@fluixi/dom 1.0.0-alpha.71 → 1.0.0-alpha.73

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.
@@ -784,8 +784,16 @@ function reconcileArrays(parent, a, b, marker) {
784
784
  // The Babel plugin hoists static elements to module-level — the same node
785
785
  // can appear in `b` for multiple parents simultaneously. Clone to avoid
786
786
  // stealing it from its current owner; future reconciles track the clone.
787
+ //
788
+ // A DocumentFragment is NOT such an owner. `cloneTemplate` hands back the clone still
789
+ // sitting in its fragment, so a template-cloned element arrives here with a non-null
790
+ // parent that nothing else refers to. Cloning it again threw away the node whose props
791
+ // had just been applied — `cloneNode` copies attributes but not the event-handler
792
+ // properties — so an element built from a template lost its handlers the moment it was
793
+ // inserted as part of an array. Moving it out of the fragment is exactly right.
787
794
  for (let i = 0; i < b.length; i++) {
788
- if (b[i].parentNode !== null && b[i].parentNode !== parent) {
795
+ const owner = b[i].parentNode;
796
+ if (owner !== null && owner !== parent && owner.nodeType !== 11) {
789
797
  b = b.slice();
790
798
  b[i] = b[i].cloneNode(true);
791
799
  }
@@ -1 +1 @@
1
- import{isSignal as m}from"@fluixi/reactive/signal";var k="http://www.w3.org/2000/svg";function ue(e){return e.localName.includes("-")}function I(e,t,n,o=!1){if(n==null){e.removeAttribute(t);return}if(ue(e)){e[t]=n;return}T(e,t,n,o)}var V=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function T(e,t,n,o=!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))}var Ae=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;var z="1.0.0-alpha.71";import{VERSION as ce}from"@fluixi/reactive";var x={dom:z,reactive:ce};function X(e){x.core&&e.setAttribute("fluixi",x.core),e.setAttribute("fx-dom",x.dom),e.setAttribute("fx-reactive",x.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=x)}function J(){let e=[x.core,x.dom,x.reactive].filter(t=>t!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${x.core??"(absent)"}, dom ${x.dom}, reactive ${x.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}function h(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}import{batch as ne,createEffect as C,createRenderEffect as p,createRoot as pe,onCleanup as S,readChildren as ye}from"@fluixi/reactive/signal";var v=typeof document>"u";var W=Symbol.for("fluixi.server-node"),U=null;function L(){if(!U)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return U}function A(e){return e!=null&&e[W]===!0?!0:typeof Node<"u"&&e instanceof Node}function Y(e){return e!=null&&e[W]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Z(e){return e!=null&&e[W]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var d={active:!1,cursor:null,parents:[]},de=null;function P(){return de}function K(e,t){return d.active&&t.parentNode===e}function Q(e){let t=d.parents.lastIndexOf(e);t!==-1&&(d.parents.length=t),d.cursor=e.nextSibling}function B(e,t){if(!e||e.parentNode==null)return t();let n=d.active,o=d.cursor,s=d.parents;d.active=!0,d.cursor=e,d.parents=[];try{return t()}finally{d.active=n,d.cursor=o,d.parents=s}}function ge(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 o=0,s=e;for(;s=s.previousElementSibling;)s.tagName===e.tagName&&o++;n+=`:nth-of-type(${o+1})`,t.unshift(n),e=e.parentElement}return t.join(">")}function me(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 Ke(e){return me(ge(e))}var Be=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),xe={};var ee=new Map,R=new Set,D=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function oe(e){if(!v)for(let t of e)R.has(t)||D.has(t)||(R.add(t),document.addEventListener(t,he))}function he(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let o=n[t];if(o&&!n.disabled&&(o(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function Ee(e,t,n){if(e[`$$${t}`]=n,D.has(t)){let o=`__fx_${t}`;if(!e[o]){let s=a=>{e[`$$${t}`]?.(a)};e.addEventListener(t,s),e[o]=s}return}R.has(t)||oe([t])}function te(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,o=e[n];o&&(e.removeEventListener(t,o),delete e[n])}function qe(e){return!D.has(e)}function Ge(e){return typeof e=="function"}function N(e,t=!1){if(v)return L().createText(e);if(d.active&&!t){let n=P()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}function ze(e,t=!1){if(v)return L().createElement(e,t);if(d.active){let n=P()?.hydrateElement(e);if(n)return n}return t?document.createElementNS(k,e):document.createElement(e)}function be(e,t=!1){let n=ee.get(e);if(n)return n;let o=document.createElement("template");return t?o.innerHTML=`<svg>${e}</svg>`:o.innerHTML=e,ee.set(e,o),o}function Xe(e,t,n=!1,o=!1){if(v){let s=L();return n?s.parseTemplate(e,o):s.createRaw(e)}if(d.active){let s=P()?.hydrateStatic(t);if(s)return s}return Ne(be(e,o),o).firstChild}function Je(e,t){if(!d.active)return t();let n=B(e.nextSibling,t);if(typeof n=="function"){let o=n;return((...s)=>d.active?B(e.nextSibling,()=>o(...s)):o(...s))}return n}function Ue(e){for(let t=e.nextSibling;t;t=t.nextSibling)if(t.nodeType===8&&t.data==="fx/")return t;throw new Error("[fluixi] template hole is missing its closing marker")}function Ye(e,t){let n=[];for(let o=e.nextSibling;o&&o!==t;o=o.nextSibling)n.push(o);return n}function Ne(e,t=!1){let n=e.content.cloneNode(!0);return t?n.firstChild:n}function Te(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Te(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function Ze(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function Qe(e){if(m(e)||h(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!m(t)&&!h(t);)t=t();return t}var b=0,we=200;function Se(e,t,n,o,s){let a=o,f=new Map;return p(()=>{let r;if(h(e)&&!m(e)){if(!f.has(e)){b++;try{let i=e();f.set(e,i)}finally{b--}}for(r=f.get(e);typeof r=="function"&&m(r);)r=r()}else for(r=e();typeof r=="function"&&m(r);)r=r();{let i=0;for(;typeof r=="function"&&i++<50;)if(h(r)){if(!f.has(r)){let l=r;b++;try{let u=l();f.set(l,u)}finally{b--}}r=f.get(r)}else if(m(r))r=r();else if(r=r(),typeof r!="function"||!m(r)&&!h(r))break}b++;try{a=O(t,r,n,a,f),s(a)}finally{b--}})}function ie(e,t,n,o){if(b>we)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=N("",!0),e.appendChild(n));let s=o??null,a=i=>Array.isArray(i)&&i.some(l=>typeof l=="function"),f=i=>typeof i=="function"?i:()=>i;if(typeof t!="function"&&!a(t)){b++;try{s=O(e,t,n,null)}finally{b--}return()=>s}let r=Se(f(t),e,n,s,i=>{s=i});return()=>(r?.(),s)}function O(e,t,n,o,s){if(t==null||typeof t=="boolean")return w(e,o,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return w(e,o,n);if(M(t)){let f=N("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(f,o[0]),w(e,o.slice(1),n)):g(e,f,n):o?e.replaceChild(f,o):g(e,f,n),t.then(r=>{f.parentNode===e&&O(e,r,f.nextSibling,f)}).catch(r=>{console.error("Error resolving promise in insertExpression:",r)}),f}let a=typeof t;if(a==="string"||a==="number"){if(a==="number"&&(t=String(t)),Array.isArray(o)){if(o.length===0){let r=N(t);return g(e,r,n),r}if(o.length===1&&o[0].nodeType===3)return o[0].data=t,o;o=w(e,o,n)}if(o&&Z(o))return o.data=t,o;let f=N(t);return o&&o.parentNode===e?e.replaceChild(f,o):K(e,f)||g(e,f,n),f}if(A(t))return K(e,t)?(Q(t),t):Array.isArray(o)?(o.length===0?g(e,t,n):o[0].parentNode===e?(e.replaceChild(t,o[0]),w(e,o.slice(1),n)):g(e,t,n),t):(o?o!==t&&(o.parentNode===e?e.replaceChild(t,o):g(e,t,n)):g(e,t,n),t);if(Array.isArray(t)){let f=[],r=Array.isArray(o)?o:o?[o]:[],i=[];E(t,f,e,n,!0,s,i);let l=ve(e,r,f,n);for(let u of i){let c=ie(e,u.sig,u.marker);S(()=>{w(e,c()),u.marker.parentNode===e&&e.removeChild(u.marker)})}return l}if(a==="object"&&t!==null&&typeof t=="object"){let f=t;if("type"in f&&"props"in f){let r=f;if(typeof r.type=="function"){let i=r.type(r.props||{});return O(e,i,n,o)}}}return w(e,o,n)}function E(e,t,n,o,s=!0,a,f){for(let r=0;r<e.length;r++){let i=e[r];if(!(i==null||typeof i=="boolean")){for(;typeof i=="function"&&!M(i)&&!m(i)&&!h(i)&&(i=i(),!(i==null||typeof i=="boolean")););if(!(i==null||typeof i=="boolean")){if(typeof i=="function"){let l;for(h(i)&&!m(i)?(a||(a=new Map),a.has(i)||a.set(i,i()),l=a.get(i)):l=i();typeof l=="function"&&!M(l)&&!m(l)&&!h(l);)a||(a=new Map),a.has(l)||a.set(l,l()),l=a.get(l);if(l==null||typeof l=="boolean")continue;if(typeof l=="function"){if(m(l)){if(f){let c=N("",!0);t.push(c),f.push({marker:c,sig:l});continue}let u=l();for(;typeof u=="function"&&m(u);)u=u();if(u==null||typeof u=="boolean")continue;Array.isArray(u)?E(u,t,n,o,s,a):E([u],t,n,o,s,a);continue}continue}Array.isArray(l)?E(l,t,n,o,s,a,f):E([l],t,n,o,s,a,f);continue}if(M(i)){let l=N("",!0);t.push(l),i.then(u=>{if(l.parentNode){let c=[];if(E([u],c,l.parentNode,void 0,!1,a),c.length>0){l.parentNode.replaceChild(c[0],l);for(let y=1;y<c.length;y++)l.parentNode?.insertBefore(c[y],c[y-1].nextSibling)}}}).catch(u=>console.error("Error resolving promise in array:",u));continue}if(Array.isArray(i)){E(i,t,n,o,s,a,f);continue}if(A(i)){t.push(i);continue}if(typeof i=="object"&&i!==null&&"type"in i&&"props"in i){let l=i;if(typeof l.type=="function"){let u=l.type(l.props||{});Array.isArray(u)?E(u,t,n,o,!1,a):E([u],t,n,o,!1,a);continue}}if(typeof i=="string"||typeof i=="number"){let l=String(i);if(l.trim()===""&&l!==" ")continue;t.push(N(l));continue}t.push(N(String(i)))}}}}function ve(e,t,n,o){for(let c=0;c<n.length;c++)n[c].parentNode!==null&&n[c].parentNode!==e&&(n=n.slice(),n[c]=n[c].cloneNode(!0));let s=n.length,a=t.length,f=s,r=0,i=0,l=a>0?t[a-1].nextSibling??void 0:o,u=null;for(;r<a||i<f;){if(t[r]===n[i]){r++,i++;continue}for(;a>r&&f>i&&t[a-1]===n[f-1];)a--,f--;if(a===r){let c=f<s?i?n[i-1].nextSibling??void 0:n[f-i]:l;for(;i<f;)g(e,n[i++],c)}else if(f===i)for(;r<a;)(!u||!u.has(t[r]))&&t[r].parentNode===e&&e.removeChild(t[r]),r++;else if(t[r]===n[f-1]&&n[i]===t[a-1]){let c=t[--a].nextSibling;g(e,n[i++],t[r++].nextSibling),g(e,n[--f],c),t[a]=t[r-1]}else{if(!u){u=new Map;let y=i;for(;y<f;)u.set(n[y],y++)}let c=u.get(t[r]);if(c!=null)if(i<c&&c<f){let y=r,_=1;for(;++y<a&&y<f&&!(!u.has(t[y])||u.get(t[y])!==c+_);)_++;if(_>c-i){let le=t[r];for(;i<c;)g(e,n[i++],le)}else t[r].parentNode===e?e.replaceChild(n[i++],t[r++]):(g(e,n[i++],l),r++)}else r++;else t[r].parentNode===e&&e.removeChild(t[r]),r++}}return n}function w(e,t,n){if(t)if(Array.isArray(t))for(let o=0;o<t.length;o++)t[o].parentNode===e&&e.removeChild(t[o]);else t.parentNode===e&&e.removeChild(t);return null}function g(e,t,n){d.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function H(e,t,n){n==null?delete e[t]:e[t]=n}function re(e,t,n){let o=n,s;return Array.isArray(n)&&(o=n[0],s=n[1]),typeof o!="function"?()=>{}:(e.addEventListener(t,o,s),()=>e.removeEventListener(t,o,s))}function se(e,t){let n=(o,s)=>{typeof o=="function"&&o(e,s??(()=>{}))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let o of t)Array.isArray(o)?n(o[0],o[1]):n(o)}}function q(e,t,n,o=!1){return typeof n!="function"?(T(e,t,n,o),()=>{}):p(()=>{let s=typeof n=="function"?n():n;T(e,t,s,o)})}function G(e,t,n){return typeof n!="function"?(H(e,t,n),()=>{}):p(()=>{let o=typeof n=="function"?n():n;H(e,t,o)})}function fe(e,t,n){return typeof n!="function"?(T(e,t,!!n),()=>{}):p(()=>{let o=n();T(e,t,!!o)})}function $(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){p(()=>$(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(o=>{let s=t[o];return typeof s=="function"?s():!!s}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function j(e,t,n){if(!(!t||typeof t!="object"))for(let o in t){let s=t[o],a=o.split(/\s+/).filter(Boolean);if(typeof s=="function"&&n)n.push(p(()=>{let f=!!s();for(let r of a)e.classList.toggle(r,f)}));else{let f=!!(typeof s=="function"?s():s);for(let r of a)e.classList.toggle(r,f)}}}function F(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 o in n){let s=n[o];s==null?e.style[o]="":e.style[o]=s}}function et(e){let{element:t,props:n,prevProps:o=xe,isSVG:s=!1,skipChildren:a=!1}=e;if(!t||!Y(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let f=s||t.namespaceURI===k,r=[];for(let i in n){if(a&&i==="children")continue;let l=n[i],u=o[i];if(l===u)continue;if(i==="ref"){ae(l,t);continue}if(i==="use"){se(t,l);continue}if(i.startsWith("on:")){r.push(re(t,i.slice(3),l));continue}if(i.startsWith("prop:")){r.push(G(t,i.slice(5),l));continue}if(i.startsWith("attr:")){r.push(q(t,i.slice(5),l,f));continue}if(i.startsWith("bool:")){r.push(fe(t,i.slice(5),l));continue}if(i==="class"||i==="className"){typeof l=="function"?r.push(p(()=>$(t,l()))):$(t,l);continue}if(i==="classList"){typeof l=="function"?r.push(p(()=>j(t,l()))):j(t,l,r);continue}if(i==="style"){typeof l=="function"?r.push(p(()=>F(t,l()))):F(t,l);continue}if(i.startsWith("on")){let y=i.slice(2).toLowerCase();u&&te(t,y),l&&Ee(t,y,l);continue}let c=V.has(i)||!f&&i in t;typeof l=="function"?r.push(c?G(t,i,l):q(t,i,l,f)):r.push(p(()=>c?H(t,i,n[i]):T(t,i,n[i],f)))}for(let i in o)if(!(i in n))if(i.startsWith("on")){let l=i.slice(2).toLowerCase();te(t,l)}else V.has(i)?H(t,i,null):t.removeAttribute(i);return()=>{r.forEach(i=>i())}}function tt(e,t,n=!1){for(let o in t){let s=t[o];if(o==="ref"){ae(s,e);continue}if(o!=="children"){if(o==="use"){se(e,s);continue}if(o.startsWith("on:")){re(e,o.slice(3),s);continue}if(o.startsWith("prop:")){G(e,o.slice(5),s);continue}if(o.startsWith("attr:")){q(e,o.slice(5),s,n);continue}if(o.startsWith("bool:")){fe(e,o.slice(5),s);continue}if(o.startsWith("on")&&o.length>2){let a=o.slice(2).toLowerCase();if(typeof s=="function")if(D.has(a)){e[`$$${a}`]=s;let f=`__fx_${a}`;if(!e[f]){let r=i=>{e[`$$${a}`]?.(i)};e.addEventListener(a,r),e[f]=r}}else e[`$$${a}`]=s,R.has(a)||oe([a]);continue}if(o==="class"||o==="className"){$(e,s);continue}if(o==="classList"){typeof s=="function"?p(()=>j(e,s())):j(e,s);continue}if(o==="style"){typeof s=="function"?p(()=>F(e,s())):F(e,s);continue}if(o==="innerHTML"){if(typeof s=="function"){let a=C(()=>{let f=s();for(;typeof f=="function";)f=f();e.innerHTML=f});S(()=>a())}else e.innerHTML=s;continue}if(o==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof s=="function"){let a=C(()=>{let f=s();for(;typeof f=="function"&&f.length===0;)f=f();document.activeElement!==e&&(e.value=f??"")});S(()=>{a()})}else p(()=>{document.activeElement!==e&&(e.value=t[o]??"")});continue}if(o==="checked"&&e.tagName==="INPUT"){if(typeof s=="function"){let a=C(()=>{let f=s();for(;typeof f=="function"&&f.length===0;)f=f();document.activeElement!==e&&(e.checked=f??"")});S(()=>{a()})}else p(()=>{document.activeElement!==e&&(e.checked=t[o]??"")});continue}if(o==="value"&&e.tagName==="SELECT"){if(typeof s=="function"){let a=!0,f=C(()=>{let r=s();for(;typeof r=="function"&&r.length===0;)r=r();a?(a=!1,queueMicrotask(()=>{e.value=r??""})):e.value=r??""});S(()=>{f()})}else{let a=!0;p(()=>{let f=t[o];a?(a=!1,queueMicrotask(()=>{e.value=f??""})):e.value=f??""})}continue}if(typeof s=="function"){let a=C(()=>{let f=s();for(;typeof f=="function"&&f.length===0;)f=f();I(e,o,f,n)});S(()=>{a()})}else p(()=>I(e,o,t[o],n))}}}function nt(...e){let t=o=>{for(let s=e.length-1;s>=0;s--){let a=e[s];if(a&&o in a&&a[o]!==void 0)return a[o]}},n=o=>{for(let s of e)if(s&&o in s)return!0;return!1};return new Proxy({},{get:(o,s)=>t(s),has:(o,s)=>n(s),ownKeys:()=>{let o=new Set;for(let s of e)if(s)for(let a of Reflect.ownKeys(s))o.add(a);return[...o]},getOwnPropertyDescriptor:(o,s)=>n(s)?{enumerable:!0,configurable:!0,get:()=>t(s)}:void 0})}function ot(e,...t){let n=new Set;for(let f of t)for(let r of f)n.add(r);let o=f=>({enumerable:!0,configurable:!0,get:()=>e[f]}),s=t.map(f=>{let r=new Set(f);return new Proxy({},{get:(i,l)=>r.has(l)?e[l]:void 0,has:(i,l)=>r.has(l)&&l in e,ownKeys:()=>Array.from(r).filter(i=>i in e),getOwnPropertyDescriptor:(i,l)=>r.has(l)&&l in e?o(l):void 0})}),a=new Proxy({},{get:(f,r)=>n.has(r)?void 0:e[r],has:(f,r)=>!n.has(r)&&r in e,ownKeys:()=>Reflect.ownKeys(e).filter(f=>!n.has(f)),getOwnPropertyDescriptor:(f,r)=>!n.has(r)&&r in e?o(r):void 0});return[...s,a]}function ae(e,t){if(e){if(A(e)){let n=t,o=e;if(!n)return;typeof n=="function"?n(o):typeof n=="object"&&"current"in n&&(n.current=o);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}}function it(e,t,n){let o=t||document.body,s=ye(()=>e),a=[];return ne(()=>{let f=p(()=>{let r=s();Array.isArray(r)?(r.forEach(i=>o.appendChild(i)),a.push(()=>{r.forEach(i=>{i.parentNode===o&&o.removeChild(i)})})):A(r)&&(o.appendChild(r),a.push(()=>{r.parentNode===o&&o.removeChild(r)}))});a.push(f),S(()=>{a.forEach(r=>r())})}),null}function rt(e){return typeof e=="string"&&e.toLowerCase()===e}function st(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 ft(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function M(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function at(e){return typeof e=="function"&&e.length===0&&m(e)}function lt(e,t,n){if(!t)throw new Error("Container element is required");let o,s,a=[];return pe(f=>{ne(()=>{d.active||(t.textContent=""),X(t),J(),ie(t,e)}),s=f}),()=>{s?.(),o?.(),a.forEach(f=>f()),t.textContent=""}}export{Ee as addDelegatedEventListener,re as addNativeEventListener,tt as applyProps,se as applyUse,w as cleanChildren,Ne as cloneTemplate,ze as createNativeElement,it as createPortal,be as createTemplate,oe as delegateEvents,ft as escapeHTML,Ze as fnName,Be as generateID,Ke as getStableElementId,ae as handleRef,Ye as holeContent,Ue as holeEnd,Je as holeScope,ie as insert,O as insertExpression,at as isAccessor,qe as isDelegatedEvent,Ge as isFunction,rt as isNativeElement,M as isPromise,st as isSVGElement,Qe as iterateFn,Te as makeArrayFlat,nt as mergeProps,te as removeDelegatedEventListener,lt as render,j as setClassList,$ as setClassName,q as setDynamicAttribute,fe as setDynamicBoolAttribute,G as setDynamicProperty,H as setProperty,F as setStyle,ot as splitProps,et as spread,Xe as templateNode};
1
+ import{isSignal as m}from"@fluixi/reactive/signal";var k="http://www.w3.org/2000/svg";function ue(e){return e.localName.includes("-")}function I(e,t,n,o=!1){if(n==null){e.removeAttribute(t);return}if(ue(e)){e[t]=n;return}T(e,t,n,o)}var V=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function T(e,t,n,o=!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))}var Ae=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;var z="1.0.0-alpha.73";import{VERSION as ce}from"@fluixi/reactive";var x={dom:z,reactive:ce};function X(e){x.core&&e.setAttribute("fluixi",x.core),e.setAttribute("fx-dom",x.dom),e.setAttribute("fx-reactive",x.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=x)}function J(){let e=[x.core,x.dom,x.reactive].filter(t=>t!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${x.core??"(absent)"}, dom ${x.dom}, reactive ${x.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}function h(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}import{batch as ne,createEffect as C,createRenderEffect as y,createRoot as pe,onCleanup as S,readChildren as ye}from"@fluixi/reactive/signal";var v=typeof document>"u";var W=Symbol.for("fluixi.server-node"),U=null;function L(){if(!U)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return U}function A(e){return e!=null&&e[W]===!0?!0:typeof Node<"u"&&e instanceof Node}function Y(e){return e!=null&&e[W]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Z(e){return e!=null&&e[W]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var d={active:!1,cursor:null,parents:[]},de=null;function P(){return de}function K(e,t){return d.active&&t.parentNode===e}function Q(e){let t=d.parents.lastIndexOf(e);t!==-1&&(d.parents.length=t),d.cursor=e.nextSibling}function B(e,t){if(!e||e.parentNode==null)return t();let n=d.active,o=d.cursor,s=d.parents;d.active=!0,d.cursor=e,d.parents=[];try{return t()}finally{d.active=n,d.cursor=o,d.parents=s}}function ge(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 o=0,s=e;for(;s=s.previousElementSibling;)s.tagName===e.tagName&&o++;n+=`:nth-of-type(${o+1})`,t.unshift(n),e=e.parentElement}return t.join(">")}function me(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 Ke(e){return me(ge(e))}var Be=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),xe={};var ee=new Map,R=new Set,D=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function oe(e){if(!v)for(let t of e)R.has(t)||D.has(t)||(R.add(t),document.addEventListener(t,he))}function he(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let o=n[t];if(o&&!n.disabled&&(o(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function Ee(e,t,n){if(e[`$$${t}`]=n,D.has(t)){let o=`__fx_${t}`;if(!e[o]){let s=a=>{e[`$$${t}`]?.(a)};e.addEventListener(t,s),e[o]=s}return}R.has(t)||oe([t])}function te(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,o=e[n];o&&(e.removeEventListener(t,o),delete e[n])}function qe(e){return!D.has(e)}function Ge(e){return typeof e=="function"}function N(e,t=!1){if(v)return L().createText(e);if(d.active&&!t){let n=P()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}function ze(e,t=!1){if(v)return L().createElement(e,t);if(d.active){let n=P()?.hydrateElement(e);if(n)return n}return t?document.createElementNS(k,e):document.createElement(e)}function be(e,t=!1){let n=ee.get(e);if(n)return n;let o=document.createElement("template");return t?o.innerHTML=`<svg>${e}</svg>`:o.innerHTML=e,ee.set(e,o),o}function Xe(e,t,n=!1,o=!1){if(v){let s=L();return n?s.parseTemplate(e,o):s.createRaw(e)}if(d.active){let s=P()?.hydrateStatic(t);if(s)return s}return Ne(be(e,o),o).firstChild}function Je(e,t){if(!d.active)return t();let n=B(e.nextSibling,t);if(typeof n=="function"){let o=n;return((...s)=>d.active?B(e.nextSibling,()=>o(...s)):o(...s))}return n}function Ue(e){for(let t=e.nextSibling;t;t=t.nextSibling)if(t.nodeType===8&&t.data==="fx/")return t;throw new Error("[fluixi] template hole is missing its closing marker")}function Ye(e,t){let n=[];for(let o=e.nextSibling;o&&o!==t;o=o.nextSibling)n.push(o);return n}function Ne(e,t=!1){let n=e.content.cloneNode(!0);return t?n.firstChild:n}function Te(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Te(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function Ze(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function Qe(e){if(m(e)||h(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!m(t)&&!h(t);)t=t();return t}var b=0,we=200;function Se(e,t,n,o,s){let a=o,f=new Map;return y(()=>{let r;if(h(e)&&!m(e)){if(!f.has(e)){b++;try{let i=e();f.set(e,i)}finally{b--}}for(r=f.get(e);typeof r=="function"&&m(r);)r=r()}else for(r=e();typeof r=="function"&&m(r);)r=r();{let i=0;for(;typeof r=="function"&&i++<50;)if(h(r)){if(!f.has(r)){let l=r;b++;try{let u=l();f.set(l,u)}finally{b--}}r=f.get(r)}else if(m(r))r=r();else if(r=r(),typeof r!="function"||!m(r)&&!h(r))break}b++;try{a=O(t,r,n,a,f),s(a)}finally{b--}})}function ie(e,t,n,o){if(b>we)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;n!==void 0&&!n&&(n=N("",!0),e.appendChild(n));let s=o??null,a=i=>Array.isArray(i)&&i.some(l=>typeof l=="function"),f=i=>typeof i=="function"?i:()=>i;if(typeof t!="function"&&!a(t)){b++;try{s=O(e,t,n,null)}finally{b--}return()=>s}let r=Se(f(t),e,n,s,i=>{s=i});return()=>(r?.(),s)}function O(e,t,n,o,s){if(t==null||typeof t=="boolean")return w(e,o,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return w(e,o,n);if(M(t)){let f=N("",!0);return Array.isArray(o)?o.length>0?(e.replaceChild(f,o[0]),w(e,o.slice(1),n)):g(e,f,n):o?e.replaceChild(f,o):g(e,f,n),t.then(r=>{f.parentNode===e&&O(e,r,f.nextSibling,f)}).catch(r=>{console.error("Error resolving promise in insertExpression:",r)}),f}let a=typeof t;if(a==="string"||a==="number"){if(a==="number"&&(t=String(t)),Array.isArray(o)){if(o.length===0){let r=N(t);return g(e,r,n),r}if(o.length===1&&o[0].nodeType===3)return o[0].data=t,o;o=w(e,o,n)}if(o&&Z(o))return o.data=t,o;let f=N(t);return o&&o.parentNode===e?e.replaceChild(f,o):K(e,f)||g(e,f,n),f}if(A(t))return K(e,t)?(Q(t),t):Array.isArray(o)?(o.length===0?g(e,t,n):o[0].parentNode===e?(e.replaceChild(t,o[0]),w(e,o.slice(1),n)):g(e,t,n),t):(o?o!==t&&(o.parentNode===e?e.replaceChild(t,o):g(e,t,n)):g(e,t,n),t);if(Array.isArray(t)){let f=[],r=Array.isArray(o)?o:o?[o]:[],i=[];E(t,f,e,n,!0,s,i);let l=ve(e,r,f,n);for(let u of i){let c=ie(e,u.sig,u.marker);S(()=>{w(e,c()),u.marker.parentNode===e&&e.removeChild(u.marker)})}return l}if(a==="object"&&t!==null&&typeof t=="object"){let f=t;if("type"in f&&"props"in f){let r=f;if(typeof r.type=="function"){let i=r.type(r.props||{});return O(e,i,n,o)}}}return w(e,o,n)}function E(e,t,n,o,s=!0,a,f){for(let r=0;r<e.length;r++){let i=e[r];if(!(i==null||typeof i=="boolean")){for(;typeof i=="function"&&!M(i)&&!m(i)&&!h(i)&&(i=i(),!(i==null||typeof i=="boolean")););if(!(i==null||typeof i=="boolean")){if(typeof i=="function"){let l;for(h(i)&&!m(i)?(a||(a=new Map),a.has(i)||a.set(i,i()),l=a.get(i)):l=i();typeof l=="function"&&!M(l)&&!m(l)&&!h(l);)a||(a=new Map),a.has(l)||a.set(l,l()),l=a.get(l);if(l==null||typeof l=="boolean")continue;if(typeof l=="function"){if(m(l)){if(f){let c=N("",!0);t.push(c),f.push({marker:c,sig:l});continue}let u=l();for(;typeof u=="function"&&m(u);)u=u();if(u==null||typeof u=="boolean")continue;Array.isArray(u)?E(u,t,n,o,s,a):E([u],t,n,o,s,a);continue}continue}Array.isArray(l)?E(l,t,n,o,s,a,f):E([l],t,n,o,s,a,f);continue}if(M(i)){let l=N("",!0);t.push(l),i.then(u=>{if(l.parentNode){let c=[];if(E([u],c,l.parentNode,void 0,!1,a),c.length>0){l.parentNode.replaceChild(c[0],l);for(let p=1;p<c.length;p++)l.parentNode?.insertBefore(c[p],c[p-1].nextSibling)}}}).catch(u=>console.error("Error resolving promise in array:",u));continue}if(Array.isArray(i)){E(i,t,n,o,s,a,f);continue}if(A(i)){t.push(i);continue}if(typeof i=="object"&&i!==null&&"type"in i&&"props"in i){let l=i;if(typeof l.type=="function"){let u=l.type(l.props||{});Array.isArray(u)?E(u,t,n,o,!1,a):E([u],t,n,o,!1,a);continue}}if(typeof i=="string"||typeof i=="number"){let l=String(i);if(l.trim()===""&&l!==" ")continue;t.push(N(l));continue}t.push(N(String(i)))}}}}function ve(e,t,n,o){for(let c=0;c<n.length;c++){let p=n[c].parentNode;p!==null&&p!==e&&p.nodeType!==11&&(n=n.slice(),n[c]=n[c].cloneNode(!0))}let s=n.length,a=t.length,f=s,r=0,i=0,l=a>0?t[a-1].nextSibling??void 0:o,u=null;for(;r<a||i<f;){if(t[r]===n[i]){r++,i++;continue}for(;a>r&&f>i&&t[a-1]===n[f-1];)a--,f--;if(a===r){let c=f<s?i?n[i-1].nextSibling??void 0:n[f-i]:l;for(;i<f;)g(e,n[i++],c)}else if(f===i)for(;r<a;)(!u||!u.has(t[r]))&&t[r].parentNode===e&&e.removeChild(t[r]),r++;else if(t[r]===n[f-1]&&n[i]===t[a-1]){let c=t[--a].nextSibling;g(e,n[i++],t[r++].nextSibling),g(e,n[--f],c),t[a]=t[r-1]}else{if(!u){u=new Map;let p=i;for(;p<f;)u.set(n[p],p++)}let c=u.get(t[r]);if(c!=null)if(i<c&&c<f){let p=r,_=1;for(;++p<a&&p<f&&!(!u.has(t[p])||u.get(t[p])!==c+_);)_++;if(_>c-i){let le=t[r];for(;i<c;)g(e,n[i++],le)}else t[r].parentNode===e?e.replaceChild(n[i++],t[r++]):(g(e,n[i++],l),r++)}else r++;else t[r].parentNode===e&&e.removeChild(t[r]),r++}}return n}function w(e,t,n){if(t)if(Array.isArray(t))for(let o=0;o<t.length;o++)t[o].parentNode===e&&e.removeChild(t[o]);else t.parentNode===e&&e.removeChild(t);return null}function g(e,t,n){d.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function H(e,t,n){n==null?delete e[t]:e[t]=n}function re(e,t,n){let o=n,s;return Array.isArray(n)&&(o=n[0],s=n[1]),typeof o!="function"?()=>{}:(e.addEventListener(t,o,s),()=>e.removeEventListener(t,o,s))}function se(e,t){let n=(o,s)=>{typeof o=="function"&&o(e,s??(()=>{}))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let o of t)Array.isArray(o)?n(o[0],o[1]):n(o)}}function q(e,t,n,o=!1){return typeof n!="function"?(T(e,t,n,o),()=>{}):y(()=>{let s=typeof n=="function"?n():n;T(e,t,s,o)})}function G(e,t,n){return typeof n!="function"?(H(e,t,n),()=>{}):y(()=>{let o=typeof n=="function"?n():n;H(e,t,o)})}function fe(e,t,n){return typeof n!="function"?(T(e,t,!!n),()=>{}):y(()=>{let o=n();T(e,t,!!o)})}function $(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){y(()=>$(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(o=>{let s=t[o];return typeof s=="function"?s():!!s}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function j(e,t,n){if(!(!t||typeof t!="object"))for(let o in t){let s=t[o],a=o.split(/\s+/).filter(Boolean);if(typeof s=="function"&&n)n.push(y(()=>{let f=!!s();for(let r of a)e.classList.toggle(r,f)}));else{let f=!!(typeof s=="function"?s():s);for(let r of a)e.classList.toggle(r,f)}}}function F(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 o in n){let s=n[o];s==null?e.style[o]="":e.style[o]=s}}function et(e){let{element:t,props:n,prevProps:o=xe,isSVG:s=!1,skipChildren:a=!1}=e;if(!t||!Y(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let f=s||t.namespaceURI===k,r=[];for(let i in n){if(a&&i==="children")continue;let l=n[i],u=o[i];if(l===u)continue;if(i==="ref"){ae(l,t);continue}if(i==="use"){se(t,l);continue}if(i.startsWith("on:")){r.push(re(t,i.slice(3),l));continue}if(i.startsWith("prop:")){r.push(G(t,i.slice(5),l));continue}if(i.startsWith("attr:")){r.push(q(t,i.slice(5),l,f));continue}if(i.startsWith("bool:")){r.push(fe(t,i.slice(5),l));continue}if(i==="class"||i==="className"){typeof l=="function"?r.push(y(()=>$(t,l()))):$(t,l);continue}if(i==="classList"){typeof l=="function"?r.push(y(()=>j(t,l()))):j(t,l,r);continue}if(i==="style"){typeof l=="function"?r.push(y(()=>F(t,l()))):F(t,l);continue}if(i.startsWith("on")){let p=i.slice(2).toLowerCase();u&&te(t,p),l&&Ee(t,p,l);continue}let c=V.has(i)||!f&&i in t;typeof l=="function"?r.push(c?G(t,i,l):q(t,i,l,f)):r.push(y(()=>c?H(t,i,n[i]):T(t,i,n[i],f)))}for(let i in o)if(!(i in n))if(i.startsWith("on")){let l=i.slice(2).toLowerCase();te(t,l)}else V.has(i)?H(t,i,null):t.removeAttribute(i);return()=>{r.forEach(i=>i())}}function tt(e,t,n=!1){for(let o in t){let s=t[o];if(o==="ref"){ae(s,e);continue}if(o!=="children"){if(o==="use"){se(e,s);continue}if(o.startsWith("on:")){re(e,o.slice(3),s);continue}if(o.startsWith("prop:")){G(e,o.slice(5),s);continue}if(o.startsWith("attr:")){q(e,o.slice(5),s,n);continue}if(o.startsWith("bool:")){fe(e,o.slice(5),s);continue}if(o.startsWith("on")&&o.length>2){let a=o.slice(2).toLowerCase();if(typeof s=="function")if(D.has(a)){e[`$$${a}`]=s;let f=`__fx_${a}`;if(!e[f]){let r=i=>{e[`$$${a}`]?.(i)};e.addEventListener(a,r),e[f]=r}}else e[`$$${a}`]=s,R.has(a)||oe([a]);continue}if(o==="class"||o==="className"){$(e,s);continue}if(o==="classList"){typeof s=="function"?y(()=>j(e,s())):j(e,s);continue}if(o==="style"){typeof s=="function"?y(()=>F(e,s())):F(e,s);continue}if(o==="innerHTML"){if(typeof s=="function"){let a=C(()=>{let f=s();for(;typeof f=="function";)f=f();e.innerHTML=f});S(()=>a())}else e.innerHTML=s;continue}if(o==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof s=="function"){let a=C(()=>{let f=s();for(;typeof f=="function"&&f.length===0;)f=f();document.activeElement!==e&&(e.value=f??"")});S(()=>{a()})}else y(()=>{document.activeElement!==e&&(e.value=t[o]??"")});continue}if(o==="checked"&&e.tagName==="INPUT"){if(typeof s=="function"){let a=C(()=>{let f=s();for(;typeof f=="function"&&f.length===0;)f=f();document.activeElement!==e&&(e.checked=f??"")});S(()=>{a()})}else y(()=>{document.activeElement!==e&&(e.checked=t[o]??"")});continue}if(o==="value"&&e.tagName==="SELECT"){if(typeof s=="function"){let a=!0,f=C(()=>{let r=s();for(;typeof r=="function"&&r.length===0;)r=r();a?(a=!1,queueMicrotask(()=>{e.value=r??""})):e.value=r??""});S(()=>{f()})}else{let a=!0;y(()=>{let f=t[o];a?(a=!1,queueMicrotask(()=>{e.value=f??""})):e.value=f??""})}continue}if(typeof s=="function"){let a=C(()=>{let f=s();for(;typeof f=="function"&&f.length===0;)f=f();I(e,o,f,n)});S(()=>{a()})}else y(()=>I(e,o,t[o],n))}}}function nt(...e){let t=o=>{for(let s=e.length-1;s>=0;s--){let a=e[s];if(a&&o in a&&a[o]!==void 0)return a[o]}},n=o=>{for(let s of e)if(s&&o in s)return!0;return!1};return new Proxy({},{get:(o,s)=>t(s),has:(o,s)=>n(s),ownKeys:()=>{let o=new Set;for(let s of e)if(s)for(let a of Reflect.ownKeys(s))o.add(a);return[...o]},getOwnPropertyDescriptor:(o,s)=>n(s)?{enumerable:!0,configurable:!0,get:()=>t(s)}:void 0})}function ot(e,...t){let n=new Set;for(let f of t)for(let r of f)n.add(r);let o=f=>({enumerable:!0,configurable:!0,get:()=>e[f]}),s=t.map(f=>{let r=new Set(f);return new Proxy({},{get:(i,l)=>r.has(l)?e[l]:void 0,has:(i,l)=>r.has(l)&&l in e,ownKeys:()=>Array.from(r).filter(i=>i in e),getOwnPropertyDescriptor:(i,l)=>r.has(l)&&l in e?o(l):void 0})}),a=new Proxy({},{get:(f,r)=>n.has(r)?void 0:e[r],has:(f,r)=>!n.has(r)&&r in e,ownKeys:()=>Reflect.ownKeys(e).filter(f=>!n.has(f)),getOwnPropertyDescriptor:(f,r)=>!n.has(r)&&r in e?o(r):void 0});return[...s,a]}function ae(e,t){if(e){if(A(e)){let n=t,o=e;if(!n)return;typeof n=="function"?n(o):typeof n=="object"&&"current"in n&&(n.current=o);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}}function it(e,t,n){let o=t||document.body,s=ye(()=>e),a=[];return ne(()=>{let f=y(()=>{let r=s();Array.isArray(r)?(r.forEach(i=>o.appendChild(i)),a.push(()=>{r.forEach(i=>{i.parentNode===o&&o.removeChild(i)})})):A(r)&&(o.appendChild(r),a.push(()=>{r.parentNode===o&&o.removeChild(r)}))});a.push(f),S(()=>{a.forEach(r=>r())})}),null}function rt(e){return typeof e=="string"&&e.toLowerCase()===e}function st(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 ft(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function M(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function at(e){return typeof e=="function"&&e.length===0&&m(e)}function lt(e,t,n){if(!t)throw new Error("Container element is required");let o,s,a=[];return pe(f=>{ne(()=>{d.active||(t.textContent=""),X(t),J(),ie(t,e)}),s=f}),()=>{s?.(),o?.(),a.forEach(f=>f()),t.textContent=""}}export{Ee as addDelegatedEventListener,re as addNativeEventListener,tt as applyProps,se as applyUse,w as cleanChildren,Ne as cloneTemplate,ze as createNativeElement,it as createPortal,be as createTemplate,oe as delegateEvents,ft as escapeHTML,Ze as fnName,Be as generateID,Ke as getStableElementId,ae as handleRef,Ye as holeContent,Ue as holeEnd,Je as holeScope,ie as insert,O as insertExpression,at as isAccessor,qe as isDelegatedEvent,Ge as isFunction,rt as isNativeElement,M as isPromise,st as isSVGElement,Qe as iterateFn,Te as makeArrayFlat,nt as mergeProps,te as removeDelegatedEventListener,lt as render,j as setClassList,$ as setClassName,q as setDynamicAttribute,fe as setDynamicBoolAttribute,G as setDynamicProperty,H as setProperty,F as setStyle,ot as splitProps,et as spread,Xe as templateNode};
@@ -1 +1 @@
1
- "use strict";var t=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var u=(e,o)=>{for(var s in o)t(e,s,{get:o[s],enumerable:!0})},m=(e,o,s,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of d(o))!f.call(e,r)&&r!==s&&t(e,r,{get:()=>o[r],enumerable:!(n=c(o,r))||n.enumerable});return e};var p=e=>m(t({},"__esModule",{value:!0}),e);var V={};u(V,{registerCoreVersion:()=>x,stampVersions:()=>v,versions:()=>i,warnOnVersionSkew:()=>g});module.exports=p(V);var a="1.0.0-alpha.71";var l=require("@fluixi/reactive"),i={dom:a,reactive:l.VERSION};function x(e){i.core=e}function v(e){i.core&&e.setAttribute("fluixi",i.core),e.setAttribute("fx-dom",i.dom),e.setAttribute("fx-reactive",i.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=i)}function g(){let e=[i.core,i.dom,i.reactive].filter(o=>o!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${i.core??"(absent)"}, dom ${i.dom}, reactive ${i.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}
1
+ "use strict";var t=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var u=(e,o)=>{for(var s in o)t(e,s,{get:o[s],enumerable:!0})},m=(e,o,s,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of d(o))!f.call(e,r)&&r!==s&&t(e,r,{get:()=>o[r],enumerable:!(n=c(o,r))||n.enumerable});return e};var p=e=>m(t({},"__esModule",{value:!0}),e);var V={};u(V,{registerCoreVersion:()=>x,stampVersions:()=>v,versions:()=>i,warnOnVersionSkew:()=>g});module.exports=p(V);var a="1.0.0-alpha.73";var l=require("@fluixi/reactive"),i={dom:a,reactive:l.VERSION};function x(e){i.core=e}function v(e){i.core&&e.setAttribute("fluixi",i.core),e.setAttribute("fx-dom",i.dom),e.setAttribute("fx-reactive",i.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=i)}function g(){let e=[i.core,i.dom,i.reactive].filter(o=>o!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${i.core??"(absent)"}, dom ${i.dom}, reactive ${i.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}
@@ -1 +1 @@
1
- var o="1.0.0-alpha.71";import{VERSION as s}from"@fluixi/reactive";var e={dom:o,reactive:s};function l(i){e.core=i}function c(i){e.core&&i.setAttribute("fluixi",e.core),i.setAttribute("fx-dom",e.dom),i.setAttribute("fx-reactive",e.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=e)}function d(){let i=[e.core,e.dom,e.reactive].filter(r=>r!==void 0);new Set(i).size<=1||console.warn(`[fluixi] package versions disagree — core ${e.core??"(absent)"}, dom ${e.dom}, reactive ${e.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}export{l as registerCoreVersion,c as stampVersions,e as versions,d as warnOnVersionSkew};
1
+ var o="1.0.0-alpha.73";import{VERSION as s}from"@fluixi/reactive";var e={dom:o,reactive:s};function l(i){e.core=i}function c(i){e.core&&i.setAttribute("fluixi",e.core),i.setAttribute("fx-dom",e.dom),i.setAttribute("fx-reactive",e.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=e)}function d(){let i=[e.core,e.dom,e.reactive].filter(r=>r!==void 0);new Set(i).size<=1||console.warn(`[fluixi] package versions disagree — core ${e.core??"(absent)"}, dom ${e.dom}, reactive ${e.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}export{l as registerCoreVersion,c as stampVersions,e as versions,d as warnOnVersionSkew};
@@ -1 +1 @@
1
- "use strict";var $=Object.defineProperty;var ye=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=ye(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:()=>X,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 d=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,d.createMemo)(n,void 0),o=(0,d.createMemo)(t,void 0),a=(0,d.getOwner)(),s=null,f=null,i=r=>{r!==f&&(s&&(0,d.disposeScope)(s),s=(0,d.createChildOwner)(a),f=r)};return(0,d.createMemo)(()=>{let r=o();return i(r?"when":"fallback"),(0,d.runWithOwner)(s,()=>{if(r){let c=e.children;return typeof c=="function"&&!B(c)?typeof t=="function"?(0,d.untrack)(()=>(0,d.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 X(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 G=require("@fluixi/reactive/signal");function J(e){let n=N(()=>e.each);return(0,G.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 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)){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 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,_=1;for(;++y<s&&y<f&&!(!l.has(n[y])||l.get(n[y])!==u+_);)_++;if(_>u-r){let de=n[i];for(;r<u;)p(e,t[r++],de)}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("; ")})}
1
+ "use strict";var $=Object.defineProperty;var ye=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=ye(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:()=>X,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 X(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 G=require("@fluixi/reactive/signal");function J(e){let n=N(()=>e.each);return(0,G.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++){let d=t[u].parentNode;d!==null&&d!==e&&d.nodeType!==11&&(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 de=n[i];for(;r<u;)p(e,t[r++],de)}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("; ")})}
@@ -1 +1 @@
1
- import{createChildOwner as q,createMemo as v,disposeScope as z,getOwner as X,runWithOwner as G,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=X(),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"),G(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 Bn,keyArray as qn,indexArray as zn}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 de,runWithOwner as ye}from"@fluixi/reactive/signal";function pe(e){let n=L(e.component),{component:t,...r}=e,c=de(),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}:ye(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 pn,createEffect as hn,createRenderEffect as he,createRoot as mn,onCleanup as me,readChildren as xn}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)):y(e,f,t):r?e.replaceChild(f,r):y(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 y(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)||y(e,f,t),f}if(w(n))return M(e,n)?(k(n),n):Array.isArray(r)?(r.length===0?y(e,n,t):r[0].parentNode===e?(e.replaceChild(n,r[0]),N(e,r.slice(1),t)):y(e,n,t),n):(r?r!==n&&(r.parentNode===e?e.replaceChild(n,r):y(e,n,t)):y(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 d=1;d<u.length;d++)a.parentNode?.insertBefore(u[d],u[d-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;)y(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;y(e,t[o++],n[i++].nextSibling),y(e,t[--f],u),n[s]=n[i-1]}else{if(!l){l=new Map;let d=o;for(;d<f;)l.set(t[d],d++)}let u=l.get(n[i]);if(u!=null)if(o<u&&u<f){let d=i,C=1;for(;++d<s&&d<f&&!(!l.has(n[d])||l.get(n[d])!==u+C);)C++;if(C>u-o){let B=n[i];for(;o<u;)y(e,t[o++],B)}else n[i].parentNode===e?e.replaceChild(t[o++],n[i++]):(y(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 y(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,zn as indexArray,qn as keyArray,Bn as mapArray,Le as styleMap};
1
+ import{createChildOwner as q,createMemo as v,disposeScope as z,getOwner as X,runWithOwner as G,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=X(),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"),G(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 Bn,keyArray as qn,indexArray as zn}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 de,runWithOwner as ye}from"@fluixi/reactive/signal";function pe(e){let n=L(e.component),{component:t,...r}=e,c=de(),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}:ye(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 pn,createEffect as hn,createRenderEffect as he,createRoot as mn,onCleanup as me,readChildren as xn}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)):y(e,f,t):r?e.replaceChild(f,r):y(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 y(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)||y(e,f,t),f}if(w(n))return M(e,n)?(k(n),n):Array.isArray(r)?(r.length===0?y(e,n,t):r[0].parentNode===e?(e.replaceChild(n,r[0]),N(e,r.slice(1),t)):y(e,n,t),n):(r?r!==n&&(r.parentNode===e?e.replaceChild(n,r):y(e,n,t)):y(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 d=1;d<u.length;d++)a.parentNode?.insertBefore(u[d],u[d-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++){let d=t[u].parentNode;d!==null&&d!==e&&d.nodeType!==11&&(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;)y(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;y(e,t[o++],n[i++].nextSibling),y(e,t[--f],u),n[s]=n[i-1]}else{if(!l){l=new Map;let d=o;for(;d<f;)l.set(t[d],d++)}let u=l.get(n[i]);if(u!=null)if(o<u&&u<f){let d=i,C=1;for(;++d<s&&d<f&&!(!l.has(n[d])||l.get(n[d])!==u+C);)C++;if(C>u-o){let B=n[i];for(;o<u;)y(e,t[o++],B)}else n[i].parentNode===e?e.replaceChild(t[o++],n[i++]):(y(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 y(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,zn as indexArray,qn as keyArray,Bn as mapArray,Le as styleMap};
@@ -1 +1 @@
1
- "use strict";var P=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var K=(e,n)=>{for(var t in n)P(e,t,{get:n[t],enumerable:!0})},B=(e,n,t,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of W(n))!I.call(e,c)&&c!==t&&P(e,c,{get:()=>n[c],enumerable:!(i=F(n,c))||i.enumerable});return e};var V=e=>B(P({},"__esModule",{value:!0}),e);var J={};K(J,{Portal:()=>G});module.exports=V(J);var A=require("@fluixi/reactive/signal");var p=require("@fluixi/reactive/signal");function N(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var m=require("@fluixi/reactive/signal");var R=typeof document>"u";var k=Symbol.for("fluixi.server-node"),M=null;function H(){if(!M)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return M}function T(e){return e!=null&&e[k]===!0?!0:typeof Node<"u"&&e instanceof Node}function _(e){return e!=null&&e[k]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var E={active:!1,cursor:null,parents:[]},q=null;function D(){return q}function C(e,n){return E.active&&n.parentNode===e}function $(e){let n=E.parents.lastIndexOf(e);n!==-1&&(E.parents.length=n),E.cursor=e.nextSibling}function g(e,n=!1){if(R)return H().createText(e);if(E.active&&!n){let t=D()?.hydrateText(e);if(t)return t}return document.createTextNode(e)}var x=0,U=200;function X(e,n,t,i,c){let u=i,s=new Map;return(0,m.createRenderEffect)(()=>{let r;if(N(e)&&!(0,p.isSignal)(e)){if(!s.has(e)){x++;try{let o=e();s.set(e,o)}finally{x--}}for(r=s.get(e);typeof r=="function"&&(0,p.isSignal)(r);)r=r()}else for(r=e();typeof r=="function"&&(0,p.isSignal)(r);)r=r();{let o=0;for(;typeof r=="function"&&o++<50;)if(N(r)){if(!s.has(r)){let f=r;x++;try{let a=f();s.set(f,a)}finally{x--}}r=s.get(r)}else if((0,p.isSignal)(r))r=r();else if(r=r(),typeof r!="function"||!(0,p.isSignal)(r)&&!N(r))break}x++;try{u=S(n,r,t,u,s),c(u)}finally{x--}})}function L(e,n,t,i){if(x>U)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;t!==void 0&&!t&&(t=g("",!0),e.appendChild(t));let c=i??null,u=o=>Array.isArray(o)&&o.some(f=>typeof f=="function"),s=o=>typeof o=="function"?o:()=>o;if(typeof n!="function"&&!u(n)){x++;try{c=S(e,n,t,null)}finally{x--}return()=>c}let r=X(s(n),e,t,c,o=>{c=o});return()=>(r?.(),c)}function S(e,n,t,i,c){if(n==null||typeof n=="boolean")return b(e,i,t);if(typeof n=="function")for(;typeof n=="function";)n=n();if(n==null||typeof n=="boolean")return b(e,i,t);if(w(n)){let s=g("",!0);return Array.isArray(i)?i.length>0?(e.replaceChild(s,i[0]),b(e,i.slice(1),t)):y(e,s,t):i?e.replaceChild(s,i):y(e,s,t),n.then(r=>{s.parentNode===e&&S(e,r,s.nextSibling,s)}).catch(r=>{console.error("Error resolving promise in insertExpression:",r)}),s}let u=typeof n;if(u==="string"||u==="number"){if(u==="number"&&(n=String(n)),Array.isArray(i)){if(i.length===0){let r=g(n);return y(e,r,t),r}if(i.length===1&&i[0].nodeType===3)return i[0].data=n,i;i=b(e,i,t)}if(i&&_(i))return i.data=n,i;let s=g(n);return i&&i.parentNode===e?e.replaceChild(s,i):C(e,s)||y(e,s,t),s}if(T(n))return C(e,n)?($(n),n):Array.isArray(i)?(i.length===0?y(e,n,t):i[0].parentNode===e?(e.replaceChild(n,i[0]),b(e,i.slice(1),t)):y(e,n,t),n):(i?i!==n&&(i.parentNode===e?e.replaceChild(n,i):y(e,n,t)):y(e,n,t),n);if(Array.isArray(n)){let s=[],r=Array.isArray(i)?i:i?[i]:[],o=[];h(n,s,e,t,!0,c,o);let f=z(e,r,s,t);for(let a of o){let l=L(e,a.sig,a.marker);(0,m.onCleanup)(()=>{b(e,l()),a.marker.parentNode===e&&e.removeChild(a.marker)})}return f}if(u==="object"&&n!==null&&typeof n=="object"){let s=n;if("type"in s&&"props"in s){let r=s;if(typeof r.type=="function"){let o=r.type(r.props||{});return S(e,o,t,i)}}}return b(e,i,t)}function h(e,n,t,i,c=!0,u,s){for(let r=0;r<e.length;r++){let o=e[r];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!w(o)&&!(0,p.isSignal)(o)&&!N(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let f;for(N(o)&&!(0,p.isSignal)(o)?(u||(u=new Map),u.has(o)||u.set(o,o()),f=u.get(o)):f=o();typeof f=="function"&&!w(f)&&!(0,p.isSignal)(f)&&!N(f);)u||(u=new Map),u.has(f)||u.set(f,f()),f=u.get(f);if(f==null||typeof f=="boolean")continue;if(typeof f=="function"){if((0,p.isSignal)(f)){if(s){let l=g("",!0);n.push(l),s.push({marker:l,sig:f});continue}let a=f();for(;typeof a=="function"&&(0,p.isSignal)(a);)a=a();if(a==null||typeof a=="boolean")continue;Array.isArray(a)?h(a,n,t,i,c,u):h([a],n,t,i,c,u);continue}continue}Array.isArray(f)?h(f,n,t,i,c,u,s):h([f],n,t,i,c,u,s);continue}if(w(o)){let f=g("",!0);n.push(f),o.then(a=>{if(f.parentNode){let l=[];if(h([a],l,f.parentNode,void 0,!1,u),l.length>0){f.parentNode.replaceChild(l[0],f);for(let d=1;d<l.length;d++)f.parentNode?.insertBefore(l[d],l[d-1].nextSibling)}}}).catch(a=>console.error("Error resolving promise in array:",a));continue}if(Array.isArray(o)){h(o,n,t,i,c,u,s);continue}if(T(o)){n.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let f=o;if(typeof f.type=="function"){let a=f.type(f.props||{});Array.isArray(a)?h(a,n,t,i,!1,u):h([a],n,t,i,!1,u);continue}}if(typeof o=="string"||typeof o=="number"){let f=String(o);if(f.trim()===""&&f!==" ")continue;n.push(g(f));continue}n.push(g(String(o)))}}}}function z(e,n,t,i){for(let l=0;l<t.length;l++)t[l].parentNode!==null&&t[l].parentNode!==e&&(t=t.slice(),t[l]=t[l].cloneNode(!0));let c=t.length,u=n.length,s=c,r=0,o=0,f=u>0?n[u-1].nextSibling??void 0:i,a=null;for(;r<u||o<s;){if(n[r]===t[o]){r++,o++;continue}for(;u>r&&s>o&&n[u-1]===t[s-1];)u--,s--;if(u===r){let l=s<c?o?t[o-1].nextSibling??void 0:t[s-o]:f;for(;o<s;)y(e,t[o++],l)}else if(s===o)for(;r<u;)(!a||!a.has(n[r]))&&n[r].parentNode===e&&e.removeChild(n[r]),r++;else if(n[r]===t[s-1]&&t[o]===n[u-1]){let l=n[--u].nextSibling;y(e,t[o++],n[r++].nextSibling),y(e,t[--s],l),n[u]=n[r-1]}else{if(!a){a=new Map;let d=o;for(;d<s;)a.set(t[d],d++)}let l=a.get(n[r]);if(l!=null)if(o<l&&l<s){let d=r,v=1;for(;++d<u&&d<s&&!(!a.has(n[d])||a.get(n[d])!==l+v);)v++;if(v>l-o){let O=n[r];for(;o<l;)y(e,t[o++],O)}else n[r].parentNode===e?e.replaceChild(t[o++],n[r++]):(y(e,t[o++],f),r++)}else r++;else n[r].parentNode===e&&e.removeChild(n[r]),r++}}return t}function b(e,n,t){if(n)if(Array.isArray(n))for(let i=0;i<n.length;i++)n[i].parentNode===e&&e.removeChild(n[i]);else n.parentNode===e&&e.removeChild(n);return null}function y(e,n,t){E.active&&n.parentNode===e||(t&&t.parentNode===e?e.insertBefore(n,t):e.appendChild(n))}function j(e,n){if(e){if(T(e)){let t=n,i=e;if(!t)return;typeof t=="function"?t(i):typeof t=="object"&&"current"in t&&(t.current=i);return}typeof e=="function"?e(n):typeof e=="object"&&"current"in e&&(e.current=n)}}function w(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function G(e){let n=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,t,i;return(0,A.createRoot)(c=>{t=c,i=document.createElement("div"),i.style.display="contents",n().appendChild(i),L(i,e.children)&&j(e.ref,i)}),(0,A.onCleanup)(()=>{t(),i.remove()}),null}
1
+ "use strict";var P=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var K=(e,n)=>{for(var t in n)P(e,t,{get:n[t],enumerable:!0})},B=(e,n,t,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of W(n))!I.call(e,c)&&c!==t&&P(e,c,{get:()=>n[c],enumerable:!(i=F(n,c))||i.enumerable});return e};var V=e=>B(P({},"__esModule",{value:!0}),e);var J={};K(J,{Portal:()=>G});module.exports=V(J);var A=require("@fluixi/reactive/signal");var p=require("@fluixi/reactive/signal");function N(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}var m=require("@fluixi/reactive/signal");var R=typeof document>"u";var k=Symbol.for("fluixi.server-node"),M=null;function H(){if(!M)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return M}function T(e){return e!=null&&e[k]===!0?!0:typeof Node<"u"&&e instanceof Node}function _(e){return e!=null&&e[k]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var E={active:!1,cursor:null,parents:[]},q=null;function D(){return q}function C(e,n){return E.active&&n.parentNode===e}function $(e){let n=E.parents.lastIndexOf(e);n!==-1&&(E.parents.length=n),E.cursor=e.nextSibling}function g(e,n=!1){if(R)return H().createText(e);if(E.active&&!n){let t=D()?.hydrateText(e);if(t)return t}return document.createTextNode(e)}var x=0,U=200;function X(e,n,t,i,c){let u=i,s=new Map;return(0,m.createRenderEffect)(()=>{let r;if(N(e)&&!(0,p.isSignal)(e)){if(!s.has(e)){x++;try{let o=e();s.set(e,o)}finally{x--}}for(r=s.get(e);typeof r=="function"&&(0,p.isSignal)(r);)r=r()}else for(r=e();typeof r=="function"&&(0,p.isSignal)(r);)r=r();{let o=0;for(;typeof r=="function"&&o++<50;)if(N(r)){if(!s.has(r)){let f=r;x++;try{let a=f();s.set(f,a)}finally{x--}}r=s.get(r)}else if((0,p.isSignal)(r))r=r();else if(r=r(),typeof r!="function"||!(0,p.isSignal)(r)&&!N(r))break}x++;try{u=S(n,r,t,u,s),c(u)}finally{x--}})}function L(e,n,t,i){if(x>U)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;t!==void 0&&!t&&(t=g("",!0),e.appendChild(t));let c=i??null,u=o=>Array.isArray(o)&&o.some(f=>typeof f=="function"),s=o=>typeof o=="function"?o:()=>o;if(typeof n!="function"&&!u(n)){x++;try{c=S(e,n,t,null)}finally{x--}return()=>c}let r=X(s(n),e,t,c,o=>{c=o});return()=>(r?.(),c)}function S(e,n,t,i,c){if(n==null||typeof n=="boolean")return b(e,i,t);if(typeof n=="function")for(;typeof n=="function";)n=n();if(n==null||typeof n=="boolean")return b(e,i,t);if(w(n)){let s=g("",!0);return Array.isArray(i)?i.length>0?(e.replaceChild(s,i[0]),b(e,i.slice(1),t)):y(e,s,t):i?e.replaceChild(s,i):y(e,s,t),n.then(r=>{s.parentNode===e&&S(e,r,s.nextSibling,s)}).catch(r=>{console.error("Error resolving promise in insertExpression:",r)}),s}let u=typeof n;if(u==="string"||u==="number"){if(u==="number"&&(n=String(n)),Array.isArray(i)){if(i.length===0){let r=g(n);return y(e,r,t),r}if(i.length===1&&i[0].nodeType===3)return i[0].data=n,i;i=b(e,i,t)}if(i&&_(i))return i.data=n,i;let s=g(n);return i&&i.parentNode===e?e.replaceChild(s,i):C(e,s)||y(e,s,t),s}if(T(n))return C(e,n)?($(n),n):Array.isArray(i)?(i.length===0?y(e,n,t):i[0].parentNode===e?(e.replaceChild(n,i[0]),b(e,i.slice(1),t)):y(e,n,t),n):(i?i!==n&&(i.parentNode===e?e.replaceChild(n,i):y(e,n,t)):y(e,n,t),n);if(Array.isArray(n)){let s=[],r=Array.isArray(i)?i:i?[i]:[],o=[];h(n,s,e,t,!0,c,o);let f=z(e,r,s,t);for(let a of o){let l=L(e,a.sig,a.marker);(0,m.onCleanup)(()=>{b(e,l()),a.marker.parentNode===e&&e.removeChild(a.marker)})}return f}if(u==="object"&&n!==null&&typeof n=="object"){let s=n;if("type"in s&&"props"in s){let r=s;if(typeof r.type=="function"){let o=r.type(r.props||{});return S(e,o,t,i)}}}return b(e,i,t)}function h(e,n,t,i,c=!0,u,s){for(let r=0;r<e.length;r++){let o=e[r];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!w(o)&&!(0,p.isSignal)(o)&&!N(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let f;for(N(o)&&!(0,p.isSignal)(o)?(u||(u=new Map),u.has(o)||u.set(o,o()),f=u.get(o)):f=o();typeof f=="function"&&!w(f)&&!(0,p.isSignal)(f)&&!N(f);)u||(u=new Map),u.has(f)||u.set(f,f()),f=u.get(f);if(f==null||typeof f=="boolean")continue;if(typeof f=="function"){if((0,p.isSignal)(f)){if(s){let l=g("",!0);n.push(l),s.push({marker:l,sig:f});continue}let a=f();for(;typeof a=="function"&&(0,p.isSignal)(a);)a=a();if(a==null||typeof a=="boolean")continue;Array.isArray(a)?h(a,n,t,i,c,u):h([a],n,t,i,c,u);continue}continue}Array.isArray(f)?h(f,n,t,i,c,u,s):h([f],n,t,i,c,u,s);continue}if(w(o)){let f=g("",!0);n.push(f),o.then(a=>{if(f.parentNode){let l=[];if(h([a],l,f.parentNode,void 0,!1,u),l.length>0){f.parentNode.replaceChild(l[0],f);for(let d=1;d<l.length;d++)f.parentNode?.insertBefore(l[d],l[d-1].nextSibling)}}}).catch(a=>console.error("Error resolving promise in array:",a));continue}if(Array.isArray(o)){h(o,n,t,i,c,u,s);continue}if(T(o)){n.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let f=o;if(typeof f.type=="function"){let a=f.type(f.props||{});Array.isArray(a)?h(a,n,t,i,!1,u):h([a],n,t,i,!1,u);continue}}if(typeof o=="string"||typeof o=="number"){let f=String(o);if(f.trim()===""&&f!==" ")continue;n.push(g(f));continue}n.push(g(String(o)))}}}}function z(e,n,t,i){for(let l=0;l<t.length;l++){let d=t[l].parentNode;d!==null&&d!==e&&d.nodeType!==11&&(t=t.slice(),t[l]=t[l].cloneNode(!0))}let c=t.length,u=n.length,s=c,r=0,o=0,f=u>0?n[u-1].nextSibling??void 0:i,a=null;for(;r<u||o<s;){if(n[r]===t[o]){r++,o++;continue}for(;u>r&&s>o&&n[u-1]===t[s-1];)u--,s--;if(u===r){let l=s<c?o?t[o-1].nextSibling??void 0:t[s-o]:f;for(;o<s;)y(e,t[o++],l)}else if(s===o)for(;r<u;)(!a||!a.has(n[r]))&&n[r].parentNode===e&&e.removeChild(n[r]),r++;else if(n[r]===t[s-1]&&t[o]===n[u-1]){let l=n[--u].nextSibling;y(e,t[o++],n[r++].nextSibling),y(e,t[--s],l),n[u]=n[r-1]}else{if(!a){a=new Map;let d=o;for(;d<s;)a.set(t[d],d++)}let l=a.get(n[r]);if(l!=null)if(o<l&&l<s){let d=r,v=1;for(;++d<u&&d<s&&!(!a.has(n[d])||a.get(n[d])!==l+v);)v++;if(v>l-o){let O=n[r];for(;o<l;)y(e,t[o++],O)}else n[r].parentNode===e?e.replaceChild(t[o++],n[r++]):(y(e,t[o++],f),r++)}else r++;else n[r].parentNode===e&&e.removeChild(n[r]),r++}}return t}function b(e,n,t){if(n)if(Array.isArray(n))for(let i=0;i<n.length;i++)n[i].parentNode===e&&e.removeChild(n[i]);else n.parentNode===e&&e.removeChild(n);return null}function y(e,n,t){E.active&&n.parentNode===e||(t&&t.parentNode===e?e.insertBefore(n,t):e.appendChild(n))}function j(e,n){if(e){if(T(e)){let t=n,i=e;if(!t)return;typeof t=="function"?t(i):typeof t=="object"&&"current"in t&&(t.current=i);return}typeof e=="function"?e(n):typeof e=="object"&&"current"in e&&(e.current=n)}}function w(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function G(e){let n=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,t,i;return(0,A.createRoot)(c=>{t=c,i=document.createElement("div"),i.style.display="contents",n().appendChild(i),L(i,e.children)&&j(e.ref,i)}),(0,A.onCleanup)(()=>{t(),i.remove()}),null}
@@ -1 +1 @@
1
- import{createRoot as K,onCleanup as B}from"@fluixi/reactive/signal";import{isSignal as p}from"@fluixi/reactive/signal";function m(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}import{batch as Q,createEffect as Z,createRenderEffect as j,createRoot as ee,onCleanup as O,readChildren as ne}from"@fluixi/reactive/signal";var C=typeof document>"u";var L=Symbol.for("fluixi.server-node"),P=null;function M(){if(!P)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return P}function b(e){return e!=null&&e[L]===!0?!0:typeof Node<"u"&&e instanceof Node}function R(e){return e!=null&&e[L]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var N={active:!1,cursor:null,parents:[]},$=null;function k(){return $}function A(e,n){return N.active&&n.parentNode===e}function H(e){let n=N.parents.lastIndexOf(e);n!==-1&&(N.parents.length=n),N.cursor=e.nextSibling}function g(e,n=!1){if(C)return M().createText(e);if(N.active&&!n){let t=k()?.hydrateText(e);if(t)return t}return document.createTextNode(e)}var x=0,F=200;function W(e,n,t,r,c){let u=r,s=new Map;return j(()=>{let i;if(m(e)&&!p(e)){if(!s.has(e)){x++;try{let o=e();s.set(e,o)}finally{x--}}for(i=s.get(e);typeof i=="function"&&p(i);)i=i()}else for(i=e();typeof i=="function"&&p(i);)i=i();{let o=0;for(;typeof i=="function"&&o++<50;)if(m(i)){if(!s.has(i)){let f=i;x++;try{let a=f();s.set(f,a)}finally{x--}}i=s.get(i)}else if(p(i))i=i();else if(i=i(),typeof i!="function"||!p(i)&&!m(i))break}x++;try{u=w(n,i,t,u,s),c(u)}finally{x--}})}function v(e,n,t,r){if(x>F)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;t!==void 0&&!t&&(t=g("",!0),e.appendChild(t));let c=r??null,u=o=>Array.isArray(o)&&o.some(f=>typeof f=="function"),s=o=>typeof o=="function"?o:()=>o;if(typeof n!="function"&&!u(n)){x++;try{c=w(e,n,t,null)}finally{x--}return()=>c}let i=W(s(n),e,t,c,o=>{c=o});return()=>(i?.(),c)}function w(e,n,t,r,c){if(n==null||typeof n=="boolean")return E(e,r,t);if(typeof n=="function")for(;typeof n=="function";)n=n();if(n==null||typeof n=="boolean")return E(e,r,t);if(T(n)){let s=g("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(s,r[0]),E(e,r.slice(1),t)):y(e,s,t):r?e.replaceChild(s,r):y(e,s,t),n.then(i=>{s.parentNode===e&&w(e,i,s.nextSibling,s)}).catch(i=>{console.error("Error resolving promise in insertExpression:",i)}),s}let u=typeof n;if(u==="string"||u==="number"){if(u==="number"&&(n=String(n)),Array.isArray(r)){if(r.length===0){let i=g(n);return y(e,i,t),i}if(r.length===1&&r[0].nodeType===3)return r[0].data=n,r;r=E(e,r,t)}if(r&&R(r))return r.data=n,r;let s=g(n);return r&&r.parentNode===e?e.replaceChild(s,r):A(e,s)||y(e,s,t),s}if(b(n))return A(e,n)?(H(n),n):Array.isArray(r)?(r.length===0?y(e,n,t):r[0].parentNode===e?(e.replaceChild(n,r[0]),E(e,r.slice(1),t)):y(e,n,t),n):(r?r!==n&&(r.parentNode===e?e.replaceChild(n,r):y(e,n,t)):y(e,n,t),n);if(Array.isArray(n)){let s=[],i=Array.isArray(r)?r:r?[r]:[],o=[];h(n,s,e,t,!0,c,o);let f=I(e,i,s,t);for(let a of o){let l=v(e,a.sig,a.marker);O(()=>{E(e,l()),a.marker.parentNode===e&&e.removeChild(a.marker)})}return f}if(u==="object"&&n!==null&&typeof n=="object"){let s=n;if("type"in s&&"props"in s){let i=s;if(typeof i.type=="function"){let o=i.type(i.props||{});return w(e,o,t,r)}}}return E(e,r,t)}function h(e,n,t,r,c=!0,u,s){for(let i=0;i<e.length;i++){let o=e[i];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!T(o)&&!p(o)&&!m(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let f;for(m(o)&&!p(o)?(u||(u=new Map),u.has(o)||u.set(o,o()),f=u.get(o)):f=o();typeof f=="function"&&!T(f)&&!p(f)&&!m(f);)u||(u=new Map),u.has(f)||u.set(f,f()),f=u.get(f);if(f==null||typeof f=="boolean")continue;if(typeof f=="function"){if(p(f)){if(s){let l=g("",!0);n.push(l),s.push({marker:l,sig:f});continue}let a=f();for(;typeof a=="function"&&p(a);)a=a();if(a==null||typeof a=="boolean")continue;Array.isArray(a)?h(a,n,t,r,c,u):h([a],n,t,r,c,u);continue}continue}Array.isArray(f)?h(f,n,t,r,c,u,s):h([f],n,t,r,c,u,s);continue}if(T(o)){let f=g("",!0);n.push(f),o.then(a=>{if(f.parentNode){let l=[];if(h([a],l,f.parentNode,void 0,!1,u),l.length>0){f.parentNode.replaceChild(l[0],f);for(let d=1;d<l.length;d++)f.parentNode?.insertBefore(l[d],l[d-1].nextSibling)}}}).catch(a=>console.error("Error resolving promise in array:",a));continue}if(Array.isArray(o)){h(o,n,t,r,c,u,s);continue}if(b(o)){n.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let f=o;if(typeof f.type=="function"){let a=f.type(f.props||{});Array.isArray(a)?h(a,n,t,r,!1,u):h([a],n,t,r,!1,u);continue}}if(typeof o=="string"||typeof o=="number"){let f=String(o);if(f.trim()===""&&f!==" ")continue;n.push(g(f));continue}n.push(g(String(o)))}}}}function I(e,n,t,r){for(let l=0;l<t.length;l++)t[l].parentNode!==null&&t[l].parentNode!==e&&(t=t.slice(),t[l]=t[l].cloneNode(!0));let c=t.length,u=n.length,s=c,i=0,o=0,f=u>0?n[u-1].nextSibling??void 0:r,a=null;for(;i<u||o<s;){if(n[i]===t[o]){i++,o++;continue}for(;u>i&&s>o&&n[u-1]===t[s-1];)u--,s--;if(u===i){let l=s<c?o?t[o-1].nextSibling??void 0:t[s-o]:f;for(;o<s;)y(e,t[o++],l)}else if(s===o)for(;i<u;)(!a||!a.has(n[i]))&&n[i].parentNode===e&&e.removeChild(n[i]),i++;else if(n[i]===t[s-1]&&t[o]===n[u-1]){let l=n[--u].nextSibling;y(e,t[o++],n[i++].nextSibling),y(e,t[--s],l),n[u]=n[i-1]}else{if(!a){a=new Map;let d=o;for(;d<s;)a.set(t[d],d++)}let l=a.get(n[i]);if(l!=null)if(o<l&&l<s){let d=i,S=1;for(;++d<u&&d<s&&!(!a.has(n[d])||a.get(n[d])!==l+S);)S++;if(S>l-o){let D=n[i];for(;o<l;)y(e,t[o++],D)}else n[i].parentNode===e?e.replaceChild(t[o++],n[i++]):(y(e,t[o++],f),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 r=0;r<n.length;r++)n[r].parentNode===e&&e.removeChild(n[r]);else n.parentNode===e&&e.removeChild(n);return null}function y(e,n,t){N.active&&n.parentNode===e||(t&&t.parentNode===e?e.insertBefore(n,t):e.appendChild(n))}function _(e,n){if(e){if(b(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 T(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function ue(e){let n=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,t,r;return K(c=>{t=c,r=document.createElement("div"),r.style.display="contents",n().appendChild(r),v(r,e.children)&&_(e.ref,r)}),B(()=>{t(),r.remove()}),null}export{ue as Portal};
1
+ import{createRoot as K,onCleanup as B}from"@fluixi/reactive/signal";import{isSignal as p}from"@fluixi/reactive/signal";function m(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}import{batch as Q,createEffect as Z,createRenderEffect as j,createRoot as ee,onCleanup as O,readChildren as ne}from"@fluixi/reactive/signal";var C=typeof document>"u";var L=Symbol.for("fluixi.server-node"),P=null;function M(){if(!P)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return P}function b(e){return e!=null&&e[L]===!0?!0:typeof Node<"u"&&e instanceof Node}function R(e){return e!=null&&e[L]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var N={active:!1,cursor:null,parents:[]},$=null;function k(){return $}function A(e,n){return N.active&&n.parentNode===e}function H(e){let n=N.parents.lastIndexOf(e);n!==-1&&(N.parents.length=n),N.cursor=e.nextSibling}function g(e,n=!1){if(C)return M().createText(e);if(N.active&&!n){let t=k()?.hydrateText(e);if(t)return t}return document.createTextNode(e)}var x=0,F=200;function W(e,n,t,r,c){let u=r,s=new Map;return j(()=>{let i;if(m(e)&&!p(e)){if(!s.has(e)){x++;try{let o=e();s.set(e,o)}finally{x--}}for(i=s.get(e);typeof i=="function"&&p(i);)i=i()}else for(i=e();typeof i=="function"&&p(i);)i=i();{let o=0;for(;typeof i=="function"&&o++<50;)if(m(i)){if(!s.has(i)){let f=i;x++;try{let a=f();s.set(f,a)}finally{x--}}i=s.get(i)}else if(p(i))i=i();else if(i=i(),typeof i!="function"||!p(i)&&!m(i))break}x++;try{u=w(n,i,t,u,s),c(u)}finally{x--}})}function v(e,n,t,r){if(x>F)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;t!==void 0&&!t&&(t=g("",!0),e.appendChild(t));let c=r??null,u=o=>Array.isArray(o)&&o.some(f=>typeof f=="function"),s=o=>typeof o=="function"?o:()=>o;if(typeof n!="function"&&!u(n)){x++;try{c=w(e,n,t,null)}finally{x--}return()=>c}let i=W(s(n),e,t,c,o=>{c=o});return()=>(i?.(),c)}function w(e,n,t,r,c){if(n==null||typeof n=="boolean")return E(e,r,t);if(typeof n=="function")for(;typeof n=="function";)n=n();if(n==null||typeof n=="boolean")return E(e,r,t);if(T(n)){let s=g("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(s,r[0]),E(e,r.slice(1),t)):y(e,s,t):r?e.replaceChild(s,r):y(e,s,t),n.then(i=>{s.parentNode===e&&w(e,i,s.nextSibling,s)}).catch(i=>{console.error("Error resolving promise in insertExpression:",i)}),s}let u=typeof n;if(u==="string"||u==="number"){if(u==="number"&&(n=String(n)),Array.isArray(r)){if(r.length===0){let i=g(n);return y(e,i,t),i}if(r.length===1&&r[0].nodeType===3)return r[0].data=n,r;r=E(e,r,t)}if(r&&R(r))return r.data=n,r;let s=g(n);return r&&r.parentNode===e?e.replaceChild(s,r):A(e,s)||y(e,s,t),s}if(b(n))return A(e,n)?(H(n),n):Array.isArray(r)?(r.length===0?y(e,n,t):r[0].parentNode===e?(e.replaceChild(n,r[0]),E(e,r.slice(1),t)):y(e,n,t),n):(r?r!==n&&(r.parentNode===e?e.replaceChild(n,r):y(e,n,t)):y(e,n,t),n);if(Array.isArray(n)){let s=[],i=Array.isArray(r)?r:r?[r]:[],o=[];h(n,s,e,t,!0,c,o);let f=I(e,i,s,t);for(let a of o){let l=v(e,a.sig,a.marker);O(()=>{E(e,l()),a.marker.parentNode===e&&e.removeChild(a.marker)})}return f}if(u==="object"&&n!==null&&typeof n=="object"){let s=n;if("type"in s&&"props"in s){let i=s;if(typeof i.type=="function"){let o=i.type(i.props||{});return w(e,o,t,r)}}}return E(e,r,t)}function h(e,n,t,r,c=!0,u,s){for(let i=0;i<e.length;i++){let o=e[i];if(!(o==null||typeof o=="boolean")){for(;typeof o=="function"&&!T(o)&&!p(o)&&!m(o)&&(o=o(),!(o==null||typeof o=="boolean")););if(!(o==null||typeof o=="boolean")){if(typeof o=="function"){let f;for(m(o)&&!p(o)?(u||(u=new Map),u.has(o)||u.set(o,o()),f=u.get(o)):f=o();typeof f=="function"&&!T(f)&&!p(f)&&!m(f);)u||(u=new Map),u.has(f)||u.set(f,f()),f=u.get(f);if(f==null||typeof f=="boolean")continue;if(typeof f=="function"){if(p(f)){if(s){let l=g("",!0);n.push(l),s.push({marker:l,sig:f});continue}let a=f();for(;typeof a=="function"&&p(a);)a=a();if(a==null||typeof a=="boolean")continue;Array.isArray(a)?h(a,n,t,r,c,u):h([a],n,t,r,c,u);continue}continue}Array.isArray(f)?h(f,n,t,r,c,u,s):h([f],n,t,r,c,u,s);continue}if(T(o)){let f=g("",!0);n.push(f),o.then(a=>{if(f.parentNode){let l=[];if(h([a],l,f.parentNode,void 0,!1,u),l.length>0){f.parentNode.replaceChild(l[0],f);for(let d=1;d<l.length;d++)f.parentNode?.insertBefore(l[d],l[d-1].nextSibling)}}}).catch(a=>console.error("Error resolving promise in array:",a));continue}if(Array.isArray(o)){h(o,n,t,r,c,u,s);continue}if(b(o)){n.push(o);continue}if(typeof o=="object"&&o!==null&&"type"in o&&"props"in o){let f=o;if(typeof f.type=="function"){let a=f.type(f.props||{});Array.isArray(a)?h(a,n,t,r,!1,u):h([a],n,t,r,!1,u);continue}}if(typeof o=="string"||typeof o=="number"){let f=String(o);if(f.trim()===""&&f!==" ")continue;n.push(g(f));continue}n.push(g(String(o)))}}}}function I(e,n,t,r){for(let l=0;l<t.length;l++){let d=t[l].parentNode;d!==null&&d!==e&&d.nodeType!==11&&(t=t.slice(),t[l]=t[l].cloneNode(!0))}let c=t.length,u=n.length,s=c,i=0,o=0,f=u>0?n[u-1].nextSibling??void 0:r,a=null;for(;i<u||o<s;){if(n[i]===t[o]){i++,o++;continue}for(;u>i&&s>o&&n[u-1]===t[s-1];)u--,s--;if(u===i){let l=s<c?o?t[o-1].nextSibling??void 0:t[s-o]:f;for(;o<s;)y(e,t[o++],l)}else if(s===o)for(;i<u;)(!a||!a.has(n[i]))&&n[i].parentNode===e&&e.removeChild(n[i]),i++;else if(n[i]===t[s-1]&&t[o]===n[u-1]){let l=n[--u].nextSibling;y(e,t[o++],n[i++].nextSibling),y(e,t[--s],l),n[u]=n[i-1]}else{if(!a){a=new Map;let d=o;for(;d<s;)a.set(t[d],d++)}let l=a.get(n[i]);if(l!=null)if(o<l&&l<s){let d=i,S=1;for(;++d<u&&d<s&&!(!a.has(n[d])||a.get(n[d])!==l+S);)S++;if(S>l-o){let D=n[i];for(;o<l;)y(e,t[o++],D)}else n[i].parentNode===e?e.replaceChild(t[o++],n[i++]):(y(e,t[o++],f),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 r=0;r<n.length;r++)n[r].parentNode===e&&e.removeChild(n[r]);else n.parentNode===e&&e.removeChild(n);return null}function y(e,n,t){N.active&&n.parentNode===e||(t&&t.parentNode===e?e.insertBefore(n,t):e.appendChild(n))}function _(e,n){if(e){if(b(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 T(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function ue(e){let n=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,t,r;return K(c=>{t=c,r=document.createElement("div"),r.style.display="contents",n().appendChild(r),v(r,e.children)&&_(e.ref,r)}),B(()=>{t(),r.remove()}),null}export{ue as Portal};