@helfy/helfy 0.0.8 → 0.0.9

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.
Files changed (40) hide show
  1. package/README.md +264 -109
  2. package/babel-preset.js +2 -1
  3. package/dist/Helfy/Render/DOM.d.ts +2 -0
  4. package/dist/app/createApp.d.ts +3 -1
  5. package/dist/app/index.d.ts +1 -1
  6. package/dist/app/types.d.ts +10 -0
  7. package/dist/compiler/babel.js +20 -13
  8. package/dist/decorators/Context.decorator.d.ts +22 -5
  9. package/dist/decorators/Effect.decorator.d.ts +1 -1
  10. package/dist/decorators/Inject.decorator.d.ts +8 -3
  11. package/dist/decorators/InjectContainer.decorator.d.ts +16 -0
  12. package/dist/decorators/Store.decorator.d.ts +12 -3
  13. package/dist/decorators/UseCase.decorator.d.ts +21 -0
  14. package/dist/di/InjectParam.decorator.d.ts +0 -11
  15. package/dist/di/Injectable.decorator.d.ts +2 -0
  16. package/dist/di/createViewInstance.d.ts +4 -5
  17. package/dist/di/index.d.ts +3 -2
  18. package/dist/http/ApiClient.decorator.d.ts +19 -0
  19. package/dist/http/FetchHttpClient.d.ts +17 -0
  20. package/dist/http/HttpClient.types.d.ts +19 -0
  21. package/dist/http/Mutation.types.d.ts +22 -0
  22. package/dist/http/MutationBuilder.d.ts +17 -0
  23. package/dist/http/Query.types.d.ts +22 -0
  24. package/dist/http/QueryBuilder.d.ts +16 -0
  25. package/dist/http/QueryCache.d.ts +13 -0
  26. package/dist/http/index.d.ts +18 -0
  27. package/dist/http/mutationConfig.decorator.d.ts +19 -0
  28. package/dist/http/queryConfig.decorator.d.ts +9 -0
  29. package/dist/http/useInfiniteQuery.decorator.d.ts +45 -0
  30. package/dist/http/useMutation.decorator.d.ts +21 -0
  31. package/dist/http/useQuery.decorator.d.ts +25 -0
  32. package/dist/index.d.ts +6 -6
  33. package/dist/index.js +2 -2
  34. package/dist/router/core.d.ts +2 -2
  35. package/dist/router/decorators.d.ts +4 -4
  36. package/dist/router.js +1 -1
  37. package/dist/signals.d.ts +7 -1
  38. package/package.json +1 -1
  39. package/dist/decorators/Observe.decorator.d.ts +0 -1
  40. package/dist/decorators/Provide.decorator.d.ts +0 -22
package/dist/router.js CHANGED
@@ -1 +1 @@
1
- function I(r){if(!r)return"/";r.startsWith("/")||(r=`/${r}`);let t=r.indexOf("?"),e=r.indexOf("#");if(t!==-1||e!==-1){let n=[t,e].filter(o=>o!==-1).reduce((o,i)=>Math.min(o,i),r.length);r=r.slice(0,n)}return r=r.replace(/\/{2,}/g,"/"),r.length>1&&r.endsWith("/")&&(r=r.slice(0,-1)),r}function mt(r,t){let e=I(r),n=I(t),o=e.split("/").filter(Boolean),i=n.split("/").filter(Boolean);if(o.length!==i.length)return null;let c={};for(let s=0;s<o.length;s++){let l=o[s],u=i[s];if(l.startsWith(":")){let a=l.slice(1);if(!a)return null;c[a]=decodeURIComponent(u)}else{if(l===u)continue;return null}}return{params:c}}function Nt(r){let t={};if(!r)return t;let e=r.startsWith("?")?r.slice(1):r;if(!e)return t;for(let n of e.split("&")){if(!n)continue;let[o,i=""]=n.split("=");o&&(t[decodeURIComponent(o)]=decodeURIComponent(i))}return t}function se(r){let t=Object.entries(r).filter(([,n])=>n!=null);return t.length?`?${t.map(([n,o])=>`${encodeURIComponent(n)}=${encodeURIComponent(String(o))}`).join("&")}`:""}function z(){var r;let{pathname:t,search:e,hash:n}=window.location,o=decodeURIComponent(t);if(o.includes("?")){let[c,s]=o.split("?",2);t=c,e=s?`?${s}`:e}let i=Nt(e);return{pathname:I(t),params:{},query:i,hash:n||void 0,state:(r=history.state)!==null&&r!==void 0?r:void 0}}var H=class{constructor(t){this.routes=t,this.listeners=new Set,this.handlePopState=e=>{var n,o,i;let c=z(),s=this.match(c.pathname),l=Object.assign(Object.assign({},c),{params:(n=s==null?void 0:s.params)!==null&&n!==void 0?n:{},query:(o=s==null?void 0:s.query)!==null&&o!==void 0?o:c.query,state:(i=e.state)!==null&&i!==void 0?i:c.state});this.notify(l)},this._location=z()}get location(){return this._location}subscribe(t){return this.listeners.add(t),t(this._location),()=>{this.listeners.delete(t)}}notify(t){this._location=t,this.listeners.forEach(e=>e(this._location))}initFromCurrentLocation(){var t,e;let n=z(),o=this.match(n.pathname),i=Object.assign(Object.assign({},n),{params:(t=o==null?void 0:o.params)!==null&&t!==void 0?t:{},query:(e=o==null?void 0:o.query)!==null&&e!==void 0?e:n.query});(this._location.pathname!==i.pathname||JSON.stringify(this._location.params)!==JSON.stringify(i.params)||JSON.stringify(this._location.query)!==JSON.stringify(i.query))&&this.notify(i)}navigate(t,e){var n,o;let[i,c]=t.split("?",2),s,l="",u="";if(c!=null){s=i;let[_,b]=c.split("#",2);l=_!=null?_:"",u=b!=null?b:""}else{let[_,b]=i.split("#",2);s=_!=null?_:i,u=b!=null?b:""}let a=I(s),f=new URL(window.location.href);f.pathname=a,f.search=l?`?${l}`:"",u&&(f.hash=`#${u}`);let p=e==null?void 0:e.state;e!=null&&e.replace?window.history.replaceState(p!=null?p:null,"",f.toString()):window.history.pushState(p!=null?p:null,"",f.toString());let h=z(),d=this.match(h.pathname),v=Object.assign(Object.assign({},h),{params:(n=d==null?void 0:d.params)!==null&&n!==void 0?n:{},query:(o=d==null?void 0:d.query)!==null&&o!==void 0?o:h.query});this.notify(v)}match(t){let e=I(t);for(let n of this.routes){let o=this.matchRouteRecursive(n,e,"",{});if(o)return o}return null}matchRouteRecursive(t,e,n,o){let i=I(n?`${n}/${t.path}`:t.path),s=z().query,l=mt(i,e);if(!l)return null;let u=Object.assign(Object.assign({},o),l.params);if(t.redirectTo){let a=I(t.redirectTo);return{route:t,params:u,query:s,pathname:a}}if(t.children&&t.children.length)for(let a of t.children){let f=this.matchRouteRecursive(a,e,i,u);if(f)return f}return{route:t,params:u,query:s,pathname:e}}};var st=Symbol.for("helfy:provideFields");function J(r){var t,e,n;let o=(t=r==null?void 0:r.reactive)!==null&&t!==void 0?t:!1,i=(e=r==null?void 0:r.computed)!==null&&e!==void 0?e:!1,c=(n=r==null?void 0:r.deps)!==null&&n!==void 0?n:[];return function(s,l,u){var a;let f=typeof s=="function"?s:s.constructor,p=(a=f[st])!==null&&a!==void 0?a:[],h=p.find(d=>d.propertyKey===l);h?(h.reactive=o,h.computed=i,h.deps=c):p.push({propertyKey:l,reactive:o,computed:i,deps:c}),Object.defineProperty(f,st,{value:p,configurable:!0})}}var ce=null;function T(){return ce}var le=Symbol.for("helfy:exposeMethods");function yt(r){if(r==null||r instanceof Node||typeof r!="object")return r;let t=r.constructor,e=t==null?void 0:t[le];return e!=null&&e.length?ue(r,e):r}function ue(r,t){return new Proxy(r,{get(e,n,o){if(typeof n=="string"&&t.includes(n)){let i=Reflect.get(e,n,e);return typeof i=="function"?i.bind(e):i}},has(e,n){return typeof n=="string"&&t.includes(n)}})}import"reflect-metadata";var ct=Symbol.for("helfy:injectParamTokens");var lt=Symbol.for("helfy:injectFields");function P(r,t,e){let n,o;typeof t=="string"?(n=t,o=e):t&&typeof t=="object"?o=t:o=e;let i=W(r);return function(c,s){var l;let u=typeof c=="function"?c:c.constructor,a=(l=u[lt])!==null&&l!==void 0?l:[];a.push({propertyKey:s,key:i,fieldName:n,options:o}),Object.defineProperty(u,lt,{value:a,configurable:!0})}}function ut(r,t,e){var n,o,i;let c=r;for(;c;){let l=c._injector;if(l!=null&&l.has(t))return l.get(t);c=(n=c._parentView)!==null&&n!==void 0?n:null}if((e==null?void 0:e.optional)!==!1&&(e==null?void 0:e.defaultValue)!==void 0)return e.defaultValue;if(e!=null&&e.optional)return;let s=typeof t=="string"?t:typeof t=="symbol"?(o=t.description)!==null&&o!==void 0?o:String(t):(i=t==null?void 0:t.name)!==null&&i!==void 0?i:String(t);throw new Error(`[helfy] No provider for ${s}`)}function L(r,t,e,n){var o,i,c,s,l,u,a,f;let p=(o=Reflect.getMetadata("design:paramtypes",t))!==null&&o!==void 0?o:[],h=(a=(s=(i=t[ct])!==null&&i!==void 0?i:(c=t.prototype)===null||c===void 0?void 0:c[ct])!==null&&s!==void 0?s:(u=(l=t.prototype)===null||l===void 0?void 0:l.constructor)===null||u===void 0?void 0:u[ct])!==null&&a!==void 0?a:{},d=Object.keys(h).map(Number),v=p.length>1?p.length-1:d.length>0?Math.max(...d)+1:t.length>1?t.length-1:0,_=[];for(let b=0;b<v;b++){let x=(f=h[b])!==null&&f!==void 0?f:p[b];if(x===void 0)throw new Error(`[helfy] Cannot resolve param ${b} of ${t.name}. Add babel-plugin-transform-typescript-metadata or use @inject(token) for interface/abstract dependencies.`);_.push(ae(r,n,x))}return _.push(e),Reflect.construct(t,_)}function ae(r,t,e){var n;let o=e;if(tt(o)){let i=W(o);return ut(t!=null?t:{},i)}if(!r){let i=typeof e=="string"?e:(n=e==null?void 0:e.name)!==null&&n!==void 0?n:String(e);throw new Error(`[helfy] No provider for ${i}. Configure a Container or use @Context for tree-scoped values.`)}return r.get(e)}var Lt="__helfy_signals_ctx__";function U(){let r=globalThis[Lt];return r||(r={currentComputation:null,batchDepth:0,pendingComputations:new Set},globalThis[Lt]=r),r}function Mt(r){let t=U(),{currentComputation:e}=t;e&&(r.observers.add(e),e.deps.add(r))}function kt(r){let t=U();if(t.batchDepth>0){t.pendingComputations.add(r);return}at(r)}function at(r){r.deps.forEach(o=>{o.observers.delete(r)}),r.deps.clear(),r.cleanups.size&&(r.cleanups.forEach(o=>{try{o()}catch(i){}}),r.cleanups.clear());let t=U(),e=t.currentComputation;t.currentComputation=r;try{r.fn()}finally{t.currentComputation=e}let n=0;r.deps.forEach(o=>{o.level>n&&(n=o.level)}),r.level=n+1}function fe(){let r=U();r.batchDepth++;try{for(;r.pendingComputations.size;){let t=Array.from(r.pendingComputations);r.pendingComputations.clear(),t.sort((e,n)=>e.level-n.level);for(let e of t)at(e)}}finally{r.batchDepth--}}function qt(r){let t=U();t.batchDepth++;try{r()}finally{t.batchDepth--,t.batchDepth===0&&fe()}}function F(r){let t={value:r,observers:new Set,level:0};return[()=>(Mt(t),t.value),o=>{let i=typeof o=="function"?o(t.value):o;if(Object.is(t.value,i)||(t.value=i,!t.observers.size))return;Array.from(t.observers).forEach(s=>{kt(s)})}]}function R(r){let t={fn:r,deps:new Set,cleanups:new Set,level:0};return at(t),()=>{t.deps.forEach(e=>{e.observers.delete(t)}),t.deps.clear(),t.cleanups.size&&(t.cleanups.forEach(e=>{try{e()}catch(n){}}),t.cleanups.clear())}}function gt(r){let{currentComputation:t}=U();if(!t)throw new Error("onCleanup() can only be used inside a reactive computation");t.cleanups.add(r)}var ft=Symbol.for("helfy:computedDispose"),dt=Symbol.for("helfy:reactiveGetter");function K(r,t){var e;let n={value:void 0,observers:new Set,level:0},o=(e=t==null?void 0:t.equals)!==null&&e!==void 0?e:Object.is,i=()=>(Mt(n),n.value);i[dt]=!0;let c={fn:()=>{let s=r();if(!o(n.value,s)){if(n.value=s,!n.observers.size)return;Array.from(n.observers).forEach(u=>{kt(u)})}},deps:new Set,cleanups:new Set,level:0};return at(c),n.level=c.level,i[ft]=()=>{c.deps.forEach(s=>s.observers.delete(c)),c.deps.clear(),c.cleanups.forEach(s=>{try{s()}catch(l){}}),c.cleanups.clear()},i}var jt=Symbol.for("helfy:reactiveCache");var Gt="__evt_",zt="__attrEffectDisposes",Jt="__attrGetterMap";function Et(r){return typeof r=="function"&&r.length===0}function Wt(r,t=10){let e=r();for(let n=0;n<t&&Et(e);n++)e=e();return e}var V=class r{static setElementAttributes(t,e){let n=t,o=n[zt],i=n[Jt];i||(i={},n[Jt]=i),o||(o=[],n[zt]=o);let c=new Set(Object.keys(e||{}));return Object.entries(e||{}).forEach(([s,l])=>{if(s==="$_key"){t.setAttribute("key",String(l));return}if(s==="$_ref")return;if(s.startsWith("on")&&s.toLowerCase()in window){let a=s.toLowerCase().substring(2),f=n[Gt+a];f&&t.removeEventListener(a,f),n[Gt+a]=l,t.addEventListener(a,l);return}if(Et(l)){let a=i[s];if(a&&a.getter===l)return;a&&(a.dispose(),delete i[s]);let f=R(()=>{let p=Wt(l);this.applyAttr(t,s,p)});i[s]={getter:l,dispose:f};return}let u=i[s];u&&(u.dispose(),delete i[s]),this.applyAttr(t,s,l)}),Object.keys(i).forEach(s=>{c.has(s)||(i[s].dispose(),delete i[s])}),t}static applyAttr(t,e,n){if(e==="html"){t.innerHTML=String(n!=null?n:"");return}if(e==="class"){if(typeof n=="string")t.className=n;else if(Array.isArray(n)){let o=[];n.forEach(i=>{if(Array.isArray(i)){let[c,s]=i;s&&o.push(c)}else o.push(String(i))}),t.className=o.join(" ")}return}if(e==="style"&&typeof n=="object"&&n!==null){let o=Object.entries(n).map(([i,c])=>c!=null?`${i.replace(/[A-Z]/g,s=>"-"+s.toLowerCase())}:${String(c)}`:"").filter(Boolean).join(";");t.setAttribute("style",o);return}if(e==="value"&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)){t.value=n!=null?String(n):"";return}if(e==="checked"&&t instanceof HTMLInputElement){t.checked=!!n;return}if(e==="disabled"){let o=!!n;"disabled"in t?t.disabled=o:o?t.setAttribute("disabled",""):t.removeAttribute("disabled");return}n!=null&&t.setAttribute(e,String(n))}static createElement(t,e){if(t==="fragment")return document.createDocumentFragment();let n=document.createElement(t);return this.setElementAttributes(n,e),n}static createNode(t,e,n){if(!t)return null;let{tag:o,props:i,children:c}=t;if(t!=null&&t.$_type)return this._jsx(t,n);let s=this.createElement(o,i);return!e&&(c!=null&&c.length)&&c.forEach(l=>{if(l)if(l.$_type==="_view"){let u=r._jsx(l,n);u&&s.append(u)}else if(typeof l=="string"||typeof l=="number")s.append(document.createTextNode(typeof l=="number"?l.toString():l));else if(Et(l)){let u=document.createTextNode(""),a=R(()=>{u.textContent=String(Wt(l))});u.__effectDispose=a,s.append(u)}else{let u=this._jsx(l,n);u!==null&&s.append(u)}}),s}static createNodesList(t,e){let n=document.createDocumentFragment(),o=T();return n.append(...t.map(i=>{var c,s,l;if(i.$_type==="_view"){let u=i,a=(c=u.$_view)!==null&&c!==void 0?c:u.tag,f=(s=u.$_props)!==null&&s!==void 0?s:u.props,p=L(o,a,f!=null?f:{},e!=null?e:null),h=(l=p.view)!==null&&l!==void 0?l:p;return h.__viewRef=p,h}return this.createNode(i,void 0,e)})),n}static _jsx(t,e){var n,o,i,c;if(typeof t=="string")return document.createTextNode(t);if(typeof t=="number")return document.createTextNode(t.toString());if(t!=null&&t.$_type){let s=null,{$_type:l,$_node:u,$_condition:a,$_items:f}=t;switch(l){case"_view":{let p=t;if(!p.$_ref){let h=(n=p.$_view)!==null&&n!==void 0?n:p.tag,d=(o=p.$_props)!==null&&o!==void 0?o:p.props,v=L(T(),h,d!=null?d:{},e!=null?e:(i=d==null?void 0:d._parentView)!==null&&i!==void 0?i:null);p.$_ref=v,s=(c=v.view)!==null&&c!==void 0?c:v,s.__viewRef=v}break}case"_if":a&&(s=this.createNode(u,void 0,e));break;case"_ifelse":s=this.createNode(u,void 0,e);break;case"_forin":s=this.createNodesList(f,e);break;default:break}return s}return this.createNode(t,void 0,e)}};var wt="__viewRef";function Ct(r){let t={},e=Object.assign({},r);for(let n of Object.keys(r))if(n.startsWith("$_bind_")){let o=n.slice(7);t[o]=r[n],delete e[n]}return{binds:t,cleanProps:e}}function Ut(r,t){let{binds:e,cleanProps:n}=Ct(r);return Object.assign(Object.assign(Object.assign({},n),{__binds:e}),t)}var M="__effectDispose",xt="__attrEffectDisposes",de="__attrGetterMap";function pe(r){if(!r)return;let t=r;typeof t[M]=="function"&&(t[M](),t[M]=void 0),Array.isArray(t[xt])&&(t[xt].forEach(n=>n()),t[xt]=[]);let e=t[de];if(e&&typeof e=="object"){Object.values(e).forEach(n=>{var o;return(o=n.dispose)===null||o===void 0?void 0:o.call(n)});for(let n of Object.keys(e))delete e[n]}}function A(r){if(!r)return;r.childNodes.forEach(e=>A(e)),pe(r);let t=r[wt];t!=null&&t.destroy&&t.destroy()}function Ot(r){return typeof r=="function"&&r.length===0}function Kt(r,t=10){let e=r();for(let n=0;n<t&&Ot(e);n++)e=e();return e}function X(r){if(!r)return;let t=r[wt];t!=null&&t._setupReactiveEffects&&t._setupReactiveEffects(),t!=null&&t.onAttached&&t.onAttached(),r.childNodes.forEach(e=>X(e))}var k=class{static mount(t){var e,n,o,i,c;let s=t.render();if(t.DOM=s,this.isView(s)){let u=s,a=this.getViewConstructor(u);if(tt(a)){let f=u.children,{restChildren:p}=this.extractSlots(f),h=(e=this.getViewProps(u))!==null&&e!==void 0?e:{},d=L(T(),a,h,t);d._parentView=t,u.$_ref=d;let v=document.createDocumentFragment();this.mountChildren(v,(n=p!=null?p:f)!==null&&n!==void 0?n:[],d),t.el=v}else{let f=u.children,{slots:p,restChildren:h}=this.extractSlots(f);f&&h!==f&&(u.children=h);let d=this.getViewProps(u);Object.keys(p).length&&(d=Object.assign(Object.assign({},d),{$slots:p})),d=Ut(d,{_parentView:t}),u.$_props=d;let v=V._jsx(s,t);if(v instanceof Node){t.el=v;let _=u.$_ref;if(_&&typeof _=="object"){_._parentView=t;let b=d.$_ref;b&&typeof b=="string"&&(t[b]=yt(_),_.__refOwner=t,_.__refName=b)}}}(o=t.onMount)===null||o===void 0||o.call(t);return}t.el=V.createElement(s.tag,s.props);let l=(i=s.props)===null||i===void 0?void 0:i.$_ref;l&&typeof l=="string"&&(t[l]=t.el),this.mountChildren(t.el,s.children,t),(c=t.onMount)===null||c===void 0||c.call(t)}static mountChildren(t,e,n){e!=null&&e.length&&e.forEach(o=>{var i,c,s;if(o!=null){if(typeof o=="string"||typeof o=="number"){t.append(document.createTextNode(o.toString()));return}if(Ot(o)){let l=document.createTextNode(""),u=R(()=>{l.textContent=String(Kt(o))});l[M]=u,t.append(l);return}if(this.isView(o)){let l=o,u=this.getViewConstructor(l);if(tt(u)){let b=l.children,{restChildren:x}=this.extractSlots(b),$=(i=this.getViewProps(l))!==null&&i!==void 0?i:{},G=L(T(),u,$,n!=null?n:null);G._parentView=n!=null?n:null,l.$_ref=G,this.mountChildren(t,(c=x!=null?x:b)!==null&&c!==void 0?c:[],G);return}let a=this.getViewConstructor(l),f=l.children,{slots:p,restChildren:h}=this.extractSlots(f);f&&h!==f&&(l.children=h);let d=this.getViewProps(l);Object.keys(p).length&&(d=Object.assign(Object.assign({},d),{$slots:p})),d=Ut(d,{_parentView:n!=null?n:null});let v=L(T(),a,d,n!=null?n:null);l.$_ref=v,v.view[wt]=v;let _=d.$_ref;_&&typeof _=="string"&&n&&(n[_]=yt(v),v.__refOwner=n,v.__refName=_),t.append(v.view);return}if(this.isCondition(o)){let l=o;l.$_condition&&l.$_node&&this.mountChildren(t,[l.$_node],n);return}if(this.isElseCondition(o)){let l=o;this.mountChildren(t,[l.$_node],n);return}if(this.isReactiveIf(o)){this.mountReactiveIf(t,o,n);return}if(this.isReactiveForin(o)){this.mountReactiveForin(t,o,n);return}if(this.isForin(o)){let l=o;this.mountChildren(t,l.$_items,n);return}if(this.isJSX(o)){let l=o,u=(s=l.props)!==null&&s!==void 0?s:{},a=V.createElement(l.tag,u),f=u.$_ref;f&&typeof f=="string"&&n&&(n[f]=a),l.children&&this.mountChildren(a,l.children,n),t.append(a)}}})}static updateChildren(t,e,n){if(!(e!=null&&e.length)){t.childNodes.forEach(i=>A(i)),t.replaceChildren();return}let o=[];e.forEach(i=>{if(i==null)return;if(typeof i=="string"||typeof i=="number"){o.push(document.createTextNode(i.toString()));return}if(Ot(i)){let s=document.createTextNode(""),l=R(()=>{s.textContent=String(Kt(i))});s[M]=l,o.push(s);return}let c=V._jsx(i,n);c instanceof Node&&o.push(c)}),t.childNodes.forEach(i=>A(i)),t.replaceChildren(...o)}static updateDomNode(t,e,n,o){if(!t||!n)return;let i=n==null?void 0:n.tag;if(typeof i=="string"&&!(n!=null&&n.$_type)&&t.tagName.toLowerCase()===i){V.setElementAttributes(t,n.props),t.childNodes.forEach(l=>A(l)),t.replaceChildren();let s=n.children;s!=null&&s.length&&this.mountChildren(t,s,o);return}t.childNodes.forEach(s=>A(s)),t.replaceChildren(),this.mountChildren(t,[n],o)}static getViewConstructor(t){var e;return(e=t==null?void 0:t.$_view)!==null&&e!==void 0?e:t==null?void 0:t.tag}static getViewProps(t){var e,n;return(n=(e=t==null?void 0:t.$_props)!==null&&e!==void 0?e:t==null?void 0:t.props)!==null&&n!==void 0?n:{}}static getNodeType(t){return this.isView(t)?"view":this.isForin(t)?"forin":this.isCondition(t)?"condition":this.isElseCondition(t)?"elsecondition":this.isJSX(t)?"jsx":typeof t=="string"||typeof t=="number"?"text":"unknown"}static isSlot(t){return typeof t=="object"&&t!==null&&(t==null?void 0:t.$_type)==="_slot"}static extractSlots(t){let e={};if(!(t!=null&&t.length))return{slots:e,restChildren:t!=null?t:[]};let n=[];return t.forEach(o=>{this.isSlot(o)?e[o.$_name]=o.$_render:n.push(o)}),{slots:e,restChildren:n}}static isJSX(t){return typeof t=="object"&&t!==null&&!(t!=null&&t.$_type)}static isView(t){return typeof t=="object"&&t!==null&&((t==null?void 0:t.$_type)==="_view"||typeof(t==null?void 0:t.tag)=="function")}static isCondition(t){return typeof t=="object"&&t!==null&&(t==null?void 0:t.$_type)==="_if"}static isElseCondition(t){return typeof t=="object"&&t!==null&&(t==null?void 0:t.$_type)==="_ifelse"}static isForin(t){return typeof t=="object"&&t!==null&&(t==null?void 0:t.$_type)==="_forin"}static isReactiveIf(t){if(typeof t!="object"||t===null)return!1;let e=t==null?void 0:t.$_type;return e==="_rIf"||e==="_rIfElse"}static isReactiveForin(t){return typeof t=="object"&&t!==null&&(t==null?void 0:t.$_type)==="_rForin"}static mountReactiveIf(t,e,n){let o=document.createComment(e.$_type);t.append(o);let i=[],c=R(()=>{let s=e.$_condFn();gt(()=>{i.forEach(u=>{A(u),u.remove()}),i=[]});let l=null;if(s?l=e.$_type==="_rIfElse"?e.$_ifFn():e.$_bodyFn():e.$_type==="_rIfElse"&&(l=e.$_elseFn()),l!=null){let u=document.createDocumentFragment();this.mountChildren(u,[l],n);let a=Array.from(u.childNodes);o.after(u),i=a,a.forEach(f=>X(f))}});o[M]=c}static mountReactiveForin(t,e,n){let o=document.createComment("_rForin");t.append(o);let i=[],c=R(()=>{let s=e.$_listFn();if(gt(()=>{i.forEach(l=>{A(l),l.remove()}),i=[]}),s&&s.length>0){let l=[];s.forEach((f,p,h)=>{let d=e.$_mapFn(f,p,h);d!=null&&l.push(d)});let u=document.createDocumentFragment();this.mountChildren(u,l,n);let a=Array.from(u.childNodes);o.after(u),i=a,a.forEach(f=>X(f))}});o[M]=c}};var Xt=Symbol.for("helfy:bindedFields");var Yt=Symbol.for("helfy:viewEffects");var Rt=Symbol.for("helfy:view"),$t=Symbol.for("helfy:propSignals");function he(r){let t={};for(let n of Object.keys(r))t[n]=F(r[n]);return new Proxy(Object.create(null),{get(n,o){if(o===$t)return t;if(typeof o=="symbol")return;let i=t[o];if(!i)return;let c=i[0]();for(;typeof c=="function"&&c[dt];){let s=c;if(c=c(),c===s)break}return c},set(n,o,i){return typeof o=="symbol"||(t[o]?t[o][1](i):t[o]=F(i)),!0},has(n,o){return typeof o=="string"&&o in t},ownKeys(){return Object.keys(t)},getOwnPropertyDescriptor(n,o){if(typeof o=="string"&&o in t){let i=t[o][0]();for(;typeof i=="function"&&i[dt];){let c=i;if(i=i(),i===c)break}return{configurable:!0,enumerable:!0,writable:!0,value:i}}}})}function _e(r){let t=Object.getPrototypeOf(r);t&&Object.getOwnPropertyNames(t).forEach(e=>{if(e==="constructor")return;let n=Object.getOwnPropertyDescriptor(t,e);!n||typeof n.value!="function"||Object.defineProperty(r,e,{value:n.value.bind(r),configurable:!0,writable:!0})})}function Y(r){return r[Rt]=!0,Object.defineProperties(r.prototype,{_injector:{value:null,writable:!0},_parentView:{value:null,writable:!0},_dirty:{value:!1,writable:!0},_subscriptions:{value:void 0,writable:!0},DOM:{value:void 0,writable:!0},el:{value:void 0,writable:!0},$slots:{get(){var t;return(t=this.__slots)!==null&&t!==void 0?t:{}},set(t){this.__slots=t!=null?t:{}}},view:{get(){return this.el}},scheduleUpdate:{value:function(){this._dirty||(this._dirty=!0,queueMicrotask(()=>{this._dirty=!1,this.el&&this.el.isConnected&&this.update()}))}},update:{value:function(){var t,e,n,o,i,c,s;let l=this.render(),u=((t=this.DOM)===null||t===void 0?void 0:t.$_type)==="_view"||typeof((e=this.DOM)===null||e===void 0?void 0:e.tag)=="function",a=(l==null?void 0:l.$_type)==="_view"||typeof(l==null?void 0:l.tag)=="function";if(this.DOM&&l&&u&&a){let f=this.DOM,p=l,h=(n=f.tag)!==null&&n!==void 0?n:f.$_component,d=(o=p.tag)!==null&&o!==void 0?o:p.$_component;if(h&&d&&h===d){let _=f.$_ref;if(_&&typeof _.updateProps=="function"){let b=(c=(i=p.$_props)!==null&&i!==void 0?i:p.props)!==null&&c!==void 0?c:{},{binds:x,cleanProps:$}=Ct(b);Object.keys(x).length&&(_.__binds=x),_.updateProps($)}f.$_ref&&!p.$_ref&&(p.$_ref=f.$_ref),this.DOM=l;return}let v=(s=this.el)===null||s===void 0?void 0:s.parentNode;if(v){let _=document.createDocumentFragment();k.mountChildren(_,[l],this);let b=Array.from(_.childNodes);this.el instanceof Node&&(A(this.el),v.replaceChild(_,this.el)),this.el=b.length===1?b[0]:v,b.forEach(x=>X(x)),this.DOM=l;return}}k.updateDomNode(this.el,this.DOM,l,this),this.DOM=l}},updateProps:{value:function(t){var e;t&&typeof t=="object"&&"$slots"in t&&(this.$slots=t.$slots);let n=(e=this.props)===null||e===void 0?void 0:e[$t];n?qt(()=>{for(let o of Object.keys(t))o!=="$slots"&&(n[o]?n[o][1](t[o]):n[o]=F(t[o]))}):(this.props=t,this.scheduleUpdate())}},mount:{value:function(){k.mount(this)}},attach:{value:function(t){var e;let n=this.view,o=n instanceof DocumentFragment,i=o?n.childNodes.length:1;t.append(n),this._setupReactiveEffects&&this._setupReactiveEffects(),(e=this.onAttached)===null||e===void 0||e.call(this),(o?Array.from(t.childNodes).slice(-i):[n]).forEach(s=>X(s))}},destroy:{value:function(){var t,e;(t=this._subscriptions)===null||t===void 0||t.forEach(o=>o()),this._subscriptions=[],this._effectsInitialized=!1;let n=this[jt];if(n){for(let o of Object.keys(n)){let i=n[o],c=i==null?void 0:i.getter;c&&typeof c[ft]=="function"&&c[ft]()}delete this[jt]}this.__refOwner&&this.__refName&&(this.__refOwner[this.__refName]=null),(e=this.onDestroy)===null||e===void 0||e.call(this)}}}),class extends r{constructor(...t){var e,n,o,i,c,s,l,u;let a=t.length-1,f=(e=t[a])!==null&&e!==void 0?e:{},p=(n=f.__binds)!==null&&n!==void 0?n:{},h=Object.assign({},f);delete h.__binds,t[a]=h,super(...t),this.__binds=p,this.props===void 0&&t[a]!=null&&(this.props=t[a]);let d=(o=this.props)!==null&&o!==void 0?o:t[a];d&&typeof d=="object"&&"_parentView"in d&&(this._parentView=d._parentView);let v=this.props;if(v&&typeof v=="object"&&!v[$t]&&(this.props=he(v)),_e(this),et(this),!((i=this.$_stateFields)===null||i===void 0)&&i.length){let m=this;m.__signals||Object.defineProperty(m,"__signals",{value:{},writable:!0,configurable:!0}),this.$_stateFields.forEach(E=>{let y=m[E];try{delete m[E]}catch(C){}let[g,j]=F(y);m.__signals[E]=[g,j],Object.defineProperty(m,E,{get(){let C=this.__signals[E];return C?C[0]():void 0},set(C){let N=this.__signals[E];N&&N[1](C)},configurable:!0,enumerable:!0})}),delete this.$_stateFields}if(!((c=this.$_observableFields)===null||c===void 0)&&c.length){let m=this;this.$_observableFields.forEach(({field:E,store:y,storeField:g})=>{try{delete m[E]}catch(j){}Object.defineProperty(m,E,{get(){return y[g]},set(j){y[g]=j},configurable:!0,enumerable:!0})}),delete this.$_observableFields}if(!((s=this.$_computedFields)===null||s===void 0)&&s.length){let m=this;((l=m.$_computedFields)!==null&&l!==void 0?l:[]).forEach(y=>{let g=Object.getPrototypeOf(this),j;for(;g&&g!==Object.prototype&&(j=Object.getOwnPropertyDescriptor(g,y),!j);)g=Object.getPrototypeOf(g);let C=j==null?void 0:j.get;if(typeof C!="function")return;let N=K(()=>C.call(this));Object.defineProperty(m,y,{get(){return N()},configurable:!0,enumerable:!0})}),delete m.$_computedFields}let _=this.constructor[Xt];_!=null&&_.length&&_.forEach(({bindName:m,fieldKey:E})=>{try{delete this[E]}catch(y){}Object.defineProperty(this,E,{get(){var y;let g=(y=this.__binds)===null||y===void 0?void 0:y[m];return g&&typeof g.get=="function"?g.get():void 0},set(y){var g;let j=(g=this.__binds)===null||g===void 0?void 0:g[m];j&&typeof j.set=="function"&&j.set(y)},configurable:!0,enumerable:!0})});let b=this.constructor[lt];if(b!=null&&b.length){let m=this;m._subscriptions=(u=m._subscriptions)!==null&&u!==void 0?u:[],b.forEach(({propertyKey:E,key:y,fieldName:g,options:j})=>{var C;try{delete m[E]}catch(ot){}let N=Symbol.for(`inject:sub:${String(E)}`),_t=(C=j==null?void 0:j.subscribeField)!==null&&C!==void 0?C:g;Object.defineProperty(m,E,{configurable:!0,enumerable:!0,get(){var ot;let D=ut(this,y,j),rt;g&&D&&typeof D=="object"&&g in D?rt=D[g]:rt=D;let vt=D&&typeof D=="object"?D:null;if(_t&&vt&&_t in vt){let it=vt;if(typeof(it==null?void 0:it.subscribe)=="function"){this._injectSubs||(this._injectSubs=new Map);let At=this._injectSubs;if(!At.has(N)){let Dt=it.subscribe(_t,()=>{var Vt,bt;return(bt=(Vt=this).scheduleUpdate)===null||bt===void 0?void 0:bt.call(Vt)});At.set(N,Dt),(ot=this._subscriptions)===null||ot===void 0||ot.push(Dt)}}}return j!=null&&j.access?j.access(rt):rt}})})}let x=this.props;x&&typeof x=="object"&&"$slots"in x&&(this.$slots=x.$slots),this.mount();let $=this,G=()=>{var m;if($._effectsInitialized)return;$._effectsInitialized=!0;let E=$.constructor,y;for(;E&&E!==Function.prototype&&(y=E[Yt],!(y!=null&&y.length));)E=Object.getPrototypeOf(E);y!=null&&y.length&&($._subscriptions=(m=$._subscriptions)!==null&&m!==void 0?m:[],y.forEach(g=>{let j=R(()=>{let C=$[g];typeof C=="function"&&C.call($)});$._subscriptions.push(j)}))};$._setupReactiveEffects=G,G()}}}var Bt=Symbol.for("helfy:store");var Qt=Symbol.for("helfy:injectable"),bn=Symbol.for("helfy:injectableToken"),mn=Symbol.for("helfy:scope");var On=Symbol.for("helfy:fieldFields");var Zt=Symbol.for("helfy:form");var Ht=Symbol.for("helfy:ILogger");var ve=["View","Service","Store","Context","Provider","Factory"];function te(r){let t=r;for(let e of ve)if(t.endsWith(e)){t=t.slice(0,-e.length);break}return t?be(t):r}function be(r){return r.replace(/([A-Z])/g,(t,e)=>`-${e.toLowerCase()}`).replace(/^-/,"")}var ee=Symbol.for("helfy:loggerCache"),me=Symbol.for("helfy:loggerFields"),ye=/^<[A-Za-z][A-Za-z0-9]*>$/,w={reset:"\x1B[0m",dim:"\x1B[2m",tag:"\x1B[36m",tagCustom:"\x1B[90m",tagView:"\x1B[96m",tagContext:"\x1B[93m",tagForm:"\x1B[94m",tagStore:"\x1B[92m",tagInjectable:"\x1B[95m",debug:"\x1B[90m",info:"\x1B[34m",warn:"\x1B[33m",error:"\x1B[31m"};function ne(r){let t=r==null?void 0:r.constructor;for(;t;){if(t[Qt])return"injectable";if(t[Zt])return"form";if(t[pt])return"context";if(t[Bt])return"store";if(t[Rt])return"view";t=Object.getPrototypeOf(t)}return"other"}function ge(r){switch(r){case"view":return w.tagView;case"context":return w.tagContext;case"form":return w.tagForm;case"store":return w.tagStore;case"injectable":return w.tagInjectable;default:return w.tag}}function je(r){let t=r.match(/^<(.+)>$/);return t?t[1]:r}function Ee(r,t){let e=je(r);switch(t){case"view":return`<${e}>`;case"injectable":return`${e}()`;case"context":return`{${e}}`;case"form":return`[${e}]`;case"store":return`${e}[]`;default:return r}}function Pt(r,t=w.tag){let e=o=>{switch(o){case"DEBUG":return w.debug;case"INFO":return w.info;case"WARN":return w.warn;case"ERROR":return w.error;default:return w.reset}},n=(o,i)=>{let c=e(o);return`${t}${r}${w.reset} ${c}${o}${w.reset} ${i}`};return{debug:(o,...i)=>console.log(n("DEBUG",o),...i),info:(o,...i)=>console.info(n("INFO",o),...i),warn:(o,...i)=>console.warn(n("WARN",o),...i),error:(o,i,c)=>{if(o instanceof Error){let s=i&&typeof i=="object"&&!(i instanceof Error)?i:void 0;s&&Object.keys(s).length>0?console.error(n("ERROR",o.message),s,o):console.error(n("ERROR",o.message),o)}else{let s=i!=null?i:c;s&&Object.keys(s).length>0?console.error(n("ERROR",o),s):console.error(n("ERROR",o))}},withContext:o=>Pt(`${r}:${o}`,t)}}function xe(r,t,e){var n,o;let i=e[ee];if(i||(e[ee]=i=new Map),!i.has(r)){let c=T(),s=t!==void 0?t:te((o=(n=e.constructor)===null||n===void 0?void 0:n.name)!==null&&o!==void 0?o:"app"),l=!ye.test(s),u=l?s:Ee(s,ne(e)),a=l?w.tagCustom:ge(ne(e)),f;try{let p=c==null?void 0:c.get(Ht);if(p){let h=`${a}${u}${w.reset}`;f=p.withContext(h)}else f=Pt(u,a)}catch(p){f=Pt(u,a)}i.set(r,f)}return i.get(r)}function et(r){let e=r.constructor,n=[];for(;e;){let o=e[me];Array.isArray(o)&&n.push(...o),e=Object.getPrototypeOf(e)}n.forEach(({propertyKey:o,prefix:i})=>{try{delete r[o]}catch(c){}Object.defineProperty(r,o,{get(){return xe(o,i,this)},configurable:!0,enumerable:!1})})}var pt=Symbol.for("helfy:context"),oe=Symbol.for("helfy:contextInjectKey");function tt(r){return typeof r=="function"&&!!r[pt]}function W(r){let t=r[oe];return t||(t=Symbol(r.name||"Context"),r[oe]=t),t}function St(r){return r[pt]=!0,W(r),Object.defineProperties(r.prototype,{updateProps:{value:function(t){}},subscribe:{value:function(t,e){let n=this,o=!0,i=R(()=>{let c=n[t];if(o){o=!1;return}e(c,()=>i())});return()=>i()}},unsubscribe:{value:function(t,e){}}}),class extends r{constructor(...t){var e,n;super(...t),this._injector=null,this._parentView=null,et(this);let o=t.length>0?t[t.length-1]:void 0;o&&typeof o=="object"&&(this.props=o);let i=o&&typeof o=="object"?o.value:void 0,c=(e=r[st])!==null&&e!==void 0?e:[],s=this;s.__signals||Object.defineProperty(s,"__signals",{value:{},writable:!0,configurable:!0}),c.filter(h=>h.reactive&&!h.computed).forEach(({propertyKey:h})=>{let d=s[h];try{delete s[h]}catch(b){}let[v,_]=F(d);s.__signals[h]=[v,_],Object.defineProperty(s,h,{get(){let b=this.__signals[h];return b?b[0]():void 0},set(b){let x=this.__signals[h];x&&x[1](b)},configurable:!0,enumerable:!0})}),typeof s.__beforeComputedInit=="function"&&s.__beforeComputedInit();let u=(n=s.$_computedFields)!==null&&n!==void 0?n:[];u.length&&(u.forEach(h=>{let d=Object.getPrototypeOf(s),v;for(;d&&(v=Object.getOwnPropertyDescriptor(d,h),!v);)d=Object.getPrototypeOf(d);let _=v==null?void 0:v.get;if(typeof _!="function")return;let b=K(()=>_.call(s));Object.defineProperty(s,h,{get(){return b()},configurable:!0,enumerable:!0})}),delete s.$_computedFields);let a=c.filter(h=>h.computed);if(a.length){let h=Object.getPrototypeOf(s);a.forEach(({propertyKey:d})=>{let v=Object.getOwnPropertyDescriptor(h,d),_=v==null?void 0:v.get;if(typeof _!="function")return;let b=K(()=>_.call(this));Object.defineProperty(s,d,{get(){return b()},configurable:!0,enumerable:!0})})}let f=new Map,p=W(r);i!=null?f.set(p,i):f.set(p,this),this._injector=f}}}var B=function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(c=r[s])&&(i=(o<3?c(i):o>3?c(t,e,i):c(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Q=function(r,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,t)},O=class{constructor(t){var e;this.push=(n,o)=>{this.router.navigate(n,Object.assign({replace:!1},o))},this.replace=(n,o)=>{this.router.navigate(n,Object.assign({replace:!0},o))},this.back=()=>{window.history.back()},this.match=n=>this.router.match(n),this.router=new H((e=t.routes)!==null&&e!==void 0?e:[]),this.location=this.router.location,this.router.subscribe(n=>{this.location=n}),this.router.initFromCurrentLocation(),window.addEventListener("popstate",this.router.handlePopState)}};B([J({reactive:!0}),Q("design:type",Object)],O.prototype,"location",void 0);B([J(),Q("design:type",Object)],O.prototype,"push",void 0);B([J(),Q("design:type",Object)],O.prototype,"replace",void 0);B([J(),Q("design:type",Object)],O.prototype,"back",void 0);B([J(),Q("design:type",Object)],O.prototype,"match",void 0);O=B([St,Q("design:paramtypes",[Object])],O);var Oe=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(r);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(r,n[o])&&(e[n[o]]=r[n[o]]);return e};function S(r,t){let e=t!=null?t:{},{children:n}=e,o=Oe(e,["children"]),i=n===void 0?[]:Array.isArray(n)?n:[n],c={tag:r,props:o,children:i};typeof r=="function"&&Object.defineProperty(c,"$_type",{value:"_view"});let s=o.$_key;return s!=null&&Object.defineProperty(c,"$_key",{value:String(s)}),c}var re=S;var ht=class{static _view(t,e){return{$_type:"_view",$_view:t,$_props:e!=null?e:void 0,$_ref:null}}static _forin(t,e){let n=[];return t.forEach((o,i,c)=>{let s=e(o,i,c);s!==null&&n.push(s)}),{$_type:"_forin",$_data:t,$_items:n}}static _if(t,e){return{$_type:"_if",$_node:t?e:null,$_condition:t}}static _ifelse(t,e,n){if(!e&&!n)throw new Error('Has no statements "if" or "else"');return{$_type:"_ifelse",$_condition:t,$_node:t?e:n}}static _rIf(t,e){return{$_type:"_rIf",$_condFn:t,$_bodyFn:e}}static _rIfElse(t,e,n){return{$_type:"_rIfElse",$_condFn:t,$_ifFn:e,$_elseFn:n}}static _rForin(t,e){return{$_type:"_rForin",$_listFn:t,$_mapFn:e}}static _slot(t,e){return{$_type:"_slot",$_name:t,$_render:e}}static _callSlot(t,e,n,o){var i,c;let s=(i=t.$slots)!==null&&i!==void 0?i:{},l=s&&s[e]||o;return l&&(c=l(n))!==null&&c!==void 0?c:null}static _bind(t,e){return{get:()=>t[e],set:n=>{t[e]=n}}}static _bindFn(t,e){return{get:t,set:e}}};var Ft=function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(c=r[s])&&(i=(o<3?c(i):o>3?c(t,e,i):c(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},It=function(r,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,t)},q=class{constructor(t){this.props=t}onClick(t){t.preventDefault();let{to:e,replace:n,state:o}=this.props;n?this.replaceNav(e,{state:o}):this.push(e,{state:o})}render(){var t;let{to:e,class:n,children:o,label:i}=this.props;return S("a",{href:e,class:n,onclick:this.onClick.bind(this),children:(t=o!=null?o:i)!==null&&t!==void 0?t:""})}};Ft([P(O,"push"),It("design:type",Function)],q.prototype,"push",void 0);Ft([P(O,"replace"),It("design:type",Function)],q.prototype,"replaceNav",void 0);q=Ft([Y,It("design:paramtypes",[Object])],q);var we=function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(c=r[s])&&(i=(o<3?c(i):o>3?c(t,e,i):c(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},Ce=function(r,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,t)},Z=class{constructor(t={}){this.props=t}render(){let{pathname:t=""}=this.props;return re("section",{style:{display:"flex",flexDirection:"column",flexGrow:1,alignItems:"center",justifyContent:"center",minHeight:"min(50vh, 320px)",padding:"2rem",textAlign:"center",gap:"10px",background:"azure"},children:[S("p",{style:{fontSize:"4rem",fontWeight:700,margin:0,lineHeight:1,letterSpacing:"-0.02em",opacity:.15},children:"404"}),S("h2",{style:{fontSize:"1.25rem",fontWeight:600,margin:"0.5rem 0 0.25rem"},children:"\u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430"}),t&&S("p",{style:{fontSize:"0.875rem",opacity:.7,margin:0,fontFamily:"ui-monospace, monospace",wordBreak:"break-all"},children:t}),S(q,{to:"/",label:"\u041D\u0430 \u0433\u043B\u0430\u0432\u043D\u0443\u044E",class:"inline-block mt-6 px-4 py-2 text-sm rounded-md no-underline bg-indigo-100 dark:bg-indigo-900/40 text-indigo-700 dark:text-indigo-200 hover:bg-indigo-200 dark:hover:bg-indigo-800/60 transition-colors"})]})}};Z=we([Y,Ce("design:paramtypes",[Object])],Z);var Tt=function(r,t,e,n){var o=arguments.length,i=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,t,e,n);else for(var s=r.length-1;s>=0;s--)(c=r[s])&&(i=(o<3?c(i):o>3?c(t,e,i):c(t,e))||i);return o>3&&i&&Object.defineProperty(t,e,i),i},ie=function(r,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,t)},nt=class{render(){var t;let e=this.location.pathname,n=this.match(e);if(!n)return(t=ht._callSlot(this,"notFound",{pathname:e,location:this.location},()=>S(Z,{pathname:e})))!==null&&t!==void 0?t:S(Z,{pathname:e});let o=n.route.component,i={params:n.params,query:n.query,location:this.location};return S(o,Object.assign({},i))}};Tt([P(O,"location"),ie("design:type",Object)],nt.prototype,"location",void 0);Tt([P(O,"match"),ie("design:type",Function)],nt.prototype,"match",void 0);nt=Tt([Y],nt);function $e(r){var t;let e=(t=r==null?void 0:r.defaultValue)!==null&&t!==void 0?t:"/";return P(O,"location",{access:n=>{var o;return(o=n&&typeof n=="object"&&"pathname"in n?n.pathname:null)!==null&&o!==void 0?o:e}})}function Re(r){var t;let e=(t=r==null?void 0:r.defaultValue)!==null&&t!==void 0?t:{};return P(O,"location",{access:n=>{var o;return(o=n&&typeof n=="object"&&"query"in n?n.query:null)!==null&&o!==void 0?o:e}})}function Se(r){var t;let e=(t=r==null?void 0:r.defaultValue)!==null&&t!==void 0?t:{};return P(O,"location",{access:n=>{var o;return(o=n&&typeof n=="object"&&"params"in n?n.params:null)!==null&&o!==void 0?o:e}})}function Pe(r){return P(O,void 0,{subscribeField:"location",access:t=>{if(!t||typeof t!="object"||!("push"in t))throw new Error("[helfy/router] RouterContext is not available in the tree");let e=t;return{get location(){return e.location},push:e.push,replace:e.replace,back:e.back}}})}export{Z as DefaultNotFound,q as Link,H as Router,O as RouterContext,nt as RouterView,mt as matchPath,I as normalizePath,Se as params,Nt as parseQuery,$e as path,Pe as router,Re as search,se as stringifyQuery};
1
+ function K(o){if(!o)return"/";o.startsWith("/")||(o=`/${o}`);let e=o.indexOf("?"),t=o.indexOf("#");if(e!==-1||t!==-1){let n=[e,t].filter(r=>r!==-1).reduce((r,i)=>Math.min(r,i),o.length);o=o.slice(0,n)}return o=o.replace(/\/{2,}/g,"/"),o.length>1&&o.endsWith("/")&&(o=o.slice(0,-1)),o}function Oe(o,e){let t=K(o),n=K(e),r=t.split("/").filter(Boolean),i=n.split("/").filter(Boolean);if(r.length!==i.length)return null;let c={};for(let s=0;s<r.length;s++){let u=r[s],l=i[s];if(u.startsWith(":")){let f=u.slice(1);if(!f)return null;c[f]=decodeURIComponent(l)}else{if(u===l)continue;return null}}return{params:c}}function Ke(o){let e={};if(!o)return e;let t=o.startsWith("?")?o.slice(1):o;if(!t)return e;for(let n of t.split("&")){if(!n)continue;let[r,i=""]=n.split("=");r&&(e[decodeURIComponent(r)]=decodeURIComponent(i))}return e}function xt(o){let e=Object.entries(o).filter(([,n])=>n!=null);return e.length?`?${e.map(([n,r])=>`${encodeURIComponent(n)}=${encodeURIComponent(String(r))}`).join("&")}`:""}function se(){var o;let{pathname:e,search:t,hash:n}=window.location,r=decodeURIComponent(e);if(r.includes("?")){let[c,s]=r.split("?",2);e=c,t=s?`?${s}`:t}let i=Ke(t);return{pathname:K(e),params:{},query:i,hash:n||void 0,state:(o=history.state)!==null&&o!==void 0?o:void 0}}var fe=class{constructor(e){this.listeners=new Set,this.handlePopState=t=>{var n,r,i;let c=se(),s=this.match(c.pathname),u=Object.assign(Object.assign({},c),{params:(n=s==null?void 0:s.params)!==null&&n!==void 0?n:{},query:(r=s==null?void 0:s.query)!==null&&r!==void 0?r:c.query,state:(i=t.state)!==null&&i!==void 0?i:c.state});this.notify(u)},this.routes=Array.isArray(e)?e:[],this._location=se()}get location(){return this._location}subscribe(e){return this.listeners.add(e),e(this._location),()=>{this.listeners.delete(e)}}notify(e){this._location=e,this.listeners.forEach(t=>t(this._location))}initFromCurrentLocation(){var e,t;let n=se(),r=this.match(n.pathname),i=Object.assign(Object.assign({},n),{params:(e=r==null?void 0:r.params)!==null&&e!==void 0?e:{},query:(t=r==null?void 0:r.query)!==null&&t!==void 0?t:n.query});(this._location.pathname!==i.pathname||JSON.stringify(this._location.params)!==JSON.stringify(i.params)||JSON.stringify(this._location.query)!==JSON.stringify(i.query))&&this.notify(i)}navigate(e,t){var n,r;let[i,c]=e.split("?",2),s,u="",l="";if(c!=null){s=i;let[h,_]=c.split("#",2);u=h!=null?h:"",l=_!=null?_:""}else{let[h,_]=i.split("#",2);s=h!=null?h:i,l=_!=null?_:""}let f=K(s),a=new URL(window.location.href);a.pathname=f,a.search=u?`?${u}`:"",l&&(a.hash=`#${l}`);let d=t==null?void 0:t.state;t!=null&&t.replace?window.history.replaceState(d!=null?d:null,"",a.toString()):window.history.pushState(d!=null?d:null,"",a.toString());let g=se(),p=this.match(g.pathname),v=Object.assign(Object.assign({},g),{params:(n=p==null?void 0:p.params)!==null&&n!==void 0?n:{},query:(r=p==null?void 0:p.query)!==null&&r!==void 0?r:g.query});this.notify(v)}match(e){let t=K(e);for(let n of this.routes){let r=this.matchRouteRecursive(n,t,"",{});if(r)return r}return null}matchRouteRecursive(e,t,n,r){let i=K(n?`${n}/${e.path}`:e.path),s=se().query,u=Oe(i,t);if(!u)return null;let l=Object.assign(Object.assign({},r),u.params);if(e.redirectTo){let f=K(e.redirectTo);return{route:e,params:l,query:s,pathname:f}}if(e.children&&e.children.length)for(let f of e.children){let a=this.matchRouteRecursive(f,t,i,l);if(a)return a}return{route:e,params:l,query:s,pathname:t}}};var Ft=null;function Q(){return Ft}var jt=Symbol.for("helfy:exposeMethods");function Re(o){if(o==null||o instanceof Node||typeof o!="object")return o;let e=o.constructor,t=e==null?void 0:e[jt];return t!=null&&t.length?St(o,t):o}function St(o,e){return new Proxy(o,{get(t,n,r){if(typeof n=="string"&&e.includes(n)){let i=Reflect.get(t,n,t);return typeof i=="function"?i.bind(t):i}},has(t,n){return typeof n=="string"&&e.includes(n)}})}function Z(o,e,t,n){return new e(t)}var Je="__helfy_signals_ctx__";function ce(){let o=globalThis[Je];return o||(o={currentComputation:null,batchDepth:0,pendingComputations:new Set,scheduleCounter:0},globalThis[Je]=o),o}function Xe(o){let e=ce(),{currentComputation:t}=e;t&&(o.observers.add(t),t.deps.add(o))}function Ye(o){let e=ce();if(e.batchDepth>0){let t=o;t.scheduleOrder=e.scheduleCounter++,t.skipWhenNoObservers&&t.node&&(t.observersWhenScheduled=t.node.observers.size),e.pendingComputations.add(t);return}be(o)}function be(o){var e;if(o.deps.forEach(i=>{i.observers.delete(o)}),o.deps.clear(),o.cleanups.size&&(o.cleanups.forEach(i=>{try{i()}catch(c){}}),o.cleanups.clear()),o.skipWhenNoObservers&&o.node&&((e=o.observersWhenScheduled)!==null&&e!==void 0?e:0)>0&&o.node.observers.size===0)return;let t=ce(),n=t.currentComputation;t.currentComputation=o;try{o.fn()}finally{t.currentComputation=n}let r=0;o.deps.forEach(i=>{i.level>r&&(r=i.level)}),o.level=r+1}function Ct(){var o;let e=ce();e.batchDepth++;try{for(;e.pendingComputations.size;){let t=Array.from(e.pendingComputations);e.pendingComputations.clear(),t.sort((n,r)=>{var i,c;return(n.structural?0:1)-(r.structural?0:1)||n.level-r.level||((i=n.scheduleOrder)!==null&&i!==void 0?i:0)-((c=r.scheduleOrder)!==null&&c!==void 0?c:0)});for(let n of t)n.skipWhenNoObservers&&n.node&&((o=n.observersWhenScheduled)!==null&&o!==void 0?o:0)>0&&n.node.observers.size===0||be(n)}}finally{e.batchDepth--}}function Y(o){let e=ce();e.batchDepth===0&&(e.scheduleCounter=0),e.batchDepth++;try{o()}finally{e.batchDepth--,e.batchDepth===0&&Ct()}}function S(o){let e={value:o,observers:new Set,level:0};return[()=>(Xe(e),e.value),r=>{let i=typeof r=="function"?r(e.value):r;if(Object.is(e.value,i)||(e.value=i,!e.observers.size))return;let c=Array.from(e.observers);Y(()=>{c.forEach(s=>Ye(s))})}]}function C(o,e){let t={fn:o,deps:new Set,cleanups:new Set,level:0,structural:e==null?void 0:e.structural};return be(t),()=>{t.deps.forEach(n=>{n.observers.delete(t)}),t.deps.clear(),t.cleanups.size&&(t.cleanups.forEach(n=>{try{n()}catch(r){}}),t.cleanups.clear())}}function J(o){let{currentComputation:e}=ce();if(!e)throw new Error("onCleanup() can only be used inside a reactive computation");e.cleanups.add(o)}var ge=Symbol.for("helfy:computedDispose"),me=Symbol.for("helfy:reactiveGetter");function de(o,e){var t,n;let r={value:void 0,observers:new Set,level:0},i=(t=e==null?void 0:e.equals)!==null&&t!==void 0?t:Object.is,c=(n=e==null?void 0:e.skipWhenNoObservers)!==null&&n!==void 0?n:!1,s=()=>(Xe(r),r.value);s[me]=!0;let u={fn:()=>{let l=o();if(!i(r.value,l)){if(r.value=l,!r.observers.size)return;let f=Array.from(r.observers);Y(()=>{f.forEach(a=>Ye(a))})}},deps:new Set,cleanups:new Set,level:0,node:r,skipWhenNoObservers:c};return be(u),r.level=u.level,s[ge]=()=>{u.deps.forEach(l=>l.observers.delete(u)),u.deps.clear(),u.cleanups.forEach(l=>{try{l()}catch(f){}}),u.cleanups.clear()},s}var $e=Symbol.for("helfy:reactiveCache");var Be="__evt_",Ze="__attrEffectDisposes",He="__attrGetterMap";function Pe(o){return typeof o=="function"&&o.length===0}function et(o,e=10){let t;try{t=o()}catch(n){if(n instanceof TypeError&&/null|undefined/.test(String(n.message)))return console.warn("[Helfy] resolveGetterValue: caught null/undefined access (race with @if unmount)",n),"";throw n}for(let n=0;n<e&&Pe(t);n++)try{t=t()}catch(r){if(r instanceof TypeError&&/null|undefined/.test(String(r.message)))return console.warn("[Helfy] resolveGetterValue: caught null/undefined access (race with @if unmount)",r),"";throw r}return t}var B=class o{static setElementAttributes(e,t){let n=e,r=n[Ze],i=n[He];i||(i={},n[He]=i),r||(r=[],n[Ze]=r);let c=new Set(Object.keys(t||{}));return Object.entries(t||{}).forEach(([s,u])=>{if(s==="$_key"){e.setAttribute("key",String(u));return}if(s==="$_ref")return;if(s.startsWith("on")&&s.toLowerCase()in window){let f=s.toLowerCase().substring(2),a=n[Be+f];a&&e.removeEventListener(f,a),n[Be+f]=u,e.addEventListener(f,u);return}if(Pe(u)){let f=i[s];if(f&&f.getter===u)return;f&&(f.dispose(),delete i[s]);let a=C(()=>{let d=et(u);this.applyAttr(e,s,d)});i[s]={getter:u,dispose:a};return}let l=i[s];l&&(l.dispose(),delete i[s]),this.applyAttr(e,s,u)}),Object.keys(i).forEach(s=>{c.has(s)||(i[s].dispose(),delete i[s])}),e}static applyAttr(e,t,n){if(t==="html"){e.innerHTML=String(n!=null?n:"");return}if(t==="class"){if(typeof n=="string")e.className=n;else if(Array.isArray(n)){let r=[];n.forEach(i=>{if(Array.isArray(i)){let[c,s]=i;s&&r.push(c)}else r.push(String(i))}),e.className=r.join(" ")}return}if(t==="style"&&typeof n=="object"&&n!==null){let r=Object.entries(n).map(([i,c])=>c!=null?`${i.replace(/[A-Z]/g,s=>"-"+s.toLowerCase())}:${String(c)}`:"").filter(Boolean).join(";");e.setAttribute("style",r);return}if(t==="value"&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)){e.value=n!=null?String(n):"";return}if(t==="checked"&&e instanceof HTMLInputElement){e.checked=!!n;return}if(t==="disabled"){let r=!!n;"disabled"in e?e.disabled=r:r?e.setAttribute("disabled",""):e.removeAttribute("disabled");return}n!=null&&e.setAttribute(t,String(n))}static createElement(e,t){if(e==="fragment")return document.createDocumentFragment();let n=document.createElement(e);return this.setElementAttributes(n,t),n}static createNode(e,t,n){if(!e)return null;let{tag:r,props:i,children:c}=e;if(e!=null&&e.$_type)return this._jsx(e,n);let s=this.createElement(r,i);return!t&&(c!=null&&c.length)&&c.forEach(u=>{if(u)if(u.$_type==="_view"){let l=o._jsx(u,n);l&&s.append(l)}else if(typeof u=="string"||typeof u=="number")s.append(document.createTextNode(typeof u=="number"?u.toString():u));else if(Pe(u)){let l=document.createTextNode(""),f=C(()=>{l.textContent=String(et(u))});l.__effectDispose=f,s.append(l)}else{let l=this._jsx(u,n);l!==null&&s.append(l)}}),s}static createNodesList(e,t){let n=document.createDocumentFragment(),r=Q();return n.append(...e.map(i=>{var c,s,u;if(i.$_type==="_view"){let l=i,f=(c=l.$_view)!==null&&c!==void 0?c:l.tag,a=(s=l.$_props)!==null&&s!==void 0?s:l.props,d=Z(r,f,a!=null?a:{},t!=null?t:null),g=(u=d.view)!==null&&u!==void 0?u:d;return g.__viewRef=d,g}return this.createNode(i,void 0,t)})),n}static _jsx(e,t){var n,r,i,c;if(typeof e=="string")return document.createTextNode(e);if(typeof e=="number")return document.createTextNode(e.toString());if(e!=null&&e.$_type){let s=null,{$_type:u,$_node:l,$_condition:f,$_items:a}=e;switch(u){case"_view":{let d=e;if(!d.$_ref){let g=(n=d.$_view)!==null&&n!==void 0?n:d.tag,p=(r=d.$_props)!==null&&r!==void 0?r:d.props,v=Z(Q(),g,p!=null?p:{},t!=null?t:(i=p==null?void 0:p._parentView)!==null&&i!==void 0?i:null);d.$_ref=v,s=(c=v.view)!==null&&c!==void 0?c:v,s.__viewRef=v}break}case"_if":f&&(s=this.createNode(l,void 0,t));break;case"_ifelse":s=this.createNode(l,void 0,t);break;case"_forin":s=this.createNodesList(a,t);break;default:break}return s}return this.createNode(e,void 0,t)}};var De="__viewRef";function Le(o){let e={},t=Object.assign({},o);for(let n of Object.keys(o))if(n.startsWith("$_bind_")){let r=n.slice(7);e[r]=o[n],delete t[n]}return{binds:e,cleanProps:t}}function tt(o,e){let{binds:t,cleanProps:n}=Le(o);return Object.assign(Object.assign(Object.assign({},n),{__binds:t}),e)}var H="__effectDispose",Ie="__attrEffectDisposes",Ot="__attrGetterMap";function Rt(o){if(!o)return;let e=o;typeof e[H]=="function"&&(e[H](),e[H]=void 0),Array.isArray(e[Ie])&&(e[Ie].forEach(n=>n()),e[Ie]=[]);let t=e[Ot];if(t&&typeof t=="object"){Object.values(t).forEach(n=>{var r;return(r=n.dispose)===null||r===void 0?void 0:r.call(n)});for(let n of Object.keys(t))delete t[n]}}function W(o){if(!o)return;o.childNodes.forEach(t=>W(t)),Rt(o);let e=o[De];e!=null&&e.destroy&&e.destroy()}function Te(o){return typeof o=="function"&&o.length===0}function nt(o,e=10){let t;try{t=o()}catch(n){if(n instanceof TypeError&&/null|undefined/.test(String(n.message)))return console.warn("[Helfy] resolveGetterValue: caught null/undefined access (race with @if unmount)",n),"";throw n}for(let n=0;n<e&&Te(t);n++)try{t=t()}catch(r){if(r instanceof TypeError&&/null|undefined/.test(String(r.message)))return console.warn("[Helfy] resolveGetterValue: caught null/undefined access (race with @if unmount)",r),"";throw r}return t}function ue(o){if(!o)return;let e=o[De];e!=null&&e._setupReactiveEffects&&e._setupReactiveEffects(),e!=null&&e.onAttached&&e.onAttached(),o.childNodes.forEach(t=>ue(t))}var ee=class{static mount(e){var t,n,r,i,c;let s=e.render();if(e.DOM=s,this.isView(s)){let l=s,f=this.getViewConstructor(l);if(Ae(f)){let a=l.children,{restChildren:d}=this.extractSlots(a),g=(t=this.getViewProps(l))!==null&&t!==void 0?t:{},p=Z(Q(),f,g,e);p._parentView=e,l.$_ref=p;let v=document.createDocumentFragment();this.mountChildren(v,(n=d!=null?d:a)!==null&&n!==void 0?n:[],p),e.el=v}else{let a=l.children,{slots:d,restChildren:g}=this.extractSlots(a);a&&g!==a&&(l.children=g);let p=this.getViewProps(l);Object.keys(d).length&&(p=Object.assign(Object.assign({},p),{$slots:d})),p=tt(p,{_parentView:e}),l.$_props=p;let v=B._jsx(s,e);if(v instanceof Node){e.el=v;let h=l.$_ref;if(h&&typeof h=="object"){h._parentView=e;let _=p.$_ref;_&&typeof _=="string"&&(e[_]=Re(h),h.__refOwner=e,h.__refName=_)}}}(r=e.onMount)===null||r===void 0||r.call(e);return}e.el=B.createElement(s.tag,s.props);let u=(i=s.props)===null||i===void 0?void 0:i.$_ref;u&&typeof u=="string"&&(e[u]=e.el),this.mountChildren(e.el,s.children,e),(c=e.onMount)===null||c===void 0||c.call(e)}static mountChildren(e,t,n){t!=null&&t.length&&t.forEach(r=>{var i,c,s;if(r!=null){if(typeof r=="string"||typeof r=="number"){e.append(document.createTextNode(r.toString()));return}if(Te(r)){let u=document.createTextNode(""),l=C(()=>{u.textContent=String(nt(r))});u[H]=l,e.append(u);return}if(this.isView(r)){let u=r,l=this.getViewConstructor(u);if(Ae(l)){let _=u.children,{restChildren:x}=this.extractSlots(_),T=(i=this.getViewProps(u))!==null&&i!==void 0?i:{},O=Z(Q(),l,T,n!=null?n:null);O._parentView=n!=null?n:null,u.$_ref=O,this.mountChildren(e,(c=x!=null?x:_)!==null&&c!==void 0?c:[],O);return}let f=this.getViewConstructor(u),a=u.children,{slots:d,restChildren:g}=this.extractSlots(a);a&&g!==a&&(u.children=g);let p=this.getViewProps(u);Object.keys(d).length&&(p=Object.assign(Object.assign({},p),{$slots:d})),p=tt(p,{_parentView:n!=null?n:null});let v=Z(Q(),f,p,n!=null?n:null);u.$_ref=v,v.view[De]=v;let h=p.$_ref;h&&typeof h=="string"&&n&&(n[h]=Re(v),v.__refOwner=n,v.__refName=h),e.append(v.view);return}if(this.isCondition(r)){let u=r;u.$_condition&&u.$_node&&this.mountChildren(e,[u.$_node],n);return}if(this.isElseCondition(r)){let u=r;this.mountChildren(e,[u.$_node],n);return}if(this.isReactiveIf(r)){this.mountReactiveIf(e,r,n);return}if(this.isReactiveForin(r)){this.mountReactiveForin(e,r,n);return}if(this.isForin(r)){let u=r;this.mountChildren(e,u.$_items,n);return}if(this.isJSX(r)){let u=r,l=(s=u.props)!==null&&s!==void 0?s:{},f=B.createElement(u.tag,l),a=l.$_ref;a&&typeof a=="string"&&n&&(n[a]=f),u.children&&this.mountChildren(f,u.children,n),e.append(f)}}})}static updateChildren(e,t,n){if(!(t!=null&&t.length)){e.childNodes.forEach(i=>W(i)),e.replaceChildren();return}let r=[];t.forEach(i=>{if(i==null)return;if(typeof i=="string"||typeof i=="number"){r.push(document.createTextNode(i.toString()));return}if(Te(i)){let s=document.createTextNode(""),u=C(()=>{s.textContent=String(nt(i))});s[H]=u,r.push(s);return}let c=B._jsx(i,n);c instanceof Node&&r.push(c)}),e.childNodes.forEach(i=>W(i)),e.replaceChildren(...r)}static updateDomNode(e,t,n,r){if(!e||!n)return;let i=n==null?void 0:n.tag;if(typeof i=="string"&&!(n!=null&&n.$_type)&&e.tagName.toLowerCase()===i){B.setElementAttributes(e,n.props),e.childNodes.forEach(u=>W(u)),e.replaceChildren();let s=n.children;s!=null&&s.length&&this.mountChildren(e,s,r);return}e.childNodes.forEach(s=>W(s)),e.replaceChildren(),this.mountChildren(e,[n],r)}static getViewConstructor(e){var t;return(t=e==null?void 0:e.$_view)!==null&&t!==void 0?t:e==null?void 0:e.tag}static getViewProps(e){var t,n;return(n=(t=e==null?void 0:e.$_props)!==null&&t!==void 0?t:e==null?void 0:e.props)!==null&&n!==void 0?n:{}}static getNodeType(e){return this.isView(e)?"view":this.isForin(e)?"forin":this.isCondition(e)?"condition":this.isElseCondition(e)?"elsecondition":this.isJSX(e)?"jsx":typeof e=="string"||typeof e=="number"?"text":"unknown"}static isSlot(e){return typeof e=="object"&&e!==null&&(e==null?void 0:e.$_type)==="_slot"}static extractSlots(e){let t={};if(!(e!=null&&e.length))return{slots:t,restChildren:e!=null?e:[]};let n=[];return e.forEach(r=>{this.isSlot(r)?t[r.$_name]=r.$_render:n.push(r)}),{slots:t,restChildren:n}}static isJSX(e){return typeof e=="object"&&e!==null&&!(e!=null&&e.$_type)}static isView(e){return typeof e=="object"&&e!==null&&((e==null?void 0:e.$_type)==="_view"||typeof(e==null?void 0:e.tag)=="function")}static isCondition(e){return typeof e=="object"&&e!==null&&(e==null?void 0:e.$_type)==="_if"}static isElseCondition(e){return typeof e=="object"&&e!==null&&(e==null?void 0:e.$_type)==="_ifelse"}static isForin(e){return typeof e=="object"&&e!==null&&(e==null?void 0:e.$_type)==="_forin"}static isReactiveIf(e){if(typeof e!="object"||e===null)return!1;let t=e==null?void 0:e.$_type;return t==="_rIf"||t==="_rIfElse"}static isReactiveForin(e){return typeof e=="object"&&e!==null&&(e==null?void 0:e.$_type)==="_rForin"}static mountReactiveIf(e,t,n){let r=document.createComment(t.$_type);e.append(r);let i=[],c,s=!1,u=C(()=>{let f=t.$_condFn();if(J(()=>{if(s){i.forEach(g=>{W(g),g.remove()}),i=[];return}let d=t.$_condFn();c!==void 0&&c===d||(i.forEach(g=>{W(g),g.remove()}),i=[])}),c===f&&i.length>0)return;c=f,i.length>0&&(i.forEach(d=>{W(d),d.remove()}),i=[]);let a=null;if(f?a=t.$_type==="_rIfElse"?t.$_ifFn():t.$_bodyFn():t.$_type==="_rIfElse"&&(a=t.$_elseFn()),a!=null){let d=document.createDocumentFragment();this.mountChildren(d,[a],n);let g=Array.from(d.childNodes);r.after(d),i=g,g.forEach(p=>ue(p))}else i=[]},{structural:!0}),l=()=>{s=!0,u()};r[H]=l}static mountReactiveForin(e,t,n){let r=document.createComment("_rForin");e.append(r);let i=[],c=C(()=>{let s=t.$_listFn();if(J(()=>{i.forEach(u=>{W(u),u.remove()}),i=[]}),s&&s.length>0){let u=[];s.forEach((a,d,g)=>{let p=t.$_mapFn(a,d,g);p!=null&&u.push(p)});let l=document.createDocumentFragment();this.mountChildren(l,u,n);let f=Array.from(l.childNodes);r.after(l),i=f,f.forEach(a=>ue(a))}},{structural:!0});r[H]=c}};var ye=Symbol.for("helfy:injectFields");function $t(o){return typeof o=="symbol"?o:Ee(o)}function G(o,e,t){if(o===void 0)throw new Error("[helfy] @useCtx<IX>() requires babel-plugin-helfy-di to transform. Ensure the plugin runs on your source.");if(typeof o=="string")throw new Error('[helfy] @useCtx<IX>("field") requires babel-plugin-helfy-di to transform. Ensure the plugin runs on your source.');let n=o,r,i;typeof e=="string"?(r=e,i=t):e&&typeof e=="object"?i=e:i=t;let c=$t(n);return function(s,u){var l;let f=typeof s=="function"?s:s.constructor,a=(l=f[ye])!==null&&l!==void 0?l:[];a.push({propertyKey:u,key:c,fieldName:r,options:i}),Object.defineProperty(f,ye,{value:a,configurable:!0})}}function rt(o,e,t){var n,r,i;let c=o;for(;c;){let u=c._injector;if(u!=null&&u.has(e))return u.get(e);c=(n=c._parentView)!==null&&n!==void 0?n:null}if((t==null?void 0:t.optional)!==!1&&(t==null?void 0:t.defaultValue)!==void 0)return t.defaultValue;if(t!=null&&t.optional)return;let s=typeof e=="string"?e:typeof e=="symbol"?(r=e.description)!==null&&r!==void 0?r:String(e):(i=e==null?void 0:e.name)!==null&&i!==void 0?i:String(e);throw new Error(`[helfy] No provider for ${s}`)}var we=Symbol.for("helfy:injectContainerFields");function k(o){var e,t;let n=Q();if(!n){let r=typeof o=="symbol"?(e=o.description)!==null&&e!==void 0?e:String(o):(t=o==null?void 0:o.name)!==null&&t!==void 0?t:String(o);throw new Error(`[helfy] No container for @inject. Configure createApp().useDI(registerAllServices) or ensure Container is set. Missing: ${r}`)}return n.get(o)}var Fn=5*60*1e3;var te=Symbol.for("helfy:querySubscribe");var xe=Symbol.for("helfy:useQueryFields");function Pt(o){return Array.isArray(o)&&o.length>0}function Fe(o,e){let t=k(e.apiToken),{keyOrGetter:n}=e;if(typeof n=="string"){let i=t[n];return typeof i=="function"?i.call(t):t[n]}let r=n.call(o,o);if(Pt(r)){let[i,...c]=r,s=t[String(i)];if(typeof s=="function")return s.apply(t,c)}}function It(o,e,t){let n=C(()=>{var r,i;let c=Fe(o,e);if(c&&typeof c=="object"){let s=c;s.refetch&&(s.data===void 0||s.data===null)&&s.refetch();let u=s[te];if(typeof u=="function"){let l=u();J(()=>{typeof l=="function"&&l()})}s.data,s.isLoading,s.isFetching}(i=(r=o).scheduleUpdate)===null||i===void 0||i.call(r)});t.push(n)}function ot(o,e){let n=o.constructor[xe];n!=null&&n.length&&n.forEach(r=>{if(typeof r.keyOrGetter=="function")It(o,r,e);else try{let i=Fe(o,r);if(i&&typeof i=="object"){let c=i;c.refetch&&(c.data===void 0||c.data===null)&&c.refetch();let s=c[te];if(typeof s=="function"){let u=s();typeof u=="function"&&e.push(u)}}}catch(i){}})}var Ne=Symbol.for("helfy:useInfiniteQueryFields");function Tt(o,e,t,n){var r,i;let c="__infiniteQuery",s=o[c];if(s)return s;let u=k(e),l=(r=t.method)!==null&&r!==void 0?r:t.methodName;if(!l)throw new Error("[helfy] useInfiniteQuery: key descriptor must have 'method'");let f=u[l];if(typeof f!="function")throw new Error(`[helfy] useInfiniteQuery: API has no method "${l}"`);let a=t.totalPages,d=(i=t.initialPage)!==null&&i!==void 0?i:Math.max(1,Math.ceil(a/2)),[g,p]=S([]),[v,h]=S(d),[_,x]=S(d),[T,O]=S(d),[z,re]=S(d),[oe,D]=S(!1),[_e,b]=S(!1),[E,F]=S(!0),[y,w]=S(void 0),I={get data(){return g()},get hasNextPage(){return _()<a},get hasPreviousPage(){return v()>1},get isFetchingNext(){return oe()},get isFetchingPrevious(){return _e()},get isLoading(){return E()},get isError(){return y()!=null},get error(){return y()},loadMore(){let j=_();j>=a||f(j+1).isFetching||x(j+1)},loadPrevious(){let j=v();j<=1||f(j-1).isFetching||h(j-1)}},M=C(()=>{var j,$;let L=_(),U=z();if(L<=U)return;let m=f(L);m.data,m.isFetching,m.isError;let q=m[te];if(typeof q=="function"){let P=q();J(()=>{typeof P=="function"&&P()})}D(m.isFetching),m.isError?w(m.error):w(void 0);let R=m.data;R!=null&&R.length&&(F(!1),Y(()=>{p(P=>P.length===0?[...R]:[...P,...R]),re(L)}),($=(j=o).scheduleUpdate)===null||$===void 0||$.call(j))}),X=C(()=>{var j,$;let L=v(),U=T();if(L>=U)return;let m=f(L);m.data,m.isFetching,m.isError;let q=m[te];if(typeof q=="function"){let P=q();J(()=>{typeof P=="function"&&P()})}b(m.isFetching),m.isError&&w(m.error);let R=m.data;R!=null&&R.length&&(F(!1),Y(()=>{p(P=>P.length===0?[...R]:[...R,...P]),O(L)}),($=(j=o).scheduleUpdate)===null||$===void 0||$.call(j))}),ie=C(()=>{var j,$;let L=v(),U=_();if(L!==U)return;let m=f(L);m.refetch&&(m.data===void 0||m.data===null)&&m.refetch(),m.data,m.isLoading,m.isFetching,m.error;let q=m[te];if(typeof q=="function"){let P=q();J(()=>{typeof P=="function"&&P()})}F(m.isLoading),D(m.isFetching),b(!1),m.isError?w(m.error):w(void 0);let R=m.data;R!=null&&R.length&&(p([...R]),O(L),re(U)),($=(j=o).scheduleUpdate)===null||$===void 0||$.call(j)});return n.push(M,X,ie),o[c]=I,I}function At(o,e){var t;let n=(t=o._subscriptions)!==null&&t!==void 0?t:[];return Tt(o,e.apiToken,e.config,n)}function it(o,e){var t;let r=o.constructor[Ne];r!=null&&r.length&&(o._subscriptions=(t=o._subscriptions)!==null&&t!==void 0?t:e,r.forEach(i=>{try{delete o[i.propertyKey]}catch(c){}Object.defineProperty(o,i.propertyKey,{configurable:!0,enumerable:!0,get(){return At(this,i)}})}))}var st=Symbol.for("helfy:useMutationFields");function ct(o){let e=k(o.apiToken),t=e[o.methodName];return typeof t=="function"?t.call(e):t}var ut=Symbol.for("helfy:bindedFields");var je=Symbol.for("helfy:viewEffects");var Me=Symbol.for("helfy:view"),Ve=Symbol.for("helfy:propSignals");function pe(o){return o.startsWith("$")}function Dt(o){let e={},t={};for(let r of Object.keys(o))pe(r)?t[r]=o[r]:e[r]=S(o[r]);let n=new Proxy(Object.create(null),{get(r,i){if(i===Ve)return e;if(typeof i=="symbol")return;if(typeof i=="string"&&pe(i)&&i in t)return t[i];let c=e[i];if(!c)return;let s=c[0]();for(;typeof s=="function"&&s[me];){let u=s;if(s=s(),s===u)break}return s},set(r,i,c){return typeof i=="symbol"?!0:typeof i=="string"&&pe(i)?(t[i]=c,!0):(e[i]?e[i][1](c):e[i]=S(c),!0)},has(r,i){return typeof i=="string"&&(i in e||i in t)},ownKeys(){return[...Object.keys(e),...Object.keys(t)]},getOwnPropertyDescriptor(r,i){if(typeof i=="string"){if(pe(i)&&i in t)return{configurable:!0,enumerable:!0,writable:!0,value:t[i]};if(i in e){let c=e[i][0]();for(;typeof c=="function"&&c[me];){let s=c;if(c=c(),c===s)break}return{configurable:!0,enumerable:!0,writable:!0,value:c}}}}});return n.__passthrough=t,n}function Lt(o){let e=Object.getPrototypeOf(o);e&&Object.getOwnPropertyNames(e).forEach(t=>{if(t==="constructor")return;let n=Object.getOwnPropertyDescriptor(e,t);!n||typeof n.value!="function"||Object.defineProperty(o,t,{value:n.value.bind(o),configurable:!0,writable:!0})})}function le(o){return o[Me]=!0,Object.defineProperties(o.prototype,{_injector:{value:null,writable:!0},_parentView:{value:null,writable:!0},_dirty:{value:!1,writable:!0},_subscriptions:{value:void 0,writable:!0},DOM:{value:void 0,writable:!0},el:{value:void 0,writable:!0},$slots:{get(){var e;return(e=this.__slots)!==null&&e!==void 0?e:{}},set(e){this.__slots=e!=null?e:{}}},view:{get(){return this.el}},scheduleUpdate:{value:function(){this._dirty||(this._dirty=!0,queueMicrotask(()=>{this._dirty=!1,this.el&&this.el.isConnected&&this.update()}))}},update:{value:function(){var e,t,n,r,i,c,s;let u=this.render(),l=((e=this.DOM)===null||e===void 0?void 0:e.$_type)==="_view"||typeof((t=this.DOM)===null||t===void 0?void 0:t.tag)=="function",f=(u==null?void 0:u.$_type)==="_view"||typeof(u==null?void 0:u.tag)=="function";if(this.DOM&&u&&l&&f){let a=this.DOM,d=u,g=(n=a.tag)!==null&&n!==void 0?n:a.$_component,p=(r=d.tag)!==null&&r!==void 0?r:d.$_component;if(g&&p&&g===p){let h=a.$_ref;if(h&&typeof h.updateProps=="function"){let _=(c=(i=d.$_props)!==null&&i!==void 0?i:d.props)!==null&&c!==void 0?c:{},{binds:x,cleanProps:T}=Le(_);Object.keys(x).length&&(h.__binds=x),h.updateProps(T)}a.$_ref&&!d.$_ref&&(d.$_ref=a.$_ref),this.DOM=u;return}let v=(s=this.el)===null||s===void 0?void 0:s.parentNode;if(v){let h=document.createDocumentFragment();ee.mountChildren(h,[u],this);let _=Array.from(h.childNodes);this.el instanceof Node&&(W(this.el),v.replaceChild(h,this.el)),this.el=_.length===1?_[0]:v,_.forEach(x=>ue(x)),this.DOM=u;return}}ee.updateDomNode(this.el,this.DOM,u,this),this.DOM=u}},updateProps:{value:function(e){var t,n;e&&typeof e=="object"&&"$slots"in e&&(this.$slots=e.$slots);let r=(t=this.props)===null||t===void 0?void 0:t[Ve],i=(n=this.props)===null||n===void 0?void 0:n.__passthrough;r||i?Y(()=>{for(let c of Object.keys(e))c!=="$slots"&&(typeof c=="string"&&pe(c)&&i?i[c]=e[c]:r&&(r[c]?r[c][1](e[c]):r[c]=S(e[c])))}):(this.props=e,this.scheduleUpdate())}},mount:{value:function(){ee.mount(this)}},attach:{value:function(e){var t;let n=this.view,r=n instanceof DocumentFragment,i=r?n.childNodes.length:1;e.append(n),this._setupReactiveEffects&&this._setupReactiveEffects(),(t=this.onAttached)===null||t===void 0||t.call(this),(r?Array.from(e.childNodes).slice(-i):[n]).forEach(s=>ue(s))}},destroy:{value:function(){var e,t;(e=this._subscriptions)===null||e===void 0||e.forEach(r=>r()),this._subscriptions=[],this._effectsInitialized=!1;let n=this[$e];if(n){for(let r of Object.keys(n)){let i=n[r],c=i==null?void 0:i.getter;c&&typeof c[ge]=="function"&&c[ge]()}delete this[$e]}this.__refOwner&&this.__refName&&(this.__refOwner[this.__refName]=null),(t=this.onDestroy)===null||t===void 0||t.call(this)}}}),class extends o{constructor(...e){var t,n,r,i,c,s,u,l,f;let a=e.length-1,d=(t=e[a])!==null&&t!==void 0?t:{},g=(n=d.__binds)!==null&&n!==void 0?n:{},p=Object.assign({},d);delete p.__binds,e[a]=p,super(...e),this.__binds=g,this.props===void 0&&e[a]!=null&&(this.props=e[a]);let v=(r=this.props)!==null&&r!==void 0?r:e[a];v&&typeof v=="object"&&"_parentView"in v&&(this._parentView=v._parentView);let h=this.props;if(h&&typeof h=="object"&&!h[Ve]&&(this.props=Dt(h)),Lt(this),he(this),!((i=this.$_stateFields)===null||i===void 0)&&i.length){let b=this;b.__signals||Object.defineProperty(b,"__signals",{value:{},writable:!0,configurable:!0}),this.$_stateFields.forEach(E=>{let F=b[E];try{delete b[E]}catch(I){}let[y,w]=S(F);b.__signals[E]=[y,w],Object.defineProperty(b,E,{get(){let I=this.__signals[E];return I?I[0]():void 0},set(I){let M=this.__signals[E];M&&M[1](I)},configurable:!0,enumerable:!0})}),delete this.$_stateFields}if(!((c=this.$_computedFields)===null||c===void 0)&&c.length){let b=this;((s=b.$_computedFields)!==null&&s!==void 0?s:[]).forEach(F=>{let y=Object.getPrototypeOf(this),w;for(;y&&y!==Object.prototype&&(w=Object.getOwnPropertyDescriptor(y,F),!w);)y=Object.getPrototypeOf(y);let I=w==null?void 0:w.get;if(typeof I!="function")return;let M=de(()=>I.call(this));Object.defineProperty(b,F,{get(){return M()},configurable:!0,enumerable:!0})}),delete b.$_computedFields}let _=this.constructor[ut];_!=null&&_.length&&_.forEach(({bindName:b,fieldKey:E})=>{try{delete this[E]}catch(F){}Object.defineProperty(this,E,{get(){var F;let y=(F=this.__binds)===null||F===void 0?void 0:F[b];return y&&typeof y.get=="function"?y.get():void 0},set(F){var y;let w=(y=this.__binds)===null||y===void 0?void 0:y[b];w&&typeof w.set=="function"&&w.set(F)},configurable:!0,enumerable:!0})});let x=this.constructor[we];if(x!=null&&x.length){let b=this;x.forEach(({token:E,propertyKey:F})=>{try{delete b[F]}catch(y){}Object.defineProperty(b,F,{configurable:!0,enumerable:!0,get(){return k(E)}})})}let T=this.constructor[ye];if(T!=null&&T.length){let b=this;b._subscriptions=(u=b._subscriptions)!==null&&u!==void 0?u:[],T.forEach(({propertyKey:E,key:F,fieldName:y,options:w})=>{var I;try{delete b[E]}catch(ie){}let M=Symbol.for(`inject:sub:${String(E)}`),X=(I=w==null?void 0:w.subscribeField)!==null&&I!==void 0?I:y;Object.defineProperty(b,E,{configurable:!0,enumerable:!0,get(){var ie;let j=rt(this,F,w),$;y&&j&&typeof j=="object"&&y in j?$=j[y]:$=j;let L=j&&typeof j=="object"?j:null;if(X&&L&&X in L){let U=L;if(typeof(U==null?void 0:U.subscribe)=="function"){this._injectSubs||(this._injectSubs=new Map);let m=this._injectSubs;if(!m.has(M)){let q=U.subscribe(X,()=>{var R,P;return(P=(R=this).scheduleUpdate)===null||P===void 0?void 0:P.call(R)});m.set(M,q),(ie=this._subscriptions)===null||ie===void 0||ie.push(q)}}}return w!=null&&w.access?w.access($):$}})})}let O=this.constructor[xe];if(O!=null&&O.length){let b=this;b._subscriptions=(l=b._subscriptions)!==null&&l!==void 0?l:[],O.forEach(E=>{try{delete b[E.propertyKey]}catch(F){}Object.defineProperty(b,E.propertyKey,{configurable:!0,enumerable:!0,get(){return Fe(this,E)}})})}let z=this.constructor[st];if(z!=null&&z.length){let b=this;z.forEach(E=>{try{delete b[E.propertyKey]}catch(F){}Object.defineProperty(b,E.propertyKey,{configurable:!0,enumerable:!0,get(){return ct(E)}})})}let re=this.constructor[Ne];if(re!=null&&re.length){let b=this;b._subscriptions=(f=b._subscriptions)!==null&&f!==void 0?f:[],it(b,b._subscriptions)}let oe=this.props;oe&&typeof oe=="object"&&"$slots"in oe&&(this.$slots=oe.$slots),this.mount();let D=this,_e=()=>{var b,E;if(D._effectsInitialized)return;D._effectsInitialized=!0;let F=D.constructor,y;for(;F&&F!==Function.prototype&&(y=F[je],!(y!=null&&y.length));)F=Object.getPrototypeOf(F);let w=D.constructor[xe];w!=null&&w.length&&ot(D,(b=D._subscriptions)!==null&&b!==void 0?b:[]),y!=null&&y.length&&(D._subscriptions=(E=D._subscriptions)!==null&&E!==void 0?E:[],y.forEach(I=>{let M=C(()=>{let X=D[I];typeof X=="function"&&X.call(D)});D._subscriptions.push(M)}))};D._setupReactiveEffects=_e,_e()}}}var Ue=Symbol.for("helfy:injectable"),Nt=Symbol.for("helfy:injectableToken"),Yn=Symbol.for("helfy:scope");var lt=Symbol.for("helfy:store");var sr=Symbol.for("helfy:fieldFields");var at=Symbol.for("helfy:form");var ft=Symbol.for("helfy:ILogger");var Vt=["View","Service","Store","Context","Provider","Factory"];function dt(o){let e=o;for(let t of Vt)if(e.endsWith(t)){e=e.slice(0,-t.length);break}return e?Mt(e):o}function Mt(o){return o.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`).replace(/^-/,"")}var pt=Symbol.for("helfy:loggerCache"),Ut=Symbol.for("helfy:loggerFields"),qt=/^<[A-Za-z][A-Za-z0-9]*>$/,A={reset:"\x1B[0m",dim:"\x1B[2m",tag:"\x1B[36m",tagCustom:"\x1B[90m",tagView:"\x1B[96m",tagContext:"\x1B[93m",tagForm:"\x1B[94m",tagStore:"\x1B[92m",tagInjectable:"\x1B[95m",debug:"\x1B[90m",info:"\x1B[34m",warn:"\x1B[33m",error:"\x1B[31m"};function ht(o){let e=o==null?void 0:o.constructor;for(;e;){if(e[Ue])return"injectable";if(e[at])return"form";if(e[Se])return"context";if(e[lt])return"store";if(e[Me])return"view";e=Object.getPrototypeOf(e)}return"other"}function Qt(o){switch(o){case"view":return A.tagView;case"context":return A.tagContext;case"form":return A.tagForm;case"store":return A.tagStore;case"injectable":return A.tagInjectable;default:return A.tag}}function Wt(o){let e=o.match(/^<(.+)>$/);return e?e[1]:o}function Gt(o,e){let t=Wt(o);switch(e){case"view":return`<${t}>`;case"injectable":return`${t}()`;case"context":return`{${t}}`;case"form":return`[${t}]`;case"store":return`${t}[]`;default:return o}}function Qe(o,e=A.tag){let t=r=>{switch(r){case"DEBUG":return A.debug;case"INFO":return A.info;case"WARN":return A.warn;case"ERROR":return A.error;default:return A.reset}},n=(r,i)=>{let c=t(r);return`${e}${o}${A.reset} ${c}${r}${A.reset} ${i}`};return{debug:(r,...i)=>console.log(n("DEBUG",r),...i),info:(r,...i)=>console.info(n("INFO",r),...i),warn:(r,...i)=>console.warn(n("WARN",r),...i),error:(r,i,c)=>{if(r instanceof Error){let s=i&&typeof i=="object"&&!(i instanceof Error)?i:void 0;s&&Object.keys(s).length>0?console.error(n("ERROR",r.message),s,r):console.error(n("ERROR",r.message),r)}else{let s=i!=null?i:c;s&&Object.keys(s).length>0?console.error(n("ERROR",r),s):console.error(n("ERROR",r))}},withContext:r=>Qe(`${o}:${r}`,e)}}function kt(o,e,t){var n,r;let i=t[pt];if(i||(t[pt]=i=new Map),!i.has(o)){let c=Q(),s=e!==void 0?e:dt((r=(n=t.constructor)===null||n===void 0?void 0:n.name)!==null&&r!==void 0?r:"app"),u=!qt.test(s),l=u?s:Gt(s,ht(t)),f=u?A.tagCustom:Qt(ht(t)),a;try{let d=c==null?void 0:c.get(ft);if(d){let g=`${f}${l}${A.reset}`;a=d.withContext(g)}else a=Qe(l,f)}catch(d){a=Qe(l,f)}i.set(o,a)}return i.get(o)}function he(o){let t=o.constructor,n=[];for(;t;){let r=t[Ut];Array.isArray(r)&&n.push(...r),t=Object.getPrototypeOf(t)}n.forEach(({propertyKey:r,prefix:i})=>{try{delete o[r]}catch(c){}Object.defineProperty(o,r,{get(){return kt(r,i,this)},configurable:!0,enumerable:!1})})}var Se=Symbol.for("helfy:context"),vt=Symbol.for("helfy:contextInjectKey"),bt=Symbol.for("helfy:contextInterfaceToken");function Ae(o){return typeof o=="function"&&!!o[Se]}function Ee(o){let e=o[vt];return e||(e=Symbol(o.name||"Context"),o[vt]=e),e}function qe(o){if(o===void 0)return e=>We(e);if(typeof o=="symbol"){let e=o;return function(t){return t[bt]=e,We(t)}}return We(o)}function _t(o,e){let t=[],n=Object.getPrototypeOf(o);for(;n&&n!==Object.prototype;){let r=n[e];Array.isArray(r)&&t.push(...r),n=Object.getPrototypeOf(n)}return t}function We(o){return o[Se]=!0,Ee(o),Object.defineProperties(o.prototype,{updateProps:{value:function(t){}},subscribe:{value:function(t,n){let r=this,i=!0,c=C(()=>{let s=r[t];if(i){i=!1;return}n(s,()=>c())});return()=>c()}},unsubscribe:{value:function(t,n){}}}),class extends o{constructor(...t){var n;super(...t),this._injector=null,this._parentView=null,he(this);let r=this,i=r.constructor;for(;i&&i!==Function.prototype;){let h=i[we];h!=null&&h.length&&h.forEach(({token:_,propertyKey:x})=>{try{delete r[x]}catch(T){}Object.defineProperty(r,x,{configurable:!0,enumerable:!0,get(){return k(_)}})}),i=Object.getPrototypeOf(i)}let c=t.length>0?t[t.length-1]:void 0;c&&typeof c=="object"&&(this.props=c);let s=c&&typeof c=="object"?c.value:void 0,u=_t(r,"$_stateFields");r.__signals||Object.defineProperty(r,"__signals",{value:{},writable:!0,configurable:!0}),u.forEach(h=>{let _=r[h];try{delete r[h]}catch(O){}let[x,T]=S(_);r.__signals[h]=[x,T],Object.defineProperty(r,h,{get(){let O=this.__signals[h];return O?O[0]():void 0},set(O){let z=this.__signals[h];z&&z[1](O)},configurable:!0,enumerable:!0})}),typeof r.__beforeComputedInit=="function"&&r.__beforeComputedInit();let l=_t(r,"$_computedFields");l.length&&(l.forEach(h=>{let _=Object.getPrototypeOf(r),x;for(;_&&(x=Object.getOwnPropertyDescriptor(_,h),!x);)_=Object.getPrototypeOf(_);let T=x==null?void 0:x.get;if(typeof T!="function")return;let O=de(()=>T.call(r));Object.defineProperty(r,h,{get(){return O()},configurable:!0,enumerable:!0})}),delete r.$_computedFields);let f=new Map,a=Ee(o),d=s!=null?s:this;f.set(a,d);let g=o[bt];g&&f.set(g,d),this._injector=f;let p=r.constructor,v;for(;p&&p!==Function.prototype&&(v=p[je],!(v!=null&&v.length));)p=Object.getPrototypeOf(p);v!=null&&v.length&&(r._subscriptions=(n=r._subscriptions)!==null&&n!==void 0?n:[],v.forEach(h=>{let _=C(()=>{let x=r[h];typeof x=="function"&&x.call(r)});r._subscriptions.push(_)}))}}}function gt(o,e){if(typeof o[e]=="function")throw new Error("Function cannot be decorated by @state");o!=null&&o.$_stateFields||Object.defineProperty(o,"$_stateFields",{value:[]}),o.$_stateFields.push(e)}var mt=function(o,e,t,n){var r=arguments.length,i=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,e,t,n);else for(var s=o.length-1;s>=0;s--)(c=o[s])&&(i=(r<3?c(i):r>3?c(e,t,i):c(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i},yt=function(o,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,e)};function zt(o){let e=o;for(let t=0;t<10&&(typeof e=="function"&&e.length===0);t++)e=e();return Array.isArray(e)?e:[]}var N=class{constructor(e){this.push=(n,r)=>{this.router.navigate(n,Object.assign({replace:!1},r))},this.replace=(n,r)=>{this.router.navigate(n,Object.assign({replace:!0},r))},this.back=()=>{window.history.back()},this.match=n=>this.router.match(n);let t=zt(e==null?void 0:e.routes);this.router=new fe(t),this.location=this.router.location,this.router.subscribe(n=>{this.location=n}),this.router.initFromCurrentLocation(),window.addEventListener("popstate",this.router.handlePopState)}};mt([gt,yt("design:type",Object)],N.prototype,"location",void 0);N=mt([qe,yt("design:paramtypes",[Object])],N);var Kt=function(o,e){var t={};for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&e.indexOf(n)<0&&(t[n]=o[n]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(o);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(o,n[r])&&(t[n[r]]=o[n[r]]);return t};function V(o,e){let t=e!=null?e:{},{children:n}=t,r=Kt(t,["children"]),i=n===void 0?[]:Array.isArray(n)?n:[n],c={tag:o,props:r,children:i};typeof o=="function"&&Object.defineProperty(c,"$_type",{value:"_view"});let s=r.$_key;return s!=null&&Object.defineProperty(c,"$_key",{value:String(s)}),c}var Et=V;var Ce=class{static _view(e,t){return{$_type:"_view",$_view:e,$_props:t!=null?t:void 0,$_ref:null}}static _forin(e,t){let n=[];return e.forEach((r,i,c)=>{let s=t(r,i,c);s!==null&&n.push(s)}),{$_type:"_forin",$_data:e,$_items:n}}static _if(e,t){return{$_type:"_if",$_node:e?t:null,$_condition:e}}static _ifelse(e,t,n){if(!t&&!n)throw new Error('Has no statements "if" or "else"');return{$_type:"_ifelse",$_condition:e,$_node:e?t:n}}static _rIf(e,t){return{$_type:"_rIf",$_condFn:e,$_bodyFn:t}}static _rIfElse(e,t,n){return{$_type:"_rIfElse",$_condFn:e,$_ifFn:t,$_elseFn:n}}static _rForin(e,t){return{$_type:"_rForin",$_listFn:e,$_mapFn:t}}static _slot(e,t){return{$_type:"_slot",$_name:e,$_render:t}}static _callSlot(e,t,n,r){var i,c;let s=(i=e.$slots)!==null&&i!==void 0?i:{},u=s&&s[t]||r;return u&&(c=u(n))!==null&&c!==void 0?c:null}static _bind(e,t){return{get:()=>e[t],set:n=>{e[t]=n}}}static _bindFn(e,t){return{get:e,set:t}}};var Ge=function(o,e,t,n){var r=arguments.length,i=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,e,t,n);else for(var s=o.length-1;s>=0;s--)(c=o[s])&&(i=(r<3?c(i):r>3?c(e,t,i):c(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i},ke=function(o,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,e)},ne=class{constructor(e){this.props=e}onClick(e){e.preventDefault();let{to:t,replace:n,state:r}=this.props;n?this.replaceNav(t,{state:r}):this.push(t,{state:r})}render(){var e;let{to:t,class:n,children:r,label:i}=this.props;return V("a",{href:t,class:n,onclick:this.onClick.bind(this),children:(e=r!=null?r:i)!==null&&e!==void 0?e:""})}};Ge([G(N,"push"),ke("design:type",Function)],ne.prototype,"push",void 0);Ge([G(N,"replace"),ke("design:type",Function)],ne.prototype,"replaceNav",void 0);ne=Ge([le,ke("design:paramtypes",[Object])],ne);var Jt=function(o,e,t,n){var r=arguments.length,i=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,e,t,n);else for(var s=o.length-1;s>=0;s--)(c=o[s])&&(i=(r<3?c(i):r>3?c(e,t,i):c(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i},Xt=function(o,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,e)},ae=class{constructor(e={}){this.props=e}render(){let{pathname:e=""}=this.props;return Et("section",{style:{display:"flex",flexDirection:"column",flexGrow:1,alignItems:"center",justifyContent:"center",minHeight:"min(50vh, 320px)",padding:"2rem",textAlign:"center",gap:"10px",background:"azure"},children:[V("p",{style:{fontSize:"4rem",fontWeight:700,margin:0,lineHeight:1,letterSpacing:"-0.02em",opacity:.15},children:"404"}),V("h2",{style:{fontSize:"1.25rem",fontWeight:600,margin:"0.5rem 0 0.25rem"},children:"\u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430"}),e&&V("p",{style:{fontSize:"0.875rem",opacity:.7,margin:0,fontFamily:"ui-monospace, monospace",wordBreak:"break-all"},children:e}),V(ne,{to:"/",label:"\u041D\u0430 \u0433\u043B\u0430\u0432\u043D\u0443\u044E",class:"inline-block mt-6 px-4 py-2 text-sm rounded-md no-underline bg-indigo-100 dark:bg-indigo-900/40 text-indigo-700 dark:text-indigo-200 hover:bg-indigo-200 dark:hover:bg-indigo-800/60 transition-colors"})]})}};ae=Jt([le,Xt("design:paramtypes",[Object])],ae);var ze=function(o,e,t,n){var r=arguments.length,i=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,e,t,n);else for(var s=o.length-1;s>=0;s--)(c=o[s])&&(i=(r<3?c(i):r>3?c(e,t,i):c(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i},wt=function(o,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,e)},ve=class{render(){var e;let t=this.location.pathname,n=this.match(t);if(!n)return(e=Ce._callSlot(this,"notFound",{pathname:t,location:this.location},()=>V(ae,{pathname:t})))!==null&&e!==void 0?e:V(ae,{pathname:t});let r=n.route.component,i={params:n.params,query:n.query,location:this.location};return V(r,Object.assign({},i))}};ze([G(N,"location"),wt("design:type",Object)],ve.prototype,"location",void 0);ze([G(N,"match"),wt("design:type",Function)],ve.prototype,"match",void 0);ve=ze([le],ve);function Yt(o){var e;let t=(e=o==null?void 0:o.defaultValue)!==null&&e!==void 0?e:"/";return G(N,"location",{access:n=>{var r;return(r=n&&typeof n=="object"&&"pathname"in n?n.pathname:null)!==null&&r!==void 0?r:t}})}function Bt(o){var e;let t=(e=o==null?void 0:o.defaultValue)!==null&&e!==void 0?e:{};return G(N,"location",{access:n=>{var r;return(r=n&&typeof n=="object"&&"query"in n?n.query:null)!==null&&r!==void 0?r:t}})}function Zt(o){var e;let t=(e=o==null?void 0:o.defaultValue)!==null&&e!==void 0?e:{};return G(N,"location",{access:n=>{var r;return(r=n&&typeof n=="object"&&"params"in n?n.params:null)!==null&&r!==void 0?r:t}})}function Ht(o){return G(N,void 0,{subscribeField:"location",access:e=>{if(!e||typeof e!="object"||!("push"in e))throw new Error("[helfy/router] RouterContext is not available in the tree");let t=e;return{get location(){return t.location},push:t.push,replace:t.replace,back:t.back}}})}export{ae as DefaultNotFound,ne as Link,fe as Router,N as RouterContext,ve as RouterView,Oe as matchPath,K as normalizePath,Zt as params,Ke as parseQuery,Yt as path,Ht as router,Bt as search,xt as stringifyQuery};
package/dist/signals.d.ts CHANGED
@@ -4,11 +4,17 @@ export type Signal<T> = [SignalGetter<T>, SignalSetter<T>];
4
4
  export declare function batch(fn: () => void): void;
5
5
  export declare function createSignal<T>(initial: T): Signal<T>;
6
6
  export type EffectDisposer = () => void;
7
- export declare function createEffect(fn: () => void): EffectDisposer;
7
+ export interface CreateEffectOptions {
8
+ /** Structural effects (@if, @for) run before content — ensures cleanup before child effects. */
9
+ structural?: boolean;
10
+ }
11
+ export declare function createEffect(fn: () => void, options?: CreateEffectOptions): EffectDisposer;
8
12
  export declare function onCleanup(fn: () => void): void;
9
13
  export interface CreateComputedOptions<T> {
10
14
  /** Custom equality. Default: Object.is. If equal, downstream observers are not notified. */
11
15
  equals?: (a: T, b: T) => boolean;
16
+ /** Skip running when node has no observers (e.g. parent @if unmounted children). */
17
+ skipWhenNoObservers?: boolean;
12
18
  }
13
19
  /** Symbol to access the dispose function on a computed getter. */
14
20
  export declare const COMPUTED_DISPOSE: unique symbol;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helfy/helfy",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "TypeScript UI framework with decorator API, custom JSX and reactive state management",
5
5
  "author": "ikrymsaev",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- export declare function observe<T>(store: T, storeField: keyof T): (target: any, field: any) => void;
@@ -1,22 +0,0 @@
1
- /** Metadata key for @provide fields on a Context class */
2
- export declare const PROVIDE_FIELDS: unique symbol;
3
- export interface ProvideField {
4
- propertyKey: string | symbol;
5
- reactive?: boolean;
6
- computed?: boolean;
7
- deps?: (string | symbol)[];
8
- }
9
- export interface ProvideOptions {
10
- reactive?: boolean;
11
- /** Computed getter — reactive, re-notifies when deps change */
12
- computed?: boolean;
13
- /** Dependencies for computed (field names this getter reads) */
14
- deps?: (string | symbol)[];
15
- }
16
- /**
17
- * Marks a field/getter/method as provided by the @Context class.
18
- * @provide() — non-reactive
19
- * @provide({ reactive: true }) — reactive, consumers re-render on change
20
- * @provide({ computed: true, deps: ['todos', 'filter'] }) — computed, reactive
21
- */
22
- export declare function provide(options?: ProvideOptions): (target: object, propertyKey: string | symbol, _descriptor?: PropertyDescriptor) => void;