native-document 1.0.122 → 1.0.123

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}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]=new i(this.$element),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,a.delete(e),e=null,this};const a=new WeakMap;i.prototype.lifecycle=function(e){const t=this.$element;a.has(t)||a.set(t,s.watch(t));const n=a.get(t);return e.mounted&&(this.$element.setAttribute("data--nd-mounted","1"),n.mounted(e.mounted)),e.unmounted&&(this.$element.setAttribute("data--nd-unmounted","1"),n.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.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 l=3,u=8,c=11,h=[];h[1]=!0,h[l]=!0,h[c]=!0,h[u]=!0;const 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")}},d=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"]),f=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`)}}}(),m=function(e,t){this.$target=t,this.$observer=e};m.prototype.__$isObservableWhen=!0,m.prototype.subscribe=function(e){return this.$observer.on(this.$target,e)},m.prototype.val=function(){return this.$observer.$currentValue===this.$target},m.prototype.isMatch=m.prototype.val,m.prototype.isActive=m.prototype.val;const b=function(e){let t=!1;return function(...n){t||(t=!0,Promise.resolve().then(()=>{e.apply(this,n),t=!1}))}},y=function(e,t){return e.replace(new RegExp(`^[${t}]+|[${t}]+$`,"g"),"")},g=(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=>g(e));if(p.isObservable(e))return t&&t(e),e;const n={};for(const t in e)Object.hasOwn(e,t)&&(n[t]=g(e[t]));return n},v=(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),{})}},w=(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)},$={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}=v(e,t);return w(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}=v(e,t);return w(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}=v(e,t);return w(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}`},C={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)},S=(e,t)=>{if(!C.has(e))return t;switch(typeof t){case"object":return C.getJson(e)??t;case"boolean":return C.getBool(e)??t;case"number":return C.getNumber(e)??t;default:return C.get(e,t)??t}},O=e=>{switch(typeof e){case"object":return C.setJson;case"boolean":return C.setBool;default:return C.set}};function A(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)?g(e):e))}Object.defineProperty(A.prototype,"$value",{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0}),A.prototype.__$isObservable=!0;const E=function(){};A.prototype.intercept=function(e){return this.$interceptor=e,this.set=this.$setWithInterceptor,this},A.prototype.triggerFirstListener=function(e){this.$firstListener(this.$currentValue,this.$previousValue,e)},A.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)},A.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)},A.prototype.triggerAll=function(e){this.triggerWatchers(e),this.triggerListeners(e)},A.prototype.triggerWatchersAndFirstListener=function(e){this.triggerWatchers(e),this.triggerFirstListener(e)},A.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=0===this.$firstListener.length?this.$firstListener:this.triggerFirstListener):this.trigger=this.triggerListeners:this.$watchers?.size?this.trigger=this.triggerWatchers:this.trigger=E},A.prototype.trigger=E;const N={action:"set"};function x(e,t=null){return new A(e,t)}A.prototype.$updateWithNewValue=function(e){e=e?.__$isObservable?e.val():e,this.$currentValue!==e&&(this.$previousValue=this.$currentValue,this.$currentValue=e,this.trigger(N),this.$previousValue=null)},A.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)},A.prototype.$basicSet=function(e){let t="function"==typeof e?e(this.$currentValue):e;this.$updateWithNewValue(t)},A.prototype.set=A.prototype.$basicSet,A.prototype.val=function(){return this.$currentValue},A.prototype.disconnectAll=function(){this.$previousValue=null,this.$currentValue=null,this.$listeners=null,this.$watchers=null,this.trigger=E},A.prototype.onCleanup=function(e){this.$cleanupListeners=this.$cleanupListeners??[],this.$cleanupListeners.push(e)},A.prototype.cleanup=function(){if(this.$cleanupListeners){for(let e=0;e<this.$cleanupListeners.length;e++)this.$cleanupListeners[e]();this.$cleanupListeners=null}f.unregister(this.$memoryId),this.disconnectAll(),delete this.$value},A.prototype.subscribe=function(e){this.$listeners=this.$listeners??[],this.$listeners.push(e),this.assocTrigger()},A.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()},A.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()},A.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)},A.prototype.unsubscribe=function(e){if(!this.$listeners)return;const t=this.$listeners.indexOf(e);t>-1&&this.$listeners.splice(t,1),this.assocTrigger()},A.prototype.check=function(e){return new o(this,e)},A.prototype.transform=A.prototype.check,A.prototype.pluck=A.prototype.check,A.prototype.is=A.prototype.check,A.prototype.select=A.prototype.check,A.prototype.get=function(e){const t=this.$currentValue[e];return p.isObservable(t)?t.val():t},A.prototype.when=function(e){return new m(this,e)},A.prototype.equals=function(e){return p.isObservable(e)?this.$currentValue===e.$currentValue:this.$currentValue===e},A.prototype.toBool=function(){return!!this.$currentValue},A.prototype.toggle=function(){this.set(!this.$currentValue)},A.prototype.reset=function(){if(!this.configs?.reset)return;const e=p.isObject(this.$initialValue)?g(this.$initialValue,e=>{e.reset()}):this.$initialValue;this.set(e)},A.prototype.toString=function(){return String(this.$currentValue)},A.prototype.valueOf=function(){return this.$currentValue},A.prototype.format=function(e,t={}){const n=this;if("function"==typeof e)return new o(n,e);const r=$[e],s=$.locale;return x.computed(()=>r(n.val(),s.val(),t),[n,s])},A.prototype.persist=function(e,t={}){let n=S(e,this.$currentValue);t.get&&(n=t.get(n)),this.set(n);const r=O(this.$currentValue);return this.subscribe(n=>{r(e,t.set?t.set(n):n)}),this};const D=x,k=x;x.useValueProperty=function(e="value"){Object.defineProperty(A.prototype,e,{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0})},x.getById=function(e){const t=f.getObservableById(parseInt(e));if(!t)throw new r("Observable.getById : No observable found with id "+e);return t},x.cleanup=function(e){e.cleanup()},x.autoCleanup=function(e=!1,t={}){if(!e)return;const{interval:n=6e4,threshold:r=100}=t;window.addEventListener("beforeunload",()=>{f.cleanup()}),setInterval(()=>f.cleanObservables(r),n)};const F=(e,t)=>{for(const n in t)t[n].bindClassProperty(e,n)},T=(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}},I=(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)}},M={string:(e,t,n)=>e.setAttribute(t,n),number:(e,t,n)=>e.setAttribute(t,n),boolean:(e,t,n)=>I(e,t,n),object:(e,t,n)=>{null!=n&&(n.handleNdAttribute?n.handleNdAttribute(e,t):"class"!==t?"style"!==t?d.has(t)&&I(e,t,n):T(e,n):F(e,n))}},P=(e,t)=>{for(const n in t){const r=n.toLowerCase();let o=t[n];M[typeof o](e,r,o)}return e};function R(e){this.$hydrate=e}R.prototype.__$isTemplateBinding=!0,String.prototype.toNdElement=function(){return j.createStaticTextNode(null,this)},Number.prototype.toNdElement=function(){return j.createStaticTextNode(null,this.toString())},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},A.prototype.toNdElement=function(){return j.createObservableNode(null,this)},o.prototype.toNdElement=A.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=j.getChild(this[t]);null!==n&&e.appendChild(n)}return e},Function.prototype.toNdElement=function(){return j.getChild(this())},R.prototype.toNdElement=function(){return j.createHydratableNode(null,this)};const _=(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,l="0s"!==i.animationDuration;a||l||o()});i.prototype.transitionOut=function(e){const t=e+"-exit",n=this.$element;return this.beforeUnmount("transition-exit",async function(){n.classes.add(t),await _(n),n.classes.remove(t)}),this},i.prototype.transitionIn=function(e){const t=e+"-enter-from",n=e+"-enter-to",r=this.$element;return r.classes.add(t),this.mounted(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{r.classes.remove(t),r.classes.add(n),_(r).then(()=>{r.classes.remove(n)})})})}),this},i.prototype.transition=function(e){return this.transitionIn(e),this.transitionOut(e),this},i.prototype.animate=function(e){const t=this.$element;return t.classes.add(e),_(t).then(()=>{t.classes.remove(e)}),this},A.prototype.handleNdAttribute=function(e,t){d.has(t)?I(e,t,this):((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)},R.prototype.handleNdAttribute=function(e,t){this.$hydrate(e,t)},A.prototype.bindClassProperty=function(e,t){e.classes.toggle(t,this.val()),this.subscribe(n=>e.classes.toggle(t,n))},m.prototype.bindClassProperty=function(e,t){e.classes.toggle(t,this.isActive()),this.subscribe(n=>e.classes.toggle(t,n))},R.prototype.bindClassProperty=function(e,t){this.$hydrate(e,t)},Boolean.prototype.bindClassProperty=function(e,t){e.classes.toggle(t,this)};let V=null;const j={createTextNode:()=>(V||(V=document.createTextNode(""),j.createTextNode=()=>V.cloneNode()),V.cloneNode()),createObservableNode:(e,t)=>{const n=j.createTextNode();return t.subscribe(e=>n.nodeValue=e),n.nodeValue=t.val(),e&&e.appendChild(n),n},createHydratableNode:(e,t)=>{const n=j.createTextNode();return t.$hydrate(n),n},createStaticTextNode:(e,t)=>{let n=j.createTextNode();return n.nodeValue=t,e&&e.appendChild(n),n},createElement:e=>document.createElement(e).cloneNode(),createFragment:e=>B("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=j.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 j.createStaticTextNode(null,e)},processAttributes:(e,t)=>{t&&P(e,t)},processAttributesDirect:P,processClassAttribute:F,processStyleAttribute:T};function L(e){const t=Reflect.construct(DocumentFragment,[],L),n=document.createComment((e||"")+" Anchor Sentinel"),r={};t.appendChild(n);const o=new MutationObserver(()=>{n.parentNode===t||n.parentNode instanceof DocumentFragment||r.connected&&r.connected(n.parentNode)});return o.observe(document,{childList:!0,subtree:!0}),t.$sentinel=n,t.$observer=o,t.$events=r,t}function B(e,t=!1){const n=new L(e);n.onConnectedOnce(e=>{t&&function(e,t){e.remove=()=>{e.append.apply(e,t.childNodes)},e.getParent=()=>t,e.appendChild=e=>{e=p.isElement(e)?e:j.getChild(e),t.appendChild(e)},e.appendChildRaw=t.appendChild.bind(t),e.append=e.appendChild,e.appendRaw=e.appendChildRaw,e.insertAtStart=e=>{e=p.isElement(e)?e:j.getChild(e),t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)},e.insertAtStartRaw=e=>{t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)},e.appendElement=e.appendChild,e.removeChildren=()=>{t.textContent=""},e.replaceContent=function(e){const n=p.isElement(e)?e:j.getChild(e);t.replaceChildren(n)},e.replaceContentRaw=function(e){t.replaceChildren(e)},e.setContent=e.replaceContent,e.insertBefore=(e,n)=>{e=p.isElement(e)?e:j.getChild(e),t.insertBefore(e,n)},e.insertBeforeRaw=(e,n)=>{t.insertBefore(e,n)},e.appendChildBefore=e.insertBefore,e.appendChildBeforeRaw=e.insertBeforeRaw,e.clear=e.remove,e.detach=e.remove,e.replaceChildren=function(){t.replaceChildren(...arguments)},e.getByIndex=e=>t.childNodes[e]}(n,e)}),n.__Anchor__=!0;const r=document.createComment("Anchor Start : "+e),o=document.createComment("/ Anchor End "+e);n.appendChild(r),n.appendChild(o),n.nativeInsertBefore=n.insertBefore,n.nativeAppendChild=n.appendChild,n.nativeAppend=n.append;const s=t?()=>!0:e=>e.firstChild===r&&e.lastChild===o,i=function(e,t,r){e!==n?s(e)&&r===o?e.append(t,r):e.insertBefore(t,r):e.nativeInsertBefore(t,r)};return n.appendElement=function(e){const t=r.parentNode;t!==n?t.insertBefore(e,o):t.nativeInsertBefore(e,o)},n.appendChild=function(e,t=null){const n=o.parentNode;n?function(e,t,n){const r=p.isElement(t)?t:j.getChild(t);i(e,r,n)}(n,e,t=t??o):DebugManager.error("Anchor","Anchor : parent not found",e)},n.appendChildRaw=function(e,t=null){const n=o.parentNode;n?i(n,e,t=t??o):DebugManager.error("Anchor","Anchor : parent not found",e)},n.getParent=()=>o.parentNode,n.append=n.appendChild,n.appendRaw=n.appendChildRaw,n.insertAtStart=function(e){e=p.isElement(e)?e:j.getChild(e),n.insertAtStartRaw(e)},n.insertAtStartRaw=function(e){const t=r.parentNode;t!==n?t.insertBefore(e,r):t.nativeInsertBefore(e,r)},n.removeChildren=function(){const e=o.parentNode;if(e===n)return;if(s(e))return void e.replaceChildren(r,o);let t,i=r.nextSibling;for(;i&&i!==o;)t=i.nextSibling,i.remove(),i=t},n.remove=function(){const e=o.parentNode;if(e===n)return;if(s(e))return n.append.apply(n,e.childNodes),void e.replaceChildren(r,o);let t,i=r.nextSibling;for(;i&&i!==o;)t=i.nextSibling,n.nativeAppend(i),i=t},n.removeWithAnchors=function(){n.removeChildren(),r.remove(),o.remove()},n.replaceContent=function(e){const t=p.isElement(e)?e:j.getChild(e);n.replaceContentRaw(t)},n.replaceContentRaw=function(e){const t=o.parentNode;t&&(s(t)?t.replaceChildren(r,childElement,o):(n.removeChildren(),t.insertBefore(childElement,o)))},n.setContent=n.replaceContent,n.setContentRaw=n.replaceContentRaw,n.insertBefore=n.appendChild,n.insertBeforeRaw=n.appendChildRaw,n.endElement=function(){return o},n.startElement=function(){return r},n.restore=function(){n.appendChild(n)},n.clear=n.remove,n.detach=n.remove,n.getByIndex=function(e){let t=r;for(let n=0;n<=e;n++){if(!t.nextSibling)return null;t=t.nextSibling}return t!==r?t:null},n}L.prototype=Object.create(DocumentFragment.prototype),L.prototype.constructor=L,L.prototype.onConnected=function(e){return this.$events.connected=e,this},L.prototype.onConnectedOnce=function(e){this.$events.connected=t=>{e(t),this.$observer.disconnect(),this.$events.connectedOnce=null}},DocumentFragment.prototype.setAttribute=()=>{};const 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 U(this.$element,t,e),this},i.prototype["onPreventStop"+e]=function(e=null){return H(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},U=function(e,t,n){return e.addEventListener(t,t=>{t.stopPropagation(),n&&n.call(e,t)}),this},H=function(e,t,n){return e.addEventListener(t,t=>{t.stopPropagation(),t.preventDefault(),n&&n.call(e,t)}),this},z={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,...z}}});let K=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 J=function(e,t=null){return e&&t?{props:e,children:t}:"object"!=typeof e||Array.isArray(e)||null===e||"Object"!==e.constructor.name||e.$hydrate?{props:t,children:e}:{props:e,children:t}},Y=e=>e?e.toNdElement():j.createTextNode(),G=(e,t,n=null)=>{let{props:r,children:o=null}=J(t,n);return j.processAttributes(e,r),j.processChildren(o,e),e};function Q(e,t=null){if(e){if(t){let n=null,r=(o,s)=>(n=document.createElement(e),r=(e,r)=>G(t(n.cloneNode()),e,r),G(t(n.cloneNode()),o,s));return(e,t)=>r(e,t)}let n=null,r=(t,o)=>(n=document.createElement(e),r=(e,t)=>G(n.cloneNode(),e,t),G(n.cloneNode(),t,o));return(e,t)=>r(e,t)}return()=>B("")}function X(e){this.$element=e,this.$classes=null,this.$styles=null,this.$attrs=null,this.$ndMethods=null}i.prototype.attach=function(e,t){if("function"==typeof t){const n=this.$element;return n.nodeCloner=n.nodeCloner||new X(n),n.nodeCloner.attach(e,t),n}return t.$hydrate(this.$element,e),this.$element},X.prototype.__$isNodeCloner=!0;const Z=(e,t,n)=>{for(const r in t)e[r]=t[r].apply(null,n);return e};X.prototype.resolve=function(){if(this.$content)return;const e=[];if(this.$ndMethods){const t=Object.keys(this.$ndMethods);if(1===t.length){const n=t[0],r=this.$ndMethods[n];e.push((e,t)=>{e.nd[n](r.bind(e,...t))})}else e.push((e,t)=>{const n=e.nd;for(const r in this.$ndMethods)n[r](this.$ndMethods[r].bind(e,...t))})}if(this.$classes){const t=Object.keys(this.$classes);if(1===t.length){const n=t[0],r=this.$classes[n];e.push((e,t)=>{r.apply(null,t).bindClassProperty(e,n)})}else{const n=this.$classes,r=t.length;e.push((e,o)=>{for(let s=0;s<r;s++){const r=t[s];n[r].apply(null,o).bindClassProperty(e,r)}})}}if(this.$styles){const t={},n=Object.keys(this.$styles);if(1===n.length){const r=n[0],o=this.$styles[r];e.push((e,n)=>{t[r]=o.apply(null,n),j.processStyleAttribute(e,t)})}else e.push((e,n)=>{j.processStyleAttribute(e,Z(t,this.$styles,n))})}if(this.$attrs){const t={},n=Object.keys(this.$attrs);if(1===n.length){const r=n[0],o=this.$attrs[r];e.push((e,n)=>{t[r]=o.apply(null,n),j.processAttributes(e,t)})}else e.push((e,n)=>{j.processAttributes(e,Z(t,this.$attrs,n))})}const t=e.length,n=this.$element;this.cloneNode=r=>{const o=n.cloneNode(!1);for(let n=0;n<t;n++)e[n](o,r);return o}},X.prototype.cloneNode=function(e){return this.$element.cloneNode(!1)},X.prototype.attach=function(e,t){return this.$ndMethods=this.$ndMethods||{},this.$ndMethods[e]=t,this},X.prototype.text=function(e){return this.$content=e,"function"==typeof e?(this.cloneNode=t=>Y(e.apply(null,t)),this):(this.cloneNode=t=>Y(t[0][e]),this)},X.prototype.attr=function(e,t){return"class"===e?(this.$classes=this.$classes||{},this.$classes[t.property]=t.value,this):"style"===e?(this.$styles=this.$styles||{},this.$styles[t.property]=t.value,this):(this.$attrs=this.$attrs||{},this.$attrs[e]=t.value,this)};function ee(e){let t=null;const n=e=>{const t=e.childNodes;let r=!!e.nodeCloner;const o=t.length;for(let e=0;e<o;e++){const o=t[e];o.nodeCloner&&(r=!0);n(o)&&(r=!0)}return r?e.nodeCloner?(e.nodeCloner.resolve(),e.dynamicCloneNode=n=>{const r=e.nodeCloner.cloneNode(n);for(let e=0;e<o;e++)r.appendChild(t[e].dynamicCloneNode(n));return r}):e.dynamicCloneNode=n=>{const r=e.cloneNode();for(let e=0;e<o;e++)r.appendChild(t[e].dynamicCloneNode(n));return r}:e.dynamicCloneNode=e.cloneNode.bind(e,!0),r};this.clone=r=>{const o=te(this);return t=e(o),t.nodeCloner||(t.nodeCloner=new X(t)),n(t),this.clone=t.dynamicCloneNode,t.dynamicCloneNode(r)};const r=(e,t)=>new R((n,r)=>{!function(e,t,n,r){n.nodeCloner=n.nodeCloner||new X(n),"value"!==t?"attach"!==t?n.nodeCloner.attr(t,{property:r,value:e}):n.nodeCloner.attach(r,e):n.nodeCloner.text(e)}(e,t,n,r)});this.style=e=>r(e,"style"),this.class=e=>r(e,"class"),this.property=e=>this.value(e),this.value=e=>r(e,"value"),this.text=this.value,this.attr=e=>r(e,"attributes"),this.attach=e=>r(e,"attach"),this.callback=this.attach}const te=e=>new Proxy(e,{get:(e,t)=>t in e||"symbol"==typeof t?e[t]:e.value(t)});function ne(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=B("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 x.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 x.getById(n)}):this.valueOf()};const re=e=>{let t=null;return(...n)=>(null!=t||(t=e(...n)),t)},oe=e=>{let t=null;return new Proxy({},{get:(n,r)=>(t||(t=e()),t[r])})},se=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 ie(e){return e instanceof Date?e:new Date(e)}function ae(e,t){const n=ie(e),r=ie(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function le(e){const t=ie(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 ce(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 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){return ue(e,(e,t)=>e<=t)}function ye(e,t=!0,n=""){return ce([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 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.every(e=>e.callback(t))}}function ve(...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 we=de,$e=fe,Ce=me,Se=be,Oe=he,Ae=pe,Ee=ge,Ne=ve;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 ke=Object.freeze({__proto__:null,all:Ee,and:ge,any:Ne,between:function(e,t){return ce([e,t],(e,[t,n])=>e>=t&&e<=n)},contains:De,createFilter:ue,createMultiSourceFilter:ce,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)&&ie(e)>ie(t)),dateBefore:e=>ue(e,(e,t)=>!(!e||!t)&&ie(e)<ie(t)),dateBetween:(e,t)=>ce([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=ie(e);return r>=ie(t)&&r<=ie(n)}),dateEquals:e=>ue(e,(e,t)=>!(!e||!t)&&ae(e,t)),dateTimeAfter:e=>ue(e,(e,t)=>!(!e||!t)&&ie(e)>ie(t)),dateTimeBefore:e=>ue(e,(e,t)=>!(!e||!t)&&ie(e)<ie(t)),dateTimeBetween:(e,t)=>ce([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=ie(e);return r>=ie(t)&&r<=ie(n)}),dateTimeEquals:e=>ue(e,(e,t)=>!(!e||!t)&&ie(e).getTime()===ie(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:he,getSecondsOfDay:le,greaterThan:de,greaterThanOrEqual:fe,gt:we,gte:$e,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:ae,lessThan:me,lessThanOrEqual:be,lt:Ce,lte:Se,match:ye,neq:Ae,not:function(e){return{dependencies:e.dependencies,callback:t=>!e.callback(t)}},notEquals:pe,notIn:function(e){return ue(e,(e,t)=>!t.includes(e))},or:ve,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)&&le(e)>le(t)),timeBefore:e=>ue(e,(e,t)=>!(!e||!t)&&le(e)<le(t)),timeBetween:(e,t)=>ce([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=le(e);return r>=le(t)&&r<=le(n)}),timeEquals:e=>ue(e,(e,t)=>{if(!e||!t)return!1;const n=ie(e),r=ie(t);return n.getHours()===r.getHours()&&n.getMinutes()===r.getMinutes()&&n.getSeconds()===r.getSeconds()}),toDate:ie});const Fe=function(e,t=null){if(!Array.isArray(e))throw new r("Observable.array : target must be an array");A.call(this,e,t)};(Fe.prototype=Object.create(A.prototype)).constructor=Fe,Fe.prototype.__$isObservableArray=!0,Object.defineProperty(Fe.prototype,"length",{get(){return this.$currentValue.length}}),["push","pop","shift","unshift","reverse","sort","splice"].forEach(e=>{Fe.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=>{Fe.prototype[e]=function(...t){return this.$currentValue[e].apply(this.$currentValue,t)}});const Te={action:"clear"};Fe.prototype.clear=function(){if(0!==this.$currentValue.length)return this.$currentValue.length=0,this.trigger(Te),!0},Fe.prototype.at=function(e){return this.$currentValue[e]},Fe.prototype.merge=function(e){this.$currentValue.push.apply(this.$currentValue,e),this.trigger({action:"merge",args:e})},Fe.prototype.count=function(e){let t=0;return this.$currentValue.forEach((n,r)=>{e(n,r)&&t++}),t},Fe.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},Fe.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)},Fe.prototype.removeItem=function(e){const t=this.$currentValue.indexOf(e);return-1===t?[]:this.remove(t)},Fe.prototype.isEmpty=function(){return 0===this.$currentValue.length},Fe.prototype.populateAndRender=function(e,t){this.trigger({action:"populate",args:[this.$currentValue,e,t]})},Fe.prototype.where=function(e){const t=this,n=[t],r={};for(const[t,o]of Object.entries(e)){const e=p.isObservable(o)?ye(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=x.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},Fe.prototype.whereSome=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.some(e=>t.callback(n[e]))}})},Fe.prototype.whereEvery=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.every(e=>t.callback(n[e]))}})},Fe.prototype.deepSubscribe=function(e){const t=b(()=>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)}},x.array=function(e=[],t=null){return new Fe(e,t)},x.batch=function(e){const t=x(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 Ie=function(e,t){A.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)})};Ie.prototype=Object.create(A.prototype),Object.defineProperty(Ie,"$value",{get(){return this.val()},set(e){this.set(e)}}),Ie.prototype.__$isObservableObject=!0,Ie.prototype.__isProxy__=!0,Ie.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)?x.json(e,t):p.isArray(e)?x.array(e,t):x(e,t));this.$observables[n]=x.array(e,t);continue}this.$observables[n]=x.array(r,t)}else p.isObservable(r)||p.isProxy(r)?this.$observables[n]=r:this.$observables[n]="object"==typeof r?x.object(r,t):x(r,t)}},Ie.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},Ie.prototype.$val=Ie.prototype.val,Ie.prototype.get=function(e){const t=this.$observables[e];return p.isObservable(t)?t.val():p.isProxy(t)?t.$value:t},Ie.prototype.$get=Ie.prototype.get,Ie.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)?x.init(t,n):x(t,n));o.set(t);continue}o.set([...i]);continue}p.isProxy(o)?o.update(i):this[r]=i}},Ie.prototype.$set=Ie.prototype.set,Ie.prototype.$updateWith=Ie.prototype.set,Ie.prototype.observables=function(){return Object.values(this.$observables)},Ie.prototype.$observables=Ie.prototype.observables,Ie.prototype.keys=function(){return Object.keys(this.$observables)},Ie.prototype.$keys=Ie.prototype.keys,Ie.prototype.clone=function(){return x.init(this.val(),this.configs)},Ie.prototype.$clone=Ie.prototype.clone,Ie.prototype.reset=function(){for(const e in this.$observables)this.$observables[e].reset()},Ie.prototype.originalSubscribe=Ie.prototype.subscribe,Ie.prototype.subscribe=function(e){const t=this.observables(),n=b(()=>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)}},Ie.prototype.configs=function(){return this.configs},Ie.prototype.update=Ie.prototype.set,x.init=function(e,t=null){return new Ie(e,t)},x.arrayOfObject=function(e){return e.map(e=>x.object(e))},x.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(x.value(r))}return t}return e},x.object=x.init,x.json=x.init,x.computed=function(e,t=[]){const n=new A(e()),o=b(()=>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 Me=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)?x.array(e,t):"object"==typeof e?x.object(e,t):x(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=x.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,l=s(i.val()),u=e=>l.set(e),c=e=>i.set(e);return i.subscribe(u),l.subscribe(c),l.destroy=()=>{i.unsubscribe(u),l.unsubscribe(c),a.delete(l),l.cleanup()},l.dispose=l.destroy,a.add(l),l},follow(e){const{observer:t,subscribers:i}=o("follow",e),a=s(t.val()),l=e=>a.set(e);return t.subscribe(l),((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(l),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=Me();return t&&t(n),n},createPersistent(e,t,n){n=n||e;const r=this.create(e,S(n,t)),o=O(t);return r.subscribe(e=>o(n,e)),r},createPersistentResettable(e,t,n){n=n||e;const r=this.createResettable(e,S(n,t)),o=O(t);r.subscribe(e=>o(n,e));const s=r.reset.bind(r);return r.reset=()=>{C.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.")}})},Pe=Me();Pe.create("locale",navigator.language.split("-")[0]||"en");const Re=new Set(["clear","push","unshift","replace"]);const _e=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=B("Show if : "+(r||""));let i=null;const a=()=>(i&&o||(i=j.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},Ve=function(e,t,n=!0){if(!p.isObservable(e))throw new r("Toggle : condition must be an Observable");const o=B("Match"),s=new Map,i=function(e){if(n&&s.has(e))return s.get(e);let r=t[e];return r?(r=j.getChild(r),p.isFragment(r)&&(r=Array.from(r.children)),n&&s.set(e,r),r):null},a=e.val(),l=i(a);return l&&o.appendChild(l),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]}})},je=function(e,t,n){if(!p.isObservable(e))throw new r("Toggle : condition must be an Observable");return Ve(e,{true:t,false:n})},Le=Q("div"),Be=Q("span"),qe=Q("label"),We=Q("p"),Ue=We,He=Q("strong"),ze=Q("h1"),Ke=Q("h2"),Je=Q("h3"),Ye=Q("h4"),Ge=Q("h5"),Qe=Q("h6"),Xe=Q("br"),Ze=Q("a"),et=Q("pre"),tt=Q("code"),nt=Q("blockquote"),rt=Q("hr"),ot=Q("em"),st=Q("small"),it=Q("mark"),at=Q("del"),lt=Q("ins"),ut=Q("sub"),ct=Q("sup"),ht=Q("abbr"),pt=Q("cite"),dt=Q("q"),ft=Q("dl"),mt=Q("dt"),bt=Q("dd"),yt=Q("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}),gt=Q("input"),vt=Q("textarea"),wt=vt,$t=Q("select"),Ct=Q("fieldset"),St=Q("option"),Ot=Q("legend"),At=Q("datalist"),Et=Q("output"),Nt=Q("progress"),xt=Q("meter"),Dt=Q("button"),kt=Q("main"),Ft=Q("section"),Tt=Q("article"),It=Q("aside"),Mt=Q("nav"),Pt=Q("figure"),Rt=Q("figcaption"),_t=Q("header"),Vt=Q("footer"),jt=Q("img"),Lt=function(e,t){return jt({src:e,...t})},Bt=Q("details"),qt=Q("summary"),Wt=Q("dialog"),Ut=Q("menu"),Ht=Q("ol"),zt=Q("ul"),Kt=Q("li"),Jt=Kt,Yt=Ht,Gt=zt,Qt=Q("audio"),Xt=Q("video"),Zt=Q("source"),en=Q("track"),tn=Q("canvas"),nn=Q("svg"),rn=Q("time"),on=Q("data"),sn=Q("address"),an=Q("kbd"),ln=Q("samp"),un=Q("var"),cn=Q("wbr"),hn=Q("caption"),pn=Q("table"),dn=Q("thead"),fn=Q("tfoot"),mn=Q("tbody"),bn=Q("tr"),yn=bn,gn=Q("th"),vn=gn,wn=gn,$n=Q("td"),Cn=$n,Sn=Q("");var On=Object.freeze({__proto__:null,Abbr:ht,Address:sn,Anchor:B,Article:Tt,Aside:It,AsyncImg:function(e,t,n,o){const s=p.isObservable(e)?e.val():e,i=Lt(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:Qt,BaseImage:jt,Blockquote:nt,Br:Xe,Button:Dt,Canvas:tn,Caption:hn,Checkbox:e=>gt({type:"checkbox",...e}),Cite:pt,Code:tt,ColorInput:e=>gt({type:"color",...e}),Data:on,Datalist:At,DateInput:e=>gt({type:"date",...e}),DateTimeInput:e=>gt({type:"datetime-local",...e}),Dd:bt,Del:at,Details:Bt,Dialog:Wt,Div:Le,Dl:ft,Dt:mt,Em:ot,EmailInput:e=>gt({type:"email",...e}),FieldSet:Ct,FigCaption:Rt,Figure:Pt,FileInput:e=>gt({type:"file",...e}),Footer:Vt,ForEach:function(e,t,o,{shouldKeepItemsInCache:s=!1}={}){const i=B("ForEach"),a=i.endElement();i.startElement();let l=new Map,u=null;const c=new Set,h=e=>{if(!s)for(const[t,n]of l.entries()){if(c.has(t))continue;const r=n.child?.deref();e&&r&&r.remove(),n.indexObserver?.cleanup(),n.child=null,n.indexObserver=null,l.delete(n.keyId),u&&u.delete(n.keyId)}},d=(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(l.has(i)){const e=l.get(i);if(e.indexObserver?.set(s),e.isNew=!1,e.child?.deref())return i;l.delete(i)}try{const n=t.length>=2?x(s):null;let o=j.getChild(t(e,n));if(!o)throw new r("ForEach child can't be null or undefined!");l.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},f=()=>{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=d(n[e],e);c.add(t)}else for(const e in n){const t=d(n[e],e);c.add(t)}if(0===c.size)return i.removeChildren(),h(),void u?.clear();h(t),u&&0!==u.size?(()=>{let e=document.createDocumentFragment();const t=Array.from(c);Array.from(u);for(const n in t){const r=t[n],o=l.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=l.get(e);if(!n)continue;const r=n.child?.deref();r&&t.appendChild(r)}e.insertBefore(t,a)})(t),u?.clear(),u=new Set([...c])};return f(),p.isObservable(e)&&e.subscribe(f),i},ForEachArray:function(e,t,n={}){const r=B("ForEach Array",n.isParentUniqueChild),o=r.endElement();r.startElement();let s=new Map,i=0;const a=t.length>=2,l=e=>{f(e),i=0},u=e=>s.get(e)?.child,c=(e,t=!0)=>{const n=s.get(e);if(n){if(t){const t=n.child;t?.remove(),s.delete(e)}n.indexObserver?.cleanup()}},h=e=>{const n=j.getChild(t(e,null));return s.set(e,{child:n,indexObserver:null}),n},p=(e,n)=>{const r=x(n),o=j.getChild(t(e,r));return s.set(e,{child:o,indexObserver:r}),o},d=(e,t)=>{const n=s.get(e);return n?(n.indexObserver?.set(t),n.child):h(e)};let f,m=h;f=a?n.shouldKeepItemsInCache?()=>{}:e=>{for(const[t,n]of s.entries())e&&e.includes(t)||c(t,!1)}:s.clear.bind(s);const b=(e,t)=>{const n=s.get(e);if(!n)return null;const r=n.child;if(!r)return null;t?t.appendChild(r):r.remove()},y={toFragment:e=>{const t=document.createDocumentFragment();for(let n=0,r=e.length;n<r;n++)t.appendChild(m(e[n],i)),i++;return t},add:e=>{r.appendChildRaw(y.toFragment(e))},replace:e=>{l(e),r.replaceContentRaw(y.toFragment(e))},set:()=>{const t=e.val();l(t),r.replaceContentRaw(y.toFragment(t))},reOrder:e=>{let t=null;const n=document.createDocumentFragment();for(const r of e)t=u(r),t&&n.appendChild(t);t=null,r.appendElementRaw(n)},removeOne:(e,t)=>{c(e,!0)},clear:e=>{r.removeChildren(),l(e)},populate:([e,t,n])=>{const o=document.createDocumentFragment();for(let r=0;r<t;r++){const t=n(r);e.push(t),o.append(m(t,r)),i++}r.appendChildRaw(o),o.replaceChildren()},unshift:e=>{r.insertAtStartRaw(y.toFragment(e))},splice:(e,t)=>{const[n,s,...i]=e;let a=null;const l=document.createDocumentFragment();if(t.length>0){let e=t[0];if(1===t.length)b(e,l);else if(t.length>1){const e=u(t[0]);a=e?.previousSibling;for(let e=0;e<t.length;e++)b(t[e],l)}}else a=o;l.replaceChildren(),i&&i.length&&a&&r.insertBeforeRaw(y.toFragment(i),a.nextSibling)},reverse:(e,t)=>{y.reOrder(t)},sort:(e,t)=>{y.reOrder(t)},remove:(e,t)=>{y.removeOne(t)},pop:(e,t)=>{y.removeOne(t)},shift:(e,t)=>{y.removeOne(t)},swap:(e,t)=>{const n=r.getParent();let o=u(t[0]),s=u(t[1]);if(!o||!s)return;const i=s.nextSibling;n.insertBefore(s,o),n.insertBefore(o,i),o=null,s=null}};y.merge=y.add,y.push=y.add;const g=(e,t,n={})=>{((e=null)=>{m=Re.has(e)?a?p:h:s.size?d:a?p:h})(n.action),y[n.action]&&y[n.action](n.args,n.result),((e,t=0)=>{if(!a)return;let n=t;for(let r=t,o=e?.length;r<o;r++){const t=s.get(e[r]);t&&(t.indexObserver?.set(n),n++)}})(e,0)};return e.val().length&&g(e.val(),0,{action:null}),e.subscribe(g),r},Form:yt,Fragment:Sn,H1:ze,H2:Ke,H3:Je,H4:Ye,H5:Ge,H6:Qe,Header:_t,HiddenInput:e=>gt({type:"hidden",...e}),HideIf:function(e,t,n){const r=x(!e.val());return e.subscribe(e=>r.set(!e)),_e(r,t,n)},HideIfNot:function(e,t,n){return _e(e,t,n)},Hr:rt,Img:Lt,Input:gt,Ins:lt,Kbd:an,Label:qe,LazyImg:function(e,t){return Lt(e,{...t,loading:"lazy"})},Legend:Ot,Li:Jt,Link:Ze,ListItem:Kt,Main:kt,Mark:it,Match:Ve,Menu:Ut,Meter:xt,MonthInput:e=>gt({type:"month",...e}),NativeDocumentFragment:B,Nav:Mt,NumberInput:e=>gt({type:"number",...e}),Ol:Yt,Option:St,OrderedList:Ht,Output:Et,P:We,Paragraph:Ue,PasswordInput:e=>gt({type:"password",...e}),Pre:et,Progress:Nt,Quote:dt,Radio:e=>gt({type:"radio",...e}),RangeInput:e=>gt({type:"range",...e}),ReadonlyInput:e=>gt({readonly:!0,...e}),Samp:ln,SearchInput:e=>gt({type:"search",...e}),Section:Ft,Select:$t,ShowIf:_e,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 _e(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 _e(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)=>Dt(e,{type:"button",...t}),Small:st,Source:Zt,Span:Be,Strong:He,Sub:ut,SubmitButton:(e,t)=>Dt(e,{type:"submit",...t}),Summary:qt,Sup:ct,Svg:nn,Switch:je,TBody:mn,TBodyCell:Cn,TFoot:fn,TFootCell:wn,THead:dn,THeadCell:vn,TRow:yn,Table:pn,Td:$n,TelInput:e=>gt({type:"tel",...e}),TextArea:vt,TextInput:wt,Th:gn,Time:rn,TimeInput:e=>gt({type:"time",...e}),Tr:bn,Track:en,Ul:Gt,UnorderedList:zt,UrlInput:e=>gt({type:"url",...e}),Var:un,Video:Xt,Wbr:cn,WeekInput:e=>gt({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,je(e,t,n)),toNdElement:()=>je(e,t,n)}},createPortal:function(e,{parent:t,name:n="unnamed"}={}){const r=B("Portal "+n);return r.appendChild(j.getChild(e)),(t||document.body).appendChild(r),r}});const An={};function En(e,t,n={}){e="/"+y(e,"/").replace(/\/+/,"/");let r=null,o=n.name||null;const s=n.middlewares||[],i=n.shouldRebuild||!1,a=n.with||{},l=n.layout||null,u={},c=[],h=e=>{if(!e)return null;const[t,n]=e.split(":");let r=a[t];return!r&&n&&(r=An[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?(u[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=()=>l,this.match=function(e){e="/"+y(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 Nn extends Error{constructor(e,t){super(e),this.context=t}}const xn=(e,t)=>{const n=[];return e.forEach(e=>{n.push(y(e.suffix,"/"))}),n.push(y(t,"/")),n.join("/")},Dn=(e,t)=>{const n=[];return e.forEach(e=>{e.options.middlewares&&n.push(...e.options.middlewares)}),t&&n.push(...t),n},kn=(e,t)=>{const n=[];return e.forEach(e=>{e.options?.name&&n.push(e.options.name)}),t&&n.push(t),n.join(".")},Fn=e=>{for(let t=e.length-1;t>=0;t--)if(e[t]?.options?.layout)return e[t].options.layout;return null};function Tn(){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:l}=e[o];r(l)},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:l}=this.resolve(n);l!==o()&&(e.splice(t+1),e.push({route:s,params:i,query:a,path:l}),t++,r(l))},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 In(){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 Mn(){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 Pn(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=B(t),r.appendChild(e)),o.set(e,r),r},l=()=>{p.isAnchor(i)&&i.remove()},u=()=>{t.nodeValue="",l(),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 l(),void e.replaceContent(h)}return u(),s=p,a(h,i).replaceContent(h),void t.appendChild(s)}u();const d=a(h,i);s=j.getChild(e(d)),r.set(h,s),t.appendChild(s)})(h,e,0,o);let p=c(e);u(),t.appendChild(p),i=e},d=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(d),d(e.currentState()),t}const Rn="default";function _n(e={}){const t=[],r={},o=[],s=[],i={route:null,params:null,query:null,path:null,hash:null};if("hash"===e.mode)Tn.apply(this,[]);else if("history"===e.mode)In.apply(this,[]);else{if("memory"!==e.mode)throw new Nn("Invalid router mode "+e.mode);Mn.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 En(xn(o,e),n,{...s,middlewares:Dn(o,s?.middlewares||[]),name:s?.name?kn(o,s.name):null,layout:s?.layout||Fn(o)});return t.push(i),i.name()&&(r[i.name()]=i),this},this.group=function(e,t,n){if(!p.isFunction(n))throw new Nn("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 Nn(`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 Nn(`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="/"+y(n,"/");let i,a=null;for(const e of t)if(i=e.match(s),i){a=e;break}if(!a)throw new Nn(`Route not found for url: ${n}`);const l={};if(o){const e=new URLSearchParams(o).entries();for(const[t,n]of e)l[t]=n}return{route:a,params:i,query:l,path:e}},this.subscribe=function(e){if(!p.isFunction(e))throw new Nn("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 l={...i},u=e=>{if(s++,!(s>=o.length))return o[s](e||l,u)};return o[s](l,u)}}function Vn(e,t){const{to:n,href:r,...o}=e;if(r){const e=_n.get();return Ze({...o,href:r},t).nd.onPreventClick(()=>{e.push(r)})}const s="string"==typeof n?{name:n}:n,i=s.router||Rn,a=_n.get(i);if(!a)throw new Nn('Router not found "'+i+'" for link "'+s.name+'"');const l=a.generateUrl(s.name,s.params,s.query);return Ze({...o,href:l},t).nd.onPreventClick(()=>{a.push(l)})}_n.routers={},_n.create=function(e,t){if(!p.isFunction(t))throw n.error("Router","Callback must be a function"),new Nn("Callback must be a function");const r=new _n(e);return _n.routers[e.name||Rn]=r,t(r),r.init(e.entry),r.mount=function(e){if(p.isString(e)){const t=document.querySelector(e);if(!t)throw new Nn(`Container not found for selector: ${e}`);e=t}else if(!p.isElement(e))throw new Nn("Container must be a string or an Element");return Pn(r,e)},r},_n.get=function(e){const t=_n.routers[e||Rn];if(!t)throw new Nn(`Router not found for name: ${e}`);return t},_n.push=function(e,t=null){return _n.get(t).push(e)},_n.replace=function(e,t=null){return _n.get(t).replace(e)},_n.forward=function(e=null){return _n.get(e).forward()},_n.back=function(e=null){return _n.get(e).back()},_n.redirectTo=function(e,t=null,n=null){let r=e;const o=_n.get(n);return o.resolve({name:e,params:t})&&(r={name:e,params:t}),console.log(r),o.push(r)},Vn.blank=function(e,t){return Ze({...e,target:"_blank"},t)};var jn=Object.freeze({__proto__:null,Link:Vn,RouteParamPatterns:An,Router:_n});var Ln=Object.freeze({__proto__:null,memoize:e=>se(e),once:e=>oe(e),singleton:e=>re(e)}),Bn=Object.freeze({__proto__:null,Cache:Ln,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 l=(a.headers.get("content-type")||"").includes("application/json")?await a.json():await a.text();if(!a.ok){const e=new Error(l?.message||a.statusText);throw e.status=a.status,e.data=l,e}return l},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:ke});return e.$=D,e.ElementCreator=j,e.HtmlElementWrapper=Q,e.NDElement=i,e.Observable=x,e.PluginsManager=null,e.SingletonView=ne,e.Store=Pe,e.StoreFactory=Me,e.TemplateCloner=ee,e.Validator=p,e.autoMemoize=se,e.autoOnce=oe,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=Y,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=On,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=J,e.obs=k,e.once=re,e.router=jn,e.useCache=function(e){let t=null,n=r=>{t=new ee(e);const o=t.clone(r);return n=t.clone,o};return e.length<2?(...e)=>n(e):(e,t,...r)=>n([e,t,...r])},e.useSingleton=function(e){let t=null;return function(...n){return t||(t=new ne(e)),t.render(n)}},e.utils=Bn,e.withValidation=K,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.__$Observable=!0,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}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]=new i(this.$element),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,a.delete(e),e=null,this};const a=new WeakMap;i.prototype.lifecycle=function(e){const t=this.$element;a.has(t)||a.set(t,s.watch(t));const n=a.get(t);return e.mounted&&(this.$element.setAttribute("data--nd-mounted","1"),n.mounted(e.mounted)),e.unmounted&&(this.$element.setAttribute("data--nd-unmounted","1"),n.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.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 l=3,u=8,c=11,h=[];h[1]=!0,h[l]=!0,h[c]=!0,h[u]=!0;const 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")}},d=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"]),f=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`)}}}(),m=function(e,t){this.$target=t,this.$observer=e};m.prototype.__$Observable=!0,m.prototype.__$isObservableWhen=!0,m.prototype.subscribe=function(e){return this.$observer.on(this.$target,e)},m.prototype.val=function(){return this.$observer.$currentValue===this.$target},m.prototype.isMatch=m.prototype.val,m.prototype.isActive=m.prototype.val;const b=function(e){let t=!1;return function(...n){t||(t=!0,Promise.resolve().then(()=>{e.apply(this,n),t=!1}))}},y=function(e,t){return e.replace(new RegExp(`^[${t}]+|[${t}]+$`,"g"),"")},g=(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=>g(e));if(p.isObservable(e))return t&&t(e),e;const n={};for(const t in e)Object.hasOwn(e,t)&&(n[t]=g(e[t]));return n},v=(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),{})}},w=(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)},$={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}=v(e,t);return w(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}=v(e,t);return w(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}=v(e,t);return w(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}`},C={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)},S=(e,t)=>{if(!C.has(e))return t;switch(typeof t){case"object":return C.getJson(e)??t;case"boolean":return C.getBool(e)??t;case"number":return C.getNumber(e)??t;default:return C.get(e,t)??t}},O=e=>{switch(typeof e){case"object":return C.setJson;case"boolean":return C.setBool;default:return C.set}};function A(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)?g(e):e))}Object.defineProperty(A.prototype,"$value",{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0}),A.prototype.__$Observable=!0,A.prototype.__$isObservable=!0;const E=function(){};A.prototype.intercept=function(e){return this.$interceptor=e,this.set=this.$setWithInterceptor,this},A.prototype.triggerFirstListener=function(e){this.$firstListener(this.$currentValue,this.$previousValue,e)},A.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)},A.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)},A.prototype.triggerAll=function(e){this.triggerWatchers(e),this.triggerListeners(e)},A.prototype.triggerWatchersAndFirstListener=function(e){this.triggerWatchers(e),this.triggerFirstListener(e)},A.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=0===this.$firstListener.length?this.$firstListener:this.triggerFirstListener):this.trigger=this.triggerListeners:this.$watchers?.size?this.trigger=this.triggerWatchers:this.trigger=E},A.prototype.trigger=E;const N={action:"set"};function x(e,t=null){return new A(e,t)}A.prototype.$updateWithNewValue=function(e){e=e?.__$isObservable?e.val():e,this.$currentValue!==e&&(this.$previousValue=this.$currentValue,this.$currentValue=e,this.trigger(N),this.$previousValue=null)},A.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)},A.prototype.$basicSet=function(e){let t="function"==typeof e?e(this.$currentValue):e;this.$updateWithNewValue(t)},A.prototype.set=A.prototype.$basicSet,A.prototype.val=function(){return this.$currentValue},A.prototype.disconnectAll=function(){this.$previousValue=null,this.$currentValue=null,this.$listeners=null,this.$watchers=null,this.trigger=E},A.prototype.onCleanup=function(e){this.$cleanupListeners=this.$cleanupListeners??[],this.$cleanupListeners.push(e)},A.prototype.cleanup=function(){if(this.$cleanupListeners){for(let e=0;e<this.$cleanupListeners.length;e++)this.$cleanupListeners[e]();this.$cleanupListeners=null}f.unregister(this.$memoryId),this.disconnectAll(),delete this.$value},A.prototype.subscribe=function(e){this.$listeners=this.$listeners??[],this.$listeners.push(e),this.assocTrigger()},A.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()},A.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()},A.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)},A.prototype.unsubscribe=function(e){if(!this.$listeners)return;const t=this.$listeners.indexOf(e);t>-1&&this.$listeners.splice(t,1),this.assocTrigger()},A.prototype.check=function(e){return new o(this,e)},A.prototype.transform=A.prototype.check,A.prototype.pluck=A.prototype.check,A.prototype.is=A.prototype.check,A.prototype.select=A.prototype.check,A.prototype.get=function(e){const t=this.$currentValue[e];return p.isObservable(t)?t.val():t},A.prototype.when=function(e){return new m(this,e)},A.prototype.equals=function(e){return p.isObservable(e)?this.$currentValue===e.$currentValue:this.$currentValue===e},A.prototype.toBool=function(){return!!this.$currentValue},A.prototype.toggle=function(){this.set(!this.$currentValue)},A.prototype.reset=function(){if(!this.configs?.reset)return;const e=p.isObject(this.$initialValue)?g(this.$initialValue,e=>{e.reset()}):this.$initialValue;this.set(e)},A.prototype.toString=function(){return String(this.$currentValue)},A.prototype.valueOf=function(){return this.$currentValue},A.prototype.format=function(e,t={}){const n=this;if("function"==typeof e)return new o(n,e);const r=$[e],s=$.locale;return x.computed(()=>r(n.val(),s.val(),t),[n,s])},A.prototype.persist=function(e,t={}){let n=S(e,this.$currentValue);t.get&&(n=t.get(n)),this.set(n);const r=O(this.$currentValue);return this.subscribe(n=>{r(e,t.set?t.set(n):n)}),this};const D=x,k=x;x.useValueProperty=function(e="value"){Object.defineProperty(A.prototype,e,{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0})},x.getById=function(e){const t=f.getObservableById(parseInt(e));if(!t)throw new r("Observable.getById : No observable found with id "+e);return t},x.cleanup=function(e){e.cleanup()},x.autoCleanup=function(e=!1,t={}){if(!e)return;const{interval:n=6e4,threshold:r=100}=t;window.addEventListener("beforeunload",()=>{f.cleanup()}),setInterval(()=>f.cleanObservables(r),n)};const F=(e,t)=>{for(const n in t){const r=t[n];r.__$Observable?(e.classes.toggle(n,r.val()),r.subscribe(t=>e.classes.toggle(n,t))):r.$hydrate?r.$hydrate(e,n):e.classes.toggle(n,r)}},T=(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}},_=(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)}},I={string:(e,t,n)=>e.setAttribute(t,n),number:(e,t,n)=>e.setAttribute(t,n),boolean:(e,t,n)=>_(e,t,n),object:(e,t,n)=>{null!=n&&(n.handleNdAttribute?n.handleNdAttribute(e,t):"class"!==t?"style"!==t?d.has(t)&&_(e,t,n):T(e,n):F(e,n))}},M=(e,t)=>{for(const n in t){const r=n.toLowerCase();let o=t[n];I[typeof o](e,r,o)}return e};function R(e){this.$hydrate=e}R.prototype.__$isTemplateBinding=!0,String.prototype.toNdElement=function(){return j.createStaticTextNode(null,this)},Number.prototype.toNdElement=function(){return j.createStaticTextNode(null,this.toString())},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},A.prototype.toNdElement=function(){return j.createObservableNode(null,this)},o.prototype.toNdElement=A.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=j.getChild(this[t]);null!==n&&e.appendChild(n)}return e},Function.prototype.toNdElement=function(){return j.getChild(this())},R.prototype.toNdElement=function(){return j.createHydratableNode(null,this)};const P=(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,l="0s"!==i.animationDuration;a||l||o()});i.prototype.transitionOut=function(e){const t=e+"-exit",n=this.$element;return this.beforeUnmount("transition-exit",async function(){n.classes.add(t),await P(n),n.classes.remove(t)}),this},i.prototype.transitionIn=function(e){const t=e+"-enter-from",n=e+"-enter-to",r=this.$element;return r.classes.add(t),this.mounted(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{r.classes.remove(t),r.classes.add(n),P(r).then(()=>{r.classes.remove(n)})})})}),this},i.prototype.transition=function(e){return this.transitionIn(e),this.transitionOut(e),this},i.prototype.animate=function(e){const t=this.$element;return t.classes.add(e),P(t).then(()=>{t.classes.remove(e)}),this},A.prototype.handleNdAttribute=function(e,t){d.has(t)?_(e,t,this):((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)},R.prototype.handleNdAttribute=function(e,t){this.$hydrate(e,t)};let V=null;const j={createTextNode:()=>(V||(V=document.createTextNode(""),j.createTextNode=()=>V.cloneNode()),V.cloneNode()),createObservableNode:(e,t)=>{const n=j.createTextNode();return t.subscribe(e=>n.nodeValue=e),n.nodeValue=t.val(),e&&e.appendChild(n),n},createHydratableNode:(e,t)=>{const n=j.createTextNode();return t.$hydrate(n),n},createStaticTextNode:(e,t)=>{let n=j.createTextNode();return n.nodeValue=t,e&&e.appendChild(n),n},createElement:e=>document.createElement(e).cloneNode(),createFragment:e=>B("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=j.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 j.createStaticTextNode(null,e)},processAttributes:(e,t)=>{t&&M(e,t)},processAttributesDirect:M,processClassAttribute:F,processStyleAttribute:T};function L(e){const t=Reflect.construct(DocumentFragment,[],L),n=document.createComment((e||"")+" Anchor Sentinel"),r={};t.appendChild(n);const o=new MutationObserver(()=>{n.parentNode===t||n.parentNode instanceof DocumentFragment||r.connected&&r.connected(n.parentNode)});return o.observe(document,{childList:!0,subtree:!0}),t.$sentinel=n,t.$observer=o,t.$events=r,t}function B(e,t=!1){const n=new L(e);n.onConnectedOnce(e=>{t&&function(e,t){e.remove=()=>{e.append.apply(e,t.childNodes)},e.getParent=()=>t,e.appendChild=e=>{e=p.isElement(e)?e:j.getChild(e),t.appendChild(e)},e.appendChildRaw=t.appendChild.bind(t),e.append=e.appendChild,e.appendRaw=e.appendChildRaw,e.insertAtStart=e=>{e=p.isElement(e)?e:j.getChild(e),t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)},e.insertAtStartRaw=e=>{t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)},e.appendElement=e.appendChild,e.removeChildren=()=>{t.textContent=""},e.replaceContent=function(e){const n=p.isElement(e)?e:j.getChild(e);t.replaceChildren(n)},e.replaceContentRaw=function(e){t.replaceChildren(e)},e.setContent=e.replaceContent,e.insertBefore=(e,n)=>{e=p.isElement(e)?e:j.getChild(e),t.insertBefore(e,n)},e.insertBeforeRaw=(e,n)=>{t.insertBefore(e,n)},e.appendChildBefore=e.insertBefore,e.appendChildBeforeRaw=e.insertBeforeRaw,e.clear=e.remove,e.detach=e.remove,e.replaceChildren=function(){t.replaceChildren(...arguments)},e.getByIndex=e=>t.childNodes[e]}(n,e)}),n.__Anchor__=!0;const r=document.createComment("Anchor Start : "+e),o=document.createComment("/ Anchor End "+e);n.appendChild(r),n.appendChild(o),n.nativeInsertBefore=n.insertBefore,n.nativeAppendChild=n.appendChild,n.nativeAppend=n.append;const s=t?()=>!0:e=>e.firstChild===r&&e.lastChild===o,i=function(e,t,r){e!==n?s(e)&&r===o?e.append(t,r):e.insertBefore(t,r):e.nativeInsertBefore(t,r)};return n.appendElement=function(e){const t=r.parentNode;t!==n?t.insertBefore(e,o):t.nativeInsertBefore(e,o)},n.appendChild=function(e,t=null){const n=o.parentNode;n?function(e,t,n){const r=p.isElement(t)?t:j.getChild(t);i(e,r,n)}(n,e,t=t??o):DebugManager.error("Anchor","Anchor : parent not found",e)},n.appendChildRaw=function(e,t=null){const n=o.parentNode;n?i(n,e,t=t??o):DebugManager.error("Anchor","Anchor : parent not found",e)},n.getParent=()=>o.parentNode,n.append=n.appendChild,n.appendRaw=n.appendChildRaw,n.insertAtStart=function(e){e=p.isElement(e)?e:j.getChild(e),n.insertAtStartRaw(e)},n.insertAtStartRaw=function(e){const t=r.parentNode;t!==n?t.insertBefore(e,r):t.nativeInsertBefore(e,r)},n.removeChildren=function(){const e=o.parentNode;if(e===n)return;if(s(e))return void e.replaceChildren(r,o);let t,i=r.nextSibling;for(;i&&i!==o;)t=i.nextSibling,i.remove(),i=t},n.remove=function(){const e=o.parentNode;if(e===n)return;if(s(e))return n.append.apply(n,e.childNodes),void e.replaceChildren(r,o);let t,i=r.nextSibling;for(;i&&i!==o;)t=i.nextSibling,n.nativeAppend(i),i=t},n.removeWithAnchors=function(){n.removeChildren(),r.remove(),o.remove()},n.replaceContent=function(e){const t=p.isElement(e)?e:j.getChild(e);n.replaceContentRaw(t)},n.replaceContentRaw=function(e){const t=o.parentNode;t&&(s(t)?t.replaceChildren(r,childElement,o):(n.removeChildren(),t.insertBefore(childElement,o)))},n.setContent=n.replaceContent,n.setContentRaw=n.replaceContentRaw,n.insertBefore=n.appendChild,n.insertBeforeRaw=n.appendChildRaw,n.endElement=function(){return o},n.startElement=function(){return r},n.restore=function(){n.appendChild(n)},n.clear=n.remove,n.detach=n.remove,n.getByIndex=function(e){let t=r;for(let n=0;n<=e;n++){if(!t.nextSibling)return null;t=t.nextSibling}return t!==r?t:null},n}L.prototype=Object.create(DocumentFragment.prototype),L.prototype.constructor=L,L.prototype.onConnected=function(e){return this.$events.connected=e,this},L.prototype.onConnectedOnce=function(e){this.$events.connected=t=>{e(t),this.$observer.disconnect(),this.$events.connectedOnce=null}},DocumentFragment.prototype.setAttribute=()=>{};const 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 U(this.$element,t,e),this},i.prototype["onPreventStop"+e]=function(e=null){return H(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},U=function(e,t,n){return e.addEventListener(t,t=>{t.stopPropagation(),n&&n.call(e,t)}),this},H=function(e,t,n){return e.addEventListener(t,t=>{t.stopPropagation(),t.preventDefault(),n&&n.call(e,t)}),this},z={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,...z}}});let K=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 J=function(e,t=null){return e&&t?{props:e,children:t}:"object"!=typeof e||Array.isArray(e)||null===e||"Object"!==e.constructor.name||e.$hydrate?{props:t,children:e}:{props:e,children:t}},Y=e=>e?e.toNdElement():j.createTextNode(),G=(e,t,n=null)=>{let{props:r,children:o=null}=J(t,n);return j.processAttributes(e,r),j.processChildren(o,e),e};function Q(e,t=null){if(e){if(t){let n=null,r=(o,s)=>(n=document.createElement(e),r=(e,r)=>G(t(n.cloneNode()),e,r),G(t(n.cloneNode()),o,s));return(e,t)=>r(e,t)}let n=null,r=(t,o)=>(n=document.createElement(e),r=(e,t)=>G(n.cloneNode(),e,t),G(n.cloneNode(),t,o));return(e,t)=>r(e,t)}return()=>B("")}function X(e){this.$element=e,this.$classes=null,this.$styles=null,this.$attrs=null,this.$ndMethods=null}i.prototype.attach=function(e,t){if("function"==typeof t){const n=this.$element;return n.nodeCloner=n.nodeCloner||new X(n),n.nodeCloner.attach(e,t),n}return t.$hydrate(this.$element,e),this.$element},X.prototype.__$isNodeCloner=!0;const Z=(e,t,n)=>{for(const r in t)e[r]=t[r].apply(null,n);return e};X.prototype.resolve=function(){if(this.$content)return;const e=[];if(this.$ndMethods){const t=Object.keys(this.$ndMethods);if(1===t.length){const n=t[0],r=this.$ndMethods[n];e.push((e,t)=>{e.nd[n](r.bind(e,...t))})}else e.push((e,t)=>{const n=e.nd;for(const r in this.$ndMethods)n[r](this.$ndMethods[r].bind(e,...t))})}if(this.$classes){const t={},n=Object.keys(this.$classes);if(1===n.length){const r=n[0],o=this.$classes[r];e.push((e,n)=>{t[r]=o.apply(null,n),j.processClassAttribute(e,t)})}else e.push((e,n)=>{j.processClassAttribute(e,Z(t,this.$classes,n))})}if(this.$styles){const t={},n=Object.keys(this.$styles);if(1===n.length){const r=n[0],o=this.$styles[r];e.push((e,n)=>{t[r]=o.apply(null,n),j.processStyleAttribute(e,t)})}else e.push((e,n)=>{j.processStyleAttribute(e,Z(t,this.$styles,n))})}if(this.$attrs){const t={},n=Object.keys(this.$attrs);if(1===n.length){const r=n[0],o=this.$attrs[r];e.push((e,n)=>{t[r]=o.apply(null,n),j.processAttributes(e,t)})}else e.push((e,n)=>{j.processAttributes(e,Z(t,this.$attrs,n))})}const t=e.length,n=this.$element;this.cloneNode=r=>{const o=n.cloneNode(!1);for(let n=0;n<t;n++)e[n](o,r);return o}},X.prototype.cloneNode=function(e){return this.$element.cloneNode(!1)},X.prototype.attach=function(e,t){return this.$ndMethods=this.$ndMethods||{},this.$ndMethods[e]=t,this},X.prototype.text=function(e){return this.$content=e,"function"==typeof e?(this.cloneNode=t=>Y(e.apply(null,t)),this):(this.cloneNode=t=>Y(t[0][e]),this)},X.prototype.attr=function(e,t){return"class"===e?(this.$classes=this.$classes||{},this.$classes[t.property]=t.value,this):"style"===e?(this.$styles=this.$styles||{},this.$styles[t.property]=t.value,this):(this.$attrs=this.$attrs||{},this.$attrs[e]=t.value,this)};function ee(e){let t=null;const n=e=>{const t=e.childNodes;let r=!!e.nodeCloner;const o=t.length;for(let e=0;e<o;e++){const o=t[e];o.nodeCloner&&(r=!0);n(o)&&(r=!0)}return r?e.nodeCloner?(e.nodeCloner.resolve(),e.dynamicCloneNode=n=>{const r=e.nodeCloner.cloneNode(n);for(let e=0;e<o;e++)r.appendChild(t[e].dynamicCloneNode(n));return r}):e.dynamicCloneNode=n=>{const r=e.cloneNode();for(let e=0;e<o;e++)r.appendChild(t[e].dynamicCloneNode(n));return r}:e.dynamicCloneNode=e.cloneNode.bind(e,!0),r};this.clone=r=>{const o=te(this);return t=e(o),t.nodeCloner||(t.nodeCloner=new X(t)),n(t),this.clone=t.dynamicCloneNode,t.dynamicCloneNode(r)};const r=(e,t)=>new R((n,r)=>{!function(e,t,n,r){n.nodeCloner=n.nodeCloner||new X(n),"value"!==t?"attach"!==t?n.nodeCloner.attr(t,{property:r,value:e}):n.nodeCloner.attach(r,e):n.nodeCloner.text(e)}(e,t,n,r)});this.style=e=>r(e,"style"),this.class=e=>r(e,"class"),this.property=e=>this.value(e),this.value=e=>r(e,"value"),this.text=this.value,this.attr=e=>r(e,"attributes"),this.attach=e=>r(e,"attach"),this.callback=this.attach}const te=e=>new Proxy(e,{get:(e,t)=>t in e||"symbol"==typeof t?e[t]:e.value(t)});function ne(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=B("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 x.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 x.getById(n)}):this.valueOf()};const re=e=>{let t=null;return(...n)=>(null!=t||(t=e(...n)),t)},oe=e=>{let t=null;return new Proxy({},{get:(n,r)=>(t||(t=e()),t[r])})},se=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 ie(e){return e instanceof Date?e:new Date(e)}function ae(e,t){const n=ie(e),r=ie(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function le(e){const t=ie(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 ce(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 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){return ue(e,(e,t)=>e<=t)}function ye(e,t=!0,n=""){return ce([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 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.every(e=>e.callback(t))}}function ve(...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 we=de,$e=fe,Ce=me,Se=be,Oe=he,Ae=pe,Ee=ge,Ne=ve;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 ke=Object.freeze({__proto__:null,all:Ee,and:ge,any:Ne,between:function(e,t){return ce([e,t],(e,[t,n])=>e>=t&&e<=n)},contains:De,createFilter:ue,createMultiSourceFilter:ce,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)&&ie(e)>ie(t)),dateBefore:e=>ue(e,(e,t)=>!(!e||!t)&&ie(e)<ie(t)),dateBetween:(e,t)=>ce([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=ie(e);return r>=ie(t)&&r<=ie(n)}),dateEquals:e=>ue(e,(e,t)=>!(!e||!t)&&ae(e,t)),dateTimeAfter:e=>ue(e,(e,t)=>!(!e||!t)&&ie(e)>ie(t)),dateTimeBefore:e=>ue(e,(e,t)=>!(!e||!t)&&ie(e)<ie(t)),dateTimeBetween:(e,t)=>ce([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=ie(e);return r>=ie(t)&&r<=ie(n)}),dateTimeEquals:e=>ue(e,(e,t)=>!(!e||!t)&&ie(e).getTime()===ie(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:he,getSecondsOfDay:le,greaterThan:de,greaterThanOrEqual:fe,gt:we,gte:$e,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:ae,lessThan:me,lessThanOrEqual:be,lt:Ce,lte:Se,match:ye,neq:Ae,not:function(e){return{dependencies:e.dependencies,callback:t=>!e.callback(t)}},notEquals:pe,notIn:function(e){return ue(e,(e,t)=>!t.includes(e))},or:ve,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)&&le(e)>le(t)),timeBefore:e=>ue(e,(e,t)=>!(!e||!t)&&le(e)<le(t)),timeBetween:(e,t)=>ce([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=le(e);return r>=le(t)&&r<=le(n)}),timeEquals:e=>ue(e,(e,t)=>{if(!e||!t)return!1;const n=ie(e),r=ie(t);return n.getHours()===r.getHours()&&n.getMinutes()===r.getMinutes()&&n.getSeconds()===r.getSeconds()}),toDate:ie});const Fe=function(e,t=null){if(!Array.isArray(e))throw new r("Observable.array : target must be an array");A.call(this,e,t)};(Fe.prototype=Object.create(A.prototype)).constructor=Fe,Fe.prototype.__$isObservableArray=!0,Object.defineProperty(Fe.prototype,"length",{get(){return this.$currentValue.length}}),["push","pop","shift","unshift","reverse","sort","splice"].forEach(e=>{Fe.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=>{Fe.prototype[e]=function(...t){return this.$currentValue[e].apply(this.$currentValue,t)}});const Te={action:"clear"};Fe.prototype.clear=function(){if(0!==this.$currentValue.length)return this.$currentValue.length=0,this.trigger(Te),!0},Fe.prototype.at=function(e){return this.$currentValue[e]},Fe.prototype.merge=function(e){this.$currentValue.push.apply(this.$currentValue,e),this.trigger({action:"merge",args:e})},Fe.prototype.count=function(e){let t=0;return this.$currentValue.forEach((n,r)=>{e(n,r)&&t++}),t},Fe.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},Fe.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)},Fe.prototype.removeItem=function(e){const t=this.$currentValue.indexOf(e);return-1===t?[]:this.remove(t)},Fe.prototype.isEmpty=function(){return 0===this.$currentValue.length},Fe.prototype.populateAndRender=function(e,t){this.trigger({action:"populate",args:[this.$currentValue,e,t]})},Fe.prototype.where=function(e){const t=this,n=[t],r={};for(const[t,o]of Object.entries(e)){const e=p.isObservable(o)?ye(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=x.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},Fe.prototype.whereSome=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.some(e=>t.callback(n[e]))}})},Fe.prototype.whereEvery=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.every(e=>t.callback(n[e]))}})},Fe.prototype.deepSubscribe=function(e){const t=b(()=>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)}},x.array=function(e=[],t=null){return new Fe(e,t)},x.batch=function(e){const t=x(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 _e=function(e,t){A.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)})};_e.prototype=Object.create(A.prototype),Object.defineProperty(_e,"$value",{get(){return this.val()},set(e){this.set(e)}}),_e.prototype.__$isObservableObject=!0,_e.prototype.__isProxy__=!0,_e.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)?x.json(e,t):p.isArray(e)?x.array(e,t):x(e,t));this.$observables[n]=x.array(e,t);continue}this.$observables[n]=x.array(r,t)}else p.isObservable(r)||p.isProxy(r)?this.$observables[n]=r:this.$observables[n]="object"==typeof r?x.object(r,t):x(r,t)}},_e.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},_e.prototype.$val=_e.prototype.val,_e.prototype.get=function(e){const t=this.$observables[e];return p.isObservable(t)?t.val():p.isProxy(t)?t.$value:t},_e.prototype.$get=_e.prototype.get,_e.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)?x.init(t,n):x(t,n));o.set(t);continue}o.set([...i]);continue}p.isProxy(o)?o.update(i):this[r]=i}},_e.prototype.$set=_e.prototype.set,_e.prototype.$updateWith=_e.prototype.set,_e.prototype.observables=function(){return Object.values(this.$observables)},_e.prototype.$observables=_e.prototype.observables,_e.prototype.keys=function(){return Object.keys(this.$observables)},_e.prototype.$keys=_e.prototype.keys,_e.prototype.clone=function(){return x.init(this.val(),this.configs)},_e.prototype.$clone=_e.prototype.clone,_e.prototype.reset=function(){for(const e in this.$observables)this.$observables[e].reset()},_e.prototype.originalSubscribe=_e.prototype.subscribe,_e.prototype.subscribe=function(e){const t=this.observables(),n=b(()=>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)}},_e.prototype.configs=function(){return this.configs},_e.prototype.update=_e.prototype.set,x.init=function(e,t=null){return new _e(e,t)},x.arrayOfObject=function(e){return e.map(e=>x.object(e))},x.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(x.value(r))}return t}return e},x.object=x.init,x.json=x.init,x.computed=function(e,t=[]){const n=new A(e()),o=b(()=>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 Ie=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)?x.array(e,t):"object"==typeof e?x.object(e,t):x(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=x.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,l=s(i.val()),u=e=>l.set(e),c=e=>i.set(e);return i.subscribe(u),l.subscribe(c),l.destroy=()=>{i.unsubscribe(u),l.unsubscribe(c),a.delete(l),l.cleanup()},l.dispose=l.destroy,a.add(l),l},follow(e){const{observer:t,subscribers:i}=o("follow",e),a=s(t.val()),l=e=>a.set(e);return t.subscribe(l),((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(l),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=Ie();return t&&t(n),n},createPersistent(e,t,n){n=n||e;const r=this.create(e,S(n,t)),o=O(t);return r.subscribe(e=>o(n,e)),r},createPersistentResettable(e,t,n){n=n||e;const r=this.createResettable(e,S(n,t)),o=O(t);r.subscribe(e=>o(n,e));const s=r.reset.bind(r);return r.reset=()=>{C.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.")}})},Me=Ie();Me.create("locale",navigator.language.split("-")[0]||"en");const Re=new Set(["clear","push","unshift","replace"]);const Pe=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=B("Show if : "+(r||""));let i=null;const a=()=>(i&&o||(i=j.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},Ve=function(e,t,n=!0){if(!p.isObservable(e))throw new r("Toggle : condition must be an Observable");const o=B("Match"),s=new Map,i=function(e){if(n&&s.has(e))return s.get(e);let r=t[e];return r?(r=j.getChild(r),p.isFragment(r)&&(r=Array.from(r.children)),n&&s.set(e,r),r):null},a=e.val(),l=i(a);return l&&o.appendChild(l),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]}})},je=function(e,t,n){if(!p.isObservable(e))throw new r("Toggle : condition must be an Observable");return Ve(e,{true:t,false:n})},Le=Q("div"),Be=Q("span"),qe=Q("label"),We=Q("p"),Ue=We,He=Q("strong"),ze=Q("h1"),Ke=Q("h2"),Je=Q("h3"),Ye=Q("h4"),Ge=Q("h5"),Qe=Q("h6"),Xe=Q("br"),Ze=Q("a"),et=Q("pre"),tt=Q("code"),nt=Q("blockquote"),rt=Q("hr"),ot=Q("em"),st=Q("small"),it=Q("mark"),at=Q("del"),lt=Q("ins"),ut=Q("sub"),ct=Q("sup"),ht=Q("abbr"),pt=Q("cite"),dt=Q("q"),ft=Q("dl"),mt=Q("dt"),bt=Q("dd"),yt=Q("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}),gt=Q("input"),vt=Q("textarea"),wt=vt,$t=Q("select"),Ct=Q("fieldset"),St=Q("option"),Ot=Q("legend"),At=Q("datalist"),Et=Q("output"),Nt=Q("progress"),xt=Q("meter"),Dt=Q("button"),kt=Q("main"),Ft=Q("section"),Tt=Q("article"),_t=Q("aside"),It=Q("nav"),Mt=Q("figure"),Rt=Q("figcaption"),Pt=Q("header"),Vt=Q("footer"),jt=Q("img"),Lt=function(e,t){return jt({src:e,...t})},Bt=Q("details"),qt=Q("summary"),Wt=Q("dialog"),Ut=Q("menu"),Ht=Q("ol"),zt=Q("ul"),Kt=Q("li"),Jt=Kt,Yt=Ht,Gt=zt,Qt=Q("audio"),Xt=Q("video"),Zt=Q("source"),en=Q("track"),tn=Q("canvas"),nn=Q("svg"),rn=Q("time"),on=Q("data"),sn=Q("address"),an=Q("kbd"),ln=Q("samp"),un=Q("var"),cn=Q("wbr"),hn=Q("caption"),pn=Q("table"),dn=Q("thead"),fn=Q("tfoot"),mn=Q("tbody"),bn=Q("tr"),yn=bn,gn=Q("th"),vn=gn,wn=gn,$n=Q("td"),Cn=$n,Sn=Q("");var On=Object.freeze({__proto__:null,Abbr:ht,Address:sn,Anchor:B,Article:Tt,Aside:_t,AsyncImg:function(e,t,n,o){const s=p.isObservable(e)?e.val():e,i=Lt(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:Qt,BaseImage:jt,Blockquote:nt,Br:Xe,Button:Dt,Canvas:tn,Caption:hn,Checkbox:e=>gt({type:"checkbox",...e}),Cite:pt,Code:tt,ColorInput:e=>gt({type:"color",...e}),Data:on,Datalist:At,DateInput:e=>gt({type:"date",...e}),DateTimeInput:e=>gt({type:"datetime-local",...e}),Dd:bt,Del:at,Details:Bt,Dialog:Wt,Div:Le,Dl:ft,Dt:mt,Em:ot,EmailInput:e=>gt({type:"email",...e}),FieldSet:Ct,FigCaption:Rt,Figure:Mt,FileInput:e=>gt({type:"file",...e}),Footer:Vt,ForEach:function(e,t,o,{shouldKeepItemsInCache:s=!1}={}){const i=B("ForEach"),a=i.endElement();i.startElement();let l=new Map,u=null;const c=new Set,h=e=>{if(!s)for(const[t,n]of l.entries()){if(c.has(t))continue;const r=n.child?.deref();e&&r&&r.remove(),n.indexObserver?.cleanup(),n.child=null,n.indexObserver=null,l.delete(n.keyId),u&&u.delete(n.keyId)}},d=(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(l.has(i)){const e=l.get(i);if(e.indexObserver?.set(s),e.isNew=!1,e.child?.deref())return i;l.delete(i)}try{const n=t.length>=2?x(s):null;let o=j.getChild(t(e,n));if(!o)throw new r("ForEach child can't be null or undefined!");l.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},f=()=>{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=d(n[e],e);c.add(t)}else for(const e in n){const t=d(n[e],e);c.add(t)}if(0===c.size)return i.removeChildren(),h(),void u?.clear();h(t),u&&0!==u.size?(()=>{let e=document.createDocumentFragment();const t=Array.from(c);Array.from(u);for(const n in t){const r=t[n],o=l.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=l.get(e);if(!n)continue;const r=n.child?.deref();r&&t.appendChild(r)}e.insertBefore(t,a)})(t),u?.clear(),u=new Set([...c])};return f(),p.isObservable(e)&&e.subscribe(f),i},ForEachArray:function(e,t,n={}){const r=B("ForEach Array",n.isParentUniqueChild),o=r.endElement();let s=new Map,i=0;const a=t.length>=2,l=e=>{f(e),i=0},u=e=>s.get(e)?.child,c=(e,t=!0)=>{const n=s.get(e);if(n){if(t){const t=n.child;t?.remove(),s.delete(e)}n.indexObserver?.cleanup()}},h=e=>{const n=t(e,null);return s.set(e,{child:n,indexObserver:null}),n},p=(e,n)=>{const r=x(n),o=t(e,r);return s.set(e,{child:o,indexObserver:r}),o},d=(e,t)=>{const n=s.get(e);return n?(n.indexObserver?.set(t),n.child):h(e)};let f,m=h;f=a?n.shouldKeepItemsInCache?()=>{}:e=>{for(const[t,n]of s.entries())e&&e.includes(t)||c(t,!1)}:s.clear.bind(s);const b=(e,t)=>{const n=s.get(e);if(!n)return null;const r=n.child;if(!r)return null;t?t.appendChild(r):r.remove()},y={toFragment:e=>{const t=document.createDocumentFragment();for(let n=0,r=e.length;n<r;n++)t.appendChild(m(e[n],i)),i++;return t},add:e=>{r.appendChildRaw(y.toFragment(e))},replace:e=>{l(e),r.replaceContentRaw(y.toFragment(e))},set:()=>{const t=e.val();l(t),r.replaceContentRaw(y.toFragment(t))},reOrder:e=>{let t=null;const n=document.createDocumentFragment();for(const r of e)t=u(r),t&&n.appendChild(t);t=null,r.appendElementRaw(n)},removeOne:(e,t)=>{c(e,!0)},clear:e=>{r.removeChildren(),l(e)},populate:([e,t,n])=>{const o=document.createDocumentFragment();for(let r=0;r<t;r++){const t=n(r);e.push(t),o.append(m(t,r)),i++}r.appendChildRaw(o),o.replaceChildren()},unshift:e=>{r.insertAtStartRaw(y.toFragment(e))},splice:(e,t)=>{const[n,s,...i]=e;let a=null;const l=document.createDocumentFragment();if(t.length>0){let e=t[0];if(1===t.length)b(e,l);else if(t.length>1){const e=u(t[0]);a=e?.previousSibling;for(let e=0;e<t.length;e++)b(t[e],l)}}else a=o;l.replaceChildren(),i&&i.length&&a&&r.insertBeforeRaw(y.toFragment(i),a.nextSibling)},reverse:(e,t)=>{y.reOrder(t)},sort:(e,t)=>{y.reOrder(t)},remove:(e,t)=>{y.removeOne(t)},pop:(e,t)=>{y.removeOne(t)},shift:(e,t)=>{y.removeOne(t)},swap:(e,t)=>{const n=r.getParent();let o=u(t[0]),s=u(t[1]);if(!o||!s)return;const i=s.nextSibling;n.insertBefore(s,o),n.insertBefore(o,i),o=null,s=null}};y.merge=y.add,y.push=y.add;const g=(e,t,n={})=>{((e=null)=>{m=Re.has(e)?a?p:h:s.size?d:a?p:h})(n.action),y[n.action]&&y[n.action](n.args,n.result),((e,t=0)=>{if(!a)return;let n=t;for(let r=t,o=e?.length;r<o;r++){const t=s.get(e[r]);t&&(t.indexObserver?.set(n),n++)}})(e,0)};return e.val().length&&g(e.val(),0,{action:null}),e.subscribe(g),r},Form:yt,Fragment:Sn,H1:ze,H2:Ke,H3:Je,H4:Ye,H5:Ge,H6:Qe,Header:Pt,HiddenInput:e=>gt({type:"hidden",...e}),HideIf:function(e,t,n){const r=x(!e.val());return e.subscribe(e=>r.set(!e)),Pe(r,t,n)},HideIfNot:function(e,t,n){return Pe(e,t,n)},Hr:rt,Img:Lt,Input:gt,Ins:lt,Kbd:an,Label:qe,LazyImg:function(e,t){return Lt(e,{...t,loading:"lazy"})},Legend:Ot,Li:Jt,Link:Ze,ListItem:Kt,Main:kt,Mark:it,Match:Ve,Menu:Ut,Meter:xt,MonthInput:e=>gt({type:"month",...e}),NativeDocumentFragment:B,Nav:It,NumberInput:e=>gt({type:"number",...e}),Ol:Yt,Option:St,OrderedList:Ht,Output:Et,P:We,Paragraph:Ue,PasswordInput:e=>gt({type:"password",...e}),Pre:et,Progress:Nt,Quote:dt,Radio:e=>gt({type:"radio",...e}),RangeInput:e=>gt({type:"range",...e}),ReadonlyInput:e=>gt({readonly:!0,...e}),Samp:ln,SearchInput:e=>gt({type:"search",...e}),Section:Ft,Select:$t,ShowIf:Pe,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 Pe(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 Pe(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)=>Dt(e,{type:"button",...t}),Small:st,Source:Zt,Span:Be,Strong:He,Sub:ut,SubmitButton:(e,t)=>Dt(e,{type:"submit",...t}),Summary:qt,Sup:ct,Svg:nn,Switch:je,TBody:mn,TBodyCell:Cn,TFoot:fn,TFootCell:wn,THead:dn,THeadCell:vn,TRow:yn,Table:pn,Td:$n,TelInput:e=>gt({type:"tel",...e}),TextArea:vt,TextInput:wt,Th:gn,Time:rn,TimeInput:e=>gt({type:"time",...e}),Tr:bn,Track:en,Ul:Gt,UnorderedList:zt,UrlInput:e=>gt({type:"url",...e}),Var:un,Video:Xt,Wbr:cn,WeekInput:e=>gt({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,je(e,t,n)),toNdElement:()=>je(e,t,n)}},createPortal:function(e,{parent:t,name:n="unnamed"}={}){const r=B("Portal "+n);return r.appendChild(j.getChild(e)),(t||document.body).appendChild(r),r}});const An={};function En(e,t,n={}){e="/"+y(e,"/").replace(/\/+/,"/");let r=null,o=n.name||null;const s=n.middlewares||[],i=n.shouldRebuild||!1,a=n.with||{},l=n.layout||null,u={},c=[],h=e=>{if(!e)return null;const[t,n]=e.split(":");let r=a[t];return!r&&n&&(r=An[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?(u[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=()=>l,this.match=function(e){e="/"+y(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 Nn extends Error{constructor(e,t){super(e),this.context=t}}const xn=(e,t)=>{const n=[];return e.forEach(e=>{n.push(y(e.suffix,"/"))}),n.push(y(t,"/")),n.join("/")},Dn=(e,t)=>{const n=[];return e.forEach(e=>{e.options.middlewares&&n.push(...e.options.middlewares)}),t&&n.push(...t),n},kn=(e,t)=>{const n=[];return e.forEach(e=>{e.options?.name&&n.push(e.options.name)}),t&&n.push(t),n.join(".")},Fn=e=>{for(let t=e.length-1;t>=0;t--)if(e[t]?.options?.layout)return e[t].options.layout;return null};function Tn(){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:l}=e[o];r(l)},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:l}=this.resolve(n);l!==o()&&(e.splice(t+1),e.push({route:s,params:i,query:a,path:l}),t++,r(l))},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 _n(){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 In(){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 Mn(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=B(t),r.appendChild(e)),o.set(e,r),r},l=()=>{p.isAnchor(i)&&i.remove()},u=()=>{t.nodeValue="",l(),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 l(),void e.replaceContent(h)}return u(),s=p,a(h,i).replaceContent(h),void t.appendChild(s)}u();const d=a(h,i);s=j.getChild(e(d)),r.set(h,s),t.appendChild(s)})(h,e,0,o);let p=c(e);u(),t.appendChild(p),i=e},d=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(d),d(e.currentState()),t}const Rn="default";function Pn(e={}){const t=[],r={},o=[],s=[],i={route:null,params:null,query:null,path:null,hash:null};if("hash"===e.mode)Tn.apply(this,[]);else if("history"===e.mode)_n.apply(this,[]);else{if("memory"!==e.mode)throw new Nn("Invalid router mode "+e.mode);In.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 En(xn(o,e),n,{...s,middlewares:Dn(o,s?.middlewares||[]),name:s?.name?kn(o,s.name):null,layout:s?.layout||Fn(o)});return t.push(i),i.name()&&(r[i.name()]=i),this},this.group=function(e,t,n){if(!p.isFunction(n))throw new Nn("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 Nn(`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 Nn(`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="/"+y(n,"/");let i,a=null;for(const e of t)if(i=e.match(s),i){a=e;break}if(!a)throw new Nn(`Route not found for url: ${n}`);const l={};if(o){const e=new URLSearchParams(o).entries();for(const[t,n]of e)l[t]=n}return{route:a,params:i,query:l,path:e}},this.subscribe=function(e){if(!p.isFunction(e))throw new Nn("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 l={...i},u=e=>{if(s++,!(s>=o.length))return o[s](e||l,u)};return o[s](l,u)}}function Vn(e,t){const{to:n,href:r,...o}=e;if(r){const e=Pn.get();return Ze({...o,href:r},t).nd.onPreventClick(()=>{e.push(r)})}const s="string"==typeof n?{name:n}:n,i=s.router||Rn,a=Pn.get(i);if(!a)throw new Nn('Router not found "'+i+'" for link "'+s.name+'"');const l=a.generateUrl(s.name,s.params,s.query);return Ze({...o,href:l},t).nd.onPreventClick(()=>{a.push(l)})}Pn.routers={},Pn.create=function(e,t){if(!p.isFunction(t))throw n.error("Router","Callback must be a function"),new Nn("Callback must be a function");const r=new Pn(e);return Pn.routers[e.name||Rn]=r,t(r),r.init(e.entry),r.mount=function(e){if(p.isString(e)){const t=document.querySelector(e);if(!t)throw new Nn(`Container not found for selector: ${e}`);e=t}else if(!p.isElement(e))throw new Nn("Container must be a string or an Element");return Mn(r,e)},r},Pn.get=function(e){const t=Pn.routers[e||Rn];if(!t)throw new Nn(`Router not found for name: ${e}`);return t},Pn.push=function(e,t=null){return Pn.get(t).push(e)},Pn.replace=function(e,t=null){return Pn.get(t).replace(e)},Pn.forward=function(e=null){return Pn.get(e).forward()},Pn.back=function(e=null){return Pn.get(e).back()},Pn.redirectTo=function(e,t=null,n=null){let r=e;const o=Pn.get(n);return o.resolve({name:e,params:t})&&(r={name:e,params:t}),console.log(r),o.push(r)},Vn.blank=function(e,t){return Ze({...e,target:"_blank"},t)};var jn=Object.freeze({__proto__:null,Link:Vn,RouteParamPatterns:An,Router:Pn});var Ln=Object.freeze({__proto__:null,memoize:e=>se(e),once:e=>oe(e),singleton:e=>re(e)}),Bn=Object.freeze({__proto__:null,Cache:Ln,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 l=(a.headers.get("content-type")||"").includes("application/json")?await a.json():await a.text();if(!a.ok){const e=new Error(l?.message||a.statusText);throw e.status=a.status,e.data=l,e}return l},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:ke});return e.$=D,e.ElementCreator=j,e.HtmlElementWrapper=Q,e.NDElement=i,e.Observable=x,e.PluginsManager=null,e.SingletonView=ne,e.Store=Me,e.StoreFactory=Ie,e.TemplateCloner=ee,e.Validator=p,e.autoMemoize=se,e.autoOnce=oe,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=Y,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=On,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=J,e.obs=k,e.once=re,e.router=jn,e.useCache=function(e){let t=null,n=r=>{t=new ee(e);const o=t.clone(r);return n=t.clone,o};return e.length<2?(...e)=>n(e):(e,t,...r)=>n([e,t,...r])},e.useSingleton=function(e){let t=null;return function(...n){return t||(t=new ne(e)),t.render(n)}},e.utils=Bn,e.withValidation=K,e}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-document",
3
- "version": "1.0.122",
3
+ "version": "1.0.123",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -12,6 +12,7 @@ export default function ObservableChecker($observable, $checker) {
12
12
 
13
13
  export const ObservablePipe = ObservableChecker;
14
14
 
15
+ ObservableChecker.prototype.__$Observable = true;
15
16
  ObservableChecker.prototype.__$isObservableChecker = true;
16
17
 
17
18
  /**
@@ -52,6 +52,7 @@ Object.defineProperty(ObservableItem.prototype, '$value', {
52
52
  configurable: true,
53
53
  });
54
54
 
55
+ ObservableItem.prototype.__$Observable = true;
55
56
  ObservableItem.prototype.__$isObservable = true;
56
57
  const DEFAULT_OPERATIONS = {};
57
58
  const noneTrigger = function() {};
@@ -11,6 +11,7 @@ export const ObservableWhen = function(observer, value) {
11
11
  this.$observer = observer;
12
12
  };
13
13
 
14
+ ObservableWhen.prototype.__$Observable = true;
14
15
  ObservableWhen.prototype.__$isObservableWhen = true;
15
16
 
16
17
  /**
@@ -1,4 +1,5 @@
1
1
  import Validator from "../utils/validator";
2
+ import NativeDocumentError from "../errors/NativeDocumentError";
2
3
  import {BOOLEAN_ATTRIBUTES} from "./constants.js";
3
4
  import {Observable} from "../data/Observable";
4
5
 
@@ -10,7 +11,16 @@ import {Observable} from "../data/Observable";
10
11
  export const bindClassAttribute = (element, data) => {
11
12
  for(const className in data) {
12
13
  const value = data[className];
13
- value.bindClassProperty(element, className, value);
14
+ if(value.__$Observable) {
15
+ element.classes.toggle(className, value.val());
16
+ value.subscribe((shouldAdd) => element.classes.toggle(className, shouldAdd));
17
+ continue;
18
+ }
19
+ if(value.$hydrate) {
20
+ value.$hydrate(element, className);
21
+ continue;
22
+ }
23
+ element.classes.toggle(className, value)
14
24
  }
15
25
  }
16
26
 
@@ -1,22 +0,0 @@
1
- import ObservableItem from "../../../core/data/ObservableItem";
2
- import {ObservableWhen} from "../../data/ObservableWhen";
3
- import TemplateBinding from "../../../core/wrappers/TemplateBinding";
4
-
5
-
6
- ObservableItem.prototype.bindClassProperty = (element, className, value) => {
7
- element.classes.toggle(className, value.val());
8
- value.subscribe((shouldAdd) => element.classes.toggle(className, shouldAdd));
9
- };
10
-
11
- ObservableWhen.prototype.bindClassProperty = (element, className, value) => {
12
- element.classes.toggle(className, value.isActive());
13
- value.subscribe((shouldAdd) => element.classes.toggle(className, shouldAdd));
14
- };
15
-
16
- TemplateBinding.prototype.bindClassProperty = (element, className, value) => {
17
- value.$hydrate(element, className);
18
- };
19
-
20
- Boolean.prototype.bindClassProperty = (element, className, value) => {
21
- element.classes.toggle(className, value);
22
- };
@@ -64,24 +64,19 @@ NodeCloner.prototype.resolve = function() {
64
64
  }
65
65
  }
66
66
  if(this.$classes) {
67
+ const cache = {};
67
68
  const keys = Object.keys(this.$classes);
68
69
 
69
70
  if(keys.length === 1) {
70
71
  const key = keys[0];
71
72
  const callback = this.$classes[key];
72
73
  steps.push((clonedNode, data) => {
73
- const value = callback.apply(null, data);
74
- value.bindClassProperty(clonedNode, key, value);
74
+ cache[key] = callback.apply(null, data);
75
+ ElementCreator.processClassAttribute(clonedNode, cache);
75
76
  });
76
77
  } else {
77
- const properties = this.$classes;
78
- const keysLength = keys.length;
79
78
  steps.push((clonedNode, data) => {
80
- for(let i = 0; i < keysLength; i++) {
81
- const key = keys[i];
82
- const value = properties[key].apply(null, data);
83
- value.bindClassProperty(clonedNode, key, value);
84
- }
79
+ ElementCreator.processClassAttribute(clonedNode, buildProperties(cache, this.$classes, data));
85
80
  });
86
81
  }
87
82
  }