nuclo 0.2.11 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/nuclo.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.Nuclo={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e===null||typeof e!=`object`&&typeof e!=`function`}function n(e){return e instanceof Node?!0:typeof e!=`object`||!e?!1:typeof e.nodeType==`number`}function r(e){return typeof e==`object`&&!!e}function i(e){return r(e)&&`tagName`in e}function a(e){return typeof e==`boolean`}function o(e){return typeof e==`function`}function s(e){return o(e)&&e.length===0}function c(e,t){typeof console<`u`&&console.error(`nuclo: ${e}`,t)}let l=typeof window<`u`&&typeof document<`u`,u=new WeakMap;function d(e,t){let n=u.get(e);n?n.push(t):u.set(e,[t])}function f(e,t){e.removeEventListener(t.type,t.wrapped,t.options)}function p(e,t){let n=u.get(e);if(!n)return;if(t===void 0){for(let t=0;t<n.length;t++)f(e,n[t]);u.delete(e);return}let r=0;for(let i=0;i<n.length;i++){let a=n[i];a.type===t?f(e,a):n[r++]=a}n.length=r,r===0&&u.delete(e)}function m(e,t,n){return function(r){if(!l||!r||typeof r.addEventListener!=`function`)return;let i=r,a=function(n){try{t.call(i,n)}catch(t){c(`Error in '${e}' listener`,t)}};i.addEventListener(e,a,n),d(i,{type:e,wrapped:a,options:n})}}let h=new Set,g=new WeakMap,_=new Set,v=new WeakMap,y=typeof FinalizationRegistry<`u`?new FinalizationRegistry(e=>{h.delete(e)}):null,ee=typeof FinalizationRegistry<`u`?new FinalizationRegistry(e=>{_.delete(e)}):null;function te(e,t){let n=g.get(e);if(n){n.info.resolver=t.resolver,n.info.lastValue=t.lastValue;return}let r=new WeakRef(e);h.add(r),g.set(e,{ref:r,info:t}),y?.register(e,r)}function ne(e,t){let n=new WeakRef(e);_.add(n),v.set(e,{ref:n,info:t}),ee?.register(e,n)}function re(e){h.delete(e)}function ie(e){_.delete(e)}function ae(e){let t=g.get(e);t&&(h.delete(t.ref),g.delete(e))}function oe(e){let t=v.get(e);t&&(_.delete(t.ref),v.delete(e))}let se=new WeakMap,b=new Set,ce=new WeakMap,le=typeof FinalizationRegistry<`u`?new FinalizationRegistry(e=>{b.delete(e)}):null;function ue(e,t){se.set(e,t);let n=new WeakRef(e);b.add(n),ce.set(e,n),le?.register(e,n)}function de(e){se.delete(e);let t=ce.get(e);t&&(b.delete(t),ce.delete(e))}function fe(){let e=[],t=[];for(let n of b){let r=n.deref();r===void 0?t.push(n):e.push(r)}for(let e of t)b.delete(e);return e}function pe(e){return se.get(e)??null}let me=`http://www.w3.org/2000/svg`;function he(e){return globalThis.document?document.createElement(e):null}function ge(e,t){return globalThis.document?document.createElementNS(e,t):null}function x(e){return globalThis.document?document.createTextNode(e):null}function _e(){return globalThis.document?document.createDocumentFragment():null}function ve(e,t){try{return e.appendChild(t),!0}catch(e){return c(`Failed to append child node`,e),!1}}function ye(e){if(e.nodeType===Node.ELEMENT_NODE){let t=e;p(t),oe(t),de(t)}else e.nodeType===Node.TEXT_NODE?ae(e):e.nodeType===Node.COMMENT_NODE&&de(e);if(e.childNodes&&e.childNodes.length>0)for(let t=0;t<e.childNodes.length;t++)ye(e.childNodes[t])}function S(e){if(!e?.parentNode)return!1;try{return ye(e),e.parentNode.removeChild(e),!0}catch(e){return c(`Failed to remove child node`,e),!1}}function be(e,t,n){try{return e.insertBefore(t,n),!0}catch(e){return c(`Failed to insert node before reference`,e),!1}}function C(e){return globalThis.document?globalThis.document.createComment(e):null}function xe(e,t=`hidden`){return globalThis.document?globalThis.document.createComment(`conditional-${e}-${t}`):null}function Se(e,t){let n=C(`${e}-end`);if(!n)throw Error(`Failed to create comment: document not available`);let r=C(`${e}-start-${t}`);if(!r)throw Error(`Failed to create comment: document not available`);return{start:r,end:n}}function Ce(e,t){let n=e.nextSibling;for(;n&&n!==t;){let e=n.nextSibling;S(n),n=e}}function we(e,t){let n=t.parentNode;if(n)for(let r=0;r<e.length;r++)be(n,e[r],t)}function Te(e,...t){if(!e)return e;for(let n=0;n<t.length;n++){let r=t[n];if(r!=null){let t;if(typeof r==`string`){let e=x(r);if(e)t=e;else continue}else t=r;ve(e,t)}}return e}function w(e){return e?.isConnected===!0}function Ee(e,t){if(!e?.parentNode)return!1;try{return e.parentNode.replaceChild(t,e),!0}catch(e){return c(`Error replacing conditional node`,e),!1}}function De(e){return e}function Oe(e,t,n){let r=De(e),i=r.appendChild.bind(r),a=r.insertBefore.bind(r);r.appendChild=function(e){return a(e,t)};try{return n()}finally{r.appendChild=i}}function ke(e,t,n){try{if(n==null||n===``)return e.style[t]=``,!0;let r=String(n);return e.style[t]=r,!0}catch{return!1}}let Ae={},je=!1;function Me(e){let t=e.target;if(!t||typeof Node>`u`||!(t instanceof Node))return;let n=t;for(;n;){if(n instanceof Element){let e=v.get(n);e&&(w(n)?Le(e.info):(ie(e.ref),v.delete(n)))}n=n.parentNode}}function Ne(){je||typeof document>`u`||typeof document.addEventListener!=`function`||(document.addEventListener(`update`,Me,!0),je=!0)}function Pe(e){let t=v.get(e);if(t)return t.info;let n={attributeResolvers:new Map};return ne(e,n),n}function Fe(e){return typeof e!=`object`||!e}function Ie(e,t){let n;try{n=t.resolver()}catch(t){c(`Failed to resolve reactive attribute: ${e}`,t);return}let r=Fe(n);if(!(r&&Object.is(n,t.lastValue)))try{t.applyValue(n),t.lastValue=r?n:Ae}catch(t){c(`Failed to apply reactive attribute: ${e}`,t)}}function Le(e){for(let[t,n]of e.attributeResolvers)Ie(t,n)}function Re(e,t,n,r){if(!(e instanceof Element)||!t||typeof n!=`function`){c(`Invalid parameters for registerAttributeResolver`);return}let i={resolver:n,applyValue:r,lastValue:Ae};if(!l){Ie(t,i);return}Ne(),Pe(e).attributeResolvers.set(t,i),Ie(t,i)}function ze(e){let t=[];for(let n of _){let r=n.deref();if(r===void 0){t.push(n);continue}let i=v.get(r);if(!i){t.push(n);continue}if(!w(r)){v.delete(r),t.push(n);continue}e&&!e.contains(r)||Le(i.info)}for(let e of t)ie(e)}function Be(e,t){if(!(!e?.style||!t))for(let n in t)ke(e,n,t[n])||c(`Failed to set style property '${n}'`)}function Ve(e,t){e&&(o(t)?Re(e,`style`,t,function(t){Be(e,t)}):Be(e,t))}let T=new WeakMap,He=new WeakSet;function E(e,t){let n=t.length,r=0;for(let i=0;i<=n;i++)(i===n||t.charCodeAt(i)===32)&&(i>r&&e.add(t.substring(r,i)),r=i+1)}function D(e){let t=``;for(let n of e)t&&(t+=` `),t+=n;return t}function Ue(e){if(e.className&&!T.has(e)){let t=new Set;E(t,e.className),T.set(e,t)}He.add(e)}function We(e){return He.has(e)}function Ge(e,t){if(!t)return;let n=T.get(e);n||(n=new Set,T.set(e,n)),E(n,t)}function Ke(e,t){let n=T.get(e);if(!n||n.size===0){e.className=t||``;return}if(!t){e.className=D(n);return}let r=D(n),i=t.length,a=0;for(let e=0;e<=i;e++)if(e===i||t.charCodeAt(e)===32){if(e>a){let i=t.substring(a,e);n.has(i)||(r+=` `+i)}a=e+1}e.className=r}function qe(e,t){if(!t)return;let n=e.className;if(n&&n!==t){let r=new Set;E(r,n),E(r,t),e.className=D(r)}else e.className=t}function Je(e,t){if(typeof e!=`function`){c(`Invalid resolver provided to createReactiveTextNode`);let e=x(``);if(!e)throw Error(`Failed to create text node: document not available`);return e}let n;if(arguments.length>1)n=t;else try{n=e()}catch(e){c(`Failed to evaluate reactive text resolver`,e),n=``}let r=n===void 0?``:String(n),i=x(r);if(!i)throw Error(`Failed to create text node: document not available`);return l&&te(i,{resolver:e,lastValue:r}),i}function Ye(e){let t=[];for(let n of h){let r=n.deref();if(r===void 0){t.push(n);continue}let i=g.get(r);if(!i){t.push(n);continue}let a=i.info;if(!w(r)){g.delete(r),t.push(n);continue}if(e&&!e.contains(r))continue;let o;try{o=a.resolver()}catch(e){c(`Failed to update reactive text node`,e),o=void 0}let s=o===void 0?``:String(o);s!==a.lastValue&&(r.textContent=s,a.lastValue=s)}for(let e of t)re(e)}function Xe(e,t,n,r=!1){if(n==null)return;if(t===`style`){Ve(e,n);return}let i=(n,r=!1)=>{if(n!=null){if(t===`className`&&e instanceof HTMLElement&&r){qe(e,String(n));return}if(e instanceof Element&&e.namespaceURI===`http://www.w3.org/2000/svg`)e.setAttribute(String(t),String(n));else if(t in e)try{e[t]=n}catch{e instanceof Element&&e.setAttribute(String(t),String(n))}else e instanceof Element&&e.setAttribute(String(t),String(n))}};if(o(n)&&n.length===0){let r=n;t===`className`&&e instanceof HTMLElement?(Ue(e),Re(e,String(t),r,function(t){Ke(e,String(t||``))})):Re(e,String(t),r,function(e){i(e,!1)})}else{if(t===`className`&&e instanceof HTMLElement&&We(e)){let t=String(n||``);t&&(Ge(e,t),qe(e,t));return}i(n,r)}}function O(e,t,n=!0){if(t)for(let r of Object.keys(t)){let i=t[r];Xe(e,r,i,n&&r===`className`)}}let k=!1,Ze=new WeakMap;function A(){return k}function Qe(){return!1}function $e(){k=!0,Ze=new WeakMap}function et(){k=!1}function tt(e){let t=k;k=!1;try{return e()}finally{k=t}}function j(e){let t=Ze.get(e);return t===void 0?e.firstChild:t}function M(e,t){Ze.set(e,t)}function nt(e){return e.nodeType===3&&!/\S/.test(e.textContent||``)}function N(e){let t=j(e),n=!1;for(;t&&nt(t);)t=t.nextSibling,n=!0;n&&M(e,t)}function P(e){let t=j(e);return t&&M(e,t.nextSibling),t}function rt(e,t){if(!k)return null;N(e);let n=j(e);return n&&n.nodeType===1&&n.tagName.toLowerCase()===t?P(e):null}function it(e,t){if(!t)return;let n=j(e);for(;n;){let r=n===t?null:n.nextSibling;e.removeChild(n),n=r}M(e,null)}let F=new WeakMap;function at(e){return r(e)&&!n(e)&&`className`in e&&typeof e.className==`string`&&Object.keys(e).length===1}function ot(e){N(e);let t=j(e);return!!t&&t.nodeType===8&&t.textContent?.trimStart().startsWith(`text-`)===!0}function st(e,t){let n=j(e);if(n&&n.nodeType===3)return P(e),n.textContent!==t&&(n.textContent=t),n;let r=x(t);return r?(e.insertBefore(r,n),M(e,n),r):null}function I(e,i,a){if(i==null)return null;if(o(i)){if(s(i))try{let n=F.get(i);if(n||(n={value:i(),error:!1},F.set(i,n)),n.error)return lt(a,()=>``);let r=n.value;if(at(r))return O(e,{className:()=>{let e=i();return at(e)?e.className:``}}),null;if(t(r)){let n=()=>{let e=i();return t(e)&&e!=null?e:``},o=r??``;if(A()&&ot(e)){let t=e;P(t);let r=String(o),i=st(t,r);return i&&te(i,{resolver:n,lastValue:r}),null}return lt(a,n,o)}return null}catch(e){return F.set(i,{value:void 0,error:!0}),c(`Error evaluating reactive text function:`,e),lt(a,()=>``)}let o=i(e,a);return o==null?null:t(o)?ut(a,o):n(o)?o:(r(o)&&O(e,o),null)}let l=i;if(t(l)){if(A()&&ot(e)){let t=e;return P(t),st(t,String(l)),null}return ut(a,l)}return n(l)?l:(O(e,l),null)}function ct(e,t){if(l&&!A()&&!Qe())return t;let n=_e();if(!n)throw Error(`Failed to create document fragment: document not available`);let r=C(` text-${e} `);return r&&n.appendChild(r),t&&n.appendChild(t),n}function lt(e,t,n){return ct(e,Je(t,n))}function ut(e,t){return ct(e,x(String(t)))}function L(e,t,n=0){if(!t||t.length===0)return;let r=n,i=e;for(let n=0;n<t.length;n+=1){let a=t[n];if(a==null)continue;let o=I(e,a,r);o&&(o.parentNode!==i&&i.appendChild(o),r+=1)}}function dt(e,t){let n=he(e);return L(n,t,0),n}function ft(e,t){let n=ge(me,e);if(!n)throw Error(`Failed to create SVG element: ${e}`);return L(n,t,0),n}function pt(e,...t){return function(n,r=0){let i=n,a=i?rt(i,e):null,o=a??he(e),s=o,c=a?s.lastChild:null;return L(o,t,r),a&&it(s,c),o}}function mt(e,...t){return function(n,r=0){let i=n,a=i?rt(i,e):null,o=a??ge(`http://www.w3.org/2000/svg`,e);if(!o)throw Error(`Failed to create SVG element: ${e}`);let s=o,c=a?s.lastChild:null;return L(o,t,r),a&&it(s,c),o}}function ht(e){return(...t)=>pt(e,...t)}function gt(e){return(...t)=>mt(e,...t)}let _t=`a.abbr.address.area.article.aside.audio.b.base.bdi.bdo.blockquote.body.br.button.canvas.caption.cite.code.col.colgroup.data.datalist.dd.del.details.dfn.dialog.div.dl.dt.em.embed.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.iframe.img.input.ins.kbd.label.legend.li.link.main.map.mark.menu.meta.meter.nav.noscript.object.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.script.search.section.select.slot.small.source.span.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.title.tr.track.u.ul.var.video.wbr`.split(`.`),vt=`a.animate.animateMotion.animateTransform.circle.clipPath.defs.desc.ellipse.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.foreignObject.g.image.line.linearGradient.marker.mask.metadata.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.svg.switch.symbol.text.textPath.title.tspan.use.view`.split(`.`),yt=[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`];function bt(e,t){if(t in e&&typeof e[t]!=`function`)return;let n=ht(t);e[t]=n,t===`var`&&(e.var_=n)}function xt(e,t){let n=`${t}Svg`;n in e||(e[n]=gt(t))}function St(e=globalThis){let t=`__nuclo_tags_registered`;if(!e[t]){for(let t=0;t<vt.length;t++)xt(e,vt[t]);for(let t=0;t<_t.length;t++)bt(e,_t[t]);e[t]=!0}}function Ct(e,t,n){if(o(e)){let r=e(t,n);return r&&i(r)?r:null}return e&&i(e)?e:null}function wt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}let R=new Set,z=new WeakMap,Tt=typeof FinalizationRegistry<`u`?new FinalizationRegistry(e=>{R.delete(e)}):null;function Et(e,t){let n=new WeakRef(e);R.add(n),z.set(e,t),Tt?.register(e,n)}function Dt(e){return Array.isArray(e)?e:Array.from(e)}function Ot(e,t,n){return Ct(e.renderItem(t,n),e.host,n)}function kt(e){let t=e;t.element=null,t.item=null}function B(e){S(e.element),kt(e)}function At(e,t,n,r){if(n.parentNode!==t||r.parentNode!==t)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=r.element;i&&i.parentNode===t&&t.removeChild(i),kt(r)}return!0}function jt(e){let t=e.length;if(t===0)return[];let n=Array(t),r=[];for(let i=0;i<t;i++){let t=e[i],a=0,o=r.length;for(;a<o;){let n=a+o>>1;e[r[n]]<t?a=n+1:o=n}n[i]=a>0?r[a-1]:-1,a===r.length?r.push(i):r[a]=i}let i=r.length,a=r[i-1],o=Array(i);for(;i>0;)o[--i]=a,a=n[a];return o}function Mt(e,t,n,r,i,a,o){let s=_e(),c=0;for(let l=r;l<i;l++){let r=n[l],i=Ot(e,r,l);if(!i)continue;o.push({item:r,element:i});let u=i;s?(s.appendChild(u),c++):t.insertBefore(u,a)}s&&c>0&&t.insertBefore(s,a)}function Nt(e,t){for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Pt(e){let{host:t,startMarker:n,endMarker:r}=e,i=n.parentNode??t,a=Dt(e.itemsProvider());if(wt(e.lastSyncedItems,a))return;let o=e.records,s=a.length;if(s===0){if(!At(o,i,n,r))for(let e=0;e<o.length;e++)B(o[e]);e.records=[],e.lastSyncedItems=[];return}if(o.length===0){let t=[];Mt(e,i,a,0,s,r,t),e.records=t,e.lastSyncedItems=a.slice();return}let c=e.lastSyncedItems;if(s>c.length&&Nt(c,a)){Mt(e,i,a,c.length,s,r,o),e.records=o,e.lastSyncedItems=a.slice();return}let l=new Map,u=new Map,d=new Map;for(let e=0;e<o.length;e++){let t=o[e];d.set(t,e);let n=u.get(t.item);n?n.push(t):u.set(t.item,[t])}for(let e=0;e<s;e++){let t=a[e];if(e<c.length&&c[e]===t){let n=o[e];if(n&&n.item===t){l.set(e,n);let r=u.get(t);r.splice(r.indexOf(n),1),r.length===0&&u.delete(t)}}}let f=Array(s),p=new Set(o),m=0;for(let t=s-1;t>=0;t--){let n=a[t],r=l.get(t);if(!r){let e=u.get(n);e&&e.length>0&&(r=e.shift(),e.length===0&&u.delete(n))}if(r)p.delete(r),m++;else{let i=Ot(e,n,t);if(!i){f[t]=null;continue}r={item:n,element:i}}f[t]=r}if(m===0){if(!At(o,i,n,r))for(let e of p)B(e)}else for(let e of p)B(e);let h=[],g=[];for(let e=0;e<s;e++){let t=f[e];if(!t)continue;let n=d.get(t);n!==void 0&&(h.push(e),g.push(n))}let _=new Set;if(g.length>0){let e=jt(g);for(let t=0;t<e.length;t++)_.add(h[e[t]])}let v=r,y=null;for(let e=s-1;e>=0;e--){let t=f[e];if(!t)continue;let n=t.element;if(!d.has(t)){y||=_e(),y?y.insertBefore(n,y.firstChild):(i.insertBefore(n,v),v=n);continue}if(y&&y.firstChild){let e=y.firstChild;i.insertBefore(y,v),v=e,y=null}_.has(e)||i.insertBefore(n,v),v=n}y&&y.firstChild&&i.insertBefore(y,v),e.records=f.filter(e=>e!==null),e.lastSyncedItems=a.slice()}function Ft(e,t,n,r){return A()?It(e,t,n,r):V(e,t,n,r)}function V(e,t,n,r){let{start:i,end:a}=Se(`list`,r),o={itemsProvider:e,renderItem:t,startMarker:i,endMarker:a,records:[],host:n,lastSyncedItems:[]},s=n;return s.appendChild(i),s.appendChild(a),Pt(o),l&&Et(i,o),o}function It(e,t,n,r){let i=n;N(i);let a=j(i);if(!a||a.nodeType!==8||!a.textContent?.startsWith(`list-start-`))return V(e,t,n,r);let o=P(i),s=0,c=j(i);for(;c;){if(c.nodeType===8){let e=c.textContent||``;if(e.startsWith(`list-start-`))s++;else if(e===`list-end`){if(s===0)break;s--}}c=c.nextSibling}let u=c;if(!u){let e=C(`list-end`);e&&(i.insertBefore(e,o.nextSibling),u=e)}if(!u)return V(e,t,n,r);let d=Dt(e()),f=[];for(let e=0;e<d.length;e++){let r=Ct(t(d[e],e),n,e);r&&f.push({item:d[e],element:r})}let p=j(i);for(;p&&p!==u;){let e=p.nextSibling;S(p),p=e}let m=u;for(let e=f.length-1;e>=0;e--){let t=f[e].element;(t.parentNode!==i||t.nextSibling!==m)&&i.insertBefore(t,m),m=t}M(i,u.nextSibling);let h={itemsProvider:e,renderItem:t,startMarker:o,endMarker:u,records:f,host:n,lastSyncedItems:d.slice()};return l&&Et(o,h),h}function Lt(e){for(let t=0;t<e.records.length;t++){let n=e.records[t];n.element=null,n.item=null}e.records=[]}function Rt(e){let t=[];for(let n of R){let r=n.deref();if(!r){t.push(n);continue}let i=z.get(r);if(!i){t.push(n);continue}if(!w(r)||!w(i.endMarker)){Lt(i),z.delete(r),t.push(n);continue}e&&!e.contains(r)||Pt(i)}for(let e of t)R.delete(e)}function zt(e,t){return function(n,r){return Ft(e,t,n,r).startMarker}}function Bt(e,t){try{return e()}catch(e){if(t)return t(e),!1;throw e}}function Vt(e,t){return typeof e==`function`?Bt(e,t):!!e}let H=new Set,U=new WeakMap,Ht=typeof FinalizationRegistry<`u`?new FinalizationRegistry(e=>{H.delete(e)}):null;function Ut(e,t){for(let t=0;t<e.length;t++)if(Vt(e[t].condition))return t;return t.length>0?-1:null}function Wt(e){let{groups:t,elseContent:n,host:r,index:i,endMarker:a}=e,o=Ut(t,n);o!==e.activeIndex&&(Ce(e.startMarker,e.endMarker),e.activeIndex=o,o!==null&&we(Jt(o>=0?t[o].content:n,r,i,a),a))}function Gt(e){let t=new WeakRef(e.startMarker);H.add(t),U.set(e.startMarker,e),Ht?.register(e.startMarker,t)}function Kt(e){let t=[];for(let n of H){let r=n.deref();if(r===void 0){t.push(n);continue}let i=U.get(r);if(!i){t.push(n);continue}if(!w(r)||!w(i.endMarker)){U.delete(r),t.push(n);continue}if(!(e&&!e.contains(r)))try{i.update()}catch(e){c(`when() branch threw during update; unregistering this conditional`,e),U.delete(r),t.push(n)}}for(let e of t)H.delete(e)}function qt(e,t,n,r){return o(e)?s(e)?(F.delete(e),I(t,e,n)):Oe(t,r,()=>{let r=I(t,e,n);return r&&!r.parentNode?r:null}):I(t,e,n)}function Jt(e,t,n,r){let i=[];for(let a of e){let e=qt(a,t,n,r);e&&i.push(e)}return i}function Yt(e,t){return`when-start-${e}-b${t===null?`n`:t}`}function Xt(e){let t=/-b(n|-?\d+)$/.exec(e||``);if(t)return t[1]===`n`?null:parseInt(t[1],10)}var Zt=class e{groups=[];elseContent=[];constructor(e,...t){this.groups.push({condition:e,content:t})}cloneWith(t,n){let r=Object.create(e.prototype);return r.groups=[...this.groups],t&&r.groups.push(t),r.elseContent=n??[...this.elseContent],r}when(e,...t){return this.groups.push({condition:e,content:t}),this}else(...e){return this.elseContent=e,this}render(e,t){return globalThis.document?A()?this.hydrateRender(e,t):this.freshRender(e,t):null}freshRender(e,t){let{start:n,end:r}=Se(`when`,t),i=this.createRuntimeFromMarkers(e,t,n,r),a=De(e);return a.appendChild(n),a.appendChild(r),Wt(i),n.textContent=Yt(t,i.activeIndex),n}hydrateRender(e,t){let n=e;N(n);let r=j(n);if(!r||r.nodeType!==8||!r.textContent?.startsWith(`when-start-`))return this.freshRender(e,t);let i=P(n),a=0,o=j(n);for(;o;){if(o.nodeType===8){let e=o.textContent||``;if(e.startsWith(`when-start-`))a++;else if(e===`when-end`){if(a===0)break;a--}}o=o.nextSibling}let s=o,c=!1;if(!s){let e=C(`when-end`);if(!e)return i;n.insertBefore(e,i.nextSibling),s=e,c=!0}let l=Ut(this.groups,this.elseContent),u=Xt(i.textContent);if(!c&&(u===void 0||u===l)){if(l!==null){let n=l>=0?this.groups[l].content:this.elseContent;for(let r of n)I(e,r,t)}}else if(Ce(i,s),l!==null){let n=l>=0?this.groups[l].content:this.elseContent,r=s;tt(()=>{we(Jt(n,e,t,r),r)})}return M(n,s.nextSibling),this.createRuntimeFromMarkers(e,t,i,s,l),i}createRuntimeFromMarkers(e,t,n,r,i=null){let a={startMarker:n,endMarker:r,host:e,index:t,groups:[...this.groups],elseContent:[...this.elseContent],activeIndex:i,update:function(){Wt(a)}};return l&&Gt(a),a}};function Qt(e){return Object.assign(function(t,n){return e.render(t,n)},{when:function(t,...n){return Qt(e.cloneWith({condition:t,content:n}))},else:function(...t){return Qt(e.cloneWith(void 0,t))}})}function $t(e,...t){return Qt(new Zt(e,...t))}function en(e){try{return e.isSvg?ft(e.tagName,e.modifiers):dt(e.tagName,e.modifiers)}catch(t){if(c(`Error applying modifiers in conditional element "${e.tagName}"`,t),e.isSvg){let n=ge(me,e.tagName);if(!n)throw Error(`Failed to create SVG element: ${e.tagName}`,{cause:t});return n}let n=he(e.tagName);if(!n)throw Error(`Failed to create element: ${e.tagName}`,{cause:t});return n}}function tn(e){let t=pe(e);if(!t)return;let n=Bt(t.condition,e=>{c(`Error evaluating conditional condition`,e)}),r=e.nodeType===Node.ELEMENT_NODE;if(n&&!r){let n=en(t);ue(n,t),Ee(e,n)}else if(!n&&r){let n=xe(t.tagName);n&&(ue(n,t),Ee(e,n))}}function nn(e){if(l)try{let t=fe();for(let n of t){if(!n.isConnected){de(n);continue}e&&!e.contains(n)||tn(n)}}catch(e){c(`Error during conditional elements update`,e)}}let W=new Map;function rn(e){let t=[],n=new Set;for(let r of e){if(typeof r!=`string`)continue;let e=r.trim();e&&(n.has(e)||(n.add(e),t.push(e)))}return t}function an(e,t){let n=W.get(e);n||(n=new Set,W.set(e,n)),n.add(new WeakRef(t))}function on(e){let t=rn(e);if(t.length===0)return[];let n=new Set;for(let e of t){let t=W.get(e);if(!t)continue;let r=[];for(let e of t){let t=e.deref();if(t===void 0){r.push(e);continue}if(!w(t)){r.push(e);continue}n.add(t)}for(let e of r)t.delete(e);t.size===0&&W.delete(e)}return Array.from(n)}function sn(...e){let t=rn(e);return function(e){if(l&&e instanceof Element)for(let n of t)an(n,e)}}let cn=[Rt,Kt,nn,ze,Ye,un];function ln(...e){let t;if(e.length>0){let n=on(e);if(n.length===1){let e=n[0];t={roots:n,contains:t=>e.contains(t)}}else t={roots:n,contains:e=>{for(let t of n)if(t.contains(e))return!0;return!1}}}for(let e of cn)e(t)}function un(e){if(typeof document>`u`)return;let t=e?e.roots:[document.body??document];for(let e of t)try{e.dispatchEvent(new Event(`update`,{bubbles:!0}))}catch(e){c(`Error dispatching global update event`,e)}}function dn(e,t,n=0){let r=t||document.body,i=e(r,n);return r.appendChild(i),i}function fn(e,t){let n=t||document.body,r=n;$e();try{let t=e(n,0),i=t;if(i&&i.nodeType===1&&i.parentNode!==r){let e=j(r);if(e){let t=e.nextSibling;r.insertBefore(i,e),S(e),M(r,t)}else r.appendChild(i),M(r,null)}return t}finally{et()}}let pn=null;function mn(e){pn=e}let hn=new Map,gn=new Map,_n=new Set,G=[],K=new Map,q=null,J=null,vn=null,Y=0,X=new Map;function yn(e){for(let t of e)K.has(t)||K.set(t,[])}function bn(e,t){try{let n=e.cssRules.length;e.insertRule(t+`{}`,n);let r=e.cssRules[n];return X.set(t,r),r}catch{return null}}function xn(e,t){try{e.insertRule(t,Y),Y++}catch{}}function Sn(){if(typeof document>`u`||typeof document.getElementById!=`function`)return null;if(J&&vn===document&&J.ownerNode&&J.ownerNode.isConnected)return J;let e=document.getElementById(`nuclo-styles`);if(e||(e=document.createElement(`style`),e.id=`nuclo-styles`,document.head.appendChild(e)),J=e.sheet,vn=document,X.clear(),Y=0,!J)return null;for(let e of G)xn(J,e);for(let[e,t]of K){let n=bn(J,e);if(n)for(let e of t)try{n.insertRule(e,n.cssRules.length)}catch{}}return J}function Cn(e,t){if(t===void 0)G.push(e);else{let n=K.get(t);n||(n=[],K.set(t,n)),n.push(e)}q=null,pn?.(t===void 0?e:t+`{`+e+`}`);let n=Sn();if(n)if(t===void 0)xn(n,e);else{let r=X.get(t)??bn(n,t);if(r)try{r.insertRule(e,r.cssRules.length)}catch{}}}function wn(e){let t=2166136261,n=2128831035;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);t=Math.imul(t^i,16777619),n=Math.imul(n^i,2246822507)}return(t>>>0).toString(36)+((n>>>9)%1296).toString(36)}function Z(e,t,n,r){let i=(e??``)+`|`+t+`|`+n+`:`+r,a=hn.get(i);return a===void 0?(a=`n`+wn(i),hn.set(i,a),gn.set(a,(e??``)+`|`+t+`|`+n),Cn(`.`+a+t+`{`+n+`:`+r+`}`,e),a):(Sn(),a)}function Tn(e){return gn.get(e)}function En(e,t){if(_n.has(e)){Sn();return}_n.add(e),Cn(t,void 0)}function Dn(){if(q!==null)return q;let e=G.join(``);for(let[t,n]of K)n.length>0&&(e+=t+`{`+n.join(``)+`}`);return q=e,e}function On(){hn.clear(),gn.clear(),_n.clear(),G.length=0,K.clear(),X.clear(),q=null,Y=0,J=null,vn=null,typeof document<`u`&&document.getElementById(`nuclo-styles`)?.remove()}let kn={hover:`:hover`,focus:`:focus`,focusVisible:`:focus-visible`,focusWithin:`:focus-within`,active:`:active`,visited:`:visited`,disabled:`:disabled`,enabled:`:enabled`,checked:`:checked`,required:`:required`,invalid:`:invalid`,valid:`:valid`,readOnly:`:read-only`,first:`:first-child`,last:`:last-child`,only:`:only-child`,odd:`:nth-child(odd)`,even:`:nth-child(even)`,empty:`:empty`,placeholderShown:`:placeholder-shown`,placeholder:`::placeholder`,before:`::before`,after:`::after`,selection:`::selection`,marker:`::marker`,firstLine:`::first-line`,firstLetter:`::first-letter`},An={bg:[`background`],p:[`padding`],px:[`padding-left`,`padding-right`],py:[`padding-top`,`padding-bottom`],pt:[`padding-top`],pr:[`padding-right`],pb:[`padding-bottom`],pl:[`padding-left`],m:[`margin`],mx:[`margin-left`,`margin-right`],my:[`margin-top`,`margin-bottom`],mt:[`margin-top`],mr:[`margin-right`],mb:[`margin-bottom`],ml:[`margin-left`],w:[`width`],h:[`height`],minW:[`min-width`],maxW:[`max-width`],minH:[`min-height`],maxH:[`max-height`],size:[`width`,`height`],text:[`font-size`],font:[`font-family`],weight:[`font-weight`],leading:[`line-height`],tracking:[`letter-spacing`],align:[`text-align`],items:[`align-items`],justify:[`justify-content`],z:[`z-index`],rounded:[`border-radius`],shadow:[`box-shadow`],select:[`user-select`]},jn={row:{display:`flex`,"flex-direction":`row`},col:{display:`flex`,"flex-direction":`column`},center:{"align-items":`center`,"justify-content":`center`},truncate:{overflow:`hidden`,"text-overflow":`ellipsis`,"white-space":`nowrap`}},Mn={background:`colors`,"background-color":`colors`,color:`colors`,"border-color":`colors`,"border-top-color":`colors`,"border-right-color":`colors`,"border-bottom-color":`colors`,"border-left-color":`colors`,"outline-color":`colors`,"caret-color":`colors`,"text-decoration-color":`colors`,"font-family":`fonts`,"box-shadow":`shadows`,"border-radius":`radii`},Nn=new Set([`z-index`,`opacity`,`font-weight`,`line-height`,`flex`,`flex-grow`,`flex-shrink`,`order`,`aspect-ratio`,`zoom`,`scale`,`column-count`,`orphans`,`widows`,`tab-size`,`animation-iteration-count`,`grid-column`,`grid-row`]),Pn=new Map;function Fn(e){let t=Pn.get(e);return t===void 0&&(t=e.replace(/[A-Z]/g,e=>`-`+e.toLowerCase()),Pn.set(e,t)),t}function In(e){return e.charCodeAt(0)===64?e:`@media `+e}function Ln(e,t){return e!==void 0&&e.startsWith(`@media`)&&t.startsWith(`@media`)?e+` and`+t.slice(6):t}function Rn(e){let t={className:e};return Object.defineProperty(t,"toString",{value:()=>e,enumerable:!1}),t}function zn(e,t){for(let n of e)if(n)if(typeof n==`string`)for(let e of n.split(` `))e&&t.set(Tn(e)??e,e);else if(Array.isArray(n))zn(n,t);else for(let e of n.className.split(` `))e&&t.set(Tn(e)??e,e)}function Q(...e){let t=new Map;zn(e,t);let n=``;for(let e of t.values())n+=(n?` `:``)+e;return Rn(n)}function Bn(e={}){let t=e.screens??{};yn(Object.values(t).map(In));let n=new WeakMap;function r(t,n){if(typeof n==`number`)return n===0||Nn.has(t)?String(n):n+`px`;let r=Mn[t];if(r!==void 0){let t=e[r]?.[n];if(t!==void 0)return t}return n}function i(e,n,a,o){for(let s in e){let c=e[s];if(c==null||c===!1)continue;if(typeof c==`object`){if(s===`raw`){let e=c;for(let t in e)o.push(Z(n,a,t,r(t,e[t])));continue}let e=kn[s];if(e!==void 0){i(c,n,a+e,o);continue}let l=t[s];if(l!==void 0){i(c,Ln(n,In(l)),a,o);continue}let u=s.charCodeAt(0);if(u===38){i(c,n,a+s.slice(1),o);continue}if(u===64){i(c,Ln(n,s),a,o);continue}continue}if(c===!0){let e=jn[s];if(e)for(let t in e)o.push(Z(n,a,t,e[t]));continue}let l=An[s];if(l!==void 0)for(let e of l)o.push(Z(n,a,e,r(e,c)));else{let e=Fn(s);o.push(Z(n,a,e,r(e,c)))}}}function a(e){let t=n.get(e);if(t)return t;let r=[];i(e,void 0,``,r);let a=Rn(r.join(` `));return n.set(e,a),a}function o(e){let t=``,n=(e,n)=>{t+=(t?`;`:``)+e+`:`+n};for(let t in e){let i=e[t];if(i==null||i===!1)continue;if(t===`raw`&&typeof i==`object`){let e=i;for(let t in e)n(t,r(t,e[t]));continue}if(typeof i==`object`)continue;if(i===!0){let e=jn[t];if(e)for(let t in e)n(t,e[t]);continue}let a=An[t];if(a!==void 0)for(let e of a)n(e,r(e,i));else{let e=Fn(t);n(e,r(e,i))}}return t}function s(e){let t=``;for(let n in e)t+=n+`{`+o(e[n])+`}`;let n=`nk`+wn(t);return En(n,`@keyframes `+n+`{`+t+`}`),n}function c(e,t){let n=e+`{`+o(t)+`}`;En(`g|`+n,n)}function l(e){let t=e=>e===!0?`true`:e===!1?`false`:String(e),n=e.variants??{},r=Object.keys(n),i=e.defaultVariants??{},o=e.base?a(e.base):null,s={};for(let e of r){let t=n[e],r={};for(let e in t)r[e]=a(t[e]);s[e]=r}let c=(e.compoundVariants??[]).map(e=>{let{css:n,...r}=e,i={};for(let e in r)i[e]=t(r[e]);return{conditions:i,result:a(n)}}),l=new Map;return function(e){let n={};for(let a of r){let r=(e?e[a]:void 0)??i[a];r!=null&&(n[a]=t(r))}let a=``;for(let e of r)a+=e+`=`+(n[e]??``)+`;`;let u=l.get(a);if(u)return u;let d=[];o&&d.push(o);for(let e of r){let t=n[e];if(t!==void 0){let n=s[e][t];n&&d.push(n)}}for(let e of c){let t=!0;for(let r in e.conditions)if(n[r]!==e.conditions[r]){t=!1;break}t&&d.push(e.result)}let f=Q(...d);return l.set(a,f),f}}return{css:a,cx:Q,variants:l,keyframes:s,globalStyle:c,theme:e}}let $=Bn({}),Vn=$.css,Hn=$.variants,Un=$.keyframes,Wn=$.globalStyle;function Gn(){St();let e=globalThis;e.list=zt,e.update=ln,e.when=$t,e.on=m,e.scope=sn,e.render=dn,e.hydrate=fn,e.createCss=Bn,e.css=Vn,e.cx=Q,e.variants=Hn,e.keyframes=Un,e.globalStyle=Wn}Gn(),e.HTML_TAGS=_t,e.SELF_CLOSING_TAGS=yt,e.SVG_TAGS=vt,e.appendChildren=Te,e.applyAttributes=O,e.applyNodeModifier=I,e.createComment=C,e.createConditionalComment=xe,e.createCss=Bn,e.createHtmlElementWithModifiers=dt,e.createHtmlTagBuilder=ht,e.createSvgElementWithModifiers=ft,e.createSvgTagBuilder=gt,e.css=Vn,e.cx=Q,e.getCssText=Dn,e.globalStyle=Wn,e.hydrate=fn,e.initializeRuntime=Gn,e.isBoolean=a,e.isBrowser=l,e.isFunction=o,e.isNode=n,e.isObject=r,e.isPrimitive=t,e.isTagLike=i,e.isZeroArityFunction=s,e.keyframes=Un,e.list=zt,e.on=m,e.registerGlobalTagBuilders=St,e.render=dn,e.replaceNodeSafely=Ee,e.resetStyles=On,e.scope=sn,e.setSSRCollector=mn,e.update=ln,e.variants=Hn,e.when=$t});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.Nuclo={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e===null||typeof e!=`object`&&typeof e!=`function`}function n(e){return e instanceof Node?!0:typeof e!=`object`||!e?!1:typeof e.nodeType==`number`}function r(e){return typeof e==`object`&&!!e}function i(e){return r(e)&&`tagName`in e}function a(e){return typeof e==`boolean`}function o(e){return typeof e==`function`}function s(e){return o(e)&&e.length===0}function c(e,t){typeof console<`u`&&console.error(`nuclo: ${e}`,t)}let l=typeof window<`u`&&typeof document<`u`,u=new WeakMap;function d(e,t){let n=u.get(e);n?n.push(t):u.set(e,[t])}function f(e,t){e.removeEventListener(t.type,t.wrapped,t.options)}function p(e,t){let n=u.get(e);if(!n)return;if(t===void 0){for(let t=0;t<n.length;t++)f(e,n[t]);u.delete(e);return}let r=0;for(let i=0;i<n.length;i++){let a=n[i];a.type===t?f(e,a):n[r++]=a}n.length=r,r===0&&u.delete(e)}function m(e,t,n){return function(r){if(!l||!r||typeof r.addEventListener!=`function`)return;let i=r,a=function(n){try{t.call(i,n)}catch(t){c(`Error in '${e}' listener`,t)}};i.addEventListener(e,a,n),d(i,{type:e,wrapped:a,options:n})}}let h=new Set,g=new WeakMap,_=new Set,v=new WeakMap,y=typeof FinalizationRegistry<`u`?new FinalizationRegistry(e=>{h.delete(e)}):null,b=typeof FinalizationRegistry<`u`?new FinalizationRegistry(e=>{_.delete(e)}):null;function ee(e,t){let n=g.get(e);if(n){n.info.resolver=t.resolver,n.info.lastValue=t.lastValue;return}let r=new WeakRef(e);h.add(r),g.set(e,{ref:r,info:t}),y?.register(e,r)}function x(e,t){let n=new WeakRef(e);_.add(n),v.set(e,{ref:n,info:t}),b?.register(e,n)}function S(e){h.delete(e)}function C(e){_.delete(e)}function te(e){let t=g.get(e);t&&(h.delete(t.ref),g.delete(e))}function w(e){let t=v.get(e);t&&(_.delete(t.ref),v.delete(e))}let T=new WeakMap,E=new Set,D=new WeakMap,ne=typeof FinalizationRegistry<`u`?new FinalizationRegistry(e=>{E.delete(e)}):null;function re(e,t){T.set(e,t);let n=new WeakRef(e);E.add(n),D.set(e,n),ne?.register(e,n)}function ie(e){T.delete(e);let t=D.get(e);t&&(E.delete(t),D.delete(e))}function ae(){let e=[],t=[];for(let n of E){let r=n.deref();r===void 0?t.push(n):e.push(r)}for(let e of t)E.delete(e);return e}function oe(e){return T.get(e)??null}let se=`http://www.w3.org/2000/svg`;function ce(e){return globalThis.document?document.createElement(e):null}function le(e,t){return globalThis.document?document.createElementNS(e,t):null}function O(e){return globalThis.document?document.createTextNode(e):null}function ue(){return globalThis.document?document.createDocumentFragment():null}function de(e,t){try{return e.appendChild(t),!0}catch(e){return c(`Failed to append child node`,e),!1}}function fe(e){if(e.nodeType===Node.ELEMENT_NODE){let t=e;p(t),w(t),ie(t)}else e.nodeType===Node.TEXT_NODE?te(e):e.nodeType===Node.COMMENT_NODE&&ie(e);if(e.childNodes&&e.childNodes.length>0)for(let t=0;t<e.childNodes.length;t++)fe(e.childNodes[t])}function k(e){if(!e?.parentNode)return!1;try{return fe(e),e.parentNode.removeChild(e),!0}catch(e){return c(`Failed to remove child node`,e),!1}}function pe(e,t,n){try{return e.insertBefore(t,n),!0}catch(e){return c(`Failed to insert node before reference`,e),!1}}function A(e){return globalThis.document?globalThis.document.createComment(e):null}function me(e,t=`hidden`){return globalThis.document?globalThis.document.createComment(`conditional-${e}-${t}`):null}function he(e,t){let n=A(`${e}-end`);if(!n)throw Error(`Failed to create comment: document not available`);let r=A(`${e}-start-${t}`);if(!r)throw Error(`Failed to create comment: document not available`);return{start:r,end:n}}function ge(e,t){let n=e.nextSibling;for(;n&&n!==t;){let e=n.nextSibling;k(n),n=e}}function _e(e,t){let n=t.parentNode;if(n)for(let r=0;r<e.length;r++)pe(n,e[r],t)}function ve(e,...t){if(!e)return e;for(let n=0;n<t.length;n++){let r=t[n];if(r!=null){let t;if(typeof r==`string`){let e=O(r);if(e)t=e;else continue}else t=r;de(e,t)}}return e}function j(e){return e?.isConnected===!0}function ye(e,t){if(!e?.parentNode)return!1;try{return e.parentNode.replaceChild(t,e),!0}catch(e){return c(`Error replacing conditional node`,e),!1}}function be(e){return e}function xe(e,t,n){let r=be(e),i=r.appendChild.bind(r),a=r.insertBefore.bind(r);r.appendChild=function(e){return a(e,t)};try{return n()}finally{r.appendChild=i}}function Se(e,t,n){try{if(n==null||n===``)return e.style[t]=``,!0;let r=String(n);return e.style[t]=r,!0}catch{return!1}}let Ce={},we=!1;function Te(e){let t=e.target;if(!t||typeof Node>`u`||!(t instanceof Node))return;let n=t;for(;n;){if(n instanceof Element){let e=v.get(n);e&&(j(n)?Ae(e.info):(C(e.ref),v.delete(n)))}n=n.parentNode}}function Ee(){we||typeof document>`u`||typeof document.addEventListener!=`function`||(document.addEventListener(`update`,Te,!0),we=!0)}function De(e){let t=v.get(e);if(t)return t.info;let n={attributeResolvers:new Map};return x(e,n),n}function Oe(e){return typeof e!=`object`||!e}function ke(e,t){let n;try{n=t.resolver()}catch(t){c(`Failed to resolve reactive attribute: ${e}`,t);return}let r=Oe(n);if(!(r&&Object.is(n,t.lastValue)))try{t.applyValue(n),t.lastValue=r?n:Ce}catch(t){c(`Failed to apply reactive attribute: ${e}`,t)}}function Ae(e){for(let[t,n]of e.attributeResolvers)ke(t,n)}function je(e,t,n,r){if(!(e instanceof Element)||!t||typeof n!=`function`){c(`Invalid parameters for registerAttributeResolver`);return}let i={resolver:n,applyValue:r,lastValue:Ce};if(!l){ke(t,i);return}Ee(),De(e).attributeResolvers.set(t,i),ke(t,i)}function Me(e){let t=[];for(let n of _){let r=n.deref();if(r===void 0){t.push(n);continue}let i=v.get(r);if(!i){t.push(n);continue}if(!j(r)){v.delete(r),t.push(n);continue}e&&!e.contains(r)||Ae(i.info)}for(let e of t)C(e)}function Ne(e,t){if(!(!e?.style||!t))for(let n in t)Se(e,n,t[n])||c(`Failed to set style property '${n}'`)}function Pe(e,t){e&&(o(t)?je(e,`style`,t,function(t){Ne(e,t)}):Ne(e,t))}let M=new WeakMap,Fe=new WeakSet;function Ie(e,t){let n=t.length,r=0;for(let i=0;i<=n;i++)(i===n||t.charCodeAt(i)===32)&&(i>r&&e.add(t.substring(r,i)),r=i+1)}function Le(e){let t=``;for(let n of e)t&&(t+=` `),t+=n;return t}function Re(e){if(e.className&&!M.has(e)){let t=new Set;Ie(t,e.className),M.set(e,t)}Fe.add(e)}function ze(e){return Fe.has(e)}function Be(e,t){if(!t)return;let n=M.get(e);n||(n=new Set,M.set(e,n)),Ie(n,t)}function Ve(e,t){let n=M.get(e);if(!n||n.size===0){e.className=t||``;return}if(!t){e.className=Le(n);return}let r=Le(n),i=t.length,a=0;for(let e=0;e<=i;e++)if(e===i||t.charCodeAt(e)===32){if(e>a){let i=t.substring(a,e);n.has(i)||(r+=` `+i)}a=e+1}e.className=r}function He(e,t){if(!t)return;let n=e.className;if(n&&n!==t){let r=new Set;Ie(r,n),Ie(r,t),e.className=Le(r)}else e.className=t}function Ue(e,t){if(typeof e!=`function`){c(`Invalid resolver provided to createReactiveTextNode`);let e=O(``);if(!e)throw Error(`Failed to create text node: document not available`);return e}let n;if(arguments.length>1)n=t;else try{n=e()}catch(e){c(`Failed to evaluate reactive text resolver`,e),n=``}let r=n===void 0?``:String(n),i=O(r);if(!i)throw Error(`Failed to create text node: document not available`);return l&&ee(i,{resolver:e,lastValue:r}),i}function We(e){let t=[];for(let n of h){let r=n.deref();if(r===void 0){t.push(n);continue}let i=g.get(r);if(!i){t.push(n);continue}let a=i.info;if(!j(r)){g.delete(r),t.push(n);continue}if(e&&!e.contains(r))continue;let o;try{o=a.resolver()}catch(e){c(`Failed to update reactive text node`,e),o=void 0}let s=o===void 0?``:String(o);s!==a.lastValue&&(r.textContent=s,a.lastValue=s)}for(let e of t)S(e)}function Ge(e,t,n,r=!1){if(n==null)return;if(t===`style`){Pe(e,n);return}let i=(n,r=!1)=>{if(n!=null){if(t===`className`&&e instanceof HTMLElement&&r){He(e,String(n));return}if(e instanceof Element&&e.namespaceURI===`http://www.w3.org/2000/svg`)e.setAttribute(String(t),String(n));else if(t in e)try{e[t]=n}catch{e instanceof Element&&e.setAttribute(String(t),String(n))}else e instanceof Element&&e.setAttribute(String(t),String(n))}};if(o(n)&&n.length===0){let r=n;t===`className`&&e instanceof HTMLElement?(Re(e),je(e,String(t),r,function(t){Ve(e,String(t||``))})):je(e,String(t),r,function(e){i(e,!1)})}else{if(t===`className`&&e instanceof HTMLElement&&ze(e)){let t=String(n||``);t&&(Be(e,t),He(e,t));return}i(n,r)}}function N(e,t,n=!0){if(t)for(let r of Object.keys(t)){let i=t[r];Ge(e,r,i,n&&r===`className`)}}let P=!1,Ke=new WeakMap;function F(){return P}function qe(){return!1}function Je(){P=!0,Ke=new WeakMap}function Ye(){P=!1}function Xe(e){let t=P;P=!1;try{return e()}finally{P=t}}function I(e){let t=Ke.get(e);return t===void 0?e.firstChild:t}function L(e,t){Ke.set(e,t)}function Ze(e){return e.nodeType===3&&!/\S/.test(e.textContent||``)}function R(e){let t=I(e),n=!1;for(;t&&Ze(t);)t=t.nextSibling,n=!0;n&&L(e,t)}function z(e){let t=I(e);return t&&L(e,t.nextSibling),t}function Qe(e,t){if(!P)return null;R(e);let n=I(e);return n&&n.nodeType===1&&n.tagName.toLowerCase()===t?z(e):null}function $e(e,t){if(!t)return;let n=I(e);for(;n;){let r=n===t?null:n.nextSibling;e.removeChild(n),n=r}L(e,null)}let B=new WeakMap;function et(e){return r(e)&&!n(e)&&`className`in e&&typeof e.className==`string`&&Object.keys(e).length===1}function tt(e){R(e);let t=I(e);return!!t&&t.nodeType===8&&t.textContent?.trimStart().startsWith(`text-`)===!0}function nt(e,t){let n=I(e);if(n&&n.nodeType===3)return z(e),n.textContent!==t&&(n.textContent=t),n;let r=O(t);return r?(e.insertBefore(r,n),L(e,n),r):null}function V(e,i,a){if(i==null)return null;if(o(i)){if(s(i))try{let n=B.get(i);if(n||(n={value:i(),error:!1},B.set(i,n)),n.error)return it(a,()=>``);let r=n.value;if(et(r))return N(e,{className:()=>{let e=i();return et(e)?e.className:``}}),null;if(t(r)){let n=()=>{let e=i();return t(e)&&e!=null?e:``},o=r??``;if(F()&&tt(e)){let t=e;z(t);let r=String(o),i=nt(t,r);return i&&ee(i,{resolver:n,lastValue:r}),null}return it(a,n,o)}return null}catch(e){return B.set(i,{value:void 0,error:!0}),c(`Error evaluating reactive text function:`,e),it(a,()=>``)}let o=i(e,a);return o==null?null:t(o)?at(a,o):n(o)?o:(r(o)&&N(e,o),null)}let l=i;if(t(l)){if(F()&&tt(e)){let t=e;return z(t),nt(t,String(l)),null}return at(a,l)}return n(l)?l:(N(e,l),null)}function rt(e,t){if(l&&!F()&&!qe())return t;let n=ue();if(!n)throw Error(`Failed to create document fragment: document not available`);let r=A(` text-${e} `);return r&&n.appendChild(r),t&&n.appendChild(t),n}function it(e,t,n){return rt(e,Ue(t,n))}function at(e,t){return rt(e,O(String(t)))}function H(e,t,n=0){if(!t||t.length===0)return;let r=n,i=e;for(let n=0;n<t.length;n+=1){let a=t[n];if(a==null)continue;let o=V(e,a,r);o&&(o.parentNode!==i&&i.appendChild(o),r+=1)}}function ot(e,t){let n=ce(e);return H(n,t,0),n}function st(e,t){let n=le(se,e);if(!n)throw Error(`Failed to create SVG element: ${e}`);return H(n,t,0),n}function ct(e,...t){return function(n,r=0){let i=n,a=i?Qe(i,e):null,o=a??ce(e),s=o,c=a?s.lastChild:null;return H(o,t,r),a&&$e(s,c),o}}function lt(e,...t){return function(n,r=0){let i=n,a=i?Qe(i,e):null,o=a??le(`http://www.w3.org/2000/svg`,e);if(!o)throw Error(`Failed to create SVG element: ${e}`);let s=o,c=a?s.lastChild:null;return H(o,t,r),a&&$e(s,c),o}}function ut(e){return(...t)=>ct(e,...t)}function dt(e){return(...t)=>lt(e,...t)}let ft=`a.abbr.address.area.article.aside.audio.b.base.bdi.bdo.blockquote.body.br.button.canvas.caption.cite.code.col.colgroup.data.datalist.dd.del.details.dfn.dialog.div.dl.dt.em.embed.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.iframe.img.input.ins.kbd.label.legend.li.link.main.map.mark.menu.meta.meter.nav.noscript.object.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.script.search.section.select.slot.small.source.span.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.title.tr.track.u.ul.var.video.wbr`.split(`.`),pt=`a.animate.animateMotion.animateTransform.circle.clipPath.defs.desc.ellipse.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.foreignObject.g.image.line.linearGradient.marker.mask.metadata.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.svg.switch.symbol.text.textPath.title.tspan.use.view`.split(`.`),mt=[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`];function ht(e,t){if(t in e&&typeof e[t]!=`function`)return;let n=ut(t);e[t]=n,t===`var`&&(e.var_=n)}function gt(e,t){let n=`${t}Svg`;n in e||(e[n]=dt(t))}function _t(e=globalThis){let t=`__nuclo_tags_registered`;if(!e[t]){for(let t=0;t<pt.length;t++)gt(e,pt[t]);for(let t=0;t<ft.length;t++)ht(e,ft[t]);e[t]=!0}}function vt(e,t,n){if(o(e)){let r=e(t,n);return r&&i(r)?r:null}return e&&i(e)?e:null}function yt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}let U=new Set,bt=new WeakMap,xt=typeof FinalizationRegistry<`u`?new FinalizationRegistry(e=>{U.delete(e)}):null;function St(e,t){let n=new WeakRef(e);U.add(n),bt.set(e,t),xt?.register(e,n)}function Ct(e){return Array.isArray(e)?e:Array.from(e)}function wt(e,t,n){return vt(e.renderItem(t,n),e.host,n)}function W(e){k(e.element)}function Tt(e,t,n,r){if(n.parentNode!==t||r.parentNode!==t)return!1;for(let n=0;n<e.length;n++){let r=e[n].element;r&&r.parentNode===t&&t.removeChild(r)}return!0}function Et(e){let t=e.length;if(t===0)return[];let n=Array(t),r=[];for(let i=0;i<t;i++){let t=e[i],a=0,o=r.length;for(;a<o;){let n=a+o>>1;e[r[n]]<t?a=n+1:o=n}n[i]=a>0?r[a-1]:-1,a===r.length?r.push(i):r[a]=i}let i=r.length,a=r[i-1],o=Array(i);for(;i>0;)o[--i]=a,a=n[a];return o}function Dt(e,t,n,r,i,a,o){let s=ue(),c=0;for(let l=r;l<i;l++){let r=n[l],i=wt(e,r,l);if(!i)continue;o.push({item:r,element:i});let u=i;s?(s.appendChild(u),c++):t.insertBefore(u,a)}s&&c>0&&t.insertBefore(s,a)}function Ot(e){let{startMarker:t,endMarker:n}=e,r=t.parentNode??e.host,i=Ct(e.itemsProvider());if(yt(e.lastSyncedItems,i))return;let a=e.records,o=a.length,s=i.length;if(s===0){if(o>0&&!Tt(a,r,t,n))for(let e=0;e<o;e++)W(a[e]);e.records=[],e.lastSyncedItems=[];return}let c=0,l=Math.min(o,s);for(;c<l&&a[c].item===i[c];)c++;let u=0,d=l-c;for(;u<d&&a[o-1-u].item===i[s-1-u];)u++;let f=c,p=o-u,m=c,h=s-u;if(f===p){let t=p<o?a[p].element:n;if(p===o)Dt(e,r,i,m,h,t,a);else{let n=[];Dt(e,r,i,m,h,t,n),e.records=a.slice(0,f).concat(n,a.slice(f))}e.lastSyncedItems=i.slice();return}if(m===h){for(let e=f;e<p;e++)W(a[e]);a.splice(f,p-f),e.lastSyncedItems=i.slice();return}let g=p-f,_=h-m,v=Array(_).fill(-1),y=new Uint8Array(g),b=0,ee=Math.min(p,h);for(let e=c;e<ee;e++)a[e].item===i[e]&&(v[e-m]=e,y[e-f]=1,b++);let x=new Map;for(let e=f;e<p;e++){if(y[e-f])continue;let t=a[e].item,n=x.get(t);n===void 0?x.set(t,e):typeof n==`number`?x.set(t,[n,e]):n.push(e)}for(let e=0;e<_;e++){if(v[e]!==-1)continue;let t=x.get(i[m+e]);if(t===void 0)continue;let n;typeof t==`number`?(n=t,x.delete(i[m+e])):(n=t.shift(),t.length===0&&x.delete(i[m+e])),v[e]=n,y[n-f]=1,b++}if(b===0&&f===0&&p===o){if(!Tt(a,r,t,n))for(let e=0;e<o;e++)W(a[e]);let c=[];Dt(e,r,i,0,s,n,c),e.records=c,e.lastSyncedItems=i.slice();return}for(let e=f;e<p;e++)y[e-f]||W(a[e]);let S=null;if(b>0){let e=[],t=[];for(let n=0;n<_;n++)v[n]!==-1&&(e.push(v[n]),t.push(n));S=new Uint8Array(_);let n=Et(e);for(let e=0;e<n.length;e++)S[t[n[e]]]=1}let C=Array(_),te=0,w=p<o?a[p].element:n,T=null;for(let t=_-1;t>=0;t--){let n=v[t];if(n===-1){let n=i[m+t],a=wt(e,n,m+t);if(!a){C[t]=null,te++;continue}C[t]={item:n,element:a};let o=a;T||=ue(),T?T.insertBefore(o,T.firstChild):(r.insertBefore(o,w),w=o);continue}let o=a[n];C[t]=o;let s=o.element;if(T&&T.firstChild){let e=T.firstChild;r.insertBefore(T,w),w=e,T=null}(!S||!S[t])&&r.insertBefore(s,w),w=s}T&&T.firstChild&&r.insertBefore(T,w);let E=Array(f+(_-te)+(o-p)),D=0;for(let e=0;e<f;e++)E[D++]=a[e];for(let e=0;e<_;e++){let t=C[e];t&&(E[D++]=t)}for(let e=p;e<o;e++)E[D++]=a[e];e.records=E,e.lastSyncedItems=i.slice()}function kt(e,t,n,r){return F()?jt(e,t,n,r):At(e,t,n,r)}function At(e,t,n,r){let{start:i,end:a}=he(`list`,r),o={itemsProvider:e,renderItem:t,startMarker:i,endMarker:a,records:[],host:n,lastSyncedItems:[]},s=n;return s.appendChild(i),s.appendChild(a),Ot(o),l&&St(i,o),o}function jt(e,t,n,r){let i=n;R(i);let a=I(i);if(!a||a.nodeType!==8||!a.textContent?.startsWith(`list-start-`))return At(e,t,n,r);let o=z(i),s=0,c=I(i);for(;c;){if(c.nodeType===8){let e=c.textContent||``;if(e.startsWith(`list-start-`))s++;else if(e===`list-end`){if(s===0)break;s--}}c=c.nextSibling}let u=c;if(!u){let e=A(`list-end`);e&&(i.insertBefore(e,o.nextSibling),u=e)}if(!u)return At(e,t,n,r);let d=Ct(e()),f=[];for(let e=0;e<d.length;e++){let r=vt(t(d[e],e),n,e);r&&f.push({item:d[e],element:r})}let p=I(i);for(;p&&p!==u;){let e=p.nextSibling;k(p),p=e}let m=u;for(let e=f.length-1;e>=0;e--){let t=f[e].element;(t.parentNode!==i||t.nextSibling!==m)&&i.insertBefore(t,m),m=t}L(i,u.nextSibling);let h={itemsProvider:e,renderItem:t,startMarker:o,endMarker:u,records:f,host:n,lastSyncedItems:d.slice()};return l&&St(o,h),h}function Mt(e){for(let t=0;t<e.records.length;t++){let n=e.records[t];n.element=null,n.item=null}e.records=[],e.lastSyncedItems=[]}function Nt(e){let t=[];for(let n of U){let r=n.deref();if(!r){t.push(n);continue}let i=bt.get(r);if(!i){t.push(n);continue}if(!j(r)||!j(i.endMarker)){Mt(i),bt.delete(r),t.push(n);continue}e&&!e.contains(r)||Ot(i)}for(let e of t)U.delete(e)}function Pt(e,t){return function(n,r){return kt(e,t,n,r).startMarker}}function Ft(e,t){try{return e()}catch(e){if(t)return t(e),!1;throw e}}function It(e,t){return typeof e==`function`?Ft(e,t):!!e}let Lt=new Set,G=new WeakMap,Rt=typeof FinalizationRegistry<`u`?new FinalizationRegistry(e=>{Lt.delete(e)}):null;function zt(e,t){for(let t=0;t<e.length;t++)if(It(e[t].condition))return t;return t.length>0?-1:null}function Bt(e){let{groups:t,elseContent:n,host:r,index:i,endMarker:a}=e,o=zt(t,n);o!==e.activeIndex&&(ge(e.startMarker,e.endMarker),e.activeIndex=o,o!==null&&_e(Wt(o>=0?t[o].content:n,r,i,a),a))}function Vt(e){let t=new WeakRef(e.startMarker);Lt.add(t),G.set(e.startMarker,e),Rt?.register(e.startMarker,t)}function Ht(e){let t=[];for(let n of Lt){let r=n.deref();if(r===void 0){t.push(n);continue}let i=G.get(r);if(!i){t.push(n);continue}if(!j(r)||!j(i.endMarker)){G.delete(r),t.push(n);continue}if(!(e&&!e.contains(r)))try{i.update()}catch(e){c(`when() branch threw during update; unregistering this conditional`,e),G.delete(r),t.push(n)}}for(let e of t)Lt.delete(e)}function Ut(e,t,n,r){return o(e)?s(e)?(B.delete(e),V(t,e,n)):xe(t,r,()=>{let r=V(t,e,n);return r&&!r.parentNode?r:null}):V(t,e,n)}function Wt(e,t,n,r){let i=[];for(let a of e){let e=Ut(a,t,n,r);e&&i.push(e)}return i}function Gt(e,t){return`when-start-${e}-b${t===null?`n`:t}`}function Kt(e){let t=/-b(n|-?\d+)$/.exec(e||``);if(t)return t[1]===`n`?null:parseInt(t[1],10)}var qt=class e{groups=[];elseContent=[];constructor(e,...t){this.groups.push({condition:e,content:t})}cloneWith(t,n){let r=Object.create(e.prototype);return r.groups=[...this.groups],t&&r.groups.push(t),r.elseContent=n??[...this.elseContent],r}when(e,...t){return this.groups.push({condition:e,content:t}),this}else(...e){return this.elseContent=e,this}render(e,t){return globalThis.document?F()?this.hydrateRender(e,t):this.freshRender(e,t):null}freshRender(e,t){let{start:n,end:r}=he(`when`,t),i=this.createRuntimeFromMarkers(e,t,n,r),a=be(e);return a.appendChild(n),a.appendChild(r),Bt(i),n.textContent=Gt(t,i.activeIndex),n}hydrateRender(e,t){let n=e;R(n);let r=I(n);if(!r||r.nodeType!==8||!r.textContent?.startsWith(`when-start-`))return this.freshRender(e,t);let i=z(n),a=0,o=I(n);for(;o;){if(o.nodeType===8){let e=o.textContent||``;if(e.startsWith(`when-start-`))a++;else if(e===`when-end`){if(a===0)break;a--}}o=o.nextSibling}let s=o,c=!1;if(!s){let e=A(`when-end`);if(!e)return i;n.insertBefore(e,i.nextSibling),s=e,c=!0}let l=zt(this.groups,this.elseContent),u=Kt(i.textContent);if(!c&&(u===void 0||u===l)){if(l!==null){let n=l>=0?this.groups[l].content:this.elseContent;for(let r of n)V(e,r,t)}}else if(ge(i,s),l!==null){let n=l>=0?this.groups[l].content:this.elseContent,r=s;Xe(()=>{_e(Wt(n,e,t,r),r)})}return L(n,s.nextSibling),this.createRuntimeFromMarkers(e,t,i,s,l),i}createRuntimeFromMarkers(e,t,n,r,i=null){let a={startMarker:n,endMarker:r,host:e,index:t,groups:[...this.groups],elseContent:[...this.elseContent],activeIndex:i,update:function(){Bt(a)}};return l&&Vt(a),a}};function Jt(e){return Object.assign(function(t,n){return e.render(t,n)},{when:function(t,...n){return Jt(e.cloneWith({condition:t,content:n}))},else:function(...t){return Jt(e.cloneWith(void 0,t))}})}function Yt(e,...t){return Jt(new qt(e,...t))}function Xt(e){try{return e.isSvg?st(e.tagName,e.modifiers):ot(e.tagName,e.modifiers)}catch(t){if(c(`Error applying modifiers in conditional element "${e.tagName}"`,t),e.isSvg){let n=le(se,e.tagName);if(!n)throw Error(`Failed to create SVG element: ${e.tagName}`,{cause:t});return n}let n=ce(e.tagName);if(!n)throw Error(`Failed to create element: ${e.tagName}`,{cause:t});return n}}function Zt(e){let t=oe(e);if(!t)return;let n=Ft(t.condition,e=>{c(`Error evaluating conditional condition`,e)}),r=e.nodeType===Node.ELEMENT_NODE;if(n&&!r){let n=Xt(t);re(n,t),ye(e,n)}else if(!n&&r){let n=me(t.tagName);n&&(re(n,t),ye(e,n))}}function Qt(e){if(l)try{let t=ae();for(let n of t){if(!n.isConnected){ie(n);continue}e&&!e.contains(n)||Zt(n)}}catch(e){c(`Error during conditional elements update`,e)}}let K=new Map;function $t(e){let t=[],n=new Set;for(let r of e){if(typeof r!=`string`)continue;let e=r.trim();e&&(n.has(e)||(n.add(e),t.push(e)))}return t}function en(e,t){let n=K.get(e);n||(n=new Set,K.set(e,n)),n.add(new WeakRef(t))}function tn(e){let t=$t(e);if(t.length===0)return[];let n=new Set;for(let e of t){let t=K.get(e);if(!t)continue;let r=[];for(let e of t){let t=e.deref();if(t===void 0){r.push(e);continue}if(!j(t)){r.push(e);continue}n.add(t)}for(let e of r)t.delete(e);t.size===0&&K.delete(e)}return Array.from(n)}function nn(...e){let t=$t(e);return function(e){if(l&&e instanceof Element)for(let n of t)en(n,e)}}let rn=[Nt,Ht,Qt,Me,We,on];function an(...e){let t;if(e.length>0){let n=tn(e);if(n.length===1){let e=n[0];t={roots:n,contains:t=>e.contains(t)}}else t={roots:n,contains:e=>{for(let t of n)if(t.contains(e))return!0;return!1}}}for(let e of rn)e(t)}function on(e){if(typeof document>`u`)return;let t=e?e.roots:[document.body??document];for(let e of t)try{e.dispatchEvent(new Event(`update`,{bubbles:!0}))}catch(e){c(`Error dispatching global update event`,e)}}function sn(e,t,n=0){let r=t||document.body,i=e(r,n);return r.appendChild(i),i}function cn(e,t){let n=t||document.body,r=n;Je();try{let t=e(n,0),i=t;if(i&&i.nodeType===1&&i.parentNode!==r){let e=I(r);if(e){let t=e.nextSibling;r.insertBefore(i,e),k(e),L(r,t)}else r.appendChild(i),L(r,null)}return t}finally{Ye()}}let ln=null;function un(e){ln=e}let dn=new Map,fn=new Map,pn=new Set,q=[],J=new Map,Y=null,X=null,mn=null,Z=0,Q=new Map;function hn(e){for(let t of e)J.has(t)||J.set(t,[])}function gn(e,t){try{let n=e.cssRules.length;e.insertRule(t+`{}`,n);let r=e.cssRules[n];return Q.set(t,r),r}catch{return null}}function _n(e,t){try{e.insertRule(t,Z),Z++}catch{}}function vn(){if(typeof document>`u`||typeof document.getElementById!=`function`)return null;if(X&&mn===document&&X.ownerNode&&X.ownerNode.isConnected)return X;let e=document.getElementById(`nuclo-styles`);if(e||(e=document.createElement(`style`),e.id=`nuclo-styles`,document.head.appendChild(e)),X=e.sheet,mn=document,Q.clear(),Z=0,!X)return null;for(let e of q)_n(X,e);for(let[e,t]of J){let n=gn(X,e);if(n)for(let e of t)try{n.insertRule(e,n.cssRules.length)}catch{}}return X}function yn(e,t){if(t===void 0)q.push(e);else{let n=J.get(t);n||(n=[],J.set(t,n)),n.push(e)}Y=null,ln?.(t===void 0?e:t+`{`+e+`}`);let n=vn();if(n)if(t===void 0)_n(n,e);else{let r=Q.get(t)??gn(n,t);if(r)try{r.insertRule(e,r.cssRules.length)}catch{}}}function bn(e){let t=2166136261,n=2128831035;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);t=Math.imul(t^i,16777619),n=Math.imul(n^i,2246822507)}return(t>>>0).toString(36)+((n>>>9)%1296).toString(36)}function $(e,t,n,r){let i=(e??``)+`|`+t+`|`+n+`:`+r,a=dn.get(i);return a===void 0?(a=`n`+bn(i),dn.set(i,a),fn.set(a,(e??``)+`|`+t+`|`+n),yn(`.`+a+t+`{`+n+`:`+r+`}`,e),a):(vn(),a)}function xn(e){return fn.get(e)}function Sn(e,t){if(pn.has(e)){vn();return}pn.add(e),yn(t,void 0)}function Cn(){if(Y!==null)return Y;let e=q.join(``);for(let[t,n]of J)n.length>0&&(e+=t+`{`+n.join(``)+`}`);return Y=e,e}function wn(){dn.clear(),fn.clear(),pn.clear(),q.length=0,J.clear(),Q.clear(),Y=null,Z=0,X=null,mn=null,typeof document<`u`&&document.getElementById(`nuclo-styles`)?.remove()}let Tn={hover:`:hover`,focus:`:focus`,focusVisible:`:focus-visible`,focusWithin:`:focus-within`,active:`:active`,visited:`:visited`,disabled:`:disabled`,enabled:`:enabled`,checked:`:checked`,required:`:required`,invalid:`:invalid`,valid:`:valid`,readOnly:`:read-only`,first:`:first-child`,last:`:last-child`,only:`:only-child`,odd:`:nth-child(odd)`,even:`:nth-child(even)`,empty:`:empty`,placeholderShown:`:placeholder-shown`,placeholder:`::placeholder`,before:`::before`,after:`::after`,selection:`::selection`,marker:`::marker`,firstLine:`::first-line`,firstLetter:`::first-letter`},En={bg:[`background`],p:[`padding`],px:[`padding-left`,`padding-right`],py:[`padding-top`,`padding-bottom`],pt:[`padding-top`],pr:[`padding-right`],pb:[`padding-bottom`],pl:[`padding-left`],m:[`margin`],mx:[`margin-left`,`margin-right`],my:[`margin-top`,`margin-bottom`],mt:[`margin-top`],mr:[`margin-right`],mb:[`margin-bottom`],ml:[`margin-left`],w:[`width`],h:[`height`],minW:[`min-width`],maxW:[`max-width`],minH:[`min-height`],maxH:[`max-height`],size:[`width`,`height`],text:[`font-size`],font:[`font-family`],weight:[`font-weight`],leading:[`line-height`],tracking:[`letter-spacing`],align:[`text-align`],items:[`align-items`],justify:[`justify-content`],z:[`z-index`],rounded:[`border-radius`],shadow:[`box-shadow`],select:[`user-select`]},Dn={row:{display:`flex`,"flex-direction":`row`},col:{display:`flex`,"flex-direction":`column`},center:{"align-items":`center`,"justify-content":`center`},truncate:{overflow:`hidden`,"text-overflow":`ellipsis`,"white-space":`nowrap`}},On={background:`colors`,"background-color":`colors`,color:`colors`,"border-color":`colors`,"border-top-color":`colors`,"border-right-color":`colors`,"border-bottom-color":`colors`,"border-left-color":`colors`,"outline-color":`colors`,"caret-color":`colors`,"text-decoration-color":`colors`,"font-family":`fonts`,"box-shadow":`shadows`,"border-radius":`radii`},kn=new Set([`z-index`,`opacity`,`font-weight`,`line-height`,`flex`,`flex-grow`,`flex-shrink`,`order`,`aspect-ratio`,`zoom`,`scale`,`column-count`,`orphans`,`widows`,`tab-size`,`animation-iteration-count`,`grid-column`,`grid-row`]),An=new Map;function jn(e){let t=An.get(e);return t===void 0&&(t=e.replace(/[A-Z]/g,e=>`-`+e.toLowerCase()),An.set(e,t)),t}function Mn(e){return e.charCodeAt(0)===64?e:`@media `+e}function Nn(e,t){return e!==void 0&&e.startsWith(`@media`)&&t.startsWith(`@media`)?e+` and`+t.slice(6):t}function Pn(e){let t={className:e};return Object.defineProperty(t,"toString",{value:()=>e,enumerable:!1}),t}function Fn(e,t){for(let n of e)if(n)if(typeof n==`string`)for(let e of n.split(` `))e&&t.set(xn(e)??e,e);else if(Array.isArray(n))Fn(n,t);else for(let e of n.className.split(` `))e&&t.set(xn(e)??e,e)}function In(...e){let t=new Map;Fn(e,t);let n=``;for(let e of t.values())n+=(n?` `:``)+e;return Pn(n)}function Ln(e={}){let t=e.screens??{};hn(Object.values(t).map(Mn));let n=new WeakMap;function r(t,n){if(typeof n==`number`)return n===0||kn.has(t)?String(n):n+`px`;let r=On[t];if(r!==void 0){let t=e[r]?.[n];if(t!==void 0)return t}return n}function i(e,n,a,o){for(let s in e){let c=e[s];if(c==null||c===!1)continue;if(typeof c==`object`){if(s===`raw`){let e=c;for(let t in e)o.push($(n,a,t,r(t,e[t])));continue}let e=Tn[s];if(e!==void 0){i(c,n,a+e,o);continue}let l=t[s];if(l!==void 0){i(c,Nn(n,Mn(l)),a,o);continue}let u=s.charCodeAt(0);if(u===38){i(c,n,a+s.slice(1),o);continue}if(u===64){i(c,Nn(n,s),a,o);continue}continue}if(c===!0){let e=Dn[s];if(e)for(let t in e)o.push($(n,a,t,e[t]));continue}let l=En[s];if(l!==void 0)for(let e of l)o.push($(n,a,e,r(e,c)));else{let e=jn(s);o.push($(n,a,e,r(e,c)))}}}function a(e){let t=n.get(e);if(t)return t;let r=[];i(e,void 0,``,r);let a=Pn(r.join(` `));return n.set(e,a),a}function o(e){let t=``,n=(e,n)=>{t+=(t?`;`:``)+e+`:`+n};for(let t in e){let i=e[t];if(i==null||i===!1)continue;if(t===`raw`&&typeof i==`object`){let e=i;for(let t in e)n(t,r(t,e[t]));continue}if(typeof i==`object`)continue;if(i===!0){let e=Dn[t];if(e)for(let t in e)n(t,e[t]);continue}let a=En[t];if(a!==void 0)for(let e of a)n(e,r(e,i));else{let e=jn(t);n(e,r(e,i))}}return t}function s(e){let t=``;for(let n in e)t+=n+`{`+o(e[n])+`}`;let n=`nk`+bn(t);return Sn(n,`@keyframes `+n+`{`+t+`}`),n}function c(e,t){let n=e+`{`+o(t)+`}`;Sn(`g|`+n,n)}function l(e){let t=e=>e===!0?`true`:e===!1?`false`:String(e),n=e.variants??{},r=Object.keys(n),i=e.defaultVariants??{},o=e.base?a(e.base):null,s={};for(let e of r){let t=n[e],r={};for(let e in t)r[e]=a(t[e]);s[e]=r}let c=(e.compoundVariants??[]).map(e=>{let{css:n,...r}=e,i={};for(let e in r)i[e]=t(r[e]);return{conditions:i,result:a(n)}}),l=new Map;return function(e){let n={};for(let a of r){let r=(e?e[a]:void 0)??i[a];r!=null&&(n[a]=t(r))}let a=``;for(let e of r)a+=e+`=`+(n[e]??``)+`;`;let u=l.get(a);if(u)return u;let d=[];o&&d.push(o);for(let e of r){let t=n[e];if(t!==void 0){let n=s[e][t];n&&d.push(n)}}for(let e of c){let t=!0;for(let r in e.conditions)if(n[r]!==e.conditions[r]){t=!1;break}t&&d.push(e.result)}let f=In(...d);return l.set(a,f),f}}return{css:a,cx:In,variants:l,keyframes:s,globalStyle:c,theme:e}}let Rn=Ln({}),zn=Rn.css,Bn=Rn.variants,Vn=Rn.keyframes,Hn=Rn.globalStyle;function Un(){_t();let e=globalThis;e.list=Pt,e.update=an,e.when=Yt,e.on=m,e.scope=nn,e.render=sn,e.hydrate=cn,e.createCss=Ln,e.css=zn,e.cx=In,e.variants=Bn,e.keyframes=Vn,e.globalStyle=Hn}Un(),e.HTML_TAGS=ft,e.SELF_CLOSING_TAGS=mt,e.SVG_TAGS=pt,e.appendChildren=ve,e.applyAttributes=N,e.applyNodeModifier=V,e.createComment=A,e.createConditionalComment=me,e.createCss=Ln,e.createHtmlElementWithModifiers=ot,e.createHtmlTagBuilder=ut,e.createSvgElementWithModifiers=st,e.createSvgTagBuilder=dt,e.css=zn,e.cx=In,e.getCssText=Cn,e.globalStyle=Hn,e.hydrate=cn,e.initializeRuntime=Un,e.isBoolean=a,e.isBrowser=l,e.isFunction=o,e.isNode=n,e.isObject=r,e.isPrimitive=t,e.isTagLike=i,e.isZeroArityFunction=s,e.keyframes=Vn,e.list=Pt,e.on=m,e.registerGlobalTagBuilders=_t,e.render=sn,e.replaceNodeSafely=ye,e.resetStyles=wn,e.scope=nn,e.setSSRCollector=un,e.update=an,e.variants=Bn,e.when=Yt});
2
2
  //# sourceMappingURL=nuclo.umd.js.map