var r=require("@preact/signals-core"),n=require("@preact/signals"),e=require("preact"),t=require("preact/hooks"),i=function(r){return"function"==typeof r.children?r.children(r.v,r.i?r.i.value:void 0):r.children};i.displayName="Item";function u(r){var n="function"==typeof r.when?r.when():r.when.value;if(!n)return r.fallback||null;else return e.createElement(i,{v:n,children:r.children})}u.displayName="Show";function o(n){var u=t.useMemo(function(){return new Map},[]),o="function"==typeof n.each?n.each():n.each,c=o instanceof r.Signal?o.value:o;if(!c.length)return n.fallback||null;var f=new Set(u.keys()),a=c.map(function(t,o){f.delete(t);var c=u.get(t);if(!c){var a=r.signal(o),s=n.getKey?n.getKey(t,o):o;c={vnode:e.createElement(i,{key:s,v:t,i:a,children:n.children}),i:a};u.set(t,c)}else if(c.i.peek()!==o)c.i.value=o;return c.vnode});f.forEach(function(r){u.delete(r)});return e.createElement(e.Fragment,null,a)}o.displayName="For";var c={configurable:!0,get:function(){return this.value},set:function(r){this.value=r}};exports.For=o;exports.Show=u;exports.useLiveSignal=function(r){var e=n.useSignal(r);if(e.peek()!==r)e.value=r;return e};exports.useSignalRef=function(r){var e=n.useSignal(r);if(!("current"in e))Object.defineProperty(e,"current",c);return e};//# sourceMappingURL=utils.js.map
