native-document 1.0.151 → 1.0.153

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()}}const o=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`)}}}();const s=function(e,t){this.$target=t,this.$observer=e};s.prototype.__$Observable=!0,s.prototype.__$isObservableWhen=!0,s.prototype.subscribe=function(e){return this.$observer.on(this.$target,e)},s.prototype.val=function(){return this.$observer.$currentValue===this.$target},s.prototype.isMatch=s.prototype.val,s.prototype.isActive=s.prototype.val;const i=function(e){let t=!1;return function(...n){t||(t=!0,Promise.resolve().then(()=>{e.apply(this,n),t=!1}))}},a=function(e,t){return e.replace(new RegExp(`^[${t}]+|[${t}]+$`,"g"),"")},l=(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=>l(e));if(B.isObservable(e))return t&&t(e),e;const n={};for(const t in e)Object.hasOwn(e,t)&&(n[t]=l(e[t]));return n},u=(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),{})}},c=(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)},h={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}=u(e,t);return c(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}=u(e,t);return c(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}=u(e,t);return c(n,r,o)}return new Intl.DateTimeFormat(t,{dateStyle:r,hour:o,minute:s,second:i}).format(new Date(e))},relative:(e,t,{unit:n="day",numeric:r="auto"}={})=>{const o=Math.round((e-Date.now())/864e5);return new Intl.RelativeTimeFormat(t,{numeric:r}).format(o,n)},plural:(e,t,{singular:n,plural:r}={})=>`${e} ${"one"===new Intl.PluralRules(t).select(e)?n:r}`};function p(e,t=null){return new g(e,t)}const d=p,f=p;p.useValueProperty=function(e="value"){Object.defineProperty(g.prototype,e,{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0})},p.getById=function(e){const t=o.getObservableById(parseInt(e));if(!t)throw new r("Observable.getById : No observable found with id "+e);return t},p.cleanup=function(e){e.cleanup()},p.autoCleanup=function(e=!1,t={}){if(!e)return;const{interval:n=6e4,threshold:r=100}=t;window.addEventListener("beforeunload",()=>{o.cleanup()}),setInterval(()=>o.cleanObservables(r),n)};const m={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)},b=(e,t)=>{if(!m.has(e))return t;switch(typeof t){case"object":return m.getJson(e)??t;case"boolean":return m.getBool(e)??t;case"number":return m.getNumber(e)??t;default:return m.get(e,t)??t}},y=e=>{switch(typeof e){case"object":return m.setJson;case"boolean":return m.setBool;default:return m.set}};function g(e,t=null){e=B.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=B.isObject(e)?l(e):e))}Object.defineProperty(g.prototype,"$value",{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0}),g.prototype.__$Observable=!0,g.prototype.__$isObservable=!0;const v=function(){};g.prototype.intercept=function(e){return this.$interceptor=e,this.set=this.$setWithInterceptor,this},g.prototype.interceptMutations=function(e){return this.$mutationInterceptor=e,this},g.prototype.triggerFirstListener=function(e){this.$firstListener(this.$currentValue,this.$previousValue,e)},g.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)},g.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)},g.prototype.triggerAll=function(e){this.triggerWatchers(e),this.triggerListeners(e)},g.prototype.triggerWatchersAndFirstListener=function(e){this.triggerWatchers(e),this.triggerFirstListener(e)},g.prototype.assocTrigger=function(){if(this.$firstListener=null,this.$watchers?.size&&this.$listeners?.length)return this.$firstListener=this.$listeners[0],this.trigger=0===this.$firstListener.length?this.$firstListener:this.triggerFirstListener,void(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=v},g.prototype.trigger=v;const w={action:"set"};function $(e,t){this.observable=e,g.call(this),this.$mutation=t,e.subscribe(e=>{this.$updateWithMutation(e)}),this.$updateWithMutation(e.val())}g.prototype.$updateWithNewValue=function(e){e=e?.__$isObservable?e.val():e,this.$currentValue!==e&&(this.$previousValue=this.$currentValue,this.$currentValue=e,this.trigger(w),this.$previousValue=null)},g.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)},g.prototype.$basicSet=function(e){let t="function"==typeof e?e(this.$currentValue):e;this.$updateWithNewValue(t)},g.prototype.set=g.prototype.$basicSet,g.prototype.val=function(){return this.$currentValue},g.prototype.disconnectAll=function(){this.$previousValue=null,this.$currentValue=null,this.$listeners=null,this.$watchers=null,this.trigger=v},g.prototype.onCleanup=function(e){this.$cleanupListeners=this.$cleanupListeners??[],this.$cleanupListeners.push(e)},g.prototype.cleanup=function(){if(this.$cleanupListeners){for(let e=0;e<this.$cleanupListeners.length;e++)this.$cleanupListeners[e]();this.$cleanupListeners=null}o.unregister(this.$memoryId),this.disconnectAll(),delete this.$value},g.prototype.subscribe=function(e){this.$listeners=this.$listeners??[],this.$listeners.push(e),this.assocTrigger()},g.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?B.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()},g.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()},g.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)},g.prototype.unsubscribe=function(e){if(!this.$listeners)return;const t=this.$listeners.indexOf(e);t>-1&&this.$listeners.splice(t,1),this.assocTrigger()},g.prototype.check=function(e){return new $(this,e)},g.prototype.transform=g.prototype.check,g.prototype.pluck=function(e){return new $(this,t=>t[e])},g.prototype.is=function(e){return new $(this,"function"==typeof e?e:t=>t===e)},g.prototype.select=g.prototype.check,g.prototype.get=function(e){const t=this.$currentValue[e];return B.isObservable(t)?t.val():t},g.prototype.when=function(e){return new s(this,e)},g.prototype.equals=function(e){return B.isObservable(e)?this.$currentValue===e.$currentValue:this.$currentValue===e},g.prototype.toBool=function(){return!!this.$currentValue},g.prototype.toggle=function(){this.set(!this.$currentValue)},g.prototype.reset=function(){if(!this.configs?.reset)return;const e=B.isObject(this.$initialValue)?l(this.$initialValue,e=>{e.reset()}):this.$initialValue;this.set(e)},g.prototype.toString=function(){return String(this.$currentValue)},g.prototype.valueOf=function(){return this.$currentValue},g.prototype.format=function(e,t={}){const n=this;if("function"==typeof e)return new $(n,e);const r=h[e],o=h.locale;return p.computed(()=>r(n.val(),o.val(),t),[n,o])},g.prototype.persist=function(e,t={}){let n=b(e,this.$currentValue);t.get&&(n=t.get(n)),this.set(n);const r=y(this.$currentValue);return this.subscribe(n=>{r(e,t.set?t.set(n):n)}),this},g.prototype.clone=function(){let e=this.$currentValue;return e&&"object"==typeof e&&(e="function"==typeof e.clone?e.clone():structuredClone(e)),new g(e)},$.prototype=Object.create(g.prototype),$.prototype.constructor=$,$.prototype.__$Observable=!0,$.prototype.__$isObservableChecker=!0;const S=$;S.prototype.constructor=S,$.prototype.$updateWithMutation=function(e){return e=this.$mutation(e),this.set(e)};const C={mounted:new WeakMap,beforeUnmount:new WeakMap,mountedSupposedSize:0,unmounted:new WeakMap,unmountedSupposedSize:0,observer:null,initObserver:()=>{C.observer||(C.observer=new MutationObserver(C.checkMutation),C.observer.observe(document.body,{childList:!0,subtree:!0}))},executeMountedCallback(e){const t=C.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=C.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(C.mountedSupposedSize>0)for(const e of t.addedNodes){if(C.executeMountedCallback(e),!e.querySelectorAll)continue;const t=e.querySelectorAll("[data--nd-mounted]");for(const e of t)C.executeMountedCallback(e)}if(C.unmountedSupposedSize>0)for(const e of t.removedNodes){if(C.executeUnmountedCallback(e),!e.querySelectorAll)continue;const t=e.querySelectorAll("[data--nd-unmounted]");for(const e of t)C.executeUnmountedCallback(e)}}},watch:function(e,t=!1){let n=!1,r=!1;C.initObserver();let o={inDom:t,mounted:null,unmounted:null,disconnect:()=>{n&&(C.mounted.delete(e),C.mountedSupposedSize--),r&&(C.unmounted.delete(e),C.unmountedSupposedSize--),o=null}};const s=(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=>{s("mounted",t),C.mounted.set(e,o),n||(C.mountedSupposedSize++,n=!0)},unmounted:t=>{s("unmounted",t),C.unmounted.set(e,o),r||(C.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)}}}},O=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"]),A=(e,t)=>{for(const n in t){const r=t[n];if(r.__$Observable){if(r.__$isObservableChecker){let t=r.val();if("string"==typeof t){e.classes.toggle(t,!0),r.subscribe(n=>{e.classes.remove(t),e.classes.toggle(n,!0),t=n});continue}}e.classes.toggle(n,r.val()),r.subscribe(t=>e.classes.toggle(n,t))}else r.$hydrate?r.$hydrate(e,n):e.classes.toggle(n,r)}},E=(e,t)=>{for(const n in t){const r=t[n],o=n.startsWith("--");r.__$Observable?o?(e.style.setProperty(n,r.val()),r.subscribe(t=>{!1!==t?e.style.setProperty(n,t):e.style.removeProperty(n)})):(e.style[n]=r.val(),r.subscribe(t=>{!1!==t?e.style[n]=t:e.style.removeProperty(n)})):o?e.style.setProperty(n,r):e.style[n]=r}},_=(e,t,n)=>{const r=n.__$isObservable,o=r?n.val():n;if(B.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)}},x=(e,t)=>{for(const n in t){const r=n.toLowerCase();let o=t[n];if(null!=o)if(o.handleNdAttribute)o.handleNdAttribute(e,r,o);else{if("object"==typeof o){if("class"===r){A(e,o);continue}if("style"===r){E(e,o);continue}}O.has(r)?_(e,r,o):e.setAttribute(r,o)}}return e};function N(e){this.$hydrate=e}N.prototype.__$isTemplateBinding=!0,String.prototype.toNdElement=function(){return M.createStaticTextNode(null,this)},Number.prototype.toNdElement=function(){return M.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},g.prototype.toNdElement=function(){return M.createObservableNode(null,this)},$.prototype.toNdElement=g.prototype.toNdElement,P.prototype.toNdElement=function(){const e=this.$element??this.$build?.()??this.build?.()??null;return this.$attachements?(this.$attachements.contains(this.$element)||this.$attachements.append(this.$element),this.$attachements):e},Array.prototype.toNdElement=function(){const e=document.createDocumentFragment();for(let t=0,n=this.length;t<n;t++){const n=M.getChild(this[t]);null!==n&&e.appendChild(n)}return e},Function.prototype.toNdElement=function(){return M.getChild(this())},N.prototype.toNdElement=function(){return M.createHydratableNode(null,this)};const F=(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()});P.prototype.transitionOut=function(e){const t=e+"-exit",n=this.$element;return this.beforeUnmount("transition-exit",async function(){n.classes.add(t),await F(n),n.classes.remove(t)}),this},P.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),F(r).then(()=>{r.classes.remove(n)})})})}),this},P.prototype.transition=function(e){return this.transitionIn(e),this.transitionOut(e),this},P.prototype.animate=function(e){const t=this.$element;return t.classes.add(e),F(t).then(()=>{t.classes.remove(e)}),this},g.prototype.handleNdAttribute=function(e,t){O.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)},$.prototype.handleNdAttribute=g.prototype.handleNdAttribute,N.prototype.handleNdAttribute=function(e,t){this.$hydrate(e,t)};let D=null;const M={createTextNode:()=>(D||(D=document.createTextNode(""),M.createTextNode=()=>D.cloneNode()),D.cloneNode()),createObservableNode:(e,t)=>{const n=M.createTextNode();return t.subscribe(e=>n.nodeValue=e),n.nodeValue=t.val(),e&&e.appendChild(n),n},createHydratableNode:(e,t)=>{const n=M.createTextNode();return t.$hydrate(n),n},createStaticTextNode:(e,t)=>{let n=M.createTextNode();return n.nodeValue=t,e&&e.appendChild(n),n},createElement:e=>document.createElement(e).cloneNode(),createFragment:e=>k("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=M.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(),B.isElement(e))return e}while(e.toNdElement);return M.createStaticTextNode(null,e)},processAttributes:(e,t)=>{t&&x(e,t)},processAttributesDirect:x,processClassAttribute:A,processStyleAttribute:E};function T(e){const t=Reflect.construct(DocumentFragment,[],T),n=document.createComment((e||"")+" Anchor Sentinel"),r=document.createComment("Anchor Start : "+e),o=document.createComment("/ Anchor End "+e),s={};t.append(r,n,o);const i=new MutationObserver(()=>{n.parentNode===t||n.parentNode instanceof DocumentFragment||s.connected&&s.connected(n.parentNode)});return i.observe(document,{childList:!0,subtree:!0}),t.$sentinel=n,t.$start=r,t.$end=o,t.$observer=i,t.$events=s,t}function k(e,t=!1){const n=new T(e);n.onConnectedOnce(e=>{t&&function(e,t){e.remove=()=>{e.append.apply(e,t.childNodes)},e.getParent=()=>t,e.appendChild=e=>{e=B.isElement(e)?e:M.getChild(e),t.appendChild(e)},e.appendChildRaw=t.appendChild.bind(t),e.append=e.appendChild,e.appendRaw=e.appendChildRaw,e.insertAtStart=e=>{e=B.isElement(e)?e:M.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=B.isElement(e)?e:M.getChild(e);t.replaceChildren(n)},e.replaceContentRaw=function(e){t.replaceChildren(e)},e.setContent=e.replaceContent,e.insertBefore=(e,n)=>{e=B.isElement(e)?e:M.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=n.$start,o=n.$end;n.nativeInsertBefore=n.insertBefore,n.nativeAppendChild=n.appendChild,n.nativeAppend=n.append;const s=t?()=>!0:e=>e.firstChild===r&&e.lastChild===o,i=(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?((e,t,n)=>{const r=B.isElement(t)?t:M.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=B.isElement(e)?e:M.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.nativeAppend.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.delete=n.removeWithAnchors,n.replaceContent=function(e){const t=B.isElement(e)?e:M.getChild(e);n.replaceContentRaw(t)},n.replaceContentRaw=function(e){const t=o.parentNode;t&&(s(t)?t.replaceChildren(r,e,o):(n.removeChildren(),t.insertBefore(e,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}function P(e){this.$element=e,this.$attachements=null}T.prototype=Object.create(DocumentFragment.prototype),T.prototype.constructor=T,T.prototype.onConnected=function(e){return this.$events.connected=e,this},T.prototype.onConnectedOnce=function(e){this.$events.connected=t=>{e(t),this.$observer.disconnect(),this.$events.connectedOnce=null}},DocumentFragment.prototype.setAttribute=()=>{},P.prototype.__$isNDElement=!0,P.prototype.ghostDom=function(e){return this.$attachements||(this.$attachements=document.createDocumentFragment()),this.$attachements.appendChild(M.getChild(e)),this},P.prototype.valueOf=function(){return this.$element},P.prototype.ref=function(e,t){return e[t]=this.$element,this},P.prototype.refSelf=function(e,t){return e[t]=this,this},P.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},P.prototype.remove=function(){let e=this.$element;return e.nd.unmountChildren(),e.$ndProx=null,I.delete(e),e=null,this};const I=new WeakMap;P.prototype.lifecycle=function(e){const t=this.$element;I.has(t)||I.set(t,C.watch(t));const n=I.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},P.prototype.mounted=function(e){return this.lifecycle({mounted:e})},P.prototype.unmounted=function(e){return this.lifecycle({unmounted:e})},P.prototype.beforeUnmount=function(e,t){const n=this.$element;if(!C.beforeUnmount.has(n)){C.beforeUnmount.set(n,new Map);const e=n.remove.bind(n);let t=!1;n.remove=async()=>{if(!t){t=!0;try{const e=C.beforeUnmount.get(n);for(const t of e.values())await t.call(this,n)}finally{e(),t=!1}}}}return C.beforeUnmount.get(n).set(e,t),this},P.prototype.htmlElement=function(){return this.$element},P.prototype.node=P.prototype.htmlElement,P.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},P.prototype.openShadow=function(e=null){return this.shadow("open",e)},P.prototype.closedShadow=function(e=null){return this.shadow("closed",e)},P.prototype.with=function(e){if(!e||"object"!=typeof e)throw new r("extend() requires an object of methods");for(const t in e){const r=e[t];"function"==typeof r?this[t]=r.bind(this):n.warn(`⚠️ extends(): "${t}" is not a function, skipping`)}return this},P.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}"`);P.prototype[o]&&n.warn("NDElement.extend",`Overwriting existing prototype method "${o}"`),P.prototype[o]=s}else n.warn("NDElement.extend",`"${o}" is not a function, skipping`)}return P};const L=3,R=8,V=11,j=[];j[1]=!0,j[L]=!0,j[V]=!0,j[R]=!0;const B={isObservable:e=>e&&(e.__$isObservable||e.__$Observable),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=>B.isObservable(e)||B.isProxy(e),isAnchor:e=>e?.__Anchor__,isObservableChecker:e=>e?.__$isObservableChecker||e instanceof $,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&&j[e.nodeType],isDOMNode:e=>j[e.nodeType],isFragment:e=>e?.nodeType===V,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 P,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&&(B.isObject(e)&&Object.values(e).some(e=>B.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")}},W={configurable:!0,get(){return new P(this)}};Object.defineProperty(HTMLElement.prototype,"nd",W),Object.defineProperty(DocumentFragment.prototype,"nd",W),Object.defineProperty(P.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();P.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();P.prototype["onStop"+e]=function(e=null){return U(this.$element,t,e),this},P.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();P.prototype["onPrevent"+e]=function(e=null){return q(this.$element,t,e),this}}),P.prototype.on=function(e,t,n){return this.$element.addEventListener(e.toLowerCase(),t,n),this};const q=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 G=e=>e;e.ArgTypes={},e.ArgTypes={string:()=>!0,number:()=>!0,boolean:()=>!0,observable:()=>!0,element:()=>!0,function:()=>!0,object:()=>!0,objectNotNull:()=>!0,children:()=>!0,attributes:()=>!0,optional:()=>!0,oneOf:()=>!0};const K=function(e,t=null){return 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}},J=e=>e?e.toNdElement():M.createTextNode(),Y=(e,t,n=null)=>{let{props:r,children:o=null}=K(t,n);return M.processAttributes(e,r),M.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)=>Y(t(n.cloneNode()),e,r),Y(t(n.cloneNode()),o,s));return(e,t)=>r(e,t)}let n=null,r=(t,o)=>(n=document.createElement(e),r=(e,t)=>Y(n.cloneNode(),e,t),Y(n.cloneNode(),t,o));return(e,t)=>r(e,t)}return(e,t="")=>{const n=k(t);return n.append(e),n}}function X(e){this.$element=e,this.$classes=null,this.$styles=null,this.$attrs=null,this.$ndMethods=null}P.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),M.processClassAttribute(e,t)})}else e.push((e,n)=>{M.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),M.processStyleAttribute(e,t)})}else e.push((e,n)=>{M.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),M.processAttributes(e,t)})}else e.push((e,n)=>{M.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=>J(e.apply(null,t)),this):(this.cloneNode=t=>J(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 N((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=k("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.errorBoundary=function(e){const t=(...n)=>{try{return this.apply(this,n)}catch(r){return e(r,{caller:t,args:n})}};return t};const re=function(e={}){let t=B.isString(e)?e.split(";").filter(Boolean):e;return{add(e,n){if(Array.isArray(t))t.push(e+": "+n);else if(B.isObject(e)){n=e;for(const e in n)t[e]=n[e]}else t[e]=n},value:()=>Array.isArray(t)?t.join(";").concat(";"):{...t}}},oe=function(e=[]){let t=B.isString(e)?e.split(" ").filter(Boolean):e;return{add(e,n=!0){if(B.isJson(e))for(const n in e)e[n]&&(t[n]=e[n]);else if(null!=n||e.__$Observable)if(Array.isArray(t)&&(t=t.reduce((e,t)=>(e[t]=!0,e),{})),e.__$Observable){const n=`obs-${Math.random().toString(36).substr(2,9)}`;t[n]=e}else t[e]=n;else Array.isArray(t)?t.push(e):t[e]=n},value:()=>Array.isArray(t)?t.join(" "):{...t}}},se=e=>{let t=null;return(...n)=>(null!=t||(t=e(...n)),t)},ie=e=>{let t=null;return new Proxy({},{get:(n,r)=>(t||(t=e()),t[r])})},ae=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 le(e){return e instanceof Date?e:new Date(e)}function ue(e,t){const n=le(e),r=le(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function ce(e){const t=le(e);return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}function he(e,t){const n=B.isObservable(e);return{dependencies:n?e:null,callback:r=>t(r,n?e.val():e)}}function pe(e,t){const n=e.filter(B.isObservable);return{dependencies:n.length>0?n:null,callback:n=>t(n,e.map(e=>B.isObservable(e)?e.val():e))}}function de(e){return he(e,(e,t)=>e===t)}function fe(e){return he(e,(e,t)=>e!==t)}function me(e){return he(e,(e,t)=>e>t)}function be(e){return he(e,(e,t)=>e>=t)}function ye(e){return he(e,(e,t)=>e<t)}function ge(e){return he(e,(e,t)=>e<=t)}function ve(e,t=!0,r=""){return pe([e,t,r],(e,[t,r,o])=>{if(!t)return!0;if(r)try{return new RegExp(t,o).test(String(e))}catch(e){return n.warn("Invalid regex pattern:",t,e),!1}return o&&""!==o?String(e).includes(String(t)):String(e).toLowerCase().includes(String(t).toLowerCase())})}function we(...e){const t=e.flatMap(e=>e.dependencies?Array.isArray(e.dependencies)?e.dependencies:[e.dependencies]:[]).filter(B.isObservable);return{dependencies:t.length>0?t:null,callback:t=>e.every(e=>e.callback(t))}}function $e(...e){const t=e.flatMap(e=>e.dependencies?Array.isArray(e.dependencies)?e.dependencies:[e.dependencies]:[]).filter(B.isObservable);return{dependencies:t.length>0?t:null,callback:t=>e.some(e=>e.callback(t))}}const Se=me,Ce=be,Oe=ye,Ae=ge,Ee=de,_e=fe,xe=we,Ne=$e;function Fe(e,t=!1){return he(e,(e,n)=>!!e&&(!n||(t?String(e).includes(String(n)):String(e).toLowerCase().includes(String(n).toLowerCase()))))}const De=Fe;var Me=Object.freeze({__proto__:null,all:xe,and:we,any:Ne,between:function(e,t){return pe([e,t],(e,[t,n])=>e>=t&&e<=n)},contains:De,createFilter:he,createMultiSourceFilter:pe,custom:function(e,...t){const n=t.filter(B.isObservable);return{dependencies:n.length>0?n:null,callback:n=>{const r=t.map(e=>B.isObservable(e)?e.val():e);return e(n,...r)}}},dateAfter:e=>he(e,(e,t)=>!(!e||!t)&&le(e)>le(t)),dateBefore:e=>he(e,(e,t)=>!(!e||!t)&&le(e)<le(t)),dateBetween:(e,t)=>pe([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=le(e);return r>=le(t)&&r<=le(n)}),dateEquals:e=>he(e,(e,t)=>!(!e||!t)&&ue(e,t)),dateTimeAfter:e=>he(e,(e,t)=>!(!e||!t)&&le(e)>le(t)),dateTimeBefore:e=>he(e,(e,t)=>!(!e||!t)&&le(e)<le(t)),dateTimeBetween:(e,t)=>pe([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=le(e);return r>=le(t)&&r<=le(n)}),dateTimeEquals:e=>he(e,(e,t)=>!(!e||!t)&&le(e).getTime()===le(t).getTime()),endsWith:function(e,t=!1){return he(e,(e,n)=>!n||(t?String(e).endsWith(String(n)):String(e).toLowerCase().endsWith(String(n).toLowerCase())))},eq:Ee,equals:de,getSecondsOfDay:ce,greaterThan:me,greaterThanOrEqual:be,gt:Se,gte:Ce,inArray:function(e){return he(e,(e,t)=>t.includes(e))},includes:Fe,isEmpty:function(e=!0){return he(e,(e,t)=>{const n=!e||""===e||Array.isArray(e)&&0===e.length;return t?n:!n})},isNotEmpty:function(e=!0){return he(e,(e,t)=>{const n=!!e&&""!==e&&(!Array.isArray(e)||e.length>0);return t?n:!n})},isSameDay:ue,lessThan:ye,lessThanOrEqual:ge,lt:Oe,lte:Ae,match:ve,neq:_e,not:function(e){return{dependencies:e.dependencies,callback:t=>!e.callback(t)}},notEquals:fe,notIn:function(e){return he(e,(e,t)=>!t.includes(e))},or:$e,startsWith:function(e,t=!1){return he(e,(e,n)=>!n||(t?String(e).startsWith(String(n)):String(e).toLowerCase().startsWith(String(n).toLowerCase())))},timeAfter:e=>he(e,(e,t)=>!(!e||!t)&&ce(e)>ce(t)),timeBefore:e=>he(e,(e,t)=>!(!e||!t)&&ce(e)<ce(t)),timeBetween:(e,t)=>pe([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=ce(e);return r>=ce(t)&&r<=ce(n)}),timeEquals:e=>he(e,(e,t)=>{if(!e||!t)return!1;const n=le(e),r=le(t);return n.getHours()===r.getHours()&&n.getMinutes()===r.getMinutes()&&n.getSeconds()===r.getSeconds()}),toDate:le});const Te=function(e,t=null){if(!Array.isArray(e))throw new r("Observable.array : target must be an array");g.call(this,e,t)};(Te.prototype=Object.create(g.prototype)).constructor=Te,Te.prototype.__$isObservableArray=!0,Object.defineProperty(Te.prototype,"length",{get(){return this.$currentValue.length}}),Te.prototype.$mutate=function(e,t,n){if(this.$mutationInterceptor){const n=this.$mutationInterceptor(t,{action:e});void 0!==t&&(t=n)}n(t)},["push","pop","shift","unshift","reverse","sort","splice"].forEach(e=>{Te.prototype[e]=function(...t){return this.$mutate(e,t,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=>{Te.prototype[e]=function(...t){return this.$currentValue[e].apply(this.$currentValue,t)}});const ke={action:"clear"};Te.prototype.clear=function(){if(0!==this.$currentValue.length)return this.$mutate("clear",[],()=>{this.$currentValue.length=0,this.trigger(ke)}),!0},Te.prototype.at=function(e){return this.$currentValue[e]},Te.prototype.merge=function(e){this.$mutate("merge",e,e=>{this.$currentValue.push.apply(this.$currentValue,e),this.trigger({action:"merge",args:e})})},Te.prototype.count=function(e){let t=0;return this.$currentValue.forEach((n,r)=>{e(n,r)&&t++}),t},Te.prototype.swap=function(e,t){return this.$mutate("swap",[e,t],([e,t])=>{const n=this.$currentValue,r=n.length;if(t<e){const n=e;e=t,t=n}if(r<e||r<t)return!1;const o=n[e],s=n[t];n[e]=s,n[t]=o,this.trigger({action:"swap",args:[e,t],result:[o,s]})}),!0},Te.prototype.swapItems=function(e,t){const n=this.$currentValue.indexOf(e),r=this.$currentValue.indexOf(t);return this.swap(n,r)},Te.prototype.insertAfter=function(e,t){const n=this.$currentValue.indexOf(t);return this.splice(n+1,0,e)},Te.prototype.remove=function(e){let t=[];return this.$mutate("remove",[e],([e])=>{t=this.$currentValue.splice(e,1),0!==t.length&&this.trigger({action:"remove",args:[e],result:t[0]})}),t},Te.prototype.removeItem=function(e){const t=this.$currentValue.indexOf(e);return-1===t?[]:this.remove(t)},Te.prototype.empty=function(){return 0===this.$currentValue.length},Te.prototype.populateAndRender=function(e,t){this.trigger({action:"populate",args:[this.$currentValue,e,t]})},Te.prototype.where=function(e){"function"==typeof e&&(e={_:e});const t=this,n=[t],r={};for(const[t,o]of Object.entries(e)){const e=B.isObservable(o)?ve(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=p.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},Te.prototype.whereSome=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.some(e=>t.callback(n[e]))}})},Te.prototype.whereEvery=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.every(e=>t.callback(n[e]))}})},Te.prototype.deepSubscribe=function(e){const t=i(()=>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)}},Te.prototype.sync=function(e){if(!e||!e.__$isObservableArray)throw new r("ObservableArray.sync : target must be an ObservableArray");e.set([...this.$currentValue]);const t=(t,n,r)=>{if(!r)return void e.set([...t]);const{action:o,args:s}=r;e[o].apply(e,s)};return this.subscribe(t),()=>this.unsubscribe(t)},Te.prototype.clone=function(){return new Te(this.resolve())},p.array=function(e=[],t=null){return new Te(e,t)},p.batch=function(e){const t=p(0),n=function(){if(B.isAsyncFunction(e))return e(...arguments).then(()=>{t.trigger()}).catch(e=>{throw e});e(...arguments),t.trigger()};return n.$observer=t,n};const Pe=function(e,t){g.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)})};Pe.prototype=Object.create(g.prototype),Object.defineProperty(Pe,"$value",{get(){return this.val()},set(e){this.set(e)}}),Pe.prototype.__$isObservableObject=!0,Pe.prototype.__isProxy__=!0,Pe.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=>B.isJson(e)?p.json(e,t):B.isArray(e)?p.array(e,t):p(e,t));this.$observables[n]=p.array(e,t);continue}this.$observables[n]=p.array(r,t)}else B.isObservable(r)||B.isProxy(r)?this.$observables[n]=r:this.$observables[n]="object"==typeof r?p.object(r,t):p(r,t)}},Pe.prototype.val=function(){const e={};for(const t in this.$observables){const n=this.$observables[t];if(B.isObservable(n)){let r=n.val();Array.isArray(r)&&(r=r.map(e=>B.isObservable(e)?e.val():B.isProxy(e)?e.$value:e)),e[t]=r}else B.isProxy(n)?e[t]=n.$value:e[t]=n}return e},Pe.prototype.$val=Pe.prototype.val,Pe.prototype.get=function(e){const t=this.$observables[e];return B.isObservable(t)?t.val():B.isProxy(t)?t.$value:t},Pe.prototype.$get=Pe.prototype.get,Pe.prototype.set=function(e){const t=B.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(B.isObservable(o)){if(!B.isArray(i)){o.set(i);continue}const e=s.at(0);if(B.isObservable(e)||B.isProxy(e)){const t=i.map(t=>B.isProxy(e)?p.init(t,n):p(t,n));o.set(t);continue}o.set([...i]);continue}B.isProxy(o)?o.update(i):this[r]=i}},Pe.prototype.$set=Pe.prototype.set,Pe.prototype.$updateWith=Pe.prototype.set,Pe.prototype.observables=function(){return Object.values(this.$observables)},Pe.prototype.$observables=Pe.prototype.observables,Pe.prototype.keys=function(){return Object.keys(this.$observables)},Pe.prototype.$keys=Pe.prototype.keys,Pe.prototype.clone=function(){return p.init(this.val(),this.configs)},Pe.prototype.$clone=Pe.prototype.clone,Pe.prototype.reset=function(){for(const e in this.$observables)this.$observables[e].reset()},Pe.prototype.originalSubscribe=Pe.prototype.subscribe,Pe.prototype.subscribe=function(e){const t=this.observables(),n=i(()=>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)}},Pe.prototype.configs=function(){return this.configs},Pe.prototype.update=Pe.prototype.set,p.init=function(e,t=null){return new Pe(e,t)},p.arrayOfObject=function(e){return e.map(e=>p.object(e))},p.value=function(e){if(e?.__$isObservableArray){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e.at(n);t.push(p.value(r))}return t}return e?.__$Observable?e.val():B.isProxy(e)?e.$value:e},g.prototype.resolve=function(){return p.value(this)},p.object=p.init,p.json=p.init,p.computed=function(e,t=[]){const n=new g(e()),o=i(()=>n.set(e(...t.map(e=>e.val()))));if(B.isFunction(t)){if(!B.isObservable(t.$observer))throw new r("Observable.computed : dependencies must be valid batch function");return t.$observer.subscribe(o),n}return t.forEach(e=>{B.isProxy(e)?e.$observables.forEach(e=>{e.subscribe(o)}):e.subscribe(o)}),n};const Ie=(e,t)=>p.computed(e,t),Le=(e,t)=>e.transform(t);g.prototype.isEqualTo=function(e){return e?.__$Observable?Ie((e,t)=>e===t,[this,e]):Le(this,t=>t===e)},g.prototype.isNotEqualTo=function(e){return e?.__$Observable?Ie((e,t)=>e!==t,[this,e]):Le(this,t=>t!==e)},g.prototype.isGreaterThan=function(e){return e?.__$Observable?Ie((e,t)=>e>t,[this,e]):Le(this,t=>t>e)},g.prototype.isGreaterThanOrEqualTo=function(e){return e?.__$Observable?Ie((e,t)=>e>=t,[this,e]):Le(this,t=>t>=e)},g.prototype.isLessThan=function(e){return e?.__$Observable?Ie((e,t)=>e<t,[this,e]):Le(this,t=>t<e)},g.prototype.isLessThanOrEqualTo=function(e){return e?.__$Observable?Ie((e,t)=>e<=t,[this,e]):Le(this,t=>t<=e)},g.prototype.isBetween=function(e,t){return e.__$Observable&&t.__$Observable?Ie((e,t,n)=>e>=t&&e<=n,[this,e,t]):e.__$Observable?Ie((e,n)=>e>=n&&e<=t,[this,e]):t.__$Observable?Ie((t,n)=>t>=e&&t<=n,[this,t]):Le(this,n=>n>=e&&n<=t)},g.prototype.isNull=function(){return Le(this,e=>null==e)},g.prototype.isTruthy=function(){return Le(this,e=>!!e)},g.prototype.isFalsy=function(){return Le(this,e=>!e)},g.prototype.isStartingWith=function(e){return e?.__$Observable?Ie((e,t)=>String(e).startsWith(t),[this,e]):Le(this,t=>String(t).startsWith(e))},g.prototype.isEndingWith=function(e){return e?.__$Observable?Ie((e,t)=>String(e).endsWith(t),[this,e]):Le(this,t=>String(t).endsWith(e))},g.prototype.isMatchingPattern=function(e){return e?.__$Observable?Ie((e,t)=>new RegExp(t).test(String(e)),[this,e]):Le(this,t=>e.test(String(t)))},g.prototype.isEmpty=function(){return Le(this,e=>null==e||""===e||Array.isArray(e)&&0===e.length)},g.prototype.isNotEmpty=function(){return Le(this,e=>null==e||""===e||Array.isArray(e)&&0!==e.length)},g.prototype.isIncludes=function(e){return e?.__$Observable?Ie((e,t)=>Array.isArray(e)?e.includes(t):String(e).includes(String(t)),[this,e]):Le(this,t=>Array.isArray(t)?t.includes(e):String(t).includes(String(e)))},g.prototype.isIncludedIn=function(e){return e?.__$Observable?Ie((e,t)=>t.includes(e),[this,e]):Le(this,t=>e.includes(t))},g.prototype.isOneOf=g.prototype.isIncludedIn,g.prototype.isHaving=function(e){return e?.__$Observable?Ie((e,t)=>t in Object(e),[this,e]):Le(this,t=>e in Object(t))},g.prototype.toUpperCase=function(){return Le(this,e=>String(e).toUpperCase())},g.prototype.toLowerCase=function(){return Le(this,e=>String(e).toLowerCase())},g.prototype.toTrimmed=function(){return Le(this,e=>String(e).trim())},g.prototype.toBoolean=function(){return Le(this,e=>!!e)},g.prototype.toLiteral=function(e,t="${v}"){return Le(this,n=>e.replace(t,n))},g.prototype.toFormatted=g.prototype.toLiteral,g.prototype.toProperty=function(e){const t=e.split(".");return Le(this,e=>{let n=e;for(const e of t){if(null==n)return;n=n[e]}return n})},g.prototype.toLength=function(){return Le(this,e=>null==e?0:e.length)},g.prototype.toClamped=function(e,t){return e.__$Observable&&t.__$Observable?Ie((e,t,n)=>Math.min(Math.max(e,t),n),[this,e,t]):e.__$Observable?Ie((e,n)=>Math.min(Math.max(e,n),t),[this,e]):t.__$Observable?Ie((t,n)=>Math.min(Math.max(t,e),n),[this,t]):Le(this,n=>Math.min(Math.max(n,e),t))},g.prototype.toPercent=function(e){return e?.__$Observable?Ie((e,t)=>0===t?0:e/t*100,[this,e]):Le(this,t=>0===e?0:t/e*100)};const Re=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)?p.array(e,t):"object"==typeof e?p.object(e,t):p(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=p.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=Re();return t&&t(n),n},createPersistent(e,t,n){n=n||e;const r=this.create(e,b(n,t)),o=y(t);return r.subscribe(e=>o(n,e)),r},createPersistentResettable(e,t,n){n=n||e;const r=this.createResettable(e,b(n,t)),o=y(t);r.subscribe(e=>o(n,e));const s=r.reset.bind(r);return r.reset=()=>{m.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.")}})},Ve=Re();Ve.create("locale",navigator.language.split("-")[0]||"en");const je=e=>e;const Be=new Set(["clear","push","unshift","replace"]),We=e=>e;const qe=function(e,t,{comment:r=null,shouldKeepInCache:o=!0}={}){if(!B.isObservable(e))return"boolean"==typeof e?e?M.getChild(t):null:n.warn("ShowIf","ShowIf : condition must be an Observable or boolean / "+r,e);const s=k("Show if : "+(r||""));let i=null;const a=()=>(i&&o||(i=M.getChild(t),B.isFragment(i)&&(i=Array.from(i.childNodes))),i);return e.val()&&s.appendChild(a()),e.subscribe(e=>{e?s.appendChild(a()):s.remove()}),s},Ue=function(e,t,n=!0){if(!B.isObservable(e))throw new r("Toggle : condition must be an Observable");const o=k("Match"),s=new Map,i=function(e){if(n&&s.has(e))return s.get(e);let r=t[e];return r?(r=M.getChild(r),B.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(r){n&&s.delete(r),e.set([...s.keys()].at(-1)??""),delete t[r]}})},He=function(e,t,n){if(!B.isObservable(e))throw new r("Toggle : condition must be an Observable");return Ue(e.toBoolean(),{true:t,false:n})},ze=Q("div"),Ge=Q("span"),Ke=Q("label"),Je=Q("p"),Ye=Je,Qe=Q("strong"),Xe=Q("h1"),Ze=Q("h2"),et=Q("h3"),tt=Q("h4"),nt=Q("h5"),rt=Q("h6"),ot=Q("br"),st=Q("a"),it=Q("pre"),at=Q("code"),lt=Q("blockquote"),ut=Q("hr"),ct=Q("em"),ht=Q("small"),pt=Q("mark"),dt=Q("del"),ft=Q("ins"),mt=Q("sub"),bt=Q("sup"),yt=Q("abbr"),gt=Q("cite"),vt=Q("q"),wt=Q("dl"),$t=Q("dt"),St=Q("dd"),Ct=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}),Ot=Q("input"),At=Q("textarea"),Et=At,_t=Q("select"),xt=Q("fieldset"),Nt=Q("option"),Ft=Q("legend"),Dt=Q("datalist"),Mt=Q("output"),Tt=Q("progress"),kt=Q("meter"),Pt=Q("button"),It=Q("main"),Lt=Q("section"),Rt=Q("article"),Vt=Q("aside"),jt=Q("nav"),Bt=Q("figure"),Wt=Q("figcaption"),qt=Q("header"),Ut=Q("footer"),Ht=Q("img"),zt=function(e,t){return Ht({src:e,...t})},Gt=Q("details"),Kt=Q("summary"),Jt=Q("dialog"),Yt=Q("menu"),Qt=Q("ol"),Xt=Q("ul"),Zt=Q("li"),en=Zt,tn=Qt,nn=Xt,rn=Q("audio"),on=Q("video"),sn=Q("source"),an=Q("track"),ln=Q("canvas"),un=Q("svg"),cn=Q("time"),hn=Q("data"),pn=Q("address"),dn=Q("kbd"),fn=Q("samp"),mn=Q("var"),bn=Q("wbr"),yn=Q("caption"),gn=Q("table"),vn=Q("thead"),wn=Q("tfoot"),$n=Q("tbody"),Sn=Q("tr"),Cn=Sn,On=Q("th"),An=On,En=On,_n=Q("td"),xn=_n;function Nn(e){let t=null,n=(r,o)=>(t=document.createElementNS("http://www.w3.org/2000/svg",e),n=(e,n)=>Y(t.cloneNode(),e,n),Y(t.cloneNode(),r,o));return(e,t)=>n(e,t)}const Fn=Nn("svg"),Dn=Nn("circle"),Mn=Nn("rect"),Tn=Nn("ellipse"),kn=Nn("line"),Pn=Nn("polyline"),In=Nn("polygon"),Ln=Nn("path"),Rn=Nn("text"),Vn=Nn("tspan"),jn=Nn("textPath"),Bn=Nn("g"),Wn=Nn("defs"),qn=Nn("use"),Un=Nn("symbol"),Hn=Nn("clipPath"),zn=Nn("mask"),Gn=Nn("marker"),Kn=Nn("pattern"),Jn=Nn("image"),Yn=Nn("foreignObject"),Qn=Nn("switch"),Xn=Nn("linearGradient"),Zn=Nn("radialGradient"),er=Nn("stop"),tr=Nn("filter"),nr=Nn("feBlend"),rr=Nn("feColorMatrix"),or=Nn("feComposite"),sr=Nn("feFlood"),ir=Nn("feGaussianBlur"),ar=Nn("feMerge"),lr=Nn("feMergeNode"),ur=Nn("feOffset"),cr=Nn("feTurbulence"),hr=Nn("feDisplacementMap"),pr=Nn("feDiffuseLighting"),dr=Nn("feSpecularLighting"),fr=Nn("feDistantLight"),mr=Nn("fePointLight"),br=Nn("feSpotLight"),yr=Nn("feMorphology"),gr=Nn("feConvolveMatrix"),vr=Nn("feComponentTransfer"),wr=Nn("feFuncR"),$r=Nn("feFuncG"),Sr=Nn("feFuncB"),Cr=Nn("feFuncA"),Or=Nn("animate"),Ar=Nn("animateTransform"),Er=Nn("animateMotion"),_r=Nn("mpath"),xr=Nn("set"),Nr=Nn("desc"),Fr=Nn("title"),Dr=Nn("metadata"),Mr=Nn("view"),Tr=Nn("style"),kr=Nn("script"),Pr=Q("");var Ir=Object.freeze({__proto__:null,Abbr:yt,Address:pn,Anchor:k,Article:Rt,Aside:Vt,AsyncImg:function(e,t,n,o){const s=B.isObservable(e)?e.val():e,i=zt(t||s,n),a=new Image;return a.onload=()=>{B.isFunction(o)&&o(null,i),i.src=B.isObservable(e)?e.val():e},a.onerror=()=>{B.isFunction(o)&&o(new r("Image not found"))},B.isObservable(e)&&e.subscribe(e=>{a.src=e}),a.src=s,i},Audio:rn,BaseImage:Ht,Blockquote:lt,Br:ot,Button:Pt,Canvas:ln,Caption:yn,Checkbox:e=>Ot({type:"checkbox",...e}),Cite:gt,Code:at,ColorInput:e=>Ot({type:"color",...e}),Data:hn,Datalist:Dt,DateInput:e=>Ot({type:"date",...e}),DateTimeInput:e=>Ot({type:"datetime-local",...e}),Dd:St,Del:dt,Details:Gt,Dialog:Jt,Div:ze,Dl:wt,Dt:$t,Em:ct,EmailInput:e=>Ot({type:"email",...e}),FieldSet:xt,FigCaption:Wt,Figure:Bt,FileInput:e=>Ot({type:"file",...e}),Footer:Ut,ForEach:function(e,t,o,{shouldKeepItemsInCache:s=!1}={}){t=t||je;const i=k("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(B.isString(n)){const r=B.isObservable(e)?e.val():e,o=r?.[n];return B.isObservable(o)?o.val():o??t}return B.isFunction(n)?n(e,t):(B.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?p(s):null;let o=M.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=B.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(),B.isObservable(e)&&e.subscribe(f),i},ForEachArray:function(e,t,n={}){t=t||We;const r=k("ForEach Array",n.isParentUniqueChild),o=r.endElement();let s=new Map,i=0;const a=t.length>=2,l=e=>{r.removeChildren(),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=M.getChild(t(e,null));return s.set(e,{child:n,indexObserver:null}),n};let p=(n,r)=>{const o=e.transform(e=>e.indexOf(n)),i=M.getChild(t(n,o));return s.set(n,{child:i,indexObserver:o}),i};e.__$Observable||(p=(e,n)=>{const r=M.getChild(t(e,n));return s.set(e,{child:r,indexObserver:null}),r});const 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()};let y=null;y=Array.isArray(e)?()=>{l(e),r.appendChildRaw(g.toFragment(e))}:()=>{const t=e.val();l(t),r.appendChildRaw(g.toFragment(t))};const g={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(g.toFragment(e))},replace:e=>{l(e),r.appendChildRaw(g.toFragment(e))},set:y,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:l,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(g.toFragment(e))},splice:(t,n)=>{const[s,i,...a]=t;let l=null;const c=document.createDocumentFragment();if(n.length>0){let e=n[0];if(1===n.length)b(e,c);else if(n.length>1){const e=u(n[0]);l=e?.previousSibling;for(let e=0;e<n.length;e++)b(n[e],c)}}else{const t=s-1>=0?s-1:s,n=e.at(t);l=u(n)||o.previousSibling}c.replaceChildren(),a&&a.length&&l&&r.insertBeforeRaw(g.toFragment(a),l.nextSibling)},reverse:(e,t)=>{g.reOrder(t)},sort:(e,t)=>{g.reOrder(t)},remove:(e,t)=>{g.removeOne(t)},pop:(e,t)=>{g.removeOne(t)},shift:(e,t)=>{g.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}};g.merge=g.add,g.push=g.add;const v=(e,t,n={})=>{((e=null)=>{m=Be.has(e)?a?p:h:s.size?d:a?p:h})(n.action),g[n.action]&&g[n.action](n.args,n.result)};return Array.isArray(e)?(v(0,0,{action:"set"}),r):(e.val().length&&v(e.val(),0,{action:"set"}),e.subscribe(v),r)},Form:Ct,Fragment:Pr,H1:Xe,H2:Ze,H3:et,H4:tt,H5:nt,H6:rt,Header:qt,HiddenInput:e=>Ot({type:"hidden",...e}),HideIf:function(e,t,n){const r=p(!e.val());return e.subscribe(e=>r.set(!e)),qe(r,t,n)},HideIfNot:function(e,t,n){return qe(e,t,n)},Hr:ut,Img:zt,Input:Ot,Ins:ft,Kbd:dn,Label:Ke,LazyImg:function(e,t){return zt(e,{...t,loading:"lazy"})},Legend:Ft,Li:en,Link:st,ListItem:Zt,Main:It,Mark:pt,Match:Ue,Menu:Yt,Meter:kt,MonthInput:e=>Ot({type:"month",...e}),NativeDocumentFragment:k,Nav:jt,NumberInput:e=>Ot({type:"number",...e}),Ol:tn,Option:Nt,OrderedList:Qt,Output:Mt,P:Je,Paragraph:Ye,PasswordInput:e=>Ot({type:"password",...e}),Pre:it,Progress:Tt,Quote:vt,Radio:e=>Ot({type:"radio",...e}),RangeInput:e=>Ot({type:"range",...e}),ReadonlyInput:e=>Ot({readonly:!0,...e}),Samp:fn,SearchInput:e=>Ot({type:"search",...e}),Section:Lt,Select:_t,ShowIf:qe,ShowWhen:function(){if(2===arguments.length){const[e,t]=arguments;if(!B.isObservableWhenResult(e))throw new r("showWhen observer must be an ObservableWhenResult",{data:e,help:"Use observer.when(target) to create an ObservableWhenResult"});return qe(e,t)}if(3===arguments.length){const[e,t,n]=arguments;if(!B.isObservable(e))throw new r("showWhen observer must be an Observable",{data:e});return qe(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)=>Pt(e,{type:"button",...t}),Small:ht,Source:sn,Span:Ge,Strong:Qe,Sub:mt,SubmitButton:(e,t)=>Pt(e,{type:"submit",...t}),Summary:Kt,Sup:bt,Svg:un,SvgAnimate:Or,SvgAnimateMotion:Er,SvgAnimateTransform:Ar,SvgCircle:Dn,SvgClipPath:Hn,SvgDefs:Wn,SvgDesc:Nr,SvgEllipse:Tn,SvgFEBlend:nr,SvgFEColorMatrix:rr,SvgFEComponentTransfer:vr,SvgFEComposite:or,SvgFEConvolveMatrix:gr,SvgFEDiffuseLighting:pr,SvgFEDisplacementMap:hr,SvgFEDistantLight:fr,SvgFEFlood:sr,SvgFEFuncA:Cr,SvgFEFuncB:Sr,SvgFEFuncG:$r,SvgFEFuncR:wr,SvgFEGaussianBlur:ir,SvgFEMerge:ar,SvgFEMergeNode:lr,SvgFEMorphology:yr,SvgFEOffset:ur,SvgFEPointLight:mr,SvgFESpecularLighting:dr,SvgFESpotLight:br,SvgFETurbulence:cr,SvgFilter:tr,SvgForeignObject:Yn,SvgG:Bn,SvgImage:Jn,SvgLine:kn,SvgLinearGradient:Xn,SvgMPath:_r,SvgMarker:Gn,SvgMask:zn,SvgMetadata:Dr,SvgPath:Ln,SvgPattern:Kn,SvgPolygon:In,SvgPolyline:Pn,SvgRadialGradient:Zn,SvgRect:Mn,SvgScript:kr,SvgSet:xr,SvgStop:er,SvgStyle:Tr,SvgSvg:Fn,SvgSwitch:Qn,SvgSymbol:Un,SvgTSpan:Vn,SvgText:Rn,SvgTextPath:jn,SvgTitle:Fr,SvgUse:qn,SvgView:Mr,Switch:He,TBody:$n,TBodyCell:xn,TFoot:wn,TFootCell:En,THead:vn,THeadCell:An,TRow:Cn,Table:gn,Td:_n,TelInput:e=>Ot({type:"tel",...e}),TextArea:At,TextInput:Et,Th:On,Time:cn,TimeInput:e=>Ot({type:"time",...e}),Tr:Sn,Track:an,Ul:nn,UnorderedList:Xt,UrlInput:e=>Ot({type:"url",...e}),Var:mn,Video:on,Wbr:bn,WeekInput:e=>Ot({type:"week",...e}),When:function(e){if(!B.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,He(e,t,n)),toNdElement:()=>He(e,t,n)}},createPortal:function(e,{parent:t,name:n="unnamed"}={}){const r=k("Portal "+n);return r.appendChild(M.getChild(e)),(t||document.body).appendChild(r),r}});const Lr={};function Rr(e,t,n={}){e="/"+a(e,"/").replace(/\/+/,"/");let r=null,o=n.name||null;const s=n.middlewares||[],i=n.shouldRebuild||!1,l=n.with||{},u=n.layout||null,c={},h=[],p=e=>{if(!e)return null;const[t,n]=e.split(":");let r=l[t];return!r&&n&&(r=Lr[n]),r||(r="[^/]+"),r=r.replace("(","(?:"),{name:t,pattern:`(${r})`}},d=()=>{if(r)return r;const t=e.replace(/\{(.*?)}/gi,(e,t)=>{const n=p(t);return n&&n.pattern?(c[n.name]=n.pattern,h.push(n.name),n.pattern):e});return r=new RegExp("^"+t+"$"),r};this.name=()=>o,this.component=()=>t,this.middlewares=()=>s,this.shouldRebuild=()=>i,this.path=()=>e,this.layout=()=>u,this.match=function(e){e="/"+a(e,"/");if(!d().exec(e))return!1;const t={};return d().exec(e).forEach((e,n)=>{if(n<1)return;const r=h[n-1];t[r]=e}),t},this.url=function(t){const n=e.replace(/\{(.*?)}/gi,(e,n)=>{const r=p(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 Vr extends Error{constructor(e,t){super(e),this.context=t}}const jr=(e,t)=>{const n=[];return e.forEach(e=>{n.push(a(e.suffix,"/"))}),n.push(a(t,"/")),n.join("/")},Br=(e,t)=>{const n=[];return e.forEach(e=>{e.options.middlewares&&n.push(...e.options.middlewares)}),t&&n.push(...t),n},Wr=(e,t)=>{const n=[];return e.forEach(e=>{e.options?.name&&n.push(e.options.name)}),t&&n.push(t),n.join(".")},qr=e=>{for(let t=e.length-1;t>=0;t--)if(e[t]?.options?.layout)return e[t].options.layout;return null};function Ur(){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 Hr(){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 zr(){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 Gr(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 B.isAnchor(e)||(r=k(t),r.appendChild(e)),o.set(e,r),r},l=()=>{B.isAnchor(i)&&i.remove()},u=()=>{t.nodeValue="",l(),s&&s.remove()},c=e=>{let t=e;return B.isNDElement(e)&&(t=e.node()),t},h=function(e,n,o){const h=n.layout();if(h)return void((e,n,o,h)=>{let p=c(n);const d=r.get(p);if(d){if(d===s){const e=a(p,h);return l(),i=p,void e.replaceContent(p)}return u(),i=p,s=d,a(p,h).replaceContent(p),void t.appendChild(s)}u(),i=p;const f=a(p,h);s=M.getChild(e(f)),r.set(p,s),t.appendChild(s)})(h,e,0,o);let p=c(e);u(),t.appendChild(p),i=e},p=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(p),p(e.currentState()),t}const Kr="default";function Jr(e={}){const t=[],r={},o=[],s=[],i={route:null,params:null,query:null,path:null,hash:null};if("hash"===e.mode)Ur.apply(this,[]);else if("history"===e.mode)Hr.apply(this,[]);else{if("memory"!==e.mode)throw new Vr("Invalid router mode "+e.mode);zr.apply(this,[])}const l=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 Rr(jr(o,e),n,{...s,middlewares:Br(o,s?.middlewares||[]),name:s?.name?Wr(o,s.name):null,layout:s?.layout||qr(o)});return t.push(i),i.name()&&(r[i.name()]=i),this},this.group=function(e,t,n){if(!B.isFunction(n))throw new Vr("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 Vr(`Route not found for name: ${e}`);return o.url({params:t,query:n})},this.resolve=function(e){if("string"==typeof e){const t=r[e];if(t)return{route:t,params:[],query:[],path:t.url({name:e})}}if(B.isJson(e)){const t=r[e.name];if(!t)throw new Vr(`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="/"+a(n,"/");let i,l=null;for(const e of t)if(i=e.match(s),i){l=e;break}if(!l)throw new Vr(`Route not found for url: ${n}`);const u={};if(o){const e=new URLSearchParams(o).entries();for(const[t,n]of e)u[t]=n}return{route:l,params:i,query:u,path:e}},this.subscribe=function(e){if(!B.isFunction(e))throw new Vr("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(),l];let s=0;const a={...i},u=e=>{if(s++,!(s>=o.length))return o[s](e||a,u)};return o[s](a,u)}}function Yr(e,t){const{to:n,href:r,...o}=e;if(r){const e=Jr.get();return st({...o,href:r},t).nd.onPreventClick(()=>{e.push(r)})}const s="string"==typeof n?{name:n}:n,i=s.router||Kr,a=Jr.get(i);if(!a)throw new Vr('Router not found "'+i+'" for link "'+s.name+'"');const l=a.generateUrl(s.name,s.params,s.query);return st({...o,href:l},t).nd.onPreventClick(()=>{a.push(l)})}Jr.routers={},Jr.create=function(e,t){if(!B.isFunction(t))throw n.error("Router","Callback must be a function"),new Vr("Callback must be a function");const r=new Jr(e);return Jr.routers[e.name||Kr]=r,t(r),r.init(e.entry),r.mount=function(e){if(B.isString(e)){const t=document.querySelector(e);if(!t)throw new Vr(`Container not found for selector: ${e}`);e=t}else if(!B.isElement(e))throw new Vr("Container must be a string or an Element");return Gr(r,e)},r},Jr.get=function(e){const t=Jr.routers[e||Kr];if(!t)throw new Vr(`Router not found for name: ${e}`);return t},Jr.push=function(e,t=null){return Jr.get(t).push(e)},Jr.replace=function(e,t=null){return Jr.get(t).replace(e)},Jr.forward=function(e=null){return Jr.get(e).forward()},Jr.back=function(e=null){return Jr.get(e).back()},Jr.redirectTo=function(e,t=null,n=null){let r=e;const o=Jr.get(n);return o.resolve({name:e,params:t})&&(r={name:e,params:t}),o.push(r)},Yr.blank=function(e,t){return st({...e,target:"_blank"},t)};var Qr=Object.freeze({__proto__:null,Link:Yr,RouteParamPatterns:Lr,Router:Jr});var Xr=Object.freeze({__proto__:null,memoize:e=>ae(e),once:e=>ie(e),singleton:e=>se(e)}),Zr=Object.freeze({__proto__:null,Cache:Xr,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)}},classPropertyAccumulator:oe,cssPropertyAccumulator:re,filters:Me});return e.$=d,e.ElementCreator=M,e.HtmlElementWrapper=Q,e.NDElement=P,e.Observable=p,e.PluginsManager=null,e.SingletonView=ne,e.Store=Ve,e.StoreFactory=Re,e.TemplateCloner=ee,e.Validator=B,e.autoMemoize=ae,e.autoOnce=ie,e.classPropertyAccumulator=oe,e.createTextNode=J,e.cssPropertyAccumulator=re,e.elements=Ir,e.memoize=e=>{const t=new Map;return(...n)=>{const[r,...o]=n,s=t.get(r);if(s)return s;const i=e(...o);return t.set(r,i),i}},e.normalizeComponentArgs=K,e.obs=f,e.once=se,e.router=Qr,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=Zr,e.withValidation=G,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()}}const o=3,s=8,i=11,a=[];a[1]=!0,a[o]=!0,a[i]=!0,a[s]=!0;const l={isObservable:e=>e&&(e.__$isObservable||e.__$Observable),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=>l.isObservable(e)||l.isProxy(e),isAnchor:e=>e?.__Anchor__,isObservableChecker:e=>e?.__$isObservableChecker,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&&a[e.nodeType],isDOMNode:e=>a[e.nodeType],isFragment:e=>e?.nodeType===i,isStringOrObservable(e){return this.isString(e)||this.isObservable(e)},isValidChild(e){return null===e||this.isElement(e)||e.__$Observable||e?.__$isNDElement||["string","number","boolean"].includes(typeof e)},isNDElement:e=>e?.__$isNDElement,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&&(l.isObject(e)&&Object.values(e).some(e=>l.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")}},u=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"]),c=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`)}}}();const h=function(e){let t=!1;return function(...n){t||(t=!0,Promise.resolve().then(()=>{e.apply(this,n),t=!1}))}},p=function(e,t){return e.replace(new RegExp(`^[${t}]+|[${t}]+$`,"g"),"")},d=(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=>d(e));if(l.isObservable(e))return t&&t(e),e;const n={};for(const t in e)Object.hasOwn(e,t)&&(n[t]=d(e[t]));return n},f={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)},b=(e,t)=>{if(!f.has(e))return t;switch(typeof t){case"object":return f.getJson(e)??t;case"boolean":return f.getBool(e)??t;case"number":return f.getNumber(e)??t;default:return f.get(e,t)??t}},m=e=>{switch(typeof e){case"object":return f.setJson;case"boolean":return f.setBool;default:return f.set}};function y(e,t=null){e=l.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=l.isObject(e)?d(e):e))}Object.defineProperty(y.prototype,"$value",{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0}),y.prototype.__$Observable=!0,y.prototype.__$isObservable=!0;const g=function(){};y.prototype.intercept=function(e){return this.$interceptor=e,this.set=this.$setWithInterceptor,this},y.prototype.interceptMutations=function(e){return this.$mutationInterceptor=e,this},y.prototype.triggerFirstListener=function(e){this.$firstListener(this.$currentValue,this.$previousValue,e)},y.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)},y.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)},y.prototype.triggerAll=function(e){this.triggerWatchers(e),this.triggerListeners(e)},y.prototype.triggerWatchersAndFirstListener=function(e){this.triggerWatchers(e),this.triggerFirstListener(e)},y.prototype.assocTrigger=function(){if(this.$firstListener=null,this.$watchers?.size&&this.$listeners?.length)return this.$firstListener=this.$listeners[0],this.trigger=0===this.$firstListener.length?this.$firstListener:this.triggerFirstListener,void(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=g},y.prototype.trigger=g;const v={action:"set"};function $(e,t=null){return new y(e,t)}y.prototype.$updateWithNewValue=function(e){e=e?.__$isObservable?e.val():e,this.$currentValue!==e&&(this.$previousValue=this.$currentValue,this.$currentValue=e,this.trigger(v),this.$previousValue=null)},y.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)},y.prototype.$basicSet=function(e){let t="function"==typeof e?e(this.$currentValue):e;this.$updateWithNewValue(t)},y.prototype.set=y.prototype.$basicSet,y.prototype.val=function(){return this.$currentValue},y.prototype.disconnectAll=function(){this.$previousValue=null,this.$currentValue=null,this.$listeners=null,this.$watchers=null,this.trigger=g},y.prototype.onCleanup=function(e){this.$cleanupListeners=this.$cleanupListeners??[],this.$cleanupListeners.push(e)},y.prototype.cleanup=function(){if(this.$cleanupListeners){for(let e=0;e<this.$cleanupListeners.length;e++)this.$cleanupListeners[e]();this.$cleanupListeners=null}c.unregister(this.$memoryId),this.disconnectAll(),delete this.$value},y.prototype.subscribe=function(e){this.$listeners=this.$listeners??[],this.$listeners.push(e),this.assocTrigger()},y.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?l.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()},y.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()},y.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)},y.prototype.unsubscribe=function(e){if(!this.$listeners)return;const t=this.$listeners.indexOf(e);t>-1&&this.$listeners.splice(t,1),this.assocTrigger()},y.prototype.get=function(e){const t=this.$currentValue[e];return l.isObservable(t)?t.val():t},y.prototype.equals=function(e){return l.isObservable(e)?this.$currentValue===e.$currentValue:this.$currentValue===e},y.prototype.toBool=function(){return!!this.$currentValue},y.prototype.toggle=function(){this.set(!this.$currentValue)},y.prototype.reset=function(){if(!this.configs?.reset)return;const e=l.isObject(this.$initialValue)?d(this.$initialValue,e=>{e.reset()}):this.$initialValue;this.set(e)},y.prototype.toString=function(){return String(this.$currentValue)},y.prototype.valueOf=function(){return this.$currentValue},y.prototype.persist=function(e,t={}){let n=b(e,this.$currentValue);t.get&&(n=t.get(n)),this.set(n);const r=m(this.$currentValue);return this.subscribe(n=>{r(e,t.set?t.set(n):n)}),this},y.prototype.clone=function(){let e=this.$currentValue;return e&&"object"==typeof e&&(e="function"==typeof e.clone?e.clone():structuredClone(e)),new y(e)};const w=$,S=$;$.useValueProperty=function(e="value"){Object.defineProperty(y.prototype,e,{get(){return this.$currentValue},set(e){this.set(e)},configurable:!0})},$.getById=function(e){const t=c.getObservableById(parseInt(e));if(!t)throw new r("Observable.getById : No observable found with id "+e);return t},$.cleanup=function(e){e.cleanup()},$.autoCleanup=function(e=!1,t={}){if(!e)return;const{interval:n=6e4,threshold:r=100}=t;window.addEventListener("beforeunload",()=>{c.cleanup()}),setInterval(()=>c.cleanObservables(r),n)};const C=(e,t)=>{for(const n in t){const r=t[n];if(r.__$Observable){if(r.__$isObservableChecker){let t=r.val();if("string"==typeof t){e.classes.toggle(t,!0),r.subscribe(n=>{e.classes.remove(t),e.classes.toggle(n,!0),t=n});continue}}e.classes.toggle(n,r.val()),r.subscribe(t=>e.classes.toggle(n,t))}else r.$hydrate?r.$hydrate(e,n):e.classes.toggle(n,r)}},O=(e,t)=>{for(const n in t){const r=t[n],o=n.startsWith("--");r.__$Observable?o?(e.style.setProperty(n,r.val()),r.subscribe(t=>{!1!==t?e.style.setProperty(n,t):e.style.removeProperty(n)})):(e.style[n]=r.val(),r.subscribe(t=>{!1!==t?e.style[n]=t:e.style.removeProperty(n)})):o?e.style.setProperty(n,r):e.style[n]=r}},A=(e,t,n)=>{const r=n.__$isObservable,o=r?n.val():n;if(l.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)}},E=(e,t)=>{for(const n in t){const r=n.toLowerCase();let o=t[n];if(null!=o)if(o.handleNdAttribute)o.handleNdAttribute(e,r,o);else{if("object"==typeof o){if("class"===r){C(e,o);continue}if("style"===r){O(e,o);continue}}u.has(r)?A(e,r,o):e.setAttribute(r,o)}}return e};let _=null;const N={createTextNode:()=>(_||(_=document.createTextNode(""),N.createTextNode=()=>_.cloneNode()),_.cloneNode()),createObservableNode:(e,t)=>{const n=N.createTextNode();return t.subscribe(e=>n.nodeValue=e),n.nodeValue=t.val(),e&&e.appendChild(n),n},createHydratableNode:(e,t)=>{const n=N.createTextNode();return t.$hydrate(n),n},createStaticTextNode:(e,t)=>{let n=N.createTextNode();return n.nodeValue=t,e&&e.appendChild(n),n},createElement:e=>document.createElement(e).cloneNode(),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=N.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(),l.isElement(e))return e}while(e.toNdElement);return N.createStaticTextNode(null,e)},processAttributes:(e,t)=>{t&&E(e,t)},processAttributesDirect:E,processClassAttribute:C,processStyleAttribute:O};function x(e){const t=Reflect.construct(DocumentFragment,[],x),n=document.createComment((e||"")+" Anchor Sentinel"),r=document.createComment("Anchor Start : "+e),o=document.createComment("/ Anchor End "+e),s={};t.append(r,n,o);const i=new MutationObserver(()=>{n.parentNode===t||n.parentNode instanceof DocumentFragment||s.connected&&s.connected(n.parentNode)});return i.observe(document,{childList:!0,subtree:!0}),t.$sentinel=n,t.$start=r,t.$end=o,t.$observer=i,t.$events=s,t}function F(e,t=!1){const n=new x(e);n.onConnectedOnce(e=>{t&&function(e,t){e.remove=()=>{e.append.apply(e,t.childNodes)},e.getParent=()=>t,e.appendChild=e=>{e=l.isElement(e)?e:N.getChild(e),t.appendChild(e)},e.appendChildRaw=t.appendChild.bind(t),e.append=e.appendChild,e.appendRaw=e.appendChildRaw,e.insertAtStart=e=>{e=l.isElement(e)?e:N.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=l.isElement(e)?e:N.getChild(e);t.replaceChildren(n)},e.replaceContentRaw=function(e){t.replaceChildren(e)},e.setContent=e.replaceContent,e.insertBefore=(e,n)=>{e=l.isElement(e)?e:N.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=n.$start,o=n.$end;n.nativeInsertBefore=n.insertBefore,n.nativeAppendChild=n.appendChild,n.nativeAppend=n.append;const s=t?()=>!0:e=>e.firstChild===r&&e.lastChild===o,i=(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?((e,t,n)=>{const r=l.isElement(t)?t:N.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=l.isElement(e)?e:N.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.nativeAppend.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.delete=n.removeWithAnchors,n.replaceContent=function(e){const t=l.isElement(e)?e:N.getChild(e);n.replaceContentRaw(t)},n.replaceContentRaw=function(e){const t=o.parentNode;t&&(s(t)?t.replaceChildren(r,e,o):(n.removeChildren(),t.insertBefore(e,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}x.prototype=Object.create(DocumentFragment.prototype),x.prototype.constructor=x,x.prototype.onConnected=function(e){return this.$events.connected=e,this},x.prototype.onConnectedOnce=function(e){this.$events.connected=t=>{e(t),this.$observer.disconnect(),this.$events.connectedOnce=null}},DocumentFragment.prototype.setAttribute=()=>{};const M={mounted:new WeakMap,beforeUnmount:new WeakMap,mountedSupposedSize:0,unmounted:new WeakMap,unmountedSupposedSize:0,observer:null,initObserver:()=>{M.observer||(M.observer=new MutationObserver(M.checkMutation),M.observer.observe(document.body,{childList:!0,subtree:!0}))},executeMountedCallback(e){const t=M.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=M.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(M.mountedSupposedSize>0)for(const e of t.addedNodes){if(M.executeMountedCallback(e),!e.querySelectorAll)continue;const t=e.querySelectorAll("[data--nd-mounted]");for(const e of t)M.executeMountedCallback(e)}if(M.unmountedSupposedSize>0)for(const e of t.removedNodes){if(M.executeUnmountedCallback(e),!e.querySelectorAll)continue;const t=e.querySelectorAll("[data--nd-unmounted]");for(const e of t)M.executeUnmountedCallback(e)}}},watch:function(e,t=!1){let n=!1,r=!1;M.initObserver();let o={inDom:t,mounted:null,unmounted:null,disconnect:()=>{n&&(M.mounted.delete(e),M.mountedSupposedSize--),r&&(M.unmounted.delete(e),M.unmountedSupposedSize--),o=null}};const s=(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=>{s("mounted",t),M.mounted.set(e,o),n||(M.mountedSupposedSize++,n=!0)},unmounted:t=>{s("unmounted",t),M.unmounted.set(e,o),r||(M.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)}}}};function T(e){this.$element=e,this.$attachements=null}T.prototype.__$isNDElement=!0,T.$getChild=e=>e,T.prototype.ghostDom=function(e){return this.$attachements||(this.$attachements=document.createDocumentFragment()),this.$attachements.appendChild(T.$getChild(e)),this},T.prototype.valueOf=function(){return this.$element},T.prototype.ref=function(e,t){return e[t]=this.$element,this},T.prototype.refSelf=function(e,t){return e[t]=this,this},T.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},T.prototype.remove=function(){let e=this.$element;return e.nd.unmountChildren(),e.$ndProx=null,D.delete(e),e=null,this};const D=new WeakMap;T.prototype.lifecycle=function(e){const t=this.$element;D.has(t)||D.set(t,M.watch(t));const n=D.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},T.prototype.mounted=function(e){return this.lifecycle({mounted:e})},T.prototype.unmounted=function(e){return this.lifecycle({unmounted:e})},T.prototype.beforeUnmount=function(e,t){const n=this.$element;if(!M.beforeUnmount.has(n)){M.beforeUnmount.set(n,new Map);const e=n.remove.bind(n);let t=!1;n.remove=async()=>{if(!t){t=!0;try{const e=M.beforeUnmount.get(n);for(const t of e.values())await t.call(this,n)}finally{e(),t=!1}}}}return M.beforeUnmount.get(n).set(e,t),this},T.prototype.htmlElement=function(){return this.$element},T.prototype.node=T.prototype.htmlElement,T.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},T.prototype.openShadow=function(e=null){return this.shadow("open",e)},T.prototype.closedShadow=function(e=null){return this.shadow("closed",e)},T.prototype.with=function(e){if(!e||"object"!=typeof e)throw new r("extend() requires an object of methods");for(const t in e){const r=e[t];"function"==typeof r?this[t]=r.bind(this):n.warn(`⚠️ extends(): "${t}" is not a function, skipping`)}return this},T.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}"`);T.prototype[o]&&n.warn("NDElement.extend",`Overwriting existing prototype method "${o}"`),T.prototype[o]=s}else n.warn("NDElement.extend",`"${o}" is not a function, skipping`)}return T};const k={configurable:!0,get(){return new T(this)}};Object.defineProperty(HTMLElement.prototype,"nd",k),Object.defineProperty(DocumentFragment.prototype,"nd",k),Object.defineProperty(T.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();T.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();T.prototype["onStop"+e]=function(e=null){return L(this.$element,t,e),this},T.prototype["onPreventStop"+e]=function(e=null){return I(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();T.prototype["onPrevent"+e]=function(e=null){return P(this.$element,t,e),this}}),T.prototype.on=function(e,t,n){return this.$element.addEventListener(e.toLowerCase(),t,n),this};const P=function(e,t,n){return e.addEventListener(t,t=>{t.preventDefault(),n&&n.call(e,t)}),this},L=function(e,t,n){return e.addEventListener(t,t=>{t.stopPropagation(),n&&n.call(e,t)}),this},I=function(e,t,n){return e.addEventListener(t,t=>{t.stopPropagation(),t.preventDefault(),n&&n.call(e,t)}),this},R={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,...R}}});let j=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 V=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}},B=e=>e?e.toNdElement():N.createTextNode(),q=(e,t,n=null)=>{let{props:r,children:o=null}=V(t,n);return N.processAttributes(e,r),N.processChildren(o,e),e};function W(e,t=null){if(e){if(t){let n=null,r=(o,s)=>(n=document.createElement(e),r=(e,r)=>q(t(n.cloneNode()),e,r),q(t(n.cloneNode()),o,s));return(e,t)=>r(e,t)}let n=null,r=(t,o)=>(n=document.createElement(e),r=(e,t)=>q(n.cloneNode(),e,t),q(n.cloneNode(),t,o));return(e,t)=>r(e,t)}return(e,t="")=>{const n=F(t);return n.append(e),n}}function U(e){this.$hydrate=e}function H(e){this.$element=e,this.$classes=null,this.$styles=null,this.$attrs=null,this.$ndMethods=null}U.prototype.__$isTemplateBinding=!0,T.prototype.attach=function(e,t){if("function"==typeof t){const n=this.$element;return n.nodeCloner=n.nodeCloner||new H(n),n.nodeCloner.attach(e,t),n}return t.$hydrate(this.$element,e),this.$element},H.prototype.__$isNodeCloner=!0;const z=(e,t,n)=>{for(const r in t)e[r]=t[r].apply(null,n);return e};H.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),N.processClassAttribute(e,t)})}else e.push((e,n)=>{N.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),N.processStyleAttribute(e,t)})}else e.push((e,n)=>{N.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),N.processAttributes(e,t)})}else e.push((e,n)=>{N.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}},H.prototype.cloneNode=function(e){return this.$element.cloneNode(!1)},H.prototype.attach=function(e,t){return this.$ndMethods=this.$ndMethods||{},this.$ndMethods[e]=t,this},H.prototype.text=function(e){return this.$content=e,"function"==typeof e?(this.cloneNode=t=>B(e.apply(null,t)),this):(this.cloneNode=t=>B(t[0][e]),this)},H.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 G(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=K(this);return t=e(o),t.nodeCloner||(t.nodeCloner=new H(t)),n(t),this.clone=t.dynamicCloneNode,t.dynamicCloneNode(r)};const r=(e,t)=>new U((n,r)=>{!function(e,t,n,r){n.nodeCloner=n.nodeCloner||new H(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 K=e=>new Proxy(e,{get:(e,t)=>t in e||"symbol"==typeof t?e[t]:e.value(t)});function J(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=F("Component "+e);return n[e]=function(...e){r.removeChildren(),t?r.appendChild(t(...e)):r.append(e)},r}}function Y(e,t){this.observable=e,y.call(this),this.$mutation=t,e.subscribe(e=>{this.$updateWithMutation(e)}),this.$updateWithMutation(e.val())}DocumentFragment.prototype.__IS_FRAGMENT=!0,Function.prototype.args=function(...e){return this},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},Y.prototype=Object.create(y.prototype),Y.prototype.constructor=Y,Y.prototype.__$Observable=!0,Y.prototype.__$isObservableChecker=!0;const Q=Y;Q.prototype.constructor=Q,Y.prototype.$updateWithMutation=function(e){return e=this.$mutation(e),this.set(e)},T.$getChild=N.getChild,String.prototype.toNdElement=function(){return N.createStaticTextNode(null,this)},Number.prototype.toNdElement=function(){return N.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},y.prototype.toNdElement=function(){return N.createObservableNode(null,this)},Y.prototype.toNdElement=y.prototype.toNdElement,T.prototype.toNdElement=function(){const e=this.$element??this.$build?.()??this.build?.()??null;return this.$attachements?(this.$attachements.contains(this.$element)||this.$attachements.append(this.$element),this.$attachements):e},Array.prototype.toNdElement=function(){const e=document.createDocumentFragment();for(let t=0,n=this.length;t<n;t++){const n=N.getChild(this[t]);null!==n&&e.appendChild(n)}return e},Function.prototype.toNdElement=function(){return N.getChild(this())},U.prototype.toNdElement=function(){return N.createHydratableNode(null,this)};const X=(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()});T.prototype.transitionOut=function(e){const t=e+"-exit",n=this.$element;return this.beforeUnmount("transition-exit",async function(){n.classes.add(t),await X(n),n.classes.remove(t)}),this},T.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),X(r).then(()=>{r.classes.remove(n)})})})}),this},T.prototype.transition=function(e){return this.transitionIn(e),this.transitionOut(e),this},T.prototype.animate=function(e){const t=this.$element;return t.classes.add(e),X(t).then(()=>{t.classes.remove(e)}),this},y.prototype.handleNdAttribute=function(e,t){u.has(t)?A(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)},Y.prototype.handleNdAttribute=y.prototype.handleNdAttribute,U.prototype.handleNdAttribute=function(e,t){this.$hydrate(e,t)};const Z=function(e={}){let t=l.isString(e)?e.split(";").filter(Boolean):e;return{add(e,n){if(Array.isArray(t))t.push(e+": "+n);else if(l.isObject(e)){n=e;for(const e in n)t[e]=n[e]}else t[e]=n},value:()=>Array.isArray(t)?t.join(";").concat(";"):{...t}}},ee=function(e=[]){let t=l.isString(e)?e.split(" ").filter(Boolean):e;return{add(e,n=!0){if(l.isJson(e))for(const n in e)e[n]&&(t[n]=e[n]);else if(null!=n||e.__$Observable)if(Array.isArray(t)&&(t=t.reduce((e,t)=>(e[t]=!0,e),{})),e.__$Observable){const n=`obs-${Math.random().toString(36).substr(2,9)}`;t[n]=e}else t[e]=n;else Array.isArray(t)?t.push(e):t[e]=n},value:()=>Array.isArray(t)?t.join(" "):{...t}}},te=e=>{let t=null;return(...n)=>(null!=t||(t=e(...n)),t)},ne=e=>{let t=null;return new Proxy({},{get:(n,r)=>(t||(t=e()),t[r])})},re=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 oe(e){return e instanceof Date?e:new Date(e)}function se(e,t){const n=oe(e),r=oe(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function ie(e){const t=oe(e);return 3600*t.getHours()+60*t.getMinutes()+t.getSeconds()}function ae(e,t){const n=l.isObservable(e);return{dependencies:n?e:null,callback:r=>t(r,n?e.val():e)}}function le(e,t){const n=e.filter(l.isObservable);return{dependencies:n.length>0?n:null,callback:n=>t(n,e.map(e=>l.isObservable(e)?e.val():e))}}function ue(e){return ae(e,(e,t)=>e===t)}function ce(e){return ae(e,(e,t)=>e!==t)}function he(e){return ae(e,(e,t)=>e>t)}function pe(e){return ae(e,(e,t)=>e>=t)}function de(e){return ae(e,(e,t)=>e<t)}function fe(e){return ae(e,(e,t)=>e<=t)}function be(e,t=!0,r=""){return le([e,t,r],(e,[t,r,o])=>{if(!t)return!0;if(r)try{return new RegExp(t,o).test(String(e))}catch(e){return n.warn("Invalid regex pattern:",t,e),!1}return o&&""!==o?String(e).includes(String(t)):String(e).toLowerCase().includes(String(t).toLowerCase())})}function me(...e){const t=e.flatMap(e=>e.dependencies?Array.isArray(e.dependencies)?e.dependencies:[e.dependencies]:[]).filter(l.isObservable);return{dependencies:t.length>0?t:null,callback:t=>e.every(e=>e.callback(t))}}function ye(...e){const t=e.flatMap(e=>e.dependencies?Array.isArray(e.dependencies)?e.dependencies:[e.dependencies]:[]).filter(l.isObservable);return{dependencies:t.length>0?t:null,callback:t=>e.some(e=>e.callback(t))}}const ge=he,ve=pe,$e=de,we=fe,Se=ue,Ce=ce,Oe=me,Ae=ye;function Ee(e,t=!1){return ae(e,(e,n)=>!!e&&(!n||(t?String(e).includes(String(n)):String(e).toLowerCase().includes(String(n).toLowerCase()))))}const _e=Ee;var Ne=Object.freeze({__proto__:null,all:Oe,and:me,any:Ae,between:function(e,t){return le([e,t],(e,[t,n])=>e>=t&&e<=n)},contains:_e,createFilter:ae,createMultiSourceFilter:le,custom:function(e,...t){const n=t.filter(l.isObservable);return{dependencies:n.length>0?n:null,callback:n=>{const r=t.map(e=>l.isObservable(e)?e.val():e);return e(n,...r)}}},dateAfter:e=>ae(e,(e,t)=>!(!e||!t)&&oe(e)>oe(t)),dateBefore:e=>ae(e,(e,t)=>!(!e||!t)&&oe(e)<oe(t)),dateBetween:(e,t)=>le([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=oe(e);return r>=oe(t)&&r<=oe(n)}),dateEquals:e=>ae(e,(e,t)=>!(!e||!t)&&se(e,t)),dateTimeAfter:e=>ae(e,(e,t)=>!(!e||!t)&&oe(e)>oe(t)),dateTimeBefore:e=>ae(e,(e,t)=>!(!e||!t)&&oe(e)<oe(t)),dateTimeBetween:(e,t)=>le([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=oe(e);return r>=oe(t)&&r<=oe(n)}),dateTimeEquals:e=>ae(e,(e,t)=>!(!e||!t)&&oe(e).getTime()===oe(t).getTime()),endsWith:function(e,t=!1){return ae(e,(e,n)=>!n||(t?String(e).endsWith(String(n)):String(e).toLowerCase().endsWith(String(n).toLowerCase())))},eq:Se,equals:ue,getSecondsOfDay:ie,greaterThan:he,greaterThanOrEqual:pe,gt:ge,gte:ve,inArray:function(e){return ae(e,(e,t)=>t.includes(e))},includes:Ee,isEmpty:function(e=!0){return ae(e,(e,t)=>{const n=!e||""===e||Array.isArray(e)&&0===e.length;return t?n:!n})},isNotEmpty:function(e=!0){return ae(e,(e,t)=>{const n=!!e&&""!==e&&(!Array.isArray(e)||e.length>0);return t?n:!n})},isSameDay:se,lessThan:de,lessThanOrEqual:fe,lt:$e,lte:we,match:be,neq:Ce,not:function(e){return{dependencies:e.dependencies,callback:t=>!e.callback(t)}},notEquals:ce,notIn:function(e){return ae(e,(e,t)=>!t.includes(e))},or:ye,startsWith:function(e,t=!1){return ae(e,(e,n)=>!n||(t?String(e).startsWith(String(n)):String(e).toLowerCase().startsWith(String(n).toLowerCase())))},timeAfter:e=>ae(e,(e,t)=>!(!e||!t)&&ie(e)>ie(t)),timeBefore:e=>ae(e,(e,t)=>!(!e||!t)&&ie(e)<ie(t)),timeBetween:(e,t)=>le([e,t],(e,[t,n])=>{if(!e||!t||!n)return!1;const r=ie(e);return r>=ie(t)&&r<=ie(n)}),timeEquals:e=>ae(e,(e,t)=>{if(!e||!t)return!1;const n=oe(e),r=oe(t);return n.getHours()===r.getHours()&&n.getMinutes()===r.getMinutes()&&n.getSeconds()===r.getSeconds()}),toDate:oe});const xe=function(e,t=null){if(!Array.isArray(e))throw new r("Observable.array : target must be an array");y.call(this,e,t)};(xe.prototype=Object.create(y.prototype)).constructor=xe,xe.prototype.__$isObservableArray=!0,Object.defineProperty(xe.prototype,"length",{get(){return this.$currentValue.length}}),xe.prototype.$mutate=function(e,t,n){if(this.$mutationInterceptor){const n=this.$mutationInterceptor(t,{action:e});void 0!==t&&(t=n)}n(t)},["push","pop","shift","unshift","reverse","sort","splice"].forEach(e=>{xe.prototype[e]=function(...t){return this.$mutate(e,t,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=>{xe.prototype[e]=function(...t){return this.$currentValue[e].apply(this.$currentValue,t)}});const Fe={action:"clear"};xe.prototype.clear=function(){if(0!==this.$currentValue.length)return this.$mutate("clear",[],()=>{this.$currentValue.length=0,this.trigger(Fe)}),!0},xe.prototype.at=function(e){return this.$currentValue[e]},xe.prototype.merge=function(e){this.$mutate("merge",e,e=>{this.$currentValue.push.apply(this.$currentValue,e),this.trigger({action:"merge",args:e})})},xe.prototype.count=function(e){let t=0;return this.$currentValue.forEach((n,r)=>{e(n,r)&&t++}),t},xe.prototype.swap=function(e,t){return this.$mutate("swap",[e,t],([e,t])=>{const n=this.$currentValue,r=n.length;if(t<e){const n=e;e=t,t=n}if(r<e||r<t)return!1;const o=n[e],s=n[t];n[e]=s,n[t]=o,this.trigger({action:"swap",args:[e,t],result:[o,s]})}),!0},xe.prototype.swapItems=function(e,t){const n=this.$currentValue.indexOf(e),r=this.$currentValue.indexOf(t);return this.swap(n,r)},xe.prototype.insertAfter=function(e,t){const n=this.$currentValue.indexOf(t);return this.splice(n+1,0,e)},xe.prototype.remove=function(e){let t=[];return this.$mutate("remove",[e],([e])=>{t=this.$currentValue.splice(e,1),0!==t.length&&this.trigger({action:"remove",args:[e],result:t[0]})}),t},xe.prototype.removeItem=function(e){const t=this.$currentValue.indexOf(e);return-1===t?[]:this.remove(t)},xe.prototype.empty=function(){return 0===this.$currentValue.length},xe.prototype.populateAndRender=function(e,t){this.trigger({action:"populate",args:[this.$currentValue,e,t]})},xe.prototype.where=function(e){"function"==typeof e&&(e={_:e});const t=this,n=[t],r={};for(const[t,o]of Object.entries(e)){const e=l.isObservable(o)?be(o,!1):o;if(e&&"object"==typeof e&&"callback"in e){if(r[t]=e.callback,e.dependencies){const t=Array.isArray(e.dependencies)?e.dependencies:[e.dependencies];n.push.apply(n,t)}}else r[t]="function"==typeof e?e:t=>t===e}const o=$.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},xe.prototype.whereSome=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.some(e=>t.callback(n[e]))}})},xe.prototype.whereEvery=function(e,t){return this.where({_:{dependencies:t.dependencies,callback:n=>e.every(e=>t.callback(n[e]))}})},xe.prototype.deepSubscribe=function(e){const t=h(()=>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)}},xe.prototype.sync=function(e){if(!e||!e.__$isObservableArray)throw new r("ObservableArray.sync : target must be an ObservableArray");e.set([...this.$currentValue]);const t=(t,n,r)=>{if(!r)return void e.set([...t]);const{action:o,args:s}=r;e[o].apply(e,s)};return this.subscribe(t),()=>this.unsubscribe(t)},xe.prototype.clone=function(){return new xe(this.resolve())},$.array=function(e=[],t=null){return new xe(e,t)},$.batch=function(e){const t=$(0),n=function(){if(l.isAsyncFunction(e))return e(...arguments).then(()=>{t.trigger()}).catch(e=>{throw e});e(...arguments),t.trigger()};return n.$observer=t,n};const Me=function(e,t){y.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)})};Me.prototype=Object.create(y.prototype),Object.defineProperty(Me,"$value",{get(){return this.val()},set(e){this.set(e)}}),Me.prototype.__$isObservableObject=!0,Me.prototype.__isProxy__=!0,Me.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=>l.isJson(e)?$.json(e,t):l.isArray(e)?$.array(e,t):$(e,t));this.$observables[n]=$.array(e,t);continue}this.$observables[n]=$.array(r,t)}else l.isObservable(r)||l.isProxy(r)?this.$observables[n]=r:this.$observables[n]="object"==typeof r?$.object(r,t):$(r,t)}},Me.prototype.val=function(){const e={};for(const t in this.$observables){const n=this.$observables[t];if(l.isObservable(n)){let r=n.val();Array.isArray(r)&&(r=r.map(e=>l.isObservable(e)?e.val():l.isProxy(e)?e.$value:e)),e[t]=r}else l.isProxy(n)?e[t]=n.$value:e[t]=n}return e},Me.prototype.$val=Me.prototype.val,Me.prototype.get=function(e){const t=this.$observables[e];return l.isObservable(t)?t.val():l.isProxy(t)?t.$value:t},Me.prototype.$get=Me.prototype.get,Me.prototype.set=function(e){const t=l.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(l.isObservable(o)){if(!l.isArray(i)){o.set(i);continue}const e=s.at(0);if(l.isObservable(e)||l.isProxy(e)){const t=i.map(t=>l.isProxy(e)?$.init(t,n):$(t,n));o.set(t);continue}o.set([...i]);continue}l.isProxy(o)?o.update(i):this[r]=i}},Me.prototype.$set=Me.prototype.set,Me.prototype.$updateWith=Me.prototype.set,Me.prototype.observables=function(){return Object.values(this.$observables)},Me.prototype.$observables=Me.prototype.observables,Me.prototype.keys=function(){return Object.keys(this.$observables)},Me.prototype.$keys=Me.prototype.keys,Me.prototype.clone=function(){return $.init(this.val(),this.configs)},Me.prototype.$clone=Me.prototype.clone,Me.prototype.reset=function(){for(const e in this.$observables)this.$observables[e].reset()},Me.prototype.originalSubscribe=Me.prototype.subscribe,Me.prototype.subscribe=function(e){const t=this.observables(),n=h(()=>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)}},Me.prototype.configs=function(){return this.configs},Me.prototype.update=Me.prototype.set,$.init=function(e,t=null){return new Me(e,t)},$.arrayOfObject=function(e){return e.map(e=>$.object(e))},$.value=function(e){if(e?.__$isObservableArray){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e.at(n);t.push($.value(r))}return t}return e?.__$Observable?e.val():l.isProxy(e)?e.$value:e},y.prototype.resolve=function(){return $.value(this)},$.object=$.init,$.json=$.init,$.computed=function(e,t=[]){const n=new y(e()),o=h(()=>n.set(e(...t.map(e=>e.val()))));if(l.isFunction(t)){if(!l.isObservable(t.$observer))throw new r("Observable.computed : dependencies must be valid batch function");return t.$observer.subscribe(o),n}return t.forEach(e=>{l.isProxy(e)?e.$observables.forEach(e=>{e.subscribe(o)}):e.subscribe(o)}),n};const Te=(e,t)=>$.computed(e,t),De=(e,t)=>e.transform(t);y.prototype.isEqualTo=function(e){return e?.__$Observable?Te((e,t)=>e===t,[this,e]):De(this,t=>t===e)},y.prototype.isNotEqualTo=function(e){return e?.__$Observable?Te((e,t)=>e!==t,[this,e]):De(this,t=>t!==e)},y.prototype.isGreaterThan=function(e){return e?.__$Observable?Te((e,t)=>e>t,[this,e]):De(this,t=>t>e)},y.prototype.isGreaterThanOrEqualTo=function(e){return e?.__$Observable?Te((e,t)=>e>=t,[this,e]):De(this,t=>t>=e)},y.prototype.isLessThan=function(e){return e?.__$Observable?Te((e,t)=>e<t,[this,e]):De(this,t=>t<e)},y.prototype.isLessThanOrEqualTo=function(e){return e?.__$Observable?Te((e,t)=>e<=t,[this,e]):De(this,t=>t<=e)},y.prototype.isBetween=function(e,t){return e.__$Observable&&t.__$Observable?Te((e,t,n)=>e>=t&&e<=n,[this,e,t]):e.__$Observable?Te((e,n)=>e>=n&&e<=t,[this,e]):t.__$Observable?Te((t,n)=>t>=e&&t<=n,[this,t]):De(this,n=>n>=e&&n<=t)},y.prototype.isNull=function(){return De(this,e=>null==e)},y.prototype.isTruthy=function(){return De(this,e=>!!e)},y.prototype.isFalsy=function(){return De(this,e=>!e)},y.prototype.isStartingWith=function(e){return e?.__$Observable?Te((e,t)=>String(e).startsWith(t),[this,e]):De(this,t=>String(t).startsWith(e))},y.prototype.isEndingWith=function(e){return e?.__$Observable?Te((e,t)=>String(e).endsWith(t),[this,e]):De(this,t=>String(t).endsWith(e))},y.prototype.isMatchingPattern=function(e){return e?.__$Observable?Te((e,t)=>new RegExp(t).test(String(e)),[this,e]):De(this,t=>e.test(String(t)))},y.prototype.isEmpty=function(){return De(this,e=>null==e||""===e||Array.isArray(e)&&0===e.length)},y.prototype.isNotEmpty=function(){return De(this,e=>null==e||""===e||Array.isArray(e)&&0!==e.length)},y.prototype.isIncludes=function(e){return e?.__$Observable?Te((e,t)=>Array.isArray(e)?e.includes(t):String(e).includes(String(t)),[this,e]):De(this,t=>Array.isArray(t)?t.includes(e):String(t).includes(String(e)))},y.prototype.isIncludedIn=function(e){return e?.__$Observable?Te((e,t)=>t.includes(e),[this,e]):De(this,t=>e.includes(t))},y.prototype.isOneOf=y.prototype.isIncludedIn,y.prototype.isHaving=function(e){return e?.__$Observable?Te((e,t)=>t in Object(e),[this,e]):De(this,t=>e in Object(t))},y.prototype.toUpperCase=function(){return De(this,e=>String(e).toUpperCase())},y.prototype.toLowerCase=function(){return De(this,e=>String(e).toLowerCase())},y.prototype.toTrimmed=function(){return De(this,e=>String(e).trim())},y.prototype.toBoolean=function(){return De(this,e=>!!e)},y.prototype.toLiteral=function(e,t="${v}"){return De(this,n=>e.replace(t,n))},y.prototype.toFormatted=y.prototype.toLiteral,y.prototype.toProperty=function(e){const t=e.split(".");return De(this,e=>{let n=e;for(const e of t){if(null==n)return;n=n[e]}return n})},y.prototype.toLength=function(){return De(this,e=>null==e?0:e.length)},y.prototype.toClamped=function(e,t){return e.__$Observable&&t.__$Observable?Te((e,t,n)=>Math.min(Math.max(e,t),n),[this,e,t]):e.__$Observable?Te((e,n)=>Math.min(Math.max(e,n),t),[this,e]):t.__$Observable?Te((t,n)=>Math.min(Math.max(t,e),n),[this,t]):De(this,n=>Math.min(Math.max(n,e),t))},y.prototype.toPercent=function(e){return e?.__$Observable?Te((e,t)=>0===t?0:e/t*100,[this,e]):De(this,t=>0===e?0:t/e*100)};const ke=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)?$.array(e,t):"object"==typeof e?$.object(e,t):$(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=$.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=ke();return t&&t(n),n},createPersistent(e,t,n){n=n||e;const r=this.create(e,b(n,t)),o=m(t);return r.subscribe(e=>o(n,e)),r},createPersistentResettable(e,t,n){n=n||e;const r=this.createResettable(e,b(n,t)),o=m(t);r.subscribe(e=>o(n,e));const s=r.reset.bind(r);return r.reset=()=>{f.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=ke();Pe.create("locale",navigator.language.split("-")[0]||"en");const Le=e=>e;const Ie=new Set(["clear","push","unshift","replace"]),Re=e=>e;const je=function(e,t,{comment:r=null,shouldKeepInCache:o=!0}={}){if(!l.isObservable(e))return"boolean"==typeof e?e?N.getChild(t):null:n.warn("ShowIf","ShowIf : condition must be an Observable or boolean / "+r,e);const s=F("Show if : "+(r||""));let i=null;const a=()=>(i&&o||(i=N.getChild(t),l.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(!l.isObservable(e))throw new r("Toggle : condition must be an Observable");const o=F("Match"),s=new Map,i=function(e){if(n&&s.has(e))return s.get(e);let r=t[e];return r?(r=N.getChild(r),l.isFragment(r)&&(r=Array.from(r.children)),n&&s.set(e,r),r):null},a=e.val(),u=i(a);return u&&o.appendChild(u),e.subscribe(e=>{const t=i(e);o.remove(),t&&o.appendChild(t)}),o.nd.with({add(n,r,o=!1){t[n]=r,o&&e.set(n)},remove(r){n&&s.delete(r),e.set([...s.keys()].at(-1)??""),delete t[r]}})},Be=function(e,t,n){if(!l.isObservable(e))throw new r("Toggle : condition must be an Observable");return Ve(e.toBoolean(),{true:t,false:n})},qe=W("div"),We=W("span"),Ue=W("label"),He=W("p"),ze=He,Ge=W("strong"),Ke=W("h1"),Je=W("h2"),Ye=W("h3"),Qe=W("h4"),Xe=W("h5"),Ze=W("h6"),et=W("br"),tt=W("a"),nt=W("pre"),rt=W("code"),ot=W("blockquote"),st=W("hr"),it=W("em"),at=W("small"),lt=W("mark"),ut=W("del"),ct=W("ins"),ht=W("sub"),pt=W("sup"),dt=W("abbr"),ft=W("cite"),bt=W("q"),mt=W("dl"),yt=W("dt"),gt=W("dd"),vt=W("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}),$t=W("input"),wt=W("textarea"),St=wt,Ct=W("select"),Ot=W("fieldset"),At=W("option"),Et=W("legend"),_t=W("datalist"),Nt=W("output"),xt=W("progress"),Ft=W("meter"),Mt=W("button"),Tt=W("main"),Dt=W("section"),kt=W("article"),Pt=W("aside"),Lt=W("nav"),It=W("figure"),Rt=W("figcaption"),jt=W("header"),Vt=W("footer"),Bt=W("img"),qt=function(e,t){return Bt({src:e,...t})},Wt=W("details"),Ut=W("summary"),Ht=W("dialog"),zt=W("menu"),Gt=W("ol"),Kt=W("ul"),Jt=W("li"),Yt=Jt,Qt=Gt,Xt=Kt,Zt=W("audio"),en=W("video"),tn=W("source"),nn=W("track"),rn=W("canvas"),on=W("svg"),sn=W("time"),an=W("data"),ln=W("address"),un=W("kbd"),cn=W("samp"),hn=W("var"),pn=W("wbr"),dn=W("caption"),fn=W("table"),bn=W("thead"),mn=W("tfoot"),yn=W("tbody"),gn=W("tr"),vn=gn,$n=W("th"),wn=$n,Sn=$n,Cn=W("td"),On=Cn;function An(e){let t=null,n=(r,o)=>(t=document.createElementNS("http://www.w3.org/2000/svg",e),n=(e,n)=>q(t.cloneNode(),e,n),q(t.cloneNode(),r,o));return(e,t)=>n(e,t)}const En=An("svg"),_n=An("circle"),Nn=An("rect"),xn=An("ellipse"),Fn=An("line"),Mn=An("polyline"),Tn=An("polygon"),Dn=An("path"),kn=An("text"),Pn=An("tspan"),Ln=An("textPath"),In=An("g"),Rn=An("defs"),jn=An("use"),Vn=An("symbol"),Bn=An("clipPath"),qn=An("mask"),Wn=An("marker"),Un=An("pattern"),Hn=An("image"),zn=An("foreignObject"),Gn=An("switch"),Kn=An("linearGradient"),Jn=An("radialGradient"),Yn=An("stop"),Qn=An("filter"),Xn=An("feBlend"),Zn=An("feColorMatrix"),er=An("feComposite"),tr=An("feFlood"),nr=An("feGaussianBlur"),rr=An("feMerge"),or=An("feMergeNode"),sr=An("feOffset"),ir=An("feTurbulence"),ar=An("feDisplacementMap"),lr=An("feDiffuseLighting"),ur=An("feSpecularLighting"),cr=An("feDistantLight"),hr=An("fePointLight"),pr=An("feSpotLight"),dr=An("feMorphology"),fr=An("feConvolveMatrix"),br=An("feComponentTransfer"),mr=An("feFuncR"),yr=An("feFuncG"),gr=An("feFuncB"),vr=An("feFuncA"),$r=An("animate"),wr=An("animateTransform"),Sr=An("animateMotion"),Cr=An("mpath"),Or=An("set"),Ar=An("desc"),Er=An("title"),_r=An("metadata"),Nr=An("view"),xr=An("style"),Fr=An("script"),Mr=W("");var Tr=Object.freeze({__proto__:null,Abbr:dt,Address:ln,Anchor:F,Article:kt,Aside:Pt,AsyncImg:function(e,t,n,o){const s=l.isObservable(e)?e.val():e,i=qt(t||s,n),a=new Image;return a.onload=()=>{l.isFunction(o)&&o(null,i),i.src=l.isObservable(e)?e.val():e},a.onerror=()=>{l.isFunction(o)&&o(new r("Image not found"))},l.isObservable(e)&&e.subscribe(e=>{a.src=e}),a.src=s,i},Audio:Zt,BaseImage:Bt,Blockquote:ot,Br:et,Button:Mt,Canvas:rn,Caption:dn,Checkbox:e=>$t({type:"checkbox",...e}),Cite:ft,Code:rt,ColorInput:e=>$t({type:"color",...e}),Data:an,Datalist:_t,DateInput:e=>$t({type:"date",...e}),DateTimeInput:e=>$t({type:"datetime-local",...e}),Dd:gt,Del:ut,Details:Wt,Dialog:Ht,Div:qe,Dl:mt,Dt:yt,Em:it,EmailInput:e=>$t({type:"email",...e}),FieldSet:Ot,FigCaption:Rt,Figure:It,FileInput:e=>$t({type:"file",...e}),Footer:Vt,ForEach:function(e,t,o,{shouldKeepItemsInCache:s=!1}={}){t=t||Le;const i=F("ForEach"),a=i.endElement();i.startElement();let u=new Map,c=null;const h=new Set,p=e=>{if(!s)for(const[t,n]of u.entries()){if(h.has(t))continue;const r=n.child?.deref();e&&r&&r.remove(),n.indexObserver?.cleanup(),n.child=null,n.indexObserver=null,u.delete(n.keyId),c&&c.delete(n.keyId)}},d=(e,s)=>{const i=((e,t,n)=>{if(l.isString(n)){const r=l.isObservable(e)?e.val():e,o=r?.[n];return l.isObservable(o)?o.val():o??t}return l.isFunction(n)?n(e,t):(l.isObservable(e)?e.val():e)??t})(e,s,o);if(u.has(i)){const e=u.get(i);if(e.indexObserver?.set(s),e.isNew=!1,e.child?.deref())return i;u.delete(i)}try{const n=t.length>=2?$(s):null;let o=N.getChild(t(e,n));if(!o)throw new r("ForEach child can't be null or undefined!");u.set(i,{keyId:i,isNew:!0,child:new WeakRef(o),indexObserver:n})}catch(e){throw n.error("ForEach",`Error creating element for key ${i}`,e),e}return i},f=()=>{const t=a.parentNode;if(!t)return;const n=l.isObservable(e)?e.val():e;if(h.clear(),Array.isArray(n))for(let e=0,t=n.length;e<t;e++){const t=d(n[e],e);h.add(t)}else for(const e in n){const t=d(n[e],e);h.add(t)}if(0===h.size)return i.removeChildren(),p(),void c?.clear();p(t),c&&0!==c.size?(()=>{let e=document.createDocumentFragment();const t=Array.from(h);Array.from(c);for(const n in t){const r=t[n],o=u.get(r);if(!o)continue;const s=o.child.deref();s&&e.appendChild(s)}i.replaceContent(e)})():(e=>{const t=document.createDocumentFragment();for(const e of h){const n=u.get(e);if(!n)continue;const r=n.child?.deref();r&&t.appendChild(r)}e.insertBefore(t,a)})(t),c?.clear(),c=new Set([...h])};return f(),l.isObservable(e)&&e.subscribe(f),i},ForEachArray:function(e,t,n={}){t=t||Re;const r=F("ForEach Array",n.isParentUniqueChild),o=r.endElement();let s=new Map,i=0;const a=t.length>=2,l=e=>{r.removeChildren(),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=N.getChild(t(e,null));return s.set(e,{child:n,indexObserver:null}),n};let p=(n,r)=>{const o=e.transform(e=>e.indexOf(n)),i=N.getChild(t(n,o));return s.set(n,{child:i,indexObserver:o}),i};e.__$Observable||(p=(e,n)=>{const r=N.getChild(t(e,n));return s.set(e,{child:r,indexObserver:null}),r});const d=(e,t)=>{const n=s.get(e);return n?(n.indexObserver?.set(t),n.child):h(e)};let f,b=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 m=(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()};let y=null;y=Array.isArray(e)?()=>{l(e),r.appendChildRaw(g.toFragment(e))}:()=>{const t=e.val();l(t),r.appendChildRaw(g.toFragment(t))};const g={toFragment:e=>{const t=document.createDocumentFragment();for(let n=0,r=e.length;n<r;n++)t.appendChild(b(e[n],i)),i++;return t},add:e=>{r.appendChildRaw(g.toFragment(e))},replace:e=>{l(e),r.appendChildRaw(g.toFragment(e))},set:y,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:l,populate:([e,t,n])=>{const o=document.createDocumentFragment();for(let r=0;r<t;r++){const t=n(r);e.push(t),o.append(b(t,r)),i++}r.appendChildRaw(o),o.replaceChildren()},unshift:e=>{r.insertAtStartRaw(g.toFragment(e))},splice:(t,n)=>{const[s,i,...a]=t;let l=null;const c=document.createDocumentFragment();if(n.length>0){let e=n[0];if(1===n.length)m(e,c);else if(n.length>1){const e=u(n[0]);l=e?.previousSibling;for(let e=0;e<n.length;e++)m(n[e],c)}}else{const t=s-1>=0?s-1:s,n=e.at(t);l=u(n)||o.previousSibling}c.replaceChildren(),a&&a.length&&l&&r.insertBeforeRaw(g.toFragment(a),l.nextSibling)},reverse:(e,t)=>{g.reOrder(t)},sort:(e,t)=>{g.reOrder(t)},remove:(e,t)=>{g.removeOne(t)},pop:(e,t)=>{g.removeOne(t)},shift:(e,t)=>{g.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}};g.merge=g.add,g.push=g.add;const v=(e,t,n={})=>{((e=null)=>{b=Ie.has(e)?a?p:h:s.size?d:a?p:h})(n.action),g[n.action]&&g[n.action](n.args,n.result)};return Array.isArray(e)?(v(0,0,{action:"set"}),r):(e.val().length&&v(e.val(),0,{action:"set"}),e.subscribe(v),r)},Form:vt,Fragment:Mr,H1:Ke,H2:Je,H3:Ye,H4:Qe,H5:Xe,H6:Ze,Header:jt,HiddenInput:e=>$t({type:"hidden",...e}),HideIf:function(e,t,n){const r=$(!e.val());return e.subscribe(e=>r.set(!e)),je(r,t,n)},HideIfNot:function(e,t,n){return je(e,t,n)},Hr:st,Img:qt,Input:$t,Ins:ct,Kbd:un,Label:Ue,LazyImg:function(e,t){return qt(e,{...t,loading:"lazy"})},Legend:Et,Li:Yt,Link:tt,ListItem:Jt,Main:Tt,Mark:lt,Match:Ve,Menu:zt,Meter:Ft,MonthInput:e=>$t({type:"month",...e}),NativeDocumentFragment:F,Nav:Lt,NumberInput:e=>$t({type:"number",...e}),Ol:Qt,Option:At,OrderedList:Gt,Output:Nt,P:He,Paragraph:ze,PasswordInput:e=>$t({type:"password",...e}),Pre:nt,Progress:xt,Quote:bt,Radio:e=>$t({type:"radio",...e}),RangeInput:e=>$t({type:"range",...e}),ReadonlyInput:e=>$t({readonly:!0,...e}),Samp:cn,SearchInput:e=>$t({type:"search",...e}),Section:Dt,Select:Ct,ShowIf:je,ShowWhen:function(){if(2===arguments.length){const[e,t]=arguments;if(!l.isObservableWhenResult(e))throw new r("showWhen observer must be an ObservableWhenResult",{data:e,help:"Use observer.when(target) to create an ObservableWhenResult"});return je(e,t)}if(3===arguments.length){const[e,t,n]=arguments;if(!l.isObservable(e))throw new r("showWhen observer must be an Observable",{data:e});return je(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)=>Mt(e,{type:"button",...t}),Small:at,Source:tn,Span:We,Strong:Ge,Sub:ht,SubmitButton:(e,t)=>Mt(e,{type:"submit",...t}),Summary:Ut,Sup:pt,Svg:on,SvgAnimate:$r,SvgAnimateMotion:Sr,SvgAnimateTransform:wr,SvgCircle:_n,SvgClipPath:Bn,SvgDefs:Rn,SvgDesc:Ar,SvgEllipse:xn,SvgFEBlend:Xn,SvgFEColorMatrix:Zn,SvgFEComponentTransfer:br,SvgFEComposite:er,SvgFEConvolveMatrix:fr,SvgFEDiffuseLighting:lr,SvgFEDisplacementMap:ar,SvgFEDistantLight:cr,SvgFEFlood:tr,SvgFEFuncA:vr,SvgFEFuncB:gr,SvgFEFuncG:yr,SvgFEFuncR:mr,SvgFEGaussianBlur:nr,SvgFEMerge:rr,SvgFEMergeNode:or,SvgFEMorphology:dr,SvgFEOffset:sr,SvgFEPointLight:hr,SvgFESpecularLighting:ur,SvgFESpotLight:pr,SvgFETurbulence:ir,SvgFilter:Qn,SvgForeignObject:zn,SvgG:In,SvgImage:Hn,SvgLine:Fn,SvgLinearGradient:Kn,SvgMPath:Cr,SvgMarker:Wn,SvgMask:qn,SvgMetadata:_r,SvgPath:Dn,SvgPattern:Un,SvgPolygon:Tn,SvgPolyline:Mn,SvgRadialGradient:Jn,SvgRect:Nn,SvgScript:Fr,SvgSet:Or,SvgStop:Yn,SvgStyle:xr,SvgSvg:En,SvgSwitch:Gn,SvgSymbol:Vn,SvgTSpan:Pn,SvgText:kn,SvgTextPath:Ln,SvgTitle:Er,SvgUse:jn,SvgView:Nr,Switch:Be,TBody:yn,TBodyCell:On,TFoot:mn,TFootCell:Sn,THead:bn,THeadCell:wn,TRow:vn,Table:fn,Td:Cn,TelInput:e=>$t({type:"tel",...e}),TextArea:wt,TextInput:St,Th:$n,Time:sn,TimeInput:e=>$t({type:"time",...e}),Tr:gn,Track:nn,Ul:Xt,UnorderedList:Kt,UrlInput:e=>$t({type:"url",...e}),Var:hn,Video:en,Wbr:pn,WeekInput:e=>$t({type:"week",...e}),When:function(e){if(!l.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,Be(e,t,n)),toNdElement:()=>Be(e,t,n)}},createPortal:function(e,{parent:t,name:n="unnamed"}={}){const r=F("Portal "+n);return r.appendChild(N.getChild(e)),(t||document.body).appendChild(r),r}});const Dr={};function kr(e,t,n={}){e="/"+p(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=Dr[n]),r||(r="[^/]+"),r=r.replace("(","(?:"),{name:t,pattern:`(${r})`}},d=()=>{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="/"+p(e,"/");if(!d().exec(e))return!1;const t={};return d().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 Pr extends Error{constructor(e,t){super(e),this.context=t}}const Lr=(e,t)=>{const n=[];return e.forEach(e=>{n.push(p(e.suffix,"/"))}),n.push(p(t,"/")),n.join("/")},Ir=(e,t)=>{const n=[];return e.forEach(e=>{e.options.middlewares&&n.push(...e.options.middlewares)}),t&&n.push(...t),n},Rr=(e,t)=>{const n=[];return e.forEach(e=>{e.options?.name&&n.push(e.options.name)}),t&&n.push(t),n.join(".")},jr=e=>{for(let t=e.length-1;t>=0;t--)if(e[t]?.options?.layout)return e[t].options.layout;return null};function Vr(){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 Br(){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 qr(){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 Wr(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 l.isAnchor(e)||(r=F(t),r.appendChild(e)),o.set(e,r),r},u=()=>{l.isAnchor(i)&&i.remove()},c=()=>{t.nodeValue="",u(),s&&s.remove()},h=e=>{let t=e;return l.isNDElement(e)&&(t=e.node()),t},p=function(e,n,o){const l=n.layout();if(l)return void((e,n,o,l)=>{let p=h(n);const d=r.get(p);if(d){if(d===s){const e=a(p,l);return u(),i=p,void e.replaceContent(p)}return c(),i=p,s=d,a(p,l).replaceContent(p),void t.appendChild(s)}c(),i=p;const f=a(p,l);s=N.getChild(e(f)),r.set(p,s),t.appendChild(s)})(l,e,0,o);let p=h(e);c(),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 p(e,t)}const i=t.component()({params:r,query:o});n.set(s,i),p(i,t,s)};return e.subscribe(d),d(e.currentState()),t}const Ur="default";function Hr(e={}){const t=[],r={},o=[],s=[],i={route:null,params:null,query:null,path:null,hash:null};if("hash"===e.mode)Vr.apply(this,[]);else if("history"===e.mode)Br.apply(this,[]);else{if("memory"!==e.mode)throw new Pr("Invalid router mode "+e.mode);qr.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 kr(Lr(o,e),n,{...s,middlewares:Ir(o,s?.middlewares||[]),name:s?.name?Rr(o,s.name):null,layout:s?.layout||jr(o)});return t.push(i),i.name()&&(r[i.name()]=i),this},this.group=function(e,t,n){if(!l.isFunction(n))throw new Pr("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 Pr(`Route not found for name: ${e}`);return o.url({params:t,query:n})},this.resolve=function(e){if("string"==typeof e){const t=r[e];if(t)return{route:t,params:[],query:[],path:t.url({name:e})}}if(l.isJson(e)){const t=r[e.name];if(!t)throw new Pr(`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="/"+p(n,"/");let i,a=null;for(const e of t)if(i=e.match(s),i){a=e;break}if(!a)throw new Pr(`Route not found for url: ${n}`);const u={};if(o){const e=new URLSearchParams(o).entries();for(const[t,n]of e)u[t]=n}return{route:a,params:i,query:u,path:e}},this.subscribe=function(e){if(!l.isFunction(e))throw new Pr("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 zr(e,t){const{to:n,href:r,...o}=e;if(r){const e=Hr.get();return tt({...o,href:r},t).nd.onPreventClick(()=>{e.push(r)})}const s="string"==typeof n?{name:n}:n,i=s.router||Ur,a=Hr.get(i);if(!a)throw new Pr('Router not found "'+i+'" for link "'+s.name+'"');const l=a.generateUrl(s.name,s.params,s.query);return tt({...o,href:l},t).nd.onPreventClick(()=>{a.push(l)})}Hr.routers={},Hr.create=function(e,t){if(!l.isFunction(t))throw n.error("Router","Callback must be a function"),new Pr("Callback must be a function");const r=new Hr(e);return Hr.routers[e.name||Ur]=r,t(r),r.init(e.entry),r.mount=function(e){if(l.isString(e)){const t=document.querySelector(e);if(!t)throw new Pr(`Container not found for selector: ${e}`);e=t}else if(!l.isElement(e))throw new Pr("Container must be a string or an Element");return Wr(r,e)},r},Hr.get=function(e){const t=Hr.routers[e||Ur];if(!t)throw new Pr(`Router not found for name: ${e}`);return t},Hr.push=function(e,t=null){return Hr.get(t).push(e)},Hr.replace=function(e,t=null){return Hr.get(t).replace(e)},Hr.forward=function(e=null){return Hr.get(e).forward()},Hr.back=function(e=null){return Hr.get(e).back()},Hr.redirectTo=function(e,t=null,n=null){let r=e;const o=Hr.get(n);return o.resolve({name:e,params:t})&&(r={name:e,params:t}),o.push(r)},zr.blank=function(e,t){return tt({...e,target:"_blank"},t)};var Gr=Object.freeze({__proto__:null,Link:zr,RouteParamPatterns:Dr,Router:Hr});var Kr=Object.freeze({__proto__:null,memoize:e=>re(e),once:e=>ne(e),singleton:e=>te(e)}),Jr=Object.freeze({__proto__:null,Cache:Kr,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)}},classPropertyAccumulator:ee,cssPropertyAccumulator:Z,filters:Ne});return e.$=w,e.ElementCreator=N,e.HtmlElementWrapper=W,e.NDElement=T,e.Observable=$,e.PluginsManager=null,e.SingletonView=J,e.Store=Pe,e.StoreFactory=ke,e.TemplateCloner=G,e.Validator=l,e.autoMemoize=re,e.autoOnce=ne,e.classPropertyAccumulator=ee,e.createTextNode=B,e.cssPropertyAccumulator=Z,e.elements=Tr,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=V,e.obs=S,e.once=te,e.router=Gr,e.useCache=function(e){let t=null,n=r=>{t=new G(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 J(e)),t.render(n)}},e.utils=Jr,e.withValidation=j,e}({});
package/elements.js CHANGED
@@ -1,3 +1,8 @@
1
1
  export {default as Anchor, default as NativeDocumentFragment } from "./src/core/elements/anchor/anchor";
2
2
  export { createPortal } from "./src/core/elements/anchor/anchor";
3
3
  export * from './src/core/elements/index';
4
+
5
+ import './src/core/wrappers/prototypes/nd-element-extensions';
6
+ import './src/core/wrappers/prototypes/nd-element.transition.extensions';
7
+ import './src/core/wrappers/prototypes/attributes-extensions';
8
+ import './src/core/wrappers/prototypes/bind-class-extensions';
package/index.js CHANGED
@@ -6,7 +6,9 @@ export { SingletonView, useSingleton } from './src/core/wrappers/SingletonView';
6
6
  export { default as PluginsManager } from './src/core/utils/plugins-manager';
7
7
  export { default as Validator } from './src/core/utils/validator';
8
8
 
9
- import './src/core/utils/prototypes.js';
9
+ export * from './src/core/utils/prototypes.js';
10
+ export * from './src/core/data/observable-helpers/observable.is-to';
11
+ export * from './src/core/data/observable-helpers/observable.prototypes';
10
12
 
11
13
  export * from './src/core/utils/property-accumulator';
12
14
  export * from './src/core/utils/args-types';
@@ -16,6 +18,5 @@ export * from './src/core/data/observable-helpers/array';
16
18
  export * from './src/core/data/observable-helpers/batch';
17
19
  export * from './src/core/data/observable-helpers/object';
18
20
  export * from './src/core/data/observable-helpers/computed';
19
- export * from './src/core/data/observable-helpers/observable.is-to';
20
21
  export * from './src/core/data/Store';
21
22
 
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "native-document",
3
- "version": "1.0.151",
3
+ "version": "1.0.153",
4
+ "sideEffects": false,
4
5
  "main": "index.js",
5
6
  "type": "module",
6
7
  "scripts": {
@@ -1,12 +1,8 @@
1
- import {classPropertyAccumulator, cssPropertyAccumulator} from "../../utils";
1
+ import {classPropertyAccumulator, cssPropertyAccumulator} from "../core/utils/property-accumulator";
2
2
  import {Observable} from "../core/data/Observable";
3
- import {ShowIf} from "../core/elements/index";
4
- import Anchor from "../core/elements/anchor/anchor";
3
+ import {ShowIf} from "../core/elements/control/show-if";
5
4
  import {NDElement} from "../core/wrappers/NDElement";
6
5
 
7
- import './base-component.css';
8
-
9
-
10
6
  /**
11
7
  *
12
8
  * @class
@@ -1,4 +1,5 @@
1
- import {DropdownItem} from "./index";
1
+ import DropdownItem from "./DropdownItem";
2
+
2
3
  const resolveField = (raw, mapperField, fallbackKeys) => {
3
4
  if(!mapperField) {
4
5
  for(const key of fallbackKeys) {
@@ -1,13 +1,9 @@
1
1
  import DebugManager from "../../core/utils/debug-manager";
2
2
  import MemoryManager from "./MemoryManager";
3
3
  import NativeDocumentError from "../../core/errors/NativeDocumentError";
4
- import ObservableChecker from "./ObservableChecker";
5
4
  import PluginsManager from "../../core/utils/plugins-manager";
6
5
  import Validator from "../../core/utils/validator";
7
- import {ObservableWhen} from "./ObservableWhen";
8
6
  import {deepClone} from "../utils/helpers";
9
- import { Formatters} from "../utils/formatters";
10
- import {Observable} from "./Observable";
11
7
  import {$getFromStorage, $saveToStorage} from "../utils/localstorage";
12
8
 
13
9
  /**
@@ -364,27 +360,6 @@ ObservableItem.prototype.unsubscribe = function(callback) {
364
360
  }
365
361
  };
366
362
 
367
- /**
368
- * Create an Observable checker instance
369
- * @param callback
370
- * @returns {ObservableChecker}
371
- */
372
- ObservableItem.prototype.check = function(callback) {
373
- return new ObservableChecker(this, callback)
374
- };
375
-
376
- ObservableItem.prototype.transform = ObservableItem.prototype.check;
377
- ObservableItem.prototype.pluck = function(property) {
378
- return new ObservableChecker(this, (value) => value[property]);
379
- };
380
- ObservableItem.prototype.is = function(callbackOrValue) {
381
- if(typeof callbackOrValue === 'function') {
382
- return new ObservableChecker(this, callbackOrValue);
383
- }
384
- return new ObservableChecker(this, (value) => value === callbackOrValue);
385
- };
386
- ObservableItem.prototype.select = ObservableItem.prototype.check;
387
-
388
363
 
389
364
 
390
365
 
@@ -404,21 +379,6 @@ ObservableItem.prototype.get = function(key) {
404
379
  return Validator.isObservable(item) ? item.val() : item;
405
380
  };
406
381
 
407
- /**
408
- * Creates an ObservableWhen that represents whether the observable equals a specific value.
409
- * Returns an object that can be subscribed to and will emit true/false.
410
- *
411
- * @param {*} value - The value to compare against
412
- * @returns {ObservableWhen} An ObservableWhen instance that tracks when the observable equals the value
413
- * @example
414
- * const status = Observable('idle');
415
- * const isLoading = status.when('loading');
416
- * isLoading.subscribe(active => console.log('Loading:', active));
417
- * status.set('loading'); // Logs: "Loading: true"
418
- */
419
- ObservableItem.prototype.when = function(value) {
420
- return new ObservableWhen(this, value);
421
- };
422
382
 
423
383
  /**
424
384
  * Compares the observable's current value with another value or observable.
@@ -506,79 +466,6 @@ ObservableItem.prototype.valueOf = function() {
506
466
  };
507
467
 
508
468
 
509
- /**
510
- * Creates a derived observable that formats the current value using Intl.
511
- * Automatically reacts to both value changes and locale changes (Store.__nd.locale).
512
- *
513
- * @param {string | Function} type - Format type or custom formatter function
514
- * @param {Object} [options={}] - Options passed to the formatter
515
- * @returns {ObservableItem<string>}
516
- *
517
- * @example
518
- * // Currency
519
- * price.format('currency') // "15 000 FCFA"
520
- * price.format('currency', { currency: 'EUR' }) // "15 000,00 €"
521
- * price.format('currency', { notation: 'compact' }) // "15 K FCFA"
522
- *
523
- * // Number
524
- * count.format('number') // "15 000"
525
- *
526
- * // Percent
527
- * rate.format('percent') // "15,0 %"
528
- * rate.format('percent', { decimals: 2 }) // "15,00 %"
529
- *
530
- * // Date
531
- * date.format('date') // "3 mars 2026"
532
- * date.format('date', { dateStyle: 'full' }) // "mardi 3 mars 2026"
533
- * date.format('date', { format: 'DD/MM/YYYY' }) // "03/03/2026"
534
- * date.format('date', { format: 'DD MMM YYYY' }) // "03 mar 2026"
535
- * date.format('date', { format: 'DD MMMM YYYY' }) // "03 mars 2026"
536
- *
537
- * // Time
538
- * date.format('time') // "20:30"
539
- * date.format('time', { second: '2-digit' }) // "20:30:00"
540
- * date.format('time', { format: 'HH:mm:ss' }) // "20:30:00"
541
- *
542
- * // Datetime
543
- * date.format('datetime') // "3 mars 2026, 20:30"
544
- * date.format('datetime', { dateStyle: 'full' }) // "mardi 3 mars 2026, 20:30"
545
- * date.format('datetime', { format: 'DD/MM/YYYY HH:mm' }) // "03/03/2026 20:30"
546
- *
547
- * // Relative
548
- * date.format('relative') // "dans 11 jours"
549
- * date.format('relative', { unit: 'month' }) // "dans 1 mois"
550
- *
551
- * // Plural
552
- * count.format('plural', { singular: 'billet', plural: 'billets' }) // "3 billets"
553
- *
554
- * // Custom formatter
555
- * price.format(value => `${value.toLocaleString()} FCFA`)
556
- *
557
- * // Reacts to locale changes automatically
558
- * Store.setLocale('en-US');
559
- */
560
- ObservableItem.prototype.format = function(type, options = {}) {
561
- const self = this;
562
-
563
- if (typeof type === 'function') {
564
- return new ObservableChecker(self, type);
565
- }
566
-
567
- if (process.env.NODE_ENV === 'development') {
568
- if (!Formatters[type]) {
569
- throw new NativeDocumentError(
570
- `Observable.format : unknown type '${type}'. Available : ${Object.keys(Formatters).join(', ')}.`
571
- );
572
- }
573
- }
574
-
575
- const formatter = Formatters[type];
576
- const localeObservable = Formatters.locale;
577
-
578
- return Observable.computed(() => formatter(self.val(), localeObservable.val(), options),
579
- [self, localeObservable]
580
- );
581
- };
582
469
 
583
470
  ObservableItem.prototype.persist = function(key, options = {}) {
584
471
  let value = $getFromStorage(key, this.$currentValue);