@fluixi/dom 1.0.0-alpha.67 → 1.0.0-alpha.69
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.
- package/dist/cdn/dom.cjs +1 -1
- package/dist/cdn/dom.global.js +1 -1
- package/dist/cdn/dom.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lib/element/attributes.d.ts +6 -6
- package/dist/lib/element/attributes.d.ts.map +1 -1
- package/dist/lib/flow/dynamic.cjs +1 -1
- package/dist/lib/flow/dynamic.d.ts.map +1 -1
- package/dist/lib/flow/dynamic.js +15 -2
- package/dist/lib/flow/dynamic.mjs +1 -1
- package/dist/lib/flow/index.cjs +1 -1
- package/dist/lib/flow/index.mjs +1 -1
- package/dist/lib/flow/show.cjs +1 -1
- package/dist/lib/flow/show.d.ts.map +1 -1
- package/dist/lib/flow/show.js +37 -15
- package/dist/lib/flow/show.mjs +1 -1
- package/dist/lib/flow/switch.cjs +1 -1
- package/dist/lib/flow/switch.d.ts.map +1 -1
- package/dist/lib/flow/switch.js +31 -7
- package/dist/lib/flow/switch.mjs +1 -1
- package/dist/lib/index.cjs +1 -1
- package/dist/lib/index.mjs +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/lib/flow/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var _=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var he=Object.prototype.hasOwnProperty;var me=(e,n)=>{for(var t in n)_(e,t,{get:n[t],enumerable:!0})},xe=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of pe(n))!he.call(e,a)&&a!==t&&_(e,a,{get:()=>n[a],enumerable:!(o=de(n,a))||o.enumerable});return e};var ge=e=>xe(_({},"__esModule",{value:!0}),e);var Pe={};me(Pe,{ClientOnly:()=>O,Dynamic:()=>Q,ErrorBoundary:()=>fe,For:()=>q,Index:()=>G,Match:()=>J,NoSsr:()=>se,Portal:()=>ie,Show:()=>V,Switch:()=>Y,classMap:()=>ce,indexArray:()=>P.indexArray,keyArray:()=>P.keyArray,mapArray:()=>P.mapArray,styleMap:()=>ue});module.exports=ge(Pe);var N=require("@fluixi/reactive/signal");function I(e){return typeof e=="function"?e:(()=>e)}function g(e){return()=>{let n=e();return typeof n=="function"?n():n}}function W(e){return e!=null&&e!==!1}function K(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function V(e){let n=g(()=>e.when),t=(0,N.createMemo)(n,void 0),o=(0,N.createMemo)(t,void 0);return(0,N.createMemo)(()=>{if(o()){let s=e.children;return typeof s=="function"&&!K(s)?typeof t=="function"?(0,N.untrack)(()=>(0,N.untrack)(t)?s(t()):e.fallback):s(t):s}return e.fallback},void 0,{name:"show"})}var w=require("@fluixi/reactive/signal");var h={active:!1,cursor:null,parents:[]},be=null;function B(){return be}function $(e,n){return h.active&&n.parentNode===e}function D(e){let n=h.parents.lastIndexOf(e);n!==-1&&(h.parents.length=n),h.cursor=e.nextSibling}function S(e){if(!h.active||e==null)return;let n=Array.isArray(e)?e[e.length-1]:e;n&&typeof n.nodeType=="number"&&D(n)}function q(e){let n=g(()=>e.each),t=()=>e.fallback??null,o=(a,s)=>{let f=e.children,i=Array.isArray(f)?f.map(r=>typeof r=="function"?r(a,s):r):typeof f=="function"?f(a,s):f;return S(i),i};return e.by?(0,w.keyArray)(n,e.by,(a,s)=>o(a,s),{fallback:t}):(0,w.mapArray)(n,(a,s)=>o(a,s),{fallback:t})}var z=require("@fluixi/reactive/signal");function G(e){let n=g(()=>e.each);return(0,z.indexArray)(n,(t,o)=>{let a=e.children(t,o);return S(a),a},{fallback:()=>e.fallback??null})}var P=require("@fluixi/reactive/signal");var X=require("@fluixi/reactive/signal");var H=Symbol("match");function J(e){return{[H]:!0,when:g(()=>e.when),children:e.children}}function Y(e){let n=Array.isArray(e.children)?e.children:[e.children];return(0,X.createMemo)(()=>{for(let t of n){let o=t,a=0;for(;typeof o=="function"&&!o[H]&&a++<10;)o=o();if(!o||typeof o!="object"||o[H]!==!0)continue;let s=o.when();if(W(s))return typeof o.children=="function"?o.children(s):o.children}return e.fallback??null})}var Z=require("@fluixi/reactive/signal");function Q(e){let n=I(e.component),{component:t,...o}=e;return(0,Z.createMemo)(()=>{let a=n();return a==null?null:typeof a=="string"?{tag:a,props:o}:a(o)})}var k=require("@fluixi/reactive/signal");var p=require("@fluixi/reactive/signal");function A(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var T=require("@fluixi/reactive/signal");var C=typeof document>"u";var ne=Symbol.for("fluixi.server-node"),ee=null;function te(){if(!ee)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return ee}function v(e){return e!=null&&e[ne]===!0?!0:typeof Node<"u"&&e instanceof Node}function oe(e){return e!=null&&e[ne]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}function b(e,n=!1){if(C)return te().createText(e);if(h.active&&!n){let t=B()?.hydrateText(e);if(t)return t}return document.createTextNode(e)}var x=0,Te=200;function Ne(e,n,t,o,a){let s=o,f=new Map;return(0,T.createRenderEffect)(()=>{let i;if(A(e)&&!(0,p.isSignal)(e)){if(!f.has(e)){x++;try{let r=e();f.set(e,r)}finally{x--}}for(i=f.get(e);typeof i=="function"&&(0,p.isSignal)(i);)i=i()}else for(i=e();typeof i=="function"&&(0,p.isSignal)(i);)i=i();{let r=0;for(;typeof i=="function"&&r++<50;)if(A(i)){if(!f.has(i)){let c=i;x++;try{let l=c();f.set(c,l)}finally{x--}}i=f.get(i)}else if((0,p.isSignal)(i))i=i();else if(i=i(),typeof i!="function"||!(0,p.isSignal)(i)&&!A(i))break}x++;try{s=R(n,i,t,s,f),a(s)}finally{x--}})}function U(e,n,t,o){if(x>Te)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;t!==void 0&&!t&&(t=b("",!0),e.appendChild(t));let a=o??null,s=r=>Array.isArray(r)&&r.some(c=>typeof c=="function"),f=r=>typeof r=="function"?r:()=>r;if(typeof n!="function"&&!s(n)){x++;try{a=R(e,n,t,null)}finally{x--}return()=>a}let i=Ne(f(n),e,t,a,r=>{a=r});return()=>(i?.(),a)}function R(e,n,t,o,a){if(n==null||typeof n=="boolean")return E(e,o,t);if(typeof n=="function")for(;typeof n=="function";)n=n();if(n==null||typeof n=="boolean")return E(e,o,t);if(M(n)){let f=b("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(f,o[0]),E(e,o.slice(1),t)):d(e,f,t):o?e.replaceChild(f,o):d(e,f,t),n.then(i=>{f.parentNode===e&&R(e,i,f.nextSibling,f)}).catch(i=>{console.error("Error resolving promise in insertExpression:",i)}),f}let s=typeof n;if(s==="string"||s==="number"){if(s==="number"&&(n=String(n)),Array.isArray(o)){if(o.length===0){let i=b(n);return d(e,i,t),i}if(o.length===1&&o[0].nodeType===3)return o[0].data=n,o;o=E(e,o,t)}if(o&&oe(o))return o.data=n,o;let f=b(n);return o&&o.parentNode===e?e.replaceChild(f,o):$(e,f)||d(e,f,t),f}if(v(n))return $(e,n)?(D(n),n):Array.isArray(o)?(o.length===0?d(e,n,t):o[0].parentNode===e?(e.replaceChild(n,o[0]),E(e,o.slice(1),t)):d(e,n,t),n):(o?o!==n&&(o.parentNode===e?e.replaceChild(n,o):d(e,n,t)):d(e,n,t),n);if(Array.isArray(n)){let f=[],i=Array.isArray(o)?o:o?[o]:[],r=[];m(n,f,e,t,!0,a,r);let c=Ae(e,i,f,t);for(let l of r){let u=U(e,l.sig,l.marker);(0,T.onCleanup)(()=>{E(e,u()),l.marker.parentNode===e&&e.removeChild(l.marker)})}return c}if(s==="object"&&n!==null&&typeof n=="object"){let f=n;if("type"in f&&"props"in f){let i=f;if(typeof i.type=="function"){let r=i.type(i.props||{});return R(e,r,t,o)}}}return E(e,o,t)}function m(e,n,t,o,a=!0,s,f){for(let i=0;i<e.length;i++){let r=e[i];if(!(r==null||typeof r=="boolean")){for(;typeof r=="function"&&!M(r)&&!(0,p.isSignal)(r)&&!A(r)&&(r=r(),!(r==null||typeof r=="boolean")););if(!(r==null||typeof r=="boolean")){if(typeof r=="function"){let c;for(A(r)&&!(0,p.isSignal)(r)?(s||(s=new Map),s.has(r)||s.set(r,r()),c=s.get(r)):c=r();typeof c=="function"&&!M(c)&&!(0,p.isSignal)(c)&&!A(c);)s||(s=new Map),s.has(c)||s.set(c,c()),c=s.get(c);if(c==null||typeof c=="boolean")continue;if(typeof c=="function"){if((0,p.isSignal)(c)){if(f){let u=b("",!0);n.push(u),f.push({marker:u,sig:c});continue}let l=c();for(;typeof l=="function"&&(0,p.isSignal)(l);)l=l();if(l==null||typeof l=="boolean")continue;Array.isArray(l)?m(l,n,t,o,a,s):m([l],n,t,o,a,s);continue}continue}Array.isArray(c)?m(c,n,t,o,a,s,f):m([c],n,t,o,a,s,f);continue}if(M(r)){let c=b("",!0);n.push(c),r.then(l=>{if(c.parentNode){let u=[];if(m([l],u,c.parentNode,void 0,!1,s),u.length>0){c.parentNode.replaceChild(u[0],c);for(let y=1;y<u.length;y++)c.parentNode?.insertBefore(u[y],u[y-1].nextSibling)}}}).catch(l=>console.error("Error resolving promise in array:",l));continue}if(Array.isArray(r)){m(r,n,t,o,a,s,f);continue}if(v(r)){n.push(r);continue}if(typeof r=="object"&&r!==null&&"type"in r&&"props"in r){let c=r;if(typeof c.type=="function"){let l=c.type(c.props||{});Array.isArray(l)?m(l,n,t,o,!1,s):m([l],n,t,o,!1,s);continue}}if(typeof r=="string"||typeof r=="number"){let c=String(r);if(c.trim()===""&&c!==" ")continue;n.push(b(c));continue}n.push(b(String(r)))}}}}function Ae(e,n,t,o){for(let u=0;u<t.length;u++)t[u].parentNode!==null&&t[u].parentNode!==e&&(t=t.slice(),t[u]=t[u].cloneNode(!0));let a=t.length,s=n.length,f=a,i=0,r=0,c=s>0?n[s-1].nextSibling??void 0:o,l=null;for(;i<s||r<f;){if(n[i]===t[r]){i++,r++;continue}for(;s>i&&f>r&&n[s-1]===t[f-1];)s--,f--;if(s===i){let u=f<a?r?t[r-1].nextSibling??void 0:t[f-r]:c;for(;r<f;)d(e,t[r++],u)}else if(f===r)for(;i<s;)(!l||!l.has(n[i]))&&n[i].parentNode===e&&e.removeChild(n[i]),i++;else if(n[i]===t[f-1]&&t[r]===n[s-1]){let u=n[--s].nextSibling;d(e,t[r++],n[i++].nextSibling),d(e,t[--f],u),n[s]=n[i-1]}else{if(!l){l=new Map;let y=r;for(;y<f;)l.set(t[y],y++)}let u=l.get(n[i]);if(u!=null)if(r<u&&u<f){let y=i,F=1;for(;++y<s&&y<f&&!(!l.has(n[y])||l.get(n[y])!==u+F);)F++;if(F>u-r){let ye=n[i];for(;r<u;)d(e,t[r++],ye)}else n[i].parentNode===e?e.replaceChild(t[r++],n[i++]):(d(e,t[r++],c),i++)}else i++;else n[i].parentNode===e&&e.removeChild(n[i]),i++}}return t}function E(e,n,t){if(n)if(Array.isArray(n))for(let o=0;o<n.length;o++)n[o].parentNode===e&&e.removeChild(n[o]);else n.parentNode===e&&e.removeChild(n);return null}function d(e,n,t){h.active&&n.parentNode===e||(t&&t.parentNode===e?e.insertBefore(n,t):e.appendChild(n))}function re(e,n){if(e){if(v(e)){let t=n,o=e;if(!t)return;typeof t=="function"?t(o):typeof t=="object"&&"current"in t&&(t.current=o);return}typeof e=="function"?e(n):typeof e=="object"&&"current"in e&&(e.current=n)}}function M(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function ie(e){let n=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,t,o;return(0,k.createRoot)(a=>{t=a,o=document.createElement("div"),o.style.display="contents",n().appendChild(o),U(o,e.children)&&re(e.ref,o)}),(0,k.onCleanup)(()=>{t(),o.remove()}),null}var L=require("@fluixi/reactive/signal");function O(e){if(C)return e.fallback??null;let n=h.active,[t,o]=(0,L.createSignal)(!n);return n&&queueMicrotask(()=>o(!0)),(0,L.createMemo)(()=>t()?e.children:e.fallback??null,void 0,{name:"client-only"})}var se=O;var j=require("@fluixi/reactive/signal");function fe(e){let[n,t]=(0,j.createSignal)(null),o=()=>t(null);return(0,j.createMemo)(()=>{let a=n();if(a!==null)return typeof e.fallback=="function"?e.fallback(a,o):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(s){return t(s),typeof e.fallback=="function"?e.fallback(s,o):e.fallback}})}var ae=require("@fluixi/reactive/signal");function ce(e){return(0,ae.createMemo)(()=>{let n=typeof e=="function"?e():e,t=[];for(let[o,a]of Object.entries(n)){if(!o)continue;(typeof a=="function"?a():a)&&t.push(o)}return t.join(" ")})}var le=require("@fluixi/reactive/signal");function Ee(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}function ue(e){return(0,le.createMemo)(()=>{let n=typeof e=="function"?e():e,t=[];for(let[o,a]of Object.entries(n)){if(!o)continue;let s=typeof a=="function"?a():a;s!=null&&t.push(`${Ee(o)}: ${s}`)}return t.join("; ")})}
|
|
1
|
+
"use strict";var $=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var he=Object.prototype.hasOwnProperty;var me=(e,n)=>{for(var t in n)$(e,t,{get:n[t],enumerable:!0})},xe=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of pe(n))!he.call(e,a)&&a!==t&&$(e,a,{get:()=>n[a],enumerable:!(o=de(n,a))||o.enumerable});return e};var ge=e=>xe($({},"__esModule",{value:!0}),e);var we={};me(we,{ClientOnly:()=>I,Dynamic:()=>Q,ErrorBoundary:()=>fe,For:()=>G,Index:()=>J,Match:()=>Y,NoSsr:()=>se,Portal:()=>ie,Show:()=>q,Switch:()=>Z,classMap:()=>ce,indexArray:()=>P.indexArray,keyArray:()=>P.keyArray,mapArray:()=>P.mapArray,styleMap:()=>ue});module.exports=ge(we);var y=require("@fluixi/reactive/signal");function K(e){return typeof e=="function"?e:(()=>e)}function N(e){return()=>{let n=e();return typeof n=="function"?n():n}}function V(e){return e!=null&&e!==!1}function B(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function q(e){let n=N(()=>e.when),t=(0,y.createMemo)(n,void 0),o=(0,y.createMemo)(t,void 0),a=(0,y.getOwner)(),s=null,f=null,i=r=>{r!==f&&(s&&(0,y.disposeScope)(s),s=(0,y.createChildOwner)(a),f=r)};return(0,y.createMemo)(()=>{let r=o();return i(r?"when":"fallback"),(0,y.runWithOwner)(s,()=>{if(r){let c=e.children;return typeof c=="function"&&!B(c)?typeof t=="function"?(0,y.untrack)(()=>(0,y.untrack)(t)?c(t()):e.fallback):c(t):c}return e.fallback});return e.fallback??null},void 0,{name:"show"})}var v=require("@fluixi/reactive/signal");var x={active:!1,cursor:null,parents:[]},be=null;function z(){return be}function D(e,n){return x.active&&n.parentNode===e}function H(e){let n=x.parents.lastIndexOf(e);n!==-1&&(x.parents.length=n),x.cursor=e.nextSibling}function C(e){if(!x.active||e==null)return;let n=Array.isArray(e)?e[e.length-1]:e;n&&typeof n.nodeType=="number"&&H(n)}function G(e){let n=N(()=>e.each),t=()=>e.fallback??null,o=(a,s)=>{let f=e.children,i=Array.isArray(f)?f.map(r=>typeof r=="function"?r(a,s):r):typeof f=="function"?f(a,s):f;return C(i),i};return e.by?(0,v.keyArray)(n,e.by,(a,s)=>o(a,s),{fallback:t}):(0,v.mapArray)(n,(a,s)=>o(a,s),{fallback:t})}var X=require("@fluixi/reactive/signal");function J(e){let n=N(()=>e.each);return(0,X.indexArray)(n,(t,o)=>{let a=e.children(t,o);return C(a),a},{fallback:()=>e.fallback??null})}var P=require("@fluixi/reactive/signal");var h=require("@fluixi/reactive/signal");var U=Symbol("match");function Y(e){return{[U]:!0,when:N(()=>e.when),get children(){return e.children}}}function Z(e){let n=Array.isArray(e.children)?e.children:[e.children],t=(0,h.getOwner)(),o=null,a=-1,s=f=>{f!==a&&(o&&(0,h.disposeScope)(o),o=(0,h.createChildOwner)(t),a=f)};return(0,h.createMemo)(()=>{for(let f=0;f<n.length;f+=1){let r=n[f],c=0;for(;typeof r=="function"&&!r[U]&&c++<10;)r=r();if(!r||typeof r!="object"||r[U]!==!0)continue;let l=r.when();if(V(l))return s(f),(0,h.runWithOwner)(o,()=>typeof r.children=="function"?r.children(l):r.children)}return s(-2),(0,h.runWithOwner)(o,()=>e.fallback??null)})}var g=require("@fluixi/reactive/signal");function Q(e){let n=K(e.component),{component:t,...o}=e,a=(0,g.getOwner)(),s=null,f;return(0,g.createMemo)(()=>{let i=n();return i!==f&&(s&&(0,g.disposeScope)(s),s=(0,g.createChildOwner)(a),f=i),i==null?null:typeof i=="string"?{tag:i,props:o}:(0,g.runWithOwner)(s,()=>i(o))})}var L=require("@fluixi/reactive/signal");var m=require("@fluixi/reactive/signal");function w(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var E=require("@fluixi/reactive/signal");var M=typeof document>"u";var ne=Symbol.for("fluixi.server-node"),ee=null;function te(){if(!ee)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return ee}function k(e){return e!=null&&e[ne]===!0?!0:typeof Node<"u"&&e instanceof Node}function oe(e){return e!=null&&e[ne]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}function A(e,n=!1){if(M)return te().createText(e);if(x.active&&!n){let t=z()?.hydrateText(e);if(t)return t}return document.createTextNode(e)}var T=0,Te=200;function Ne(e,n,t,o,a){let s=o,f=new Map;return(0,E.createRenderEffect)(()=>{let i;if(w(e)&&!(0,m.isSignal)(e)){if(!f.has(e)){T++;try{let r=e();f.set(e,r)}finally{T--}}for(i=f.get(e);typeof i=="function"&&(0,m.isSignal)(i);)i=i()}else for(i=e();typeof i=="function"&&(0,m.isSignal)(i);)i=i();{let r=0;for(;typeof i=="function"&&r++<50;)if(w(i)){if(!f.has(i)){let c=i;T++;try{let l=c();f.set(c,l)}finally{T--}}i=f.get(i)}else if((0,m.isSignal)(i))i=i();else if(i=i(),typeof i!="function"||!(0,m.isSignal)(i)&&!w(i))break}T++;try{s=O(n,i,t,s,f),a(s)}finally{T--}})}function W(e,n,t,o){if(T>Te)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;t!==void 0&&!t&&(t=A("",!0),e.appendChild(t));let a=o??null,s=r=>Array.isArray(r)&&r.some(c=>typeof c=="function"),f=r=>typeof r=="function"?r:()=>r;if(typeof n!="function"&&!s(n)){T++;try{a=O(e,n,t,null)}finally{T--}return()=>a}let i=Ne(f(n),e,t,a,r=>{a=r});return()=>(i?.(),a)}function O(e,n,t,o,a){if(n==null||typeof n=="boolean")return S(e,o,t);if(typeof n=="function")for(;typeof n=="function";)n=n();if(n==null||typeof n=="boolean")return S(e,o,t);if(R(n)){let f=A("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(f,o[0]),S(e,o.slice(1),t)):p(e,f,t):o?e.replaceChild(f,o):p(e,f,t),n.then(i=>{f.parentNode===e&&O(e,i,f.nextSibling,f)}).catch(i=>{console.error("Error resolving promise in insertExpression:",i)}),f}let s=typeof n;if(s==="string"||s==="number"){if(s==="number"&&(n=String(n)),Array.isArray(o)){if(o.length===0){let i=A(n);return p(e,i,t),i}if(o.length===1&&o[0].nodeType===3)return o[0].data=n,o;o=S(e,o,t)}if(o&&oe(o))return o.data=n,o;let f=A(n);return o&&o.parentNode===e?e.replaceChild(f,o):D(e,f)||p(e,f,t),f}if(k(n))return D(e,n)?(H(n),n):Array.isArray(o)?(o.length===0?p(e,n,t):o[0].parentNode===e?(e.replaceChild(n,o[0]),S(e,o.slice(1),t)):p(e,n,t),n):(o?o!==n&&(o.parentNode===e?e.replaceChild(n,o):p(e,n,t)):p(e,n,t),n);if(Array.isArray(n)){let f=[],i=Array.isArray(o)?o:o?[o]:[],r=[];b(n,f,e,t,!0,a,r);let c=Ae(e,i,f,t);for(let l of r){let u=W(e,l.sig,l.marker);(0,E.onCleanup)(()=>{S(e,u()),l.marker.parentNode===e&&e.removeChild(l.marker)})}return c}if(s==="object"&&n!==null&&typeof n=="object"){let f=n;if("type"in f&&"props"in f){let i=f;if(typeof i.type=="function"){let r=i.type(i.props||{});return O(e,r,t,o)}}}return S(e,o,t)}function b(e,n,t,o,a=!0,s,f){for(let i=0;i<e.length;i++){let r=e[i];if(!(r==null||typeof r=="boolean")){for(;typeof r=="function"&&!R(r)&&!(0,m.isSignal)(r)&&!w(r)&&(r=r(),!(r==null||typeof r=="boolean")););if(!(r==null||typeof r=="boolean")){if(typeof r=="function"){let c;for(w(r)&&!(0,m.isSignal)(r)?(s||(s=new Map),s.has(r)||s.set(r,r()),c=s.get(r)):c=r();typeof c=="function"&&!R(c)&&!(0,m.isSignal)(c)&&!w(c);)s||(s=new Map),s.has(c)||s.set(c,c()),c=s.get(c);if(c==null||typeof c=="boolean")continue;if(typeof c=="function"){if((0,m.isSignal)(c)){if(f){let u=A("",!0);n.push(u),f.push({marker:u,sig:c});continue}let l=c();for(;typeof l=="function"&&(0,m.isSignal)(l);)l=l();if(l==null||typeof l=="boolean")continue;Array.isArray(l)?b(l,n,t,o,a,s):b([l],n,t,o,a,s);continue}continue}Array.isArray(c)?b(c,n,t,o,a,s,f):b([c],n,t,o,a,s,f);continue}if(R(r)){let c=A("",!0);n.push(c),r.then(l=>{if(c.parentNode){let u=[];if(b([l],u,c.parentNode,void 0,!1,s),u.length>0){c.parentNode.replaceChild(u[0],c);for(let d=1;d<u.length;d++)c.parentNode?.insertBefore(u[d],u[d-1].nextSibling)}}}).catch(l=>console.error("Error resolving promise in array:",l));continue}if(Array.isArray(r)){b(r,n,t,o,a,s,f);continue}if(k(r)){n.push(r);continue}if(typeof r=="object"&&r!==null&&"type"in r&&"props"in r){let c=r;if(typeof c.type=="function"){let l=c.type(c.props||{});Array.isArray(l)?b(l,n,t,o,!1,s):b([l],n,t,o,!1,s);continue}}if(typeof r=="string"||typeof r=="number"){let c=String(r);if(c.trim()===""&&c!==" ")continue;n.push(A(c));continue}n.push(A(String(r)))}}}}function Ae(e,n,t,o){for(let u=0;u<t.length;u++)t[u].parentNode!==null&&t[u].parentNode!==e&&(t=t.slice(),t[u]=t[u].cloneNode(!0));let a=t.length,s=n.length,f=a,i=0,r=0,c=s>0?n[s-1].nextSibling??void 0:o,l=null;for(;i<s||r<f;){if(n[i]===t[r]){i++,r++;continue}for(;s>i&&f>r&&n[s-1]===t[f-1];)s--,f--;if(s===i){let u=f<a?r?t[r-1].nextSibling??void 0:t[f-r]:c;for(;r<f;)p(e,t[r++],u)}else if(f===r)for(;i<s;)(!l||!l.has(n[i]))&&n[i].parentNode===e&&e.removeChild(n[i]),i++;else if(n[i]===t[f-1]&&t[r]===n[s-1]){let u=n[--s].nextSibling;p(e,t[r++],n[i++].nextSibling),p(e,t[--f],u),n[s]=n[i-1]}else{if(!l){l=new Map;let d=r;for(;d<f;)l.set(t[d],d++)}let u=l.get(n[i]);if(u!=null)if(r<u&&u<f){let d=i,_=1;for(;++d<s&&d<f&&!(!l.has(n[d])||l.get(n[d])!==u+_);)_++;if(_>u-r){let ye=n[i];for(;r<u;)p(e,t[r++],ye)}else n[i].parentNode===e?e.replaceChild(t[r++],n[i++]):(p(e,t[r++],c),i++)}else i++;else n[i].parentNode===e&&e.removeChild(n[i]),i++}}return t}function S(e,n,t){if(n)if(Array.isArray(n))for(let o=0;o<n.length;o++)n[o].parentNode===e&&e.removeChild(n[o]);else n.parentNode===e&&e.removeChild(n);return null}function p(e,n,t){x.active&&n.parentNode===e||(t&&t.parentNode===e?e.insertBefore(n,t):e.appendChild(n))}function re(e,n){if(e){if(k(e)){let t=n,o=e;if(!t)return;typeof t=="function"?t(o):typeof t=="object"&&"current"in t&&(t.current=o);return}typeof e=="function"?e(n):typeof e=="object"&&"current"in e&&(e.current=n)}}function R(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function ie(e){let n=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,t,o;return(0,L.createRoot)(a=>{t=a,o=document.createElement("div"),o.style.display="contents",n().appendChild(o),W(o,e.children)&&re(e.ref,o)}),(0,L.onCleanup)(()=>{t(),o.remove()}),null}var j=require("@fluixi/reactive/signal");function I(e){if(M)return e.fallback??null;let n=x.active,[t,o]=(0,j.createSignal)(!n);return n&&queueMicrotask(()=>o(!0)),(0,j.createMemo)(()=>t()?e.children:e.fallback??null,void 0,{name:"client-only"})}var se=I;var F=require("@fluixi/reactive/signal");function fe(e){let[n,t]=(0,F.createSignal)(null),o=()=>t(null);return(0,F.createMemo)(()=>{let a=n();if(a!==null)return typeof e.fallback=="function"?e.fallback(a,o):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(s){return t(s),typeof e.fallback=="function"?e.fallback(s,o):e.fallback}})}var ae=require("@fluixi/reactive/signal");function ce(e){return(0,ae.createMemo)(()=>{let n=typeof e=="function"?e():e,t=[];for(let[o,a]of Object.entries(n)){if(!o)continue;(typeof a=="function"?a():a)&&t.push(o)}return t.join(" ")})}var le=require("@fluixi/reactive/signal");function Ee(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}function ue(e){return(0,le.createMemo)(()=>{let n=typeof e=="function"?e():e,t=[];for(let[o,a]of Object.entries(n)){if(!o)continue;let s=typeof a=="function"?a():a;s!=null&&t.push(`${Ee(o)}: ${s}`)}return t.join("; ")})}
|
package/dist/lib/flow/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createMemo as v,untrack as $}from"@fluixi/reactive/signal";function j(e){return typeof e=="function"?e:(()=>e)}function g(e){return()=>{let n=e();return typeof n=="function"?n():n}}function F(e){return e!=null&&e!==!1}function _(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function B(e){let n=g(()=>e.when),t=v(n,void 0),o=v(t,void 0);return v(()=>{if(o()){let s=e.children;return typeof s=="function"&&!_(s)?typeof t=="function"?$(()=>$(t)?s(t()):e.fallback):s(t):s}return e.fallback},void 0,{name:"show"})}import{mapArray as z,keyArray as G}from"@fluixi/reactive/signal";var p={active:!1,cursor:null,parents:[]},q=null;function D(){return q}function M(e,n){return p.active&&n.parentNode===e}function R(e){let n=p.parents.lastIndexOf(e);n!==-1&&(p.parents.length=n),p.cursor=e.nextSibling}function A(e){if(!p.active||e==null)return;let n=Array.isArray(e)?e[e.length-1]:e;n&&typeof n.nodeType=="number"&&R(n)}function X(e){let n=g(()=>e.each),t=()=>e.fallback??null,o=(a,s)=>{let f=e.children,i=Array.isArray(f)?f.map(r=>typeof r=="function"?r(a,s):r):typeof f=="function"?f(a,s):f;return A(i),i};return e.by?G(n,e.by,(a,s)=>o(a,s),{fallback:t}):z(n,(a,s)=>o(a,s),{fallback:t})}import{indexArray as J}from"@fluixi/reactive/signal";function Y(e){let n=g(()=>e.each);return J(n,(t,o)=>{let a=e.children(t,o);return A(a),a},{fallback:()=>e.fallback??null})}import{mapArray as Ln,keyArray as jn,indexArray as Fn}from"@fluixi/reactive/signal";import{createMemo as Z}from"@fluixi/reactive/signal";var k=Symbol("match");function Q(e){return{[k]:!0,when:g(()=>e.when),children:e.children}}function ee(e){let n=Array.isArray(e.children)?e.children:[e.children];return Z(()=>{for(let t of n){let o=t,a=0;for(;typeof o=="function"&&!o[k]&&a++<10;)o=o();if(!o||typeof o!="object"||o[k]!==!0)continue;let s=o.when();if(F(s))return typeof o.children=="function"?o.children(s):o.children}return e.fallback??null})}import{createMemo as ne}from"@fluixi/reactive/signal";function te(e){let n=j(e.component),{component:t,...o}=e;return ne(()=>{let a=n();return a==null?null:typeof a=="string"?{tag:a,props:o}:a(o)})}import{createRoot as ae,onCleanup as ce}from"@fluixi/reactive/signal";import{isSignal as h}from"@fluixi/reactive/signal";function T(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}import{batch as en,createEffect as nn,createRenderEffect as oe,createRoot as tn,onCleanup as re,readChildren as on}from"@fluixi/reactive/signal";var E=typeof document>"u";var U=Symbol.for("fluixi.server-node"),H=null;function O(){if(!H)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return H}function P(e){return e!=null&&e[U]===!0?!0:typeof Node<"u"&&e instanceof Node}function I(e){return e!=null&&e[U]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}function b(e,n=!1){if(E)return O().createText(e);if(p.active&&!n){let t=D()?.hydrateText(e);if(t)return t}return document.createTextNode(e)}var x=0,ie=200;function se(e,n,t,o,a){let s=o,f=new Map;return oe(()=>{let i;if(T(e)&&!h(e)){if(!f.has(e)){x++;try{let r=e();f.set(e,r)}finally{x--}}for(i=f.get(e);typeof i=="function"&&h(i);)i=i()}else for(i=e();typeof i=="function"&&h(i);)i=i();{let r=0;for(;typeof i=="function"&&r++<50;)if(T(i)){if(!f.has(i)){let c=i;x++;try{let l=c();f.set(c,l)}finally{x--}}i=f.get(i)}else if(h(i))i=i();else if(i=i(),typeof i!="function"||!h(i)&&!T(i))break}x++;try{s=w(n,i,t,s,f),a(s)}finally{x--}})}function L(e,n,t,o){if(x>ie)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;t!==void 0&&!t&&(t=b("",!0),e.appendChild(t));let a=o??null,s=r=>Array.isArray(r)&&r.some(c=>typeof c=="function"),f=r=>typeof r=="function"?r:()=>r;if(typeof n!="function"&&!s(n)){x++;try{a=w(e,n,t,null)}finally{x--}return()=>a}let i=se(f(n),e,t,a,r=>{a=r});return()=>(i?.(),a)}function w(e,n,t,o,a){if(n==null||typeof n=="boolean")return N(e,o,t);if(typeof n=="function")for(;typeof n=="function";)n=n();if(n==null||typeof n=="boolean")return N(e,o,t);if(S(n)){let f=b("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(f,o[0]),N(e,o.slice(1),t)):d(e,f,t):o?e.replaceChild(f,o):d(e,f,t),n.then(i=>{f.parentNode===e&&w(e,i,f.nextSibling,f)}).catch(i=>{console.error("Error resolving promise in insertExpression:",i)}),f}let s=typeof n;if(s==="string"||s==="number"){if(s==="number"&&(n=String(n)),Array.isArray(o)){if(o.length===0){let i=b(n);return d(e,i,t),i}if(o.length===1&&o[0].nodeType===3)return o[0].data=n,o;o=N(e,o,t)}if(o&&I(o))return o.data=n,o;let f=b(n);return o&&o.parentNode===e?e.replaceChild(f,o):M(e,f)||d(e,f,t),f}if(P(n))return M(e,n)?(R(n),n):Array.isArray(o)?(o.length===0?d(e,n,t):o[0].parentNode===e?(e.replaceChild(n,o[0]),N(e,o.slice(1),t)):d(e,n,t),n):(o?o!==n&&(o.parentNode===e?e.replaceChild(n,o):d(e,n,t)):d(e,n,t),n);if(Array.isArray(n)){let f=[],i=Array.isArray(o)?o:o?[o]:[],r=[];m(n,f,e,t,!0,a,r);let c=fe(e,i,f,t);for(let l of r){let u=L(e,l.sig,l.marker);re(()=>{N(e,u()),l.marker.parentNode===e&&e.removeChild(l.marker)})}return c}if(s==="object"&&n!==null&&typeof n=="object"){let f=n;if("type"in f&&"props"in f){let i=f;if(typeof i.type=="function"){let r=i.type(i.props||{});return w(e,r,t,o)}}}return N(e,o,t)}function m(e,n,t,o,a=!0,s,f){for(let i=0;i<e.length;i++){let r=e[i];if(!(r==null||typeof r=="boolean")){for(;typeof r=="function"&&!S(r)&&!h(r)&&!T(r)&&(r=r(),!(r==null||typeof r=="boolean")););if(!(r==null||typeof r=="boolean")){if(typeof r=="function"){let c;for(T(r)&&!h(r)?(s||(s=new Map),s.has(r)||s.set(r,r()),c=s.get(r)):c=r();typeof c=="function"&&!S(c)&&!h(c)&&!T(c);)s||(s=new Map),s.has(c)||s.set(c,c()),c=s.get(c);if(c==null||typeof c=="boolean")continue;if(typeof c=="function"){if(h(c)){if(f){let u=b("",!0);n.push(u),f.push({marker:u,sig:c});continue}let l=c();for(;typeof l=="function"&&h(l);)l=l();if(l==null||typeof l=="boolean")continue;Array.isArray(l)?m(l,n,t,o,a,s):m([l],n,t,o,a,s);continue}continue}Array.isArray(c)?m(c,n,t,o,a,s,f):m([c],n,t,o,a,s,f);continue}if(S(r)){let c=b("",!0);n.push(c),r.then(l=>{if(c.parentNode){let u=[];if(m([l],u,c.parentNode,void 0,!1,s),u.length>0){c.parentNode.replaceChild(u[0],c);for(let y=1;y<u.length;y++)c.parentNode?.insertBefore(u[y],u[y-1].nextSibling)}}}).catch(l=>console.error("Error resolving promise in array:",l));continue}if(Array.isArray(r)){m(r,n,t,o,a,s,f);continue}if(P(r)){n.push(r);continue}if(typeof r=="object"&&r!==null&&"type"in r&&"props"in r){let c=r;if(typeof c.type=="function"){let l=c.type(c.props||{});Array.isArray(l)?m(l,n,t,o,!1,s):m([l],n,t,o,!1,s);continue}}if(typeof r=="string"||typeof r=="number"){let c=String(r);if(c.trim()===""&&c!==" ")continue;n.push(b(c));continue}n.push(b(String(r)))}}}}function fe(e,n,t,o){for(let u=0;u<t.length;u++)t[u].parentNode!==null&&t[u].parentNode!==e&&(t=t.slice(),t[u]=t[u].cloneNode(!0));let a=t.length,s=n.length,f=a,i=0,r=0,c=s>0?n[s-1].nextSibling??void 0:o,l=null;for(;i<s||r<f;){if(n[i]===t[r]){i++,r++;continue}for(;s>i&&f>r&&n[s-1]===t[f-1];)s--,f--;if(s===i){let u=f<a?r?t[r-1].nextSibling??void 0:t[f-r]:c;for(;r<f;)d(e,t[r++],u)}else if(f===r)for(;i<s;)(!l||!l.has(n[i]))&&n[i].parentNode===e&&e.removeChild(n[i]),i++;else if(n[i]===t[f-1]&&t[r]===n[s-1]){let u=n[--s].nextSibling;d(e,t[r++],n[i++].nextSibling),d(e,t[--f],u),n[s]=n[i-1]}else{if(!l){l=new Map;let y=r;for(;y<f;)l.set(t[y],y++)}let u=l.get(n[i]);if(u!=null)if(r<u&&u<f){let y=i,C=1;for(;++y<s&&y<f&&!(!l.has(n[y])||l.get(n[y])!==u+C);)C++;if(C>u-r){let V=n[i];for(;r<u;)d(e,t[r++],V)}else n[i].parentNode===e?e.replaceChild(t[r++],n[i++]):(d(e,t[r++],c),i++)}else i++;else n[i].parentNode===e&&e.removeChild(n[i]),i++}}return t}function N(e,n,t){if(n)if(Array.isArray(n))for(let o=0;o<n.length;o++)n[o].parentNode===e&&e.removeChild(n[o]);else n.parentNode===e&&e.removeChild(n);return null}function d(e,n,t){p.active&&n.parentNode===e||(t&&t.parentNode===e?e.insertBefore(n,t):e.appendChild(n))}function W(e,n){if(e){if(P(e)){let t=n,o=e;if(!t)return;typeof t=="function"?t(o):typeof t=="object"&&"current"in t&&(t.current=o);return}typeof e=="function"?e(n):typeof e=="object"&&"current"in e&&(e.current=n)}}function S(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function le(e){let n=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,t,o;return ae(a=>{t=a,o=document.createElement("div"),o.style.display="contents",n().appendChild(o),L(o,e.children)&&W(e.ref,o)}),ce(()=>{t(),o.remove()}),null}import{createMemo as ue,createSignal as ye}from"@fluixi/reactive/signal";function K(e){if(E)return e.fallback??null;let n=p.active,[t,o]=ye(!n);return n&&queueMicrotask(()=>o(!0)),ue(()=>t()?e.children:e.fallback??null,void 0,{name:"client-only"})}var de=K;import{createMemo as pe,createSignal as he}from"@fluixi/reactive/signal";function me(e){let[n,t]=he(null),o=()=>t(null);return pe(()=>{let a=n();if(a!==null)return typeof e.fallback=="function"?e.fallback(a,o):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(s){return t(s),typeof e.fallback=="function"?e.fallback(s,o):e.fallback}})}import{createMemo as xe}from"@fluixi/reactive/signal";function ge(e){return xe(()=>{let n=typeof e=="function"?e():e,t=[];for(let[o,a]of Object.entries(n)){if(!o)continue;(typeof a=="function"?a():a)&&t.push(o)}return t.join(" ")})}import{createMemo as be}from"@fluixi/reactive/signal";function Te(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}function Ne(e){return be(()=>{let n=typeof e=="function"?e():e,t=[];for(let[o,a]of Object.entries(n)){if(!o)continue;let s=typeof a=="function"?a():a;s!=null&&t.push(`${Te(o)}: ${s}`)}return t.join("; ")})}export{K as ClientOnly,te as Dynamic,me as ErrorBoundary,X as For,Y as Index,Q as Match,de as NoSsr,le as Portal,B as Show,ee as Switch,ge as classMap,Fn as indexArray,jn as keyArray,Ln as mapArray,Ne as styleMap};
|
|
1
|
+
import{createChildOwner as q,createMemo as v,disposeScope as z,getOwner as G,runWithOwner as X,untrack as _}from"@fluixi/reactive/signal";function L(e){return typeof e=="function"?e:(()=>e)}function g(e){return()=>{let n=e();return typeof n=="function"?n():n}}function j(e){return e!=null&&e!==!1}function F(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function J(e){let n=g(()=>e.when),t=v(n,void 0),r=v(t,void 0),c=G(),s=null,f=null,i=o=>{o!==f&&(s&&z(s),s=q(c),f=o)};return v(()=>{let o=r();return i(o?"when":"fallback"),X(s,()=>{if(o){let a=e.children;return typeof a=="function"&&!F(a)?typeof t=="function"?_(()=>_(t)?a(t()):e.fallback):a(t):a}return e.fallback});return e.fallback??null},void 0,{name:"show"})}import{mapArray as Z,keyArray as Q}from"@fluixi/reactive/signal";var p={active:!1,cursor:null,parents:[]},Y=null;function $(){return Y}function M(e,n){return p.active&&n.parentNode===e}function k(e){let n=p.parents.lastIndexOf(e);n!==-1&&(p.parents.length=n),p.cursor=e.nextSibling}function A(e){if(!p.active||e==null)return;let n=Array.isArray(e)?e[e.length-1]:e;n&&typeof n.nodeType=="number"&&k(n)}function ee(e){let n=g(()=>e.each),t=()=>e.fallback??null,r=(c,s)=>{let f=e.children,i=Array.isArray(f)?f.map(o=>typeof o=="function"?o(c,s):o):typeof f=="function"?f(c,s):f;return A(i),i};return e.by?Q(n,e.by,(c,s)=>r(c,s),{fallback:t}):Z(n,(c,s)=>r(c,s),{fallback:t})}import{indexArray as ne}from"@fluixi/reactive/signal";function te(e){let n=g(()=>e.each);return ne(n,(t,r)=>{let c=e.children(t,r);return A(c),c},{fallback:()=>e.fallback??null})}import{mapArray as Vn,keyArray as Bn,indexArray as qn}from"@fluixi/reactive/signal";import{createMemo as oe,createChildOwner as re,disposeScope as ie,getOwner as se,runWithOwner as D}from"@fluixi/reactive/signal";var R=Symbol("match");function fe(e){return{[R]:!0,when:g(()=>e.when),get children(){return e.children}}}function ae(e){let n=Array.isArray(e.children)?e.children:[e.children],t=se(),r=null,c=-1,s=f=>{f!==c&&(r&&ie(r),r=re(t),c=f)};return oe(()=>{for(let f=0;f<n.length;f+=1){let o=n[f],a=0;for(;typeof o=="function"&&!o[R]&&a++<10;)o=o();if(!o||typeof o!="object"||o[R]!==!0)continue;let l=o.when();if(j(l))return s(f),D(r,()=>typeof o.children=="function"?o.children(l):o.children)}return s(-2),D(r,()=>e.fallback??null)})}import{createMemo as ce,createChildOwner as le,disposeScope as ue,getOwner as ye,runWithOwner as de}from"@fluixi/reactive/signal";function pe(e){let n=L(e.component),{component:t,...r}=e,c=ye(),s=null,f;return ce(()=>{let i=n();return i!==f&&(s&&ue(s),s=le(c),f=i),i==null?null:typeof i=="string"?{tag:i,props:r}:de(s,()=>i(r))})}import{createRoot as Te,onCleanup as Ne}from"@fluixi/reactive/signal";import{isSignal as h}from"@fluixi/reactive/signal";function T(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}import{batch as dn,createEffect as pn,createRenderEffect as he,createRoot as hn,onCleanup as me,readChildren as mn}from"@fluixi/reactive/signal";var E=typeof document>"u";var U=Symbol.for("fluixi.server-node"),H=null;function W(){if(!H)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return H}function w(e){return e!=null&&e[U]===!0?!0:typeof Node<"u"&&e instanceof Node}function I(e){return e!=null&&e[U]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}function b(e,n=!1){if(E)return W().createText(e);if(p.active&&!n){let t=$()?.hydrateText(e);if(t)return t}return document.createTextNode(e)}var x=0,xe=200;function ge(e,n,t,r,c){let s=r,f=new Map;return he(()=>{let i;if(T(e)&&!h(e)){if(!f.has(e)){x++;try{let o=e();f.set(e,o)}finally{x--}}for(i=f.get(e);typeof i=="function"&&h(i);)i=i()}else for(i=e();typeof i=="function"&&h(i);)i=i();{let o=0;for(;typeof i=="function"&&o++<50;)if(T(i)){if(!f.has(i)){let a=i;x++;try{let l=a();f.set(a,l)}finally{x--}}i=f.get(i)}else if(h(i))i=i();else if(i=i(),typeof i!="function"||!h(i)&&!T(i))break}x++;try{s=P(n,i,t,s,f),c(s)}finally{x--}})}function O(e,n,t,r){if(x>xe)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;t!==void 0&&!t&&(t=b("",!0),e.appendChild(t));let c=r??null,s=o=>Array.isArray(o)&&o.some(a=>typeof a=="function"),f=o=>typeof o=="function"?o:()=>o;if(typeof n!="function"&&!s(n)){x++;try{c=P(e,n,t,null)}finally{x--}return()=>c}let i=ge(f(n),e,t,c,o=>{c=o});return()=>(i?.(),c)}function P(e,n,t,r,c){if(n==null||typeof n=="boolean")return N(e,r,t);if(typeof n=="function")for(;typeof n=="function";)n=n();if(n==null||typeof n=="boolean")return N(e,r,t);if(S(n)){let f=b("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(f,r[0]),N(e,r.slice(1),t)):d(e,f,t):r?e.replaceChild(f,r):d(e,f,t),n.then(i=>{f.parentNode===e&&P(e,i,f.nextSibling,f)}).catch(i=>{console.error("Error resolving promise in insertExpression:",i)}),f}let s=typeof n;if(s==="string"||s==="number"){if(s==="number"&&(n=String(n)),Array.isArray(r)){if(r.length===0){let i=b(n);return d(e,i,t),i}if(r.length===1&&r[0].nodeType===3)return r[0].data=n,r;r=N(e,r,t)}if(r&&I(r))return r.data=n,r;let f=b(n);return r&&r.parentNode===e?e.replaceChild(f,r):M(e,f)||d(e,f,t),f}if(w(n))return M(e,n)?(k(n),n):Array.isArray(r)?(r.length===0?d(e,n,t):r[0].parentNode===e?(e.replaceChild(n,r[0]),N(e,r.slice(1),t)):d(e,n,t),n):(r?r!==n&&(r.parentNode===e?e.replaceChild(n,r):d(e,n,t)):d(e,n,t),n);if(Array.isArray(n)){let f=[],i=Array.isArray(r)?r:r?[r]:[],o=[];m(n,f,e,t,!0,c,o);let a=be(e,i,f,t);for(let l of o){let u=O(e,l.sig,l.marker);me(()=>{N(e,u()),l.marker.parentNode===e&&e.removeChild(l.marker)})}return a}if(s==="object"&&n!==null&&typeof n=="object"){let f=n;if("type"in f&&"props"in f){let i=f;if(typeof i.type=="function"){let o=i.type(i.props||{});return P(e,o,t,r)}}}return N(e,r,t)}function m(e,n,t,r,c=!0,s,f){for(let i=0;i<e.length;i++){let o=e[i];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!S(o)&&!h(o)&&!T(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let a;for(T(o)&&!h(o)?(s||(s=new Map),s.has(o)||s.set(o,o()),a=s.get(o)):a=o();typeof a=="function"&&!S(a)&&!h(a)&&!T(a);)s||(s=new Map),s.has(a)||s.set(a,a()),a=s.get(a);if(a==null||typeof a=="boolean")continue;if(typeof a=="function"){if(h(a)){if(f){let u=b("",!0);n.push(u),f.push({marker:u,sig:a});continue}let l=a();for(;typeof l=="function"&&h(l);)l=l();if(l==null||typeof l=="boolean")continue;Array.isArray(l)?m(l,n,t,r,c,s):m([l],n,t,r,c,s);continue}continue}Array.isArray(a)?m(a,n,t,r,c,s,f):m([a],n,t,r,c,s,f);continue}if(S(o)){let a=b("",!0);n.push(a),o.then(l=>{if(a.parentNode){let u=[];if(m([l],u,a.parentNode,void 0,!1,s),u.length>0){a.parentNode.replaceChild(u[0],a);for(let y=1;y<u.length;y++)a.parentNode?.insertBefore(u[y],u[y-1].nextSibling)}}}).catch(l=>console.error("Error resolving promise in array:",l));continue}if(Array.isArray(o)){m(o,n,t,r,c,s,f);continue}if(w(o)){n.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let a=o;if(typeof a.type=="function"){let l=a.type(a.props||{});Array.isArray(l)?m(l,n,t,r,!1,s):m([l],n,t,r,!1,s);continue}}if(typeof o=="string"||typeof o=="number"){let a=String(o);if(a.trim()===""&&a!==" ")continue;n.push(b(a));continue}n.push(b(String(o)))}}}}function be(e,n,t,r){for(let u=0;u<t.length;u++)t[u].parentNode!==null&&t[u].parentNode!==e&&(t=t.slice(),t[u]=t[u].cloneNode(!0));let c=t.length,s=n.length,f=c,i=0,o=0,a=s>0?n[s-1].nextSibling??void 0:r,l=null;for(;i<s||o<f;){if(n[i]===t[o]){i++,o++;continue}for(;s>i&&f>o&&n[s-1]===t[f-1];)s--,f--;if(s===i){let u=f<c?o?t[o-1].nextSibling??void 0:t[f-o]:a;for(;o<f;)d(e,t[o++],u)}else if(f===o)for(;i<s;)(!l||!l.has(n[i]))&&n[i].parentNode===e&&e.removeChild(n[i]),i++;else if(n[i]===t[f-1]&&t[o]===n[s-1]){let u=n[--s].nextSibling;d(e,t[o++],n[i++].nextSibling),d(e,t[--f],u),n[s]=n[i-1]}else{if(!l){l=new Map;let y=o;for(;y<f;)l.set(t[y],y++)}let u=l.get(n[i]);if(u!=null)if(o<u&&u<f){let y=i,C=1;for(;++y<s&&y<f&&!(!l.has(n[y])||l.get(n[y])!==u+C);)C++;if(C>u-o){let B=n[i];for(;o<u;)d(e,t[o++],B)}else n[i].parentNode===e?e.replaceChild(t[o++],n[i++]):(d(e,t[o++],a),i++)}else i++;else n[i].parentNode===e&&e.removeChild(n[i]),i++}}return t}function N(e,n,t){if(n)if(Array.isArray(n))for(let r=0;r<n.length;r++)n[r].parentNode===e&&e.removeChild(n[r]);else n.parentNode===e&&e.removeChild(n);return null}function d(e,n,t){p.active&&n.parentNode===e||(t&&t.parentNode===e?e.insertBefore(n,t):e.appendChild(n))}function K(e,n){if(e){if(w(e)){let t=n,r=e;if(!t)return;typeof t=="function"?t(r):typeof t=="object"&&"current"in t&&(t.current=r);return}typeof e=="function"?e(n):typeof e=="object"&&"current"in e&&(e.current=n)}}function S(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function Ae(e){let n=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,t,r;return Te(c=>{t=c,r=document.createElement("div"),r.style.display="contents",n().appendChild(r),O(r,e.children)&&K(e.ref,r)}),Ne(()=>{t(),r.remove()}),null}import{createMemo as Ee,createSignal as we}from"@fluixi/reactive/signal";function V(e){if(E)return e.fallback??null;let n=p.active,[t,r]=we(!n);return n&&queueMicrotask(()=>r(!0)),Ee(()=>t()?e.children:e.fallback??null,void 0,{name:"client-only"})}var Se=V;import{createMemo as Pe,createSignal as Ce}from"@fluixi/reactive/signal";function ve(e){let[n,t]=Ce(null),r=()=>t(null);return Pe(()=>{let c=n();if(c!==null)return typeof e.fallback=="function"?e.fallback(c,r):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(s){return t(s),typeof e.fallback=="function"?e.fallback(s,r):e.fallback}})}import{createMemo as Me}from"@fluixi/reactive/signal";function ke(e){return Me(()=>{let n=typeof e=="function"?e():e,t=[];for(let[r,c]of Object.entries(n)){if(!r)continue;(typeof c=="function"?c():c)&&t.push(r)}return t.join(" ")})}import{createMemo as Re}from"@fluixi/reactive/signal";function Oe(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}function Le(e){return Re(()=>{let n=typeof e=="function"?e():e,t=[];for(let[r,c]of Object.entries(n)){if(!r)continue;let s=typeof c=="function"?c():c;s!=null&&t.push(`${Oe(r)}: ${s}`)}return t.join("; ")})}export{V as ClientOnly,pe as Dynamic,ve as ErrorBoundary,ee as For,te as Index,fe as Match,Se as NoSsr,Ae as Portal,J as Show,ae as Switch,ke as classMap,qn as indexArray,Bn as keyArray,Vn as mapArray,Le as styleMap};
|
package/dist/lib/flow/show.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var l=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var w=(e,n)=>{for(var t in n)l(e,t,{get:n[t],enumerable:!0})},m=(e,n,t,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of h(n))!p.call(e,o)&&o!==t&&l(e,o,{get:()=>n[o],enumerable:!(a=y(n,o))||a.enumerable});return e};var A=e=>m(l({},"__esModule",{value:!0}),e);var k={};w(k,{Show:()=>b});module.exports=A(k);var r=require("@fluixi/reactive/signal");function u(e){return()=>{let n=e();return typeof n=="function"?n():n}}function T(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function b(e){let n=u(()=>e.when),t=(0,r.createMemo)(n,void 0),a=(0,r.createMemo)(t,void 0),o=(0,r.getOwner)(),c=null,f=null,d=i=>{i!==f&&(c&&(0,r.disposeScope)(c),c=(0,r.createChildOwner)(o),f=i)};return(0,r.createMemo)(()=>{let i=a();return d(i?"when":"fallback"),(0,r.runWithOwner)(c,()=>{if(i){let s=e.children;return typeof s=="function"&&!T(s)?typeof t=="function"?(0,r.untrack)(()=>(0,r.untrack)(t)?s(t()):e.fallback):s(t):s}return e.fallback});return e.fallback??null},void 0,{name:"show"})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../../src/lib/flow/show.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../../src/lib/flow/show.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAc,MAAM,yBAAyB,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,SAAS,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAGtG,MAAM,WAAW,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG;IACnC,yDAAyD;IACzD,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,CAAC;IACjD,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf;;;;;;OAMG;IACH,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;;;;;;;;;;;GAYG;AAcH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,CAgGhD"}
|
package/dist/lib/flow/show.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createMemo, untrack } from '@fluixi/reactive/signal';
|
|
1
|
+
import { createChildOwner, createMemo, disposeScope, getOwner, runWithOwner, untrack, } from '@fluixi/reactive/signal';
|
|
2
2
|
import { resolveReactiveProp, isLitResult } from './utils.js';
|
|
3
3
|
/**
|
|
4
4
|
* Conditionally renders content based on a reactive condition.
|
|
@@ -33,6 +33,25 @@ export function Show(props) {
|
|
|
33
33
|
// const {when} = props
|
|
34
34
|
const value = createMemo(when, undefined);
|
|
35
35
|
const cond = createMemo(value, undefined);
|
|
36
|
+
// Each branch renders in its own scope so that leaving it tears down whatever
|
|
37
|
+
// it registered — an event listener, an observer, a timer. Without this the
|
|
38
|
+
// branch's `onCleanup`s land on the enclosing owner and only run when the
|
|
39
|
+
// whole tree dies, so a closed <Show> kept listening and reacting.
|
|
40
|
+
//
|
|
41
|
+
// Keyed on which branch is showing, NOT on every re-run: the memo also re-runs
|
|
42
|
+
// when the value changes within the same branch, and disposing then would
|
|
43
|
+
// throw away DOM the runtime deliberately reuses.
|
|
44
|
+
const parentOwner = getOwner();
|
|
45
|
+
let branchScope = null;
|
|
46
|
+
let shown = null;
|
|
47
|
+
const enterBranch = (next) => {
|
|
48
|
+
if (next === shown)
|
|
49
|
+
return;
|
|
50
|
+
if (branchScope)
|
|
51
|
+
disposeScope(branchScope);
|
|
52
|
+
branchScope = createChildOwner(parentOwner);
|
|
53
|
+
shown = next;
|
|
54
|
+
};
|
|
36
55
|
return createMemo(() => {
|
|
37
56
|
// if (isResource(when)) {
|
|
38
57
|
// if (when.loading) {
|
|
@@ -41,22 +60,25 @@ export function Show(props) {
|
|
|
41
60
|
// }
|
|
42
61
|
// const value = when();
|
|
43
62
|
const evaluate = cond();
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
63
|
+
enterBranch(evaluate ? 'when' : 'fallback');
|
|
64
|
+
return runWithOwner(branchScope, () => {
|
|
65
|
+
if (evaluate) {
|
|
66
|
+
let children = props.children;
|
|
67
|
+
if (typeof children === 'function' && !isLitResult(children)) {
|
|
68
|
+
if (typeof value === 'function') {
|
|
69
|
+
// value = (value as any)() as any;
|
|
70
|
+
return untrack(() => {
|
|
71
|
+
if (!untrack(value))
|
|
72
|
+
return props.fallback;
|
|
73
|
+
return children(value());
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return children(value);
|
|
54
77
|
}
|
|
55
|
-
return children
|
|
78
|
+
return children;
|
|
56
79
|
}
|
|
57
|
-
return
|
|
58
|
-
}
|
|
59
|
-
return props.fallback;
|
|
80
|
+
return props.fallback;
|
|
81
|
+
});
|
|
60
82
|
// if (isTruthy(value)) {
|
|
61
83
|
// let children = props.children;
|
|
62
84
|
// // handle children on jsx
|
package/dist/lib/flow/show.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createMemo as
|
|
1
|
+
import{createChildOwner as y,createMemo as s,disposeScope as h,getOwner as p,runWithOwner as w,untrack as f}from"@fluixi/reactive/signal";function c(e){return()=>{let n=e();return typeof n=="function"?n():n}}function l(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function O(e){let n=c(()=>e.when),r=s(n,void 0),u=s(r,void 0),T=p(),i=null,a=null,d=t=>{t!==a&&(i&&h(i),i=y(T),a=t)};return s(()=>{let t=u();return d(t?"when":"fallback"),w(i,()=>{if(t){let o=e.children;return typeof o=="function"&&!l(o)?typeof r=="function"?f(()=>f(r)?o(r()):e.fallback):o(r):o}return e.fallback});return e.fallback??null},void 0,{name:"show"})}export{O as Show};
|
package/dist/lib/flow/switch.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var s=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var w=(e,n)=>{for(var l in n)s(e,l,{get:n[l],enumerable:!0})},b=(e,n,l,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of p(n))!A.call(e,o)&&o!==l&&s(e,o,{get:()=>n[o],enumerable:!(c=y(n,o))||c.enumerable});return e};var M=e=>b(s({},"__esModule",{value:!0}),e);var x={};w(x,{Match:()=>m,Switch:()=>N});module.exports=M(x);var t=require("@fluixi/reactive/signal");function h(e){return()=>{let n=e();return typeof n=="function"?n():n}}function d(e){return e!=null&&e!==!1}var a=Symbol("match");function m(e){return{[a]:!0,when:h(()=>e.when),get children(){return e.children}}}function N(e){let n=Array.isArray(e.children)?e.children:[e.children],l=(0,t.getOwner)(),c=null,o=-1,f=i=>{i!==o&&(c&&(0,t.disposeScope)(c),c=(0,t.createChildOwner)(l),o=i)};return(0,t.createMemo)(()=>{for(let i=0;i<n.length;i+=1){let r=n[i],T=0;for(;typeof r=="function"&&!r[a]&&T++<10;)r=r();if(!r||typeof r!="object"||r[a]!==!0)continue;let u=r.when();if(d(u))return f(i),(0,t.runWithOwner)(c,()=>typeof r.children=="function"?r.children(u):r.children)}return f(-2),(0,t.runWithOwner)(c,()=>e.fallback??null)})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/lib/flow/switch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/lib/flow/switch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkF,MAAM,yBAAyB,CAAC;AAInI,QAAA,MAAM,YAAY,eAAkB,CAAC;AAErC,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,4CAA4C;IAC5C,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,CAAC;IACjD;;;OAGG;IACH,QAAQ,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;CAChD;AAED,qEAAqE;AACrE,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,GAAG;IAChC,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC;IACrB,IAAI,EAAE,QAAQ,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,CAAC,CAAC;IAC7C,QAAQ,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;CAChD;AAED;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAc3D;AAED,MAAM,WAAW,WAAW;IAC1B,iDAAiD;IACjD,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf;;;;;OAKG;IACH,QAAQ,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,CA6CxD"}
|
package/dist/lib/flow/switch.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createMemo } from '@fluixi/reactive/signal';
|
|
1
|
+
import { createMemo, createChildOwner, disposeScope, getOwner, runWithOwner } from '@fluixi/reactive/signal';
|
|
2
2
|
import { resolveReactiveProp, isTruthy } from './utils.js';
|
|
3
3
|
// Internal marker used by Switch to identify Match nodes.
|
|
4
4
|
const MATCH_MARKER = Symbol('match');
|
|
@@ -18,7 +18,13 @@ export function Match(props) {
|
|
|
18
18
|
// Lazy read through the prop getter — Switch calls `branch.when()` inside its memo,
|
|
19
19
|
// so `when={cond()}` reacts; `when={cond}` unwraps via resolveReactiveProp.
|
|
20
20
|
when: resolveReactiveProp(() => props.when),
|
|
21
|
-
children
|
|
21
|
+
// Lazy, like `when`. Read eagerly, every branch's children were built the
|
|
22
|
+
// moment the Match node was — before Switch had chosen one — so they were
|
|
23
|
+
// created outside the branch's scope (and non-matching branches were built
|
|
24
|
+
// for nothing). Switch reads this inside the selected branch's scope.
|
|
25
|
+
get children() {
|
|
26
|
+
return props.children;
|
|
27
|
+
},
|
|
22
28
|
};
|
|
23
29
|
}
|
|
24
30
|
/**
|
|
@@ -44,8 +50,25 @@ export function Match(props) {
|
|
|
44
50
|
*/
|
|
45
51
|
export function Switch(props) {
|
|
46
52
|
const branches = Array.isArray(props.children) ? props.children : [props.children];
|
|
53
|
+
// Each branch renders in its own scope, disposed when a different branch takes
|
|
54
|
+
// over, so whatever it registered with `onCleanup` — a listener, an observer, a
|
|
55
|
+
// timer — goes with it. Keyed on which branch is showing, not on every re-run:
|
|
56
|
+
// the memo also re-runs when a `when` value changes within the same branch, and
|
|
57
|
+
// disposing then would throw away DOM the runtime deliberately reuses.
|
|
58
|
+
const parentOwner = getOwner();
|
|
59
|
+
let branchScope = null;
|
|
60
|
+
let shown = -1;
|
|
61
|
+
const enterBranch = (index) => {
|
|
62
|
+
if (index === shown)
|
|
63
|
+
return;
|
|
64
|
+
if (branchScope)
|
|
65
|
+
disposeScope(branchScope);
|
|
66
|
+
branchScope = createChildOwner(parentOwner);
|
|
67
|
+
shown = index;
|
|
68
|
+
};
|
|
47
69
|
return createMemo(() => {
|
|
48
|
-
for (
|
|
70
|
+
for (let i = 0; i < branches.length; i += 1) {
|
|
71
|
+
const raw = branches[i];
|
|
49
72
|
// The JSX compiler wraps <Match> in createMemo(createComponent(...)); unwrap
|
|
50
73
|
// those (and skip whitespace/other children) to reach the MatchNode. Direct
|
|
51
74
|
// Match({...}) results (lit syntax) pass through unchanged.
|
|
@@ -59,11 +82,12 @@ export function Switch(props) {
|
|
|
59
82
|
}
|
|
60
83
|
const value = branch.when();
|
|
61
84
|
if (isTruthy(value)) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
: branch.children;
|
|
85
|
+
enterBranch(i);
|
|
86
|
+
return runWithOwner(branchScope, () => typeof branch.children === 'function' ? branch.children(value) : branch.children);
|
|
65
87
|
}
|
|
66
88
|
}
|
|
67
|
-
|
|
89
|
+
// The fallback is a branch too, so it gets a scope of its own.
|
|
90
|
+
enterBranch(-2);
|
|
91
|
+
return runWithOwner(branchScope, () => props.fallback ?? null);
|
|
68
92
|
});
|
|
69
93
|
}
|
package/dist/lib/flow/switch.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createMemo as
|
|
1
|
+
import{createMemo as T,createChildOwner as y,disposeScope as p,getOwner as A,runWithOwner as u}from"@fluixi/reactive/signal";function a(e){return()=>{let t=e();return typeof t=="function"?t():t}}function f(e){return e!=null&&e!==!1}var o=Symbol("match");function x(e){return{[o]:!0,when:a(()=>e.when),get children(){return e.children}}}function R(e){let t=Array.isArray(e.children)?e.children:[e.children],h=A(),c=null,i=-1,l=r=>{r!==i&&(c&&p(c),c=y(h),i=r)};return T(()=>{for(let r=0;r<t.length;r+=1){let n=t[r],d=0;for(;typeof n=="function"&&!n[o]&&d++<10;)n=n();if(!n||typeof n!="object"||n[o]!==!0)continue;let s=n.when();if(f(s))return l(r),u(c,()=>typeof n.children=="function"?n.children(s):n.children)}return l(-2),u(c,()=>e.fallback??null)})}export{x as Match,R as Switch};
|
package/dist/lib/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Te=Object.defineProperty;var nn=Object.getOwnPropertyDescriptor;var rn=Object.getOwnPropertyNames;var on=Object.prototype.hasOwnProperty;var sn=(e,t)=>{for(var n in t)Te(e,n,{get:t[n],enumerable:!0})},an=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of rn(t))!on.call(e,o)&&o!==n&&Te(e,o,{get:()=>t[o],enumerable:!(r=nn(t,o))||r.enumerable});return e};var ln=e=>an(Te({},"__esModule",{value:!0}),e);var Vr={};sn(Vr,{ClientOnly:()=>We,Dynamic:()=>Ht,ErrorBoundary:()=>Wt,FX_DATA_ID:()=>q,For:()=>_t,Index:()=>$t,Island:()=>At,JSX_PROPERTIES:()=>Q,Match:()=>It,NoSsr:()=>Ut,Portal:()=>Vt,SVG_ELEMENTS:()=>yn,SVG_NAMESPACE:()=>D,Show:()=>Dt,Switch:()=>jt,VOID_ELEMENTS:()=>pn,addClass:()=>gn,addDelegatedEventListener:()=>Tt,addNativeEventListener:()=>Ce,appendChildren:()=>wn,applyElementProp:()=>Z,applyProps:()=>Le,applyUse:()=>Me,asComponent:()=>zn,asContext:()=>Bn,asOutlet:()=>Wn,asProvider:()=>Kn,asRoute:()=>Un,asRouter:()=>Hn,asRoutes:()=>Vn,asSuspense:()=>Gn,captureHydrationCursor:()=>mt,checkRenderType:()=>Xn,classMap:()=>Bt,cleanChildren:()=>w,cloneTemplate:()=>ir,closest:()=>hn,createComponent:()=>_e,createDynamicElement:()=>Pr,createElement:()=>vn,createNativeElement:()=>Re,createPortal:()=>yr,createRequestContext:()=>O,createTemplate:()=>or,delegate:()=>Pn,delegateEvents:()=>we,escapeFxJson:()=>G,escapeHTML:()=>hr,fnName:()=>sr,generateID:()=>Qn,getAttribute:()=>En,getGlobal:()=>Fn,getLitEventName:()=>fn,getLocals:()=>qe,getOffset:()=>Mn,getRequestContext:()=>S,getRequestEvent:()=>ae,getRequestLocals:()=>le,getServerData:()=>X,getStableElementId:()=>Zn,getStyle:()=>Sn,handleRef:()=>z,hasClass:()=>bn,html:()=>Rt,hydrate:()=>ue,hydrateAdvancePast:()=>_,hydrateIslands:()=>wt,indexArray:()=>I.indexArray,initializeIntegration:()=>br,insert:()=>N,insertExpression:()=>V,intergartionInitialized:()=>Er,isAccessor:()=>gr,isComponent:()=>b,isContext:()=>ut,isCustomElement:()=>nt,isDOMNode:()=>In,isDelegatedEvent:()=>nr,isDomElement:()=>ee,isDomNode:()=>P,isDomText:()=>te,isEventHandler:()=>un,isFunction:()=>rr,isIntegrationInitialized:()=>Nr,isJSXTemplate:()=>qn,isLitTemplateResult:()=>ot,isNativeElement:()=>mr,isOutlet:()=>lt,isPromise:()=>H,isProvider:()=>ct,isReactElement:()=>On,isRoute:()=>at,isRouter:()=>it,isRoutes:()=>st,isSVGElement:()=>ke,isServer:()=>m,isSuspense:()=>ft,isTemplateFactory:()=>$n,isVisible:()=>Rn,iterateFn:()=>ar,keyArray:()=>I.keyArray,makeArrayFlat:()=>bt,mapArray:()=>I.mapArray,mergeProps:()=>dr,observeIntersection:()=>kn,observeResize:()=>Dn,query:()=>be,queryAll:()=>mn,registerCreateComponent:()=>Tr,registerGlobal:()=>jn,removeAttribute:()=>Nn,removeChildren:()=>An,removeClass:()=>xn,removeDelegatedEventListener:()=>Ae,render:()=>De,renderToString:()=>Qe,renderToStringAsync:()=>tt,resetIntegration:()=>Sr,runHydrationAt:()=>ht,runWithRequestContext:()=>$,runWithoutHydration:()=>gt,scrollIntoView:()=>Cn,serializeNode:()=>E,serializeResourceData:()=>ge,setAttribute:()=>T,setClassList:()=>K,setClassName:()=>W,setDataRedactor:()=>et,setDynamicAttribute:()=>re,setDynamicBoolAttribute:()=>Pe,setDynamicProperty:()=>oe,setProperty:()=>U,setRequestStore:()=>$e,setServerMode:()=>M,setStyle:()=>B,setStyles:()=>rt,shouldSetAsProperty:()=>dn,splitProps:()=>pr,spread:()=>fr,styleMap:()=>Gt,svg:()=>Ct,toAttributeName:()=>cn,toggleClass:()=>Tn,waitForElement:()=>Ln});module.exports=ln(Vr);function cn(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function un(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function fn(e){return e.startsWith("@")?e.slice(1):e.startsWith("on")?e.slice(2).toLowerCase():e}function dn(e,t){let n=new Set(["checked","value","selected","disabled","readonly","required","multiple","open","contenteditable","draggable","spellcheck"]),r={input:new Set(["value","checked","indeterminate"]),textarea:new Set(["value"]),select:new Set(["value"]),option:new Set(["selected","value"]),audio:new Set(["volume","currentTime","paused"]),video:new Set(["volume","currentTime","paused"]),img:new Set(["src","srcset"]),iframe:new Set(["src"]),a:new Set(["href"])};return n.has(t)||r[e]&&r[e].has(t)}var pn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),yn=new Set(["svg","g","path","circle","rect","line","polyline","polygon","ellipse","text","tspan","use","defs","symbol","mask","clipPath","pattern","linearGradient","radialGradient","stop","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","foreignObject"]),D="http://www.w3.org/2000/svg";function nt(e){return e.localName.includes("-")}function Z(e,t,n,r=!1){if(n==null){e.removeAttribute(t);return}if(nt(e)){e[t]=n;return}T(e,t,n,r)}var Q=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function be(e,t=document){return t.querySelector(e)}function mn(e,t=document){return Array.from(t.querySelectorAll(e))}function hn(e,t){return e.closest(t)}function gn(e,...t){e.classList.add(...t)}function xn(e,...t){e.classList.remove(...t)}function Tn(e,...t){t.forEach(n=>e.classList.toggle(n))}function bn(e,t){return e.classList.contains(t)}function T(e,t,n,r=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}function En(e,t){return e.getAttribute(t)}function Nn(e,t){e.removeAttribute(t)}function rt(e,t){Object.assign(e.style,t)}function Sn(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function vn(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([o,i])=>{if(o==="class"||o==="className")r.className=i;else if(o==="style"&&typeof i=="object")rt(r,i);else if(o.startsWith("on")&&typeof i=="function"){let s=o.slice(2).toLowerCase();r.addEventListener(s,i)}else T(r,o,i)}),n.forEach(o=>{typeof o=="string"?r.appendChild(document.createTextNode(o)):r.appendChild(o)}),r}function An(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function wn(e,...t){t.forEach(n=>{typeof n=="string"?e.appendChild(document.createTextNode(n)):e.appendChild(n)})}function Rn(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function Cn(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function Mn(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function Pn(e,t,n,r){let o=i=>{let s=i.target.closest(n);s&&e.contains(s)&&r(i,s)};return e.addEventListener(t,o),()=>{e.removeEventListener(t,o)}}function Ln(e,t=5e3){return new Promise((n,r)=>{let o=be(e);if(o){n(o);return}let i=new MutationObserver(()=>{let a=be(e);a&&(i.disconnect(),clearTimeout(s),n(a))});i.observe(document.body,{childList:!0,subtree:!0});let s=setTimeout(()=>{i.disconnect(),r(new Error(`Element ${e} not found within ${t}ms`))},t)})}function kn(e,t,n={}){let r=new IntersectionObserver(o=>{o.forEach(i=>{t(i.isIntersecting)})},n);return r.observe(e),()=>{r.disconnect()}}function Dn(e,t){let n=new ResizeObserver(r=>{r.forEach(t)});return n.observe(e),()=>{n.disconnect()}}var _n=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function On(e){return typeof e=="object"&&e!==null&&e.$$typeof===_n}function ot(e){return e&&typeof e=="object"&&e.strings&&Array.isArray(e.strings)&&e.values&&Array.isArray(e.values)}function $n(e){if(typeof e!="function")return!1;try{let t=e();return ot(t)}catch{return!1}}function qn(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function In(e){return e instanceof Node}function jn(e,t,n="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[n]>"u"&&(globalThis[n]={}),typeof globalThis[n][e]>"u"&&(globalThis[n][e]=t))}function Fn(e,t,n="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[n]<"u"&&typeof globalThis[n][e]<"u"?globalThis[n][e]:t}var h=require("@fluixi/reactive/signal");function Hn(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function Vn(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function Un(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function Wn(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function Kn(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function Bn(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function zn(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function Gn(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function it(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function st(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function at(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function lt(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function ct(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function ut(e){return typeof e=="function"&&e[Symbol.for("fluixi-context")]===!0}function b(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function ft(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function Xn(e){return it(e)?{type:"router",value:e}:at(e)?{type:"route",value:e}:st(e)?{type:"routes",value:e}:lt(e)?{type:"outlet",value:e}:b(e)?{type:"component",value:e}:ft(e)?{type:"suspense",value:e}:ct(e)?{type:"provider",value:e}:ut(e)?{type:"context",value:e}:{type:"none",value:e}}var d=require("@fluixi/reactive/signal");var m=typeof document>"u";function M(e){m=e}var j=Symbol.for("fluixi.server-node"),Ee=null;function dt(e){Ee=e}function F(){if(!Ee)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Ee}function P(e){return e!=null&&e[j]===!0?!0:typeof Node<"u"&&e instanceof Node}function ee(e){return e!=null&&e[j]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function te(e){return e!=null&&e[j]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var u={active:!1,cursor:null,parents:[]},pt=null;function yt(e){pt=e}function Ne(){return pt}function Se(e,t){return u.active&&t.parentNode===e}function ve(e){let t=u.parents.lastIndexOf(e);t!==-1&&(u.parents.length=t),u.cursor=e.nextSibling}function mt(){return u.active?u.cursor:null}function ht(e,t){if(!e||e.parentNode==null)return t();let n=u.active,r=u.cursor,o=u.parents;u.active=!0,u.cursor=e,u.parents=[];try{return t()}finally{u.active=n,u.cursor=r,u.parents=o}}function gt(e){if(!u.active)return e();let t=u.cursor,n=u.parents;u.active=!1,u.parents=[];try{return e()}finally{u.active=!0,u.cursor=t,u.parents=n}}function _(e){if(!u.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&ve(t)}function Jn(e){let t=[];for(;e&&e.nodeType===1;){let n=e.tagName.toLowerCase();if(e.id){n+=`#${e.id}`,t.unshift(n);break}e.getAttribute("data-id")&&(n+=`[data-id="${e.getAttribute("data-id")}"]`);let r=0,o=e;for(;o=o.previousElementSibling;)o.tagName===e.tagName&&r++;n+=`:nth-of-type(${r+1})`,t.unshift(n),e=e.parentElement}return t.join(">")}function Yn(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return`el_${Math.abs(t)}`}function Zn(e){return Yn(Jn(e))}var Qn=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),er={};var xt=new Map,ne=new Set,ie=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function we(e){if(!m)for(let t of e)ne.has(t)||ie.has(t)||(ne.add(t),document.addEventListener(t,tr))}function tr(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let r=n[t];if(r&&!n.disabled&&(r(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function Tt(e,t,n){if(e[`$$${t}`]=n,ie.has(t)){let r=`__fx_${t}`;if(!e[r]){let o=i=>{e[`$$${t}`]?.(i)};e.addEventListener(t,o),e[r]=o}return}ne.has(t)||we([t])}function Ae(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function nr(e){return!ie.has(e)}function rr(e){return typeof e=="function"}function R(e,t=!1){if(m)return F().createText(e);if(u.active&&!t){let n=Ne()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}function Re(e,t=!1){if(m)return F().createElement(e,t);if(u.active){let n=Ne()?.hydrateElement(e);if(n)return n}return t?document.createElementNS(D,e):document.createElement(e)}function or(e,t=!1){let n=xt.get(e);if(n)return n;let r=document.createElement("template");return t?r.innerHTML=`<svg>${e}</svg>`:r.innerHTML=e,xt.set(e,r),r}function ir(e,t=!1){let n=e.content.cloneNode(!0);return t?n.firstChild:n}function bt(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?bt(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function sr(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function ar(e){if((0,h.isSignal)(e)||b(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!(0,h.isSignal)(t)&&!b(t);)t=t();return t}var A=0,lr=200;function cr(e,t,n,r,o){let i=r,s=new Map;return(0,d.createRenderEffect)(()=>{let a;if(b(e)&&!(0,h.isSignal)(e)){if(!s.has(e)){A++;try{let l=e();s.set(e,l)}finally{A--}}for(a=s.get(e);typeof a=="function"&&(0,h.isSignal)(a);)a=a()}else for(a=e();typeof a=="function"&&(0,h.isSignal)(a);)a=a();{let l=0;for(;typeof a=="function"&&l++<50;)if(b(a)){if(!s.has(a)){let c=a;A++;try{let f=c();s.set(c,f)}finally{A--}}a=s.get(a)}else if((0,h.isSignal)(a))a=a();else if(a=a(),typeof a!="function"||!(0,h.isSignal)(a)&&!b(a))break}A++;try{i=V(t,a,n,i,s),o(i)}finally{A--}})}function N(e,t,n,r){if(A>lr)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=R("",!0),e.appendChild(n));let o=r??null,i=l=>Array.isArray(l)&&l.some(c=>typeof c=="function"),s=l=>typeof l=="function"?l:()=>l;if(typeof t!="function"&&!i(t)){A++;try{o=V(e,t,n,null)}finally{A--}return()=>o}let a=cr(s(t),e,n,o,l=>{o=l});return()=>(a?.(),o)}function V(e,t,n,r,o){if(t==null||typeof t=="boolean")return w(e,r,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return w(e,r,n);if(H(t)){let s=R("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(s,r[0]),w(e,r.slice(1),n)):g(e,s,n):r?e.replaceChild(s,r):g(e,s,n),t.then(a=>{s.parentNode===e&&V(e,a,s.nextSibling,s)}).catch(a=>{console.error("Error resolving promise in insertExpression:",a)}),s}let i=typeof t;if(i==="string"||i==="number"){if(i==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let a=R(t);return g(e,a,n),a}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=w(e,r,n)}if(r&&te(r))return r.data=t,r;let s=R(t);return r&&r.parentNode===e?e.replaceChild(s,r):Se(e,s)||g(e,s,n),s}if(P(t))return Se(e,t)?(ve(t),t):Array.isArray(r)?(r.length===0?g(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),w(e,r.slice(1),n)):g(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):g(e,t,n)):g(e,t,n),t);if(Array.isArray(t)){let s=[],a=Array.isArray(r)?r:r?[r]:[],l=[];v(t,s,e,n,!0,o,l);let c=ur(e,a,s,n);for(let f of l){let p=N(e,f.sig,f.marker);(0,d.onCleanup)(()=>{w(e,p()),f.marker.parentNode===e&&e.removeChild(f.marker)})}return c}if(i==="object"&&t!==null&&typeof t=="object"){let s=t;if("type"in s&&"props"in s){let a=s;if(typeof a.type=="function"){let l=a.type(a.props||{});return V(e,l,n,r)}}}return w(e,r,n)}function v(e,t,n,r,o=!0,i,s){for(let a=0;a<e.length;a++){let l=e[a];if(!(l==null||typeof l=="boolean")){for(;typeof l=="function"&&!H(l)&&!(0,h.isSignal)(l)&&!b(l)&&(l=l(),!(l==null||typeof l=="boolean")););if(!(l==null||typeof l=="boolean")){if(typeof l=="function"){let c;for(b(l)&&!(0,h.isSignal)(l)?(i||(i=new Map),i.has(l)||i.set(l,l()),c=i.get(l)):c=l();typeof c=="function"&&!H(c)&&!(0,h.isSignal)(c)&&!b(c);)i||(i=new Map),i.has(c)||i.set(c,c()),c=i.get(c);if(c==null||typeof c=="boolean")continue;if(typeof c=="function"){if((0,h.isSignal)(c)){if(s){let p=R("",!0);t.push(p),s.push({marker:p,sig:c});continue}let f=c();for(;typeof f=="function"&&(0,h.isSignal)(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?v(f,t,n,r,o,i):v([f],t,n,r,o,i);continue}continue}Array.isArray(c)?v(c,t,n,r,o,i,s):v([c],t,n,r,o,i,s);continue}if(H(l)){let c=R("",!0);t.push(c),l.then(f=>{if(c.parentNode){let p=[];if(v([f],p,c.parentNode,void 0,!1,i),p.length>0){c.parentNode.replaceChild(p[0],c);for(let y=1;y<p.length;y++)c.parentNode?.insertBefore(p[y],p[y-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(l)){v(l,t,n,r,o,i,s);continue}if(P(l)){t.push(l);continue}if(typeof l=="object"&&l!==null&&"type"in l&&"props"in l){let c=l;if(typeof c.type=="function"){let f=c.type(c.props||{});Array.isArray(f)?v(f,t,n,r,!1,i):v([f],t,n,r,!1,i);continue}}if(typeof l=="string"||typeof l=="number"){let c=String(l);if(c.trim()===""&&c!==" ")continue;t.push(R(c));continue}t.push(R(String(l)))}}}}function ur(e,t,n,r){for(let p=0;p<n.length;p++)n[p].parentNode!==null&&n[p].parentNode!==e&&(n=n.slice(),n[p]=n[p].cloneNode(!0));let o=n.length,i=t.length,s=o,a=0,l=0,c=i>0?t[i-1].nextSibling??void 0:r,f=null;for(;a<i||l<s;){if(t[a]===n[l]){a++,l++;continue}for(;i>a&&s>l&&t[i-1]===n[s-1];)i--,s--;if(i===a){let p=s<o?l?n[l-1].nextSibling??void 0:n[s-l]:c;for(;l<s;)g(e,n[l++],p)}else if(s===l)for(;a<i;)(!f||!f.has(t[a]))&&t[a].parentNode===e&&e.removeChild(t[a]),a++;else if(t[a]===n[s-1]&&n[l]===t[i-1]){let p=t[--i].nextSibling;g(e,n[l++],t[a++].nextSibling),g(e,n[--s],p),t[i]=t[a-1]}else{if(!f){f=new Map;let y=l;for(;y<s;)f.set(n[y],y++)}let p=f.get(t[a]);if(p!=null)if(l<p&&p<s){let y=a,xe=1;for(;++y<i&&y<s&&!(!f.has(t[y])||f.get(t[y])!==p+xe);)xe++;if(xe>p-l){let tn=t[a];for(;l<p;)g(e,n[l++],tn)}else t[a].parentNode===e?e.replaceChild(n[l++],t[a++]):(g(e,n[l++],c),a++)}else a++;else t[a].parentNode===e&&e.removeChild(t[a]),a++}}return n}function w(e,t,n){if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r].parentNode===e&&e.removeChild(t[r]);else t.parentNode===e&&e.removeChild(t);return null}function g(e,t,n){u.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function U(e,t,n){n==null?delete e[t]:e[t]=n}function Ce(e,t,n){let r=n,o;return Array.isArray(n)&&(r=n[0],o=n[1]),typeof r!="function"?()=>{}:(e.addEventListener(t,r,o),()=>e.removeEventListener(t,r,o))}function Me(e,t){let n=(r,o)=>{typeof r=="function"&&r(e,o??(()=>{}))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let r of t)Array.isArray(r)?n(r[0],r[1]):n(r)}}function re(e,t,n,r=!1){return typeof n!="function"?(T(e,t,n,r),()=>{}):(0,d.createRenderEffect)(()=>{let o=typeof n=="function"?n():n;T(e,t,o,r)})}function oe(e,t,n){return typeof n!="function"?(U(e,t,n),()=>{}):(0,d.createRenderEffect)(()=>{let r=typeof n=="function"?n():n;U(e,t,r)})}function Pe(e,t,n){return typeof n!="function"?(T(e,t,!!n),()=>{}):(0,d.createRenderEffect)(()=>{let r=n();T(e,t,!!r)})}function W(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){(0,d.createRenderEffect)(()=>W(e,t()));return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(r=>{let o=t[r];return typeof o=="function"?o():!!o}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function K(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let o=t[r],i=r.split(/\s+/).filter(Boolean);if(typeof o=="function"&&n)n.push((0,d.createRenderEffect)(()=>{let s=!!o();for(let a of i)e.classList.toggle(a,s)}));else{let s=!!(typeof o=="function"?o():o);for(let a of i)e.classList.toggle(a,s)}}}function B(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let r in n){let o=n[r];o==null?e.style[r]="":e.style[r]=o}}function fr(e){let{element:t,props:n,prevProps:r=er,isSVG:o=!1,skipChildren:i=!1}=e;if(!t||!ee(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let s=o||t.namespaceURI===D,a=[];for(let l in n){if(i&&l==="children")continue;let c=n[l],f=r[l];if(c===f)continue;if(l==="ref"){z(c,t);continue}if(l==="use"){Me(t,c);continue}if(l.startsWith("on:")){a.push(Ce(t,l.slice(3),c));continue}if(l.startsWith("prop:")){a.push(oe(t,l.slice(5),c));continue}if(l.startsWith("attr:")){a.push(re(t,l.slice(5),c,s));continue}if(l.startsWith("bool:")){a.push(Pe(t,l.slice(5),c));continue}if(l==="class"||l==="className"){typeof c=="function"?a.push((0,d.createRenderEffect)(()=>W(t,c()))):W(t,c);continue}if(l==="classList"){typeof c=="function"?a.push((0,d.createRenderEffect)(()=>K(t,c()))):K(t,c,a);continue}if(l==="style"){typeof c=="function"?a.push((0,d.createRenderEffect)(()=>B(t,c()))):B(t,c);continue}if(l.startsWith("on")){let y=l.slice(2).toLowerCase();f&&Ae(t,y),c&&Tt(t,y,c);continue}let p=Q.has(l)||!s&&l in t;typeof c=="function"?a.push(p?oe(t,l,c):re(t,l,c,s)):a.push((0,d.createRenderEffect)(()=>p?U(t,l,n[l]):T(t,l,n[l],s)))}for(let l in r)if(!(l in n))if(l.startsWith("on")){let c=l.slice(2).toLowerCase();Ae(t,c)}else Q.has(l)?U(t,l,null):t.removeAttribute(l);return()=>{a.forEach(l=>l())}}function Le(e,t,n=!1){for(let r in t){let o=t[r];if(r==="ref"){z(o,e);continue}if(r!=="children"){if(r==="use"){Me(e,o);continue}if(r.startsWith("on:")){Ce(e,r.slice(3),o);continue}if(r.startsWith("prop:")){oe(e,r.slice(5),o);continue}if(r.startsWith("attr:")){re(e,r.slice(5),o,n);continue}if(r.startsWith("bool:")){Pe(e,r.slice(5),o);continue}if(r.startsWith("on")&&r.length>2){let i=r.slice(2).toLowerCase();if(typeof o=="function")if(ie.has(i)){e[`$$${i}`]=o;let s=`__fx_${i}`;if(!e[s]){let a=l=>{e[`$$${i}`]?.(l)};e.addEventListener(i,a),e[s]=a}}else e[`$$${i}`]=o,ne.has(i)||we([i]);continue}if(r==="class"||r==="className"){W(e,o);continue}if(r==="classList"){typeof o=="function"?(0,d.createRenderEffect)(()=>K(e,o())):K(e,o);continue}if(r==="style"){typeof o=="function"?(0,d.createRenderEffect)(()=>B(e,o())):B(e,o);continue}if(r==="innerHTML"){if(typeof o=="function"){let i=(0,d.createEffect)(()=>{let s=o();for(;typeof s=="function";)s=s();e.innerHTML=s});(0,d.onCleanup)(()=>i())}else e.innerHTML=o;continue}if(r==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof o=="function"){let i=(0,d.createEffect)(()=>{let s=o();for(;typeof s=="function"&&s.length===0;)s=s();document.activeElement!==e&&(e.value=s??"")});(0,d.onCleanup)(()=>{i()})}else(0,d.createRenderEffect)(()=>{document.activeElement!==e&&(e.value=t[r]??"")});continue}if(r==="checked"&&e.tagName==="INPUT"){if(typeof o=="function"){let i=(0,d.createEffect)(()=>{let s=o();for(;typeof s=="function"&&s.length===0;)s=s();document.activeElement!==e&&(e.checked=s??"")});(0,d.onCleanup)(()=>{i()})}else(0,d.createRenderEffect)(()=>{document.activeElement!==e&&(e.checked=t[r]??"")});continue}if(r==="value"&&e.tagName==="SELECT"){if(typeof o=="function"){let i=!0,s=(0,d.createEffect)(()=>{let a=o();for(;typeof a=="function"&&a.length===0;)a=a();i?(i=!1,queueMicrotask(()=>{e.value=a??""})):e.value=a??""});(0,d.onCleanup)(()=>{s()})}else{let i=!0;(0,d.createRenderEffect)(()=>{let s=t[r];i?(i=!1,queueMicrotask(()=>{e.value=s??""})):e.value=s??""})}continue}if(typeof o=="function"){let i=(0,d.createEffect)(()=>{let s=o();for(;typeof s=="function"&&s.length===0;)s=s();Z(e,r,s,n)});(0,d.onCleanup)(()=>{i()})}else(0,d.createRenderEffect)(()=>Z(e,r,t[r],n))}}}function dr(...e){let t=r=>{for(let o=e.length-1;o>=0;o--){let i=e[o];if(i&&r in i&&i[r]!==void 0)return i[r]}},n=r=>{for(let o of e)if(o&&r in o)return!0;return!1};return new Proxy({},{get:(r,o)=>t(o),has:(r,o)=>n(o),ownKeys:()=>{let r=new Set;for(let o of e)if(o)for(let i of Reflect.ownKeys(o))r.add(i);return[...r]},getOwnPropertyDescriptor:(r,o)=>n(o)?{enumerable:!0,configurable:!0,get:()=>t(o)}:void 0})}function pr(e,...t){let n=new Set;for(let s of t)for(let a of s)n.add(a);let r=s=>({enumerable:!0,configurable:!0,get:()=>e[s]}),o=t.map(s=>{let a=new Set(s);return new Proxy({},{get:(l,c)=>a.has(c)?e[c]:void 0,has:(l,c)=>a.has(c)&&c in e,ownKeys:()=>Array.from(a).filter(l=>l in e),getOwnPropertyDescriptor:(l,c)=>a.has(c)&&c in e?r(c):void 0})}),i=new Proxy({},{get:(s,a)=>n.has(a)?void 0:e[a],has:(s,a)=>!n.has(a)&&a in e,ownKeys:()=>Reflect.ownKeys(e).filter(s=>!n.has(s)),getOwnPropertyDescriptor:(s,a)=>!n.has(a)&&a in e?r(a):void 0});return[...o,i]}function z(e,t){if(e){if(P(e)){let n=t,r=e;if(!n)return;typeof n=="function"?n(r):typeof n=="object"&&"current"in n&&(n.current=r);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}}function yr(e,t,n){let r=t||document.body,o=(0,d.readChildren)(()=>e),i=[];return(0,d.batch)(()=>{let s=(0,d.createRenderEffect)(()=>{let a=o();Array.isArray(a)?(a.forEach(l=>r.appendChild(l)),i.push(()=>{a.forEach(l=>{l.parentNode===r&&r.removeChild(l)})})):P(a)&&(r.appendChild(a),i.push(()=>{a.parentNode===r&&r.removeChild(a)}))});i.push(s),(0,d.onCleanup)(()=>{i.forEach(a=>a())})}),null}function mr(e){return typeof e=="string"&&e.toLowerCase()===e}function ke(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="polygon"||e==="polyline"||e==="ellipse"||e==="g"||e==="defs"||e==="clipPath"||e==="text"}function hr(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function H(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function gr(e){return typeof e=="function"&&e.length===0&&(0,h.isSignal)(e)}function De(e,t,n){if(!t)throw new Error("Container element is required");let r,o,i=[];return(0,d.createRoot)(s=>{(0,d.batch)(()=>{u.active||(t.textContent=""),N(t,e)}),o=s}),()=>{o?.(),r?.(),i.forEach(s=>s()),t.textContent=""}}var xr="__fx_dom_create_component__",L=globalThis[xr]??={fn:null};function Tr(e){L.fn=e}function br(e={}){let t=e.signalSystem?.createComponent;t&&(L.fn=t)}function _e(e,t){return L.fn?L.fn(e,t):(()=>e(t))}var Er=()=>L.fn!==null,Nr=()=>L.fn!==null;function Sr(){L.fn=null}var se,Nt={getStore:()=>se,run(e,t){let n=se;se=e;try{return t()}finally{se=n}}},Oe=Nt;function $e(e){Oe=e??Nt}function O(e={}){e.locals||(e.locals=e.request?le(e.request):{});let t=0,n=0,r=null,o=new Map,i=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${t++}`,nextResourceId:()=>{if(r===null)return`r${n++}`;let s=o.get(r)??0;return o.set(r,s+1),`${r}:r${s}`},nextIslandNamespace:s=>{let a=i.get(s)??0;return i.set(s,a+1),`${s}#${a}`},withResourceScope(s,a){let l=r;r=s;try{return a()}finally{r=l}},pending:new Set,data:new Map}}function $(e,t){return Oe.run(e,t)}function S(){return Oe.getStore()}function ae(){return S()?.event}function qe(){let e=ae();return e?(e.locals||(e.locals={}),e.locals):{}}var Et=new WeakMap;function le(e){let t=Et.get(e);return t||(t={},Et.set(e,t)),t}var ce=require("@fluixi/reactive/signal");var q="__FX_DATA__";function G(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var Ie;function X(){let e=globalThis.__FX_DATA__;if(e)return e;if(Ie!==void 0)return Ie;let t=null;if(typeof document<"u"){let n=document.getElementById(q)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return Ie=t}function je(){for(;;){for(;u.cursor&&u.cursor.nodeType===3&&u.cursor.data==="";)u.cursor=u.cursor.nextSibling;if(u.cursor!=null||!u.parents.length)return;u.cursor=u.parents.pop().nextSibling}}var vr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Fe=typeof process<"u"&&process.env&&!1;function He(e,t){let n=t.nodeType===1?`<${t.tagName.toLowerCase()}>`:t.nodeType===3?`text ${JSON.stringify((t.nodeValue??"").slice(0,24))}`:t.nodeType===8?"comment":"node";console.warn(`[fluixi] hydration mismatch: expected ${e} but the server DOM has ${n}. Server and client rendered different markup; recreating this node on the client. Check for non-deterministic render (Date.now(), Math.random(), browser-only branches, untransported data).`)}function Ar(e){je();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(vr.has(e.toLowerCase())?u.cursor=t.nextSibling:(u.parents.push(t),u.cursor=t.firstChild),t):(Fe&&t&&He(`<${e}>`,t),null)}function wr(e){if(e===""){let n=u.cursor;return n&&n.nodeType===3&&n.data!==""?(u.cursor=n.nextSibling,n.data="",n):null}je();let t=u.cursor;return t&&t.nodeType===3?(u.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(Fe&&t&&He(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function Rr(e){je();let t=u.cursor;return t&&t.nodeType===8&&t.data===e?(u.cursor=t.nextSibling,t):(Fe&&t&&He(`marker <!--${e.slice(0,24)}-->`,t),null)}var St=!1;function Cr(){St||(St=!0,yt({hydrateElement:Ar,hydrateText:wr,hydrateMarker:Rr}))}function ue(e,t,n){Cr(),u.active=!0,u.cursor=t.firstChild,u.parents=[];let r=X(),o=n?.resourceNamespace,i=0;(0,ce.setResourceIdSource)(()=>o?`${o}:r${i++}`:`r${i++}`),(0,ce.setServerDataGetter)(r?s=>s in r?{value:r[s]}:void 0:null);try{return De(e,t)}finally{u.active=!1,u.cursor=null,u.parents=[]}}var Ve="fluixi-island";function At(e){let{component:t,props:n={},name:r}=e,o=Re(Ve),i=r??t.name??"Island";T(o,"name",i),T(o,"props",JSON.stringify(n??{}));let s=m?S():void 0;if(s){let a=s.nextIslandNamespace(i);N(o,()=>s.withResourceScope(a,()=>t(n)))}else N(o,()=>t(n));return o}var vt=!1;function Mr(){if(vt||typeof document>"u")return;vt=!0;let e=document.createElement("style");e.textContent=`${Ve}{display:contents}`,document.head.appendChild(e)}function wt(e){if(typeof document>"u")return;Mr();let t=document.querySelectorAll(Ve),n=new Map;t.forEach(r=>{let o=r.getAttribute("name")??"",i=n.get(o)??0;n.set(o,i+1);let s=e[o];if(!s){typeof process>"u"&&console.warn(`[fluixi] island "${o}" has no component in the registry — left static.`);return}let a={};try{a=JSON.parse(r.getAttribute("props")||"{}")}catch{}ue(()=>s(a),r,{resourceNamespace:`${o}#${i}`})})}function Rt(e,...t){throw new Error("html`` was not compiled — enable the lit format: fluixi({ format: 'lit' }).")}function Ct(e,...t){throw new Error("svg`` was not compiled — enable the lit format: fluixi({ format: 'lit' }).")}var Mt=require("@fluixi/reactive/signal");function Pr(e,t={}){if(typeof e=="function")return _e(e,t);if(typeof e!="string"||e.length===0)return null;let n=ke(e);if(m)return F().createElement(e,n);let r=n?document.createElementNS(D,e):document.createElement(e);return Le(r,t,n),Lr(r,t),r}function Lr(e,t){if(!t||t.children===void 0)return;let n=(0,Mt.readChildren)(()=>t.children),r=o=>{N(e,o,typeof o=="function"?null:void 0)};Array.isArray(n)?n.forEach(r):r(n)}var k=require("@fluixi/reactive/signal");function Pt(e){return typeof e=="function"?e:(()=>e)}function C(e){return()=>{let t=e();return typeof t=="function"?t():t}}function Lt(e){return e!=null&&e!==!1}function kt(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function Dt(e){let t=C(()=>e.when),n=(0,k.createMemo)(t,void 0),r=(0,k.createMemo)(n,void 0);return(0,k.createMemo)(()=>{if(r()){let i=e.children;return typeof i=="function"&&!kt(i)?typeof n=="function"?(0,k.untrack)(()=>(0,k.untrack)(n)?i(n()):e.fallback):i(n):i}return e.fallback},void 0,{name:"show"})}var fe=require("@fluixi/reactive/signal");function _t(e){let t=C(()=>e.each),n=()=>e.fallback??null,r=(o,i)=>{let s=e.children,a=Array.isArray(s)?s.map(l=>typeof l=="function"?l(o,i):l):typeof s=="function"?s(o,i):s;return _(a),a};return e.by?(0,fe.keyArray)(t,e.by,(o,i)=>r(o,i),{fallback:n}):(0,fe.mapArray)(t,(o,i)=>r(o,i),{fallback:n})}var Ot=require("@fluixi/reactive/signal");function $t(e){let t=C(()=>e.each);return(0,Ot.indexArray)(t,(n,r)=>{let o=e.children(n,r);return _(o),o},{fallback:()=>e.fallback??null})}var I=require("@fluixi/reactive/signal");var qt=require("@fluixi/reactive/signal");var Ue=Symbol("match");function It(e){return{[Ue]:!0,when:C(()=>e.when),children:e.children}}function jt(e){let t=Array.isArray(e.children)?e.children:[e.children];return(0,qt.createMemo)(()=>{for(let n of t){let r=n,o=0;for(;typeof r=="function"&&!r[Ue]&&o++<10;)r=r();if(!r||typeof r!="object"||r[Ue]!==!0)continue;let i=r.when();if(Lt(i))return typeof r.children=="function"?r.children(i):r.children}return e.fallback??null})}var Ft=require("@fluixi/reactive/signal");function Ht(e){let t=Pt(e.component),{component:n,...r}=e;return(0,Ft.createMemo)(()=>{let o=t();return o==null?null:typeof o=="string"?{tag:o,props:r}:o(r)})}var de=require("@fluixi/reactive/signal");function Vt(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return(0,de.createRoot)(o=>{n=o,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),N(r,e.children)&&z(e.ref,r)}),(0,de.onCleanup)(()=>{n(),r.remove()}),null}var pe=require("@fluixi/reactive/signal");function We(e){if(m)return e.fallback??null;let t=u.active,[n,r]=(0,pe.createSignal)(!t);return t&&queueMicrotask(()=>r(!0)),(0,pe.createMemo)(()=>n()?e.children:e.fallback??null,void 0,{name:"client-only"})}var Ut=We;var ye=require("@fluixi/reactive/signal");function Wt(e){let[t,n]=(0,ye.createSignal)(null),r=()=>n(null);return(0,ye.createMemo)(()=>{let o=t();if(o!==null)return typeof e.fallback=="function"?e.fallback(o,r):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(i){return n(i),typeof e.fallback=="function"?e.fallback(i,r):e.fallback}})}var Kt=require("@fluixi/reactive/signal");function Bt(e){return(0,Kt.createMemo)(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,o]of Object.entries(t)){if(!r)continue;(typeof o=="function"?o():o)&&n.push(r)}return n.join(" ")})}var zt=require("@fluixi/reactive/signal");function kr(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Gt(e){return(0,zt.createMemo)(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,o]of Object.entries(t)){if(!r)continue;let i=typeof o=="function"?o():o;i!=null&&n.push(`${kr(r)}: ${i}`)}return n.join("; ")})}var ze=1,Ge=3,Xe=8,Xt;Xt=j;var J=class{constructor(){this[Xt]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let t=this.parentNode;if(!t)return null;let n=t.childNodes.indexOf(this);return n>=0?t.childNodes[n+1]??null:null}get previousSibling(){let t=this.parentNode;if(!t)return null;let n=t.childNodes.indexOf(this);return n>0?t.childNodes[n-1]??null:null}get parentElement(){return this.parentNode}appendChild(t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes.push(t),t}insertBefore(t,n){if(n==null)return this.appendChild(t);t.parentNode&&t.parentNode.removeChild(t);let r=this.childNodes.indexOf(n);return t.parentNode=this,r<0?this.childNodes.push(t):this.childNodes.splice(r,0,t),t}removeChild(t){let n=this.childNodes.indexOf(t);return n>=0&&this.childNodes.splice(n,1),t.parentNode=null,t}replaceChild(t,n){let r=this.childNodes.indexOf(n);return r>=0&&(t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes[r]=t,n.parentNode=null),n}addEventListener(){}removeEventListener(){}},Y=class e extends J{constructor(n){super();this.nodeType=Ge;this.data=n}get nodeValue(){return this.data}set nodeValue(n){this.data=n==null?"":String(n)}get textContent(){return this.data}set textContent(n){this.data=n==null?"":String(n)}cloneNode(){return new e(this.data)}},me=class e extends J{constructor(n){super();this.nodeType=Xe;this.data=n}get nodeValue(){return this.data}set nodeValue(n){this.data=n==null?"":String(n)}cloneNode(){return new e(this.data)}},Ke=class{constructor(){this.cssText=""}setProperty(t,n){this[t]=n}removeProperty(t){delete this[t]}},Be=class{constructor(t){this.el=t}list(){let t=this.el.getAttribute("class");return t?t.split(/\s+/).filter(Boolean):[]}write(t){t.length?this.el.setAttribute("class",t.join(" ")):this.el.removeAttribute("class")}add(...t){let n=this.list();for(let r of t)n.includes(r)||n.push(r);this.write(n)}remove(...t){this.write(this.list().filter(n=>!t.includes(n)))}contains(t){return this.list().includes(t)}toggle(t,n){let r=this.contains(t),o=n===void 0?!r:n;return o?this.add(t):this.remove(t),o}},he=class e extends J{constructor(n,r=!1){super();this.nodeType=ze;this.attributes=new Map;this.style=new Ke;this.classList=new Be(this);this.rawHTML=null;this.localName=n.toLowerCase(),this.tagName=r?n:n.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(n,r){this.attributes.set(n,String(r))}removeAttribute(n){this.attributes.delete(n)}getAttribute(n){return this.attributes.has(n)?this.attributes.get(n):null}hasAttribute(n){return this.attributes.has(n)}get id(){return this.getAttribute("id")??""}set id(n){n==null?this.removeAttribute("id"):this.setAttribute("id",n)}get className(){return this.getAttribute("class")??""}set className(n){n==null?this.removeAttribute("class"):this.setAttribute("class",n)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(n){n==null?this.removeAttribute("for"):this.setAttribute("for",n)}set value(n){n==null?this.removeAttribute("value"):this.setAttribute("value",String(n))}set checked(n){n?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(n){n?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(n){}get textContent(){return this.childNodes.map(n=>n.textContent??"").join("")}set textContent(n){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,n!=null&&n!==""&&this.appendChild(new Y(String(n)))}set innerText(n){this.textContent=n}set innerHTML(n){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=n==null?"":String(n)}cloneNode(n=!1){let r=new e(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,n)for(let o of this.childNodes)r.appendChild(o.cloneNode(!0));return r}};var Dr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Yt=/&/g,_r=/</g,Or=/>/g,$r=/"/g;function Je(e){return e.replace(Yt,"&").replace(_r,"<").replace(Or,">")}function Jt(e){return e.replace(Yt,"&").replace($r,""")}function qr(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Ir(e){if(!e)return"";let t=[];e.cssText&&t.push(e.cssText.trim().replace(/;\s*$/,""));for(let n of Object.keys(e)){if(n==="cssText")continue;let r=e[n];r==null||r===""||t.push(`${qr(n)}: ${r}`)}return t.join("; ")}function jr(e){let t="",n=Ir(e.style);for(let[r,o]of e.attributes)r==="style"&&n||(t+=` ${r}="${Jt(o)}"`);if(n){let r=e.attributes.get("style"),o=r?`${r.replace(/;\s*$/,"")}; ${n}`:n;t+=` style="${Jt(o)}"`}return t}function E(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return Je(e);if(typeof e=="number")return Je(String(e));if(typeof e=="function")return E(e());if(Array.isArray(e))return e.map(E).join("");switch(e.nodeType){case Ge:return Je(e.data??"");case Xe:return`<!--${e.data??""}-->`;case ze:{let t=e.localName,n=`<${t}${jr(e)}>`;if(Dr.has(t))return n;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(E).join("");return`${n}${r}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(E).join(""):""}var Ze=require("@fluixi/reactive/signal"),x=require("@fluixi/reactive/signal");var Zt=!1;function en(){Zt||(Zt=!0,dt({createElement:(e,t)=>new he(e,t),createText:e=>new Y(e),createComment:e=>new me(e)}))}function Qe(e,t={}){let n=m;en(),M(!0);let r=O(t.event);try{return $(r,()=>(0,Ze.createRoot)(o=>{try{let i=typeof e=="function"?e():e;return E(i)}finally{o()}}))}finally{M(n)}}var Qt=!1;function Fr(){Qt||(Qt=!0,(0,x.setResourceTracker)(e=>{S()?.pending.add(e)}),(0,x.setResourceIdSource)(()=>S()?.nextResourceId()??""),(0,x.setResourceDataSink)((e,t)=>{e&&S()?.data.set(e,t)}))}var Ye=null;function et(e){Ye=e}function ge(e){if(e.data.size===0)return"";let t={};for(let[r,o]of e.data){let i=o;if(Ye)try{i=Ye(o,r)}catch{continue}i!==void 0&&(t[r]=i)}if(Object.keys(t).length===0)return"";let n=G(JSON.stringify(t));return`<script type="application/json" id="${q}">${n}<\/script>`}var Hr=50;async function tt(e,t={}){let n=m;en(),M(!0),Fr();let r=O(t.event);try{return await $(r,async()=>{t.preload&&await t.preload(t.event);let o,i=null,s=()=>{};(0,Ze.createRoot)(f=>{s=f,i=(0,x.getOwner)(),o=typeof e=="function"?e():e});let a=()=>{try{(0,x.runWithOwner)(i,()=>E(o))}catch{}};a();let l=0;for(;r.pending.size>0&&l++<Hr;){let f=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(f),await(0,x.flush)(),a()}let c=(0,x.runWithOwner)(i,()=>E(o))+ge(r);return s(),c})}finally{M(n)}}
|
|
1
|
+
"use strict";var Ee=Object.defineProperty;var nn=Object.getOwnPropertyDescriptor;var rn=Object.getOwnPropertyNames;var on=Object.prototype.hasOwnProperty;var sn=(e,t)=>{for(var n in t)Ee(e,n,{get:t[n],enumerable:!0})},an=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of rn(t))!on.call(e,o)&&o!==n&&Ee(e,o,{get:()=>t[o],enumerable:!(r=nn(t,o))||r.enumerable});return e};var ln=e=>an(Ee({},"__esModule",{value:!0}),e);var Vr={};sn(Vr,{ClientOnly:()=>Ke,Dynamic:()=>Ht,ErrorBoundary:()=>Ut,FX_DATA_ID:()=>j,For:()=>$t,Index:()=>It,Island:()=>Ct,JSX_PROPERTIES:()=>te,Match:()=>jt,NoSsr:()=>Wt,Portal:()=>Vt,SVG_ELEMENTS:()=>yn,SVG_NAMESPACE:()=>_,Show:()=>_t,Switch:()=>Ft,VOID_ELEMENTS:()=>pn,addClass:()=>gn,addDelegatedEventListener:()=>Et,addNativeEventListener:()=>Pe,appendChildren:()=>An,applyElementProp:()=>ee,applyProps:()=>ke,applyUse:()=>Le,asComponent:()=>zn,asContext:()=>Kn,asOutlet:()=>Un,asProvider:()=>Bn,asRoute:()=>Wn,asRouter:()=>Hn,asRoutes:()=>Vn,asSuspense:()=>Gn,captureHydrationCursor:()=>gt,checkRenderType:()=>Xn,classMap:()=>Kt,cleanChildren:()=>M,cloneTemplate:()=>ir,closest:()=>hn,createComponent:()=>$e,createDynamicElement:()=>Pr,createElement:()=>wn,createNativeElement:()=>Me,createPortal:()=>yr,createRequestContext:()=>q,createTemplate:()=>or,delegate:()=>Pn,delegateEvents:()=>Re,escapeFxJson:()=>J,escapeHTML:()=>hr,fnName:()=>sr,generateID:()=>Qn,getAttribute:()=>En,getGlobal:()=>Fn,getLitEventName:()=>fn,getLocals:()=>je,getOffset:()=>Mn,getRequestContext:()=>v,getRequestEvent:()=>ce,getRequestLocals:()=>ue,getServerData:()=>Y,getStableElementId:()=>Zn,getStyle:()=>Sn,handleRef:()=>X,hasClass:()=>bn,html:()=>Mt,hydrate:()=>de,hydrateAdvancePast:()=>$,hydrateIslands:()=>Rt,indexArray:()=>F.indexArray,initializeIntegration:()=>br,insert:()=>w,insertExpression:()=>U,intergartionInitialized:()=>Er,isAccessor:()=>gr,isComponent:()=>E,isContext:()=>dt,isCustomElement:()=>ot,isDOMNode:()=>In,isDelegatedEvent:()=>nr,isDomElement:()=>ne,isDomNode:()=>k,isDomText:()=>re,isEventHandler:()=>un,isFunction:()=>rr,isIntegrationInitialized:()=>Nr,isJSXTemplate:()=>qn,isLitTemplateResult:()=>st,isNativeElement:()=>mr,isOutlet:()=>ut,isPromise:()=>W,isProvider:()=>ft,isReactElement:()=>_n,isRoute:()=>ct,isRouter:()=>at,isRoutes:()=>lt,isSVGElement:()=>De,isServer:()=>m,isSuspense:()=>pt,isTemplateFactory:()=>$n,isVisible:()=>Cn,iterateFn:()=>ar,keyArray:()=>F.keyArray,makeArrayFlat:()=>Nt,mapArray:()=>F.mapArray,mergeProps:()=>dr,observeIntersection:()=>On,observeResize:()=>kn,query:()=>Ne,queryAll:()=>mn,registerCreateComponent:()=>Tr,registerGlobal:()=>jn,removeAttribute:()=>Nn,removeChildren:()=>vn,removeClass:()=>xn,removeDelegatedEventListener:()=>Ce,render:()=>_e,renderToString:()=>tt,renderToStringAsync:()=>rt,resetIntegration:()=>Sr,runHydrationAt:()=>xt,runWithRequestContext:()=>I,runWithoutHydration:()=>Tt,scrollIntoView:()=>Rn,serializeNode:()=>S,serializeResourceData:()=>Te,setAttribute:()=>b,setClassList:()=>z,setClassName:()=>K,setDataRedactor:()=>nt,setDynamicAttribute:()=>ie,setDynamicBoolAttribute:()=>Oe,setDynamicProperty:()=>se,setProperty:()=>B,setRequestStore:()=>Ie,setServerMode:()=>O,setStyle:()=>G,setStyles:()=>it,shouldSetAsProperty:()=>dn,splitProps:()=>pr,spread:()=>fr,styleMap:()=>Gt,svg:()=>Pt,toAttributeName:()=>cn,toggleClass:()=>Tn,waitForElement:()=>Ln});module.exports=ln(Vr);function cn(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function un(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function fn(e){return e.startsWith("@")?e.slice(1):e.startsWith("on")?e.slice(2).toLowerCase():e}function dn(e,t){let n=new Set(["checked","value","selected","disabled","readonly","required","multiple","open","contenteditable","draggable","spellcheck"]),r={input:new Set(["value","checked","indeterminate"]),textarea:new Set(["value"]),select:new Set(["value"]),option:new Set(["selected","value"]),audio:new Set(["volume","currentTime","paused"]),video:new Set(["volume","currentTime","paused"]),img:new Set(["src","srcset"]),iframe:new Set(["src"]),a:new Set(["href"])};return n.has(t)||r[e]&&r[e].has(t)}var pn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),yn=new Set(["svg","g","path","circle","rect","line","polyline","polygon","ellipse","text","tspan","use","defs","symbol","mask","clipPath","pattern","linearGradient","radialGradient","stop","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","foreignObject"]),_="http://www.w3.org/2000/svg";function ot(e){return e.localName.includes("-")}function ee(e,t,n,r=!1){if(n==null){e.removeAttribute(t);return}if(ot(e)){e[t]=n;return}b(e,t,n,r)}var te=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function Ne(e,t=document){return t.querySelector(e)}function mn(e,t=document){return Array.from(t.querySelectorAll(e))}function hn(e,t){return e.closest(t)}function gn(e,...t){e.classList.add(...t)}function xn(e,...t){e.classList.remove(...t)}function Tn(e,...t){t.forEach(n=>e.classList.toggle(n))}function bn(e,t){return e.classList.contains(t)}function b(e,t,n,r=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}function En(e,t){return e.getAttribute(t)}function Nn(e,t){e.removeAttribute(t)}function it(e,t){Object.assign(e.style,t)}function Sn(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function wn(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([o,s])=>{if(o==="class"||o==="className")r.className=s;else if(o==="style"&&typeof s=="object")it(r,s);else if(o.startsWith("on")&&typeof s=="function"){let i=o.slice(2).toLowerCase();r.addEventListener(i,s)}else b(r,o,s)}),n.forEach(o=>{typeof o=="string"?r.appendChild(document.createTextNode(o)):r.appendChild(o)}),r}function vn(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function An(e,...t){t.forEach(n=>{typeof n=="string"?e.appendChild(document.createTextNode(n)):e.appendChild(n)})}function Cn(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function Rn(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function Mn(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function Pn(e,t,n,r){let o=s=>{let i=s.target.closest(n);i&&e.contains(i)&&r(s,i)};return e.addEventListener(t,o),()=>{e.removeEventListener(t,o)}}function Ln(e,t=5e3){return new Promise((n,r)=>{let o=Ne(e);if(o){n(o);return}let s=new MutationObserver(()=>{let a=Ne(e);a&&(s.disconnect(),clearTimeout(i),n(a))});s.observe(document.body,{childList:!0,subtree:!0});let i=setTimeout(()=>{s.disconnect(),r(new Error(`Element ${e} not found within ${t}ms`))},t)})}function On(e,t,n={}){let r=new IntersectionObserver(o=>{o.forEach(s=>{t(s.isIntersecting)})},n);return r.observe(e),()=>{r.disconnect()}}function kn(e,t){let n=new ResizeObserver(r=>{r.forEach(t)});return n.observe(e),()=>{n.disconnect()}}var Dn=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function _n(e){return typeof e=="object"&&e!==null&&e.$$typeof===Dn}function st(e){return e&&typeof e=="object"&&e.strings&&Array.isArray(e.strings)&&e.values&&Array.isArray(e.values)}function $n(e){if(typeof e!="function")return!1;try{let t=e();return st(t)}catch{return!1}}function qn(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function In(e){return e instanceof Node}function jn(e,t,n="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[n]>"u"&&(globalThis[n]={}),typeof globalThis[n][e]>"u"&&(globalThis[n][e]=t))}function Fn(e,t,n="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[n]<"u"&&typeof globalThis[n][e]<"u"?globalThis[n][e]:t}var g=require("@fluixi/reactive/signal");function Hn(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function Vn(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function Wn(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function Un(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function Bn(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function Kn(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function zn(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function Gn(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function at(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function lt(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function ct(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function ut(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function ft(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function dt(e){return typeof e=="function"&&e[Symbol.for("fluixi-context")]===!0}function E(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function pt(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function Xn(e){return at(e)?{type:"router",value:e}:ct(e)?{type:"route",value:e}:lt(e)?{type:"routes",value:e}:ut(e)?{type:"outlet",value:e}:E(e)?{type:"component",value:e}:pt(e)?{type:"suspense",value:e}:ft(e)?{type:"provider",value:e}:dt(e)?{type:"context",value:e}:{type:"none",value:e}}var d=require("@fluixi/reactive/signal");var m=typeof document>"u";function O(e){m=e}var H=Symbol.for("fluixi.server-node"),Se=null;function yt(e){Se=e}function V(){if(!Se)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Se}function k(e){return e!=null&&e[H]===!0?!0:typeof Node<"u"&&e instanceof Node}function ne(e){return e!=null&&e[H]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function re(e){return e!=null&&e[H]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var u={active:!1,cursor:null,parents:[]},mt=null;function ht(e){mt=e}function we(){return mt}function ve(e,t){return u.active&&t.parentNode===e}function Ae(e){let t=u.parents.lastIndexOf(e);t!==-1&&(u.parents.length=t),u.cursor=e.nextSibling}function gt(){return u.active?u.cursor:null}function xt(e,t){if(!e||e.parentNode==null)return t();let n=u.active,r=u.cursor,o=u.parents;u.active=!0,u.cursor=e,u.parents=[];try{return t()}finally{u.active=n,u.cursor=r,u.parents=o}}function Tt(e){if(!u.active)return e();let t=u.cursor,n=u.parents;u.active=!1,u.parents=[];try{return e()}finally{u.active=!0,u.cursor=t,u.parents=n}}function $(e){if(!u.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&Ae(t)}function Jn(e){let t=[];for(;e&&e.nodeType===1;){let n=e.tagName.toLowerCase();if(e.id){n+=`#${e.id}`,t.unshift(n);break}e.getAttribute("data-id")&&(n+=`[data-id="${e.getAttribute("data-id")}"]`);let r=0,o=e;for(;o=o.previousElementSibling;)o.tagName===e.tagName&&r++;n+=`:nth-of-type(${r+1})`,t.unshift(n),e=e.parentElement}return t.join(">")}function Yn(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return`el_${Math.abs(t)}`}function Zn(e){return Yn(Jn(e))}var Qn=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),er={};var bt=new Map,oe=new Set,ae=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function Re(e){if(!m)for(let t of e)oe.has(t)||ae.has(t)||(oe.add(t),document.addEventListener(t,tr))}function tr(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let r=n[t];if(r&&!n.disabled&&(r(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function Et(e,t,n){if(e[`$$${t}`]=n,ae.has(t)){let r=`__fx_${t}`;if(!e[r]){let o=s=>{e[`$$${t}`]?.(s)};e.addEventListener(t,o),e[r]=o}return}oe.has(t)||Re([t])}function Ce(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function nr(e){return!ae.has(e)}function rr(e){return typeof e=="function"}function P(e,t=!1){if(m)return V().createText(e);if(u.active&&!t){let n=we()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}function Me(e,t=!1){if(m)return V().createElement(e,t);if(u.active){let n=we()?.hydrateElement(e);if(n)return n}return t?document.createElementNS(_,e):document.createElement(e)}function or(e,t=!1){let n=bt.get(e);if(n)return n;let r=document.createElement("template");return t?r.innerHTML=`<svg>${e}</svg>`:r.innerHTML=e,bt.set(e,r),r}function ir(e,t=!1){let n=e.content.cloneNode(!0);return t?n.firstChild:n}function Nt(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Nt(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function sr(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function ar(e){if((0,g.isSignal)(e)||E(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!(0,g.isSignal)(t)&&!E(t);)t=t();return t}var R=0,lr=200;function cr(e,t,n,r,o){let s=r,i=new Map;return(0,d.createRenderEffect)(()=>{let a;if(E(e)&&!(0,g.isSignal)(e)){if(!i.has(e)){R++;try{let l=e();i.set(e,l)}finally{R--}}for(a=i.get(e);typeof a=="function"&&(0,g.isSignal)(a);)a=a()}else for(a=e();typeof a=="function"&&(0,g.isSignal)(a);)a=a();{let l=0;for(;typeof a=="function"&&l++<50;)if(E(a)){if(!i.has(a)){let c=a;R++;try{let f=c();i.set(c,f)}finally{R--}}a=i.get(a)}else if((0,g.isSignal)(a))a=a();else if(a=a(),typeof a!="function"||!(0,g.isSignal)(a)&&!E(a))break}R++;try{s=U(t,a,n,s,i),o(s)}finally{R--}})}function w(e,t,n,r){if(R>lr)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=P("",!0),e.appendChild(n));let o=r??null,s=l=>Array.isArray(l)&&l.some(c=>typeof c=="function"),i=l=>typeof l=="function"?l:()=>l;if(typeof t!="function"&&!s(t)){R++;try{o=U(e,t,n,null)}finally{R--}return()=>o}let a=cr(i(t),e,n,o,l=>{o=l});return()=>(a?.(),o)}function U(e,t,n,r,o){if(t==null||typeof t=="boolean")return M(e,r,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return M(e,r,n);if(W(t)){let i=P("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(i,r[0]),M(e,r.slice(1),n)):x(e,i,n):r?e.replaceChild(i,r):x(e,i,n),t.then(a=>{i.parentNode===e&&U(e,a,i.nextSibling,i)}).catch(a=>{console.error("Error resolving promise in insertExpression:",a)}),i}let s=typeof t;if(s==="string"||s==="number"){if(s==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let a=P(t);return x(e,a,n),a}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=M(e,r,n)}if(r&&re(r))return r.data=t,r;let i=P(t);return r&&r.parentNode===e?e.replaceChild(i,r):ve(e,i)||x(e,i,n),i}if(k(t))return ve(e,t)?(Ae(t),t):Array.isArray(r)?(r.length===0?x(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),M(e,r.slice(1),n)):x(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):x(e,t,n)):x(e,t,n),t);if(Array.isArray(t)){let i=[],a=Array.isArray(r)?r:r?[r]:[],l=[];C(t,i,e,n,!0,o,l);let c=ur(e,a,i,n);for(let f of l){let p=w(e,f.sig,f.marker);(0,d.onCleanup)(()=>{M(e,p()),f.marker.parentNode===e&&e.removeChild(f.marker)})}return c}if(s==="object"&&t!==null&&typeof t=="object"){let i=t;if("type"in i&&"props"in i){let a=i;if(typeof a.type=="function"){let l=a.type(a.props||{});return U(e,l,n,r)}}}return M(e,r,n)}function C(e,t,n,r,o=!0,s,i){for(let a=0;a<e.length;a++){let l=e[a];if(!(l==null||typeof l=="boolean")){for(;typeof l=="function"&&!W(l)&&!(0,g.isSignal)(l)&&!E(l)&&(l=l(),!(l==null||typeof l=="boolean")););if(!(l==null||typeof l=="boolean")){if(typeof l=="function"){let c;for(E(l)&&!(0,g.isSignal)(l)?(s||(s=new Map),s.has(l)||s.set(l,l()),c=s.get(l)):c=l();typeof c=="function"&&!W(c)&&!(0,g.isSignal)(c)&&!E(c);)s||(s=new Map),s.has(c)||s.set(c,c()),c=s.get(c);if(c==null||typeof c=="boolean")continue;if(typeof c=="function"){if((0,g.isSignal)(c)){if(i){let p=P("",!0);t.push(p),i.push({marker:p,sig:c});continue}let f=c();for(;typeof f=="function"&&(0,g.isSignal)(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?C(f,t,n,r,o,s):C([f],t,n,r,o,s);continue}continue}Array.isArray(c)?C(c,t,n,r,o,s,i):C([c],t,n,r,o,s,i);continue}if(W(l)){let c=P("",!0);t.push(c),l.then(f=>{if(c.parentNode){let p=[];if(C([f],p,c.parentNode,void 0,!1,s),p.length>0){c.parentNode.replaceChild(p[0],c);for(let y=1;y<p.length;y++)c.parentNode?.insertBefore(p[y],p[y-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(l)){C(l,t,n,r,o,s,i);continue}if(k(l)){t.push(l);continue}if(typeof l=="object"&&l!==null&&"type"in l&&"props"in l){let c=l;if(typeof c.type=="function"){let f=c.type(c.props||{});Array.isArray(f)?C(f,t,n,r,!1,s):C([f],t,n,r,!1,s);continue}}if(typeof l=="string"||typeof l=="number"){let c=String(l);if(c.trim()===""&&c!==" ")continue;t.push(P(c));continue}t.push(P(String(l)))}}}}function ur(e,t,n,r){for(let p=0;p<n.length;p++)n[p].parentNode!==null&&n[p].parentNode!==e&&(n=n.slice(),n[p]=n[p].cloneNode(!0));let o=n.length,s=t.length,i=o,a=0,l=0,c=s>0?t[s-1].nextSibling??void 0:r,f=null;for(;a<s||l<i;){if(t[a]===n[l]){a++,l++;continue}for(;s>a&&i>l&&t[s-1]===n[i-1];)s--,i--;if(s===a){let p=i<o?l?n[l-1].nextSibling??void 0:n[i-l]:c;for(;l<i;)x(e,n[l++],p)}else if(i===l)for(;a<s;)(!f||!f.has(t[a]))&&t[a].parentNode===e&&e.removeChild(t[a]),a++;else if(t[a]===n[i-1]&&n[l]===t[s-1]){let p=t[--s].nextSibling;x(e,n[l++],t[a++].nextSibling),x(e,n[--i],p),t[s]=t[a-1]}else{if(!f){f=new Map;let y=l;for(;y<i;)f.set(n[y],y++)}let p=f.get(t[a]);if(p!=null)if(l<p&&p<i){let y=a,be=1;for(;++y<s&&y<i&&!(!f.has(t[y])||f.get(t[y])!==p+be);)be++;if(be>p-l){let tn=t[a];for(;l<p;)x(e,n[l++],tn)}else t[a].parentNode===e?e.replaceChild(n[l++],t[a++]):(x(e,n[l++],c),a++)}else a++;else t[a].parentNode===e&&e.removeChild(t[a]),a++}}return n}function M(e,t,n){if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r].parentNode===e&&e.removeChild(t[r]);else t.parentNode===e&&e.removeChild(t);return null}function x(e,t,n){u.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function B(e,t,n){n==null?delete e[t]:e[t]=n}function Pe(e,t,n){let r=n,o;return Array.isArray(n)&&(r=n[0],o=n[1]),typeof r!="function"?()=>{}:(e.addEventListener(t,r,o),()=>e.removeEventListener(t,r,o))}function Le(e,t){let n=(r,o)=>{typeof r=="function"&&r(e,o??(()=>{}))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let r of t)Array.isArray(r)?n(r[0],r[1]):n(r)}}function ie(e,t,n,r=!1){return typeof n!="function"?(b(e,t,n,r),()=>{}):(0,d.createRenderEffect)(()=>{let o=typeof n=="function"?n():n;b(e,t,o,r)})}function se(e,t,n){return typeof n!="function"?(B(e,t,n),()=>{}):(0,d.createRenderEffect)(()=>{let r=typeof n=="function"?n():n;B(e,t,r)})}function Oe(e,t,n){return typeof n!="function"?(b(e,t,!!n),()=>{}):(0,d.createRenderEffect)(()=>{let r=n();b(e,t,!!r)})}function K(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){(0,d.createRenderEffect)(()=>K(e,t()));return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(r=>{let o=t[r];return typeof o=="function"?o():!!o}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function z(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let o=t[r],s=r.split(/\s+/).filter(Boolean);if(typeof o=="function"&&n)n.push((0,d.createRenderEffect)(()=>{let i=!!o();for(let a of s)e.classList.toggle(a,i)}));else{let i=!!(typeof o=="function"?o():o);for(let a of s)e.classList.toggle(a,i)}}}function G(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let r in n){let o=n[r];o==null?e.style[r]="":e.style[r]=o}}function fr(e){let{element:t,props:n,prevProps:r=er,isSVG:o=!1,skipChildren:s=!1}=e;if(!t||!ne(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let i=o||t.namespaceURI===_,a=[];for(let l in n){if(s&&l==="children")continue;let c=n[l],f=r[l];if(c===f)continue;if(l==="ref"){X(c,t);continue}if(l==="use"){Le(t,c);continue}if(l.startsWith("on:")){a.push(Pe(t,l.slice(3),c));continue}if(l.startsWith("prop:")){a.push(se(t,l.slice(5),c));continue}if(l.startsWith("attr:")){a.push(ie(t,l.slice(5),c,i));continue}if(l.startsWith("bool:")){a.push(Oe(t,l.slice(5),c));continue}if(l==="class"||l==="className"){typeof c=="function"?a.push((0,d.createRenderEffect)(()=>K(t,c()))):K(t,c);continue}if(l==="classList"){typeof c=="function"?a.push((0,d.createRenderEffect)(()=>z(t,c()))):z(t,c,a);continue}if(l==="style"){typeof c=="function"?a.push((0,d.createRenderEffect)(()=>G(t,c()))):G(t,c);continue}if(l.startsWith("on")){let y=l.slice(2).toLowerCase();f&&Ce(t,y),c&&Et(t,y,c);continue}let p=te.has(l)||!i&&l in t;typeof c=="function"?a.push(p?se(t,l,c):ie(t,l,c,i)):a.push((0,d.createRenderEffect)(()=>p?B(t,l,n[l]):b(t,l,n[l],i)))}for(let l in r)if(!(l in n))if(l.startsWith("on")){let c=l.slice(2).toLowerCase();Ce(t,c)}else te.has(l)?B(t,l,null):t.removeAttribute(l);return()=>{a.forEach(l=>l())}}function ke(e,t,n=!1){for(let r in t){let o=t[r];if(r==="ref"){X(o,e);continue}if(r!=="children"){if(r==="use"){Le(e,o);continue}if(r.startsWith("on:")){Pe(e,r.slice(3),o);continue}if(r.startsWith("prop:")){se(e,r.slice(5),o);continue}if(r.startsWith("attr:")){ie(e,r.slice(5),o,n);continue}if(r.startsWith("bool:")){Oe(e,r.slice(5),o);continue}if(r.startsWith("on")&&r.length>2){let s=r.slice(2).toLowerCase();if(typeof o=="function")if(ae.has(s)){e[`$$${s}`]=o;let i=`__fx_${s}`;if(!e[i]){let a=l=>{e[`$$${s}`]?.(l)};e.addEventListener(s,a),e[i]=a}}else e[`$$${s}`]=o,oe.has(s)||Re([s]);continue}if(r==="class"||r==="className"){K(e,o);continue}if(r==="classList"){typeof o=="function"?(0,d.createRenderEffect)(()=>z(e,o())):z(e,o);continue}if(r==="style"){typeof o=="function"?(0,d.createRenderEffect)(()=>G(e,o())):G(e,o);continue}if(r==="innerHTML"){if(typeof o=="function"){let s=(0,d.createEffect)(()=>{let i=o();for(;typeof i=="function";)i=i();e.innerHTML=i});(0,d.onCleanup)(()=>s())}else e.innerHTML=o;continue}if(r==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof o=="function"){let s=(0,d.createEffect)(()=>{let i=o();for(;typeof i=="function"&&i.length===0;)i=i();document.activeElement!==e&&(e.value=i??"")});(0,d.onCleanup)(()=>{s()})}else(0,d.createRenderEffect)(()=>{document.activeElement!==e&&(e.value=t[r]??"")});continue}if(r==="checked"&&e.tagName==="INPUT"){if(typeof o=="function"){let s=(0,d.createEffect)(()=>{let i=o();for(;typeof i=="function"&&i.length===0;)i=i();document.activeElement!==e&&(e.checked=i??"")});(0,d.onCleanup)(()=>{s()})}else(0,d.createRenderEffect)(()=>{document.activeElement!==e&&(e.checked=t[r]??"")});continue}if(r==="value"&&e.tagName==="SELECT"){if(typeof o=="function"){let s=!0,i=(0,d.createEffect)(()=>{let a=o();for(;typeof a=="function"&&a.length===0;)a=a();s?(s=!1,queueMicrotask(()=>{e.value=a??""})):e.value=a??""});(0,d.onCleanup)(()=>{i()})}else{let s=!0;(0,d.createRenderEffect)(()=>{let i=t[r];s?(s=!1,queueMicrotask(()=>{e.value=i??""})):e.value=i??""})}continue}if(typeof o=="function"){let s=(0,d.createEffect)(()=>{let i=o();for(;typeof i=="function"&&i.length===0;)i=i();ee(e,r,i,n)});(0,d.onCleanup)(()=>{s()})}else(0,d.createRenderEffect)(()=>ee(e,r,t[r],n))}}}function dr(...e){let t=r=>{for(let o=e.length-1;o>=0;o--){let s=e[o];if(s&&r in s&&s[r]!==void 0)return s[r]}},n=r=>{for(let o of e)if(o&&r in o)return!0;return!1};return new Proxy({},{get:(r,o)=>t(o),has:(r,o)=>n(o),ownKeys:()=>{let r=new Set;for(let o of e)if(o)for(let s of Reflect.ownKeys(o))r.add(s);return[...r]},getOwnPropertyDescriptor:(r,o)=>n(o)?{enumerable:!0,configurable:!0,get:()=>t(o)}:void 0})}function pr(e,...t){let n=new Set;for(let i of t)for(let a of i)n.add(a);let r=i=>({enumerable:!0,configurable:!0,get:()=>e[i]}),o=t.map(i=>{let a=new Set(i);return new Proxy({},{get:(l,c)=>a.has(c)?e[c]:void 0,has:(l,c)=>a.has(c)&&c in e,ownKeys:()=>Array.from(a).filter(l=>l in e),getOwnPropertyDescriptor:(l,c)=>a.has(c)&&c in e?r(c):void 0})}),s=new Proxy({},{get:(i,a)=>n.has(a)?void 0:e[a],has:(i,a)=>!n.has(a)&&a in e,ownKeys:()=>Reflect.ownKeys(e).filter(i=>!n.has(i)),getOwnPropertyDescriptor:(i,a)=>!n.has(a)&&a in e?r(a):void 0});return[...o,s]}function X(e,t){if(e){if(k(e)){let n=t,r=e;if(!n)return;typeof n=="function"?n(r):typeof n=="object"&&"current"in n&&(n.current=r);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}}function yr(e,t,n){let r=t||document.body,o=(0,d.readChildren)(()=>e),s=[];return(0,d.batch)(()=>{let i=(0,d.createRenderEffect)(()=>{let a=o();Array.isArray(a)?(a.forEach(l=>r.appendChild(l)),s.push(()=>{a.forEach(l=>{l.parentNode===r&&r.removeChild(l)})})):k(a)&&(r.appendChild(a),s.push(()=>{a.parentNode===r&&r.removeChild(a)}))});s.push(i),(0,d.onCleanup)(()=>{s.forEach(a=>a())})}),null}function mr(e){return typeof e=="string"&&e.toLowerCase()===e}function De(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="polygon"||e==="polyline"||e==="ellipse"||e==="g"||e==="defs"||e==="clipPath"||e==="text"}function hr(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function W(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function gr(e){return typeof e=="function"&&e.length===0&&(0,g.isSignal)(e)}function _e(e,t,n){if(!t)throw new Error("Container element is required");let r,o,s=[];return(0,d.createRoot)(i=>{(0,d.batch)(()=>{u.active||(t.textContent=""),w(t,e)}),o=i}),()=>{o?.(),r?.(),s.forEach(i=>i()),t.textContent=""}}var xr="__fx_dom_create_component__",D=globalThis[xr]??={fn:null};function Tr(e){D.fn=e}function br(e={}){let t=e.signalSystem?.createComponent;t&&(D.fn=t)}function $e(e,t){return D.fn?D.fn(e,t):(()=>e(t))}var Er=()=>D.fn!==null,Nr=()=>D.fn!==null;function Sr(){D.fn=null}var le,wt={getStore:()=>le,run(e,t){let n=le;le=e;try{return t()}finally{le=n}}},qe=wt;function Ie(e){qe=e??wt}function q(e={}){e.locals||(e.locals=e.request?ue(e.request):{});let t=0,n=0,r=null,o=new Map,s=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${t++}`,nextResourceId:()=>{if(r===null)return`r${n++}`;let i=o.get(r)??0;return o.set(r,i+1),`${r}:r${i}`},nextIslandNamespace:i=>{let a=s.get(i)??0;return s.set(i,a+1),`${i}#${a}`},withResourceScope(i,a){let l=r;r=i;try{return a()}finally{r=l}},pending:new Set,data:new Map}}function I(e,t){return qe.run(e,t)}function v(){return qe.getStore()}function ce(){return v()?.event}function je(){let e=ce();return e?(e.locals||(e.locals={}),e.locals):{}}var St=new WeakMap;function ue(e){let t=St.get(e);return t||(t={},St.set(e,t)),t}var fe=require("@fluixi/reactive/signal");var j="__FX_DATA__";function J(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var Fe;function Y(){let e=globalThis.__FX_DATA__;if(e)return e;if(Fe!==void 0)return Fe;let t=null;if(typeof document<"u"){let n=document.getElementById(j)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return Fe=t}function He(){for(;;){for(;u.cursor&&u.cursor.nodeType===3&&u.cursor.data==="";)u.cursor=u.cursor.nextSibling;if(u.cursor!=null||!u.parents.length)return;u.cursor=u.parents.pop().nextSibling}}var wr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ve=typeof process<"u"&&process.env&&!1;function We(e,t){let n=t.nodeType===1?`<${t.tagName.toLowerCase()}>`:t.nodeType===3?`text ${JSON.stringify((t.nodeValue??"").slice(0,24))}`:t.nodeType===8?"comment":"node";console.warn(`[fluixi] hydration mismatch: expected ${e} but the server DOM has ${n}. Server and client rendered different markup; recreating this node on the client. Check for non-deterministic render (Date.now(), Math.random(), browser-only branches, untransported data).`)}function vr(e){He();let t=u.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(wr.has(e.toLowerCase())?u.cursor=t.nextSibling:(u.parents.push(t),u.cursor=t.firstChild),t):(Ve&&t&&We(`<${e}>`,t),null)}function Ar(e){if(e===""){let n=u.cursor;return n&&n.nodeType===3&&n.data!==""?(u.cursor=n.nextSibling,n.data="",n):null}He();let t=u.cursor;return t&&t.nodeType===3?(u.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(Ve&&t&&We(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function Cr(e){He();let t=u.cursor;return t&&t.nodeType===8&&t.data===e?(u.cursor=t.nextSibling,t):(Ve&&t&&We(`marker <!--${e.slice(0,24)}-->`,t),null)}var vt=!1;function Rr(){vt||(vt=!0,ht({hydrateElement:vr,hydrateText:Ar,hydrateMarker:Cr}))}function de(e,t,n){Rr(),u.active=!0,u.cursor=t.firstChild,u.parents=[];let r=Y(),o=n?.resourceNamespace,s=0;(0,fe.setResourceIdSource)(()=>o?`${o}:r${s++}`:`r${s++}`),(0,fe.setServerDataGetter)(r?i=>i in r?{value:r[i]}:void 0:null);try{return _e(e,t)}finally{u.active=!1,u.cursor=null,u.parents=[]}}var Ue="fluixi-island";function Ct(e){let{component:t,props:n={},name:r}=e,o=Me(Ue),s=r??t.name??"Island";b(o,"name",s),b(o,"props",JSON.stringify(n??{}));let i=m?v():void 0;if(i){let a=i.nextIslandNamespace(s);w(o,()=>i.withResourceScope(a,()=>t(n)))}else w(o,()=>t(n));return o}var At=!1;function Mr(){if(At||typeof document>"u")return;At=!0;let e=document.createElement("style");e.textContent=`${Ue}{display:contents}`,document.head.appendChild(e)}function Rt(e){if(typeof document>"u")return;Mr();let t=document.querySelectorAll(Ue),n=new Map;t.forEach(r=>{let o=r.getAttribute("name")??"",s=n.get(o)??0;n.set(o,s+1);let i=e[o];if(!i){typeof process>"u"&&console.warn(`[fluixi] island "${o}" has no component in the registry — left static.`);return}let a={};try{a=JSON.parse(r.getAttribute("props")||"{}")}catch{}de(()=>i(a),r,{resourceNamespace:`${o}#${s}`})})}function Mt(e,...t){throw new Error("html`` was not compiled — enable the lit format: fluixi({ format: 'lit' }).")}function Pt(e,...t){throw new Error("svg`` was not compiled — enable the lit format: fluixi({ format: 'lit' }).")}var Lt=require("@fluixi/reactive/signal");function Pr(e,t={}){if(typeof e=="function")return $e(e,t);if(typeof e!="string"||e.length===0)return null;let n=De(e);if(m)return V().createElement(e,n);let r=n?document.createElementNS(_,e):document.createElement(e);return ke(r,t,n),Lr(r,t),r}function Lr(e,t){if(!t||t.children===void 0)return;let n=(0,Lt.readChildren)(()=>t.children),r=o=>{w(e,o,typeof o=="function"?null:void 0)};Array.isArray(n)?n.forEach(r):r(n)}var h=require("@fluixi/reactive/signal");function Ot(e){return typeof e=="function"?e:(()=>e)}function L(e){return()=>{let t=e();return typeof t=="function"?t():t}}function kt(e){return e!=null&&e!==!1}function Dt(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function _t(e){let t=L(()=>e.when),n=(0,h.createMemo)(t,void 0),r=(0,h.createMemo)(n,void 0),o=(0,h.getOwner)(),s=null,i=null,a=l=>{l!==i&&(s&&(0,h.disposeScope)(s),s=(0,h.createChildOwner)(o),i=l)};return(0,h.createMemo)(()=>{let l=r();return a(l?"when":"fallback"),(0,h.runWithOwner)(s,()=>{if(l){let c=e.children;return typeof c=="function"&&!Dt(c)?typeof n=="function"?(0,h.untrack)(()=>(0,h.untrack)(n)?c(n()):e.fallback):c(n):c}return e.fallback});return e.fallback??null},void 0,{name:"show"})}var pe=require("@fluixi/reactive/signal");function $t(e){let t=L(()=>e.each),n=()=>e.fallback??null,r=(o,s)=>{let i=e.children,a=Array.isArray(i)?i.map(l=>typeof l=="function"?l(o,s):l):typeof i=="function"?i(o,s):i;return $(a),a};return e.by?(0,pe.keyArray)(t,e.by,(o,s)=>r(o,s),{fallback:n}):(0,pe.mapArray)(t,(o,s)=>r(o,s),{fallback:n})}var qt=require("@fluixi/reactive/signal");function It(e){let t=L(()=>e.each);return(0,qt.indexArray)(t,(n,r)=>{let o=e.children(n,r);return $(o),o},{fallback:()=>e.fallback??null})}var F=require("@fluixi/reactive/signal");var N=require("@fluixi/reactive/signal");var Be=Symbol("match");function jt(e){return{[Be]:!0,when:L(()=>e.when),get children(){return e.children}}}function Ft(e){let t=Array.isArray(e.children)?e.children:[e.children],n=(0,N.getOwner)(),r=null,o=-1,s=i=>{i!==o&&(r&&(0,N.disposeScope)(r),r=(0,N.createChildOwner)(n),o=i)};return(0,N.createMemo)(()=>{for(let i=0;i<t.length;i+=1){let l=t[i],c=0;for(;typeof l=="function"&&!l[Be]&&c++<10;)l=l();if(!l||typeof l!="object"||l[Be]!==!0)continue;let f=l.when();if(kt(f))return s(i),(0,N.runWithOwner)(r,()=>typeof l.children=="function"?l.children(f):l.children)}return s(-2),(0,N.runWithOwner)(r,()=>e.fallback??null)})}var A=require("@fluixi/reactive/signal");function Ht(e){let t=Ot(e.component),{component:n,...r}=e,o=(0,A.getOwner)(),s=null,i;return(0,A.createMemo)(()=>{let a=t();return a!==i&&(s&&(0,A.disposeScope)(s),s=(0,A.createChildOwner)(o),i=a),a==null?null:typeof a=="string"?{tag:a,props:r}:(0,A.runWithOwner)(s,()=>a(r))})}var ye=require("@fluixi/reactive/signal");function Vt(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return(0,ye.createRoot)(o=>{n=o,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),w(r,e.children)&&X(e.ref,r)}),(0,ye.onCleanup)(()=>{n(),r.remove()}),null}var me=require("@fluixi/reactive/signal");function Ke(e){if(m)return e.fallback??null;let t=u.active,[n,r]=(0,me.createSignal)(!t);return t&&queueMicrotask(()=>r(!0)),(0,me.createMemo)(()=>n()?e.children:e.fallback??null,void 0,{name:"client-only"})}var Wt=Ke;var he=require("@fluixi/reactive/signal");function Ut(e){let[t,n]=(0,he.createSignal)(null),r=()=>n(null);return(0,he.createMemo)(()=>{let o=t();if(o!==null)return typeof e.fallback=="function"?e.fallback(o,r):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(s){return n(s),typeof e.fallback=="function"?e.fallback(s,r):e.fallback}})}var Bt=require("@fluixi/reactive/signal");function Kt(e){return(0,Bt.createMemo)(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,o]of Object.entries(t)){if(!r)continue;(typeof o=="function"?o():o)&&n.push(r)}return n.join(" ")})}var zt=require("@fluixi/reactive/signal");function Or(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Gt(e){return(0,zt.createMemo)(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,o]of Object.entries(t)){if(!r)continue;let s=typeof o=="function"?o():o;s!=null&&n.push(`${Or(r)}: ${s}`)}return n.join("; ")})}var Xe=1,Je=3,Ye=8,Xt;Xt=H;var Z=class{constructor(){this[Xt]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let t=this.parentNode;if(!t)return null;let n=t.childNodes.indexOf(this);return n>=0?t.childNodes[n+1]??null:null}get previousSibling(){let t=this.parentNode;if(!t)return null;let n=t.childNodes.indexOf(this);return n>0?t.childNodes[n-1]??null:null}get parentElement(){return this.parentNode}appendChild(t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes.push(t),t}insertBefore(t,n){if(n==null)return this.appendChild(t);t.parentNode&&t.parentNode.removeChild(t);let r=this.childNodes.indexOf(n);return t.parentNode=this,r<0?this.childNodes.push(t):this.childNodes.splice(r,0,t),t}removeChild(t){let n=this.childNodes.indexOf(t);return n>=0&&this.childNodes.splice(n,1),t.parentNode=null,t}replaceChild(t,n){let r=this.childNodes.indexOf(n);return r>=0&&(t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes[r]=t,n.parentNode=null),n}addEventListener(){}removeEventListener(){}},Q=class e extends Z{constructor(n){super();this.nodeType=Je;this.data=n}get nodeValue(){return this.data}set nodeValue(n){this.data=n==null?"":String(n)}get textContent(){return this.data}set textContent(n){this.data=n==null?"":String(n)}cloneNode(){return new e(this.data)}},ge=class e extends Z{constructor(n){super();this.nodeType=Ye;this.data=n}get nodeValue(){return this.data}set nodeValue(n){this.data=n==null?"":String(n)}cloneNode(){return new e(this.data)}},ze=class{constructor(){this.cssText=""}setProperty(t,n){this[t]=n}removeProperty(t){delete this[t]}},Ge=class{constructor(t){this.el=t}list(){let t=this.el.getAttribute("class");return t?t.split(/\s+/).filter(Boolean):[]}write(t){t.length?this.el.setAttribute("class",t.join(" ")):this.el.removeAttribute("class")}add(...t){let n=this.list();for(let r of t)n.includes(r)||n.push(r);this.write(n)}remove(...t){this.write(this.list().filter(n=>!t.includes(n)))}contains(t){return this.list().includes(t)}toggle(t,n){let r=this.contains(t),o=n===void 0?!r:n;return o?this.add(t):this.remove(t),o}},xe=class e extends Z{constructor(n,r=!1){super();this.nodeType=Xe;this.attributes=new Map;this.style=new ze;this.classList=new Ge(this);this.rawHTML=null;this.localName=n.toLowerCase(),this.tagName=r?n:n.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(n,r){this.attributes.set(n,String(r))}removeAttribute(n){this.attributes.delete(n)}getAttribute(n){return this.attributes.has(n)?this.attributes.get(n):null}hasAttribute(n){return this.attributes.has(n)}get id(){return this.getAttribute("id")??""}set id(n){n==null?this.removeAttribute("id"):this.setAttribute("id",n)}get className(){return this.getAttribute("class")??""}set className(n){n==null?this.removeAttribute("class"):this.setAttribute("class",n)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(n){n==null?this.removeAttribute("for"):this.setAttribute("for",n)}set value(n){n==null?this.removeAttribute("value"):this.setAttribute("value",String(n))}set checked(n){n?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(n){n?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(n){}get textContent(){return this.childNodes.map(n=>n.textContent??"").join("")}set textContent(n){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,n!=null&&n!==""&&this.appendChild(new Q(String(n)))}set innerText(n){this.textContent=n}set innerHTML(n){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=n==null?"":String(n)}cloneNode(n=!1){let r=new e(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,n)for(let o of this.childNodes)r.appendChild(o.cloneNode(!0));return r}};var kr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Yt=/&/g,Dr=/</g,_r=/>/g,$r=/"/g;function Ze(e){return e.replace(Yt,"&").replace(Dr,"<").replace(_r,">")}function Jt(e){return e.replace(Yt,"&").replace($r,""")}function qr(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Ir(e){if(!e)return"";let t=[];e.cssText&&t.push(e.cssText.trim().replace(/;\s*$/,""));for(let n of Object.keys(e)){if(n==="cssText")continue;let r=e[n];r==null||r===""||t.push(`${qr(n)}: ${r}`)}return t.join("; ")}function jr(e){let t="",n=Ir(e.style);for(let[r,o]of e.attributes)r==="style"&&n||(t+=` ${r}="${Jt(o)}"`);if(n){let r=e.attributes.get("style"),o=r?`${r.replace(/;\s*$/,"")}; ${n}`:n;t+=` style="${Jt(o)}"`}return t}function S(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return Ze(e);if(typeof e=="number")return Ze(String(e));if(typeof e=="function")return S(e());if(Array.isArray(e))return e.map(S).join("");switch(e.nodeType){case Je:return Ze(e.data??"");case Ye:return`<!--${e.data??""}-->`;case Xe:{let t=e.localName,n=`<${t}${jr(e)}>`;if(kr.has(t))return n;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(S).join("");return`${n}${r}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(S).join(""):""}var et=require("@fluixi/reactive/signal"),T=require("@fluixi/reactive/signal");var Zt=!1;function en(){Zt||(Zt=!0,yt({createElement:(e,t)=>new xe(e,t),createText:e=>new Q(e),createComment:e=>new ge(e)}))}function tt(e,t={}){let n=m;en(),O(!0);let r=q(t.event);try{return I(r,()=>(0,et.createRoot)(o=>{try{let s=typeof e=="function"?e():e;return S(s)}finally{o()}}))}finally{O(n)}}var Qt=!1;function Fr(){Qt||(Qt=!0,(0,T.setResourceTracker)(e=>{v()?.pending.add(e)}),(0,T.setResourceIdSource)(()=>v()?.nextResourceId()??""),(0,T.setResourceDataSink)((e,t)=>{e&&v()?.data.set(e,t)}))}var Qe=null;function nt(e){Qe=e}function Te(e){if(e.data.size===0)return"";let t={};for(let[r,o]of e.data){let s=o;if(Qe)try{s=Qe(o,r)}catch{continue}s!==void 0&&(t[r]=s)}if(Object.keys(t).length===0)return"";let n=J(JSON.stringify(t));return`<script type="application/json" id="${j}">${n}<\/script>`}var Hr=50;async function rt(e,t={}){let n=m;en(),O(!0),Fr();let r=q(t.event);try{return await I(r,async()=>{t.preload&&await t.preload(t.event);let o,s=null,i=()=>{};(0,et.createRoot)(f=>{i=f,s=(0,T.getOwner)(),o=typeof e=="function"?e():e});let a=()=>{try{(0,T.runWithOwner)(s,()=>S(o))}catch{}};a();let l=0;for(;r.pending.size>0&&l++<Hr;){let f=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(f),await(0,T.flush)(),a()}let c=(0,T.runWithOwner)(s,()=>S(o))+Te(r);return i(),c})}finally{O(n)}}
|