@jsswift/core 1.0.49 → 1.0.51

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/cms.js CHANGED
@@ -648,7 +648,10 @@
648
648
 
649
649
  // scroll lock + focus
650
650
  if (opts.lockScroll) lockScroll();
651
- if (opts.autoFocus !== false) setTimeout(() => focusFirst(panel), 0);
651
+ if (opts.autoFocus !== false) setTimeout(() => {
652
+ // Respect focus deliberately assigned by an onOpen callback.
653
+ if (panel.isConnected && stack.get(id) === entry && !panel.contains(document.activeElement)) focusFirst(panel);
654
+ }, 0);
652
655
 
653
656
  // positioning (for menus/tooltips)
654
657
  const position = (nextOpts = null) => {
package/dist/cms.min.js CHANGED
@@ -1 +1 @@
1
- (()=>{var Fe,Ie,Be,je,Ue,We,He,qe,$e;window.JSswift=window.JSswift||{};const i=window.JSswift;window._=window.JSswift,i.config=i.config||{};const Ve=typeof globalThis!="undefined"&&globalThis.JSswift_setting?globalThis.JSswift_setting:{};i.config.debug=(Fe=Ve.modeDev)!=null?Fe:!1,i.isDev=function(){return i.config.debug},i.uiNormalizeArgs=function(e){let t={},n=e;return e.length>0&&typeof e[0]=="object"&&e[0]!==null&&!e[0].nodeType&&!Array.isArray(e[0])&&!(e[0]instanceof Function)&&(t=e[0],n=e.slice(1)),{props:t,children:n}},i.uiSizes=["xxs","xs","sm","md","lg","xl","xxl","xxxl"],i.uiColors=["primary","secondary","success","warning","danger","info","light","dark"],i.meta=i.meta||{version:"1.0.23",policy:{sourceOfTruth:"docDevelop/reference/core.md",syncRule:"Quando cambia un modulo core, aggiornare sia questo meta sia docDevelop/reference/core.md."},modules:{render:{description:"Bridge props -> DOM per hyperscript _, attributi, class, style, eventi e children reattivi.",entrypoints:["createElement","setProp","bindProp"],status:"milestone-3-closed",knownLimits:["Il mini-terzo-giro e il successivo micro-giro avanzato hanno chiuso style dinamico, eventi, children e props/attr speciali, ma restano altri edge case avanzati da esplorare.","Gli eventi ora supportano composizione base di listener multipli, ma non hanno ancora delegation o diff avanzato.","Restano da esplorare edge case avanzati del renderer oltre ai giri gia coperti dai test."]},reactive:{description:"Core minimale signal/effect usato come base della reattivita.",entrypoints:["JSswift.reactive.signal","JSswift.reactive.effect","JSswift.reactive.computed","JSswift.reactive.untracked","JSswift.reactive.batch"],status:"milestone-2-closed",knownLimits:["La protezione loop copre i loop sincroni per singolo effect, non ancora i cicli complessi tra effect multipli.","Il batching sincrono ora esiste, ma manca ancora scheduling configurabile oltre il flush immediato a fine batch.","Mancano primitive avanzate per controllare scheduling e transazioni asincrone."]},rod:{description:"Layer reattivo di alto livello per binding DOM, model e interpolazioni.",entrypoints:["_.rod","JSswift.rodBind","JSswift.rodModel"],status:"milestone-2-closed",knownLimits:["Va chiarito meglio il rapporto con JSswift.reactive oltre al primo riallineamento strutturale.","Restano casi avanzati di model/binding da esplorare oltre al primo giro coperto dai test.","Il modulo e piu pulito internamente ma non e ancora il punto finale della convergenza con il renderer."]},mount:{description:"Mount, component instances e cleanup automatico del tree DOM.",entrypoints:["JSswift.mount","JSswift.component","JSswift.enableAutoCleanup"],status:"milestone-2-closed",knownLimits:["Il lifecycle e piu pulito internamente ma resta da chiarire meglio la semantica su multi-mount e cloni.","Restano da esplorare edge case avanzati del cleanup automatico fuori dal primo giro gia coperto."]},platform:{description:"Moduli applicativi nel core: overlay, store, auth, http, router, UI meta.",entrypoints:["JSswift.overlay","JSswift.store","JSswift.plugins.auth","JSswift.http","JSswift.router","JSswift.ui.meta"],status:"milestone-2-closed",knownLimits:["Il secondo giro ha ripulito i moduli interni, ma mancano ancora demo separate per modulo e una validazione piu formale di alcune superfici pubbliche.","Esiste una demo browser aggregata del blocco platform, ma non ancora demo separate per ogni modulo.","Mancano configurazione pubblica piu coerente e confini piu netti tra auth, http e router.","Il registry UI meta non ha ancora validazione formale del suo shape."]}}},i.omit=(e,t)=>{const n={},o=new Set(t||[]);for(const r in e||{})o.has(r)||(n[r]=e[r]);return n},i._cleanupRegistry=new WeakMap,i._registerCleanup=function(e,t){if(!e||typeof t!="function")return t;const n=i._cleanupRegistry.get(e)||[];return n.push(t),i._cleanupRegistry.set(e,n),t},i.dom={q(e,t=document){return t.querySelector(e)},qa(e,t=document){return Array.from(t.querySelectorAll(e))},attr(e,t,n){return e?n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.setAttribute(t,String(n)),e):null}},(()=>{let e=[],t=!1;function n(){if(t)return;t=!0;const o=e.slice();e.length=0;for(const r of o)try{r()}catch(a){console.error("[JSswift.ready] error:",a)}}i.ready=function(o){typeof o=="function"&&(t||document.readyState==="interactive"||document.readyState==="complete"?queueMicrotask(()=>{try{o()}catch(r){console.error("[JSswift.ready] error:",r)}}):e.push(o))},document.addEventListener("DOMContentLoaded",n,{once:!0})})(),i.reactive=(()=>{let e=null;const t=[],n=100;let o=0,r="sync",a="sync",s=!1;const c=new Set;function d(p){const b=p==null?void 0:p.flush;if(b==null||b==="sync")return"sync";if(b==="microtask")return"microtask";throw new Error("JSswift.reactive.batch: options.flush must be 'sync' or 'microtask'")}function u(){for(;c.size;){const p=Array.from(c);c.clear(),p.forEach(b=>b())}}function l(){s||(s=!0,queueMicrotask(()=>{s=!1,a="sync",u()}))}function f(p){const b=Array.from(p);if(o>0||a==="microtask"){b.forEach(k=>c.add(k)),o===0&&a==="microtask"&&l();return}b.forEach(k=>k())}function m(p){if(p&&(p._deps.size&&(p._deps.forEach(b=>b.delete(p._runner)),p._deps.clear()),typeof p._cleanup=="function")){const b=p._cleanup;p._cleanup=null;try{b()}catch(k){console.error("[JSswift.reactive.effect] cleanup error:",k)}}}function h(p){if(!(!p||!p.active)){m(p),t.push(p),e=p;try{const b=A=>{p._cleanup=typeof A=="function"?A:null},k=p.fn.length>0?p.fn(b):p.fn();typeof k=="function"&&(p._cleanup=k)}finally{t.pop(),e=t[t.length-1]||null}}}function w(p){if(typeof p!="function")return()=>{};const b={fn:p,active:!0,_deps:new Set,_cleanup:null,_runner:null,_running:!1,_queued:!1},k=()=>{if(!b.active)return;if(b._running){b._queued=!0;return}b._running=!0;let A=0;try{do if(b._queued=!1,h(b),A++,A>=n){b._queued=!1,console.warn("[JSswift.reactive.effect] loop guard triggered: too many synchronous reruns",{max:n,effect:p.name||"anonymous"});break}while(b.active&&b._queued)}finally{b._running=!1}};return b._runner=k,k(),()=>{b.active&&(b.active=!1,m(b))}}function T(p){let b=p;const k=new Set;function A(){return e&&e.active&&(k.add(e._runner),e._deps.add(k)),b}function L(j){b=j,f(k)}function D(){k.clear()}return[A,L,D]}function C(p){if(typeof p!="function")throw new Error("JSswift.reactive.computed: fn must be a function");const[b,k,A]=T(void 0),L=w(()=>{k(p())}),D=()=>b();return D.dispose=()=>{L(),A()},D.peek=()=>b(),D.type="computed",D}function v(p){if(typeof p!="function")throw new Error("JSswift.reactive.untracked: fn must be a function");const b=e;e=null;try{return p()}finally{e=b}}function y(p,b){if(typeof p!="function")throw new Error("JSswift.reactive.batch: fn must be a function");const k=d(b);o===0?r=k:k==="microtask"&&(r="microtask"),o+=1;try{return p()}finally{if(o-=1,o===0){const A=r==="microtask"||a==="microtask";r="sync",A?(a="microtask",l()):u()}}}return{signal:T,effect:w,computed:C,untracked:v,batch:y}})(),i._overlayShared=(()=>{const e=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function t(a,s){const c=a();if(c&&c.isConnected)return c;let d=document.getElementById("cms-overlay-root");return!d&&(document!=null&&document.body)&&(d=document.createElement("div"),d.id="cms-overlay-root",d.className="cms-overlay-root",document.body.appendChild(d)),!document.body&&!d&&i.ready(()=>{let u=document.getElementById("cms-overlay-root");u||(u=document.createElement("div"),u.id="cms-overlay-root",u.className="cms-overlay-root",document.body.appendChild(u)),s(u)}),s(d),d}function n(a){var c;const s=a.querySelector(e);(c=s==null?void 0:s.focus)==null||c.call(s)}function o(a,s){if(a.key!=="Tab")return;const c=Array.from(s.querySelectorAll(e)).filter(f=>f.offsetParent!==null);if(!c.length)return;const d=c[0],u=c[c.length-1],l=document.activeElement;a.shiftKey&&l===d?(a.preventDefault(),u.focus()):!a.shiftKey&&l===u&&(a.preventDefault(),d.focus())}function r(a,s){var Q,Z,ee,H,ne,Ge;if(!s.anchorEl)return;const c=s.anchorEl.getBoundingClientRect(),d=a.getBoundingClientRect(),u=window.visualViewport||null,l=Math.max(0,Number(u==null?void 0:u.offsetLeft)||0),f=Math.max(0,Number(u==null?void 0:u.offsetTop)||0),m=Math.max(Number(u==null?void 0:u.width)||0,window.innerWidth||0,((Q=document.documentElement)==null?void 0:Q.clientWidth)||0),h=Math.max(Number(u==null?void 0:u.height)||0,window.innerHeight||0,((Z=document.documentElement)==null?void 0:Z.clientHeight)||0),w=Number((H=(ee=s.viewportGutter)!=null?ee:s.gutter)!=null?H:8),T=Number.isFinite(w)?Math.max(0,w):8,C=Number((ne=s.offsetX)!=null?ne:0),v=Number((Ge=s.offsetY)!=null?Ge:8),y=Number.isFinite(C)?C:0,p=Number.isFinite(v)?v:8,b=(V,$,X)=>!Number.isFinite(V)||(Number.isFinite($)||($=0),Number.isFinite(X)||(X=$),X<$)?$:Math.min(Math.max(V,$),X),k=String(s.placement||"bottom-start").toLowerCase(),[A,L]=k.split("-"),D=["top","bottom","left","right"].includes(A)?A:"bottom",j=["start","end","center"].includes(L)?L:"start",R={top:"bottom",bottom:"top",left:"right",right:"left"}[D]||"top",P=D==="top"||D==="bottom",M=d.width,F=d.height,g=V=>{let $=c.left+y,X=c.top+p;return V==="top"||V==="bottom"?(j==="center"?$=c.left+(c.width-M)/2+y:j==="end"&&($=c.right-M+y),X=V==="top"?c.top-F-p:c.bottom+p):(j==="center"?X=c.top+(c.height-F)/2+p:j==="end"&&(X=c.bottom-F+p),$=V==="left"?c.left-M-y:c.right+y),{left:$,top:X}},S=V=>V==="top"?c.top-p-T:V==="bottom"?h-c.bottom-p-T:V==="left"?c.left-y-T:m-c.right-y-T,z=S(D),I=S(R),N=(P?F:M)>z&&I>z?R:D,E=g(N),x=l+T,O=f+T,B=Math.max(x,l+m-M-T),q=Math.max(O,f+h-F-T),W=b(E.left,x,B),U=b(E.top,O,q);a.style.position="fixed",a.style.left=`${W}px`,a.style.top=`${U}px`}return{ensureRoot:t,focusFirst:n,trapFocus:o,applyAnchoredPosition:r}})(),i.overlay=(()=>{let e=0;const t=new Map;let n=null;const{ensureRoot:o,focusFirst:r,trapFocus:a,applyAnchoredPosition:s}=i._overlayShared,c=()=>o(()=>n,C=>{n=C});let d=0;const u=()=>{d++,d===1&&document.documentElement.classList.add("cms-scroll-locked")},l=()=>{d=Math.max(0,d-1),d===0&&document.documentElement.classList.remove("cms-scroll-locked")},f=()=>{let C=null;for(const v of t.values())C=v;return C},m=C=>{var y;let v=C;for(;v&&v!==document;){if(v.nodeType===1&&((y=v.getAttribute)==null?void 0:y.call(v,"data-cms-overlay-portal"))==="true")return!0;v=v.parentNode}return!1},h=(C,v={})=>{var S,z,I,J;const y=`ov_${++e}`,p={id:y,opts:v,isOpen:!0,anchorEl:v.anchorEl||null,placement:v.placement||"bottom-start",onClose:typeof v.onClose=="function"?v.onClose:null,overlay:null,panel:null,backdrop:null,reposition:null,_positionCleanup:null,_positionFrame:null,_panelResizeObserver:null,_cleanup:null},b=document.createElement("div");b.className=["cms-overlay",v.type?`type-${v.type}`:""].filter(Boolean).join(" "),b.dataset.id=y;const k=document.createElement("div");k.className="cms-overlay-backdrop",v.backdrop||(k.style.display="none");const A=document.createElement("div");A.className=["cms-overlay-panel",v.className].filter(Boolean).join(" "),A.tabIndex=-1;const L=typeof C=="function"?C({close:()=>w(y)}):C,D=i.ui.slot(L);Array.isArray(D)?D.forEach(N=>N&&A.appendChild(N)):D&&A.appendChild(D),b.appendChild(k),b.appendChild(A);const j=c();if(!j)return{id:y,close:()=>w(y),panel:A,overlay:b};j.appendChild(b),p.overlay=b,p.panel=A,p.backdrop=k,t.set(y,p),v.lockScroll&&u(),v.autoFocus!==!1&&setTimeout(()=>r(A),0);const R=(N=null)=>{N&&typeof N=="object"&&Object.assign(p.opts,N),s(A,p.opts)},P=()=>{if(!v.anchorEl)return;const N=globalThis.requestAnimationFrame||(x=>setTimeout(()=>x(Date.now()),0)),E=globalThis.cancelAnimationFrame||clearTimeout;p._positionFrame!=null&&E(p._positionFrame),p._positionFrame=N(()=>{p._positionFrame=null,R()})};if(p.reposition=R,v.anchorEl){R(),P();const N=()=>R();if(window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),(z=(S=window.visualViewport)==null?void 0:S.addEventListener)==null||z.call(S,"resize",N),(J=(I=window.visualViewport)==null?void 0:I.addEventListener)==null||J.call(I,"scroll",N),typeof ResizeObserver=="function"){const E=new ResizeObserver(()=>R());E.observe(A),p._panelResizeObserver=E}p._positionCleanup=()=>{var x,O,B,q,W,U;const E=globalThis.cancelAnimationFrame||clearTimeout;p._positionFrame!=null&&(E(p._positionFrame),p._positionFrame=null),(O=(x=p._panelResizeObserver)==null?void 0:x.disconnect)==null||O.call(x),p._panelResizeObserver=null,window.removeEventListener("resize",N),window.removeEventListener("scroll",N,!0),(q=(B=window.visualViewport)==null?void 0:B.removeEventListener)==null||q.call(B,"resize",N),(U=(W=window.visualViewport)==null?void 0:W.removeEventListener)==null||U.call(W,"scroll",N)}}const M=N=>{const E=f();!E||E.id!==y||v.closeOnOutside!==!1&&(m(N.target)||A.contains(N.target)||w(y))};document.addEventListener("mousedown",M,!0);const F=N=>{const E=f();!E||E.id!==y||(v.trapFocus&&a(N,A),N.key==="Escape"&&v.closeOnEsc!==!1&&(N.preventDefault(),w(y)))};document.addEventListener("keydown",F,!0),k.addEventListener("click",()=>{v.closeOnBackdrop!==!1&&w(y)}),p._cleanup=()=>{var N;document.removeEventListener("mousedown",M,!0),document.removeEventListener("keydown",F,!0),(N=p._positionCleanup)==null||N.call(p)};const g=1e3+t.size*10;return b.style.zIndex=String(g),{id:y,close:()=>w(y),panel:A,overlay:b,reposition:R}},w=C=>{var y,p,b;const v=t.get(C);v&&(t.delete(C),(y=v._cleanup)==null||y.call(v),v.opts.lockScroll&&l(),typeof Y=="function"&&Y(v.overlay),(p=v.overlay)==null||p.remove(),(b=v.onClose)==null||b.call(v))};return{open:h,close:w,closeTop:()=>{const C=f();C&&w(C.id)},root:n,_stack:t}})();function be(e,t={}){const{isSVG:n=!1,normalizeClass:o=y=>String(y!=null?y:""),isContentProp:r=()=>!1,autoValueTags:a=new Set(["INPUT","TEXTAREA","SELECT"])}=t;function s(y){if(n||!(y in e))return!1;try{return typeof e[y]=="boolean"}catch(p){return!1}}function c(y){return n||y.startsWith("data-")||y.startsWith("aria-")||!(y in e)}function d(y,p){if(p==null){e.removeAttribute(y);return}if(p===!1){if(y.startsWith("aria-")){e.setAttribute(y,"false");return}e.removeAttribute(y);return}if(p===!0&&!n&&!y.startsWith("aria-")&&!y.startsWith("data-")){e.setAttribute(y,"");return}e.setAttribute(y,String(p))}function u(y,p){if(y==null)return;const b=String(y),k=b.startsWith("--")||b.includes("-");if(p==null||p===!1||p===""){k?e.style.removeProperty(b):e.style[b]="";return}if(k){e.style.setProperty(b,String(p));return}e.style[b]=p}function l(y){const p=o(y);if(p==null||p===!1||p===""){e.removeAttribute("class");return}e.setAttribute("class",String(p))}function f(y,p){const b=!!p;e[y]=b,b?e.setAttribute(y,""):e.removeAttribute(y)}function m(y){if(r(y)){e[y]="";return}if(y==="class"){e.removeAttribute("class");return}if(y==="style"){e.removeAttribute("style");return}if(s(y)){try{e[y]=!1}catch(p){}e.removeAttribute(y);return}if(e.removeAttribute(y),!c(y))try{typeof e[y]=="string"&&(e[y]="")}catch(p){}}function h(y){!y||typeof y!="object"||Object.entries(y).forEach(([p,b])=>{u(p,b)})}function w(y,p){if(r(y)){e[y]=p!=null?p:"";return}if(y==="class"){l(p);return}if(y==="style"){if(p==null||p===!1){m(y);return}if(typeof p=="object"){h(p);return}}if(s(y)){f(y,p);return}if(p==null||p===!1){m(y);return}if(c(y)){d(y,p);return}e[y]=p}function T(y,p){const b=String(y).split(".");let k=e;for(let A=0;A<b.length-1;A++)if(k=k==null?void 0:k[b[A]],!k)return;k[b[b.length-1]]=p}function C(y){return y?y==="auto"||y.startsWith("attr:")||y.startsWith("@")||y.startsWith("style.")||y.includes("."):!1}function v(y,p){if(!y||y==="auto"){a.has(e.tagName)?w("value",p):e.textContent=p!=null?p:"";return}if(y.startsWith("attr:")){d(y.slice(5),p);return}if(y.startsWith("@")){d(y.slice(1),p);return}if(y.startsWith("style.")){u(y.slice(6),p);return}if(y.includes(".")){T(y,p);return}w(y,p)}return{isBooleanDomProp:s,isAttributeOnlyProp:c,isBindingValueKey:C,setAttributeValue:d,setStyleEntry:u,setClassValue:l,setBooleanProp:f,removeProp:m,applyStyleObject:h,setProp:w,setPathValue:T,applyBindingValue:v}}function ie(e){const t=[],n=o=>{if(!(o==null||o===!1)){if(typeof o=="function"){n(o());return}if(o&&o.type==="rod"){n(o.value);return}if(Array.isArray(o)){o.forEach(n);return}if(typeof o=="object"){Object.entries(o).forEach(([r,a])=>{let s=a;typeof s=="function"?s=s():s&&s.type==="rod"&&(s=s.value),n(s?r:null)});return}o!==!0&&String(o).split(/\s+/).forEach(r=>{r&&t.push(r)})}};return n(e),t.length?Array.from(new Set(t)).join(" "):""}function de(e){return e==null||e===!1?!1:typeof e=="function"||e&&e.type==="rod"?!0:Array.isArray(e)?e.some(de):typeof e=="object"?Object.values(e).some(de):!1}function we(e,t){return e==null||e===!1?!1:typeof e=="function"||t(e)?!0:typeof e!="object"||Array.isArray(e)||e.nodeType?!1:Object.values(e).some(n=>we(n,t))}function Ke(e,t){let n=e;if(typeof n=="function"?n=n():t(n)&&(n=n.value),!n||typeof n!="object"||Array.isArray(n)||n.nodeType)return null;const o={};return Object.entries(n).forEach(([r,a])=>{let s=a;typeof s=="function"?s=s():t(s)&&(s=s.value),o[r]=s}),o}function Se(e){let t=new Set;function n(r){t.forEach(a=>{r.has(a)||e(a,null)}),t=r}function o(r,a){const s=Ke(r,a);if(!s){n(new Set);return}const c=new Set(Object.keys(s));n(c),Object.entries(s).forEach(([d,u])=>{e(d,u)})}return{apply:o}}function Qe(e){return typeof e=="string"&&(e.startsWith("on:")||e.startsWith("on")&&e.length>2)}const ve=128,te=[];function Xe(e,t){te.push({rod:e,value:String(t!=null?t:"")}),te.length>ve&&te.splice(0,te.length-ve)}function Ye(){if(!te.length)return null;const e=te.slice();return te.length=0,{items:e,index:0}}function pe(e,t){if(!t||!e||t.index>=t.items.length)return null;const n=[],o=String(e);let r=0,a=t.index,s=!1;for(;a<t.items.length;){const c=t.items[a],d=c.value;if(!d)break;const u=o.indexOf(d,r);if(u===-1)break;u>r&&n.push(o.slice(r,u)),n.push(c.rod),r=u+d.length,a++,s=!0}return s?(r<o.length&&n.push(o.slice(r)),t.index=a,n):null}function Ae(e){var n;let t="";for(const o of e)typeof o=="string"?t+=o:t+=(n=o==null?void 0:o.value)!=null?n:"";return t}function Ze(e){if(e.startsWith("on:"))return e.slice(3);const t=e.slice(2);return t?t==="DoubleClick"?"dblclick":t.toLowerCase():""}function ce(e){return e==null||e===!1?!1:e===!0?{capture:!0}:typeof e=="boolean"?e:typeof e=="object"?{capture:!!e.capture,passive:!!e.passive,once:!!e.once}:!1}function et(e,t){const n=ce(e),o=ce(t);return typeof n=="boolean"||typeof o=="boolean"?n===o:!!n&&!!o&&n.capture===o.capture&&n.passive===o.passive&&n.once===o.once}function ae(e,t){return Array.isArray(e)?e.some(n=>ae(n,t)):t(e)?!0:!e||typeof e!="object"||Array.isArray(e)||e.nodeType?!1:Array.isArray(e.handlers)?e.handlers.some(n=>ae(n,t))||t(e.options)||typeof e.options=="function":Array.isArray(e.listeners)?e.listeners.some(n=>ae(n,t))||t(e.options)||typeof e.options=="function":t(e.handler)||t(e.listener)||t(e.fn)||t(e.options)||typeof e.options=="function"}function ue(e,t,n){var o,r,a,s,c,d,u;if(e==null||e===!1)return[];if(typeof e=="function")return[{handler:e,options:ce(n!=null?n:!1)}];if(t(e))return ue(e.value,t,n);if(Array.isArray(e))return e.flatMap(l=>ue(l,t,n));if(typeof e=="object"&&!Array.isArray(e)&&!e.nodeType){if(Array.isArray(e.handlers)||Array.isArray(e.listeners)){const m=e.handlers||e.listeners||[],h=(r=(o=e.options)!=null?o:n)!=null?r:!1;return m.flatMap(w=>ue(w,t,h))}let l=(c=(s=(a=e.handler)!=null?a:e.listener)!=null?s:e.fn)!=null?c:null,f=(u=(d=e.options)!=null?d:n)!=null?u:!1;return t(l)&&(l=l.value),t(f)&&(f=f.value),typeof f=="function"&&(f=f()),typeof l=="function"?[{handler:l,options:ce(f)}]:[]}return[]}function tt(e,t){return ue(e,t)}function nt(e,t,n,o){const r=Ze(t);if(!r)return;const a={listeners:[]},s=()=>{a.listeners.forEach(d=>{e.removeEventListener(r,d.dispatch,d.options)}),a.listeners=[]},c=d=>{const u=tt(d,o);a.listeners.length===u.length&&a.listeners.every((f,m)=>{const h=u[m];return f.handler===h.handler&&et(f.options,h.options)})||(s(),u.forEach(f=>{const m={handler:f.handler,options:f.options,dispatch:null};m.dispatch=h=>{if(typeof m.handler=="function"){const w=m.handler.call(e,h);return m.options&&typeof m.options=="object"&&m.options.once&&(e.removeEventListener(r,m.dispatch,m.options),a.listeners=a.listeners.filter(T=>T!==m)),w}},e.addEventListener(r,m.dispatch,m.options),a.listeners.push(m)}))};if(i._registerCleanup(e,s),o(n)){const d=i.reactive.effect(()=>{c(n.value)});i._registerCleanup(e,d);return}if(ae(n,o)){const d=i.reactive.effect(()=>{c(n)});i._registerCleanup(e,d);return}c(n)}function rt(e,t={}){const{isRod:n=()=>!1,interpolationCursor:o=null}=t;function r(l){const f=document.createTextNode(""),m=i.rodBind(f,l);return i._registerCleanup(f,m),f}function a(l){e.appendChild(r(l))}function s(l){const f=document.createTextNode("");e.appendChild(f);const m=i.reactive.effect(()=>{f.textContent=Ae(l)});i._registerCleanup(f,m)}function c(l){const f=[],m=h=>{if(!(h==null||h===!1)){if(Array.isArray(h)){h.forEach(m);return}if(typeof h=="string"){f.push(document.createTextNode(h));return}if(typeof h=="number"){f.push(document.createTextNode(String(h)));return}if(typeof h!="boolean"){if(n(h)){f.push(r(h));return}if(h!=null&&h.nodeType){f.push(h);return}f.push(document.createTextNode(String(h)))}}};return m(l),f}function d(l){const f=document.createComment("dyn");e.appendChild(f);let m=[];const h=i.reactive.effect(()=>{m.forEach(v=>{Y(v),v.parentNode&&v.parentNode.removeChild(v)}),m=[];const w=f.parentNode;if(!w)return;const T=c(l());if(!T.length)return;const C=document.createDocumentFragment();T.forEach(v=>C.appendChild(v)),w.insertBefore(C,f.nextSibling),m=T});i._registerCleanup(f,()=>{h(),m.forEach(w=>Y(w)),m=[]})}function u(l){if(l!=null){if(Array.isArray(l)){for(const f of l)u(f);return}if(typeof l=="string"){const f=pe(l,o);f?s(f):e.appendChild(document.createTextNode(l));return}if(typeof l=="number"){e.appendChild(document.createTextNode(String(l)));return}if(typeof l=="function"){d(l);return}if(n(l)){a(l);return}l.nodeType&&e.appendChild(l)}}return{appendRodText:a,appendInterpolatedText:s,appendDynamicChild:d,appendChildValue:u}}function ot(e,t={}){const{el:n,isRod:o=()=>!1,interpolationCursor:r=null,appendChildValue:a=()=>{},appendRodText:s=()=>{},appendInterpolatedText:c=()=>{},appendDynamicChild:d=()=>{},bindProp:u=()=>{}}=t;for(const l of e)if(l!=null){if(Array.isArray(l)){a(l);continue}if(typeof l=="string"){const f=pe(l,r);f?c(f):n.appendChild(document.createTextNode(l));continue}if(typeof l=="number"){n.appendChild(document.createTextNode(String(l)));continue}if(typeof l=="function"){d(l);continue}if(o(l)){s(l);continue}if(l.nodeType){n.appendChild(l);continue}if(typeof l=="object")for(const[f,m]of Object.entries(l)){if(typeof m=="string"){const h=pe(m,r);if(h){u(f,()=>Ae(h));continue}}if(f==="class"){u(f,m);continue}if(f==="style"&&typeof m=="object"&&m!==null&&!o(m)){u(f,m);continue}u(f,m)}}}const _e="http://www.w3.org/2000/svg",st=new Set(["svg","g","path","circle","ellipse","line","rect","polygon","polyline","text","tspan","defs","linearGradient","radialGradient","stop","use","symbol","clipPath","mask","pattern","filter","feGaussianBlur","feOffset","feBlend","feColorMatrix"]);function he(e){return e==="innerHTML"||e==="innerText"||e==="textContent"||e==="value"}function it(e,...t){const n=st.has(e),o=e==="text"&&!n?document.createTextNode(""):n?document.createElementNS(_e,e):document.createElement(e),r=g=>!!g&&g.type==="rod",a=Ye(),s=rt(o,{isRod:r,interpolationCursor:a}),{appendRodText:c,appendInterpolatedText:d,appendDynamicChild:u,appendChildValue:l}=s,f=be(o,{isSVG:n,normalizeClass:ie,isContentProp:he}),{isBooleanDomProp:m,isBindingValueKey:h,applyBindingValue:w,setStyleEntry:T,setProp:C,setClassValue:v}=f;function y(g){const S=i.reactive.effect(g);return i._registerCleanup(o,S),S}function p(g){if(String((g==null?void 0:g.tagName)||"").toLowerCase()!=="input")return!1;const S=String((g==null?void 0:g.type)||"").toLowerCase();return S==="range"||S==="number"}function b(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()!=="input"?"":String((g==null?void 0:g.type)||"").toLowerCase()}function k(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()==="select"&&!g.multiple}function A(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()==="input"&&String((g==null?void 0:g.type)||"").toLowerCase()==="file"}function L(g,S,z){y(()=>{var N;const J=(N=S.value)!=null?N:"";g.value!==String(J)&&C("value",J)});const I=()=>{let J=g.value;const N=b(g),E=typeof S.value=="number"||S.value==null;if(k(g)&&g.value==="")J=null;else if(p(g)&&E)if(N==="number"&&g.value==="")J=null;else{const x=typeof g.valueAsNumber=="number"&&!Number.isNaN(g.valueAsNumber)?g.valueAsNumber:Number(g.value);J=Number.isNaN(x)?N==="number"?null:0:x}S.value!==J&&(S.value=J)};g.addEventListener(z,I),i._registerCleanup(g,()=>{g.removeEventListener(z,I)})}function D(g,S){y(()=>{const I=!!S.value;!!g.checked!==I&&C("checked",I)});const z=()=>{const I=!!g.checked;S.value!==I&&(S.value=I)};g.addEventListener("change",z),i._registerCleanup(g,()=>{g.removeEventListener("change",z)})}function j(g,S){const z=()=>{var J;return String((J=g.value)!=null?J:"on")};y(()=>{const N=(S.value==null?null:String(S.value))===z();!!g.checked!==N&&C("checked",N)});const I=()=>{if(!g.checked)return;const J=z();S.value!==J&&(S.value=J)};g.addEventListener("change",I),i._registerCleanup(g,()=>{g.removeEventListener("change",I)})}function R(g,S){const z=()=>{const J=g.files;return J==null?[]:Array.isArray(J)?J.slice():typeof J.length=="number"?Array.from(J):[J]};y(()=>{const J=S.value;(J==null||Array.isArray(J)&&J.length===0)&&(g.value!==""&&C("value",""),Array.isArray(g.files)&&(g.files=[]))});const I=()=>{const J=z();S.value=J};g.addEventListener("change",I),i._registerCleanup(g,()=>{g.removeEventListener("change",I)})}function P(g,S){const z=()=>Array.from(g.childNodes||[]).filter(N=>(N==null?void 0:N.tagName)==="OPTION"&&N.selected).map(N=>{var E;return String((E=N.value)!=null?E:"")}),I=()=>{const N=Array.isArray(S.value)?S.value.map(x=>String(x)):[],E=new Set(N);Array.from(g.childNodes||[]).forEach(x=>{var B;if((x==null?void 0:x.tagName)!=="OPTION")return;const O=E.has(String((B=x.value)!=null?B:""));!!x.selected!==O&&(x.selected=O,O?x.setAttribute("selected",""):x.removeAttribute("selected"))})};y(I),g._cmsApplySelectedValues=I,queueMicrotask(I);const J=()=>{const N=z(),E=Array.isArray(S.value)?S.value.map(x=>String(x)):[];E.length===N.length&&E.every((x,O)=>x===N[O])||(S.value=N)};g.addEventListener("change",J),i._registerCleanup(g,()=>{g.removeEventListener("change",J)})}function M(g,S){y(()=>{const N=!!S.value;!!g.selected!==N&&C("selected",N)});let z=null;const I=()=>{const N=!!g.selected;S.value!==N&&(S.value=N)};queueMicrotask(()=>{var N;z||((N=g.parentNode)==null?void 0:N.tagName)!=="SELECT"||(z=g.parentNode,z.addEventListener("change",I))}),i._registerCleanup(g,()=>{z==null||z.removeEventListener("change",I)})}function F(g,S){if(Qe(g)){nt(o,g,S,r);return}if(g==="class"){if(de(S)){y(()=>{v(ie(S))});return}v(ie(S));return}if(g==="style"&&S&&typeof S=="object"){const z=Se(T);if(we(S,r)){y(()=>{z.apply(S,r)});return}z.apply(S,r);return}if(g==="style"&&(typeof S=="function"||r(S))){const z=Se(T);y(()=>{z.apply(S,r)});return}if(h(g)&&typeof S=="function"){y(()=>{w(g,S())});return}if(h(g)&&!r(S)){w(g,S);return}if(typeof S=="function"){y(()=>{C(g,S())});return}if(g==="value"&&r(S)&&(e==="input"||e==="textarea"||e==="select")){if(e==="select"&&o.multiple){P(o,S);return}L(o,S,e==="select"?"change":"input");return}if(g==="checked"&&r(S)&&e==="input"){if(String(o.type||"").toLowerCase()==="radio"){j(o,S);return}D(o,S);return}if(g==="files"&&r(S)&&A(o)){R(o,S);return}if(g==="selected"&&r(S)&&e==="option"){M(o,S);return}if(he(g)&&r(S)){y(()=>{C(g,S.value)});return}if(r(S)){const z=i.rodBind(o,S,{key:g});i._registerCleanup(o,z);return}C(g,S)}return ot(t,{el:o,isRod:r,interpolationCursor:a,appendChildValue:l,appendRodText:c,appendInterpolatedText:d,appendDynamicChild:u,bindProp:F}),e==="select"&&typeof o._cmsApplySelectedValues=="function"&&o._cmsApplySelectedValues(),o}const bt={},Ee=["html","head","title","base","link","meta","style","body","header","footer","main","section","article","aside","nav","h1","h2","h3","h4","h5","h6","p","div","span","pre","blockquote","hr","br","address","a","abbr","b","bdi","bdo","cite","code","data","dfn","em","i","kbd","mark","q","rp","rt","ruby","s","samp","small","strong","sub","sup","time","u","var","wbr","ul","ol","li","dl","dt","dd","table","caption","colgroup","col","thead","tbody","tfoot","tr","th","td","form","label","input","textarea","button","select","option","optgroup","fieldset","legend","datalist","output","progress","meter","img","picture","source","iframe","embed","object","param","audio","video","track","details","summary","dialog","script","noscript","canvas","template","slot","svg","g","path","circle","ellipse","line","rect","polygon","polyline","text","tspan","defs","linearGradient","radialGradient","stop","use","symbol","clipPath","mask","pattern","filter","feGaussianBlur","feOffset","feBlend","feColorMatrix"];Ee.forEach(e=>{window._[e]=(...t)=>it(e,...t)}),_.DOM_ELEMENTS=Ee,_.fragment=(...e)=>e,_.dynamic=function(e){const t=document.createComment("dyn"),n=document.createDocumentFragment();n.appendChild(t);let o=null;return i.reactive.effect(()=>{const r=e();if(o&&o.parentNode&&o.parentNode.removeChild(o),o=null,r==null)return;let a=r;(typeof r=="string"||typeof r=="number")&&(a=document.createTextNode(String(r)));const s=t.parentNode;s&&a&&a.nodeType&&(s.insertBefore(a,t.nextSibling),o=a)}),n};function ct(){let e=!1;const t=new Set;function n(){var r,a,s;e=!1,(r=i.debug)==null||r.inc("rodFlushes"),(a=i.perf)==null||a.inc("rodFlushes"),(s=i.perf)==null||s.mark("rod:flush");const o=Array.from(t);t.clear();for(const c of o)try{c()}catch(d){console.error("[rod] flush error:",d)}}return function(r){t.add(r),e||(e=!0,queueMicrotask(n))}}const at=ct();function Ce(e,t,n){if(!e)return;if(e.nodeType===3){e.textContent=n!=null?n:"";return}be(e,{isSVG:e.namespaceURI===_e,normalizeClass:ie,isContentProp:he}).applyBindingValue(t,n)}function ut(e){return{type:"rod",value:e,_bindings:[],_actions:[],_disposeHooks:[],_disposed:!1,_silentDepth:0,_pending:!1,bindings(){return this._bindings.map(n=>({el:n.el,key:n.key}))},onDispose(n){return typeof n=="function"&&this._disposeHooks.push(n),this},_bind(n,o={key:"auto"}){var s;if(this._disposed)return()=>{};if(!n)return()=>{};const r={el:n,key:(s=o==null?void 0:o.key)!=null?s:"auto"};return this._bindings.some(c=>c.el===r.el&&c.key===r.key)||this._bindings.push(r),Ce(r.el,r.key,this.value),()=>{this._bindings=this._bindings.filter(c=>!(c.el===r.el&&c.key===r.key))}},action(n){return!this._disposed&&typeof n=="function"&&this._actions.push(n),this},_setSilent(n){this._silentDepth++;try{this.value=n}finally{this._silentDepth--}return this},_scheduleNotify(){this._disposed||this._pending||(this._pending=!0,at(()=>{this._pending=!1,this._notifyNow()}))},_notifyNow(){var o,r,a,s,c;if(this._disposed)return;const n=performance.now();(o=i.perf)==null||o.inc("rodNotifies"),this._bindings=this._bindings.filter(d=>{const u=d.el;return u?u.nodeType===3?!!u.parentNode:u.isConnected!==!1:!1});for(const d of this._bindings)Ce(d.el,d.key,this.value);if(!(this._silentDepth>0)){for(const d of this._actions)try{d(this.value)}catch(u){console.error("[rod] action error:",u)}(r=i.debug)==null||r.inc("rodNotifies"),(c=i.perf)==null||c.tick("rod:notify",performance.now()-n,{bindings:((a=this._bindings)==null?void 0:a.length)||0,actions:((s=this._actions)==null?void 0:s.length)||0})}},dispose(){if(!this._disposed){this._disposed=!0;for(const n of this._disposeHooks)try{n()}catch(o){console.error("[rod] dispose hook error:",o)}this._bindings.length=0,this._actions.length=0,this._disposeHooks.length=0}}}}function lt(e,t="value"){var s;let n=e[t],o=null,r=null,a=null;return(s=i==null?void 0:i.reactive)!=null&&s.signal&&([o,r,a]=i.reactive.signal(n),a&&typeof e.onDispose=="function"&&e.onDispose(a)),Object.defineProperty(e,t,{get(){return o?o():n},set(c){r?r(c):n=c,e._scheduleNotify()},configurable:!0}),typeof e.val!="function"&&Object.defineProperty(e,"val",{value(c){return arguments.length?(this.value=c,c):this.value},configurable:!0}),e[Symbol.toPrimitive]||Object.defineProperty(e,Symbol.toPrimitive,{value(c){const d=this.value;if(d==null)return d;const u=typeof d;return c==="number"?Number(d):(u!=="symbol"&&Xe(this,d),u==="string"||u==="number"||u==="boolean"||u==="bigint"||u==="symbol"?d:String(d))},configurable:!0}),e.valueOf||Object.defineProperty(e,"valueOf",{value(){return this.value},configurable:!0}),e.toString||Object.defineProperty(e,"toString",{value(){return String(this.value)},configurable:!0}),e}_.rod=function(t,n="value"){const o=ut(t);return lt(o,n),i.rod._all=i.rod._all||new Set,i.rod._all.add(o),typeof o.onDispose=="function"&&o.onDispose(()=>i.rod._all.delete(o)),o},i.rodBind=function(e,t,n={key:"auto"}){var o,r,a;if((o=i.debug)==null||o.inc("rodBinds"),!e)return(r=i.debug)==null||r.inc("rodBindNull"),(a=i.debug)==null||a.warn("rodBind: target element \xE8 null/undefined",n),()=>{};if(!t||t.type!=="rod")throw new Error("JSswift.rodBind: react must be a rod object");return t._bind(e,n)},i.rodFromSignal=function(e,t){const n=_.rod(e());let o=!1;const r=i.reactive.effect(()=>{const s=n.value,c=i.reactive.untracked(()=>e());if(!o&&c!==s){o=!0;try{t(s)}finally{o=!1}}}),a=i.reactive.effect(()=>{const s=e();if(i.reactive.untracked(()=>n.value)!==s){o=!0;try{n._setSilent(s)}finally{o=!1}}});return typeof n.onDispose=="function"&&(n.onDispose(r),n.onDispose(a)),n};function ke(e){if(!e||!e.tagName)return null;const t=e.tagName.toLowerCase();if(t==="input"){const n=(e.type||"text").toLowerCase();return n==="checkbox"?"checkbox":n==="radio"?"radio":n==="number"?"number":"text"}return t==="select"?e.multiple?"select-multiple":"select":null}i.rodModel=function(e,t,n={}){var l,f,m;if(!t||t.type!=="rod")throw new Error("[JSswift.rodModel] rodObj deve essere un rod");const o=Array.isArray(e)||e instanceof NodeList?Array.from(e):[e],r=(l=n.event)!=null?l:"change",a=(f=n.parse)!=null?f:(h=>h),s=(m=n.format)!=null?m:(h=>h);let c=!1;const d=[],u=h=>{for(const w of o){if(!w)continue;switch(ke(w)){case"checkbox":w.checked=!!h;break;case"radio":w.checked=w.value==h;break;case"select":w.value=h!=null?h:"";break;case"select-multiple":const C=Array.isArray(h)?h.map(String):[];for(const v of w.options)v.selected=C.includes(v.value);break;default:w.value=h!=null?h:""}}};t.action(h=>{if(!c){c=!0;try{u(s(h))}finally{c=!1}}}),u(s(t.value));for(const h of o){if(!h)continue;const w=ke(h),T=()=>{if(c)return;let C;switch(w){case"checkbox":C=h.checked;break;case"radio":if(!h.checked)return;C=h.value;break;case"select":C=h.value;break;case"select-multiple":C=Array.from(h.selectedOptions).map(v=>v.value);break;case"number":C=a(h.value===""?null:Number(h.value));break;default:C=a(h.value)}c=!0;try{t.value!==C&&(t.value=C)}finally{c=!1}};h.addEventListener(r,T),d.push(()=>h.removeEventListener(r,T))}return typeof t.onDispose=="function"&&t.onDispose(()=>d.forEach(h=>h())),()=>d.forEach(h=>h())},i.signalModel=function(e,t,n,o={}){const r=i.rodFromSignal(t,n);return i.rodModel(e,r,o)};function Y(e){if(!e)return;const t=i._cleanupRegistry.get(e);if(t){for(const n of t)try{n()}catch(o){console.error("[cleanup] error:",o)}i._cleanupRegistry.delete(e)}if(e.childNodes&&e.childNodes.length)for(const n of e.childNodes)Y(n)}function ft(e){const t=n=>typeof n=="string"?i.dom.q(n):n;return Array.isArray(e)?e.map(t).filter(Boolean):[t(e)].filter(Boolean)}function dt(e){const t=[],n=[],o=r=>{if(r!=null){if(typeof r=="function"){o(r());return}if(r&&typeof r=="object"&&"node"in r){typeof r.dispose=="function"&&n.push(r.dispose),o(r.node);return}if(Array.isArray(r)){for(const a of r)o(a);return}if(typeof r=="string"||typeof r=="number"){t.push(document.createTextNode(String(r)));return}if(r.nodeType){t.push(r);return}console.warn("[JSswift.mount] contenuto non supportato:",r)}};return o(e),{nodes:t,disposers:n}}function Te(e=[],t="[JSswift.mount] dispose error:"){let n=!1;return()=>{if(!n){n=!0;for(const o of e)try{o()}catch(r){console.error(t,r)}}}}function Ne(e=[],t=null){return Te([...t?[t]:[],...e],"[component] dispose error:")}i.mount=function(e,t,n={}){var d;const o=ft(e),r=(d=n.clear)!=null?d:!0,a=o.length>1;if(o.length===0)return console.warn("[JSswift.mount] nessun target valido:",e),()=>{};const s=[];for(const u of o){if(r)for(;u.firstChild;)Y(u.firstChild),u.removeChild(u.firstChild);const{nodes:l,disposers:f}=dt(t);let m=l;a&&typeof t!="function"&&(m=l.map(w=>w.cloneNode(!0)),f.length&&console.warn("[JSswift.mount] multi-target con dispose: usa content come function per istanze separate."));const h=Te(f);for(const w of m)u.appendChild(w);s.push({root:u,nodes:m,dispose:h});for(const w of m)!w||!w.nodeType||i._registerCleanup(w,h)}return()=>{var u;for(const l of s){for(const f of l.nodes)f&&(Y(f),f.parentNode===l.root&&l.root.removeChild(f));(u=l.dispose)==null||u.call(l)}}},i.component=function(e){if(typeof e!="function")throw new Error("JSswift.component: renderFn must be a function");return function(n={}){const o=[],a=e(n,{onDispose(s){typeof s=="function"&&o.push(s)}});return a&&typeof a=="object"&&"node"in a?{node:a.node,dispose:Ne(o,typeof a.dispose=="function"?a.dispose:null)}:{node:a,dispose:Ne(o)}}},i.enableAutoCleanup=function(){if(i._autoCleanupEnabled)return;i._autoCleanupEnabled=!0;const e=new MutationObserver(t=>{for(const n of t)for(const o of n.removedNodes)Y(o)});e.observe(document.body,{childList:!0,subtree:!0}),i._cleanupObserver=e},i.debug=(()=>{const e={rodFlushes:0,rodNotifies:0,rodBinds:0,rodBindNull:0,rodBindDup:0};function t(){return!!i.config.debug}function n(...d){t()&&console.log("[JSswift]",...d)}function o(...d){t()&&console.warn("[JSswift]",...d)}function r(...d){console.error("[JSswift]",...d)}function a(d,u=1){e[d]||(e[d]=0),e[d]+=u}function s(){return{...e}}function c(){for(const d of Object.keys(e))e[d]=0}return{enabled:t,log:n,warn:o,error:r,inc:a,stats:s,reset:c}})(),i.perf=(()=>{let e=!1;const t={effectsRun:0,effectsSlow:0,rodNotifies:0,rodFlushes:0,domWrites:0,httpRequests:0},n=[],o=[],r={timelineMax:200,slowEffectMs:8};function a(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function s(b,k=0,A=null){e&&(n.push({t:Date.now(),type:b,ms:k,meta:A}),n.length>r.timelineMax&&n.shift())}function c(b,k=1){e&&(t[b]=(t[b]||0)+k)}function d(b,k){e&&(o.push({t:Date.now(),ms:b,meta:k}),o.length>100&&o.shift())}let u=null;function l(){u||(u=i.reactive.effect,i.reactive.effect=function(b,k){return u((...L)=>{const D=a();c("effectsRun");try{return b(...L)}finally{const j=a()-D;j>=r.slowEffectMs?(c("effectsSlow"),d(j,k||b.name||"effect"),s("effect:slow",j,k||b.name||null)):s("effect",j,k||b.name||null)}})})}function f(){u&&(i.reactive.effect=u,u=null)}function m(b=!0){return e=!!b,e?l():f(),e}function h(){for(const b of Object.keys(t))t[b]=0;n.length=0,o.length=0}function w(){return{enabled:e,...t,slowEffectMs:r.slowEffectMs,timelineSize:n.length}}function T(){return n.slice()}function C(b=r.slowEffectMs){return o.filter(k=>k.ms>=b).slice().sort((k,A)=>A.ms-k.ms)}function v(b,k){const A=a();try{return k()}finally{const L=a()-A;s("time:"+b,L,b)}}function y(b,k){s(b,0,k)}function p(b,k,A){s(b,k,A)}return{enable:m,reset:h,stats:w,timeline:T,slowEffects:C,time:v,mark:y,tick:p,inc:c,cfg:r}})(),i.rod=i.rod||{},i.rod.inspect=function(e,t="rod"){if(!e||e.type!=="rod")return console.warn("[JSswift.rod.inspect] non \xE8 un rod:",e),null;const n=typeof e.bindings=="function"?e.bindings():[],o={label:t,value:e.value,bindingsCount:n.length,bindings:n.map(r=>{var a,s,c,d,u,l,f;return{key:r.key,el:((a=r.el)==null?void 0:a.nodeType)===3?"#text":(s=r.el)==null?void 0:s.tagName,id:((c=r.el)==null?void 0:c.id)||null,className:((d=r.el)==null?void 0:d.className)||null,isConnected:((u=r.el)==null?void 0:u.nodeType)===3?!!r.el.parentNode:(f=(l=r.el)==null?void 0:l.isConnected)!=null?f:null}}),actionsCount:Array.isArray(e._actions)?e._actions.length:null,disposed:!!e._disposed};return i.config.debug?(console.groupCollapsed(`[JSswift.rod.inspect] ${t}`),console.log(o),console.groupEnd()):console.log(o),o},i.rod.inspectAll=function(){const e=i.rod._all?Array.from(i.rod._all):[];return e.forEach((t,n)=>i.rod.inspect(t,`rod#${n+1}`)),e.length},i._storeShared=(()=>{function e(a){return`${a.storage}::${a.prefix}`}function t(a,s){function c(f={}){var h,w;const m={storage:(h=f.storage)!=null?h:a.storage,prefix:(w=f.prefix)!=null?w:a.prefix};return s.set(e(m),m),m}function d(f=null){var h;return(typeof f=="string"?f:(h=f==null?void 0:f.storage)!=null?h:a.storage)==="session"?window.sessionStorage:window.localStorage}function u(f,m=null){return(m||c()).prefix+f}function l(f,m=null){const h=m||c();return`${e(h)}::${f}`}return{getScope:c,getStorage:d,fullKey:u,channelKey:l}}function n(a){try{return JSON.parse(a)}catch(s){return}}function o(a){try{return JSON.stringify(a)}catch(s){return}}function r(a,...s){const c=`${a.storage}::${a.prefix}::`;for(const d of s)for(const u of Array.from(d.keys()))u.startsWith(c)&&d.delete(u)}return{createScopeTools:t,safeParse:n,safeStringify:o,clearScopedMapEntries:r}})(),i.store=(()=>{const e={prefix:"JSswift:",storage:"local",syncTabs:!0,writeDelay:0},t=new Map,n=new Map,o=new Map,r=new Map;let a=!1;const{createScopeTools:s,safeParse:c,safeStringify:d,clearScopedMapEntries:u}=i._storeShared,{getScope:l,getStorage:f,fullKey:m,channelKey:h}=s(e,r);function w(R,P,M=null){var S;const F=M||l(),g=n.get(h(R,F));if(g)for(const z of g)try{(S=i.reactive)!=null&&S.untracked?i.reactive.untracked(()=>z(P)):z(P)}catch(I){console.error("[store] watcher error:",I)}}function T(){a=!1;for(const[R,P]of Array.from(o.entries())){o.delete(R);const M=t.get(R),F=d(M);if(F===void 0)continue;const g=f(P.scope);try{g.setItem(m(P.key,P.scope),F)}catch(S){console.error("[store] write error:",S)}}}function C(R,P=null){const M=P||l();o.set(h(R,M),{key:R,scope:M}),!a&&(a=!0,e.writeDelay>0?setTimeout(T,e.writeDelay):queueMicrotask(T))}function v(R,P=null){const M=P||l(),g=f(M).getItem(m(R,M));if(g!=null)return c(g)}function y(R,P,M=null){const F=M||l(),g=h(R,F);if(t.has(g))return t.get(g);const S=v(R,F);return S!==void 0?(t.set(g,S),S):P}function p(R,P,M=null){const F=M||l();return t.set(h(R,F),P),C(R,F),w(R,P,F),P}function b(R,P=null){const M=P||l(),F=h(R,M);t.delete(F),o.delete(F);try{f(M).removeItem(m(R,M))}catch(g){}w(R,void 0,M)}function k(R={}){const P=l(R),M=f(P),F=[];for(let g=0;g<M.length;g++){const S=M.key(g);S&&S.startsWith(P.prefix)&&F.push(S)}for(const g of F)M.removeItem(g);u(P,t,o,n)}function A(R,P,M=null){if(typeof P!="function")return()=>{};const F=M||l(),g=h(R,F);return n.has(g)||n.set(g,new Set),n.get(g).add(P),()=>{var S;return(S=n.get(g))==null?void 0:S.delete(P)}}function L(R,P,M={}){const F=l({storage:M.storage,prefix:M.prefix}),g=y(R,P,F),[S,z,I]=i.reactive.signal(g),J=i.reactive.effect(()=>{const x=S();p(R,x,F)}),N=A(R,x=>{S()!==x&&z(x)},F);return[S,z,()=>{try{J==null||J()}catch(x){}try{N==null||N()}catch(x){}try{I==null||I()}catch(x){}}]}l(),e.syncTabs&&window.addEventListener("storage",R=>{if(!(!R.key||!R.storageArea))for(const P of r.values()){if(f(P)!==R.storageArea||!R.key.startsWith(P.prefix))continue;const M=R.key.slice(P.prefix.length),F=R.newValue==null?void 0:c(R.newValue),g=h(M,P);F===void 0?t.delete(g):t.set(g,F),w(M,F,P)}});function D(R={}){Object.assign(e,R),l()}function j(){return{prefix:e.prefix,storage:e.storage,syncTabs:e.syncTabs,cacheSize:t.size,scopeCount:r.size}}return{configure:D,stats:j,get:y,set:p,remove:b,clear:k,watch:A,signal:L}})(),i.store.computed=function(e){if(typeof e!="function")throw new Error("store.computed: fn must be a function");return i.reactive.computed(e)},i.store.migrate=function(e,t,n={}){var c,d;const o=(c=n.versionKey)!=null?c:"__version",r=Number((d=i.store.get(o,0))!=null?d:0),a=Number(e!=null?e:0);if(!Number.isFinite(a)||a<0)throw new Error("store.migrate: targetVersion non valido");if(r>=a)return{from:r,to:a,applied:0};let s=0;for(let u=r;u<a;u++){const l=t==null?void 0:t[u];if(typeof l=="function")try{l(i.store)}catch(f){console.error("[store.migrate] step error at version",u,f)}s++,i.store.set(o,u+1)}return{from:r,to:a,applied:s}},i.store.model=function(e,t,n,o={}){if(typeof t!="string"||!t)throw new Error("store.model: key deve essere una stringa non vuota");const[r,a,s]=i.store.signal(t,n,{storage:o.storage,prefix:o.prefix}),c=i.rodFromSignal(r,a),d=i.rodModel(e,c,{event:o.event,parse:o.parse,format:o.format});return()=>{var u;try{d==null||d()}catch(l){}try{s==null||s()}catch(l){}try{(u=c.dispose)==null||u.call(c)}catch(l){}}},i.store.bind=function(e,t,n,o={}){var a;let r=e;return typeof e=="string"&&(e.includes("[")||e.includes(" ")?r=document.querySelectorAll(e):r=i.dom.q(e)),r?i.store.model(r,t,n,o):((a=i.config)!=null&&a.debug&&console.warn("[store.bind] target non trovato:",e),()=>{})},i.store.bindAll=function(e,t={},n={}){if(typeof e=="string"&&(e=i.dom.q(e)),!e||!e.querySelectorAll)return console.warn("[store.bindAll] form non valido:",e),()=>{};const o=[];for(const[r,a]of Object.entries(t)){const s=e.querySelectorAll(`[name="${r}"]`);if(!s.length)continue;const c=i.store.model(s.length===1?s[0]:s,r,a,n);o.push(c)}return()=>o.forEach(r=>r())},i.store.inspect=function(){const e={...i.store.stats(),keys:Array.from((function(){const t=i.store.stats().storage==="session"?sessionStorage:localStorage,n=[];for(let o=0;o<t.length;o++){const r=t.key(o);r&&r.startsWith(i.store.stats().prefix)&&n.push(r.replace(i.store.stats().prefix,""))}return n})())};return console.groupCollapsed("[JSswift.store.inspect]"),console.table(e.keys),console.log(e),console.groupEnd(),e},i.store.autoForm=function(e,t={},n={}){var r;const o=i.store.bindAll(e,t,n);return(r=i.config)!=null&&r.debug&&console.log("[store.autoForm] autosave attivo:",t),o},i.useStore=function(e,t,n,o={}){const[r,a,s]=i.store.signal(e,t,o);return n&&typeof n.onDispose=="function"&&typeof s=="function"&&n.onDispose(s),[r,a]},i._plugins=new Set,i.usePlugin=function(e,t){var n;if(e){if(i._plugins.has(e)){(n=i.config)!=null&&n.debug&&console.warn("[JSswift.usePlugin] plugin gi\xE0 installato:",e.name||e);return}if(typeof e=="function"){e(i,t),i._plugins.add(e);return}if(e&&typeof e.install=="function"){e.install(i,t),i._plugins.add(e);return}console.warn("[JSswift.usePlugin] plugin non valido:",e)}},i.plugins=i.plugins||{},i.plugins.debug={install(e){e.config.debug=!0,console.log("[JSswift] Debug mode ON")}},i.plugins.forms={install(e){const t={};e.forms={validate(n,o={},r={}){var l,f;if(typeof n=="string"&&(n=e.dom.q(n)),!n||!n.querySelectorAll)return console.warn("[forms.validate] form non valido:",n),null;const a={mode:r.mode||"input",showMessages:(l=r.showMessages)!=null?l:!0,submitGuard:(f=r.submitGuard)!=null?f:!0,errorClass:r.errorClass||"is-invalid",validClass:r.validClass||"is-valid",messageClass:r.messageClass||"form-error"},s={};for(const[m,h]of Object.entries(o)){const w=n.querySelectorAll(`[name="${m}"]`);if(!w.length)continue;const[T,C]=e.reactive.signal(null);s[m]={getErr:T,setErr:C,els:w};let v=null;a.showMessages&&(v=document.createElement("div"),v.className=a.messageClass,w[w.length-1].after(v));const y=()=>{let p;const b=w[0];if(b.type==="checkbox")p=b.checked;else if(b.type==="radio"){const L=Array.from(w).find(D=>D.checked);p=L?L.value:null}else p=b.value;let k=!0;try{k=h(p)}catch(L){k=L.message||"Errore di validazione"}const A=k===!0?null:typeof k=="string"?k:"Valore non valido";return C(A),!A};for(const p of w)p.addEventListener(a.mode,y);e.reactive.effect(()=>{const p=T();for(const b of w)b.classList.toggle(a.errorClass,!!p),b.classList.toggle(a.validClass,!p);v&&(v.textContent=p||"",v.style.display=p?"block":"none")}),y()}const c=e.store.computed(()=>Object.values(s).every(m=>!m.getErr())),d=m=>{let h=!0;for(const w of Object.values(s)){const T=w.els[0];T&&T.dispatchEvent(new Event(a.mode,{bubbles:!0})),w.getErr()&&(h=!1)}!h&&a.submitGuard&&(m.preventDefault(),m.stopPropagation())};a.submitGuard&&n.addEventListener("submit",d);const u=()=>{a.submitGuard&&n.removeEventListener("submit",d)};return t[n]={isValid:c,dispose:u},{isValid:c,dispose:u}}}}},i._authShared=(()=>{function e(o){const r=()=>{var s;return((s=o())==null?void 0:s.roles)||[]},a=()=>{var s;return((s=o())==null?void 0:s.permissions)||[]};return{roles:r,perms:a,hasRole:s=>r().includes(s),can:s=>a().includes(s),canAny:s=>s.some(c=>r().includes(c)||a().includes(c)),canAll:s=>s.every(c=>r().includes(c)||a().includes(c))}}function t(o,r){return r.some(a=>typeof a=="string"?o.startsWith(a):a instanceof RegExp?a.test(o):!1)}function n(o,r){if(!o||!r)return;let a=!1;function s(){return Date.now()}function c(m){if(!m||typeof m!="string")return null;const h=m.split(".");if(h.length<2)return null;try{const w=h[1].replace(/-/g,"+").replace(/_/g,"/"),T=decodeURIComponent(atob(w).split("").map(C=>"%"+C.charCodeAt(0).toString(16).padStart(2,"0")).join(""));return JSON.parse(T)}catch(w){return null}}function d(){var m,h,w,T;if(typeof r._getState=="function"){const C=r._getState();return C&&typeof C=="object"?C:{user:(h=(m=r.user)==null?void 0:m.call(r))!=null?h:null}}return{user:(T=(w=r.user)==null?void 0:w.call(r))!=null?T:null}}function u(){var y,p,b;const m=d()||{},h=(p=m.user)!=null?p:(y=r.user)==null?void 0:y.call(r),w=(h==null?void 0:h.name)||(h==null?void 0:h.email)||(h==null?void 0:h.id)||"anon",T=!!((b=r.isAuth)!=null&&b.call(r)),C=m.expiresAt||null,v=C?C-s():null;return T?`AUTH \u2705 user=${w}${C?` expiresIn=${Math.round(v/1e3)}s`:""}`:`AUTH \u274C user=${w}`}function l(m="auth"){var D,j,R;const h=d()||{},w=(j=h.user)!=null?j:(D=r.user)==null?void 0:D.call(r),T=(w==null?void 0:w.roles)||[],C=(w==null?void 0:w.permissions)||[],v=h.accessToken||null,y=h.refreshToken||null,p=v?c(v):null,b=h.expiresAt||(p!=null&&p.exp?p.exp*1e3:null),k=s(),A=b?b-k:null,L={label:m,isAuth:!!((R=r.isAuth)!=null&&R.call(r)),user:w,roles:T,permissions:C,has:{role:P=>{var M;return!!((M=r.hasRole)!=null&&M.call(r,P))},can:P=>{var M;return!!((M=r.can)!=null&&M.call(r,P))}},token:{hasAccess:!!v,hasRefresh:!!y,expiresAt:b,expiresInSec:A==null?null:Math.round(A/1e3),decodedJWT:p}};return console.groupCollapsed(`[JSswift.auth.inspect] ${m}`),console.log("status:",u()),console.log(L),A!=null&&(A<=0?console.warn("\u26A0\uFE0F Access token scaduto."):A<6e4&&console.warn("\u26A0\uFE0F Access token in scadenza (<60s).")),console.groupEnd(),L}function f(m=!0){a=!!m,console.log("[JSswift.auth.trace]",a?"ON":"OFF")}if(typeof r.fetch=="function"&&!r._fetchWrapped){const m=r.fetch.bind(r);r.fetch=async(...h)=>{const w=await m(...h);if(a)try{console.log("[auth.fetch]",w.status,h[0])}catch(T){}return w},r._fetchWrapped=!0}r.decodeJWT=c,r.status=u,r.inspect=l,r.trace=f}return{createPermissionApi:e,matchesProtectedPath:t,attachDevTools:n}})(),i.plugins.auth={install(e,t={}){var k;const{createPermissionApi:n,matchesProtectedPath:o,attachDevTools:r}=i._authShared,a={key:t.key||"auth",loginRoute:t.loginRoute||"/login",protected:t.protected||[],autoRedirect:(k=t.autoRedirect)!=null?k:!0,endpoints:t.endpoints||{login:"/api/login",refresh:"/api/refresh",logout:"/api/logout"},fetchOptions:t.fetchOptions||{},tokenHeader:t.tokenHeader||"Authorization",tokenPrefix:t.tokenPrefix||"Bearer ",refreshMargin:t.refreshMargin||3e4},[s,c]=e.store.signal(a.key,null),d=()=>{var A;return((A=s())==null?void 0:A.user)||null},u=()=>{var A;return!!((A=s())!=null&&A.accessToken)},{hasRole:l,can:f,canAny:m,canAll:h}=n(d);let w=!1,T=[];function C(){const A=s();return A!=null&&A.expiresAt?Date.now()>A.expiresAt-a.refreshMargin:!1}async function v(){var A;if(w)return new Promise((L,D)=>T.push({res:L,rej:D}));w=!0;try{const L=await fetch(a.endpoints.refresh,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:(A=s())==null?void 0:A.refreshToken})});if(!L.ok)throw new Error("Refresh failed");const D=await L.json();return c({...s(),...D}),T.forEach(j=>j.res(!0)),T=[],!0}catch(L){throw T.forEach(D=>D.rej(L)),T=[],c(null),a.autoRedirect&&e.router.navigate(a.loginRoute),L}finally{w=!1}}async function y(A){const L=await fetch(a.endpoints.login,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!L.ok)throw new Error("Login failed");const D=await L.json();return c(D),D}async function p(){try{await fetch(a.endpoints.logout,{method:"POST"})}catch(A){}c(null),a.autoRedirect&&e.router.navigate(a.loginRoute)}async function b(A,L={}){var P;C()&&await v();const D=s(),j=new Headers(L.headers||{});D!=null&&D.accessToken&&j.set(a.tokenHeader,a.tokenPrefix+D.accessToken);const R=await fetch(A,{...a.fetchOptions,...L,headers:j});return R.status===401&&((P=s())!=null&&P.refreshToken)&&!L._authRetried?(await v(),b(A,{...L,_authRetried:!0})):R}e.router.beforeEach(A=>{const L=A.path;return o(L,a.protected)&&!u()?a.loginRoute:!0}),e.auth={user:d,isAuth:u,hasRole:l,can:f,canAny:m,canAll:h,loginAsync:y,logoutAsync:p,fetch:b,_getState:s},e.useAuth=function(A){return A&&A.onDispose,e.auth},r(i,e.auth)}},i._httpShared=(()=>{function e(u){var F;const l=u.reactive,[f,m]=l.signal(0),[h,w]=l.signal("idle"),[T,C]=l.signal(null),[v,y]=l.signal(null),[p,b]=l.signal(null),[k,A]=l.signal(0),[L,D]=l.signal(0);let j=0;function R(g){const S=++j,z=Date.now();return m(f()+1),w("pending"),b(null),y(null),C({id:S,url:g.url,method:g.method,meta:g.meta,timeout:g.timeout,retry:g.retry,startedAt:z}),D(z),S}function P(g,S,z,I){const J=Date.now();m(Math.max(0,f()-1)),g===j&&(z?(w("error"),b(z),y(null)):S?(w("success"),b(null),y({id:g,status:S.status,ok:S.ok,headers:S.headers,url:S.url,receivedAt:J,raw:S})):(w("idle"),b(null),y(null)),A(Math.max(0,Number(I||0)))),D(J)}return{state:{inFlight:f,status:h,isLoading:(F=u.store)!=null&&F.computed?u.store.computed(()=>f()>0):()=>f()>0,lastRequest:T,lastResponse:v,lastError:p,lastDuration:k,lastUpdated:L,reset(){m(0),w("idle"),C(null),y(null),b(null),A(0),D(Date.now())}},markStart:R,markEnd:P}}function t(u,l){if(!u||/^https?:\/\//i.test(l))return l;const f=u.endsWith("/")?u.slice(0,-1):u,m=l.startsWith("/")?l:"/"+l;return f+m}function n(u){return new Promise(l=>setTimeout(l,u))}function o(u,l){return u?!0:l?l.status===429||l.status>=500&&l.status<=599:!1}function r(u,l){if(!u&&!l)return{signal:void 0,cancel:()=>{}};const f=new AbortController,m=f.signal;let h=null;u>0&&(h=setTimeout(()=>f.abort(new Error("timeout")),u));const w=()=>f.abort(l.reason||new Error("aborted"));return l&&(l.aborted?w():l.addEventListener("abort",w,{once:!0})),{signal:m,cancel:()=>{var C;h&&clearTimeout(h),l&&((C=l.removeEventListener)==null||C.call(l,"abort",w))}}}function a(u,l,f={}){var T,C,v;const m=typeof l=="string"?t(u.baseURL,l):l,h=(f.method||"GET").toUpperCase(),w=new Headers(u.headers);return f.headers&&new Headers(f.headers).forEach((y,p)=>w.set(p,y)),{url:m,method:h,headers:w,body:f.body,credentials:(T=f.credentials)!=null?T:u.credentials,signal:f.signal,timeout:(C=f.timeout)!=null?C:u.timeout,retry:(v=f.retry)!=null?v:u.retry,meta:f.meta||{}}}async function s(u,...l){var m;let f=l[0];for(const h of u)f=(m=await h(f,...l.slice(1)))!=null?m:f;return f}function c(u,l){return{ok:u.ok,status:u.status,headers:u.headers,raw:u,req:l,async json(){let f=null,m=null;try{f=await u.json()}catch(h){f=null}return u.ok||(m=f!=null?f:{status:u.status}),{data:f,error:m,ok:u.ok,status:u.status}},async jsonStrict(){const{data:f,error:m}=await this.json();if(m){const h=new Error(`HTTP error ${u.status} ${(l==null?void 0:l.method)||""} ${(l==null?void 0:l.url)||""}`.trim());throw h.status=u.status,h.data=f,h.req={url:l==null?void 0:l.url,method:l==null?void 0:l.method,meta:l==null?void 0:l.meta},h}return{data:f,ok:!0,status:u.status}},async text(){let f="";try{f=await u.text()}catch(m){}return{text:f,ok:u.ok,status:u.status}},async textStrict(){const f=await this.text();if(!f.ok){const m=new Error("HTTP error "+u.status);throw m.status=u.status,m.text=f.text,m}return f}}}function d(u,l,f,m,h={}){const w=new Headers(h.headers||{});return w.has("Content-Type")||w.set("Content-Type","application/json"),u(f,{...h,method:l,headers:w,body:m==null?void 0:JSON.stringify(m)})}return{createReactiveState:e,joinURL:t,sleep:n,isRetryable:o,makeAbort:r,normalizeRequest:a,runHooks:s,wrapResponse:c,withJSON:d}})();const{createReactiveState:pt,sleep:xe,isRetryable:Re,makeAbort:ht,normalizeRequest:mt,runHooks:Le,wrapResponse:Pe,withJSON:re}=i._httpShared,oe=typeof globalThis!="undefined"&&globalThis.JSswift_setting?globalThis.JSswift_setting:{},Me={baseURL:((Ie=oe.http)==null?void 0:Ie.baseURL)||"",timeout:(je=(Be=oe.http)==null?void 0:Be.timeout)!=null?je:0,retry:((Ue=oe.http)==null?void 0:Ue.retry)||{attempts:0,delay:250,factor:2},headers:((We=oe.http)==null?void 0:We.headers)||{},credentials:(He=oe.http)==null?void 0:He.credentials,debug:(qe=oe.debug)!=null?qe:!1},me=pt(i),le=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now(),K={beforeRequest:new Set,afterResponse:new Set,onError:new Set};async function yt(e){const t=i.auth&&typeof i.auth.fetch=="function"?i.auth.fetch.bind(i.auth):fetch,n={method:e.method,headers:e.headers,body:e.body,credentials:e.credentials,signal:e.signal};return t(e.url,n)}async function G(e,t={}){var h,w,T;let n=mt(Me,e,t);n=await Le(K.beforeRequest,n);const o=me.markStart(n),r=le(),a=n.retry||{attempts:0,delay:250,factor:2},s=Math.max(0,Number(a.attempts||0));let c=Math.max(0,Number(a.delay||0));const d=Math.max(1,Number(a.factor||2));let u=null,l=null,f=null,m=null;try{for(let C=0;C<=s;C++){u=null,l=null;const{signal:v,cancel:y}=ht(n.timeout,t.signal),p={...n,signal:v},b=le();try{Me.debug&&console.log("[http.request]",p.method,p.url),(h=i.perf)==null||h.inc("httpRequests"),(w=i.perf)==null||w.mark("http:req",{url:n.url,method:n.method});const k=await yt(p);l=k;const A=await Le(K.afterResponse,k,p),L=le()-b;if((T=i.perf)==null||T.tick("http:res",L,{status:k.status,url:n.url}),C<s&&Re(null,A)){y(),await xe(c),c=Math.round(c*d);continue}return y(),f=A,Pe(A,p)}catch(k){u=k,y();for(const A of K.onError)try{A(k,p)}catch(L){}if(C<s&&Re(k,null)){await xe(c),c=Math.round(c*d);continue}throw m=k,k}}}finally{const C=le()-r;me.markEnd(o,f,m,C)}if(u)throw u;return Pe(l,n)}i.http={},i.http.request=G,i.http.state=()=>me.state,i.http.get=(e,t)=>G(e,{...t,method:"GET"}),i.http.del=(e,t)=>G(e,{...t,method:"DELETE"}),i.http.post=(e,t,n)=>re(G,"POST",e,t,n),i.http.put=(e,t,n)=>re(G,"PUT",e,t,n),i.http.patch=(e,t,n)=>re(G,"PATCH",e,t,n),i.http.getJSON=async(e,t)=>(await G(e,{...t,method:"GET"})).jsonStrict(),i.http.delJSON=async(e,t)=>(await G(e,{...t,method:"DELETE"})).jsonStrict(),i.http.postJSON=async(e,t,n)=>(await re(G,"POST",e,t,n)).jsonStrict(),i.http.putJSON=async(e,t,n)=>(await re(G,"PUT",e,t,n)).jsonStrict(),i.http.patchJSON=async(e,t,n)=>(await re(G,"PATCH",e,t,n)).jsonStrict(),i.http.onBefore=function(e){return K.beforeRequest.add(e),()=>K.beforeRequest.delete(e)},i.http.onAfter=function(e){return K.afterResponse.add(e),()=>K.afterResponse.delete(e)},i.http.onError=function(e){return K.onError.add(e),()=>K.onError.delete(e)},window._http=i.http,i.useRouter=function(e){const t=i.router;return e&&e.onDispose,{navigate:t.navigate,back:()=>history.back(),forward:()=>history.forward(),get current(){return t}}},i.useRoute=function(e){const[t,n]=i.reactive.signal(""),[o,r]=i.reactive.signal({}),[a,s]=i.reactive.signal({}),[c,d]=i.reactive.signal(""),u=f=>{n(f.path||""),r(f.params||{}),s(f.query||{}),d(f.hash||"")},l=i.router.subscribe(u);return e&&typeof e.onDispose=="function"&&e.onDispose(l),{path:t,params:o,query:a,hash:c}},i._routerShared=(()=>{function e(c){return c?(c.startsWith("/")||(c="/"+c),c.length>1&&c.endsWith("/")&&(c=c.slice(0,-1)),c):"/"}function t(c,d=""){if(d&&c.startsWith(d)){const u=c.slice(d.length)||"/";return e(u)}return e(c)}function n(c){c=e(c);const d=[],u=c.replace(/([.+*?=^!${}()[\]|/\\])/g,"\\$1").replace(/\\\/:([A-Za-z0-9_]+)/g,(l,f)=>(d.push(f),"\\/([^\\/]+)"));return{pattern:c,regex:new RegExp("^"+u+"$"),keys:d}}function o(c){const d={};return new URLSearchParams(c||"").forEach((l,f)=>{d[f]===void 0?d[f]=l:Array.isArray(d[f])?d[f].push(l):d[f]=[d[f],l]}),d}function r(c){const d=[];for(const u of c)if(d.push({...u,_parent:null}),u.children&&u.children.length)for(const l of u.children)d.push({...l,_parent:u});return d.sort((u,l)=>l.path.length-u.path.length),d}function a(c,d){const u=e(c),l=r(d);for(const f of l){const m=f._compiled.regex.exec(u);if(!m)continue;const h={};return f._compiled.keys.forEach((w,T)=>{h[w]=decodeURIComponent(m[T+1])}),{route:f,params:h,parent:f._parent||null}}return null}function s(c,d,u=50){c.push({at:Date.now(),path:d.path,params:d.params,query:d.query,hash:d.hash}),c.length>u&&c.shift()}return{normalizePath:e,stripBase:t,compilePattern:n,parseQuery:o,flattenRoutes:r,matchRoute:a,pushHistoryEntry:s}})(),i._uiMetaShared=(()=>{function e(s){return{hasTabPanel:typeof s.TabPanel=="function",Card:typeof s.Card=="function"?s.Card:(...c)=>s.div({class:"cms-doc-card"},...c),Chip:typeof s.Chip=="function"?s.Chip:(c,d)=>s.span({class:"cms-chip cms-chip-fallback"},d)}}function t(s){return s?Array.isArray(s)?s.join(" | "):String(s):"\u2014"}function n(s,c,d){return s.div({class:"cms-doc-meta"},s.div({class:"cms-doc-meta-head"},s.div({class:"cms-doc-meta-name"},c.name),s.div({class:"cms-doc-meta-types"},...c.type?String(c.type).split("|").map(u=>d({color:"secondary",dense:!0,outline:!0},u)):[s.span("\u2014")])),s.div({class:"cms-doc-meta-grid"},s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Default"),s.div({class:"cms-doc-meta-value"},c.default==null?"\u2014":String(c.default))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Values"),s.div({class:"cms-doc-meta-value"},t(c.values)))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Description"),s.div({class:"cms-doc-meta-value"},c.description||"\u2014")))}function o(s,c){return s.div({class:"cms-doc-fallback"},c.map(d=>s.div({class:"cms-doc-fallback-item"},s.h4({class:"cms-doc-fallback-title"},d.label||d.name),d.content)))}function r(s,c){return c?Array.isArray(c)?c.map(d=>({name:d.name,wrap:!0,label:d.name,content:s.div({class:"cms-p-md"},d.description)})):Object.entries(c).map(([d,u])=>({name:d,wrap:!0,label:d,content:s.div({class:"cms-p-md"},u)})):[]}function a(s,c){return c?Array.isArray(c)?c.map(d=>({name:d.name,wrap:!0,label:d.type,content:d.description})):Object.entries(c).map(([d,u])=>({name:d,wrap:!0,label:d,content:s.div({class:"cms-doc-meta"},s.div({class:"cms-doc-meta-head"},s.div({class:"cms-doc-meta-name"},d)),s.div({class:"cms-doc-meta-grid"},s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Type"),s.div({class:"cms-doc-meta-value"},u.type||"\u2014"))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Description"),s.div({class:"cms-doc-meta-value"},u.description||"\u2014")))})):[]}return{resolveDocComponents:e,renderMetaItem:n,renderTabGroupFallback:o,normalizeEventRows:r,normalizeSlotRows:a}})(),i.ui=i.ui||{},i.ui.meta=i.ui.meta||{},i.ui.slot=function(t,n={}){const o=i.ui,{as:r="node",wrap:a="span",iconProps:s=null,filter:c=!0}=n,d=m=>document.createTextNode(String(m)),u=m=>_.span(String(m)),l=m=>{if(m==null||m===!1)return null;if(typeof m=="function")return m;if(Array.isArray(m))return m.flatMap(l).filter(Boolean);if(m&&typeof m=="object"&&m.nodeType)return m;if(typeof m=="string"||typeof m=="number"||typeof m=="boolean"){const h=String(m);return r==="icon"&&o.Icon?o.Icon(h,{class:"cms-slot-icon",...s||{}}):a==="text"?d(h):a==="span"?u(h):h}return a==="text"?d(m):a==="span"?u(m):String(m)},f=l(t);return c&&Array.isArray(f)?f.filter(Boolean):f},i.ui.slots=function(...t){const n=[];for(const o of t){const r=i.ui.slot(o);r&&(Array.isArray(r)?n.push(...r):n.push(r))}return n},i.docTable=e=>{var v;if(!i.isDev())return _.div();const{resolveDocComponents:t,renderMetaItem:n,renderTabGroupFallback:o,normalizeEventRows:r,normalizeSlotRows:a}=i._uiMetaShared,s=(v=i.ui.meta)==null?void 0:v[e];if(!s)return _.div({class:"cms-muted"},`Meta non trovata: ${e}`);const{hasTabPanel:c,Card:d,Chip:u}=t(_),l={};Object.entries(s.props||{}).forEach(([y,p])=>{const b=p.category||"general";l[b]||(l[b]=[]),l[b].push({name:y,...p})});const f=Object.keys(l).map(y=>{const p=l[y].map(b=>({name:b.name,wrap:!0,label:b.name,content:n(_,b,u)}));return{name:y,wrap:!0,label:y,content:c?_.TabPanel({orientation:"vertical",animated:!0,radius:"0 0 0 var(--cms-r-default)",tabs:p}):o(_,p)}}),m=r(_,s.events),h=a(_,s.slots),w=_.rod(null),T=[];h.length&&T.push({name:"Slots",wrap:!0,label:"Slots",content:c?_.TabPanel({animated:!0,radius:"0 0 0 var(--cms-r-default)",orientation:"vertical",tabs:h}):o(_,h)}),f.length&&T.push(...f),m.length&&T.push({name:"Events",wrap:!0,label:"Events",content:c?_.TabPanel({animated:!0,radius:"0 0 0 var(--cms-r-default)",orientation:"vertical",tabs:m}):o(_,m)});const C="general";return T.sort((y,p)=>y.name===C?-1:p.name===C?1:y.name.localeCompare(p.name)),d({class:"cms-doc-table"},_.div({class:"cms-doc-table-header"},_.div({class:"cms-doc-table-title"},`_.${e}`),s.signature?_.div({class:"cms-doc-table-signature"},String(s.signature).replaceAll("UI.","_.")):null),T.length?_.h4({class:"cms-doc-table-section-title"},f.length?"Props":"Documentation"):_.p({class:"cms-muted"},"Nessuna documentazione strutturata disponibile."),T.length?c?_.TabPanel({border:!0,animated:!0,orientation:"horizontal",tabs:T,model:w}):o(_,T):null,s.returns?_.p({class:"cms-muted",style:{marginTop:"14px"}},`Returns: ${s.returns}`):null)},i.ui.inspect=e=>{var t;return console.log(((t=i.ui.meta)==null?void 0:t[e])||"meta not found")},i.ui.can=function(e,t,n,o=null){var s,c;const r=i.useAuth?i.useAuth(e):i.auth;return r?(typeof t=="function"?!!t(r):((s=r.can)==null?void 0:s.call(r,t))||((c=r.hasRole)==null?void 0:c.call(r,t)))?typeof n=="function"?n():n:typeof o=="function"?o():o:typeof o=="function"?o():null},i.ui.canAny=function(e,t,n,o=null){var s;const r=i.useAuth?i.useAuth(e):i.auth;return!!((s=r==null?void 0:r.canAny)!=null&&s.call(r,t))?typeof n=="function"?n():n:typeof o=="function"?o():o},i.ui.canAll=function(e,t,n,o=null){var s;const r=i.useAuth?i.useAuth(e):i.auth;return!!((s=r==null?void 0:r.canAll)!=null&&s.call(r,t))?typeof n=="function"?n():n:typeof o=="function"?o():o},i.Can=function(t,n){var a,s;const o=i.useAuth?i.useAuth(n):i.auth;return(()=>{var c,d,u,l;return o?t.when&&typeof t.when=="function"?!!t.when(o):t.perm?!!((c=o.can)!=null&&c.call(o,t.perm)):t.role?!!((d=o.hasRole)!=null&&d.call(o,t.role)):t.any?!!((u=o.canAny)!=null&&u.call(o,t.any)):t.all?!!((l=o.canAll)!=null&&l.call(o,t.all)):!1:!1})()?typeof t.then=="function"?t.then():(a=t.then)!=null?a:null:typeof t.else=="function"?t.else():(s=t.else)!=null?s:null},i.router=(()=>{let e="history",t=[],n=null,o=null,r="",a=null,s=null,c=[],d=!1;const{normalizePath:u,stripBase:l,compilePattern:f,parseQuery:m,matchRoute:h,pushHistoryEntry:w}=i._routerShared,T={setOutlet:{description:"imposta il contenitore del router"},setBase:{description:"imposta il base path del router"},add:{description:"per aggiungere la route"},notFound:{description:"imposta la view 404"},beforeEach:{description:"hook prima di ogni navigazione"},start:{description:"avvia il router"},navigate:{description:"naviga verso una route"},subscribe:{description:"sottoscrive agli aggiornamenti di route"},current:{description:"ritorna l'URL corrente"},isActive:{description:"verifica se una route e\u0300 attiva"},status:{description:"stringa di stato router"},inspect:{description:"stampa info diagnostiche"},trace:{description:"abilita/disabilita tracing"},history:{description:"ritorna la history interna"},setURLOnly:{description:"aggiorna solo l'URL del browser senza render/meta"}};function C(E,{replace:x=!1}={}){const O=typeof E=="string"?new URL(E,window.location.origin):E,B=O.pathname+O.search+O.hash;if(e==="hash"||e==="auto"){if(history.pushState){const W="#"+B;x?history.replaceState({},"",W):history.pushState({},"",W);return}const q="#"+B;x?window.location.replace(q):window.location.hash=q;return}x?history.replaceState({},"",r+B):history.pushState({},"",r+B)}function v(){if(e==="hash"){const E=window.location.hash||"#/",x=E.startsWith("#")?E.slice(1):E;return new URL(x,window.location.origin)}if(e==="auto"&&window.location.hash.startsWith("#/")){const E=window.location.hash.slice(1);return new URL(E,window.location.origin)}return new URL(window.location.href)}function y(E,x=!1){if(e==="hash"||e==="auto"&&!history.pushState){const O="#"+(E.pathname+E.search+E.hash);x?window.location.replace(O):window.location.hash=O;return}x?history.replaceState({},"",r+E.pathname+E.search+E.hash):history.pushState({},"",r+E.pathname+E.search+E.hash)}function p(E){e=E||"history"}function b(E){return l(E,r)}function k(E){if(!E)return!1;const x=s?s.path:b(v().pathname);let O=E;typeof O=="string"&&(O.includes("?")||O.includes("#")||O.includes("://"))&&(O=new URL(O,window.location.origin).pathname);const B=b(O);return B.includes(":")?f(B).regex.test(x):B===x}async function A(E,{replace:x=!1}={}){if(!n){console.warn("[router] outlet non impostato. Usa JSswift.router.setOutlet('#app').");return}const O=typeof E=="string"?new URL(E,window.location.origin):E;d&&console.log("[router.navigate]",O.toString());const B=O.pathname+O.search+O.hash;y(O,x);const q=b(O.pathname),W=h(q,t),U={path:q,fullPath:B,params:W?W.params:{},query:m(O.search),hash:O.hash||"",navigate:L,outlet:n};if(a){const H=await a(U);if(H===!1)return;if(typeof H=="string"){L(H,{replace:!0});return}}if(typeof o=="function"){try{o()}catch(H){console.error("[router] unmount error:",H)}o=null}if(!W){const H=t._notFound;H?o=i.mount(n,()=>H(U),{clear:!0}):o=i.mount(n,_.div("404"),{clear:!0}),S(U),s=U,w(c,U);return}const Q=W.route.view,Z=W.parent;let ee=null;if(U.renderChild=H=>{if(!U._child)return null;const ne=typeof H=="string"?U.outlet.querySelector(H):H;return ne?(ee=i.mount(ne,()=>U._child.view(U._child.ctx),{clear:!0}),ee):(console.warn("[router] child outlet non trovato:",H),null)},Z){const H=W.route,ne={...U,params:{...U.params}};U._child={view:H.view,ctx:ne},o=i.mount(n,()=>Z.view(U),{clear:!0})}else U._child=null,o=i.mount(n,()=>Q(U),{clear:!0});S(U),s=U,w(c,U)}function L(E,x={}){const O=new URL(E,window.location.origin);A(O,x)}function D(){window.addEventListener("popstate",()=>{A(v(),{replace:!0})}),window.addEventListener("hashchange",()=>{(e==="hash"||e==="auto")&&A(v(),{replace:!0})}),document.addEventListener("click",E=>{var U,Q;const x=(Q=(U=E.target)==null?void 0:U.closest)==null?void 0:Q.call(U,"a");if(!x||E.defaultPrevented||E.button!==0||E.metaKey||E.ctrlKey||E.shiftKey||E.altKey||x.hasAttribute("download")||x.target&&x.target!=="_self")return;const O=x.getAttribute("href");if(!O||O.startsWith("mailto:")||O.startsWith("tel:"))return;const B=new URL(O,window.location.origin);if(B.origin!==window.location.origin)return;const q=new URL(window.location.href);B.pathname+B.search===q.pathname+q.search&&B.hash||(E.preventDefault(),L(B.pathname+B.search+B.hash))}),A(v(),{replace:!0})}function j(E){return n=typeof E=="string"?i.dom.q(E):E,n}function R(E){r=E?u(E):"",r==="/"&&(r="")}function P(E,x,O=null){const B=f(E),q={path:B.pattern,view:x,_compiled:B,children:[]};if(Array.isArray(O))for(const W of O){const[U,Q,Z]=W,ee=u(B.pattern+"/"+(U||"").replace(/^\//,""));q.children.push({path:ee,view:Q,_compiled:f(ee),children:Array.isArray(Z)?Z:[]})}t.push(q)}function M(E){t._notFound=E}function F(E){a=E}let g=new Set;function S(E){for(const x of g)try{x(E)}catch(O){console.error("[router] listener error:",O)}}function z(){if(!s)return"ROUTER \u23F3 not ready";const E=Object.keys(s.query||{}).length?"?":"";return`ROUTER ${s.path}${E} ${s.hash||""}`}function I(E="router"){if(!s)return console.warn("[router.inspect] nessuna route attiva"),null;const x={label:E,mode:typeof e!="undefined"?e:"unknown",base:r,path:s.path,params:s.params,query:s.query,hash:s.hash,outlet:n,timestamp:new Date().toISOString()};return console.groupCollapsed(`[JSswift.router.inspect] ${E}`),console.log(x),console.log("history:",c.slice()),console.groupEnd(),x}function J(E=!0){d=!!E,console.log("[JSswift.router.trace]",d?"ON":"OFF")}function N(){return c.slice()}return{meta:T,setOutlet:j,setBase:R,add:P,setURLOnly:C,notFound:M,beforeEach:F,start:D,navigate:L,isActive:k,subscribe(E){return g.add(E),()=>g.delete(E)},current(){return v?v():new URL(window.location.href)},status:z,inspect:I,trace:J,history:N}})(),($e=i.config)!=null&&$e.debug&&(window.$router=i.router),i.signal=i.reactive.signal,i.effect=i.reactive.effect,i.computed=i.reactive.computed,i.untracked=i.reactive.untracked,i.batch=i.reactive.batch;function se(e){return e==null?null:String(e).trim()||null}function ye(e){const t=Array.isArray(e)?e:typeof e=="string"?e.split(","):[],n=[],o=new Set;for(const r of t){const a=se(r);!a||o.has(a)||(o.add(a),n.push(a))}return n}function ge(){var e;return typeof document!="undefined"&&document.documentElement?document.documentElement:(e=i.dom)!=null&&e.q?i.dom.q("html"):null}function De(){try{return typeof globalThis!="undefined"&&globalThis.localStorage||null}catch(e){return null}}function fe(){var e;return se((e=i.theme)==null?void 0:e.storageKey)||"jsswift:theme"}function Oe(){const e=De();if(!e)return null;try{return se(e.getItem(fe()))}catch(t){return null}}function gt(e){const t=De();if(t)try{e==null?t.removeItem(fe()):t.setItem(fe(),e)}catch(n){}}function ze(e){var o,r,a,s,c;const t=ge(),n=[e,(o=i.theme)==null?void 0:o.themes,(r=i.config)==null?void 0:r.themes,typeof globalThis!="undefined"?(a=globalThis.JSswift_setting)==null?void 0:a.themes:null,typeof globalThis!="undefined"?(s=globalThis.JSswift_setting)==null?void 0:s.themeList:null,(c=t==null?void 0:t.getAttribute)==null?void 0:c.call(t,"data-themes")];for(const d of n){const u=ye(d);if(u.length)return u}return[]}i.theme=i.theme||{},i.theme.storageKey=fe(),ye(i.theme.themes).length||(i.theme.themes=ze()),i.setTheme=function(e,t={}){const n=se(e),o=ge();return o&&(n==null?o.removeAttribute("data-theme"):o.setAttribute("data-theme",n)),t.persist!==!1&&gt(n),o},i.getTheme=function(e={}){var r;const t=ge(),n=se((r=t==null?void 0:t.getAttribute)==null?void 0:r.call(t,"data-theme"));if(n)return n;if(e.storage===!1)return null;const o=Oe();return o&&t&&e.sync!==!1&&t.setAttribute("data-theme",o),o},i.toggleTheme=function(e,t={}){const n=ze(e),o=n.length?n:ye([i.getTheme({sync:!1}),"light","dark"]),r=i.getTheme({sync:!1}),a=se(t.fallback)||o[0]||"light",s=r?o.indexOf(r):-1,c=s>=0?o[(s+1)%o.length]:a;return i.theme.themes=o.slice(),i.setTheme(c,t),c};const Je=Oe();Je&&i.setTheme(Je,{persist:!1})})();
1
+ (()=>{var Fe,Ie,Be,je,Ue,We,He,qe,$e;window.JSswift=window.JSswift||{};const i=window.JSswift;window._=window.JSswift,i.config=i.config||{};const Ve=typeof globalThis!="undefined"&&globalThis.JSswift_setting?globalThis.JSswift_setting:{};i.config.debug=(Fe=Ve.modeDev)!=null?Fe:!1,i.isDev=function(){return i.config.debug},i.uiNormalizeArgs=function(e){let t={},n=e;return e.length>0&&typeof e[0]=="object"&&e[0]!==null&&!e[0].nodeType&&!Array.isArray(e[0])&&!(e[0]instanceof Function)&&(t=e[0],n=e.slice(1)),{props:t,children:n}},i.uiSizes=["xxs","xs","sm","md","lg","xl","xxl","xxxl"],i.uiColors=["primary","secondary","success","warning","danger","info","light","dark"],i.meta=i.meta||{version:"1.0.23",policy:{sourceOfTruth:"docDevelop/reference/core.md",syncRule:"Quando cambia un modulo core, aggiornare sia questo meta sia docDevelop/reference/core.md."},modules:{render:{description:"Bridge props -> DOM per hyperscript _, attributi, class, style, eventi e children reattivi.",entrypoints:["createElement","setProp","bindProp"],status:"milestone-3-closed",knownLimits:["Il mini-terzo-giro e il successivo micro-giro avanzato hanno chiuso style dinamico, eventi, children e props/attr speciali, ma restano altri edge case avanzati da esplorare.","Gli eventi ora supportano composizione base di listener multipli, ma non hanno ancora delegation o diff avanzato.","Restano da esplorare edge case avanzati del renderer oltre ai giri gia coperti dai test."]},reactive:{description:"Core minimale signal/effect usato come base della reattivita.",entrypoints:["JSswift.reactive.signal","JSswift.reactive.effect","JSswift.reactive.computed","JSswift.reactive.untracked","JSswift.reactive.batch"],status:"milestone-2-closed",knownLimits:["La protezione loop copre i loop sincroni per singolo effect, non ancora i cicli complessi tra effect multipli.","Il batching sincrono ora esiste, ma manca ancora scheduling configurabile oltre il flush immediato a fine batch.","Mancano primitive avanzate per controllare scheduling e transazioni asincrone."]},rod:{description:"Layer reattivo di alto livello per binding DOM, model e interpolazioni.",entrypoints:["_.rod","JSswift.rodBind","JSswift.rodModel"],status:"milestone-2-closed",knownLimits:["Va chiarito meglio il rapporto con JSswift.reactive oltre al primo riallineamento strutturale.","Restano casi avanzati di model/binding da esplorare oltre al primo giro coperto dai test.","Il modulo e piu pulito internamente ma non e ancora il punto finale della convergenza con il renderer."]},mount:{description:"Mount, component instances e cleanup automatico del tree DOM.",entrypoints:["JSswift.mount","JSswift.component","JSswift.enableAutoCleanup"],status:"milestone-2-closed",knownLimits:["Il lifecycle e piu pulito internamente ma resta da chiarire meglio la semantica su multi-mount e cloni.","Restano da esplorare edge case avanzati del cleanup automatico fuori dal primo giro gia coperto."]},platform:{description:"Moduli applicativi nel core: overlay, store, auth, http, router, UI meta.",entrypoints:["JSswift.overlay","JSswift.store","JSswift.plugins.auth","JSswift.http","JSswift.router","JSswift.ui.meta"],status:"milestone-2-closed",knownLimits:["Il secondo giro ha ripulito i moduli interni, ma mancano ancora demo separate per modulo e una validazione piu formale di alcune superfici pubbliche.","Esiste una demo browser aggregata del blocco platform, ma non ancora demo separate per ogni modulo.","Mancano configurazione pubblica piu coerente e confini piu netti tra auth, http e router.","Il registry UI meta non ha ancora validazione formale del suo shape."]}}},i.omit=(e,t)=>{const n={},o=new Set(t||[]);for(const r in e||{})o.has(r)||(n[r]=e[r]);return n},i._cleanupRegistry=new WeakMap,i._registerCleanup=function(e,t){if(!e||typeof t!="function")return t;const n=i._cleanupRegistry.get(e)||[];return n.push(t),i._cleanupRegistry.set(e,n),t},i.dom={q(e,t=document){return t.querySelector(e)},qa(e,t=document){return Array.from(t.querySelectorAll(e))},attr(e,t,n){return e?n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.setAttribute(t,String(n)),e):null}},(()=>{let e=[],t=!1;function n(){if(t)return;t=!0;const o=e.slice();e.length=0;for(const r of o)try{r()}catch(a){console.error("[JSswift.ready] error:",a)}}i.ready=function(o){typeof o=="function"&&(t||document.readyState==="interactive"||document.readyState==="complete"?queueMicrotask(()=>{try{o()}catch(r){console.error("[JSswift.ready] error:",r)}}):e.push(o))},document.addEventListener("DOMContentLoaded",n,{once:!0})})(),i.reactive=(()=>{let e=null;const t=[],n=100;let o=0,r="sync",a="sync",s=!1;const c=new Set;function d(p){const b=p==null?void 0:p.flush;if(b==null||b==="sync")return"sync";if(b==="microtask")return"microtask";throw new Error("JSswift.reactive.batch: options.flush must be 'sync' or 'microtask'")}function u(){for(;c.size;){const p=Array.from(c);c.clear(),p.forEach(b=>b())}}function l(){s||(s=!0,queueMicrotask(()=>{s=!1,a="sync",u()}))}function f(p){const b=Array.from(p);if(o>0||a==="microtask"){b.forEach(k=>c.add(k)),o===0&&a==="microtask"&&l();return}b.forEach(k=>k())}function m(p){if(p&&(p._deps.size&&(p._deps.forEach(b=>b.delete(p._runner)),p._deps.clear()),typeof p._cleanup=="function")){const b=p._cleanup;p._cleanup=null;try{b()}catch(k){console.error("[JSswift.reactive.effect] cleanup error:",k)}}}function h(p){if(!(!p||!p.active)){m(p),t.push(p),e=p;try{const b=A=>{p._cleanup=typeof A=="function"?A:null},k=p.fn.length>0?p.fn(b):p.fn();typeof k=="function"&&(p._cleanup=k)}finally{t.pop(),e=t[t.length-1]||null}}}function w(p){if(typeof p!="function")return()=>{};const b={fn:p,active:!0,_deps:new Set,_cleanup:null,_runner:null,_running:!1,_queued:!1},k=()=>{if(!b.active)return;if(b._running){b._queued=!0;return}b._running=!0;let A=0;try{do if(b._queued=!1,h(b),A++,A>=n){b._queued=!1,console.warn("[JSswift.reactive.effect] loop guard triggered: too many synchronous reruns",{max:n,effect:p.name||"anonymous"});break}while(b.active&&b._queued)}finally{b._running=!1}};return b._runner=k,k(),()=>{b.active&&(b.active=!1,m(b))}}function T(p){let b=p;const k=new Set;function A(){return e&&e.active&&(k.add(e._runner),e._deps.add(k)),b}function L(j){b=j,f(k)}function D(){k.clear()}return[A,L,D]}function C(p){if(typeof p!="function")throw new Error("JSswift.reactive.computed: fn must be a function");const[b,k,A]=T(void 0),L=w(()=>{k(p())}),D=()=>b();return D.dispose=()=>{L(),A()},D.peek=()=>b(),D.type="computed",D}function v(p){if(typeof p!="function")throw new Error("JSswift.reactive.untracked: fn must be a function");const b=e;e=null;try{return p()}finally{e=b}}function y(p,b){if(typeof p!="function")throw new Error("JSswift.reactive.batch: fn must be a function");const k=d(b);o===0?r=k:k==="microtask"&&(r="microtask"),o+=1;try{return p()}finally{if(o-=1,o===0){const A=r==="microtask"||a==="microtask";r="sync",A?(a="microtask",l()):u()}}}return{signal:T,effect:w,computed:C,untracked:v,batch:y}})(),i._overlayShared=(()=>{const e=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function t(a,s){const c=a();if(c&&c.isConnected)return c;let d=document.getElementById("cms-overlay-root");return!d&&(document!=null&&document.body)&&(d=document.createElement("div"),d.id="cms-overlay-root",d.className="cms-overlay-root",document.body.appendChild(d)),!document.body&&!d&&i.ready(()=>{let u=document.getElementById("cms-overlay-root");u||(u=document.createElement("div"),u.id="cms-overlay-root",u.className="cms-overlay-root",document.body.appendChild(u)),s(u)}),s(d),d}function n(a){var c;const s=a.querySelector(e);(c=s==null?void 0:s.focus)==null||c.call(s)}function o(a,s){if(a.key!=="Tab")return;const c=Array.from(s.querySelectorAll(e)).filter(f=>f.offsetParent!==null);if(!c.length)return;const d=c[0],u=c[c.length-1],l=document.activeElement;a.shiftKey&&l===d?(a.preventDefault(),u.focus()):!a.shiftKey&&l===u&&(a.preventDefault(),d.focus())}function r(a,s){var Q,Z,ee,H,ne,Ge;if(!s.anchorEl)return;const c=s.anchorEl.getBoundingClientRect(),d=a.getBoundingClientRect(),u=window.visualViewport||null,l=Math.max(0,Number(u==null?void 0:u.offsetLeft)||0),f=Math.max(0,Number(u==null?void 0:u.offsetTop)||0),m=Math.max(Number(u==null?void 0:u.width)||0,window.innerWidth||0,((Q=document.documentElement)==null?void 0:Q.clientWidth)||0),h=Math.max(Number(u==null?void 0:u.height)||0,window.innerHeight||0,((Z=document.documentElement)==null?void 0:Z.clientHeight)||0),w=Number((H=(ee=s.viewportGutter)!=null?ee:s.gutter)!=null?H:8),T=Number.isFinite(w)?Math.max(0,w):8,C=Number((ne=s.offsetX)!=null?ne:0),v=Number((Ge=s.offsetY)!=null?Ge:8),y=Number.isFinite(C)?C:0,p=Number.isFinite(v)?v:8,b=(V,$,X)=>!Number.isFinite(V)||(Number.isFinite($)||($=0),Number.isFinite(X)||(X=$),X<$)?$:Math.min(Math.max(V,$),X),k=String(s.placement||"bottom-start").toLowerCase(),[A,L]=k.split("-"),D=["top","bottom","left","right"].includes(A)?A:"bottom",j=["start","end","center"].includes(L)?L:"start",R={top:"bottom",bottom:"top",left:"right",right:"left"}[D]||"top",P=D==="top"||D==="bottom",M=d.width,F=d.height,g=V=>{let $=c.left+y,X=c.top+p;return V==="top"||V==="bottom"?(j==="center"?$=c.left+(c.width-M)/2+y:j==="end"&&($=c.right-M+y),X=V==="top"?c.top-F-p:c.bottom+p):(j==="center"?X=c.top+(c.height-F)/2+p:j==="end"&&(X=c.bottom-F+p),$=V==="left"?c.left-M-y:c.right+y),{left:$,top:X}},S=V=>V==="top"?c.top-p-T:V==="bottom"?h-c.bottom-p-T:V==="left"?c.left-y-T:m-c.right-y-T,z=S(D),I=S(R),N=(P?F:M)>z&&I>z?R:D,E=g(N),x=l+T,O=f+T,B=Math.max(x,l+m-M-T),q=Math.max(O,f+h-F-T),W=b(E.left,x,B),U=b(E.top,O,q);a.style.position="fixed",a.style.left=`${W}px`,a.style.top=`${U}px`}return{ensureRoot:t,focusFirst:n,trapFocus:o,applyAnchoredPosition:r}})(),i.overlay=(()=>{let e=0;const t=new Map;let n=null;const{ensureRoot:o,focusFirst:r,trapFocus:a,applyAnchoredPosition:s}=i._overlayShared,c=()=>o(()=>n,C=>{n=C});let d=0;const u=()=>{d++,d===1&&document.documentElement.classList.add("cms-scroll-locked")},l=()=>{d=Math.max(0,d-1),d===0&&document.documentElement.classList.remove("cms-scroll-locked")},f=()=>{let C=null;for(const v of t.values())C=v;return C},m=C=>{var y;let v=C;for(;v&&v!==document;){if(v.nodeType===1&&((y=v.getAttribute)==null?void 0:y.call(v,"data-cms-overlay-portal"))==="true")return!0;v=v.parentNode}return!1},h=(C,v={})=>{var S,z,I,J;const y=`ov_${++e}`,p={id:y,opts:v,isOpen:!0,anchorEl:v.anchorEl||null,placement:v.placement||"bottom-start",onClose:typeof v.onClose=="function"?v.onClose:null,overlay:null,panel:null,backdrop:null,reposition:null,_positionCleanup:null,_positionFrame:null,_panelResizeObserver:null,_cleanup:null},b=document.createElement("div");b.className=["cms-overlay",v.type?`type-${v.type}`:""].filter(Boolean).join(" "),b.dataset.id=y;const k=document.createElement("div");k.className="cms-overlay-backdrop",v.backdrop||(k.style.display="none");const A=document.createElement("div");A.className=["cms-overlay-panel",v.className].filter(Boolean).join(" "),A.tabIndex=-1;const L=typeof C=="function"?C({close:()=>w(y)}):C,D=i.ui.slot(L);Array.isArray(D)?D.forEach(N=>N&&A.appendChild(N)):D&&A.appendChild(D),b.appendChild(k),b.appendChild(A);const j=c();if(!j)return{id:y,close:()=>w(y),panel:A,overlay:b};j.appendChild(b),p.overlay=b,p.panel=A,p.backdrop=k,t.set(y,p),v.lockScroll&&u(),v.autoFocus!==!1&&setTimeout(()=>{A.isConnected&&t.get(y)===p&&!A.contains(document.activeElement)&&r(A)},0);const R=(N=null)=>{N&&typeof N=="object"&&Object.assign(p.opts,N),s(A,p.opts)},P=()=>{if(!v.anchorEl)return;const N=globalThis.requestAnimationFrame||(x=>setTimeout(()=>x(Date.now()),0)),E=globalThis.cancelAnimationFrame||clearTimeout;p._positionFrame!=null&&E(p._positionFrame),p._positionFrame=N(()=>{p._positionFrame=null,R()})};if(p.reposition=R,v.anchorEl){R(),P();const N=()=>R();if(window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),(z=(S=window.visualViewport)==null?void 0:S.addEventListener)==null||z.call(S,"resize",N),(J=(I=window.visualViewport)==null?void 0:I.addEventListener)==null||J.call(I,"scroll",N),typeof ResizeObserver=="function"){const E=new ResizeObserver(()=>R());E.observe(A),p._panelResizeObserver=E}p._positionCleanup=()=>{var x,O,B,q,W,U;const E=globalThis.cancelAnimationFrame||clearTimeout;p._positionFrame!=null&&(E(p._positionFrame),p._positionFrame=null),(O=(x=p._panelResizeObserver)==null?void 0:x.disconnect)==null||O.call(x),p._panelResizeObserver=null,window.removeEventListener("resize",N),window.removeEventListener("scroll",N,!0),(q=(B=window.visualViewport)==null?void 0:B.removeEventListener)==null||q.call(B,"resize",N),(U=(W=window.visualViewport)==null?void 0:W.removeEventListener)==null||U.call(W,"scroll",N)}}const M=N=>{const E=f();!E||E.id!==y||v.closeOnOutside!==!1&&(m(N.target)||A.contains(N.target)||w(y))};document.addEventListener("mousedown",M,!0);const F=N=>{const E=f();!E||E.id!==y||(v.trapFocus&&a(N,A),N.key==="Escape"&&v.closeOnEsc!==!1&&(N.preventDefault(),w(y)))};document.addEventListener("keydown",F,!0),k.addEventListener("click",()=>{v.closeOnBackdrop!==!1&&w(y)}),p._cleanup=()=>{var N;document.removeEventListener("mousedown",M,!0),document.removeEventListener("keydown",F,!0),(N=p._positionCleanup)==null||N.call(p)};const g=1e3+t.size*10;return b.style.zIndex=String(g),{id:y,close:()=>w(y),panel:A,overlay:b,reposition:R}},w=C=>{var y,p,b;const v=t.get(C);v&&(t.delete(C),(y=v._cleanup)==null||y.call(v),v.opts.lockScroll&&l(),typeof Y=="function"&&Y(v.overlay),(p=v.overlay)==null||p.remove(),(b=v.onClose)==null||b.call(v))};return{open:h,close:w,closeTop:()=>{const C=f();C&&w(C.id)},root:n,_stack:t}})();function be(e,t={}){const{isSVG:n=!1,normalizeClass:o=y=>String(y!=null?y:""),isContentProp:r=()=>!1,autoValueTags:a=new Set(["INPUT","TEXTAREA","SELECT"])}=t;function s(y){if(n||!(y in e))return!1;try{return typeof e[y]=="boolean"}catch(p){return!1}}function c(y){return n||y.startsWith("data-")||y.startsWith("aria-")||!(y in e)}function d(y,p){if(p==null){e.removeAttribute(y);return}if(p===!1){if(y.startsWith("aria-")){e.setAttribute(y,"false");return}e.removeAttribute(y);return}if(p===!0&&!n&&!y.startsWith("aria-")&&!y.startsWith("data-")){e.setAttribute(y,"");return}e.setAttribute(y,String(p))}function u(y,p){if(y==null)return;const b=String(y),k=b.startsWith("--")||b.includes("-");if(p==null||p===!1||p===""){k?e.style.removeProperty(b):e.style[b]="";return}if(k){e.style.setProperty(b,String(p));return}e.style[b]=p}function l(y){const p=o(y);if(p==null||p===!1||p===""){e.removeAttribute("class");return}e.setAttribute("class",String(p))}function f(y,p){const b=!!p;e[y]=b,b?e.setAttribute(y,""):e.removeAttribute(y)}function m(y){if(r(y)){e[y]="";return}if(y==="class"){e.removeAttribute("class");return}if(y==="style"){e.removeAttribute("style");return}if(s(y)){try{e[y]=!1}catch(p){}e.removeAttribute(y);return}if(e.removeAttribute(y),!c(y))try{typeof e[y]=="string"&&(e[y]="")}catch(p){}}function h(y){!y||typeof y!="object"||Object.entries(y).forEach(([p,b])=>{u(p,b)})}function w(y,p){if(r(y)){e[y]=p!=null?p:"";return}if(y==="class"){l(p);return}if(y==="style"){if(p==null||p===!1){m(y);return}if(typeof p=="object"){h(p);return}}if(s(y)){f(y,p);return}if(p==null||p===!1){m(y);return}if(c(y)){d(y,p);return}e[y]=p}function T(y,p){const b=String(y).split(".");let k=e;for(let A=0;A<b.length-1;A++)if(k=k==null?void 0:k[b[A]],!k)return;k[b[b.length-1]]=p}function C(y){return y?y==="auto"||y.startsWith("attr:")||y.startsWith("@")||y.startsWith("style.")||y.includes("."):!1}function v(y,p){if(!y||y==="auto"){a.has(e.tagName)?w("value",p):e.textContent=p!=null?p:"";return}if(y.startsWith("attr:")){d(y.slice(5),p);return}if(y.startsWith("@")){d(y.slice(1),p);return}if(y.startsWith("style.")){u(y.slice(6),p);return}if(y.includes(".")){T(y,p);return}w(y,p)}return{isBooleanDomProp:s,isAttributeOnlyProp:c,isBindingValueKey:C,setAttributeValue:d,setStyleEntry:u,setClassValue:l,setBooleanProp:f,removeProp:m,applyStyleObject:h,setProp:w,setPathValue:T,applyBindingValue:v}}function ie(e){const t=[],n=o=>{if(!(o==null||o===!1)){if(typeof o=="function"){n(o());return}if(o&&o.type==="rod"){n(o.value);return}if(Array.isArray(o)){o.forEach(n);return}if(typeof o=="object"){Object.entries(o).forEach(([r,a])=>{let s=a;typeof s=="function"?s=s():s&&s.type==="rod"&&(s=s.value),n(s?r:null)});return}o!==!0&&String(o).split(/\s+/).forEach(r=>{r&&t.push(r)})}};return n(e),t.length?Array.from(new Set(t)).join(" "):""}function de(e){return e==null||e===!1?!1:typeof e=="function"||e&&e.type==="rod"?!0:Array.isArray(e)?e.some(de):typeof e=="object"?Object.values(e).some(de):!1}function we(e,t){return e==null||e===!1?!1:typeof e=="function"||t(e)?!0:typeof e!="object"||Array.isArray(e)||e.nodeType?!1:Object.values(e).some(n=>we(n,t))}function Ke(e,t){let n=e;if(typeof n=="function"?n=n():t(n)&&(n=n.value),!n||typeof n!="object"||Array.isArray(n)||n.nodeType)return null;const o={};return Object.entries(n).forEach(([r,a])=>{let s=a;typeof s=="function"?s=s():t(s)&&(s=s.value),o[r]=s}),o}function Se(e){let t=new Set;function n(r){t.forEach(a=>{r.has(a)||e(a,null)}),t=r}function o(r,a){const s=Ke(r,a);if(!s){n(new Set);return}const c=new Set(Object.keys(s));n(c),Object.entries(s).forEach(([d,u])=>{e(d,u)})}return{apply:o}}function Qe(e){return typeof e=="string"&&(e.startsWith("on:")||e.startsWith("on")&&e.length>2)}const ve=128,te=[];function Xe(e,t){te.push({rod:e,value:String(t!=null?t:"")}),te.length>ve&&te.splice(0,te.length-ve)}function Ye(){if(!te.length)return null;const e=te.slice();return te.length=0,{items:e,index:0}}function pe(e,t){if(!t||!e||t.index>=t.items.length)return null;const n=[],o=String(e);let r=0,a=t.index,s=!1;for(;a<t.items.length;){const c=t.items[a],d=c.value;if(!d)break;const u=o.indexOf(d,r);if(u===-1)break;u>r&&n.push(o.slice(r,u)),n.push(c.rod),r=u+d.length,a++,s=!0}return s?(r<o.length&&n.push(o.slice(r)),t.index=a,n):null}function Ae(e){var n;let t="";for(const o of e)typeof o=="string"?t+=o:t+=(n=o==null?void 0:o.value)!=null?n:"";return t}function Ze(e){if(e.startsWith("on:"))return e.slice(3);const t=e.slice(2);return t?t==="DoubleClick"?"dblclick":t.toLowerCase():""}function ce(e){return e==null||e===!1?!1:e===!0?{capture:!0}:typeof e=="boolean"?e:typeof e=="object"?{capture:!!e.capture,passive:!!e.passive,once:!!e.once}:!1}function et(e,t){const n=ce(e),o=ce(t);return typeof n=="boolean"||typeof o=="boolean"?n===o:!!n&&!!o&&n.capture===o.capture&&n.passive===o.passive&&n.once===o.once}function ae(e,t){return Array.isArray(e)?e.some(n=>ae(n,t)):t(e)?!0:!e||typeof e!="object"||Array.isArray(e)||e.nodeType?!1:Array.isArray(e.handlers)?e.handlers.some(n=>ae(n,t))||t(e.options)||typeof e.options=="function":Array.isArray(e.listeners)?e.listeners.some(n=>ae(n,t))||t(e.options)||typeof e.options=="function":t(e.handler)||t(e.listener)||t(e.fn)||t(e.options)||typeof e.options=="function"}function ue(e,t,n){var o,r,a,s,c,d,u;if(e==null||e===!1)return[];if(typeof e=="function")return[{handler:e,options:ce(n!=null?n:!1)}];if(t(e))return ue(e.value,t,n);if(Array.isArray(e))return e.flatMap(l=>ue(l,t,n));if(typeof e=="object"&&!Array.isArray(e)&&!e.nodeType){if(Array.isArray(e.handlers)||Array.isArray(e.listeners)){const m=e.handlers||e.listeners||[],h=(r=(o=e.options)!=null?o:n)!=null?r:!1;return m.flatMap(w=>ue(w,t,h))}let l=(c=(s=(a=e.handler)!=null?a:e.listener)!=null?s:e.fn)!=null?c:null,f=(u=(d=e.options)!=null?d:n)!=null?u:!1;return t(l)&&(l=l.value),t(f)&&(f=f.value),typeof f=="function"&&(f=f()),typeof l=="function"?[{handler:l,options:ce(f)}]:[]}return[]}function tt(e,t){return ue(e,t)}function nt(e,t,n,o){const r=Ze(t);if(!r)return;const a={listeners:[]},s=()=>{a.listeners.forEach(d=>{e.removeEventListener(r,d.dispatch,d.options)}),a.listeners=[]},c=d=>{const u=tt(d,o);a.listeners.length===u.length&&a.listeners.every((f,m)=>{const h=u[m];return f.handler===h.handler&&et(f.options,h.options)})||(s(),u.forEach(f=>{const m={handler:f.handler,options:f.options,dispatch:null};m.dispatch=h=>{if(typeof m.handler=="function"){const w=m.handler.call(e,h);return m.options&&typeof m.options=="object"&&m.options.once&&(e.removeEventListener(r,m.dispatch,m.options),a.listeners=a.listeners.filter(T=>T!==m)),w}},e.addEventListener(r,m.dispatch,m.options),a.listeners.push(m)}))};if(i._registerCleanup(e,s),o(n)){const d=i.reactive.effect(()=>{c(n.value)});i._registerCleanup(e,d);return}if(ae(n,o)){const d=i.reactive.effect(()=>{c(n)});i._registerCleanup(e,d);return}c(n)}function rt(e,t={}){const{isRod:n=()=>!1,interpolationCursor:o=null}=t;function r(l){const f=document.createTextNode(""),m=i.rodBind(f,l);return i._registerCleanup(f,m),f}function a(l){e.appendChild(r(l))}function s(l){const f=document.createTextNode("");e.appendChild(f);const m=i.reactive.effect(()=>{f.textContent=Ae(l)});i._registerCleanup(f,m)}function c(l){const f=[],m=h=>{if(!(h==null||h===!1)){if(Array.isArray(h)){h.forEach(m);return}if(typeof h=="string"){f.push(document.createTextNode(h));return}if(typeof h=="number"){f.push(document.createTextNode(String(h)));return}if(typeof h!="boolean"){if(n(h)){f.push(r(h));return}if(h!=null&&h.nodeType){f.push(h);return}f.push(document.createTextNode(String(h)))}}};return m(l),f}function d(l){const f=document.createComment("dyn");e.appendChild(f);let m=[];const h=i.reactive.effect(()=>{m.forEach(v=>{Y(v),v.parentNode&&v.parentNode.removeChild(v)}),m=[];const w=f.parentNode;if(!w)return;const T=c(l());if(!T.length)return;const C=document.createDocumentFragment();T.forEach(v=>C.appendChild(v)),w.insertBefore(C,f.nextSibling),m=T});i._registerCleanup(f,()=>{h(),m.forEach(w=>Y(w)),m=[]})}function u(l){if(l!=null){if(Array.isArray(l)){for(const f of l)u(f);return}if(typeof l=="string"){const f=pe(l,o);f?s(f):e.appendChild(document.createTextNode(l));return}if(typeof l=="number"){e.appendChild(document.createTextNode(String(l)));return}if(typeof l=="function"){d(l);return}if(n(l)){a(l);return}l.nodeType&&e.appendChild(l)}}return{appendRodText:a,appendInterpolatedText:s,appendDynamicChild:d,appendChildValue:u}}function ot(e,t={}){const{el:n,isRod:o=()=>!1,interpolationCursor:r=null,appendChildValue:a=()=>{},appendRodText:s=()=>{},appendInterpolatedText:c=()=>{},appendDynamicChild:d=()=>{},bindProp:u=()=>{}}=t;for(const l of e)if(l!=null){if(Array.isArray(l)){a(l);continue}if(typeof l=="string"){const f=pe(l,r);f?c(f):n.appendChild(document.createTextNode(l));continue}if(typeof l=="number"){n.appendChild(document.createTextNode(String(l)));continue}if(typeof l=="function"){d(l);continue}if(o(l)){s(l);continue}if(l.nodeType){n.appendChild(l);continue}if(typeof l=="object")for(const[f,m]of Object.entries(l)){if(typeof m=="string"){const h=pe(m,r);if(h){u(f,()=>Ae(h));continue}}if(f==="class"){u(f,m);continue}if(f==="style"&&typeof m=="object"&&m!==null&&!o(m)){u(f,m);continue}u(f,m)}}}const _e="http://www.w3.org/2000/svg",st=new Set(["svg","g","path","circle","ellipse","line","rect","polygon","polyline","text","tspan","defs","linearGradient","radialGradient","stop","use","symbol","clipPath","mask","pattern","filter","feGaussianBlur","feOffset","feBlend","feColorMatrix"]);function he(e){return e==="innerHTML"||e==="innerText"||e==="textContent"||e==="value"}function it(e,...t){const n=st.has(e),o=e==="text"&&!n?document.createTextNode(""):n?document.createElementNS(_e,e):document.createElement(e),r=g=>!!g&&g.type==="rod",a=Ye(),s=rt(o,{isRod:r,interpolationCursor:a}),{appendRodText:c,appendInterpolatedText:d,appendDynamicChild:u,appendChildValue:l}=s,f=be(o,{isSVG:n,normalizeClass:ie,isContentProp:he}),{isBooleanDomProp:m,isBindingValueKey:h,applyBindingValue:w,setStyleEntry:T,setProp:C,setClassValue:v}=f;function y(g){const S=i.reactive.effect(g);return i._registerCleanup(o,S),S}function p(g){if(String((g==null?void 0:g.tagName)||"").toLowerCase()!=="input")return!1;const S=String((g==null?void 0:g.type)||"").toLowerCase();return S==="range"||S==="number"}function b(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()!=="input"?"":String((g==null?void 0:g.type)||"").toLowerCase()}function k(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()==="select"&&!g.multiple}function A(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()==="input"&&String((g==null?void 0:g.type)||"").toLowerCase()==="file"}function L(g,S,z){y(()=>{var N;const J=(N=S.value)!=null?N:"";g.value!==String(J)&&C("value",J)});const I=()=>{let J=g.value;const N=b(g),E=typeof S.value=="number"||S.value==null;if(k(g)&&g.value==="")J=null;else if(p(g)&&E)if(N==="number"&&g.value==="")J=null;else{const x=typeof g.valueAsNumber=="number"&&!Number.isNaN(g.valueAsNumber)?g.valueAsNumber:Number(g.value);J=Number.isNaN(x)?N==="number"?null:0:x}S.value!==J&&(S.value=J)};g.addEventListener(z,I),i._registerCleanup(g,()=>{g.removeEventListener(z,I)})}function D(g,S){y(()=>{const I=!!S.value;!!g.checked!==I&&C("checked",I)});const z=()=>{const I=!!g.checked;S.value!==I&&(S.value=I)};g.addEventListener("change",z),i._registerCleanup(g,()=>{g.removeEventListener("change",z)})}function j(g,S){const z=()=>{var J;return String((J=g.value)!=null?J:"on")};y(()=>{const N=(S.value==null?null:String(S.value))===z();!!g.checked!==N&&C("checked",N)});const I=()=>{if(!g.checked)return;const J=z();S.value!==J&&(S.value=J)};g.addEventListener("change",I),i._registerCleanup(g,()=>{g.removeEventListener("change",I)})}function R(g,S){const z=()=>{const J=g.files;return J==null?[]:Array.isArray(J)?J.slice():typeof J.length=="number"?Array.from(J):[J]};y(()=>{const J=S.value;(J==null||Array.isArray(J)&&J.length===0)&&(g.value!==""&&C("value",""),Array.isArray(g.files)&&(g.files=[]))});const I=()=>{const J=z();S.value=J};g.addEventListener("change",I),i._registerCleanup(g,()=>{g.removeEventListener("change",I)})}function P(g,S){const z=()=>Array.from(g.childNodes||[]).filter(N=>(N==null?void 0:N.tagName)==="OPTION"&&N.selected).map(N=>{var E;return String((E=N.value)!=null?E:"")}),I=()=>{const N=Array.isArray(S.value)?S.value.map(x=>String(x)):[],E=new Set(N);Array.from(g.childNodes||[]).forEach(x=>{var B;if((x==null?void 0:x.tagName)!=="OPTION")return;const O=E.has(String((B=x.value)!=null?B:""));!!x.selected!==O&&(x.selected=O,O?x.setAttribute("selected",""):x.removeAttribute("selected"))})};y(I),g._cmsApplySelectedValues=I,queueMicrotask(I);const J=()=>{const N=z(),E=Array.isArray(S.value)?S.value.map(x=>String(x)):[];E.length===N.length&&E.every((x,O)=>x===N[O])||(S.value=N)};g.addEventListener("change",J),i._registerCleanup(g,()=>{g.removeEventListener("change",J)})}function M(g,S){y(()=>{const N=!!S.value;!!g.selected!==N&&C("selected",N)});let z=null;const I=()=>{const N=!!g.selected;S.value!==N&&(S.value=N)};queueMicrotask(()=>{var N;z||((N=g.parentNode)==null?void 0:N.tagName)!=="SELECT"||(z=g.parentNode,z.addEventListener("change",I))}),i._registerCleanup(g,()=>{z==null||z.removeEventListener("change",I)})}function F(g,S){if(Qe(g)){nt(o,g,S,r);return}if(g==="class"){if(de(S)){y(()=>{v(ie(S))});return}v(ie(S));return}if(g==="style"&&S&&typeof S=="object"){const z=Se(T);if(we(S,r)){y(()=>{z.apply(S,r)});return}z.apply(S,r);return}if(g==="style"&&(typeof S=="function"||r(S))){const z=Se(T);y(()=>{z.apply(S,r)});return}if(h(g)&&typeof S=="function"){y(()=>{w(g,S())});return}if(h(g)&&!r(S)){w(g,S);return}if(typeof S=="function"){y(()=>{C(g,S())});return}if(g==="value"&&r(S)&&(e==="input"||e==="textarea"||e==="select")){if(e==="select"&&o.multiple){P(o,S);return}L(o,S,e==="select"?"change":"input");return}if(g==="checked"&&r(S)&&e==="input"){if(String(o.type||"").toLowerCase()==="radio"){j(o,S);return}D(o,S);return}if(g==="files"&&r(S)&&A(o)){R(o,S);return}if(g==="selected"&&r(S)&&e==="option"){M(o,S);return}if(he(g)&&r(S)){y(()=>{C(g,S.value)});return}if(r(S)){const z=i.rodBind(o,S,{key:g});i._registerCleanup(o,z);return}C(g,S)}return ot(t,{el:o,isRod:r,interpolationCursor:a,appendChildValue:l,appendRodText:c,appendInterpolatedText:d,appendDynamicChild:u,bindProp:F}),e==="select"&&typeof o._cmsApplySelectedValues=="function"&&o._cmsApplySelectedValues(),o}const bt={},Ee=["html","head","title","base","link","meta","style","body","header","footer","main","section","article","aside","nav","h1","h2","h3","h4","h5","h6","p","div","span","pre","blockquote","hr","br","address","a","abbr","b","bdi","bdo","cite","code","data","dfn","em","i","kbd","mark","q","rp","rt","ruby","s","samp","small","strong","sub","sup","time","u","var","wbr","ul","ol","li","dl","dt","dd","table","caption","colgroup","col","thead","tbody","tfoot","tr","th","td","form","label","input","textarea","button","select","option","optgroup","fieldset","legend","datalist","output","progress","meter","img","picture","source","iframe","embed","object","param","audio","video","track","details","summary","dialog","script","noscript","canvas","template","slot","svg","g","path","circle","ellipse","line","rect","polygon","polyline","text","tspan","defs","linearGradient","radialGradient","stop","use","symbol","clipPath","mask","pattern","filter","feGaussianBlur","feOffset","feBlend","feColorMatrix"];Ee.forEach(e=>{window._[e]=(...t)=>it(e,...t)}),_.DOM_ELEMENTS=Ee,_.fragment=(...e)=>e,_.dynamic=function(e){const t=document.createComment("dyn"),n=document.createDocumentFragment();n.appendChild(t);let o=null;return i.reactive.effect(()=>{const r=e();if(o&&o.parentNode&&o.parentNode.removeChild(o),o=null,r==null)return;let a=r;(typeof r=="string"||typeof r=="number")&&(a=document.createTextNode(String(r)));const s=t.parentNode;s&&a&&a.nodeType&&(s.insertBefore(a,t.nextSibling),o=a)}),n};function ct(){let e=!1;const t=new Set;function n(){var r,a,s;e=!1,(r=i.debug)==null||r.inc("rodFlushes"),(a=i.perf)==null||a.inc("rodFlushes"),(s=i.perf)==null||s.mark("rod:flush");const o=Array.from(t);t.clear();for(const c of o)try{c()}catch(d){console.error("[rod] flush error:",d)}}return function(r){t.add(r),e||(e=!0,queueMicrotask(n))}}const at=ct();function Ce(e,t,n){if(!e)return;if(e.nodeType===3){e.textContent=n!=null?n:"";return}be(e,{isSVG:e.namespaceURI===_e,normalizeClass:ie,isContentProp:he}).applyBindingValue(t,n)}function ut(e){return{type:"rod",value:e,_bindings:[],_actions:[],_disposeHooks:[],_disposed:!1,_silentDepth:0,_pending:!1,bindings(){return this._bindings.map(n=>({el:n.el,key:n.key}))},onDispose(n){return typeof n=="function"&&this._disposeHooks.push(n),this},_bind(n,o={key:"auto"}){var s;if(this._disposed)return()=>{};if(!n)return()=>{};const r={el:n,key:(s=o==null?void 0:o.key)!=null?s:"auto"};return this._bindings.some(c=>c.el===r.el&&c.key===r.key)||this._bindings.push(r),Ce(r.el,r.key,this.value),()=>{this._bindings=this._bindings.filter(c=>!(c.el===r.el&&c.key===r.key))}},action(n){return!this._disposed&&typeof n=="function"&&this._actions.push(n),this},_setSilent(n){this._silentDepth++;try{this.value=n}finally{this._silentDepth--}return this},_scheduleNotify(){this._disposed||this._pending||(this._pending=!0,at(()=>{this._pending=!1,this._notifyNow()}))},_notifyNow(){var o,r,a,s,c;if(this._disposed)return;const n=performance.now();(o=i.perf)==null||o.inc("rodNotifies"),this._bindings=this._bindings.filter(d=>{const u=d.el;return u?u.nodeType===3?!!u.parentNode:u.isConnected!==!1:!1});for(const d of this._bindings)Ce(d.el,d.key,this.value);if(!(this._silentDepth>0)){for(const d of this._actions)try{d(this.value)}catch(u){console.error("[rod] action error:",u)}(r=i.debug)==null||r.inc("rodNotifies"),(c=i.perf)==null||c.tick("rod:notify",performance.now()-n,{bindings:((a=this._bindings)==null?void 0:a.length)||0,actions:((s=this._actions)==null?void 0:s.length)||0})}},dispose(){if(!this._disposed){this._disposed=!0;for(const n of this._disposeHooks)try{n()}catch(o){console.error("[rod] dispose hook error:",o)}this._bindings.length=0,this._actions.length=0,this._disposeHooks.length=0}}}}function lt(e,t="value"){var s;let n=e[t],o=null,r=null,a=null;return(s=i==null?void 0:i.reactive)!=null&&s.signal&&([o,r,a]=i.reactive.signal(n),a&&typeof e.onDispose=="function"&&e.onDispose(a)),Object.defineProperty(e,t,{get(){return o?o():n},set(c){r?r(c):n=c,e._scheduleNotify()},configurable:!0}),typeof e.val!="function"&&Object.defineProperty(e,"val",{value(c){return arguments.length?(this.value=c,c):this.value},configurable:!0}),e[Symbol.toPrimitive]||Object.defineProperty(e,Symbol.toPrimitive,{value(c){const d=this.value;if(d==null)return d;const u=typeof d;return c==="number"?Number(d):(u!=="symbol"&&Xe(this,d),u==="string"||u==="number"||u==="boolean"||u==="bigint"||u==="symbol"?d:String(d))},configurable:!0}),e.valueOf||Object.defineProperty(e,"valueOf",{value(){return this.value},configurable:!0}),e.toString||Object.defineProperty(e,"toString",{value(){return String(this.value)},configurable:!0}),e}_.rod=function(t,n="value"){const o=ut(t);return lt(o,n),i.rod._all=i.rod._all||new Set,i.rod._all.add(o),typeof o.onDispose=="function"&&o.onDispose(()=>i.rod._all.delete(o)),o},i.rodBind=function(e,t,n={key:"auto"}){var o,r,a;if((o=i.debug)==null||o.inc("rodBinds"),!e)return(r=i.debug)==null||r.inc("rodBindNull"),(a=i.debug)==null||a.warn("rodBind: target element \xE8 null/undefined",n),()=>{};if(!t||t.type!=="rod")throw new Error("JSswift.rodBind: react must be a rod object");return t._bind(e,n)},i.rodFromSignal=function(e,t){const n=_.rod(e());let o=!1;const r=i.reactive.effect(()=>{const s=n.value,c=i.reactive.untracked(()=>e());if(!o&&c!==s){o=!0;try{t(s)}finally{o=!1}}}),a=i.reactive.effect(()=>{const s=e();if(i.reactive.untracked(()=>n.value)!==s){o=!0;try{n._setSilent(s)}finally{o=!1}}});return typeof n.onDispose=="function"&&(n.onDispose(r),n.onDispose(a)),n};function ke(e){if(!e||!e.tagName)return null;const t=e.tagName.toLowerCase();if(t==="input"){const n=(e.type||"text").toLowerCase();return n==="checkbox"?"checkbox":n==="radio"?"radio":n==="number"?"number":"text"}return t==="select"?e.multiple?"select-multiple":"select":null}i.rodModel=function(e,t,n={}){var l,f,m;if(!t||t.type!=="rod")throw new Error("[JSswift.rodModel] rodObj deve essere un rod");const o=Array.isArray(e)||e instanceof NodeList?Array.from(e):[e],r=(l=n.event)!=null?l:"change",a=(f=n.parse)!=null?f:(h=>h),s=(m=n.format)!=null?m:(h=>h);let c=!1;const d=[],u=h=>{for(const w of o){if(!w)continue;switch(ke(w)){case"checkbox":w.checked=!!h;break;case"radio":w.checked=w.value==h;break;case"select":w.value=h!=null?h:"";break;case"select-multiple":const C=Array.isArray(h)?h.map(String):[];for(const v of w.options)v.selected=C.includes(v.value);break;default:w.value=h!=null?h:""}}};t.action(h=>{if(!c){c=!0;try{u(s(h))}finally{c=!1}}}),u(s(t.value));for(const h of o){if(!h)continue;const w=ke(h),T=()=>{if(c)return;let C;switch(w){case"checkbox":C=h.checked;break;case"radio":if(!h.checked)return;C=h.value;break;case"select":C=h.value;break;case"select-multiple":C=Array.from(h.selectedOptions).map(v=>v.value);break;case"number":C=a(h.value===""?null:Number(h.value));break;default:C=a(h.value)}c=!0;try{t.value!==C&&(t.value=C)}finally{c=!1}};h.addEventListener(r,T),d.push(()=>h.removeEventListener(r,T))}return typeof t.onDispose=="function"&&t.onDispose(()=>d.forEach(h=>h())),()=>d.forEach(h=>h())},i.signalModel=function(e,t,n,o={}){const r=i.rodFromSignal(t,n);return i.rodModel(e,r,o)};function Y(e){if(!e)return;const t=i._cleanupRegistry.get(e);if(t){for(const n of t)try{n()}catch(o){console.error("[cleanup] error:",o)}i._cleanupRegistry.delete(e)}if(e.childNodes&&e.childNodes.length)for(const n of e.childNodes)Y(n)}function ft(e){const t=n=>typeof n=="string"?i.dom.q(n):n;return Array.isArray(e)?e.map(t).filter(Boolean):[t(e)].filter(Boolean)}function dt(e){const t=[],n=[],o=r=>{if(r!=null){if(typeof r=="function"){o(r());return}if(r&&typeof r=="object"&&"node"in r){typeof r.dispose=="function"&&n.push(r.dispose),o(r.node);return}if(Array.isArray(r)){for(const a of r)o(a);return}if(typeof r=="string"||typeof r=="number"){t.push(document.createTextNode(String(r)));return}if(r.nodeType){t.push(r);return}console.warn("[JSswift.mount] contenuto non supportato:",r)}};return o(e),{nodes:t,disposers:n}}function Te(e=[],t="[JSswift.mount] dispose error:"){let n=!1;return()=>{if(!n){n=!0;for(const o of e)try{o()}catch(r){console.error(t,r)}}}}function Ne(e=[],t=null){return Te([...t?[t]:[],...e],"[component] dispose error:")}i.mount=function(e,t,n={}){var d;const o=ft(e),r=(d=n.clear)!=null?d:!0,a=o.length>1;if(o.length===0)return console.warn("[JSswift.mount] nessun target valido:",e),()=>{};const s=[];for(const u of o){if(r)for(;u.firstChild;)Y(u.firstChild),u.removeChild(u.firstChild);const{nodes:l,disposers:f}=dt(t);let m=l;a&&typeof t!="function"&&(m=l.map(w=>w.cloneNode(!0)),f.length&&console.warn("[JSswift.mount] multi-target con dispose: usa content come function per istanze separate."));const h=Te(f);for(const w of m)u.appendChild(w);s.push({root:u,nodes:m,dispose:h});for(const w of m)!w||!w.nodeType||i._registerCleanup(w,h)}return()=>{var u;for(const l of s){for(const f of l.nodes)f&&(Y(f),f.parentNode===l.root&&l.root.removeChild(f));(u=l.dispose)==null||u.call(l)}}},i.component=function(e){if(typeof e!="function")throw new Error("JSswift.component: renderFn must be a function");return function(n={}){const o=[],a=e(n,{onDispose(s){typeof s=="function"&&o.push(s)}});return a&&typeof a=="object"&&"node"in a?{node:a.node,dispose:Ne(o,typeof a.dispose=="function"?a.dispose:null)}:{node:a,dispose:Ne(o)}}},i.enableAutoCleanup=function(){if(i._autoCleanupEnabled)return;i._autoCleanupEnabled=!0;const e=new MutationObserver(t=>{for(const n of t)for(const o of n.removedNodes)Y(o)});e.observe(document.body,{childList:!0,subtree:!0}),i._cleanupObserver=e},i.debug=(()=>{const e={rodFlushes:0,rodNotifies:0,rodBinds:0,rodBindNull:0,rodBindDup:0};function t(){return!!i.config.debug}function n(...d){t()&&console.log("[JSswift]",...d)}function o(...d){t()&&console.warn("[JSswift]",...d)}function r(...d){console.error("[JSswift]",...d)}function a(d,u=1){e[d]||(e[d]=0),e[d]+=u}function s(){return{...e}}function c(){for(const d of Object.keys(e))e[d]=0}return{enabled:t,log:n,warn:o,error:r,inc:a,stats:s,reset:c}})(),i.perf=(()=>{let e=!1;const t={effectsRun:0,effectsSlow:0,rodNotifies:0,rodFlushes:0,domWrites:0,httpRequests:0},n=[],o=[],r={timelineMax:200,slowEffectMs:8};function a(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function s(b,k=0,A=null){e&&(n.push({t:Date.now(),type:b,ms:k,meta:A}),n.length>r.timelineMax&&n.shift())}function c(b,k=1){e&&(t[b]=(t[b]||0)+k)}function d(b,k){e&&(o.push({t:Date.now(),ms:b,meta:k}),o.length>100&&o.shift())}let u=null;function l(){u||(u=i.reactive.effect,i.reactive.effect=function(b,k){return u((...L)=>{const D=a();c("effectsRun");try{return b(...L)}finally{const j=a()-D;j>=r.slowEffectMs?(c("effectsSlow"),d(j,k||b.name||"effect"),s("effect:slow",j,k||b.name||null)):s("effect",j,k||b.name||null)}})})}function f(){u&&(i.reactive.effect=u,u=null)}function m(b=!0){return e=!!b,e?l():f(),e}function h(){for(const b of Object.keys(t))t[b]=0;n.length=0,o.length=0}function w(){return{enabled:e,...t,slowEffectMs:r.slowEffectMs,timelineSize:n.length}}function T(){return n.slice()}function C(b=r.slowEffectMs){return o.filter(k=>k.ms>=b).slice().sort((k,A)=>A.ms-k.ms)}function v(b,k){const A=a();try{return k()}finally{const L=a()-A;s("time:"+b,L,b)}}function y(b,k){s(b,0,k)}function p(b,k,A){s(b,k,A)}return{enable:m,reset:h,stats:w,timeline:T,slowEffects:C,time:v,mark:y,tick:p,inc:c,cfg:r}})(),i.rod=i.rod||{},i.rod.inspect=function(e,t="rod"){if(!e||e.type!=="rod")return console.warn("[JSswift.rod.inspect] non \xE8 un rod:",e),null;const n=typeof e.bindings=="function"?e.bindings():[],o={label:t,value:e.value,bindingsCount:n.length,bindings:n.map(r=>{var a,s,c,d,u,l,f;return{key:r.key,el:((a=r.el)==null?void 0:a.nodeType)===3?"#text":(s=r.el)==null?void 0:s.tagName,id:((c=r.el)==null?void 0:c.id)||null,className:((d=r.el)==null?void 0:d.className)||null,isConnected:((u=r.el)==null?void 0:u.nodeType)===3?!!r.el.parentNode:(f=(l=r.el)==null?void 0:l.isConnected)!=null?f:null}}),actionsCount:Array.isArray(e._actions)?e._actions.length:null,disposed:!!e._disposed};return i.config.debug?(console.groupCollapsed(`[JSswift.rod.inspect] ${t}`),console.log(o),console.groupEnd()):console.log(o),o},i.rod.inspectAll=function(){const e=i.rod._all?Array.from(i.rod._all):[];return e.forEach((t,n)=>i.rod.inspect(t,`rod#${n+1}`)),e.length},i._storeShared=(()=>{function e(a){return`${a.storage}::${a.prefix}`}function t(a,s){function c(f={}){var h,w;const m={storage:(h=f.storage)!=null?h:a.storage,prefix:(w=f.prefix)!=null?w:a.prefix};return s.set(e(m),m),m}function d(f=null){var h;return(typeof f=="string"?f:(h=f==null?void 0:f.storage)!=null?h:a.storage)==="session"?window.sessionStorage:window.localStorage}function u(f,m=null){return(m||c()).prefix+f}function l(f,m=null){const h=m||c();return`${e(h)}::${f}`}return{getScope:c,getStorage:d,fullKey:u,channelKey:l}}function n(a){try{return JSON.parse(a)}catch(s){return}}function o(a){try{return JSON.stringify(a)}catch(s){return}}function r(a,...s){const c=`${a.storage}::${a.prefix}::`;for(const d of s)for(const u of Array.from(d.keys()))u.startsWith(c)&&d.delete(u)}return{createScopeTools:t,safeParse:n,safeStringify:o,clearScopedMapEntries:r}})(),i.store=(()=>{const e={prefix:"JSswift:",storage:"local",syncTabs:!0,writeDelay:0},t=new Map,n=new Map,o=new Map,r=new Map;let a=!1;const{createScopeTools:s,safeParse:c,safeStringify:d,clearScopedMapEntries:u}=i._storeShared,{getScope:l,getStorage:f,fullKey:m,channelKey:h}=s(e,r);function w(R,P,M=null){var S;const F=M||l(),g=n.get(h(R,F));if(g)for(const z of g)try{(S=i.reactive)!=null&&S.untracked?i.reactive.untracked(()=>z(P)):z(P)}catch(I){console.error("[store] watcher error:",I)}}function T(){a=!1;for(const[R,P]of Array.from(o.entries())){o.delete(R);const M=t.get(R),F=d(M);if(F===void 0)continue;const g=f(P.scope);try{g.setItem(m(P.key,P.scope),F)}catch(S){console.error("[store] write error:",S)}}}function C(R,P=null){const M=P||l();o.set(h(R,M),{key:R,scope:M}),!a&&(a=!0,e.writeDelay>0?setTimeout(T,e.writeDelay):queueMicrotask(T))}function v(R,P=null){const M=P||l(),g=f(M).getItem(m(R,M));if(g!=null)return c(g)}function y(R,P,M=null){const F=M||l(),g=h(R,F);if(t.has(g))return t.get(g);const S=v(R,F);return S!==void 0?(t.set(g,S),S):P}function p(R,P,M=null){const F=M||l();return t.set(h(R,F),P),C(R,F),w(R,P,F),P}function b(R,P=null){const M=P||l(),F=h(R,M);t.delete(F),o.delete(F);try{f(M).removeItem(m(R,M))}catch(g){}w(R,void 0,M)}function k(R={}){const P=l(R),M=f(P),F=[];for(let g=0;g<M.length;g++){const S=M.key(g);S&&S.startsWith(P.prefix)&&F.push(S)}for(const g of F)M.removeItem(g);u(P,t,o,n)}function A(R,P,M=null){if(typeof P!="function")return()=>{};const F=M||l(),g=h(R,F);return n.has(g)||n.set(g,new Set),n.get(g).add(P),()=>{var S;return(S=n.get(g))==null?void 0:S.delete(P)}}function L(R,P,M={}){const F=l({storage:M.storage,prefix:M.prefix}),g=y(R,P,F),[S,z,I]=i.reactive.signal(g),J=i.reactive.effect(()=>{const x=S();p(R,x,F)}),N=A(R,x=>{S()!==x&&z(x)},F);return[S,z,()=>{try{J==null||J()}catch(x){}try{N==null||N()}catch(x){}try{I==null||I()}catch(x){}}]}l(),e.syncTabs&&window.addEventListener("storage",R=>{if(!(!R.key||!R.storageArea))for(const P of r.values()){if(f(P)!==R.storageArea||!R.key.startsWith(P.prefix))continue;const M=R.key.slice(P.prefix.length),F=R.newValue==null?void 0:c(R.newValue),g=h(M,P);F===void 0?t.delete(g):t.set(g,F),w(M,F,P)}});function D(R={}){Object.assign(e,R),l()}function j(){return{prefix:e.prefix,storage:e.storage,syncTabs:e.syncTabs,cacheSize:t.size,scopeCount:r.size}}return{configure:D,stats:j,get:y,set:p,remove:b,clear:k,watch:A,signal:L}})(),i.store.computed=function(e){if(typeof e!="function")throw new Error("store.computed: fn must be a function");return i.reactive.computed(e)},i.store.migrate=function(e,t,n={}){var c,d;const o=(c=n.versionKey)!=null?c:"__version",r=Number((d=i.store.get(o,0))!=null?d:0),a=Number(e!=null?e:0);if(!Number.isFinite(a)||a<0)throw new Error("store.migrate: targetVersion non valido");if(r>=a)return{from:r,to:a,applied:0};let s=0;for(let u=r;u<a;u++){const l=t==null?void 0:t[u];if(typeof l=="function")try{l(i.store)}catch(f){console.error("[store.migrate] step error at version",u,f)}s++,i.store.set(o,u+1)}return{from:r,to:a,applied:s}},i.store.model=function(e,t,n,o={}){if(typeof t!="string"||!t)throw new Error("store.model: key deve essere una stringa non vuota");const[r,a,s]=i.store.signal(t,n,{storage:o.storage,prefix:o.prefix}),c=i.rodFromSignal(r,a),d=i.rodModel(e,c,{event:o.event,parse:o.parse,format:o.format});return()=>{var u;try{d==null||d()}catch(l){}try{s==null||s()}catch(l){}try{(u=c.dispose)==null||u.call(c)}catch(l){}}},i.store.bind=function(e,t,n,o={}){var a;let r=e;return typeof e=="string"&&(e.includes("[")||e.includes(" ")?r=document.querySelectorAll(e):r=i.dom.q(e)),r?i.store.model(r,t,n,o):((a=i.config)!=null&&a.debug&&console.warn("[store.bind] target non trovato:",e),()=>{})},i.store.bindAll=function(e,t={},n={}){if(typeof e=="string"&&(e=i.dom.q(e)),!e||!e.querySelectorAll)return console.warn("[store.bindAll] form non valido:",e),()=>{};const o=[];for(const[r,a]of Object.entries(t)){const s=e.querySelectorAll(`[name="${r}"]`);if(!s.length)continue;const c=i.store.model(s.length===1?s[0]:s,r,a,n);o.push(c)}return()=>o.forEach(r=>r())},i.store.inspect=function(){const e={...i.store.stats(),keys:Array.from((function(){const t=i.store.stats().storage==="session"?sessionStorage:localStorage,n=[];for(let o=0;o<t.length;o++){const r=t.key(o);r&&r.startsWith(i.store.stats().prefix)&&n.push(r.replace(i.store.stats().prefix,""))}return n})())};return console.groupCollapsed("[JSswift.store.inspect]"),console.table(e.keys),console.log(e),console.groupEnd(),e},i.store.autoForm=function(e,t={},n={}){var r;const o=i.store.bindAll(e,t,n);return(r=i.config)!=null&&r.debug&&console.log("[store.autoForm] autosave attivo:",t),o},i.useStore=function(e,t,n,o={}){const[r,a,s]=i.store.signal(e,t,o);return n&&typeof n.onDispose=="function"&&typeof s=="function"&&n.onDispose(s),[r,a]},i._plugins=new Set,i.usePlugin=function(e,t){var n;if(e){if(i._plugins.has(e)){(n=i.config)!=null&&n.debug&&console.warn("[JSswift.usePlugin] plugin gi\xE0 installato:",e.name||e);return}if(typeof e=="function"){e(i,t),i._plugins.add(e);return}if(e&&typeof e.install=="function"){e.install(i,t),i._plugins.add(e);return}console.warn("[JSswift.usePlugin] plugin non valido:",e)}},i.plugins=i.plugins||{},i.plugins.debug={install(e){e.config.debug=!0,console.log("[JSswift] Debug mode ON")}},i.plugins.forms={install(e){const t={};e.forms={validate(n,o={},r={}){var l,f;if(typeof n=="string"&&(n=e.dom.q(n)),!n||!n.querySelectorAll)return console.warn("[forms.validate] form non valido:",n),null;const a={mode:r.mode||"input",showMessages:(l=r.showMessages)!=null?l:!0,submitGuard:(f=r.submitGuard)!=null?f:!0,errorClass:r.errorClass||"is-invalid",validClass:r.validClass||"is-valid",messageClass:r.messageClass||"form-error"},s={};for(const[m,h]of Object.entries(o)){const w=n.querySelectorAll(`[name="${m}"]`);if(!w.length)continue;const[T,C]=e.reactive.signal(null);s[m]={getErr:T,setErr:C,els:w};let v=null;a.showMessages&&(v=document.createElement("div"),v.className=a.messageClass,w[w.length-1].after(v));const y=()=>{let p;const b=w[0];if(b.type==="checkbox")p=b.checked;else if(b.type==="radio"){const L=Array.from(w).find(D=>D.checked);p=L?L.value:null}else p=b.value;let k=!0;try{k=h(p)}catch(L){k=L.message||"Errore di validazione"}const A=k===!0?null:typeof k=="string"?k:"Valore non valido";return C(A),!A};for(const p of w)p.addEventListener(a.mode,y);e.reactive.effect(()=>{const p=T();for(const b of w)b.classList.toggle(a.errorClass,!!p),b.classList.toggle(a.validClass,!p);v&&(v.textContent=p||"",v.style.display=p?"block":"none")}),y()}const c=e.store.computed(()=>Object.values(s).every(m=>!m.getErr())),d=m=>{let h=!0;for(const w of Object.values(s)){const T=w.els[0];T&&T.dispatchEvent(new Event(a.mode,{bubbles:!0})),w.getErr()&&(h=!1)}!h&&a.submitGuard&&(m.preventDefault(),m.stopPropagation())};a.submitGuard&&n.addEventListener("submit",d);const u=()=>{a.submitGuard&&n.removeEventListener("submit",d)};return t[n]={isValid:c,dispose:u},{isValid:c,dispose:u}}}}},i._authShared=(()=>{function e(o){const r=()=>{var s;return((s=o())==null?void 0:s.roles)||[]},a=()=>{var s;return((s=o())==null?void 0:s.permissions)||[]};return{roles:r,perms:a,hasRole:s=>r().includes(s),can:s=>a().includes(s),canAny:s=>s.some(c=>r().includes(c)||a().includes(c)),canAll:s=>s.every(c=>r().includes(c)||a().includes(c))}}function t(o,r){return r.some(a=>typeof a=="string"?o.startsWith(a):a instanceof RegExp?a.test(o):!1)}function n(o,r){if(!o||!r)return;let a=!1;function s(){return Date.now()}function c(m){if(!m||typeof m!="string")return null;const h=m.split(".");if(h.length<2)return null;try{const w=h[1].replace(/-/g,"+").replace(/_/g,"/"),T=decodeURIComponent(atob(w).split("").map(C=>"%"+C.charCodeAt(0).toString(16).padStart(2,"0")).join(""));return JSON.parse(T)}catch(w){return null}}function d(){var m,h,w,T;if(typeof r._getState=="function"){const C=r._getState();return C&&typeof C=="object"?C:{user:(h=(m=r.user)==null?void 0:m.call(r))!=null?h:null}}return{user:(T=(w=r.user)==null?void 0:w.call(r))!=null?T:null}}function u(){var y,p,b;const m=d()||{},h=(p=m.user)!=null?p:(y=r.user)==null?void 0:y.call(r),w=(h==null?void 0:h.name)||(h==null?void 0:h.email)||(h==null?void 0:h.id)||"anon",T=!!((b=r.isAuth)!=null&&b.call(r)),C=m.expiresAt||null,v=C?C-s():null;return T?`AUTH \u2705 user=${w}${C?` expiresIn=${Math.round(v/1e3)}s`:""}`:`AUTH \u274C user=${w}`}function l(m="auth"){var D,j,R;const h=d()||{},w=(j=h.user)!=null?j:(D=r.user)==null?void 0:D.call(r),T=(w==null?void 0:w.roles)||[],C=(w==null?void 0:w.permissions)||[],v=h.accessToken||null,y=h.refreshToken||null,p=v?c(v):null,b=h.expiresAt||(p!=null&&p.exp?p.exp*1e3:null),k=s(),A=b?b-k:null,L={label:m,isAuth:!!((R=r.isAuth)!=null&&R.call(r)),user:w,roles:T,permissions:C,has:{role:P=>{var M;return!!((M=r.hasRole)!=null&&M.call(r,P))},can:P=>{var M;return!!((M=r.can)!=null&&M.call(r,P))}},token:{hasAccess:!!v,hasRefresh:!!y,expiresAt:b,expiresInSec:A==null?null:Math.round(A/1e3),decodedJWT:p}};return console.groupCollapsed(`[JSswift.auth.inspect] ${m}`),console.log("status:",u()),console.log(L),A!=null&&(A<=0?console.warn("\u26A0\uFE0F Access token scaduto."):A<6e4&&console.warn("\u26A0\uFE0F Access token in scadenza (<60s).")),console.groupEnd(),L}function f(m=!0){a=!!m,console.log("[JSswift.auth.trace]",a?"ON":"OFF")}if(typeof r.fetch=="function"&&!r._fetchWrapped){const m=r.fetch.bind(r);r.fetch=async(...h)=>{const w=await m(...h);if(a)try{console.log("[auth.fetch]",w.status,h[0])}catch(T){}return w},r._fetchWrapped=!0}r.decodeJWT=c,r.status=u,r.inspect=l,r.trace=f}return{createPermissionApi:e,matchesProtectedPath:t,attachDevTools:n}})(),i.plugins.auth={install(e,t={}){var k;const{createPermissionApi:n,matchesProtectedPath:o,attachDevTools:r}=i._authShared,a={key:t.key||"auth",loginRoute:t.loginRoute||"/login",protected:t.protected||[],autoRedirect:(k=t.autoRedirect)!=null?k:!0,endpoints:t.endpoints||{login:"/api/login",refresh:"/api/refresh",logout:"/api/logout"},fetchOptions:t.fetchOptions||{},tokenHeader:t.tokenHeader||"Authorization",tokenPrefix:t.tokenPrefix||"Bearer ",refreshMargin:t.refreshMargin||3e4},[s,c]=e.store.signal(a.key,null),d=()=>{var A;return((A=s())==null?void 0:A.user)||null},u=()=>{var A;return!!((A=s())!=null&&A.accessToken)},{hasRole:l,can:f,canAny:m,canAll:h}=n(d);let w=!1,T=[];function C(){const A=s();return A!=null&&A.expiresAt?Date.now()>A.expiresAt-a.refreshMargin:!1}async function v(){var A;if(w)return new Promise((L,D)=>T.push({res:L,rej:D}));w=!0;try{const L=await fetch(a.endpoints.refresh,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:(A=s())==null?void 0:A.refreshToken})});if(!L.ok)throw new Error("Refresh failed");const D=await L.json();return c({...s(),...D}),T.forEach(j=>j.res(!0)),T=[],!0}catch(L){throw T.forEach(D=>D.rej(L)),T=[],c(null),a.autoRedirect&&e.router.navigate(a.loginRoute),L}finally{w=!1}}async function y(A){const L=await fetch(a.endpoints.login,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!L.ok)throw new Error("Login failed");const D=await L.json();return c(D),D}async function p(){try{await fetch(a.endpoints.logout,{method:"POST"})}catch(A){}c(null),a.autoRedirect&&e.router.navigate(a.loginRoute)}async function b(A,L={}){var P;C()&&await v();const D=s(),j=new Headers(L.headers||{});D!=null&&D.accessToken&&j.set(a.tokenHeader,a.tokenPrefix+D.accessToken);const R=await fetch(A,{...a.fetchOptions,...L,headers:j});return R.status===401&&((P=s())!=null&&P.refreshToken)&&!L._authRetried?(await v(),b(A,{...L,_authRetried:!0})):R}e.router.beforeEach(A=>{const L=A.path;return o(L,a.protected)&&!u()?a.loginRoute:!0}),e.auth={user:d,isAuth:u,hasRole:l,can:f,canAny:m,canAll:h,loginAsync:y,logoutAsync:p,fetch:b,_getState:s},e.useAuth=function(A){return A&&A.onDispose,e.auth},r(i,e.auth)}},i._httpShared=(()=>{function e(u){var F;const l=u.reactive,[f,m]=l.signal(0),[h,w]=l.signal("idle"),[T,C]=l.signal(null),[v,y]=l.signal(null),[p,b]=l.signal(null),[k,A]=l.signal(0),[L,D]=l.signal(0);let j=0;function R(g){const S=++j,z=Date.now();return m(f()+1),w("pending"),b(null),y(null),C({id:S,url:g.url,method:g.method,meta:g.meta,timeout:g.timeout,retry:g.retry,startedAt:z}),D(z),S}function P(g,S,z,I){const J=Date.now();m(Math.max(0,f()-1)),g===j&&(z?(w("error"),b(z),y(null)):S?(w("success"),b(null),y({id:g,status:S.status,ok:S.ok,headers:S.headers,url:S.url,receivedAt:J,raw:S})):(w("idle"),b(null),y(null)),A(Math.max(0,Number(I||0)))),D(J)}return{state:{inFlight:f,status:h,isLoading:(F=u.store)!=null&&F.computed?u.store.computed(()=>f()>0):()=>f()>0,lastRequest:T,lastResponse:v,lastError:p,lastDuration:k,lastUpdated:L,reset(){m(0),w("idle"),C(null),y(null),b(null),A(0),D(Date.now())}},markStart:R,markEnd:P}}function t(u,l){if(!u||/^https?:\/\//i.test(l))return l;const f=u.endsWith("/")?u.slice(0,-1):u,m=l.startsWith("/")?l:"/"+l;return f+m}function n(u){return new Promise(l=>setTimeout(l,u))}function o(u,l){return u?!0:l?l.status===429||l.status>=500&&l.status<=599:!1}function r(u,l){if(!u&&!l)return{signal:void 0,cancel:()=>{}};const f=new AbortController,m=f.signal;let h=null;u>0&&(h=setTimeout(()=>f.abort(new Error("timeout")),u));const w=()=>f.abort(l.reason||new Error("aborted"));return l&&(l.aborted?w():l.addEventListener("abort",w,{once:!0})),{signal:m,cancel:()=>{var C;h&&clearTimeout(h),l&&((C=l.removeEventListener)==null||C.call(l,"abort",w))}}}function a(u,l,f={}){var T,C,v;const m=typeof l=="string"?t(u.baseURL,l):l,h=(f.method||"GET").toUpperCase(),w=new Headers(u.headers);return f.headers&&new Headers(f.headers).forEach((y,p)=>w.set(p,y)),{url:m,method:h,headers:w,body:f.body,credentials:(T=f.credentials)!=null?T:u.credentials,signal:f.signal,timeout:(C=f.timeout)!=null?C:u.timeout,retry:(v=f.retry)!=null?v:u.retry,meta:f.meta||{}}}async function s(u,...l){var m;let f=l[0];for(const h of u)f=(m=await h(f,...l.slice(1)))!=null?m:f;return f}function c(u,l){return{ok:u.ok,status:u.status,headers:u.headers,raw:u,req:l,async json(){let f=null,m=null;try{f=await u.json()}catch(h){f=null}return u.ok||(m=f!=null?f:{status:u.status}),{data:f,error:m,ok:u.ok,status:u.status}},async jsonStrict(){const{data:f,error:m}=await this.json();if(m){const h=new Error(`HTTP error ${u.status} ${(l==null?void 0:l.method)||""} ${(l==null?void 0:l.url)||""}`.trim());throw h.status=u.status,h.data=f,h.req={url:l==null?void 0:l.url,method:l==null?void 0:l.method,meta:l==null?void 0:l.meta},h}return{data:f,ok:!0,status:u.status}},async text(){let f="";try{f=await u.text()}catch(m){}return{text:f,ok:u.ok,status:u.status}},async textStrict(){const f=await this.text();if(!f.ok){const m=new Error("HTTP error "+u.status);throw m.status=u.status,m.text=f.text,m}return f}}}function d(u,l,f,m,h={}){const w=new Headers(h.headers||{});return w.has("Content-Type")||w.set("Content-Type","application/json"),u(f,{...h,method:l,headers:w,body:m==null?void 0:JSON.stringify(m)})}return{createReactiveState:e,joinURL:t,sleep:n,isRetryable:o,makeAbort:r,normalizeRequest:a,runHooks:s,wrapResponse:c,withJSON:d}})();const{createReactiveState:pt,sleep:xe,isRetryable:Re,makeAbort:ht,normalizeRequest:mt,runHooks:Le,wrapResponse:Pe,withJSON:re}=i._httpShared,oe=typeof globalThis!="undefined"&&globalThis.JSswift_setting?globalThis.JSswift_setting:{},Me={baseURL:((Ie=oe.http)==null?void 0:Ie.baseURL)||"",timeout:(je=(Be=oe.http)==null?void 0:Be.timeout)!=null?je:0,retry:((Ue=oe.http)==null?void 0:Ue.retry)||{attempts:0,delay:250,factor:2},headers:((We=oe.http)==null?void 0:We.headers)||{},credentials:(He=oe.http)==null?void 0:He.credentials,debug:(qe=oe.debug)!=null?qe:!1},me=pt(i),le=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now(),K={beforeRequest:new Set,afterResponse:new Set,onError:new Set};async function yt(e){const t=i.auth&&typeof i.auth.fetch=="function"?i.auth.fetch.bind(i.auth):fetch,n={method:e.method,headers:e.headers,body:e.body,credentials:e.credentials,signal:e.signal};return t(e.url,n)}async function G(e,t={}){var h,w,T;let n=mt(Me,e,t);n=await Le(K.beforeRequest,n);const o=me.markStart(n),r=le(),a=n.retry||{attempts:0,delay:250,factor:2},s=Math.max(0,Number(a.attempts||0));let c=Math.max(0,Number(a.delay||0));const d=Math.max(1,Number(a.factor||2));let u=null,l=null,f=null,m=null;try{for(let C=0;C<=s;C++){u=null,l=null;const{signal:v,cancel:y}=ht(n.timeout,t.signal),p={...n,signal:v},b=le();try{Me.debug&&console.log("[http.request]",p.method,p.url),(h=i.perf)==null||h.inc("httpRequests"),(w=i.perf)==null||w.mark("http:req",{url:n.url,method:n.method});const k=await yt(p);l=k;const A=await Le(K.afterResponse,k,p),L=le()-b;if((T=i.perf)==null||T.tick("http:res",L,{status:k.status,url:n.url}),C<s&&Re(null,A)){y(),await xe(c),c=Math.round(c*d);continue}return y(),f=A,Pe(A,p)}catch(k){u=k,y();for(const A of K.onError)try{A(k,p)}catch(L){}if(C<s&&Re(k,null)){await xe(c),c=Math.round(c*d);continue}throw m=k,k}}}finally{const C=le()-r;me.markEnd(o,f,m,C)}if(u)throw u;return Pe(l,n)}i.http={},i.http.request=G,i.http.state=()=>me.state,i.http.get=(e,t)=>G(e,{...t,method:"GET"}),i.http.del=(e,t)=>G(e,{...t,method:"DELETE"}),i.http.post=(e,t,n)=>re(G,"POST",e,t,n),i.http.put=(e,t,n)=>re(G,"PUT",e,t,n),i.http.patch=(e,t,n)=>re(G,"PATCH",e,t,n),i.http.getJSON=async(e,t)=>(await G(e,{...t,method:"GET"})).jsonStrict(),i.http.delJSON=async(e,t)=>(await G(e,{...t,method:"DELETE"})).jsonStrict(),i.http.postJSON=async(e,t,n)=>(await re(G,"POST",e,t,n)).jsonStrict(),i.http.putJSON=async(e,t,n)=>(await re(G,"PUT",e,t,n)).jsonStrict(),i.http.patchJSON=async(e,t,n)=>(await re(G,"PATCH",e,t,n)).jsonStrict(),i.http.onBefore=function(e){return K.beforeRequest.add(e),()=>K.beforeRequest.delete(e)},i.http.onAfter=function(e){return K.afterResponse.add(e),()=>K.afterResponse.delete(e)},i.http.onError=function(e){return K.onError.add(e),()=>K.onError.delete(e)},window._http=i.http,i.useRouter=function(e){const t=i.router;return e&&e.onDispose,{navigate:t.navigate,back:()=>history.back(),forward:()=>history.forward(),get current(){return t}}},i.useRoute=function(e){const[t,n]=i.reactive.signal(""),[o,r]=i.reactive.signal({}),[a,s]=i.reactive.signal({}),[c,d]=i.reactive.signal(""),u=f=>{n(f.path||""),r(f.params||{}),s(f.query||{}),d(f.hash||"")},l=i.router.subscribe(u);return e&&typeof e.onDispose=="function"&&e.onDispose(l),{path:t,params:o,query:a,hash:c}},i._routerShared=(()=>{function e(c){return c?(c.startsWith("/")||(c="/"+c),c.length>1&&c.endsWith("/")&&(c=c.slice(0,-1)),c):"/"}function t(c,d=""){if(d&&c.startsWith(d)){const u=c.slice(d.length)||"/";return e(u)}return e(c)}function n(c){c=e(c);const d=[],u=c.replace(/([.+*?=^!${}()[\]|/\\])/g,"\\$1").replace(/\\\/:([A-Za-z0-9_]+)/g,(l,f)=>(d.push(f),"\\/([^\\/]+)"));return{pattern:c,regex:new RegExp("^"+u+"$"),keys:d}}function o(c){const d={};return new URLSearchParams(c||"").forEach((l,f)=>{d[f]===void 0?d[f]=l:Array.isArray(d[f])?d[f].push(l):d[f]=[d[f],l]}),d}function r(c){const d=[];for(const u of c)if(d.push({...u,_parent:null}),u.children&&u.children.length)for(const l of u.children)d.push({...l,_parent:u});return d.sort((u,l)=>l.path.length-u.path.length),d}function a(c,d){const u=e(c),l=r(d);for(const f of l){const m=f._compiled.regex.exec(u);if(!m)continue;const h={};return f._compiled.keys.forEach((w,T)=>{h[w]=decodeURIComponent(m[T+1])}),{route:f,params:h,parent:f._parent||null}}return null}function s(c,d,u=50){c.push({at:Date.now(),path:d.path,params:d.params,query:d.query,hash:d.hash}),c.length>u&&c.shift()}return{normalizePath:e,stripBase:t,compilePattern:n,parseQuery:o,flattenRoutes:r,matchRoute:a,pushHistoryEntry:s}})(),i._uiMetaShared=(()=>{function e(s){return{hasTabPanel:typeof s.TabPanel=="function",Card:typeof s.Card=="function"?s.Card:(...c)=>s.div({class:"cms-doc-card"},...c),Chip:typeof s.Chip=="function"?s.Chip:(c,d)=>s.span({class:"cms-chip cms-chip-fallback"},d)}}function t(s){return s?Array.isArray(s)?s.join(" | "):String(s):"\u2014"}function n(s,c,d){return s.div({class:"cms-doc-meta"},s.div({class:"cms-doc-meta-head"},s.div({class:"cms-doc-meta-name"},c.name),s.div({class:"cms-doc-meta-types"},...c.type?String(c.type).split("|").map(u=>d({color:"secondary",dense:!0,outline:!0},u)):[s.span("\u2014")])),s.div({class:"cms-doc-meta-grid"},s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Default"),s.div({class:"cms-doc-meta-value"},c.default==null?"\u2014":String(c.default))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Values"),s.div({class:"cms-doc-meta-value"},t(c.values)))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Description"),s.div({class:"cms-doc-meta-value"},c.description||"\u2014")))}function o(s,c){return s.div({class:"cms-doc-fallback"},c.map(d=>s.div({class:"cms-doc-fallback-item"},s.h4({class:"cms-doc-fallback-title"},d.label||d.name),d.content)))}function r(s,c){return c?Array.isArray(c)?c.map(d=>({name:d.name,wrap:!0,label:d.name,content:s.div({class:"cms-p-md"},d.description)})):Object.entries(c).map(([d,u])=>({name:d,wrap:!0,label:d,content:s.div({class:"cms-p-md"},u)})):[]}function a(s,c){return c?Array.isArray(c)?c.map(d=>({name:d.name,wrap:!0,label:d.type,content:d.description})):Object.entries(c).map(([d,u])=>({name:d,wrap:!0,label:d,content:s.div({class:"cms-doc-meta"},s.div({class:"cms-doc-meta-head"},s.div({class:"cms-doc-meta-name"},d)),s.div({class:"cms-doc-meta-grid"},s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Type"),s.div({class:"cms-doc-meta-value"},u.type||"\u2014"))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Description"),s.div({class:"cms-doc-meta-value"},u.description||"\u2014")))})):[]}return{resolveDocComponents:e,renderMetaItem:n,renderTabGroupFallback:o,normalizeEventRows:r,normalizeSlotRows:a}})(),i.ui=i.ui||{},i.ui.meta=i.ui.meta||{},i.ui.slot=function(t,n={}){const o=i.ui,{as:r="node",wrap:a="span",iconProps:s=null,filter:c=!0}=n,d=m=>document.createTextNode(String(m)),u=m=>_.span(String(m)),l=m=>{if(m==null||m===!1)return null;if(typeof m=="function")return m;if(Array.isArray(m))return m.flatMap(l).filter(Boolean);if(m&&typeof m=="object"&&m.nodeType)return m;if(typeof m=="string"||typeof m=="number"||typeof m=="boolean"){const h=String(m);return r==="icon"&&o.Icon?o.Icon(h,{class:"cms-slot-icon",...s||{}}):a==="text"?d(h):a==="span"?u(h):h}return a==="text"?d(m):a==="span"?u(m):String(m)},f=l(t);return c&&Array.isArray(f)?f.filter(Boolean):f},i.ui.slots=function(...t){const n=[];for(const o of t){const r=i.ui.slot(o);r&&(Array.isArray(r)?n.push(...r):n.push(r))}return n},i.docTable=e=>{var v;if(!i.isDev())return _.div();const{resolveDocComponents:t,renderMetaItem:n,renderTabGroupFallback:o,normalizeEventRows:r,normalizeSlotRows:a}=i._uiMetaShared,s=(v=i.ui.meta)==null?void 0:v[e];if(!s)return _.div({class:"cms-muted"},`Meta non trovata: ${e}`);const{hasTabPanel:c,Card:d,Chip:u}=t(_),l={};Object.entries(s.props||{}).forEach(([y,p])=>{const b=p.category||"general";l[b]||(l[b]=[]),l[b].push({name:y,...p})});const f=Object.keys(l).map(y=>{const p=l[y].map(b=>({name:b.name,wrap:!0,label:b.name,content:n(_,b,u)}));return{name:y,wrap:!0,label:y,content:c?_.TabPanel({orientation:"vertical",animated:!0,radius:"0 0 0 var(--cms-r-default)",tabs:p}):o(_,p)}}),m=r(_,s.events),h=a(_,s.slots),w=_.rod(null),T=[];h.length&&T.push({name:"Slots",wrap:!0,label:"Slots",content:c?_.TabPanel({animated:!0,radius:"0 0 0 var(--cms-r-default)",orientation:"vertical",tabs:h}):o(_,h)}),f.length&&T.push(...f),m.length&&T.push({name:"Events",wrap:!0,label:"Events",content:c?_.TabPanel({animated:!0,radius:"0 0 0 var(--cms-r-default)",orientation:"vertical",tabs:m}):o(_,m)});const C="general";return T.sort((y,p)=>y.name===C?-1:p.name===C?1:y.name.localeCompare(p.name)),d({class:"cms-doc-table"},_.div({class:"cms-doc-table-header"},_.div({class:"cms-doc-table-title"},`_.${e}`),s.signature?_.div({class:"cms-doc-table-signature"},String(s.signature).replaceAll("UI.","_.")):null),T.length?_.h4({class:"cms-doc-table-section-title"},f.length?"Props":"Documentation"):_.p({class:"cms-muted"},"Nessuna documentazione strutturata disponibile."),T.length?c?_.TabPanel({border:!0,animated:!0,orientation:"horizontal",tabs:T,model:w}):o(_,T):null,s.returns?_.p({class:"cms-muted",style:{marginTop:"14px"}},`Returns: ${s.returns}`):null)},i.ui.inspect=e=>{var t;return console.log(((t=i.ui.meta)==null?void 0:t[e])||"meta not found")},i.ui.can=function(e,t,n,o=null){var s,c;const r=i.useAuth?i.useAuth(e):i.auth;return r?(typeof t=="function"?!!t(r):((s=r.can)==null?void 0:s.call(r,t))||((c=r.hasRole)==null?void 0:c.call(r,t)))?typeof n=="function"?n():n:typeof o=="function"?o():o:typeof o=="function"?o():null},i.ui.canAny=function(e,t,n,o=null){var s;const r=i.useAuth?i.useAuth(e):i.auth;return!!((s=r==null?void 0:r.canAny)!=null&&s.call(r,t))?typeof n=="function"?n():n:typeof o=="function"?o():o},i.ui.canAll=function(e,t,n,o=null){var s;const r=i.useAuth?i.useAuth(e):i.auth;return!!((s=r==null?void 0:r.canAll)!=null&&s.call(r,t))?typeof n=="function"?n():n:typeof o=="function"?o():o},i.Can=function(t,n){var a,s;const o=i.useAuth?i.useAuth(n):i.auth;return(()=>{var c,d,u,l;return o?t.when&&typeof t.when=="function"?!!t.when(o):t.perm?!!((c=o.can)!=null&&c.call(o,t.perm)):t.role?!!((d=o.hasRole)!=null&&d.call(o,t.role)):t.any?!!((u=o.canAny)!=null&&u.call(o,t.any)):t.all?!!((l=o.canAll)!=null&&l.call(o,t.all)):!1:!1})()?typeof t.then=="function"?t.then():(a=t.then)!=null?a:null:typeof t.else=="function"?t.else():(s=t.else)!=null?s:null},i.router=(()=>{let e="history",t=[],n=null,o=null,r="",a=null,s=null,c=[],d=!1;const{normalizePath:u,stripBase:l,compilePattern:f,parseQuery:m,matchRoute:h,pushHistoryEntry:w}=i._routerShared,T={setOutlet:{description:"imposta il contenitore del router"},setBase:{description:"imposta il base path del router"},add:{description:"per aggiungere la route"},notFound:{description:"imposta la view 404"},beforeEach:{description:"hook prima di ogni navigazione"},start:{description:"avvia il router"},navigate:{description:"naviga verso una route"},subscribe:{description:"sottoscrive agli aggiornamenti di route"},current:{description:"ritorna l'URL corrente"},isActive:{description:"verifica se una route e\u0300 attiva"},status:{description:"stringa di stato router"},inspect:{description:"stampa info diagnostiche"},trace:{description:"abilita/disabilita tracing"},history:{description:"ritorna la history interna"},setURLOnly:{description:"aggiorna solo l'URL del browser senza render/meta"}};function C(E,{replace:x=!1}={}){const O=typeof E=="string"?new URL(E,window.location.origin):E,B=O.pathname+O.search+O.hash;if(e==="hash"||e==="auto"){if(history.pushState){const W="#"+B;x?history.replaceState({},"",W):history.pushState({},"",W);return}const q="#"+B;x?window.location.replace(q):window.location.hash=q;return}x?history.replaceState({},"",r+B):history.pushState({},"",r+B)}function v(){if(e==="hash"){const E=window.location.hash||"#/",x=E.startsWith("#")?E.slice(1):E;return new URL(x,window.location.origin)}if(e==="auto"&&window.location.hash.startsWith("#/")){const E=window.location.hash.slice(1);return new URL(E,window.location.origin)}return new URL(window.location.href)}function y(E,x=!1){if(e==="hash"||e==="auto"&&!history.pushState){const O="#"+(E.pathname+E.search+E.hash);x?window.location.replace(O):window.location.hash=O;return}x?history.replaceState({},"",r+E.pathname+E.search+E.hash):history.pushState({},"",r+E.pathname+E.search+E.hash)}function p(E){e=E||"history"}function b(E){return l(E,r)}function k(E){if(!E)return!1;const x=s?s.path:b(v().pathname);let O=E;typeof O=="string"&&(O.includes("?")||O.includes("#")||O.includes("://"))&&(O=new URL(O,window.location.origin).pathname);const B=b(O);return B.includes(":")?f(B).regex.test(x):B===x}async function A(E,{replace:x=!1}={}){if(!n){console.warn("[router] outlet non impostato. Usa JSswift.router.setOutlet('#app').");return}const O=typeof E=="string"?new URL(E,window.location.origin):E;d&&console.log("[router.navigate]",O.toString());const B=O.pathname+O.search+O.hash;y(O,x);const q=b(O.pathname),W=h(q,t),U={path:q,fullPath:B,params:W?W.params:{},query:m(O.search),hash:O.hash||"",navigate:L,outlet:n};if(a){const H=await a(U);if(H===!1)return;if(typeof H=="string"){L(H,{replace:!0});return}}if(typeof o=="function"){try{o()}catch(H){console.error("[router] unmount error:",H)}o=null}if(!W){const H=t._notFound;H?o=i.mount(n,()=>H(U),{clear:!0}):o=i.mount(n,_.div("404"),{clear:!0}),S(U),s=U,w(c,U);return}const Q=W.route.view,Z=W.parent;let ee=null;if(U.renderChild=H=>{if(!U._child)return null;const ne=typeof H=="string"?U.outlet.querySelector(H):H;return ne?(ee=i.mount(ne,()=>U._child.view(U._child.ctx),{clear:!0}),ee):(console.warn("[router] child outlet non trovato:",H),null)},Z){const H=W.route,ne={...U,params:{...U.params}};U._child={view:H.view,ctx:ne},o=i.mount(n,()=>Z.view(U),{clear:!0})}else U._child=null,o=i.mount(n,()=>Q(U),{clear:!0});S(U),s=U,w(c,U)}function L(E,x={}){const O=new URL(E,window.location.origin);A(O,x)}function D(){window.addEventListener("popstate",()=>{A(v(),{replace:!0})}),window.addEventListener("hashchange",()=>{(e==="hash"||e==="auto")&&A(v(),{replace:!0})}),document.addEventListener("click",E=>{var U,Q;const x=(Q=(U=E.target)==null?void 0:U.closest)==null?void 0:Q.call(U,"a");if(!x||E.defaultPrevented||E.button!==0||E.metaKey||E.ctrlKey||E.shiftKey||E.altKey||x.hasAttribute("download")||x.target&&x.target!=="_self")return;const O=x.getAttribute("href");if(!O||O.startsWith("mailto:")||O.startsWith("tel:"))return;const B=new URL(O,window.location.origin);if(B.origin!==window.location.origin)return;const q=new URL(window.location.href);B.pathname+B.search===q.pathname+q.search&&B.hash||(E.preventDefault(),L(B.pathname+B.search+B.hash))}),A(v(),{replace:!0})}function j(E){return n=typeof E=="string"?i.dom.q(E):E,n}function R(E){r=E?u(E):"",r==="/"&&(r="")}function P(E,x,O=null){const B=f(E),q={path:B.pattern,view:x,_compiled:B,children:[]};if(Array.isArray(O))for(const W of O){const[U,Q,Z]=W,ee=u(B.pattern+"/"+(U||"").replace(/^\//,""));q.children.push({path:ee,view:Q,_compiled:f(ee),children:Array.isArray(Z)?Z:[]})}t.push(q)}function M(E){t._notFound=E}function F(E){a=E}let g=new Set;function S(E){for(const x of g)try{x(E)}catch(O){console.error("[router] listener error:",O)}}function z(){if(!s)return"ROUTER \u23F3 not ready";const E=Object.keys(s.query||{}).length?"?":"";return`ROUTER ${s.path}${E} ${s.hash||""}`}function I(E="router"){if(!s)return console.warn("[router.inspect] nessuna route attiva"),null;const x={label:E,mode:typeof e!="undefined"?e:"unknown",base:r,path:s.path,params:s.params,query:s.query,hash:s.hash,outlet:n,timestamp:new Date().toISOString()};return console.groupCollapsed(`[JSswift.router.inspect] ${E}`),console.log(x),console.log("history:",c.slice()),console.groupEnd(),x}function J(E=!0){d=!!E,console.log("[JSswift.router.trace]",d?"ON":"OFF")}function N(){return c.slice()}return{meta:T,setOutlet:j,setBase:R,add:P,setURLOnly:C,notFound:M,beforeEach:F,start:D,navigate:L,isActive:k,subscribe(E){return g.add(E),()=>g.delete(E)},current(){return v?v():new URL(window.location.href)},status:z,inspect:I,trace:J,history:N}})(),($e=i.config)!=null&&$e.debug&&(window.$router=i.router),i.signal=i.reactive.signal,i.effect=i.reactive.effect,i.computed=i.reactive.computed,i.untracked=i.reactive.untracked,i.batch=i.reactive.batch;function se(e){return e==null?null:String(e).trim()||null}function ye(e){const t=Array.isArray(e)?e:typeof e=="string"?e.split(","):[],n=[],o=new Set;for(const r of t){const a=se(r);!a||o.has(a)||(o.add(a),n.push(a))}return n}function ge(){var e;return typeof document!="undefined"&&document.documentElement?document.documentElement:(e=i.dom)!=null&&e.q?i.dom.q("html"):null}function De(){try{return typeof globalThis!="undefined"&&globalThis.localStorage||null}catch(e){return null}}function fe(){var e;return se((e=i.theme)==null?void 0:e.storageKey)||"jsswift:theme"}function Oe(){const e=De();if(!e)return null;try{return se(e.getItem(fe()))}catch(t){return null}}function gt(e){const t=De();if(t)try{e==null?t.removeItem(fe()):t.setItem(fe(),e)}catch(n){}}function ze(e){var o,r,a,s,c;const t=ge(),n=[e,(o=i.theme)==null?void 0:o.themes,(r=i.config)==null?void 0:r.themes,typeof globalThis!="undefined"?(a=globalThis.JSswift_setting)==null?void 0:a.themes:null,typeof globalThis!="undefined"?(s=globalThis.JSswift_setting)==null?void 0:s.themeList:null,(c=t==null?void 0:t.getAttribute)==null?void 0:c.call(t,"data-themes")];for(const d of n){const u=ye(d);if(u.length)return u}return[]}i.theme=i.theme||{},i.theme.storageKey=fe(),ye(i.theme.themes).length||(i.theme.themes=ze()),i.setTheme=function(e,t={}){const n=se(e),o=ge();return o&&(n==null?o.removeAttribute("data-theme"):o.setAttribute("data-theme",n)),t.persist!==!1&&gt(n),o},i.getTheme=function(e={}){var r;const t=ge(),n=se((r=t==null?void 0:t.getAttribute)==null?void 0:r.call(t,"data-theme"));if(n)return n;if(e.storage===!1)return null;const o=Oe();return o&&t&&e.sync!==!1&&t.setAttribute("data-theme",o),o},i.toggleTheme=function(e,t={}){const n=ze(e),o=n.length?n:ye([i.getTheme({sync:!1}),"light","dark"]),r=i.getTheme({sync:!1}),a=se(t.fallback)||o[0]||"light",s=r?o.indexOf(r):-1,c=s>=0?o[(s+1)%o.length]:a;return i.theme.themes=o.slice(),i.setTheme(c,t),c};const Je=Oe();Je&&i.setTheme(Je,{persist:!1})})();
package/dist/min-cms.js CHANGED
@@ -1 +1 @@
1
- (()=>{var Fe,Ie,Be,je,Ue,We,He,qe,$e;window.JSswift=window.JSswift||{};const i=window.JSswift;window._=window.JSswift,i.config=i.config||{};const Ve=typeof globalThis!="undefined"&&globalThis.JSswift_setting?globalThis.JSswift_setting:{};i.config.debug=(Fe=Ve.modeDev)!=null?Fe:!1,i.isDev=function(){return i.config.debug},i.uiNormalizeArgs=function(e){let t={},n=e;return e.length>0&&typeof e[0]=="object"&&e[0]!==null&&!e[0].nodeType&&!Array.isArray(e[0])&&!(e[0]instanceof Function)&&(t=e[0],n=e.slice(1)),{props:t,children:n}},i.uiSizes=["xxs","xs","sm","md","lg","xl","xxl","xxxl"],i.uiColors=["primary","secondary","success","warning","danger","info","light","dark"],i.meta=i.meta||{version:"1.0.23",policy:{sourceOfTruth:"docDevelop/reference/core.md",syncRule:"Quando cambia un modulo core, aggiornare sia questo meta sia docDevelop/reference/core.md."},modules:{render:{description:"Bridge props -> DOM per hyperscript _, attributi, class, style, eventi e children reattivi.",entrypoints:["createElement","setProp","bindProp"],status:"milestone-3-closed",knownLimits:["Il mini-terzo-giro e il successivo micro-giro avanzato hanno chiuso style dinamico, eventi, children e props/attr speciali, ma restano altri edge case avanzati da esplorare.","Gli eventi ora supportano composizione base di listener multipli, ma non hanno ancora delegation o diff avanzato.","Restano da esplorare edge case avanzati del renderer oltre ai giri gia coperti dai test."]},reactive:{description:"Core minimale signal/effect usato come base della reattivita.",entrypoints:["JSswift.reactive.signal","JSswift.reactive.effect","JSswift.reactive.computed","JSswift.reactive.untracked","JSswift.reactive.batch"],status:"milestone-2-closed",knownLimits:["La protezione loop copre i loop sincroni per singolo effect, non ancora i cicli complessi tra effect multipli.","Il batching sincrono ora esiste, ma manca ancora scheduling configurabile oltre il flush immediato a fine batch.","Mancano primitive avanzate per controllare scheduling e transazioni asincrone."]},rod:{description:"Layer reattivo di alto livello per binding DOM, model e interpolazioni.",entrypoints:["_.rod","JSswift.rodBind","JSswift.rodModel"],status:"milestone-2-closed",knownLimits:["Va chiarito meglio il rapporto con JSswift.reactive oltre al primo riallineamento strutturale.","Restano casi avanzati di model/binding da esplorare oltre al primo giro coperto dai test.","Il modulo e piu pulito internamente ma non e ancora il punto finale della convergenza con il renderer."]},mount:{description:"Mount, component instances e cleanup automatico del tree DOM.",entrypoints:["JSswift.mount","JSswift.component","JSswift.enableAutoCleanup"],status:"milestone-2-closed",knownLimits:["Il lifecycle e piu pulito internamente ma resta da chiarire meglio la semantica su multi-mount e cloni.","Restano da esplorare edge case avanzati del cleanup automatico fuori dal primo giro gia coperto."]},platform:{description:"Moduli applicativi nel core: overlay, store, auth, http, router, UI meta.",entrypoints:["JSswift.overlay","JSswift.store","JSswift.plugins.auth","JSswift.http","JSswift.router","JSswift.ui.meta"],status:"milestone-2-closed",knownLimits:["Il secondo giro ha ripulito i moduli interni, ma mancano ancora demo separate per modulo e una validazione piu formale di alcune superfici pubbliche.","Esiste una demo browser aggregata del blocco platform, ma non ancora demo separate per ogni modulo.","Mancano configurazione pubblica piu coerente e confini piu netti tra auth, http e router.","Il registry UI meta non ha ancora validazione formale del suo shape."]}}},i.omit=(e,t)=>{const n={},o=new Set(t||[]);for(const r in e||{})o.has(r)||(n[r]=e[r]);return n},i._cleanupRegistry=new WeakMap,i._registerCleanup=function(e,t){if(!e||typeof t!="function")return t;const n=i._cleanupRegistry.get(e)||[];return n.push(t),i._cleanupRegistry.set(e,n),t},i.dom={q(e,t=document){return t.querySelector(e)},qa(e,t=document){return Array.from(t.querySelectorAll(e))},attr(e,t,n){return e?n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.setAttribute(t,String(n)),e):null}},(()=>{let e=[],t=!1;function n(){if(t)return;t=!0;const o=e.slice();e.length=0;for(const r of o)try{r()}catch(a){console.error("[JSswift.ready] error:",a)}}i.ready=function(o){typeof o=="function"&&(t||document.readyState==="interactive"||document.readyState==="complete"?queueMicrotask(()=>{try{o()}catch(r){console.error("[JSswift.ready] error:",r)}}):e.push(o))},document.addEventListener("DOMContentLoaded",n,{once:!0})})(),i.reactive=(()=>{let e=null;const t=[],n=100;let o=0,r="sync",a="sync",s=!1;const c=new Set;function d(p){const b=p==null?void 0:p.flush;if(b==null||b==="sync")return"sync";if(b==="microtask")return"microtask";throw new Error("JSswift.reactive.batch: options.flush must be 'sync' or 'microtask'")}function u(){for(;c.size;){const p=Array.from(c);c.clear(),p.forEach(b=>b())}}function l(){s||(s=!0,queueMicrotask(()=>{s=!1,a="sync",u()}))}function f(p){const b=Array.from(p);if(o>0||a==="microtask"){b.forEach(k=>c.add(k)),o===0&&a==="microtask"&&l();return}b.forEach(k=>k())}function m(p){if(p&&(p._deps.size&&(p._deps.forEach(b=>b.delete(p._runner)),p._deps.clear()),typeof p._cleanup=="function")){const b=p._cleanup;p._cleanup=null;try{b()}catch(k){console.error("[JSswift.reactive.effect] cleanup error:",k)}}}function h(p){if(!(!p||!p.active)){m(p),t.push(p),e=p;try{const b=A=>{p._cleanup=typeof A=="function"?A:null},k=p.fn.length>0?p.fn(b):p.fn();typeof k=="function"&&(p._cleanup=k)}finally{t.pop(),e=t[t.length-1]||null}}}function w(p){if(typeof p!="function")return()=>{};const b={fn:p,active:!0,_deps:new Set,_cleanup:null,_runner:null,_running:!1,_queued:!1},k=()=>{if(!b.active)return;if(b._running){b._queued=!0;return}b._running=!0;let A=0;try{do if(b._queued=!1,h(b),A++,A>=n){b._queued=!1,console.warn("[JSswift.reactive.effect] loop guard triggered: too many synchronous reruns",{max:n,effect:p.name||"anonymous"});break}while(b.active&&b._queued)}finally{b._running=!1}};return b._runner=k,k(),()=>{b.active&&(b.active=!1,m(b))}}function T(p){let b=p;const k=new Set;function A(){return e&&e.active&&(k.add(e._runner),e._deps.add(k)),b}function L(j){b=j,f(k)}function D(){k.clear()}return[A,L,D]}function C(p){if(typeof p!="function")throw new Error("JSswift.reactive.computed: fn must be a function");const[b,k,A]=T(void 0),L=w(()=>{k(p())}),D=()=>b();return D.dispose=()=>{L(),A()},D.peek=()=>b(),D.type="computed",D}function v(p){if(typeof p!="function")throw new Error("JSswift.reactive.untracked: fn must be a function");const b=e;e=null;try{return p()}finally{e=b}}function y(p,b){if(typeof p!="function")throw new Error("JSswift.reactive.batch: fn must be a function");const k=d(b);o===0?r=k:k==="microtask"&&(r="microtask"),o+=1;try{return p()}finally{if(o-=1,o===0){const A=r==="microtask"||a==="microtask";r="sync",A?(a="microtask",l()):u()}}}return{signal:T,effect:w,computed:C,untracked:v,batch:y}})(),i._overlayShared=(()=>{const e=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function t(a,s){const c=a();if(c&&c.isConnected)return c;let d=document.getElementById("cms-overlay-root");return!d&&(document!=null&&document.body)&&(d=document.createElement("div"),d.id="cms-overlay-root",d.className="cms-overlay-root",document.body.appendChild(d)),!document.body&&!d&&i.ready(()=>{let u=document.getElementById("cms-overlay-root");u||(u=document.createElement("div"),u.id="cms-overlay-root",u.className="cms-overlay-root",document.body.appendChild(u)),s(u)}),s(d),d}function n(a){var c;const s=a.querySelector(e);(c=s==null?void 0:s.focus)==null||c.call(s)}function o(a,s){if(a.key!=="Tab")return;const c=Array.from(s.querySelectorAll(e)).filter(f=>f.offsetParent!==null);if(!c.length)return;const d=c[0],u=c[c.length-1],l=document.activeElement;a.shiftKey&&l===d?(a.preventDefault(),u.focus()):!a.shiftKey&&l===u&&(a.preventDefault(),d.focus())}function r(a,s){var Q,Z,ee,H,ne,Ge;if(!s.anchorEl)return;const c=s.anchorEl.getBoundingClientRect(),d=a.getBoundingClientRect(),u=window.visualViewport||null,l=Math.max(0,Number(u==null?void 0:u.offsetLeft)||0),f=Math.max(0,Number(u==null?void 0:u.offsetTop)||0),m=Math.max(Number(u==null?void 0:u.width)||0,window.innerWidth||0,((Q=document.documentElement)==null?void 0:Q.clientWidth)||0),h=Math.max(Number(u==null?void 0:u.height)||0,window.innerHeight||0,((Z=document.documentElement)==null?void 0:Z.clientHeight)||0),w=Number((H=(ee=s.viewportGutter)!=null?ee:s.gutter)!=null?H:8),T=Number.isFinite(w)?Math.max(0,w):8,C=Number((ne=s.offsetX)!=null?ne:0),v=Number((Ge=s.offsetY)!=null?Ge:8),y=Number.isFinite(C)?C:0,p=Number.isFinite(v)?v:8,b=(V,$,X)=>!Number.isFinite(V)||(Number.isFinite($)||($=0),Number.isFinite(X)||(X=$),X<$)?$:Math.min(Math.max(V,$),X),k=String(s.placement||"bottom-start").toLowerCase(),[A,L]=k.split("-"),D=["top","bottom","left","right"].includes(A)?A:"bottom",j=["start","end","center"].includes(L)?L:"start",R={top:"bottom",bottom:"top",left:"right",right:"left"}[D]||"top",P=D==="top"||D==="bottom",M=d.width,F=d.height,g=V=>{let $=c.left+y,X=c.top+p;return V==="top"||V==="bottom"?(j==="center"?$=c.left+(c.width-M)/2+y:j==="end"&&($=c.right-M+y),X=V==="top"?c.top-F-p:c.bottom+p):(j==="center"?X=c.top+(c.height-F)/2+p:j==="end"&&(X=c.bottom-F+p),$=V==="left"?c.left-M-y:c.right+y),{left:$,top:X}},S=V=>V==="top"?c.top-p-T:V==="bottom"?h-c.bottom-p-T:V==="left"?c.left-y-T:m-c.right-y-T,z=S(D),I=S(R),N=(P?F:M)>z&&I>z?R:D,E=g(N),x=l+T,O=f+T,B=Math.max(x,l+m-M-T),q=Math.max(O,f+h-F-T),W=b(E.left,x,B),U=b(E.top,O,q);a.style.position="fixed",a.style.left=`${W}px`,a.style.top=`${U}px`}return{ensureRoot:t,focusFirst:n,trapFocus:o,applyAnchoredPosition:r}})(),i.overlay=(()=>{let e=0;const t=new Map;let n=null;const{ensureRoot:o,focusFirst:r,trapFocus:a,applyAnchoredPosition:s}=i._overlayShared,c=()=>o(()=>n,C=>{n=C});let d=0;const u=()=>{d++,d===1&&document.documentElement.classList.add("cms-scroll-locked")},l=()=>{d=Math.max(0,d-1),d===0&&document.documentElement.classList.remove("cms-scroll-locked")},f=()=>{let C=null;for(const v of t.values())C=v;return C},m=C=>{var y;let v=C;for(;v&&v!==document;){if(v.nodeType===1&&((y=v.getAttribute)==null?void 0:y.call(v,"data-cms-overlay-portal"))==="true")return!0;v=v.parentNode}return!1},h=(C,v={})=>{var S,z,I,J;const y=`ov_${++e}`,p={id:y,opts:v,isOpen:!0,anchorEl:v.anchorEl||null,placement:v.placement||"bottom-start",onClose:typeof v.onClose=="function"?v.onClose:null,overlay:null,panel:null,backdrop:null,reposition:null,_positionCleanup:null,_positionFrame:null,_panelResizeObserver:null,_cleanup:null},b=document.createElement("div");b.className=["cms-overlay",v.type?`type-${v.type}`:""].filter(Boolean).join(" "),b.dataset.id=y;const k=document.createElement("div");k.className="cms-overlay-backdrop",v.backdrop||(k.style.display="none");const A=document.createElement("div");A.className=["cms-overlay-panel",v.className].filter(Boolean).join(" "),A.tabIndex=-1;const L=typeof C=="function"?C({close:()=>w(y)}):C,D=i.ui.slot(L);Array.isArray(D)?D.forEach(N=>N&&A.appendChild(N)):D&&A.appendChild(D),b.appendChild(k),b.appendChild(A);const j=c();if(!j)return{id:y,close:()=>w(y),panel:A,overlay:b};j.appendChild(b),p.overlay=b,p.panel=A,p.backdrop=k,t.set(y,p),v.lockScroll&&u(),v.autoFocus!==!1&&setTimeout(()=>r(A),0);const R=(N=null)=>{N&&typeof N=="object"&&Object.assign(p.opts,N),s(A,p.opts)},P=()=>{if(!v.anchorEl)return;const N=globalThis.requestAnimationFrame||(x=>setTimeout(()=>x(Date.now()),0)),E=globalThis.cancelAnimationFrame||clearTimeout;p._positionFrame!=null&&E(p._positionFrame),p._positionFrame=N(()=>{p._positionFrame=null,R()})};if(p.reposition=R,v.anchorEl){R(),P();const N=()=>R();if(window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),(z=(S=window.visualViewport)==null?void 0:S.addEventListener)==null||z.call(S,"resize",N),(J=(I=window.visualViewport)==null?void 0:I.addEventListener)==null||J.call(I,"scroll",N),typeof ResizeObserver=="function"){const E=new ResizeObserver(()=>R());E.observe(A),p._panelResizeObserver=E}p._positionCleanup=()=>{var x,O,B,q,W,U;const E=globalThis.cancelAnimationFrame||clearTimeout;p._positionFrame!=null&&(E(p._positionFrame),p._positionFrame=null),(O=(x=p._panelResizeObserver)==null?void 0:x.disconnect)==null||O.call(x),p._panelResizeObserver=null,window.removeEventListener("resize",N),window.removeEventListener("scroll",N,!0),(q=(B=window.visualViewport)==null?void 0:B.removeEventListener)==null||q.call(B,"resize",N),(U=(W=window.visualViewport)==null?void 0:W.removeEventListener)==null||U.call(W,"scroll",N)}}const M=N=>{const E=f();!E||E.id!==y||v.closeOnOutside!==!1&&(m(N.target)||A.contains(N.target)||w(y))};document.addEventListener("mousedown",M,!0);const F=N=>{const E=f();!E||E.id!==y||(v.trapFocus&&a(N,A),N.key==="Escape"&&v.closeOnEsc!==!1&&(N.preventDefault(),w(y)))};document.addEventListener("keydown",F,!0),k.addEventListener("click",()=>{v.closeOnBackdrop!==!1&&w(y)}),p._cleanup=()=>{var N;document.removeEventListener("mousedown",M,!0),document.removeEventListener("keydown",F,!0),(N=p._positionCleanup)==null||N.call(p)};const g=1e3+t.size*10;return b.style.zIndex=String(g),{id:y,close:()=>w(y),panel:A,overlay:b,reposition:R}},w=C=>{var y,p,b;const v=t.get(C);v&&(t.delete(C),(y=v._cleanup)==null||y.call(v),v.opts.lockScroll&&l(),typeof Y=="function"&&Y(v.overlay),(p=v.overlay)==null||p.remove(),(b=v.onClose)==null||b.call(v))};return{open:h,close:w,closeTop:()=>{const C=f();C&&w(C.id)},root:n,_stack:t}})();function be(e,t={}){const{isSVG:n=!1,normalizeClass:o=y=>String(y!=null?y:""),isContentProp:r=()=>!1,autoValueTags:a=new Set(["INPUT","TEXTAREA","SELECT"])}=t;function s(y){if(n||!(y in e))return!1;try{return typeof e[y]=="boolean"}catch(p){return!1}}function c(y){return n||y.startsWith("data-")||y.startsWith("aria-")||!(y in e)}function d(y,p){if(p==null){e.removeAttribute(y);return}if(p===!1){if(y.startsWith("aria-")){e.setAttribute(y,"false");return}e.removeAttribute(y);return}if(p===!0&&!n&&!y.startsWith("aria-")&&!y.startsWith("data-")){e.setAttribute(y,"");return}e.setAttribute(y,String(p))}function u(y,p){if(y==null)return;const b=String(y),k=b.startsWith("--")||b.includes("-");if(p==null||p===!1||p===""){k?e.style.removeProperty(b):e.style[b]="";return}if(k){e.style.setProperty(b,String(p));return}e.style[b]=p}function l(y){const p=o(y);if(p==null||p===!1||p===""){e.removeAttribute("class");return}e.setAttribute("class",String(p))}function f(y,p){const b=!!p;e[y]=b,b?e.setAttribute(y,""):e.removeAttribute(y)}function m(y){if(r(y)){e[y]="";return}if(y==="class"){e.removeAttribute("class");return}if(y==="style"){e.removeAttribute("style");return}if(s(y)){try{e[y]=!1}catch(p){}e.removeAttribute(y);return}if(e.removeAttribute(y),!c(y))try{typeof e[y]=="string"&&(e[y]="")}catch(p){}}function h(y){!y||typeof y!="object"||Object.entries(y).forEach(([p,b])=>{u(p,b)})}function w(y,p){if(r(y)){e[y]=p!=null?p:"";return}if(y==="class"){l(p);return}if(y==="style"){if(p==null||p===!1){m(y);return}if(typeof p=="object"){h(p);return}}if(s(y)){f(y,p);return}if(p==null||p===!1){m(y);return}if(c(y)){d(y,p);return}e[y]=p}function T(y,p){const b=String(y).split(".");let k=e;for(let A=0;A<b.length-1;A++)if(k=k==null?void 0:k[b[A]],!k)return;k[b[b.length-1]]=p}function C(y){return y?y==="auto"||y.startsWith("attr:")||y.startsWith("@")||y.startsWith("style.")||y.includes("."):!1}function v(y,p){if(!y||y==="auto"){a.has(e.tagName)?w("value",p):e.textContent=p!=null?p:"";return}if(y.startsWith("attr:")){d(y.slice(5),p);return}if(y.startsWith("@")){d(y.slice(1),p);return}if(y.startsWith("style.")){u(y.slice(6),p);return}if(y.includes(".")){T(y,p);return}w(y,p)}return{isBooleanDomProp:s,isAttributeOnlyProp:c,isBindingValueKey:C,setAttributeValue:d,setStyleEntry:u,setClassValue:l,setBooleanProp:f,removeProp:m,applyStyleObject:h,setProp:w,setPathValue:T,applyBindingValue:v}}function ie(e){const t=[],n=o=>{if(!(o==null||o===!1)){if(typeof o=="function"){n(o());return}if(o&&o.type==="rod"){n(o.value);return}if(Array.isArray(o)){o.forEach(n);return}if(typeof o=="object"){Object.entries(o).forEach(([r,a])=>{let s=a;typeof s=="function"?s=s():s&&s.type==="rod"&&(s=s.value),n(s?r:null)});return}o!==!0&&String(o).split(/\s+/).forEach(r=>{r&&t.push(r)})}};return n(e),t.length?Array.from(new Set(t)).join(" "):""}function de(e){return e==null||e===!1?!1:typeof e=="function"||e&&e.type==="rod"?!0:Array.isArray(e)?e.some(de):typeof e=="object"?Object.values(e).some(de):!1}function we(e,t){return e==null||e===!1?!1:typeof e=="function"||t(e)?!0:typeof e!="object"||Array.isArray(e)||e.nodeType?!1:Object.values(e).some(n=>we(n,t))}function Ke(e,t){let n=e;if(typeof n=="function"?n=n():t(n)&&(n=n.value),!n||typeof n!="object"||Array.isArray(n)||n.nodeType)return null;const o={};return Object.entries(n).forEach(([r,a])=>{let s=a;typeof s=="function"?s=s():t(s)&&(s=s.value),o[r]=s}),o}function Se(e){let t=new Set;function n(r){t.forEach(a=>{r.has(a)||e(a,null)}),t=r}function o(r,a){const s=Ke(r,a);if(!s){n(new Set);return}const c=new Set(Object.keys(s));n(c),Object.entries(s).forEach(([d,u])=>{e(d,u)})}return{apply:o}}function Qe(e){return typeof e=="string"&&(e.startsWith("on:")||e.startsWith("on")&&e.length>2)}const ve=128,te=[];function Xe(e,t){te.push({rod:e,value:String(t!=null?t:"")}),te.length>ve&&te.splice(0,te.length-ve)}function Ye(){if(!te.length)return null;const e=te.slice();return te.length=0,{items:e,index:0}}function pe(e,t){if(!t||!e||t.index>=t.items.length)return null;const n=[],o=String(e);let r=0,a=t.index,s=!1;for(;a<t.items.length;){const c=t.items[a],d=c.value;if(!d)break;const u=o.indexOf(d,r);if(u===-1)break;u>r&&n.push(o.slice(r,u)),n.push(c.rod),r=u+d.length,a++,s=!0}return s?(r<o.length&&n.push(o.slice(r)),t.index=a,n):null}function Ae(e){var n;let t="";for(const o of e)typeof o=="string"?t+=o:t+=(n=o==null?void 0:o.value)!=null?n:"";return t}function Ze(e){if(e.startsWith("on:"))return e.slice(3);const t=e.slice(2);return t?t==="DoubleClick"?"dblclick":t.toLowerCase():""}function ce(e){return e==null||e===!1?!1:e===!0?{capture:!0}:typeof e=="boolean"?e:typeof e=="object"?{capture:!!e.capture,passive:!!e.passive,once:!!e.once}:!1}function et(e,t){const n=ce(e),o=ce(t);return typeof n=="boolean"||typeof o=="boolean"?n===o:!!n&&!!o&&n.capture===o.capture&&n.passive===o.passive&&n.once===o.once}function ae(e,t){return Array.isArray(e)?e.some(n=>ae(n,t)):t(e)?!0:!e||typeof e!="object"||Array.isArray(e)||e.nodeType?!1:Array.isArray(e.handlers)?e.handlers.some(n=>ae(n,t))||t(e.options)||typeof e.options=="function":Array.isArray(e.listeners)?e.listeners.some(n=>ae(n,t))||t(e.options)||typeof e.options=="function":t(e.handler)||t(e.listener)||t(e.fn)||t(e.options)||typeof e.options=="function"}function ue(e,t,n){var o,r,a,s,c,d,u;if(e==null||e===!1)return[];if(typeof e=="function")return[{handler:e,options:ce(n!=null?n:!1)}];if(t(e))return ue(e.value,t,n);if(Array.isArray(e))return e.flatMap(l=>ue(l,t,n));if(typeof e=="object"&&!Array.isArray(e)&&!e.nodeType){if(Array.isArray(e.handlers)||Array.isArray(e.listeners)){const m=e.handlers||e.listeners||[],h=(r=(o=e.options)!=null?o:n)!=null?r:!1;return m.flatMap(w=>ue(w,t,h))}let l=(c=(s=(a=e.handler)!=null?a:e.listener)!=null?s:e.fn)!=null?c:null,f=(u=(d=e.options)!=null?d:n)!=null?u:!1;return t(l)&&(l=l.value),t(f)&&(f=f.value),typeof f=="function"&&(f=f()),typeof l=="function"?[{handler:l,options:ce(f)}]:[]}return[]}function tt(e,t){return ue(e,t)}function nt(e,t,n,o){const r=Ze(t);if(!r)return;const a={listeners:[]},s=()=>{a.listeners.forEach(d=>{e.removeEventListener(r,d.dispatch,d.options)}),a.listeners=[]},c=d=>{const u=tt(d,o);a.listeners.length===u.length&&a.listeners.every((f,m)=>{const h=u[m];return f.handler===h.handler&&et(f.options,h.options)})||(s(),u.forEach(f=>{const m={handler:f.handler,options:f.options,dispatch:null};m.dispatch=h=>{if(typeof m.handler=="function"){const w=m.handler.call(e,h);return m.options&&typeof m.options=="object"&&m.options.once&&(e.removeEventListener(r,m.dispatch,m.options),a.listeners=a.listeners.filter(T=>T!==m)),w}},e.addEventListener(r,m.dispatch,m.options),a.listeners.push(m)}))};if(i._registerCleanup(e,s),o(n)){const d=i.reactive.effect(()=>{c(n.value)});i._registerCleanup(e,d);return}if(ae(n,o)){const d=i.reactive.effect(()=>{c(n)});i._registerCleanup(e,d);return}c(n)}function rt(e,t={}){const{isRod:n=()=>!1,interpolationCursor:o=null}=t;function r(l){const f=document.createTextNode(""),m=i.rodBind(f,l);return i._registerCleanup(f,m),f}function a(l){e.appendChild(r(l))}function s(l){const f=document.createTextNode("");e.appendChild(f);const m=i.reactive.effect(()=>{f.textContent=Ae(l)});i._registerCleanup(f,m)}function c(l){const f=[],m=h=>{if(!(h==null||h===!1)){if(Array.isArray(h)){h.forEach(m);return}if(typeof h=="string"){f.push(document.createTextNode(h));return}if(typeof h=="number"){f.push(document.createTextNode(String(h)));return}if(typeof h!="boolean"){if(n(h)){f.push(r(h));return}if(h!=null&&h.nodeType){f.push(h);return}f.push(document.createTextNode(String(h)))}}};return m(l),f}function d(l){const f=document.createComment("dyn");e.appendChild(f);let m=[];const h=i.reactive.effect(()=>{m.forEach(v=>{Y(v),v.parentNode&&v.parentNode.removeChild(v)}),m=[];const w=f.parentNode;if(!w)return;const T=c(l());if(!T.length)return;const C=document.createDocumentFragment();T.forEach(v=>C.appendChild(v)),w.insertBefore(C,f.nextSibling),m=T});i._registerCleanup(f,()=>{h(),m.forEach(w=>Y(w)),m=[]})}function u(l){if(l!=null){if(Array.isArray(l)){for(const f of l)u(f);return}if(typeof l=="string"){const f=pe(l,o);f?s(f):e.appendChild(document.createTextNode(l));return}if(typeof l=="number"){e.appendChild(document.createTextNode(String(l)));return}if(typeof l=="function"){d(l);return}if(n(l)){a(l);return}l.nodeType&&e.appendChild(l)}}return{appendRodText:a,appendInterpolatedText:s,appendDynamicChild:d,appendChildValue:u}}function ot(e,t={}){const{el:n,isRod:o=()=>!1,interpolationCursor:r=null,appendChildValue:a=()=>{},appendRodText:s=()=>{},appendInterpolatedText:c=()=>{},appendDynamicChild:d=()=>{},bindProp:u=()=>{}}=t;for(const l of e)if(l!=null){if(Array.isArray(l)){a(l);continue}if(typeof l=="string"){const f=pe(l,r);f?c(f):n.appendChild(document.createTextNode(l));continue}if(typeof l=="number"){n.appendChild(document.createTextNode(String(l)));continue}if(typeof l=="function"){d(l);continue}if(o(l)){s(l);continue}if(l.nodeType){n.appendChild(l);continue}if(typeof l=="object")for(const[f,m]of Object.entries(l)){if(typeof m=="string"){const h=pe(m,r);if(h){u(f,()=>Ae(h));continue}}if(f==="class"){u(f,m);continue}if(f==="style"&&typeof m=="object"&&m!==null&&!o(m)){u(f,m);continue}u(f,m)}}}const _e="http://www.w3.org/2000/svg",st=new Set(["svg","g","path","circle","ellipse","line","rect","polygon","polyline","text","tspan","defs","linearGradient","radialGradient","stop","use","symbol","clipPath","mask","pattern","filter","feGaussianBlur","feOffset","feBlend","feColorMatrix"]);function he(e){return e==="innerHTML"||e==="innerText"||e==="textContent"||e==="value"}function it(e,...t){const n=st.has(e),o=e==="text"&&!n?document.createTextNode(""):n?document.createElementNS(_e,e):document.createElement(e),r=g=>!!g&&g.type==="rod",a=Ye(),s=rt(o,{isRod:r,interpolationCursor:a}),{appendRodText:c,appendInterpolatedText:d,appendDynamicChild:u,appendChildValue:l}=s,f=be(o,{isSVG:n,normalizeClass:ie,isContentProp:he}),{isBooleanDomProp:m,isBindingValueKey:h,applyBindingValue:w,setStyleEntry:T,setProp:C,setClassValue:v}=f;function y(g){const S=i.reactive.effect(g);return i._registerCleanup(o,S),S}function p(g){if(String((g==null?void 0:g.tagName)||"").toLowerCase()!=="input")return!1;const S=String((g==null?void 0:g.type)||"").toLowerCase();return S==="range"||S==="number"}function b(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()!=="input"?"":String((g==null?void 0:g.type)||"").toLowerCase()}function k(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()==="select"&&!g.multiple}function A(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()==="input"&&String((g==null?void 0:g.type)||"").toLowerCase()==="file"}function L(g,S,z){y(()=>{var N;const J=(N=S.value)!=null?N:"";g.value!==String(J)&&C("value",J)});const I=()=>{let J=g.value;const N=b(g),E=typeof S.value=="number"||S.value==null;if(k(g)&&g.value==="")J=null;else if(p(g)&&E)if(N==="number"&&g.value==="")J=null;else{const x=typeof g.valueAsNumber=="number"&&!Number.isNaN(g.valueAsNumber)?g.valueAsNumber:Number(g.value);J=Number.isNaN(x)?N==="number"?null:0:x}S.value!==J&&(S.value=J)};g.addEventListener(z,I),i._registerCleanup(g,()=>{g.removeEventListener(z,I)})}function D(g,S){y(()=>{const I=!!S.value;!!g.checked!==I&&C("checked",I)});const z=()=>{const I=!!g.checked;S.value!==I&&(S.value=I)};g.addEventListener("change",z),i._registerCleanup(g,()=>{g.removeEventListener("change",z)})}function j(g,S){const z=()=>{var J;return String((J=g.value)!=null?J:"on")};y(()=>{const N=(S.value==null?null:String(S.value))===z();!!g.checked!==N&&C("checked",N)});const I=()=>{if(!g.checked)return;const J=z();S.value!==J&&(S.value=J)};g.addEventListener("change",I),i._registerCleanup(g,()=>{g.removeEventListener("change",I)})}function R(g,S){const z=()=>{const J=g.files;return J==null?[]:Array.isArray(J)?J.slice():typeof J.length=="number"?Array.from(J):[J]};y(()=>{const J=S.value;(J==null||Array.isArray(J)&&J.length===0)&&(g.value!==""&&C("value",""),Array.isArray(g.files)&&(g.files=[]))});const I=()=>{const J=z();S.value=J};g.addEventListener("change",I),i._registerCleanup(g,()=>{g.removeEventListener("change",I)})}function P(g,S){const z=()=>Array.from(g.childNodes||[]).filter(N=>(N==null?void 0:N.tagName)==="OPTION"&&N.selected).map(N=>{var E;return String((E=N.value)!=null?E:"")}),I=()=>{const N=Array.isArray(S.value)?S.value.map(x=>String(x)):[],E=new Set(N);Array.from(g.childNodes||[]).forEach(x=>{var B;if((x==null?void 0:x.tagName)!=="OPTION")return;const O=E.has(String((B=x.value)!=null?B:""));!!x.selected!==O&&(x.selected=O,O?x.setAttribute("selected",""):x.removeAttribute("selected"))})};y(I),g._cmsApplySelectedValues=I,queueMicrotask(I);const J=()=>{const N=z(),E=Array.isArray(S.value)?S.value.map(x=>String(x)):[];E.length===N.length&&E.every((x,O)=>x===N[O])||(S.value=N)};g.addEventListener("change",J),i._registerCleanup(g,()=>{g.removeEventListener("change",J)})}function M(g,S){y(()=>{const N=!!S.value;!!g.selected!==N&&C("selected",N)});let z=null;const I=()=>{const N=!!g.selected;S.value!==N&&(S.value=N)};queueMicrotask(()=>{var N;z||((N=g.parentNode)==null?void 0:N.tagName)!=="SELECT"||(z=g.parentNode,z.addEventListener("change",I))}),i._registerCleanup(g,()=>{z==null||z.removeEventListener("change",I)})}function F(g,S){if(Qe(g)){nt(o,g,S,r);return}if(g==="class"){if(de(S)){y(()=>{v(ie(S))});return}v(ie(S));return}if(g==="style"&&S&&typeof S=="object"){const z=Se(T);if(we(S,r)){y(()=>{z.apply(S,r)});return}z.apply(S,r);return}if(g==="style"&&(typeof S=="function"||r(S))){const z=Se(T);y(()=>{z.apply(S,r)});return}if(h(g)&&typeof S=="function"){y(()=>{w(g,S())});return}if(h(g)&&!r(S)){w(g,S);return}if(typeof S=="function"){y(()=>{C(g,S())});return}if(g==="value"&&r(S)&&(e==="input"||e==="textarea"||e==="select")){if(e==="select"&&o.multiple){P(o,S);return}L(o,S,e==="select"?"change":"input");return}if(g==="checked"&&r(S)&&e==="input"){if(String(o.type||"").toLowerCase()==="radio"){j(o,S);return}D(o,S);return}if(g==="files"&&r(S)&&A(o)){R(o,S);return}if(g==="selected"&&r(S)&&e==="option"){M(o,S);return}if(he(g)&&r(S)){y(()=>{C(g,S.value)});return}if(r(S)){const z=i.rodBind(o,S,{key:g});i._registerCleanup(o,z);return}C(g,S)}return ot(t,{el:o,isRod:r,interpolationCursor:a,appendChildValue:l,appendRodText:c,appendInterpolatedText:d,appendDynamicChild:u,bindProp:F}),e==="select"&&typeof o._cmsApplySelectedValues=="function"&&o._cmsApplySelectedValues(),o}const bt={},Ee=["html","head","title","base","link","meta","style","body","header","footer","main","section","article","aside","nav","h1","h2","h3","h4","h5","h6","p","div","span","pre","blockquote","hr","br","address","a","abbr","b","bdi","bdo","cite","code","data","dfn","em","i","kbd","mark","q","rp","rt","ruby","s","samp","small","strong","sub","sup","time","u","var","wbr","ul","ol","li","dl","dt","dd","table","caption","colgroup","col","thead","tbody","tfoot","tr","th","td","form","label","input","textarea","button","select","option","optgroup","fieldset","legend","datalist","output","progress","meter","img","picture","source","iframe","embed","object","param","audio","video","track","details","summary","dialog","script","noscript","canvas","template","slot","svg","g","path","circle","ellipse","line","rect","polygon","polyline","text","tspan","defs","linearGradient","radialGradient","stop","use","symbol","clipPath","mask","pattern","filter","feGaussianBlur","feOffset","feBlend","feColorMatrix"];Ee.forEach(e=>{window._[e]=(...t)=>it(e,...t)}),_.DOM_ELEMENTS=Ee,_.fragment=(...e)=>e,_.dynamic=function(e){const t=document.createComment("dyn"),n=document.createDocumentFragment();n.appendChild(t);let o=null;return i.reactive.effect(()=>{const r=e();if(o&&o.parentNode&&o.parentNode.removeChild(o),o=null,r==null)return;let a=r;(typeof r=="string"||typeof r=="number")&&(a=document.createTextNode(String(r)));const s=t.parentNode;s&&a&&a.nodeType&&(s.insertBefore(a,t.nextSibling),o=a)}),n};function ct(){let e=!1;const t=new Set;function n(){var r,a,s;e=!1,(r=i.debug)==null||r.inc("rodFlushes"),(a=i.perf)==null||a.inc("rodFlushes"),(s=i.perf)==null||s.mark("rod:flush");const o=Array.from(t);t.clear();for(const c of o)try{c()}catch(d){console.error("[rod] flush error:",d)}}return function(r){t.add(r),e||(e=!0,queueMicrotask(n))}}const at=ct();function Ce(e,t,n){if(!e)return;if(e.nodeType===3){e.textContent=n!=null?n:"";return}be(e,{isSVG:e.namespaceURI===_e,normalizeClass:ie,isContentProp:he}).applyBindingValue(t,n)}function ut(e){return{type:"rod",value:e,_bindings:[],_actions:[],_disposeHooks:[],_disposed:!1,_silentDepth:0,_pending:!1,bindings(){return this._bindings.map(n=>({el:n.el,key:n.key}))},onDispose(n){return typeof n=="function"&&this._disposeHooks.push(n),this},_bind(n,o={key:"auto"}){var s;if(this._disposed)return()=>{};if(!n)return()=>{};const r={el:n,key:(s=o==null?void 0:o.key)!=null?s:"auto"};return this._bindings.some(c=>c.el===r.el&&c.key===r.key)||this._bindings.push(r),Ce(r.el,r.key,this.value),()=>{this._bindings=this._bindings.filter(c=>!(c.el===r.el&&c.key===r.key))}},action(n){return!this._disposed&&typeof n=="function"&&this._actions.push(n),this},_setSilent(n){this._silentDepth++;try{this.value=n}finally{this._silentDepth--}return this},_scheduleNotify(){this._disposed||this._pending||(this._pending=!0,at(()=>{this._pending=!1,this._notifyNow()}))},_notifyNow(){var o,r,a,s,c;if(this._disposed)return;const n=performance.now();(o=i.perf)==null||o.inc("rodNotifies"),this._bindings=this._bindings.filter(d=>{const u=d.el;return u?u.nodeType===3?!!u.parentNode:u.isConnected!==!1:!1});for(const d of this._bindings)Ce(d.el,d.key,this.value);if(!(this._silentDepth>0)){for(const d of this._actions)try{d(this.value)}catch(u){console.error("[rod] action error:",u)}(r=i.debug)==null||r.inc("rodNotifies"),(c=i.perf)==null||c.tick("rod:notify",performance.now()-n,{bindings:((a=this._bindings)==null?void 0:a.length)||0,actions:((s=this._actions)==null?void 0:s.length)||0})}},dispose(){if(!this._disposed){this._disposed=!0;for(const n of this._disposeHooks)try{n()}catch(o){console.error("[rod] dispose hook error:",o)}this._bindings.length=0,this._actions.length=0,this._disposeHooks.length=0}}}}function lt(e,t="value"){var s;let n=e[t],o=null,r=null,a=null;return(s=i==null?void 0:i.reactive)!=null&&s.signal&&([o,r,a]=i.reactive.signal(n),a&&typeof e.onDispose=="function"&&e.onDispose(a)),Object.defineProperty(e,t,{get(){return o?o():n},set(c){r?r(c):n=c,e._scheduleNotify()},configurable:!0}),typeof e.val!="function"&&Object.defineProperty(e,"val",{value(c){return arguments.length?(this.value=c,c):this.value},configurable:!0}),e[Symbol.toPrimitive]||Object.defineProperty(e,Symbol.toPrimitive,{value(c){const d=this.value;if(d==null)return d;const u=typeof d;return c==="number"?Number(d):(u!=="symbol"&&Xe(this,d),u==="string"||u==="number"||u==="boolean"||u==="bigint"||u==="symbol"?d:String(d))},configurable:!0}),e.valueOf||Object.defineProperty(e,"valueOf",{value(){return this.value},configurable:!0}),e.toString||Object.defineProperty(e,"toString",{value(){return String(this.value)},configurable:!0}),e}_.rod=function(t,n="value"){const o=ut(t);return lt(o,n),i.rod._all=i.rod._all||new Set,i.rod._all.add(o),typeof o.onDispose=="function"&&o.onDispose(()=>i.rod._all.delete(o)),o},i.rodBind=function(e,t,n={key:"auto"}){var o,r,a;if((o=i.debug)==null||o.inc("rodBinds"),!e)return(r=i.debug)==null||r.inc("rodBindNull"),(a=i.debug)==null||a.warn("rodBind: target element \xE8 null/undefined",n),()=>{};if(!t||t.type!=="rod")throw new Error("JSswift.rodBind: react must be a rod object");return t._bind(e,n)},i.rodFromSignal=function(e,t){const n=_.rod(e());let o=!1;const r=i.reactive.effect(()=>{const s=n.value,c=i.reactive.untracked(()=>e());if(!o&&c!==s){o=!0;try{t(s)}finally{o=!1}}}),a=i.reactive.effect(()=>{const s=e();if(i.reactive.untracked(()=>n.value)!==s){o=!0;try{n._setSilent(s)}finally{o=!1}}});return typeof n.onDispose=="function"&&(n.onDispose(r),n.onDispose(a)),n};function ke(e){if(!e||!e.tagName)return null;const t=e.tagName.toLowerCase();if(t==="input"){const n=(e.type||"text").toLowerCase();return n==="checkbox"?"checkbox":n==="radio"?"radio":n==="number"?"number":"text"}return t==="select"?e.multiple?"select-multiple":"select":null}i.rodModel=function(e,t,n={}){var l,f,m;if(!t||t.type!=="rod")throw new Error("[JSswift.rodModel] rodObj deve essere un rod");const o=Array.isArray(e)||e instanceof NodeList?Array.from(e):[e],r=(l=n.event)!=null?l:"change",a=(f=n.parse)!=null?f:(h=>h),s=(m=n.format)!=null?m:(h=>h);let c=!1;const d=[],u=h=>{for(const w of o){if(!w)continue;switch(ke(w)){case"checkbox":w.checked=!!h;break;case"radio":w.checked=w.value==h;break;case"select":w.value=h!=null?h:"";break;case"select-multiple":const C=Array.isArray(h)?h.map(String):[];for(const v of w.options)v.selected=C.includes(v.value);break;default:w.value=h!=null?h:""}}};t.action(h=>{if(!c){c=!0;try{u(s(h))}finally{c=!1}}}),u(s(t.value));for(const h of o){if(!h)continue;const w=ke(h),T=()=>{if(c)return;let C;switch(w){case"checkbox":C=h.checked;break;case"radio":if(!h.checked)return;C=h.value;break;case"select":C=h.value;break;case"select-multiple":C=Array.from(h.selectedOptions).map(v=>v.value);break;case"number":C=a(h.value===""?null:Number(h.value));break;default:C=a(h.value)}c=!0;try{t.value!==C&&(t.value=C)}finally{c=!1}};h.addEventListener(r,T),d.push(()=>h.removeEventListener(r,T))}return typeof t.onDispose=="function"&&t.onDispose(()=>d.forEach(h=>h())),()=>d.forEach(h=>h())},i.signalModel=function(e,t,n,o={}){const r=i.rodFromSignal(t,n);return i.rodModel(e,r,o)};function Y(e){if(!e)return;const t=i._cleanupRegistry.get(e);if(t){for(const n of t)try{n()}catch(o){console.error("[cleanup] error:",o)}i._cleanupRegistry.delete(e)}if(e.childNodes&&e.childNodes.length)for(const n of e.childNodes)Y(n)}function ft(e){const t=n=>typeof n=="string"?i.dom.q(n):n;return Array.isArray(e)?e.map(t).filter(Boolean):[t(e)].filter(Boolean)}function dt(e){const t=[],n=[],o=r=>{if(r!=null){if(typeof r=="function"){o(r());return}if(r&&typeof r=="object"&&"node"in r){typeof r.dispose=="function"&&n.push(r.dispose),o(r.node);return}if(Array.isArray(r)){for(const a of r)o(a);return}if(typeof r=="string"||typeof r=="number"){t.push(document.createTextNode(String(r)));return}if(r.nodeType){t.push(r);return}console.warn("[JSswift.mount] contenuto non supportato:",r)}};return o(e),{nodes:t,disposers:n}}function Te(e=[],t="[JSswift.mount] dispose error:"){let n=!1;return()=>{if(!n){n=!0;for(const o of e)try{o()}catch(r){console.error(t,r)}}}}function Ne(e=[],t=null){return Te([...t?[t]:[],...e],"[component] dispose error:")}i.mount=function(e,t,n={}){var d;const o=ft(e),r=(d=n.clear)!=null?d:!0,a=o.length>1;if(o.length===0)return console.warn("[JSswift.mount] nessun target valido:",e),()=>{};const s=[];for(const u of o){if(r)for(;u.firstChild;)Y(u.firstChild),u.removeChild(u.firstChild);const{nodes:l,disposers:f}=dt(t);let m=l;a&&typeof t!="function"&&(m=l.map(w=>w.cloneNode(!0)),f.length&&console.warn("[JSswift.mount] multi-target con dispose: usa content come function per istanze separate."));const h=Te(f);for(const w of m)u.appendChild(w);s.push({root:u,nodes:m,dispose:h});for(const w of m)!w||!w.nodeType||i._registerCleanup(w,h)}return()=>{var u;for(const l of s){for(const f of l.nodes)f&&(Y(f),f.parentNode===l.root&&l.root.removeChild(f));(u=l.dispose)==null||u.call(l)}}},i.component=function(e){if(typeof e!="function")throw new Error("JSswift.component: renderFn must be a function");return function(n={}){const o=[],a=e(n,{onDispose(s){typeof s=="function"&&o.push(s)}});return a&&typeof a=="object"&&"node"in a?{node:a.node,dispose:Ne(o,typeof a.dispose=="function"?a.dispose:null)}:{node:a,dispose:Ne(o)}}},i.enableAutoCleanup=function(){if(i._autoCleanupEnabled)return;i._autoCleanupEnabled=!0;const e=new MutationObserver(t=>{for(const n of t)for(const o of n.removedNodes)Y(o)});e.observe(document.body,{childList:!0,subtree:!0}),i._cleanupObserver=e},i.debug=(()=>{const e={rodFlushes:0,rodNotifies:0,rodBinds:0,rodBindNull:0,rodBindDup:0};function t(){return!!i.config.debug}function n(...d){t()&&console.log("[JSswift]",...d)}function o(...d){t()&&console.warn("[JSswift]",...d)}function r(...d){console.error("[JSswift]",...d)}function a(d,u=1){e[d]||(e[d]=0),e[d]+=u}function s(){return{...e}}function c(){for(const d of Object.keys(e))e[d]=0}return{enabled:t,log:n,warn:o,error:r,inc:a,stats:s,reset:c}})(),i.perf=(()=>{let e=!1;const t={effectsRun:0,effectsSlow:0,rodNotifies:0,rodFlushes:0,domWrites:0,httpRequests:0},n=[],o=[],r={timelineMax:200,slowEffectMs:8};function a(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function s(b,k=0,A=null){e&&(n.push({t:Date.now(),type:b,ms:k,meta:A}),n.length>r.timelineMax&&n.shift())}function c(b,k=1){e&&(t[b]=(t[b]||0)+k)}function d(b,k){e&&(o.push({t:Date.now(),ms:b,meta:k}),o.length>100&&o.shift())}let u=null;function l(){u||(u=i.reactive.effect,i.reactive.effect=function(b,k){return u((...L)=>{const D=a();c("effectsRun");try{return b(...L)}finally{const j=a()-D;j>=r.slowEffectMs?(c("effectsSlow"),d(j,k||b.name||"effect"),s("effect:slow",j,k||b.name||null)):s("effect",j,k||b.name||null)}})})}function f(){u&&(i.reactive.effect=u,u=null)}function m(b=!0){return e=!!b,e?l():f(),e}function h(){for(const b of Object.keys(t))t[b]=0;n.length=0,o.length=0}function w(){return{enabled:e,...t,slowEffectMs:r.slowEffectMs,timelineSize:n.length}}function T(){return n.slice()}function C(b=r.slowEffectMs){return o.filter(k=>k.ms>=b).slice().sort((k,A)=>A.ms-k.ms)}function v(b,k){const A=a();try{return k()}finally{const L=a()-A;s("time:"+b,L,b)}}function y(b,k){s(b,0,k)}function p(b,k,A){s(b,k,A)}return{enable:m,reset:h,stats:w,timeline:T,slowEffects:C,time:v,mark:y,tick:p,inc:c,cfg:r}})(),i.rod=i.rod||{},i.rod.inspect=function(e,t="rod"){if(!e||e.type!=="rod")return console.warn("[JSswift.rod.inspect] non \xE8 un rod:",e),null;const n=typeof e.bindings=="function"?e.bindings():[],o={label:t,value:e.value,bindingsCount:n.length,bindings:n.map(r=>{var a,s,c,d,u,l,f;return{key:r.key,el:((a=r.el)==null?void 0:a.nodeType)===3?"#text":(s=r.el)==null?void 0:s.tagName,id:((c=r.el)==null?void 0:c.id)||null,className:((d=r.el)==null?void 0:d.className)||null,isConnected:((u=r.el)==null?void 0:u.nodeType)===3?!!r.el.parentNode:(f=(l=r.el)==null?void 0:l.isConnected)!=null?f:null}}),actionsCount:Array.isArray(e._actions)?e._actions.length:null,disposed:!!e._disposed};return i.config.debug?(console.groupCollapsed(`[JSswift.rod.inspect] ${t}`),console.log(o),console.groupEnd()):console.log(o),o},i.rod.inspectAll=function(){const e=i.rod._all?Array.from(i.rod._all):[];return e.forEach((t,n)=>i.rod.inspect(t,`rod#${n+1}`)),e.length},i._storeShared=(()=>{function e(a){return`${a.storage}::${a.prefix}`}function t(a,s){function c(f={}){var h,w;const m={storage:(h=f.storage)!=null?h:a.storage,prefix:(w=f.prefix)!=null?w:a.prefix};return s.set(e(m),m),m}function d(f=null){var h;return(typeof f=="string"?f:(h=f==null?void 0:f.storage)!=null?h:a.storage)==="session"?window.sessionStorage:window.localStorage}function u(f,m=null){return(m||c()).prefix+f}function l(f,m=null){const h=m||c();return`${e(h)}::${f}`}return{getScope:c,getStorage:d,fullKey:u,channelKey:l}}function n(a){try{return JSON.parse(a)}catch(s){return}}function o(a){try{return JSON.stringify(a)}catch(s){return}}function r(a,...s){const c=`${a.storage}::${a.prefix}::`;for(const d of s)for(const u of Array.from(d.keys()))u.startsWith(c)&&d.delete(u)}return{createScopeTools:t,safeParse:n,safeStringify:o,clearScopedMapEntries:r}})(),i.store=(()=>{const e={prefix:"JSswift:",storage:"local",syncTabs:!0,writeDelay:0},t=new Map,n=new Map,o=new Map,r=new Map;let a=!1;const{createScopeTools:s,safeParse:c,safeStringify:d,clearScopedMapEntries:u}=i._storeShared,{getScope:l,getStorage:f,fullKey:m,channelKey:h}=s(e,r);function w(R,P,M=null){var S;const F=M||l(),g=n.get(h(R,F));if(g)for(const z of g)try{(S=i.reactive)!=null&&S.untracked?i.reactive.untracked(()=>z(P)):z(P)}catch(I){console.error("[store] watcher error:",I)}}function T(){a=!1;for(const[R,P]of Array.from(o.entries())){o.delete(R);const M=t.get(R),F=d(M);if(F===void 0)continue;const g=f(P.scope);try{g.setItem(m(P.key,P.scope),F)}catch(S){console.error("[store] write error:",S)}}}function C(R,P=null){const M=P||l();o.set(h(R,M),{key:R,scope:M}),!a&&(a=!0,e.writeDelay>0?setTimeout(T,e.writeDelay):queueMicrotask(T))}function v(R,P=null){const M=P||l(),g=f(M).getItem(m(R,M));if(g!=null)return c(g)}function y(R,P,M=null){const F=M||l(),g=h(R,F);if(t.has(g))return t.get(g);const S=v(R,F);return S!==void 0?(t.set(g,S),S):P}function p(R,P,M=null){const F=M||l();return t.set(h(R,F),P),C(R,F),w(R,P,F),P}function b(R,P=null){const M=P||l(),F=h(R,M);t.delete(F),o.delete(F);try{f(M).removeItem(m(R,M))}catch(g){}w(R,void 0,M)}function k(R={}){const P=l(R),M=f(P),F=[];for(let g=0;g<M.length;g++){const S=M.key(g);S&&S.startsWith(P.prefix)&&F.push(S)}for(const g of F)M.removeItem(g);u(P,t,o,n)}function A(R,P,M=null){if(typeof P!="function")return()=>{};const F=M||l(),g=h(R,F);return n.has(g)||n.set(g,new Set),n.get(g).add(P),()=>{var S;return(S=n.get(g))==null?void 0:S.delete(P)}}function L(R,P,M={}){const F=l({storage:M.storage,prefix:M.prefix}),g=y(R,P,F),[S,z,I]=i.reactive.signal(g),J=i.reactive.effect(()=>{const x=S();p(R,x,F)}),N=A(R,x=>{S()!==x&&z(x)},F);return[S,z,()=>{try{J==null||J()}catch(x){}try{N==null||N()}catch(x){}try{I==null||I()}catch(x){}}]}l(),e.syncTabs&&window.addEventListener("storage",R=>{if(!(!R.key||!R.storageArea))for(const P of r.values()){if(f(P)!==R.storageArea||!R.key.startsWith(P.prefix))continue;const M=R.key.slice(P.prefix.length),F=R.newValue==null?void 0:c(R.newValue),g=h(M,P);F===void 0?t.delete(g):t.set(g,F),w(M,F,P)}});function D(R={}){Object.assign(e,R),l()}function j(){return{prefix:e.prefix,storage:e.storage,syncTabs:e.syncTabs,cacheSize:t.size,scopeCount:r.size}}return{configure:D,stats:j,get:y,set:p,remove:b,clear:k,watch:A,signal:L}})(),i.store.computed=function(e){if(typeof e!="function")throw new Error("store.computed: fn must be a function");return i.reactive.computed(e)},i.store.migrate=function(e,t,n={}){var c,d;const o=(c=n.versionKey)!=null?c:"__version",r=Number((d=i.store.get(o,0))!=null?d:0),a=Number(e!=null?e:0);if(!Number.isFinite(a)||a<0)throw new Error("store.migrate: targetVersion non valido");if(r>=a)return{from:r,to:a,applied:0};let s=0;for(let u=r;u<a;u++){const l=t==null?void 0:t[u];if(typeof l=="function")try{l(i.store)}catch(f){console.error("[store.migrate] step error at version",u,f)}s++,i.store.set(o,u+1)}return{from:r,to:a,applied:s}},i.store.model=function(e,t,n,o={}){if(typeof t!="string"||!t)throw new Error("store.model: key deve essere una stringa non vuota");const[r,a,s]=i.store.signal(t,n,{storage:o.storage,prefix:o.prefix}),c=i.rodFromSignal(r,a),d=i.rodModel(e,c,{event:o.event,parse:o.parse,format:o.format});return()=>{var u;try{d==null||d()}catch(l){}try{s==null||s()}catch(l){}try{(u=c.dispose)==null||u.call(c)}catch(l){}}},i.store.bind=function(e,t,n,o={}){var a;let r=e;return typeof e=="string"&&(e.includes("[")||e.includes(" ")?r=document.querySelectorAll(e):r=i.dom.q(e)),r?i.store.model(r,t,n,o):((a=i.config)!=null&&a.debug&&console.warn("[store.bind] target non trovato:",e),()=>{})},i.store.bindAll=function(e,t={},n={}){if(typeof e=="string"&&(e=i.dom.q(e)),!e||!e.querySelectorAll)return console.warn("[store.bindAll] form non valido:",e),()=>{};const o=[];for(const[r,a]of Object.entries(t)){const s=e.querySelectorAll(`[name="${r}"]`);if(!s.length)continue;const c=i.store.model(s.length===1?s[0]:s,r,a,n);o.push(c)}return()=>o.forEach(r=>r())},i.store.inspect=function(){const e={...i.store.stats(),keys:Array.from((function(){const t=i.store.stats().storage==="session"?sessionStorage:localStorage,n=[];for(let o=0;o<t.length;o++){const r=t.key(o);r&&r.startsWith(i.store.stats().prefix)&&n.push(r.replace(i.store.stats().prefix,""))}return n})())};return console.groupCollapsed("[JSswift.store.inspect]"),console.table(e.keys),console.log(e),console.groupEnd(),e},i.store.autoForm=function(e,t={},n={}){var r;const o=i.store.bindAll(e,t,n);return(r=i.config)!=null&&r.debug&&console.log("[store.autoForm] autosave attivo:",t),o},i.useStore=function(e,t,n,o={}){const[r,a,s]=i.store.signal(e,t,o);return n&&typeof n.onDispose=="function"&&typeof s=="function"&&n.onDispose(s),[r,a]},i._plugins=new Set,i.usePlugin=function(e,t){var n;if(e){if(i._plugins.has(e)){(n=i.config)!=null&&n.debug&&console.warn("[JSswift.usePlugin] plugin gi\xE0 installato:",e.name||e);return}if(typeof e=="function"){e(i,t),i._plugins.add(e);return}if(e&&typeof e.install=="function"){e.install(i,t),i._plugins.add(e);return}console.warn("[JSswift.usePlugin] plugin non valido:",e)}},i.plugins=i.plugins||{},i.plugins.debug={install(e){e.config.debug=!0,console.log("[JSswift] Debug mode ON")}},i.plugins.forms={install(e){const t={};e.forms={validate(n,o={},r={}){var l,f;if(typeof n=="string"&&(n=e.dom.q(n)),!n||!n.querySelectorAll)return console.warn("[forms.validate] form non valido:",n),null;const a={mode:r.mode||"input",showMessages:(l=r.showMessages)!=null?l:!0,submitGuard:(f=r.submitGuard)!=null?f:!0,errorClass:r.errorClass||"is-invalid",validClass:r.validClass||"is-valid",messageClass:r.messageClass||"form-error"},s={};for(const[m,h]of Object.entries(o)){const w=n.querySelectorAll(`[name="${m}"]`);if(!w.length)continue;const[T,C]=e.reactive.signal(null);s[m]={getErr:T,setErr:C,els:w};let v=null;a.showMessages&&(v=document.createElement("div"),v.className=a.messageClass,w[w.length-1].after(v));const y=()=>{let p;const b=w[0];if(b.type==="checkbox")p=b.checked;else if(b.type==="radio"){const L=Array.from(w).find(D=>D.checked);p=L?L.value:null}else p=b.value;let k=!0;try{k=h(p)}catch(L){k=L.message||"Errore di validazione"}const A=k===!0?null:typeof k=="string"?k:"Valore non valido";return C(A),!A};for(const p of w)p.addEventListener(a.mode,y);e.reactive.effect(()=>{const p=T();for(const b of w)b.classList.toggle(a.errorClass,!!p),b.classList.toggle(a.validClass,!p);v&&(v.textContent=p||"",v.style.display=p?"block":"none")}),y()}const c=e.store.computed(()=>Object.values(s).every(m=>!m.getErr())),d=m=>{let h=!0;for(const w of Object.values(s)){const T=w.els[0];T&&T.dispatchEvent(new Event(a.mode,{bubbles:!0})),w.getErr()&&(h=!1)}!h&&a.submitGuard&&(m.preventDefault(),m.stopPropagation())};a.submitGuard&&n.addEventListener("submit",d);const u=()=>{a.submitGuard&&n.removeEventListener("submit",d)};return t[n]={isValid:c,dispose:u},{isValid:c,dispose:u}}}}},i._authShared=(()=>{function e(o){const r=()=>{var s;return((s=o())==null?void 0:s.roles)||[]},a=()=>{var s;return((s=o())==null?void 0:s.permissions)||[]};return{roles:r,perms:a,hasRole:s=>r().includes(s),can:s=>a().includes(s),canAny:s=>s.some(c=>r().includes(c)||a().includes(c)),canAll:s=>s.every(c=>r().includes(c)||a().includes(c))}}function t(o,r){return r.some(a=>typeof a=="string"?o.startsWith(a):a instanceof RegExp?a.test(o):!1)}function n(o,r){if(!o||!r)return;let a=!1;function s(){return Date.now()}function c(m){if(!m||typeof m!="string")return null;const h=m.split(".");if(h.length<2)return null;try{const w=h[1].replace(/-/g,"+").replace(/_/g,"/"),T=decodeURIComponent(atob(w).split("").map(C=>"%"+C.charCodeAt(0).toString(16).padStart(2,"0")).join(""));return JSON.parse(T)}catch(w){return null}}function d(){var m,h,w,T;if(typeof r._getState=="function"){const C=r._getState();return C&&typeof C=="object"?C:{user:(h=(m=r.user)==null?void 0:m.call(r))!=null?h:null}}return{user:(T=(w=r.user)==null?void 0:w.call(r))!=null?T:null}}function u(){var y,p,b;const m=d()||{},h=(p=m.user)!=null?p:(y=r.user)==null?void 0:y.call(r),w=(h==null?void 0:h.name)||(h==null?void 0:h.email)||(h==null?void 0:h.id)||"anon",T=!!((b=r.isAuth)!=null&&b.call(r)),C=m.expiresAt||null,v=C?C-s():null;return T?`AUTH \u2705 user=${w}${C?` expiresIn=${Math.round(v/1e3)}s`:""}`:`AUTH \u274C user=${w}`}function l(m="auth"){var D,j,R;const h=d()||{},w=(j=h.user)!=null?j:(D=r.user)==null?void 0:D.call(r),T=(w==null?void 0:w.roles)||[],C=(w==null?void 0:w.permissions)||[],v=h.accessToken||null,y=h.refreshToken||null,p=v?c(v):null,b=h.expiresAt||(p!=null&&p.exp?p.exp*1e3:null),k=s(),A=b?b-k:null,L={label:m,isAuth:!!((R=r.isAuth)!=null&&R.call(r)),user:w,roles:T,permissions:C,has:{role:P=>{var M;return!!((M=r.hasRole)!=null&&M.call(r,P))},can:P=>{var M;return!!((M=r.can)!=null&&M.call(r,P))}},token:{hasAccess:!!v,hasRefresh:!!y,expiresAt:b,expiresInSec:A==null?null:Math.round(A/1e3),decodedJWT:p}};return console.groupCollapsed(`[JSswift.auth.inspect] ${m}`),console.log("status:",u()),console.log(L),A!=null&&(A<=0?console.warn("\u26A0\uFE0F Access token scaduto."):A<6e4&&console.warn("\u26A0\uFE0F Access token in scadenza (<60s).")),console.groupEnd(),L}function f(m=!0){a=!!m,console.log("[JSswift.auth.trace]",a?"ON":"OFF")}if(typeof r.fetch=="function"&&!r._fetchWrapped){const m=r.fetch.bind(r);r.fetch=async(...h)=>{const w=await m(...h);if(a)try{console.log("[auth.fetch]",w.status,h[0])}catch(T){}return w},r._fetchWrapped=!0}r.decodeJWT=c,r.status=u,r.inspect=l,r.trace=f}return{createPermissionApi:e,matchesProtectedPath:t,attachDevTools:n}})(),i.plugins.auth={install(e,t={}){var k;const{createPermissionApi:n,matchesProtectedPath:o,attachDevTools:r}=i._authShared,a={key:t.key||"auth",loginRoute:t.loginRoute||"/login",protected:t.protected||[],autoRedirect:(k=t.autoRedirect)!=null?k:!0,endpoints:t.endpoints||{login:"/api/login",refresh:"/api/refresh",logout:"/api/logout"},fetchOptions:t.fetchOptions||{},tokenHeader:t.tokenHeader||"Authorization",tokenPrefix:t.tokenPrefix||"Bearer ",refreshMargin:t.refreshMargin||3e4},[s,c]=e.store.signal(a.key,null),d=()=>{var A;return((A=s())==null?void 0:A.user)||null},u=()=>{var A;return!!((A=s())!=null&&A.accessToken)},{hasRole:l,can:f,canAny:m,canAll:h}=n(d);let w=!1,T=[];function C(){const A=s();return A!=null&&A.expiresAt?Date.now()>A.expiresAt-a.refreshMargin:!1}async function v(){var A;if(w)return new Promise((L,D)=>T.push({res:L,rej:D}));w=!0;try{const L=await fetch(a.endpoints.refresh,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:(A=s())==null?void 0:A.refreshToken})});if(!L.ok)throw new Error("Refresh failed");const D=await L.json();return c({...s(),...D}),T.forEach(j=>j.res(!0)),T=[],!0}catch(L){throw T.forEach(D=>D.rej(L)),T=[],c(null),a.autoRedirect&&e.router.navigate(a.loginRoute),L}finally{w=!1}}async function y(A){const L=await fetch(a.endpoints.login,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!L.ok)throw new Error("Login failed");const D=await L.json();return c(D),D}async function p(){try{await fetch(a.endpoints.logout,{method:"POST"})}catch(A){}c(null),a.autoRedirect&&e.router.navigate(a.loginRoute)}async function b(A,L={}){var P;C()&&await v();const D=s(),j=new Headers(L.headers||{});D!=null&&D.accessToken&&j.set(a.tokenHeader,a.tokenPrefix+D.accessToken);const R=await fetch(A,{...a.fetchOptions,...L,headers:j});return R.status===401&&((P=s())!=null&&P.refreshToken)&&!L._authRetried?(await v(),b(A,{...L,_authRetried:!0})):R}e.router.beforeEach(A=>{const L=A.path;return o(L,a.protected)&&!u()?a.loginRoute:!0}),e.auth={user:d,isAuth:u,hasRole:l,can:f,canAny:m,canAll:h,loginAsync:y,logoutAsync:p,fetch:b,_getState:s},e.useAuth=function(A){return A&&A.onDispose,e.auth},r(i,e.auth)}},i._httpShared=(()=>{function e(u){var F;const l=u.reactive,[f,m]=l.signal(0),[h,w]=l.signal("idle"),[T,C]=l.signal(null),[v,y]=l.signal(null),[p,b]=l.signal(null),[k,A]=l.signal(0),[L,D]=l.signal(0);let j=0;function R(g){const S=++j,z=Date.now();return m(f()+1),w("pending"),b(null),y(null),C({id:S,url:g.url,method:g.method,meta:g.meta,timeout:g.timeout,retry:g.retry,startedAt:z}),D(z),S}function P(g,S,z,I){const J=Date.now();m(Math.max(0,f()-1)),g===j&&(z?(w("error"),b(z),y(null)):S?(w("success"),b(null),y({id:g,status:S.status,ok:S.ok,headers:S.headers,url:S.url,receivedAt:J,raw:S})):(w("idle"),b(null),y(null)),A(Math.max(0,Number(I||0)))),D(J)}return{state:{inFlight:f,status:h,isLoading:(F=u.store)!=null&&F.computed?u.store.computed(()=>f()>0):()=>f()>0,lastRequest:T,lastResponse:v,lastError:p,lastDuration:k,lastUpdated:L,reset(){m(0),w("idle"),C(null),y(null),b(null),A(0),D(Date.now())}},markStart:R,markEnd:P}}function t(u,l){if(!u||/^https?:\/\//i.test(l))return l;const f=u.endsWith("/")?u.slice(0,-1):u,m=l.startsWith("/")?l:"/"+l;return f+m}function n(u){return new Promise(l=>setTimeout(l,u))}function o(u,l){return u?!0:l?l.status===429||l.status>=500&&l.status<=599:!1}function r(u,l){if(!u&&!l)return{signal:void 0,cancel:()=>{}};const f=new AbortController,m=f.signal;let h=null;u>0&&(h=setTimeout(()=>f.abort(new Error("timeout")),u));const w=()=>f.abort(l.reason||new Error("aborted"));return l&&(l.aborted?w():l.addEventListener("abort",w,{once:!0})),{signal:m,cancel:()=>{var C;h&&clearTimeout(h),l&&((C=l.removeEventListener)==null||C.call(l,"abort",w))}}}function a(u,l,f={}){var T,C,v;const m=typeof l=="string"?t(u.baseURL,l):l,h=(f.method||"GET").toUpperCase(),w=new Headers(u.headers);return f.headers&&new Headers(f.headers).forEach((y,p)=>w.set(p,y)),{url:m,method:h,headers:w,body:f.body,credentials:(T=f.credentials)!=null?T:u.credentials,signal:f.signal,timeout:(C=f.timeout)!=null?C:u.timeout,retry:(v=f.retry)!=null?v:u.retry,meta:f.meta||{}}}async function s(u,...l){var m;let f=l[0];for(const h of u)f=(m=await h(f,...l.slice(1)))!=null?m:f;return f}function c(u,l){return{ok:u.ok,status:u.status,headers:u.headers,raw:u,req:l,async json(){let f=null,m=null;try{f=await u.json()}catch(h){f=null}return u.ok||(m=f!=null?f:{status:u.status}),{data:f,error:m,ok:u.ok,status:u.status}},async jsonStrict(){const{data:f,error:m}=await this.json();if(m){const h=new Error(`HTTP error ${u.status} ${(l==null?void 0:l.method)||""} ${(l==null?void 0:l.url)||""}`.trim());throw h.status=u.status,h.data=f,h.req={url:l==null?void 0:l.url,method:l==null?void 0:l.method,meta:l==null?void 0:l.meta},h}return{data:f,ok:!0,status:u.status}},async text(){let f="";try{f=await u.text()}catch(m){}return{text:f,ok:u.ok,status:u.status}},async textStrict(){const f=await this.text();if(!f.ok){const m=new Error("HTTP error "+u.status);throw m.status=u.status,m.text=f.text,m}return f}}}function d(u,l,f,m,h={}){const w=new Headers(h.headers||{});return w.has("Content-Type")||w.set("Content-Type","application/json"),u(f,{...h,method:l,headers:w,body:m==null?void 0:JSON.stringify(m)})}return{createReactiveState:e,joinURL:t,sleep:n,isRetryable:o,makeAbort:r,normalizeRequest:a,runHooks:s,wrapResponse:c,withJSON:d}})();const{createReactiveState:pt,sleep:xe,isRetryable:Re,makeAbort:ht,normalizeRequest:mt,runHooks:Le,wrapResponse:Pe,withJSON:re}=i._httpShared,oe=typeof globalThis!="undefined"&&globalThis.JSswift_setting?globalThis.JSswift_setting:{},Me={baseURL:((Ie=oe.http)==null?void 0:Ie.baseURL)||"",timeout:(je=(Be=oe.http)==null?void 0:Be.timeout)!=null?je:0,retry:((Ue=oe.http)==null?void 0:Ue.retry)||{attempts:0,delay:250,factor:2},headers:((We=oe.http)==null?void 0:We.headers)||{},credentials:(He=oe.http)==null?void 0:He.credentials,debug:(qe=oe.debug)!=null?qe:!1},me=pt(i),le=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now(),K={beforeRequest:new Set,afterResponse:new Set,onError:new Set};async function yt(e){const t=i.auth&&typeof i.auth.fetch=="function"?i.auth.fetch.bind(i.auth):fetch,n={method:e.method,headers:e.headers,body:e.body,credentials:e.credentials,signal:e.signal};return t(e.url,n)}async function G(e,t={}){var h,w,T;let n=mt(Me,e,t);n=await Le(K.beforeRequest,n);const o=me.markStart(n),r=le(),a=n.retry||{attempts:0,delay:250,factor:2},s=Math.max(0,Number(a.attempts||0));let c=Math.max(0,Number(a.delay||0));const d=Math.max(1,Number(a.factor||2));let u=null,l=null,f=null,m=null;try{for(let C=0;C<=s;C++){u=null,l=null;const{signal:v,cancel:y}=ht(n.timeout,t.signal),p={...n,signal:v},b=le();try{Me.debug&&console.log("[http.request]",p.method,p.url),(h=i.perf)==null||h.inc("httpRequests"),(w=i.perf)==null||w.mark("http:req",{url:n.url,method:n.method});const k=await yt(p);l=k;const A=await Le(K.afterResponse,k,p),L=le()-b;if((T=i.perf)==null||T.tick("http:res",L,{status:k.status,url:n.url}),C<s&&Re(null,A)){y(),await xe(c),c=Math.round(c*d);continue}return y(),f=A,Pe(A,p)}catch(k){u=k,y();for(const A of K.onError)try{A(k,p)}catch(L){}if(C<s&&Re(k,null)){await xe(c),c=Math.round(c*d);continue}throw m=k,k}}}finally{const C=le()-r;me.markEnd(o,f,m,C)}if(u)throw u;return Pe(l,n)}i.http={},i.http.request=G,i.http.state=()=>me.state,i.http.get=(e,t)=>G(e,{...t,method:"GET"}),i.http.del=(e,t)=>G(e,{...t,method:"DELETE"}),i.http.post=(e,t,n)=>re(G,"POST",e,t,n),i.http.put=(e,t,n)=>re(G,"PUT",e,t,n),i.http.patch=(e,t,n)=>re(G,"PATCH",e,t,n),i.http.getJSON=async(e,t)=>(await G(e,{...t,method:"GET"})).jsonStrict(),i.http.delJSON=async(e,t)=>(await G(e,{...t,method:"DELETE"})).jsonStrict(),i.http.postJSON=async(e,t,n)=>(await re(G,"POST",e,t,n)).jsonStrict(),i.http.putJSON=async(e,t,n)=>(await re(G,"PUT",e,t,n)).jsonStrict(),i.http.patchJSON=async(e,t,n)=>(await re(G,"PATCH",e,t,n)).jsonStrict(),i.http.onBefore=function(e){return K.beforeRequest.add(e),()=>K.beforeRequest.delete(e)},i.http.onAfter=function(e){return K.afterResponse.add(e),()=>K.afterResponse.delete(e)},i.http.onError=function(e){return K.onError.add(e),()=>K.onError.delete(e)},window._http=i.http,i.useRouter=function(e){const t=i.router;return e&&e.onDispose,{navigate:t.navigate,back:()=>history.back(),forward:()=>history.forward(),get current(){return t}}},i.useRoute=function(e){const[t,n]=i.reactive.signal(""),[o,r]=i.reactive.signal({}),[a,s]=i.reactive.signal({}),[c,d]=i.reactive.signal(""),u=f=>{n(f.path||""),r(f.params||{}),s(f.query||{}),d(f.hash||"")},l=i.router.subscribe(u);return e&&typeof e.onDispose=="function"&&e.onDispose(l),{path:t,params:o,query:a,hash:c}},i._routerShared=(()=>{function e(c){return c?(c.startsWith("/")||(c="/"+c),c.length>1&&c.endsWith("/")&&(c=c.slice(0,-1)),c):"/"}function t(c,d=""){if(d&&c.startsWith(d)){const u=c.slice(d.length)||"/";return e(u)}return e(c)}function n(c){c=e(c);const d=[],u=c.replace(/([.+*?=^!${}()[\]|/\\])/g,"\\$1").replace(/\\\/:([A-Za-z0-9_]+)/g,(l,f)=>(d.push(f),"\\/([^\\/]+)"));return{pattern:c,regex:new RegExp("^"+u+"$"),keys:d}}function o(c){const d={};return new URLSearchParams(c||"").forEach((l,f)=>{d[f]===void 0?d[f]=l:Array.isArray(d[f])?d[f].push(l):d[f]=[d[f],l]}),d}function r(c){const d=[];for(const u of c)if(d.push({...u,_parent:null}),u.children&&u.children.length)for(const l of u.children)d.push({...l,_parent:u});return d.sort((u,l)=>l.path.length-u.path.length),d}function a(c,d){const u=e(c),l=r(d);for(const f of l){const m=f._compiled.regex.exec(u);if(!m)continue;const h={};return f._compiled.keys.forEach((w,T)=>{h[w]=decodeURIComponent(m[T+1])}),{route:f,params:h,parent:f._parent||null}}return null}function s(c,d,u=50){c.push({at:Date.now(),path:d.path,params:d.params,query:d.query,hash:d.hash}),c.length>u&&c.shift()}return{normalizePath:e,stripBase:t,compilePattern:n,parseQuery:o,flattenRoutes:r,matchRoute:a,pushHistoryEntry:s}})(),i._uiMetaShared=(()=>{function e(s){return{hasTabPanel:typeof s.TabPanel=="function",Card:typeof s.Card=="function"?s.Card:(...c)=>s.div({class:"cms-doc-card"},...c),Chip:typeof s.Chip=="function"?s.Chip:(c,d)=>s.span({class:"cms-chip cms-chip-fallback"},d)}}function t(s){return s?Array.isArray(s)?s.join(" | "):String(s):"\u2014"}function n(s,c,d){return s.div({class:"cms-doc-meta"},s.div({class:"cms-doc-meta-head"},s.div({class:"cms-doc-meta-name"},c.name),s.div({class:"cms-doc-meta-types"},...c.type?String(c.type).split("|").map(u=>d({color:"secondary",dense:!0,outline:!0},u)):[s.span("\u2014")])),s.div({class:"cms-doc-meta-grid"},s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Default"),s.div({class:"cms-doc-meta-value"},c.default==null?"\u2014":String(c.default))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Values"),s.div({class:"cms-doc-meta-value"},t(c.values)))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Description"),s.div({class:"cms-doc-meta-value"},c.description||"\u2014")))}function o(s,c){return s.div({class:"cms-doc-fallback"},c.map(d=>s.div({class:"cms-doc-fallback-item"},s.h4({class:"cms-doc-fallback-title"},d.label||d.name),d.content)))}function r(s,c){return c?Array.isArray(c)?c.map(d=>({name:d.name,wrap:!0,label:d.name,content:s.div({class:"cms-p-md"},d.description)})):Object.entries(c).map(([d,u])=>({name:d,wrap:!0,label:d,content:s.div({class:"cms-p-md"},u)})):[]}function a(s,c){return c?Array.isArray(c)?c.map(d=>({name:d.name,wrap:!0,label:d.type,content:d.description})):Object.entries(c).map(([d,u])=>({name:d,wrap:!0,label:d,content:s.div({class:"cms-doc-meta"},s.div({class:"cms-doc-meta-head"},s.div({class:"cms-doc-meta-name"},d)),s.div({class:"cms-doc-meta-grid"},s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Type"),s.div({class:"cms-doc-meta-value"},u.type||"\u2014"))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Description"),s.div({class:"cms-doc-meta-value"},u.description||"\u2014")))})):[]}return{resolveDocComponents:e,renderMetaItem:n,renderTabGroupFallback:o,normalizeEventRows:r,normalizeSlotRows:a}})(),i.ui=i.ui||{},i.ui.meta=i.ui.meta||{},i.ui.slot=function(t,n={}){const o=i.ui,{as:r="node",wrap:a="span",iconProps:s=null,filter:c=!0}=n,d=m=>document.createTextNode(String(m)),u=m=>_.span(String(m)),l=m=>{if(m==null||m===!1)return null;if(typeof m=="function")return m;if(Array.isArray(m))return m.flatMap(l).filter(Boolean);if(m&&typeof m=="object"&&m.nodeType)return m;if(typeof m=="string"||typeof m=="number"||typeof m=="boolean"){const h=String(m);return r==="icon"&&o.Icon?o.Icon(h,{class:"cms-slot-icon",...s||{}}):a==="text"?d(h):a==="span"?u(h):h}return a==="text"?d(m):a==="span"?u(m):String(m)},f=l(t);return c&&Array.isArray(f)?f.filter(Boolean):f},i.ui.slots=function(...t){const n=[];for(const o of t){const r=i.ui.slot(o);r&&(Array.isArray(r)?n.push(...r):n.push(r))}return n},i.docTable=e=>{var v;if(!i.isDev())return _.div();const{resolveDocComponents:t,renderMetaItem:n,renderTabGroupFallback:o,normalizeEventRows:r,normalizeSlotRows:a}=i._uiMetaShared,s=(v=i.ui.meta)==null?void 0:v[e];if(!s)return _.div({class:"cms-muted"},`Meta non trovata: ${e}`);const{hasTabPanel:c,Card:d,Chip:u}=t(_),l={};Object.entries(s.props||{}).forEach(([y,p])=>{const b=p.category||"general";l[b]||(l[b]=[]),l[b].push({name:y,...p})});const f=Object.keys(l).map(y=>{const p=l[y].map(b=>({name:b.name,wrap:!0,label:b.name,content:n(_,b,u)}));return{name:y,wrap:!0,label:y,content:c?_.TabPanel({orientation:"vertical",animated:!0,radius:"0 0 0 var(--cms-r-default)",tabs:p}):o(_,p)}}),m=r(_,s.events),h=a(_,s.slots),w=_.rod(null),T=[];h.length&&T.push({name:"Slots",wrap:!0,label:"Slots",content:c?_.TabPanel({animated:!0,radius:"0 0 0 var(--cms-r-default)",orientation:"vertical",tabs:h}):o(_,h)}),f.length&&T.push(...f),m.length&&T.push({name:"Events",wrap:!0,label:"Events",content:c?_.TabPanel({animated:!0,radius:"0 0 0 var(--cms-r-default)",orientation:"vertical",tabs:m}):o(_,m)});const C="general";return T.sort((y,p)=>y.name===C?-1:p.name===C?1:y.name.localeCompare(p.name)),d({class:"cms-doc-table"},_.div({class:"cms-doc-table-header"},_.div({class:"cms-doc-table-title"},`_.${e}`),s.signature?_.div({class:"cms-doc-table-signature"},String(s.signature).replaceAll("UI.","_.")):null),T.length?_.h4({class:"cms-doc-table-section-title"},f.length?"Props":"Documentation"):_.p({class:"cms-muted"},"Nessuna documentazione strutturata disponibile."),T.length?c?_.TabPanel({border:!0,animated:!0,orientation:"horizontal",tabs:T,model:w}):o(_,T):null,s.returns?_.p({class:"cms-muted",style:{marginTop:"14px"}},`Returns: ${s.returns}`):null)},i.ui.inspect=e=>{var t;return console.log(((t=i.ui.meta)==null?void 0:t[e])||"meta not found")},i.ui.can=function(e,t,n,o=null){var s,c;const r=i.useAuth?i.useAuth(e):i.auth;return r?(typeof t=="function"?!!t(r):((s=r.can)==null?void 0:s.call(r,t))||((c=r.hasRole)==null?void 0:c.call(r,t)))?typeof n=="function"?n():n:typeof o=="function"?o():o:typeof o=="function"?o():null},i.ui.canAny=function(e,t,n,o=null){var s;const r=i.useAuth?i.useAuth(e):i.auth;return!!((s=r==null?void 0:r.canAny)!=null&&s.call(r,t))?typeof n=="function"?n():n:typeof o=="function"?o():o},i.ui.canAll=function(e,t,n,o=null){var s;const r=i.useAuth?i.useAuth(e):i.auth;return!!((s=r==null?void 0:r.canAll)!=null&&s.call(r,t))?typeof n=="function"?n():n:typeof o=="function"?o():o},i.Can=function(t,n){var a,s;const o=i.useAuth?i.useAuth(n):i.auth;return(()=>{var c,d,u,l;return o?t.when&&typeof t.when=="function"?!!t.when(o):t.perm?!!((c=o.can)!=null&&c.call(o,t.perm)):t.role?!!((d=o.hasRole)!=null&&d.call(o,t.role)):t.any?!!((u=o.canAny)!=null&&u.call(o,t.any)):t.all?!!((l=o.canAll)!=null&&l.call(o,t.all)):!1:!1})()?typeof t.then=="function"?t.then():(a=t.then)!=null?a:null:typeof t.else=="function"?t.else():(s=t.else)!=null?s:null},i.router=(()=>{let e="history",t=[],n=null,o=null,r="",a=null,s=null,c=[],d=!1;const{normalizePath:u,stripBase:l,compilePattern:f,parseQuery:m,matchRoute:h,pushHistoryEntry:w}=i._routerShared,T={setOutlet:{description:"imposta il contenitore del router"},setBase:{description:"imposta il base path del router"},add:{description:"per aggiungere la route"},notFound:{description:"imposta la view 404"},beforeEach:{description:"hook prima di ogni navigazione"},start:{description:"avvia il router"},navigate:{description:"naviga verso una route"},subscribe:{description:"sottoscrive agli aggiornamenti di route"},current:{description:"ritorna l'URL corrente"},isActive:{description:"verifica se una route e\u0300 attiva"},status:{description:"stringa di stato router"},inspect:{description:"stampa info diagnostiche"},trace:{description:"abilita/disabilita tracing"},history:{description:"ritorna la history interna"},setURLOnly:{description:"aggiorna solo l'URL del browser senza render/meta"}};function C(E,{replace:x=!1}={}){const O=typeof E=="string"?new URL(E,window.location.origin):E,B=O.pathname+O.search+O.hash;if(e==="hash"||e==="auto"){if(history.pushState){const W="#"+B;x?history.replaceState({},"",W):history.pushState({},"",W);return}const q="#"+B;x?window.location.replace(q):window.location.hash=q;return}x?history.replaceState({},"",r+B):history.pushState({},"",r+B)}function v(){if(e==="hash"){const E=window.location.hash||"#/",x=E.startsWith("#")?E.slice(1):E;return new URL(x,window.location.origin)}if(e==="auto"&&window.location.hash.startsWith("#/")){const E=window.location.hash.slice(1);return new URL(E,window.location.origin)}return new URL(window.location.href)}function y(E,x=!1){if(e==="hash"||e==="auto"&&!history.pushState){const O="#"+(E.pathname+E.search+E.hash);x?window.location.replace(O):window.location.hash=O;return}x?history.replaceState({},"",r+E.pathname+E.search+E.hash):history.pushState({},"",r+E.pathname+E.search+E.hash)}function p(E){e=E||"history"}function b(E){return l(E,r)}function k(E){if(!E)return!1;const x=s?s.path:b(v().pathname);let O=E;typeof O=="string"&&(O.includes("?")||O.includes("#")||O.includes("://"))&&(O=new URL(O,window.location.origin).pathname);const B=b(O);return B.includes(":")?f(B).regex.test(x):B===x}async function A(E,{replace:x=!1}={}){if(!n){console.warn("[router] outlet non impostato. Usa JSswift.router.setOutlet('#app').");return}const O=typeof E=="string"?new URL(E,window.location.origin):E;d&&console.log("[router.navigate]",O.toString());const B=O.pathname+O.search+O.hash;y(O,x);const q=b(O.pathname),W=h(q,t),U={path:q,fullPath:B,params:W?W.params:{},query:m(O.search),hash:O.hash||"",navigate:L,outlet:n};if(a){const H=await a(U);if(H===!1)return;if(typeof H=="string"){L(H,{replace:!0});return}}if(typeof o=="function"){try{o()}catch(H){console.error("[router] unmount error:",H)}o=null}if(!W){const H=t._notFound;H?o=i.mount(n,()=>H(U),{clear:!0}):o=i.mount(n,_.div("404"),{clear:!0}),S(U),s=U,w(c,U);return}const Q=W.route.view,Z=W.parent;let ee=null;if(U.renderChild=H=>{if(!U._child)return null;const ne=typeof H=="string"?U.outlet.querySelector(H):H;return ne?(ee=i.mount(ne,()=>U._child.view(U._child.ctx),{clear:!0}),ee):(console.warn("[router] child outlet non trovato:",H),null)},Z){const H=W.route,ne={...U,params:{...U.params}};U._child={view:H.view,ctx:ne},o=i.mount(n,()=>Z.view(U),{clear:!0})}else U._child=null,o=i.mount(n,()=>Q(U),{clear:!0});S(U),s=U,w(c,U)}function L(E,x={}){const O=new URL(E,window.location.origin);A(O,x)}function D(){window.addEventListener("popstate",()=>{A(v(),{replace:!0})}),window.addEventListener("hashchange",()=>{(e==="hash"||e==="auto")&&A(v(),{replace:!0})}),document.addEventListener("click",E=>{var U,Q;const x=(Q=(U=E.target)==null?void 0:U.closest)==null?void 0:Q.call(U,"a");if(!x||E.defaultPrevented||E.button!==0||E.metaKey||E.ctrlKey||E.shiftKey||E.altKey||x.hasAttribute("download")||x.target&&x.target!=="_self")return;const O=x.getAttribute("href");if(!O||O.startsWith("mailto:")||O.startsWith("tel:"))return;const B=new URL(O,window.location.origin);if(B.origin!==window.location.origin)return;const q=new URL(window.location.href);B.pathname+B.search===q.pathname+q.search&&B.hash||(E.preventDefault(),L(B.pathname+B.search+B.hash))}),A(v(),{replace:!0})}function j(E){return n=typeof E=="string"?i.dom.q(E):E,n}function R(E){r=E?u(E):"",r==="/"&&(r="")}function P(E,x,O=null){const B=f(E),q={path:B.pattern,view:x,_compiled:B,children:[]};if(Array.isArray(O))for(const W of O){const[U,Q,Z]=W,ee=u(B.pattern+"/"+(U||"").replace(/^\//,""));q.children.push({path:ee,view:Q,_compiled:f(ee),children:Array.isArray(Z)?Z:[]})}t.push(q)}function M(E){t._notFound=E}function F(E){a=E}let g=new Set;function S(E){for(const x of g)try{x(E)}catch(O){console.error("[router] listener error:",O)}}function z(){if(!s)return"ROUTER \u23F3 not ready";const E=Object.keys(s.query||{}).length?"?":"";return`ROUTER ${s.path}${E} ${s.hash||""}`}function I(E="router"){if(!s)return console.warn("[router.inspect] nessuna route attiva"),null;const x={label:E,mode:typeof e!="undefined"?e:"unknown",base:r,path:s.path,params:s.params,query:s.query,hash:s.hash,outlet:n,timestamp:new Date().toISOString()};return console.groupCollapsed(`[JSswift.router.inspect] ${E}`),console.log(x),console.log("history:",c.slice()),console.groupEnd(),x}function J(E=!0){d=!!E,console.log("[JSswift.router.trace]",d?"ON":"OFF")}function N(){return c.slice()}return{meta:T,setOutlet:j,setBase:R,add:P,setURLOnly:C,notFound:M,beforeEach:F,start:D,navigate:L,isActive:k,subscribe(E){return g.add(E),()=>g.delete(E)},current(){return v?v():new URL(window.location.href)},status:z,inspect:I,trace:J,history:N}})(),($e=i.config)!=null&&$e.debug&&(window.$router=i.router),i.signal=i.reactive.signal,i.effect=i.reactive.effect,i.computed=i.reactive.computed,i.untracked=i.reactive.untracked,i.batch=i.reactive.batch;function se(e){return e==null?null:String(e).trim()||null}function ye(e){const t=Array.isArray(e)?e:typeof e=="string"?e.split(","):[],n=[],o=new Set;for(const r of t){const a=se(r);!a||o.has(a)||(o.add(a),n.push(a))}return n}function ge(){var e;return typeof document!="undefined"&&document.documentElement?document.documentElement:(e=i.dom)!=null&&e.q?i.dom.q("html"):null}function De(){try{return typeof globalThis!="undefined"&&globalThis.localStorage||null}catch(e){return null}}function fe(){var e;return se((e=i.theme)==null?void 0:e.storageKey)||"jsswift:theme"}function Oe(){const e=De();if(!e)return null;try{return se(e.getItem(fe()))}catch(t){return null}}function gt(e){const t=De();if(t)try{e==null?t.removeItem(fe()):t.setItem(fe(),e)}catch(n){}}function ze(e){var o,r,a,s,c;const t=ge(),n=[e,(o=i.theme)==null?void 0:o.themes,(r=i.config)==null?void 0:r.themes,typeof globalThis!="undefined"?(a=globalThis.JSswift_setting)==null?void 0:a.themes:null,typeof globalThis!="undefined"?(s=globalThis.JSswift_setting)==null?void 0:s.themeList:null,(c=t==null?void 0:t.getAttribute)==null?void 0:c.call(t,"data-themes")];for(const d of n){const u=ye(d);if(u.length)return u}return[]}i.theme=i.theme||{},i.theme.storageKey=fe(),ye(i.theme.themes).length||(i.theme.themes=ze()),i.setTheme=function(e,t={}){const n=se(e),o=ge();return o&&(n==null?o.removeAttribute("data-theme"):o.setAttribute("data-theme",n)),t.persist!==!1&&gt(n),o},i.getTheme=function(e={}){var r;const t=ge(),n=se((r=t==null?void 0:t.getAttribute)==null?void 0:r.call(t,"data-theme"));if(n)return n;if(e.storage===!1)return null;const o=Oe();return o&&t&&e.sync!==!1&&t.setAttribute("data-theme",o),o},i.toggleTheme=function(e,t={}){const n=ze(e),o=n.length?n:ye([i.getTheme({sync:!1}),"light","dark"]),r=i.getTheme({sync:!1}),a=se(t.fallback)||o[0]||"light",s=r?o.indexOf(r):-1,c=s>=0?o[(s+1)%o.length]:a;return i.theme.themes=o.slice(),i.setTheme(c,t),c};const Je=Oe();Je&&i.setTheme(Je,{persist:!1})})();
1
+ (()=>{var Fe,Ie,Be,je,Ue,We,He,qe,$e;window.JSswift=window.JSswift||{};const i=window.JSswift;window._=window.JSswift,i.config=i.config||{};const Ve=typeof globalThis!="undefined"&&globalThis.JSswift_setting?globalThis.JSswift_setting:{};i.config.debug=(Fe=Ve.modeDev)!=null?Fe:!1,i.isDev=function(){return i.config.debug},i.uiNormalizeArgs=function(e){let t={},n=e;return e.length>0&&typeof e[0]=="object"&&e[0]!==null&&!e[0].nodeType&&!Array.isArray(e[0])&&!(e[0]instanceof Function)&&(t=e[0],n=e.slice(1)),{props:t,children:n}},i.uiSizes=["xxs","xs","sm","md","lg","xl","xxl","xxxl"],i.uiColors=["primary","secondary","success","warning","danger","info","light","dark"],i.meta=i.meta||{version:"1.0.23",policy:{sourceOfTruth:"docDevelop/reference/core.md",syncRule:"Quando cambia un modulo core, aggiornare sia questo meta sia docDevelop/reference/core.md."},modules:{render:{description:"Bridge props -> DOM per hyperscript _, attributi, class, style, eventi e children reattivi.",entrypoints:["createElement","setProp","bindProp"],status:"milestone-3-closed",knownLimits:["Il mini-terzo-giro e il successivo micro-giro avanzato hanno chiuso style dinamico, eventi, children e props/attr speciali, ma restano altri edge case avanzati da esplorare.","Gli eventi ora supportano composizione base di listener multipli, ma non hanno ancora delegation o diff avanzato.","Restano da esplorare edge case avanzati del renderer oltre ai giri gia coperti dai test."]},reactive:{description:"Core minimale signal/effect usato come base della reattivita.",entrypoints:["JSswift.reactive.signal","JSswift.reactive.effect","JSswift.reactive.computed","JSswift.reactive.untracked","JSswift.reactive.batch"],status:"milestone-2-closed",knownLimits:["La protezione loop copre i loop sincroni per singolo effect, non ancora i cicli complessi tra effect multipli.","Il batching sincrono ora esiste, ma manca ancora scheduling configurabile oltre il flush immediato a fine batch.","Mancano primitive avanzate per controllare scheduling e transazioni asincrone."]},rod:{description:"Layer reattivo di alto livello per binding DOM, model e interpolazioni.",entrypoints:["_.rod","JSswift.rodBind","JSswift.rodModel"],status:"milestone-2-closed",knownLimits:["Va chiarito meglio il rapporto con JSswift.reactive oltre al primo riallineamento strutturale.","Restano casi avanzati di model/binding da esplorare oltre al primo giro coperto dai test.","Il modulo e piu pulito internamente ma non e ancora il punto finale della convergenza con il renderer."]},mount:{description:"Mount, component instances e cleanup automatico del tree DOM.",entrypoints:["JSswift.mount","JSswift.component","JSswift.enableAutoCleanup"],status:"milestone-2-closed",knownLimits:["Il lifecycle e piu pulito internamente ma resta da chiarire meglio la semantica su multi-mount e cloni.","Restano da esplorare edge case avanzati del cleanup automatico fuori dal primo giro gia coperto."]},platform:{description:"Moduli applicativi nel core: overlay, store, auth, http, router, UI meta.",entrypoints:["JSswift.overlay","JSswift.store","JSswift.plugins.auth","JSswift.http","JSswift.router","JSswift.ui.meta"],status:"milestone-2-closed",knownLimits:["Il secondo giro ha ripulito i moduli interni, ma mancano ancora demo separate per modulo e una validazione piu formale di alcune superfici pubbliche.","Esiste una demo browser aggregata del blocco platform, ma non ancora demo separate per ogni modulo.","Mancano configurazione pubblica piu coerente e confini piu netti tra auth, http e router.","Il registry UI meta non ha ancora validazione formale del suo shape."]}}},i.omit=(e,t)=>{const n={},o=new Set(t||[]);for(const r in e||{})o.has(r)||(n[r]=e[r]);return n},i._cleanupRegistry=new WeakMap,i._registerCleanup=function(e,t){if(!e||typeof t!="function")return t;const n=i._cleanupRegistry.get(e)||[];return n.push(t),i._cleanupRegistry.set(e,n),t},i.dom={q(e,t=document){return t.querySelector(e)},qa(e,t=document){return Array.from(t.querySelectorAll(e))},attr(e,t,n){return e?n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.setAttribute(t,String(n)),e):null}},(()=>{let e=[],t=!1;function n(){if(t)return;t=!0;const o=e.slice();e.length=0;for(const r of o)try{r()}catch(a){console.error("[JSswift.ready] error:",a)}}i.ready=function(o){typeof o=="function"&&(t||document.readyState==="interactive"||document.readyState==="complete"?queueMicrotask(()=>{try{o()}catch(r){console.error("[JSswift.ready] error:",r)}}):e.push(o))},document.addEventListener("DOMContentLoaded",n,{once:!0})})(),i.reactive=(()=>{let e=null;const t=[],n=100;let o=0,r="sync",a="sync",s=!1;const c=new Set;function d(p){const b=p==null?void 0:p.flush;if(b==null||b==="sync")return"sync";if(b==="microtask")return"microtask";throw new Error("JSswift.reactive.batch: options.flush must be 'sync' or 'microtask'")}function u(){for(;c.size;){const p=Array.from(c);c.clear(),p.forEach(b=>b())}}function l(){s||(s=!0,queueMicrotask(()=>{s=!1,a="sync",u()}))}function f(p){const b=Array.from(p);if(o>0||a==="microtask"){b.forEach(k=>c.add(k)),o===0&&a==="microtask"&&l();return}b.forEach(k=>k())}function m(p){if(p&&(p._deps.size&&(p._deps.forEach(b=>b.delete(p._runner)),p._deps.clear()),typeof p._cleanup=="function")){const b=p._cleanup;p._cleanup=null;try{b()}catch(k){console.error("[JSswift.reactive.effect] cleanup error:",k)}}}function h(p){if(!(!p||!p.active)){m(p),t.push(p),e=p;try{const b=A=>{p._cleanup=typeof A=="function"?A:null},k=p.fn.length>0?p.fn(b):p.fn();typeof k=="function"&&(p._cleanup=k)}finally{t.pop(),e=t[t.length-1]||null}}}function w(p){if(typeof p!="function")return()=>{};const b={fn:p,active:!0,_deps:new Set,_cleanup:null,_runner:null,_running:!1,_queued:!1},k=()=>{if(!b.active)return;if(b._running){b._queued=!0;return}b._running=!0;let A=0;try{do if(b._queued=!1,h(b),A++,A>=n){b._queued=!1,console.warn("[JSswift.reactive.effect] loop guard triggered: too many synchronous reruns",{max:n,effect:p.name||"anonymous"});break}while(b.active&&b._queued)}finally{b._running=!1}};return b._runner=k,k(),()=>{b.active&&(b.active=!1,m(b))}}function T(p){let b=p;const k=new Set;function A(){return e&&e.active&&(k.add(e._runner),e._deps.add(k)),b}function L(j){b=j,f(k)}function D(){k.clear()}return[A,L,D]}function C(p){if(typeof p!="function")throw new Error("JSswift.reactive.computed: fn must be a function");const[b,k,A]=T(void 0),L=w(()=>{k(p())}),D=()=>b();return D.dispose=()=>{L(),A()},D.peek=()=>b(),D.type="computed",D}function v(p){if(typeof p!="function")throw new Error("JSswift.reactive.untracked: fn must be a function");const b=e;e=null;try{return p()}finally{e=b}}function y(p,b){if(typeof p!="function")throw new Error("JSswift.reactive.batch: fn must be a function");const k=d(b);o===0?r=k:k==="microtask"&&(r="microtask"),o+=1;try{return p()}finally{if(o-=1,o===0){const A=r==="microtask"||a==="microtask";r="sync",A?(a="microtask",l()):u()}}}return{signal:T,effect:w,computed:C,untracked:v,batch:y}})(),i._overlayShared=(()=>{const e=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function t(a,s){const c=a();if(c&&c.isConnected)return c;let d=document.getElementById("cms-overlay-root");return!d&&(document!=null&&document.body)&&(d=document.createElement("div"),d.id="cms-overlay-root",d.className="cms-overlay-root",document.body.appendChild(d)),!document.body&&!d&&i.ready(()=>{let u=document.getElementById("cms-overlay-root");u||(u=document.createElement("div"),u.id="cms-overlay-root",u.className="cms-overlay-root",document.body.appendChild(u)),s(u)}),s(d),d}function n(a){var c;const s=a.querySelector(e);(c=s==null?void 0:s.focus)==null||c.call(s)}function o(a,s){if(a.key!=="Tab")return;const c=Array.from(s.querySelectorAll(e)).filter(f=>f.offsetParent!==null);if(!c.length)return;const d=c[0],u=c[c.length-1],l=document.activeElement;a.shiftKey&&l===d?(a.preventDefault(),u.focus()):!a.shiftKey&&l===u&&(a.preventDefault(),d.focus())}function r(a,s){var Q,Z,ee,H,ne,Ge;if(!s.anchorEl)return;const c=s.anchorEl.getBoundingClientRect(),d=a.getBoundingClientRect(),u=window.visualViewport||null,l=Math.max(0,Number(u==null?void 0:u.offsetLeft)||0),f=Math.max(0,Number(u==null?void 0:u.offsetTop)||0),m=Math.max(Number(u==null?void 0:u.width)||0,window.innerWidth||0,((Q=document.documentElement)==null?void 0:Q.clientWidth)||0),h=Math.max(Number(u==null?void 0:u.height)||0,window.innerHeight||0,((Z=document.documentElement)==null?void 0:Z.clientHeight)||0),w=Number((H=(ee=s.viewportGutter)!=null?ee:s.gutter)!=null?H:8),T=Number.isFinite(w)?Math.max(0,w):8,C=Number((ne=s.offsetX)!=null?ne:0),v=Number((Ge=s.offsetY)!=null?Ge:8),y=Number.isFinite(C)?C:0,p=Number.isFinite(v)?v:8,b=(V,$,X)=>!Number.isFinite(V)||(Number.isFinite($)||($=0),Number.isFinite(X)||(X=$),X<$)?$:Math.min(Math.max(V,$),X),k=String(s.placement||"bottom-start").toLowerCase(),[A,L]=k.split("-"),D=["top","bottom","left","right"].includes(A)?A:"bottom",j=["start","end","center"].includes(L)?L:"start",R={top:"bottom",bottom:"top",left:"right",right:"left"}[D]||"top",P=D==="top"||D==="bottom",M=d.width,F=d.height,g=V=>{let $=c.left+y,X=c.top+p;return V==="top"||V==="bottom"?(j==="center"?$=c.left+(c.width-M)/2+y:j==="end"&&($=c.right-M+y),X=V==="top"?c.top-F-p:c.bottom+p):(j==="center"?X=c.top+(c.height-F)/2+p:j==="end"&&(X=c.bottom-F+p),$=V==="left"?c.left-M-y:c.right+y),{left:$,top:X}},S=V=>V==="top"?c.top-p-T:V==="bottom"?h-c.bottom-p-T:V==="left"?c.left-y-T:m-c.right-y-T,z=S(D),I=S(R),N=(P?F:M)>z&&I>z?R:D,E=g(N),x=l+T,O=f+T,B=Math.max(x,l+m-M-T),q=Math.max(O,f+h-F-T),W=b(E.left,x,B),U=b(E.top,O,q);a.style.position="fixed",a.style.left=`${W}px`,a.style.top=`${U}px`}return{ensureRoot:t,focusFirst:n,trapFocus:o,applyAnchoredPosition:r}})(),i.overlay=(()=>{let e=0;const t=new Map;let n=null;const{ensureRoot:o,focusFirst:r,trapFocus:a,applyAnchoredPosition:s}=i._overlayShared,c=()=>o(()=>n,C=>{n=C});let d=0;const u=()=>{d++,d===1&&document.documentElement.classList.add("cms-scroll-locked")},l=()=>{d=Math.max(0,d-1),d===0&&document.documentElement.classList.remove("cms-scroll-locked")},f=()=>{let C=null;for(const v of t.values())C=v;return C},m=C=>{var y;let v=C;for(;v&&v!==document;){if(v.nodeType===1&&((y=v.getAttribute)==null?void 0:y.call(v,"data-cms-overlay-portal"))==="true")return!0;v=v.parentNode}return!1},h=(C,v={})=>{var S,z,I,J;const y=`ov_${++e}`,p={id:y,opts:v,isOpen:!0,anchorEl:v.anchorEl||null,placement:v.placement||"bottom-start",onClose:typeof v.onClose=="function"?v.onClose:null,overlay:null,panel:null,backdrop:null,reposition:null,_positionCleanup:null,_positionFrame:null,_panelResizeObserver:null,_cleanup:null},b=document.createElement("div");b.className=["cms-overlay",v.type?`type-${v.type}`:""].filter(Boolean).join(" "),b.dataset.id=y;const k=document.createElement("div");k.className="cms-overlay-backdrop",v.backdrop||(k.style.display="none");const A=document.createElement("div");A.className=["cms-overlay-panel",v.className].filter(Boolean).join(" "),A.tabIndex=-1;const L=typeof C=="function"?C({close:()=>w(y)}):C,D=i.ui.slot(L);Array.isArray(D)?D.forEach(N=>N&&A.appendChild(N)):D&&A.appendChild(D),b.appendChild(k),b.appendChild(A);const j=c();if(!j)return{id:y,close:()=>w(y),panel:A,overlay:b};j.appendChild(b),p.overlay=b,p.panel=A,p.backdrop=k,t.set(y,p),v.lockScroll&&u(),v.autoFocus!==!1&&setTimeout(()=>{A.isConnected&&t.get(y)===p&&!A.contains(document.activeElement)&&r(A)},0);const R=(N=null)=>{N&&typeof N=="object"&&Object.assign(p.opts,N),s(A,p.opts)},P=()=>{if(!v.anchorEl)return;const N=globalThis.requestAnimationFrame||(x=>setTimeout(()=>x(Date.now()),0)),E=globalThis.cancelAnimationFrame||clearTimeout;p._positionFrame!=null&&E(p._positionFrame),p._positionFrame=N(()=>{p._positionFrame=null,R()})};if(p.reposition=R,v.anchorEl){R(),P();const N=()=>R();if(window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),(z=(S=window.visualViewport)==null?void 0:S.addEventListener)==null||z.call(S,"resize",N),(J=(I=window.visualViewport)==null?void 0:I.addEventListener)==null||J.call(I,"scroll",N),typeof ResizeObserver=="function"){const E=new ResizeObserver(()=>R());E.observe(A),p._panelResizeObserver=E}p._positionCleanup=()=>{var x,O,B,q,W,U;const E=globalThis.cancelAnimationFrame||clearTimeout;p._positionFrame!=null&&(E(p._positionFrame),p._positionFrame=null),(O=(x=p._panelResizeObserver)==null?void 0:x.disconnect)==null||O.call(x),p._panelResizeObserver=null,window.removeEventListener("resize",N),window.removeEventListener("scroll",N,!0),(q=(B=window.visualViewport)==null?void 0:B.removeEventListener)==null||q.call(B,"resize",N),(U=(W=window.visualViewport)==null?void 0:W.removeEventListener)==null||U.call(W,"scroll",N)}}const M=N=>{const E=f();!E||E.id!==y||v.closeOnOutside!==!1&&(m(N.target)||A.contains(N.target)||w(y))};document.addEventListener("mousedown",M,!0);const F=N=>{const E=f();!E||E.id!==y||(v.trapFocus&&a(N,A),N.key==="Escape"&&v.closeOnEsc!==!1&&(N.preventDefault(),w(y)))};document.addEventListener("keydown",F,!0),k.addEventListener("click",()=>{v.closeOnBackdrop!==!1&&w(y)}),p._cleanup=()=>{var N;document.removeEventListener("mousedown",M,!0),document.removeEventListener("keydown",F,!0),(N=p._positionCleanup)==null||N.call(p)};const g=1e3+t.size*10;return b.style.zIndex=String(g),{id:y,close:()=>w(y),panel:A,overlay:b,reposition:R}},w=C=>{var y,p,b;const v=t.get(C);v&&(t.delete(C),(y=v._cleanup)==null||y.call(v),v.opts.lockScroll&&l(),typeof Y=="function"&&Y(v.overlay),(p=v.overlay)==null||p.remove(),(b=v.onClose)==null||b.call(v))};return{open:h,close:w,closeTop:()=>{const C=f();C&&w(C.id)},root:n,_stack:t}})();function be(e,t={}){const{isSVG:n=!1,normalizeClass:o=y=>String(y!=null?y:""),isContentProp:r=()=>!1,autoValueTags:a=new Set(["INPUT","TEXTAREA","SELECT"])}=t;function s(y){if(n||!(y in e))return!1;try{return typeof e[y]=="boolean"}catch(p){return!1}}function c(y){return n||y.startsWith("data-")||y.startsWith("aria-")||!(y in e)}function d(y,p){if(p==null){e.removeAttribute(y);return}if(p===!1){if(y.startsWith("aria-")){e.setAttribute(y,"false");return}e.removeAttribute(y);return}if(p===!0&&!n&&!y.startsWith("aria-")&&!y.startsWith("data-")){e.setAttribute(y,"");return}e.setAttribute(y,String(p))}function u(y,p){if(y==null)return;const b=String(y),k=b.startsWith("--")||b.includes("-");if(p==null||p===!1||p===""){k?e.style.removeProperty(b):e.style[b]="";return}if(k){e.style.setProperty(b,String(p));return}e.style[b]=p}function l(y){const p=o(y);if(p==null||p===!1||p===""){e.removeAttribute("class");return}e.setAttribute("class",String(p))}function f(y,p){const b=!!p;e[y]=b,b?e.setAttribute(y,""):e.removeAttribute(y)}function m(y){if(r(y)){e[y]="";return}if(y==="class"){e.removeAttribute("class");return}if(y==="style"){e.removeAttribute("style");return}if(s(y)){try{e[y]=!1}catch(p){}e.removeAttribute(y);return}if(e.removeAttribute(y),!c(y))try{typeof e[y]=="string"&&(e[y]="")}catch(p){}}function h(y){!y||typeof y!="object"||Object.entries(y).forEach(([p,b])=>{u(p,b)})}function w(y,p){if(r(y)){e[y]=p!=null?p:"";return}if(y==="class"){l(p);return}if(y==="style"){if(p==null||p===!1){m(y);return}if(typeof p=="object"){h(p);return}}if(s(y)){f(y,p);return}if(p==null||p===!1){m(y);return}if(c(y)){d(y,p);return}e[y]=p}function T(y,p){const b=String(y).split(".");let k=e;for(let A=0;A<b.length-1;A++)if(k=k==null?void 0:k[b[A]],!k)return;k[b[b.length-1]]=p}function C(y){return y?y==="auto"||y.startsWith("attr:")||y.startsWith("@")||y.startsWith("style.")||y.includes("."):!1}function v(y,p){if(!y||y==="auto"){a.has(e.tagName)?w("value",p):e.textContent=p!=null?p:"";return}if(y.startsWith("attr:")){d(y.slice(5),p);return}if(y.startsWith("@")){d(y.slice(1),p);return}if(y.startsWith("style.")){u(y.slice(6),p);return}if(y.includes(".")){T(y,p);return}w(y,p)}return{isBooleanDomProp:s,isAttributeOnlyProp:c,isBindingValueKey:C,setAttributeValue:d,setStyleEntry:u,setClassValue:l,setBooleanProp:f,removeProp:m,applyStyleObject:h,setProp:w,setPathValue:T,applyBindingValue:v}}function ie(e){const t=[],n=o=>{if(!(o==null||o===!1)){if(typeof o=="function"){n(o());return}if(o&&o.type==="rod"){n(o.value);return}if(Array.isArray(o)){o.forEach(n);return}if(typeof o=="object"){Object.entries(o).forEach(([r,a])=>{let s=a;typeof s=="function"?s=s():s&&s.type==="rod"&&(s=s.value),n(s?r:null)});return}o!==!0&&String(o).split(/\s+/).forEach(r=>{r&&t.push(r)})}};return n(e),t.length?Array.from(new Set(t)).join(" "):""}function de(e){return e==null||e===!1?!1:typeof e=="function"||e&&e.type==="rod"?!0:Array.isArray(e)?e.some(de):typeof e=="object"?Object.values(e).some(de):!1}function we(e,t){return e==null||e===!1?!1:typeof e=="function"||t(e)?!0:typeof e!="object"||Array.isArray(e)||e.nodeType?!1:Object.values(e).some(n=>we(n,t))}function Ke(e,t){let n=e;if(typeof n=="function"?n=n():t(n)&&(n=n.value),!n||typeof n!="object"||Array.isArray(n)||n.nodeType)return null;const o={};return Object.entries(n).forEach(([r,a])=>{let s=a;typeof s=="function"?s=s():t(s)&&(s=s.value),o[r]=s}),o}function Se(e){let t=new Set;function n(r){t.forEach(a=>{r.has(a)||e(a,null)}),t=r}function o(r,a){const s=Ke(r,a);if(!s){n(new Set);return}const c=new Set(Object.keys(s));n(c),Object.entries(s).forEach(([d,u])=>{e(d,u)})}return{apply:o}}function Qe(e){return typeof e=="string"&&(e.startsWith("on:")||e.startsWith("on")&&e.length>2)}const ve=128,te=[];function Xe(e,t){te.push({rod:e,value:String(t!=null?t:"")}),te.length>ve&&te.splice(0,te.length-ve)}function Ye(){if(!te.length)return null;const e=te.slice();return te.length=0,{items:e,index:0}}function pe(e,t){if(!t||!e||t.index>=t.items.length)return null;const n=[],o=String(e);let r=0,a=t.index,s=!1;for(;a<t.items.length;){const c=t.items[a],d=c.value;if(!d)break;const u=o.indexOf(d,r);if(u===-1)break;u>r&&n.push(o.slice(r,u)),n.push(c.rod),r=u+d.length,a++,s=!0}return s?(r<o.length&&n.push(o.slice(r)),t.index=a,n):null}function Ae(e){var n;let t="";for(const o of e)typeof o=="string"?t+=o:t+=(n=o==null?void 0:o.value)!=null?n:"";return t}function Ze(e){if(e.startsWith("on:"))return e.slice(3);const t=e.slice(2);return t?t==="DoubleClick"?"dblclick":t.toLowerCase():""}function ce(e){return e==null||e===!1?!1:e===!0?{capture:!0}:typeof e=="boolean"?e:typeof e=="object"?{capture:!!e.capture,passive:!!e.passive,once:!!e.once}:!1}function et(e,t){const n=ce(e),o=ce(t);return typeof n=="boolean"||typeof o=="boolean"?n===o:!!n&&!!o&&n.capture===o.capture&&n.passive===o.passive&&n.once===o.once}function ae(e,t){return Array.isArray(e)?e.some(n=>ae(n,t)):t(e)?!0:!e||typeof e!="object"||Array.isArray(e)||e.nodeType?!1:Array.isArray(e.handlers)?e.handlers.some(n=>ae(n,t))||t(e.options)||typeof e.options=="function":Array.isArray(e.listeners)?e.listeners.some(n=>ae(n,t))||t(e.options)||typeof e.options=="function":t(e.handler)||t(e.listener)||t(e.fn)||t(e.options)||typeof e.options=="function"}function ue(e,t,n){var o,r,a,s,c,d,u;if(e==null||e===!1)return[];if(typeof e=="function")return[{handler:e,options:ce(n!=null?n:!1)}];if(t(e))return ue(e.value,t,n);if(Array.isArray(e))return e.flatMap(l=>ue(l,t,n));if(typeof e=="object"&&!Array.isArray(e)&&!e.nodeType){if(Array.isArray(e.handlers)||Array.isArray(e.listeners)){const m=e.handlers||e.listeners||[],h=(r=(o=e.options)!=null?o:n)!=null?r:!1;return m.flatMap(w=>ue(w,t,h))}let l=(c=(s=(a=e.handler)!=null?a:e.listener)!=null?s:e.fn)!=null?c:null,f=(u=(d=e.options)!=null?d:n)!=null?u:!1;return t(l)&&(l=l.value),t(f)&&(f=f.value),typeof f=="function"&&(f=f()),typeof l=="function"?[{handler:l,options:ce(f)}]:[]}return[]}function tt(e,t){return ue(e,t)}function nt(e,t,n,o){const r=Ze(t);if(!r)return;const a={listeners:[]},s=()=>{a.listeners.forEach(d=>{e.removeEventListener(r,d.dispatch,d.options)}),a.listeners=[]},c=d=>{const u=tt(d,o);a.listeners.length===u.length&&a.listeners.every((f,m)=>{const h=u[m];return f.handler===h.handler&&et(f.options,h.options)})||(s(),u.forEach(f=>{const m={handler:f.handler,options:f.options,dispatch:null};m.dispatch=h=>{if(typeof m.handler=="function"){const w=m.handler.call(e,h);return m.options&&typeof m.options=="object"&&m.options.once&&(e.removeEventListener(r,m.dispatch,m.options),a.listeners=a.listeners.filter(T=>T!==m)),w}},e.addEventListener(r,m.dispatch,m.options),a.listeners.push(m)}))};if(i._registerCleanup(e,s),o(n)){const d=i.reactive.effect(()=>{c(n.value)});i._registerCleanup(e,d);return}if(ae(n,o)){const d=i.reactive.effect(()=>{c(n)});i._registerCleanup(e,d);return}c(n)}function rt(e,t={}){const{isRod:n=()=>!1,interpolationCursor:o=null}=t;function r(l){const f=document.createTextNode(""),m=i.rodBind(f,l);return i._registerCleanup(f,m),f}function a(l){e.appendChild(r(l))}function s(l){const f=document.createTextNode("");e.appendChild(f);const m=i.reactive.effect(()=>{f.textContent=Ae(l)});i._registerCleanup(f,m)}function c(l){const f=[],m=h=>{if(!(h==null||h===!1)){if(Array.isArray(h)){h.forEach(m);return}if(typeof h=="string"){f.push(document.createTextNode(h));return}if(typeof h=="number"){f.push(document.createTextNode(String(h)));return}if(typeof h!="boolean"){if(n(h)){f.push(r(h));return}if(h!=null&&h.nodeType){f.push(h);return}f.push(document.createTextNode(String(h)))}}};return m(l),f}function d(l){const f=document.createComment("dyn");e.appendChild(f);let m=[];const h=i.reactive.effect(()=>{m.forEach(v=>{Y(v),v.parentNode&&v.parentNode.removeChild(v)}),m=[];const w=f.parentNode;if(!w)return;const T=c(l());if(!T.length)return;const C=document.createDocumentFragment();T.forEach(v=>C.appendChild(v)),w.insertBefore(C,f.nextSibling),m=T});i._registerCleanup(f,()=>{h(),m.forEach(w=>Y(w)),m=[]})}function u(l){if(l!=null){if(Array.isArray(l)){for(const f of l)u(f);return}if(typeof l=="string"){const f=pe(l,o);f?s(f):e.appendChild(document.createTextNode(l));return}if(typeof l=="number"){e.appendChild(document.createTextNode(String(l)));return}if(typeof l=="function"){d(l);return}if(n(l)){a(l);return}l.nodeType&&e.appendChild(l)}}return{appendRodText:a,appendInterpolatedText:s,appendDynamicChild:d,appendChildValue:u}}function ot(e,t={}){const{el:n,isRod:o=()=>!1,interpolationCursor:r=null,appendChildValue:a=()=>{},appendRodText:s=()=>{},appendInterpolatedText:c=()=>{},appendDynamicChild:d=()=>{},bindProp:u=()=>{}}=t;for(const l of e)if(l!=null){if(Array.isArray(l)){a(l);continue}if(typeof l=="string"){const f=pe(l,r);f?c(f):n.appendChild(document.createTextNode(l));continue}if(typeof l=="number"){n.appendChild(document.createTextNode(String(l)));continue}if(typeof l=="function"){d(l);continue}if(o(l)){s(l);continue}if(l.nodeType){n.appendChild(l);continue}if(typeof l=="object")for(const[f,m]of Object.entries(l)){if(typeof m=="string"){const h=pe(m,r);if(h){u(f,()=>Ae(h));continue}}if(f==="class"){u(f,m);continue}if(f==="style"&&typeof m=="object"&&m!==null&&!o(m)){u(f,m);continue}u(f,m)}}}const _e="http://www.w3.org/2000/svg",st=new Set(["svg","g","path","circle","ellipse","line","rect","polygon","polyline","text","tspan","defs","linearGradient","radialGradient","stop","use","symbol","clipPath","mask","pattern","filter","feGaussianBlur","feOffset","feBlend","feColorMatrix"]);function he(e){return e==="innerHTML"||e==="innerText"||e==="textContent"||e==="value"}function it(e,...t){const n=st.has(e),o=e==="text"&&!n?document.createTextNode(""):n?document.createElementNS(_e,e):document.createElement(e),r=g=>!!g&&g.type==="rod",a=Ye(),s=rt(o,{isRod:r,interpolationCursor:a}),{appendRodText:c,appendInterpolatedText:d,appendDynamicChild:u,appendChildValue:l}=s,f=be(o,{isSVG:n,normalizeClass:ie,isContentProp:he}),{isBooleanDomProp:m,isBindingValueKey:h,applyBindingValue:w,setStyleEntry:T,setProp:C,setClassValue:v}=f;function y(g){const S=i.reactive.effect(g);return i._registerCleanup(o,S),S}function p(g){if(String((g==null?void 0:g.tagName)||"").toLowerCase()!=="input")return!1;const S=String((g==null?void 0:g.type)||"").toLowerCase();return S==="range"||S==="number"}function b(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()!=="input"?"":String((g==null?void 0:g.type)||"").toLowerCase()}function k(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()==="select"&&!g.multiple}function A(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()==="input"&&String((g==null?void 0:g.type)||"").toLowerCase()==="file"}function L(g,S,z){y(()=>{var N;const J=(N=S.value)!=null?N:"";g.value!==String(J)&&C("value",J)});const I=()=>{let J=g.value;const N=b(g),E=typeof S.value=="number"||S.value==null;if(k(g)&&g.value==="")J=null;else if(p(g)&&E)if(N==="number"&&g.value==="")J=null;else{const x=typeof g.valueAsNumber=="number"&&!Number.isNaN(g.valueAsNumber)?g.valueAsNumber:Number(g.value);J=Number.isNaN(x)?N==="number"?null:0:x}S.value!==J&&(S.value=J)};g.addEventListener(z,I),i._registerCleanup(g,()=>{g.removeEventListener(z,I)})}function D(g,S){y(()=>{const I=!!S.value;!!g.checked!==I&&C("checked",I)});const z=()=>{const I=!!g.checked;S.value!==I&&(S.value=I)};g.addEventListener("change",z),i._registerCleanup(g,()=>{g.removeEventListener("change",z)})}function j(g,S){const z=()=>{var J;return String((J=g.value)!=null?J:"on")};y(()=>{const N=(S.value==null?null:String(S.value))===z();!!g.checked!==N&&C("checked",N)});const I=()=>{if(!g.checked)return;const J=z();S.value!==J&&(S.value=J)};g.addEventListener("change",I),i._registerCleanup(g,()=>{g.removeEventListener("change",I)})}function R(g,S){const z=()=>{const J=g.files;return J==null?[]:Array.isArray(J)?J.slice():typeof J.length=="number"?Array.from(J):[J]};y(()=>{const J=S.value;(J==null||Array.isArray(J)&&J.length===0)&&(g.value!==""&&C("value",""),Array.isArray(g.files)&&(g.files=[]))});const I=()=>{const J=z();S.value=J};g.addEventListener("change",I),i._registerCleanup(g,()=>{g.removeEventListener("change",I)})}function P(g,S){const z=()=>Array.from(g.childNodes||[]).filter(N=>(N==null?void 0:N.tagName)==="OPTION"&&N.selected).map(N=>{var E;return String((E=N.value)!=null?E:"")}),I=()=>{const N=Array.isArray(S.value)?S.value.map(x=>String(x)):[],E=new Set(N);Array.from(g.childNodes||[]).forEach(x=>{var B;if((x==null?void 0:x.tagName)!=="OPTION")return;const O=E.has(String((B=x.value)!=null?B:""));!!x.selected!==O&&(x.selected=O,O?x.setAttribute("selected",""):x.removeAttribute("selected"))})};y(I),g._cmsApplySelectedValues=I,queueMicrotask(I);const J=()=>{const N=z(),E=Array.isArray(S.value)?S.value.map(x=>String(x)):[];E.length===N.length&&E.every((x,O)=>x===N[O])||(S.value=N)};g.addEventListener("change",J),i._registerCleanup(g,()=>{g.removeEventListener("change",J)})}function M(g,S){y(()=>{const N=!!S.value;!!g.selected!==N&&C("selected",N)});let z=null;const I=()=>{const N=!!g.selected;S.value!==N&&(S.value=N)};queueMicrotask(()=>{var N;z||((N=g.parentNode)==null?void 0:N.tagName)!=="SELECT"||(z=g.parentNode,z.addEventListener("change",I))}),i._registerCleanup(g,()=>{z==null||z.removeEventListener("change",I)})}function F(g,S){if(Qe(g)){nt(o,g,S,r);return}if(g==="class"){if(de(S)){y(()=>{v(ie(S))});return}v(ie(S));return}if(g==="style"&&S&&typeof S=="object"){const z=Se(T);if(we(S,r)){y(()=>{z.apply(S,r)});return}z.apply(S,r);return}if(g==="style"&&(typeof S=="function"||r(S))){const z=Se(T);y(()=>{z.apply(S,r)});return}if(h(g)&&typeof S=="function"){y(()=>{w(g,S())});return}if(h(g)&&!r(S)){w(g,S);return}if(typeof S=="function"){y(()=>{C(g,S())});return}if(g==="value"&&r(S)&&(e==="input"||e==="textarea"||e==="select")){if(e==="select"&&o.multiple){P(o,S);return}L(o,S,e==="select"?"change":"input");return}if(g==="checked"&&r(S)&&e==="input"){if(String(o.type||"").toLowerCase()==="radio"){j(o,S);return}D(o,S);return}if(g==="files"&&r(S)&&A(o)){R(o,S);return}if(g==="selected"&&r(S)&&e==="option"){M(o,S);return}if(he(g)&&r(S)){y(()=>{C(g,S.value)});return}if(r(S)){const z=i.rodBind(o,S,{key:g});i._registerCleanup(o,z);return}C(g,S)}return ot(t,{el:o,isRod:r,interpolationCursor:a,appendChildValue:l,appendRodText:c,appendInterpolatedText:d,appendDynamicChild:u,bindProp:F}),e==="select"&&typeof o._cmsApplySelectedValues=="function"&&o._cmsApplySelectedValues(),o}const bt={},Ee=["html","head","title","base","link","meta","style","body","header","footer","main","section","article","aside","nav","h1","h2","h3","h4","h5","h6","p","div","span","pre","blockquote","hr","br","address","a","abbr","b","bdi","bdo","cite","code","data","dfn","em","i","kbd","mark","q","rp","rt","ruby","s","samp","small","strong","sub","sup","time","u","var","wbr","ul","ol","li","dl","dt","dd","table","caption","colgroup","col","thead","tbody","tfoot","tr","th","td","form","label","input","textarea","button","select","option","optgroup","fieldset","legend","datalist","output","progress","meter","img","picture","source","iframe","embed","object","param","audio","video","track","details","summary","dialog","script","noscript","canvas","template","slot","svg","g","path","circle","ellipse","line","rect","polygon","polyline","text","tspan","defs","linearGradient","radialGradient","stop","use","symbol","clipPath","mask","pattern","filter","feGaussianBlur","feOffset","feBlend","feColorMatrix"];Ee.forEach(e=>{window._[e]=(...t)=>it(e,...t)}),_.DOM_ELEMENTS=Ee,_.fragment=(...e)=>e,_.dynamic=function(e){const t=document.createComment("dyn"),n=document.createDocumentFragment();n.appendChild(t);let o=null;return i.reactive.effect(()=>{const r=e();if(o&&o.parentNode&&o.parentNode.removeChild(o),o=null,r==null)return;let a=r;(typeof r=="string"||typeof r=="number")&&(a=document.createTextNode(String(r)));const s=t.parentNode;s&&a&&a.nodeType&&(s.insertBefore(a,t.nextSibling),o=a)}),n};function ct(){let e=!1;const t=new Set;function n(){var r,a,s;e=!1,(r=i.debug)==null||r.inc("rodFlushes"),(a=i.perf)==null||a.inc("rodFlushes"),(s=i.perf)==null||s.mark("rod:flush");const o=Array.from(t);t.clear();for(const c of o)try{c()}catch(d){console.error("[rod] flush error:",d)}}return function(r){t.add(r),e||(e=!0,queueMicrotask(n))}}const at=ct();function Ce(e,t,n){if(!e)return;if(e.nodeType===3){e.textContent=n!=null?n:"";return}be(e,{isSVG:e.namespaceURI===_e,normalizeClass:ie,isContentProp:he}).applyBindingValue(t,n)}function ut(e){return{type:"rod",value:e,_bindings:[],_actions:[],_disposeHooks:[],_disposed:!1,_silentDepth:0,_pending:!1,bindings(){return this._bindings.map(n=>({el:n.el,key:n.key}))},onDispose(n){return typeof n=="function"&&this._disposeHooks.push(n),this},_bind(n,o={key:"auto"}){var s;if(this._disposed)return()=>{};if(!n)return()=>{};const r={el:n,key:(s=o==null?void 0:o.key)!=null?s:"auto"};return this._bindings.some(c=>c.el===r.el&&c.key===r.key)||this._bindings.push(r),Ce(r.el,r.key,this.value),()=>{this._bindings=this._bindings.filter(c=>!(c.el===r.el&&c.key===r.key))}},action(n){return!this._disposed&&typeof n=="function"&&this._actions.push(n),this},_setSilent(n){this._silentDepth++;try{this.value=n}finally{this._silentDepth--}return this},_scheduleNotify(){this._disposed||this._pending||(this._pending=!0,at(()=>{this._pending=!1,this._notifyNow()}))},_notifyNow(){var o,r,a,s,c;if(this._disposed)return;const n=performance.now();(o=i.perf)==null||o.inc("rodNotifies"),this._bindings=this._bindings.filter(d=>{const u=d.el;return u?u.nodeType===3?!!u.parentNode:u.isConnected!==!1:!1});for(const d of this._bindings)Ce(d.el,d.key,this.value);if(!(this._silentDepth>0)){for(const d of this._actions)try{d(this.value)}catch(u){console.error("[rod] action error:",u)}(r=i.debug)==null||r.inc("rodNotifies"),(c=i.perf)==null||c.tick("rod:notify",performance.now()-n,{bindings:((a=this._bindings)==null?void 0:a.length)||0,actions:((s=this._actions)==null?void 0:s.length)||0})}},dispose(){if(!this._disposed){this._disposed=!0;for(const n of this._disposeHooks)try{n()}catch(o){console.error("[rod] dispose hook error:",o)}this._bindings.length=0,this._actions.length=0,this._disposeHooks.length=0}}}}function lt(e,t="value"){var s;let n=e[t],o=null,r=null,a=null;return(s=i==null?void 0:i.reactive)!=null&&s.signal&&([o,r,a]=i.reactive.signal(n),a&&typeof e.onDispose=="function"&&e.onDispose(a)),Object.defineProperty(e,t,{get(){return o?o():n},set(c){r?r(c):n=c,e._scheduleNotify()},configurable:!0}),typeof e.val!="function"&&Object.defineProperty(e,"val",{value(c){return arguments.length?(this.value=c,c):this.value},configurable:!0}),e[Symbol.toPrimitive]||Object.defineProperty(e,Symbol.toPrimitive,{value(c){const d=this.value;if(d==null)return d;const u=typeof d;return c==="number"?Number(d):(u!=="symbol"&&Xe(this,d),u==="string"||u==="number"||u==="boolean"||u==="bigint"||u==="symbol"?d:String(d))},configurable:!0}),e.valueOf||Object.defineProperty(e,"valueOf",{value(){return this.value},configurable:!0}),e.toString||Object.defineProperty(e,"toString",{value(){return String(this.value)},configurable:!0}),e}_.rod=function(t,n="value"){const o=ut(t);return lt(o,n),i.rod._all=i.rod._all||new Set,i.rod._all.add(o),typeof o.onDispose=="function"&&o.onDispose(()=>i.rod._all.delete(o)),o},i.rodBind=function(e,t,n={key:"auto"}){var o,r,a;if((o=i.debug)==null||o.inc("rodBinds"),!e)return(r=i.debug)==null||r.inc("rodBindNull"),(a=i.debug)==null||a.warn("rodBind: target element \xE8 null/undefined",n),()=>{};if(!t||t.type!=="rod")throw new Error("JSswift.rodBind: react must be a rod object");return t._bind(e,n)},i.rodFromSignal=function(e,t){const n=_.rod(e());let o=!1;const r=i.reactive.effect(()=>{const s=n.value,c=i.reactive.untracked(()=>e());if(!o&&c!==s){o=!0;try{t(s)}finally{o=!1}}}),a=i.reactive.effect(()=>{const s=e();if(i.reactive.untracked(()=>n.value)!==s){o=!0;try{n._setSilent(s)}finally{o=!1}}});return typeof n.onDispose=="function"&&(n.onDispose(r),n.onDispose(a)),n};function ke(e){if(!e||!e.tagName)return null;const t=e.tagName.toLowerCase();if(t==="input"){const n=(e.type||"text").toLowerCase();return n==="checkbox"?"checkbox":n==="radio"?"radio":n==="number"?"number":"text"}return t==="select"?e.multiple?"select-multiple":"select":null}i.rodModel=function(e,t,n={}){var l,f,m;if(!t||t.type!=="rod")throw new Error("[JSswift.rodModel] rodObj deve essere un rod");const o=Array.isArray(e)||e instanceof NodeList?Array.from(e):[e],r=(l=n.event)!=null?l:"change",a=(f=n.parse)!=null?f:(h=>h),s=(m=n.format)!=null?m:(h=>h);let c=!1;const d=[],u=h=>{for(const w of o){if(!w)continue;switch(ke(w)){case"checkbox":w.checked=!!h;break;case"radio":w.checked=w.value==h;break;case"select":w.value=h!=null?h:"";break;case"select-multiple":const C=Array.isArray(h)?h.map(String):[];for(const v of w.options)v.selected=C.includes(v.value);break;default:w.value=h!=null?h:""}}};t.action(h=>{if(!c){c=!0;try{u(s(h))}finally{c=!1}}}),u(s(t.value));for(const h of o){if(!h)continue;const w=ke(h),T=()=>{if(c)return;let C;switch(w){case"checkbox":C=h.checked;break;case"radio":if(!h.checked)return;C=h.value;break;case"select":C=h.value;break;case"select-multiple":C=Array.from(h.selectedOptions).map(v=>v.value);break;case"number":C=a(h.value===""?null:Number(h.value));break;default:C=a(h.value)}c=!0;try{t.value!==C&&(t.value=C)}finally{c=!1}};h.addEventListener(r,T),d.push(()=>h.removeEventListener(r,T))}return typeof t.onDispose=="function"&&t.onDispose(()=>d.forEach(h=>h())),()=>d.forEach(h=>h())},i.signalModel=function(e,t,n,o={}){const r=i.rodFromSignal(t,n);return i.rodModel(e,r,o)};function Y(e){if(!e)return;const t=i._cleanupRegistry.get(e);if(t){for(const n of t)try{n()}catch(o){console.error("[cleanup] error:",o)}i._cleanupRegistry.delete(e)}if(e.childNodes&&e.childNodes.length)for(const n of e.childNodes)Y(n)}function ft(e){const t=n=>typeof n=="string"?i.dom.q(n):n;return Array.isArray(e)?e.map(t).filter(Boolean):[t(e)].filter(Boolean)}function dt(e){const t=[],n=[],o=r=>{if(r!=null){if(typeof r=="function"){o(r());return}if(r&&typeof r=="object"&&"node"in r){typeof r.dispose=="function"&&n.push(r.dispose),o(r.node);return}if(Array.isArray(r)){for(const a of r)o(a);return}if(typeof r=="string"||typeof r=="number"){t.push(document.createTextNode(String(r)));return}if(r.nodeType){t.push(r);return}console.warn("[JSswift.mount] contenuto non supportato:",r)}};return o(e),{nodes:t,disposers:n}}function Te(e=[],t="[JSswift.mount] dispose error:"){let n=!1;return()=>{if(!n){n=!0;for(const o of e)try{o()}catch(r){console.error(t,r)}}}}function Ne(e=[],t=null){return Te([...t?[t]:[],...e],"[component] dispose error:")}i.mount=function(e,t,n={}){var d;const o=ft(e),r=(d=n.clear)!=null?d:!0,a=o.length>1;if(o.length===0)return console.warn("[JSswift.mount] nessun target valido:",e),()=>{};const s=[];for(const u of o){if(r)for(;u.firstChild;)Y(u.firstChild),u.removeChild(u.firstChild);const{nodes:l,disposers:f}=dt(t);let m=l;a&&typeof t!="function"&&(m=l.map(w=>w.cloneNode(!0)),f.length&&console.warn("[JSswift.mount] multi-target con dispose: usa content come function per istanze separate."));const h=Te(f);for(const w of m)u.appendChild(w);s.push({root:u,nodes:m,dispose:h});for(const w of m)!w||!w.nodeType||i._registerCleanup(w,h)}return()=>{var u;for(const l of s){for(const f of l.nodes)f&&(Y(f),f.parentNode===l.root&&l.root.removeChild(f));(u=l.dispose)==null||u.call(l)}}},i.component=function(e){if(typeof e!="function")throw new Error("JSswift.component: renderFn must be a function");return function(n={}){const o=[],a=e(n,{onDispose(s){typeof s=="function"&&o.push(s)}});return a&&typeof a=="object"&&"node"in a?{node:a.node,dispose:Ne(o,typeof a.dispose=="function"?a.dispose:null)}:{node:a,dispose:Ne(o)}}},i.enableAutoCleanup=function(){if(i._autoCleanupEnabled)return;i._autoCleanupEnabled=!0;const e=new MutationObserver(t=>{for(const n of t)for(const o of n.removedNodes)Y(o)});e.observe(document.body,{childList:!0,subtree:!0}),i._cleanupObserver=e},i.debug=(()=>{const e={rodFlushes:0,rodNotifies:0,rodBinds:0,rodBindNull:0,rodBindDup:0};function t(){return!!i.config.debug}function n(...d){t()&&console.log("[JSswift]",...d)}function o(...d){t()&&console.warn("[JSswift]",...d)}function r(...d){console.error("[JSswift]",...d)}function a(d,u=1){e[d]||(e[d]=0),e[d]+=u}function s(){return{...e}}function c(){for(const d of Object.keys(e))e[d]=0}return{enabled:t,log:n,warn:o,error:r,inc:a,stats:s,reset:c}})(),i.perf=(()=>{let e=!1;const t={effectsRun:0,effectsSlow:0,rodNotifies:0,rodFlushes:0,domWrites:0,httpRequests:0},n=[],o=[],r={timelineMax:200,slowEffectMs:8};function a(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function s(b,k=0,A=null){e&&(n.push({t:Date.now(),type:b,ms:k,meta:A}),n.length>r.timelineMax&&n.shift())}function c(b,k=1){e&&(t[b]=(t[b]||0)+k)}function d(b,k){e&&(o.push({t:Date.now(),ms:b,meta:k}),o.length>100&&o.shift())}let u=null;function l(){u||(u=i.reactive.effect,i.reactive.effect=function(b,k){return u((...L)=>{const D=a();c("effectsRun");try{return b(...L)}finally{const j=a()-D;j>=r.slowEffectMs?(c("effectsSlow"),d(j,k||b.name||"effect"),s("effect:slow",j,k||b.name||null)):s("effect",j,k||b.name||null)}})})}function f(){u&&(i.reactive.effect=u,u=null)}function m(b=!0){return e=!!b,e?l():f(),e}function h(){for(const b of Object.keys(t))t[b]=0;n.length=0,o.length=0}function w(){return{enabled:e,...t,slowEffectMs:r.slowEffectMs,timelineSize:n.length}}function T(){return n.slice()}function C(b=r.slowEffectMs){return o.filter(k=>k.ms>=b).slice().sort((k,A)=>A.ms-k.ms)}function v(b,k){const A=a();try{return k()}finally{const L=a()-A;s("time:"+b,L,b)}}function y(b,k){s(b,0,k)}function p(b,k,A){s(b,k,A)}return{enable:m,reset:h,stats:w,timeline:T,slowEffects:C,time:v,mark:y,tick:p,inc:c,cfg:r}})(),i.rod=i.rod||{},i.rod.inspect=function(e,t="rod"){if(!e||e.type!=="rod")return console.warn("[JSswift.rod.inspect] non \xE8 un rod:",e),null;const n=typeof e.bindings=="function"?e.bindings():[],o={label:t,value:e.value,bindingsCount:n.length,bindings:n.map(r=>{var a,s,c,d,u,l,f;return{key:r.key,el:((a=r.el)==null?void 0:a.nodeType)===3?"#text":(s=r.el)==null?void 0:s.tagName,id:((c=r.el)==null?void 0:c.id)||null,className:((d=r.el)==null?void 0:d.className)||null,isConnected:((u=r.el)==null?void 0:u.nodeType)===3?!!r.el.parentNode:(f=(l=r.el)==null?void 0:l.isConnected)!=null?f:null}}),actionsCount:Array.isArray(e._actions)?e._actions.length:null,disposed:!!e._disposed};return i.config.debug?(console.groupCollapsed(`[JSswift.rod.inspect] ${t}`),console.log(o),console.groupEnd()):console.log(o),o},i.rod.inspectAll=function(){const e=i.rod._all?Array.from(i.rod._all):[];return e.forEach((t,n)=>i.rod.inspect(t,`rod#${n+1}`)),e.length},i._storeShared=(()=>{function e(a){return`${a.storage}::${a.prefix}`}function t(a,s){function c(f={}){var h,w;const m={storage:(h=f.storage)!=null?h:a.storage,prefix:(w=f.prefix)!=null?w:a.prefix};return s.set(e(m),m),m}function d(f=null){var h;return(typeof f=="string"?f:(h=f==null?void 0:f.storage)!=null?h:a.storage)==="session"?window.sessionStorage:window.localStorage}function u(f,m=null){return(m||c()).prefix+f}function l(f,m=null){const h=m||c();return`${e(h)}::${f}`}return{getScope:c,getStorage:d,fullKey:u,channelKey:l}}function n(a){try{return JSON.parse(a)}catch(s){return}}function o(a){try{return JSON.stringify(a)}catch(s){return}}function r(a,...s){const c=`${a.storage}::${a.prefix}::`;for(const d of s)for(const u of Array.from(d.keys()))u.startsWith(c)&&d.delete(u)}return{createScopeTools:t,safeParse:n,safeStringify:o,clearScopedMapEntries:r}})(),i.store=(()=>{const e={prefix:"JSswift:",storage:"local",syncTabs:!0,writeDelay:0},t=new Map,n=new Map,o=new Map,r=new Map;let a=!1;const{createScopeTools:s,safeParse:c,safeStringify:d,clearScopedMapEntries:u}=i._storeShared,{getScope:l,getStorage:f,fullKey:m,channelKey:h}=s(e,r);function w(R,P,M=null){var S;const F=M||l(),g=n.get(h(R,F));if(g)for(const z of g)try{(S=i.reactive)!=null&&S.untracked?i.reactive.untracked(()=>z(P)):z(P)}catch(I){console.error("[store] watcher error:",I)}}function T(){a=!1;for(const[R,P]of Array.from(o.entries())){o.delete(R);const M=t.get(R),F=d(M);if(F===void 0)continue;const g=f(P.scope);try{g.setItem(m(P.key,P.scope),F)}catch(S){console.error("[store] write error:",S)}}}function C(R,P=null){const M=P||l();o.set(h(R,M),{key:R,scope:M}),!a&&(a=!0,e.writeDelay>0?setTimeout(T,e.writeDelay):queueMicrotask(T))}function v(R,P=null){const M=P||l(),g=f(M).getItem(m(R,M));if(g!=null)return c(g)}function y(R,P,M=null){const F=M||l(),g=h(R,F);if(t.has(g))return t.get(g);const S=v(R,F);return S!==void 0?(t.set(g,S),S):P}function p(R,P,M=null){const F=M||l();return t.set(h(R,F),P),C(R,F),w(R,P,F),P}function b(R,P=null){const M=P||l(),F=h(R,M);t.delete(F),o.delete(F);try{f(M).removeItem(m(R,M))}catch(g){}w(R,void 0,M)}function k(R={}){const P=l(R),M=f(P),F=[];for(let g=0;g<M.length;g++){const S=M.key(g);S&&S.startsWith(P.prefix)&&F.push(S)}for(const g of F)M.removeItem(g);u(P,t,o,n)}function A(R,P,M=null){if(typeof P!="function")return()=>{};const F=M||l(),g=h(R,F);return n.has(g)||n.set(g,new Set),n.get(g).add(P),()=>{var S;return(S=n.get(g))==null?void 0:S.delete(P)}}function L(R,P,M={}){const F=l({storage:M.storage,prefix:M.prefix}),g=y(R,P,F),[S,z,I]=i.reactive.signal(g),J=i.reactive.effect(()=>{const x=S();p(R,x,F)}),N=A(R,x=>{S()!==x&&z(x)},F);return[S,z,()=>{try{J==null||J()}catch(x){}try{N==null||N()}catch(x){}try{I==null||I()}catch(x){}}]}l(),e.syncTabs&&window.addEventListener("storage",R=>{if(!(!R.key||!R.storageArea))for(const P of r.values()){if(f(P)!==R.storageArea||!R.key.startsWith(P.prefix))continue;const M=R.key.slice(P.prefix.length),F=R.newValue==null?void 0:c(R.newValue),g=h(M,P);F===void 0?t.delete(g):t.set(g,F),w(M,F,P)}});function D(R={}){Object.assign(e,R),l()}function j(){return{prefix:e.prefix,storage:e.storage,syncTabs:e.syncTabs,cacheSize:t.size,scopeCount:r.size}}return{configure:D,stats:j,get:y,set:p,remove:b,clear:k,watch:A,signal:L}})(),i.store.computed=function(e){if(typeof e!="function")throw new Error("store.computed: fn must be a function");return i.reactive.computed(e)},i.store.migrate=function(e,t,n={}){var c,d;const o=(c=n.versionKey)!=null?c:"__version",r=Number((d=i.store.get(o,0))!=null?d:0),a=Number(e!=null?e:0);if(!Number.isFinite(a)||a<0)throw new Error("store.migrate: targetVersion non valido");if(r>=a)return{from:r,to:a,applied:0};let s=0;for(let u=r;u<a;u++){const l=t==null?void 0:t[u];if(typeof l=="function")try{l(i.store)}catch(f){console.error("[store.migrate] step error at version",u,f)}s++,i.store.set(o,u+1)}return{from:r,to:a,applied:s}},i.store.model=function(e,t,n,o={}){if(typeof t!="string"||!t)throw new Error("store.model: key deve essere una stringa non vuota");const[r,a,s]=i.store.signal(t,n,{storage:o.storage,prefix:o.prefix}),c=i.rodFromSignal(r,a),d=i.rodModel(e,c,{event:o.event,parse:o.parse,format:o.format});return()=>{var u;try{d==null||d()}catch(l){}try{s==null||s()}catch(l){}try{(u=c.dispose)==null||u.call(c)}catch(l){}}},i.store.bind=function(e,t,n,o={}){var a;let r=e;return typeof e=="string"&&(e.includes("[")||e.includes(" ")?r=document.querySelectorAll(e):r=i.dom.q(e)),r?i.store.model(r,t,n,o):((a=i.config)!=null&&a.debug&&console.warn("[store.bind] target non trovato:",e),()=>{})},i.store.bindAll=function(e,t={},n={}){if(typeof e=="string"&&(e=i.dom.q(e)),!e||!e.querySelectorAll)return console.warn("[store.bindAll] form non valido:",e),()=>{};const o=[];for(const[r,a]of Object.entries(t)){const s=e.querySelectorAll(`[name="${r}"]`);if(!s.length)continue;const c=i.store.model(s.length===1?s[0]:s,r,a,n);o.push(c)}return()=>o.forEach(r=>r())},i.store.inspect=function(){const e={...i.store.stats(),keys:Array.from((function(){const t=i.store.stats().storage==="session"?sessionStorage:localStorage,n=[];for(let o=0;o<t.length;o++){const r=t.key(o);r&&r.startsWith(i.store.stats().prefix)&&n.push(r.replace(i.store.stats().prefix,""))}return n})())};return console.groupCollapsed("[JSswift.store.inspect]"),console.table(e.keys),console.log(e),console.groupEnd(),e},i.store.autoForm=function(e,t={},n={}){var r;const o=i.store.bindAll(e,t,n);return(r=i.config)!=null&&r.debug&&console.log("[store.autoForm] autosave attivo:",t),o},i.useStore=function(e,t,n,o={}){const[r,a,s]=i.store.signal(e,t,o);return n&&typeof n.onDispose=="function"&&typeof s=="function"&&n.onDispose(s),[r,a]},i._plugins=new Set,i.usePlugin=function(e,t){var n;if(e){if(i._plugins.has(e)){(n=i.config)!=null&&n.debug&&console.warn("[JSswift.usePlugin] plugin gi\xE0 installato:",e.name||e);return}if(typeof e=="function"){e(i,t),i._plugins.add(e);return}if(e&&typeof e.install=="function"){e.install(i,t),i._plugins.add(e);return}console.warn("[JSswift.usePlugin] plugin non valido:",e)}},i.plugins=i.plugins||{},i.plugins.debug={install(e){e.config.debug=!0,console.log("[JSswift] Debug mode ON")}},i.plugins.forms={install(e){const t={};e.forms={validate(n,o={},r={}){var l,f;if(typeof n=="string"&&(n=e.dom.q(n)),!n||!n.querySelectorAll)return console.warn("[forms.validate] form non valido:",n),null;const a={mode:r.mode||"input",showMessages:(l=r.showMessages)!=null?l:!0,submitGuard:(f=r.submitGuard)!=null?f:!0,errorClass:r.errorClass||"is-invalid",validClass:r.validClass||"is-valid",messageClass:r.messageClass||"form-error"},s={};for(const[m,h]of Object.entries(o)){const w=n.querySelectorAll(`[name="${m}"]`);if(!w.length)continue;const[T,C]=e.reactive.signal(null);s[m]={getErr:T,setErr:C,els:w};let v=null;a.showMessages&&(v=document.createElement("div"),v.className=a.messageClass,w[w.length-1].after(v));const y=()=>{let p;const b=w[0];if(b.type==="checkbox")p=b.checked;else if(b.type==="radio"){const L=Array.from(w).find(D=>D.checked);p=L?L.value:null}else p=b.value;let k=!0;try{k=h(p)}catch(L){k=L.message||"Errore di validazione"}const A=k===!0?null:typeof k=="string"?k:"Valore non valido";return C(A),!A};for(const p of w)p.addEventListener(a.mode,y);e.reactive.effect(()=>{const p=T();for(const b of w)b.classList.toggle(a.errorClass,!!p),b.classList.toggle(a.validClass,!p);v&&(v.textContent=p||"",v.style.display=p?"block":"none")}),y()}const c=e.store.computed(()=>Object.values(s).every(m=>!m.getErr())),d=m=>{let h=!0;for(const w of Object.values(s)){const T=w.els[0];T&&T.dispatchEvent(new Event(a.mode,{bubbles:!0})),w.getErr()&&(h=!1)}!h&&a.submitGuard&&(m.preventDefault(),m.stopPropagation())};a.submitGuard&&n.addEventListener("submit",d);const u=()=>{a.submitGuard&&n.removeEventListener("submit",d)};return t[n]={isValid:c,dispose:u},{isValid:c,dispose:u}}}}},i._authShared=(()=>{function e(o){const r=()=>{var s;return((s=o())==null?void 0:s.roles)||[]},a=()=>{var s;return((s=o())==null?void 0:s.permissions)||[]};return{roles:r,perms:a,hasRole:s=>r().includes(s),can:s=>a().includes(s),canAny:s=>s.some(c=>r().includes(c)||a().includes(c)),canAll:s=>s.every(c=>r().includes(c)||a().includes(c))}}function t(o,r){return r.some(a=>typeof a=="string"?o.startsWith(a):a instanceof RegExp?a.test(o):!1)}function n(o,r){if(!o||!r)return;let a=!1;function s(){return Date.now()}function c(m){if(!m||typeof m!="string")return null;const h=m.split(".");if(h.length<2)return null;try{const w=h[1].replace(/-/g,"+").replace(/_/g,"/"),T=decodeURIComponent(atob(w).split("").map(C=>"%"+C.charCodeAt(0).toString(16).padStart(2,"0")).join(""));return JSON.parse(T)}catch(w){return null}}function d(){var m,h,w,T;if(typeof r._getState=="function"){const C=r._getState();return C&&typeof C=="object"?C:{user:(h=(m=r.user)==null?void 0:m.call(r))!=null?h:null}}return{user:(T=(w=r.user)==null?void 0:w.call(r))!=null?T:null}}function u(){var y,p,b;const m=d()||{},h=(p=m.user)!=null?p:(y=r.user)==null?void 0:y.call(r),w=(h==null?void 0:h.name)||(h==null?void 0:h.email)||(h==null?void 0:h.id)||"anon",T=!!((b=r.isAuth)!=null&&b.call(r)),C=m.expiresAt||null,v=C?C-s():null;return T?`AUTH \u2705 user=${w}${C?` expiresIn=${Math.round(v/1e3)}s`:""}`:`AUTH \u274C user=${w}`}function l(m="auth"){var D,j,R;const h=d()||{},w=(j=h.user)!=null?j:(D=r.user)==null?void 0:D.call(r),T=(w==null?void 0:w.roles)||[],C=(w==null?void 0:w.permissions)||[],v=h.accessToken||null,y=h.refreshToken||null,p=v?c(v):null,b=h.expiresAt||(p!=null&&p.exp?p.exp*1e3:null),k=s(),A=b?b-k:null,L={label:m,isAuth:!!((R=r.isAuth)!=null&&R.call(r)),user:w,roles:T,permissions:C,has:{role:P=>{var M;return!!((M=r.hasRole)!=null&&M.call(r,P))},can:P=>{var M;return!!((M=r.can)!=null&&M.call(r,P))}},token:{hasAccess:!!v,hasRefresh:!!y,expiresAt:b,expiresInSec:A==null?null:Math.round(A/1e3),decodedJWT:p}};return console.groupCollapsed(`[JSswift.auth.inspect] ${m}`),console.log("status:",u()),console.log(L),A!=null&&(A<=0?console.warn("\u26A0\uFE0F Access token scaduto."):A<6e4&&console.warn("\u26A0\uFE0F Access token in scadenza (<60s).")),console.groupEnd(),L}function f(m=!0){a=!!m,console.log("[JSswift.auth.trace]",a?"ON":"OFF")}if(typeof r.fetch=="function"&&!r._fetchWrapped){const m=r.fetch.bind(r);r.fetch=async(...h)=>{const w=await m(...h);if(a)try{console.log("[auth.fetch]",w.status,h[0])}catch(T){}return w},r._fetchWrapped=!0}r.decodeJWT=c,r.status=u,r.inspect=l,r.trace=f}return{createPermissionApi:e,matchesProtectedPath:t,attachDevTools:n}})(),i.plugins.auth={install(e,t={}){var k;const{createPermissionApi:n,matchesProtectedPath:o,attachDevTools:r}=i._authShared,a={key:t.key||"auth",loginRoute:t.loginRoute||"/login",protected:t.protected||[],autoRedirect:(k=t.autoRedirect)!=null?k:!0,endpoints:t.endpoints||{login:"/api/login",refresh:"/api/refresh",logout:"/api/logout"},fetchOptions:t.fetchOptions||{},tokenHeader:t.tokenHeader||"Authorization",tokenPrefix:t.tokenPrefix||"Bearer ",refreshMargin:t.refreshMargin||3e4},[s,c]=e.store.signal(a.key,null),d=()=>{var A;return((A=s())==null?void 0:A.user)||null},u=()=>{var A;return!!((A=s())!=null&&A.accessToken)},{hasRole:l,can:f,canAny:m,canAll:h}=n(d);let w=!1,T=[];function C(){const A=s();return A!=null&&A.expiresAt?Date.now()>A.expiresAt-a.refreshMargin:!1}async function v(){var A;if(w)return new Promise((L,D)=>T.push({res:L,rej:D}));w=!0;try{const L=await fetch(a.endpoints.refresh,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:(A=s())==null?void 0:A.refreshToken})});if(!L.ok)throw new Error("Refresh failed");const D=await L.json();return c({...s(),...D}),T.forEach(j=>j.res(!0)),T=[],!0}catch(L){throw T.forEach(D=>D.rej(L)),T=[],c(null),a.autoRedirect&&e.router.navigate(a.loginRoute),L}finally{w=!1}}async function y(A){const L=await fetch(a.endpoints.login,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!L.ok)throw new Error("Login failed");const D=await L.json();return c(D),D}async function p(){try{await fetch(a.endpoints.logout,{method:"POST"})}catch(A){}c(null),a.autoRedirect&&e.router.navigate(a.loginRoute)}async function b(A,L={}){var P;C()&&await v();const D=s(),j=new Headers(L.headers||{});D!=null&&D.accessToken&&j.set(a.tokenHeader,a.tokenPrefix+D.accessToken);const R=await fetch(A,{...a.fetchOptions,...L,headers:j});return R.status===401&&((P=s())!=null&&P.refreshToken)&&!L._authRetried?(await v(),b(A,{...L,_authRetried:!0})):R}e.router.beforeEach(A=>{const L=A.path;return o(L,a.protected)&&!u()?a.loginRoute:!0}),e.auth={user:d,isAuth:u,hasRole:l,can:f,canAny:m,canAll:h,loginAsync:y,logoutAsync:p,fetch:b,_getState:s},e.useAuth=function(A){return A&&A.onDispose,e.auth},r(i,e.auth)}},i._httpShared=(()=>{function e(u){var F;const l=u.reactive,[f,m]=l.signal(0),[h,w]=l.signal("idle"),[T,C]=l.signal(null),[v,y]=l.signal(null),[p,b]=l.signal(null),[k,A]=l.signal(0),[L,D]=l.signal(0);let j=0;function R(g){const S=++j,z=Date.now();return m(f()+1),w("pending"),b(null),y(null),C({id:S,url:g.url,method:g.method,meta:g.meta,timeout:g.timeout,retry:g.retry,startedAt:z}),D(z),S}function P(g,S,z,I){const J=Date.now();m(Math.max(0,f()-1)),g===j&&(z?(w("error"),b(z),y(null)):S?(w("success"),b(null),y({id:g,status:S.status,ok:S.ok,headers:S.headers,url:S.url,receivedAt:J,raw:S})):(w("idle"),b(null),y(null)),A(Math.max(0,Number(I||0)))),D(J)}return{state:{inFlight:f,status:h,isLoading:(F=u.store)!=null&&F.computed?u.store.computed(()=>f()>0):()=>f()>0,lastRequest:T,lastResponse:v,lastError:p,lastDuration:k,lastUpdated:L,reset(){m(0),w("idle"),C(null),y(null),b(null),A(0),D(Date.now())}},markStart:R,markEnd:P}}function t(u,l){if(!u||/^https?:\/\//i.test(l))return l;const f=u.endsWith("/")?u.slice(0,-1):u,m=l.startsWith("/")?l:"/"+l;return f+m}function n(u){return new Promise(l=>setTimeout(l,u))}function o(u,l){return u?!0:l?l.status===429||l.status>=500&&l.status<=599:!1}function r(u,l){if(!u&&!l)return{signal:void 0,cancel:()=>{}};const f=new AbortController,m=f.signal;let h=null;u>0&&(h=setTimeout(()=>f.abort(new Error("timeout")),u));const w=()=>f.abort(l.reason||new Error("aborted"));return l&&(l.aborted?w():l.addEventListener("abort",w,{once:!0})),{signal:m,cancel:()=>{var C;h&&clearTimeout(h),l&&((C=l.removeEventListener)==null||C.call(l,"abort",w))}}}function a(u,l,f={}){var T,C,v;const m=typeof l=="string"?t(u.baseURL,l):l,h=(f.method||"GET").toUpperCase(),w=new Headers(u.headers);return f.headers&&new Headers(f.headers).forEach((y,p)=>w.set(p,y)),{url:m,method:h,headers:w,body:f.body,credentials:(T=f.credentials)!=null?T:u.credentials,signal:f.signal,timeout:(C=f.timeout)!=null?C:u.timeout,retry:(v=f.retry)!=null?v:u.retry,meta:f.meta||{}}}async function s(u,...l){var m;let f=l[0];for(const h of u)f=(m=await h(f,...l.slice(1)))!=null?m:f;return f}function c(u,l){return{ok:u.ok,status:u.status,headers:u.headers,raw:u,req:l,async json(){let f=null,m=null;try{f=await u.json()}catch(h){f=null}return u.ok||(m=f!=null?f:{status:u.status}),{data:f,error:m,ok:u.ok,status:u.status}},async jsonStrict(){const{data:f,error:m}=await this.json();if(m){const h=new Error(`HTTP error ${u.status} ${(l==null?void 0:l.method)||""} ${(l==null?void 0:l.url)||""}`.trim());throw h.status=u.status,h.data=f,h.req={url:l==null?void 0:l.url,method:l==null?void 0:l.method,meta:l==null?void 0:l.meta},h}return{data:f,ok:!0,status:u.status}},async text(){let f="";try{f=await u.text()}catch(m){}return{text:f,ok:u.ok,status:u.status}},async textStrict(){const f=await this.text();if(!f.ok){const m=new Error("HTTP error "+u.status);throw m.status=u.status,m.text=f.text,m}return f}}}function d(u,l,f,m,h={}){const w=new Headers(h.headers||{});return w.has("Content-Type")||w.set("Content-Type","application/json"),u(f,{...h,method:l,headers:w,body:m==null?void 0:JSON.stringify(m)})}return{createReactiveState:e,joinURL:t,sleep:n,isRetryable:o,makeAbort:r,normalizeRequest:a,runHooks:s,wrapResponse:c,withJSON:d}})();const{createReactiveState:pt,sleep:xe,isRetryable:Re,makeAbort:ht,normalizeRequest:mt,runHooks:Le,wrapResponse:Pe,withJSON:re}=i._httpShared,oe=typeof globalThis!="undefined"&&globalThis.JSswift_setting?globalThis.JSswift_setting:{},Me={baseURL:((Ie=oe.http)==null?void 0:Ie.baseURL)||"",timeout:(je=(Be=oe.http)==null?void 0:Be.timeout)!=null?je:0,retry:((Ue=oe.http)==null?void 0:Ue.retry)||{attempts:0,delay:250,factor:2},headers:((We=oe.http)==null?void 0:We.headers)||{},credentials:(He=oe.http)==null?void 0:He.credentials,debug:(qe=oe.debug)!=null?qe:!1},me=pt(i),le=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now(),K={beforeRequest:new Set,afterResponse:new Set,onError:new Set};async function yt(e){const t=i.auth&&typeof i.auth.fetch=="function"?i.auth.fetch.bind(i.auth):fetch,n={method:e.method,headers:e.headers,body:e.body,credentials:e.credentials,signal:e.signal};return t(e.url,n)}async function G(e,t={}){var h,w,T;let n=mt(Me,e,t);n=await Le(K.beforeRequest,n);const o=me.markStart(n),r=le(),a=n.retry||{attempts:0,delay:250,factor:2},s=Math.max(0,Number(a.attempts||0));let c=Math.max(0,Number(a.delay||0));const d=Math.max(1,Number(a.factor||2));let u=null,l=null,f=null,m=null;try{for(let C=0;C<=s;C++){u=null,l=null;const{signal:v,cancel:y}=ht(n.timeout,t.signal),p={...n,signal:v},b=le();try{Me.debug&&console.log("[http.request]",p.method,p.url),(h=i.perf)==null||h.inc("httpRequests"),(w=i.perf)==null||w.mark("http:req",{url:n.url,method:n.method});const k=await yt(p);l=k;const A=await Le(K.afterResponse,k,p),L=le()-b;if((T=i.perf)==null||T.tick("http:res",L,{status:k.status,url:n.url}),C<s&&Re(null,A)){y(),await xe(c),c=Math.round(c*d);continue}return y(),f=A,Pe(A,p)}catch(k){u=k,y();for(const A of K.onError)try{A(k,p)}catch(L){}if(C<s&&Re(k,null)){await xe(c),c=Math.round(c*d);continue}throw m=k,k}}}finally{const C=le()-r;me.markEnd(o,f,m,C)}if(u)throw u;return Pe(l,n)}i.http={},i.http.request=G,i.http.state=()=>me.state,i.http.get=(e,t)=>G(e,{...t,method:"GET"}),i.http.del=(e,t)=>G(e,{...t,method:"DELETE"}),i.http.post=(e,t,n)=>re(G,"POST",e,t,n),i.http.put=(e,t,n)=>re(G,"PUT",e,t,n),i.http.patch=(e,t,n)=>re(G,"PATCH",e,t,n),i.http.getJSON=async(e,t)=>(await G(e,{...t,method:"GET"})).jsonStrict(),i.http.delJSON=async(e,t)=>(await G(e,{...t,method:"DELETE"})).jsonStrict(),i.http.postJSON=async(e,t,n)=>(await re(G,"POST",e,t,n)).jsonStrict(),i.http.putJSON=async(e,t,n)=>(await re(G,"PUT",e,t,n)).jsonStrict(),i.http.patchJSON=async(e,t,n)=>(await re(G,"PATCH",e,t,n)).jsonStrict(),i.http.onBefore=function(e){return K.beforeRequest.add(e),()=>K.beforeRequest.delete(e)},i.http.onAfter=function(e){return K.afterResponse.add(e),()=>K.afterResponse.delete(e)},i.http.onError=function(e){return K.onError.add(e),()=>K.onError.delete(e)},window._http=i.http,i.useRouter=function(e){const t=i.router;return e&&e.onDispose,{navigate:t.navigate,back:()=>history.back(),forward:()=>history.forward(),get current(){return t}}},i.useRoute=function(e){const[t,n]=i.reactive.signal(""),[o,r]=i.reactive.signal({}),[a,s]=i.reactive.signal({}),[c,d]=i.reactive.signal(""),u=f=>{n(f.path||""),r(f.params||{}),s(f.query||{}),d(f.hash||"")},l=i.router.subscribe(u);return e&&typeof e.onDispose=="function"&&e.onDispose(l),{path:t,params:o,query:a,hash:c}},i._routerShared=(()=>{function e(c){return c?(c.startsWith("/")||(c="/"+c),c.length>1&&c.endsWith("/")&&(c=c.slice(0,-1)),c):"/"}function t(c,d=""){if(d&&c.startsWith(d)){const u=c.slice(d.length)||"/";return e(u)}return e(c)}function n(c){c=e(c);const d=[],u=c.replace(/([.+*?=^!${}()[\]|/\\])/g,"\\$1").replace(/\\\/:([A-Za-z0-9_]+)/g,(l,f)=>(d.push(f),"\\/([^\\/]+)"));return{pattern:c,regex:new RegExp("^"+u+"$"),keys:d}}function o(c){const d={};return new URLSearchParams(c||"").forEach((l,f)=>{d[f]===void 0?d[f]=l:Array.isArray(d[f])?d[f].push(l):d[f]=[d[f],l]}),d}function r(c){const d=[];for(const u of c)if(d.push({...u,_parent:null}),u.children&&u.children.length)for(const l of u.children)d.push({...l,_parent:u});return d.sort((u,l)=>l.path.length-u.path.length),d}function a(c,d){const u=e(c),l=r(d);for(const f of l){const m=f._compiled.regex.exec(u);if(!m)continue;const h={};return f._compiled.keys.forEach((w,T)=>{h[w]=decodeURIComponent(m[T+1])}),{route:f,params:h,parent:f._parent||null}}return null}function s(c,d,u=50){c.push({at:Date.now(),path:d.path,params:d.params,query:d.query,hash:d.hash}),c.length>u&&c.shift()}return{normalizePath:e,stripBase:t,compilePattern:n,parseQuery:o,flattenRoutes:r,matchRoute:a,pushHistoryEntry:s}})(),i._uiMetaShared=(()=>{function e(s){return{hasTabPanel:typeof s.TabPanel=="function",Card:typeof s.Card=="function"?s.Card:(...c)=>s.div({class:"cms-doc-card"},...c),Chip:typeof s.Chip=="function"?s.Chip:(c,d)=>s.span({class:"cms-chip cms-chip-fallback"},d)}}function t(s){return s?Array.isArray(s)?s.join(" | "):String(s):"\u2014"}function n(s,c,d){return s.div({class:"cms-doc-meta"},s.div({class:"cms-doc-meta-head"},s.div({class:"cms-doc-meta-name"},c.name),s.div({class:"cms-doc-meta-types"},...c.type?String(c.type).split("|").map(u=>d({color:"secondary",dense:!0,outline:!0},u)):[s.span("\u2014")])),s.div({class:"cms-doc-meta-grid"},s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Default"),s.div({class:"cms-doc-meta-value"},c.default==null?"\u2014":String(c.default))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Values"),s.div({class:"cms-doc-meta-value"},t(c.values)))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Description"),s.div({class:"cms-doc-meta-value"},c.description||"\u2014")))}function o(s,c){return s.div({class:"cms-doc-fallback"},c.map(d=>s.div({class:"cms-doc-fallback-item"},s.h4({class:"cms-doc-fallback-title"},d.label||d.name),d.content)))}function r(s,c){return c?Array.isArray(c)?c.map(d=>({name:d.name,wrap:!0,label:d.name,content:s.div({class:"cms-p-md"},d.description)})):Object.entries(c).map(([d,u])=>({name:d,wrap:!0,label:d,content:s.div({class:"cms-p-md"},u)})):[]}function a(s,c){return c?Array.isArray(c)?c.map(d=>({name:d.name,wrap:!0,label:d.type,content:d.description})):Object.entries(c).map(([d,u])=>({name:d,wrap:!0,label:d,content:s.div({class:"cms-doc-meta"},s.div({class:"cms-doc-meta-head"},s.div({class:"cms-doc-meta-name"},d)),s.div({class:"cms-doc-meta-grid"},s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Type"),s.div({class:"cms-doc-meta-value"},u.type||"\u2014"))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Description"),s.div({class:"cms-doc-meta-value"},u.description||"\u2014")))})):[]}return{resolveDocComponents:e,renderMetaItem:n,renderTabGroupFallback:o,normalizeEventRows:r,normalizeSlotRows:a}})(),i.ui=i.ui||{},i.ui.meta=i.ui.meta||{},i.ui.slot=function(t,n={}){const o=i.ui,{as:r="node",wrap:a="span",iconProps:s=null,filter:c=!0}=n,d=m=>document.createTextNode(String(m)),u=m=>_.span(String(m)),l=m=>{if(m==null||m===!1)return null;if(typeof m=="function")return m;if(Array.isArray(m))return m.flatMap(l).filter(Boolean);if(m&&typeof m=="object"&&m.nodeType)return m;if(typeof m=="string"||typeof m=="number"||typeof m=="boolean"){const h=String(m);return r==="icon"&&o.Icon?o.Icon(h,{class:"cms-slot-icon",...s||{}}):a==="text"?d(h):a==="span"?u(h):h}return a==="text"?d(m):a==="span"?u(m):String(m)},f=l(t);return c&&Array.isArray(f)?f.filter(Boolean):f},i.ui.slots=function(...t){const n=[];for(const o of t){const r=i.ui.slot(o);r&&(Array.isArray(r)?n.push(...r):n.push(r))}return n},i.docTable=e=>{var v;if(!i.isDev())return _.div();const{resolveDocComponents:t,renderMetaItem:n,renderTabGroupFallback:o,normalizeEventRows:r,normalizeSlotRows:a}=i._uiMetaShared,s=(v=i.ui.meta)==null?void 0:v[e];if(!s)return _.div({class:"cms-muted"},`Meta non trovata: ${e}`);const{hasTabPanel:c,Card:d,Chip:u}=t(_),l={};Object.entries(s.props||{}).forEach(([y,p])=>{const b=p.category||"general";l[b]||(l[b]=[]),l[b].push({name:y,...p})});const f=Object.keys(l).map(y=>{const p=l[y].map(b=>({name:b.name,wrap:!0,label:b.name,content:n(_,b,u)}));return{name:y,wrap:!0,label:y,content:c?_.TabPanel({orientation:"vertical",animated:!0,radius:"0 0 0 var(--cms-r-default)",tabs:p}):o(_,p)}}),m=r(_,s.events),h=a(_,s.slots),w=_.rod(null),T=[];h.length&&T.push({name:"Slots",wrap:!0,label:"Slots",content:c?_.TabPanel({animated:!0,radius:"0 0 0 var(--cms-r-default)",orientation:"vertical",tabs:h}):o(_,h)}),f.length&&T.push(...f),m.length&&T.push({name:"Events",wrap:!0,label:"Events",content:c?_.TabPanel({animated:!0,radius:"0 0 0 var(--cms-r-default)",orientation:"vertical",tabs:m}):o(_,m)});const C="general";return T.sort((y,p)=>y.name===C?-1:p.name===C?1:y.name.localeCompare(p.name)),d({class:"cms-doc-table"},_.div({class:"cms-doc-table-header"},_.div({class:"cms-doc-table-title"},`_.${e}`),s.signature?_.div({class:"cms-doc-table-signature"},String(s.signature).replaceAll("UI.","_.")):null),T.length?_.h4({class:"cms-doc-table-section-title"},f.length?"Props":"Documentation"):_.p({class:"cms-muted"},"Nessuna documentazione strutturata disponibile."),T.length?c?_.TabPanel({border:!0,animated:!0,orientation:"horizontal",tabs:T,model:w}):o(_,T):null,s.returns?_.p({class:"cms-muted",style:{marginTop:"14px"}},`Returns: ${s.returns}`):null)},i.ui.inspect=e=>{var t;return console.log(((t=i.ui.meta)==null?void 0:t[e])||"meta not found")},i.ui.can=function(e,t,n,o=null){var s,c;const r=i.useAuth?i.useAuth(e):i.auth;return r?(typeof t=="function"?!!t(r):((s=r.can)==null?void 0:s.call(r,t))||((c=r.hasRole)==null?void 0:c.call(r,t)))?typeof n=="function"?n():n:typeof o=="function"?o():o:typeof o=="function"?o():null},i.ui.canAny=function(e,t,n,o=null){var s;const r=i.useAuth?i.useAuth(e):i.auth;return!!((s=r==null?void 0:r.canAny)!=null&&s.call(r,t))?typeof n=="function"?n():n:typeof o=="function"?o():o},i.ui.canAll=function(e,t,n,o=null){var s;const r=i.useAuth?i.useAuth(e):i.auth;return!!((s=r==null?void 0:r.canAll)!=null&&s.call(r,t))?typeof n=="function"?n():n:typeof o=="function"?o():o},i.Can=function(t,n){var a,s;const o=i.useAuth?i.useAuth(n):i.auth;return(()=>{var c,d,u,l;return o?t.when&&typeof t.when=="function"?!!t.when(o):t.perm?!!((c=o.can)!=null&&c.call(o,t.perm)):t.role?!!((d=o.hasRole)!=null&&d.call(o,t.role)):t.any?!!((u=o.canAny)!=null&&u.call(o,t.any)):t.all?!!((l=o.canAll)!=null&&l.call(o,t.all)):!1:!1})()?typeof t.then=="function"?t.then():(a=t.then)!=null?a:null:typeof t.else=="function"?t.else():(s=t.else)!=null?s:null},i.router=(()=>{let e="history",t=[],n=null,o=null,r="",a=null,s=null,c=[],d=!1;const{normalizePath:u,stripBase:l,compilePattern:f,parseQuery:m,matchRoute:h,pushHistoryEntry:w}=i._routerShared,T={setOutlet:{description:"imposta il contenitore del router"},setBase:{description:"imposta il base path del router"},add:{description:"per aggiungere la route"},notFound:{description:"imposta la view 404"},beforeEach:{description:"hook prima di ogni navigazione"},start:{description:"avvia il router"},navigate:{description:"naviga verso una route"},subscribe:{description:"sottoscrive agli aggiornamenti di route"},current:{description:"ritorna l'URL corrente"},isActive:{description:"verifica se una route e\u0300 attiva"},status:{description:"stringa di stato router"},inspect:{description:"stampa info diagnostiche"},trace:{description:"abilita/disabilita tracing"},history:{description:"ritorna la history interna"},setURLOnly:{description:"aggiorna solo l'URL del browser senza render/meta"}};function C(E,{replace:x=!1}={}){const O=typeof E=="string"?new URL(E,window.location.origin):E,B=O.pathname+O.search+O.hash;if(e==="hash"||e==="auto"){if(history.pushState){const W="#"+B;x?history.replaceState({},"",W):history.pushState({},"",W);return}const q="#"+B;x?window.location.replace(q):window.location.hash=q;return}x?history.replaceState({},"",r+B):history.pushState({},"",r+B)}function v(){if(e==="hash"){const E=window.location.hash||"#/",x=E.startsWith("#")?E.slice(1):E;return new URL(x,window.location.origin)}if(e==="auto"&&window.location.hash.startsWith("#/")){const E=window.location.hash.slice(1);return new URL(E,window.location.origin)}return new URL(window.location.href)}function y(E,x=!1){if(e==="hash"||e==="auto"&&!history.pushState){const O="#"+(E.pathname+E.search+E.hash);x?window.location.replace(O):window.location.hash=O;return}x?history.replaceState({},"",r+E.pathname+E.search+E.hash):history.pushState({},"",r+E.pathname+E.search+E.hash)}function p(E){e=E||"history"}function b(E){return l(E,r)}function k(E){if(!E)return!1;const x=s?s.path:b(v().pathname);let O=E;typeof O=="string"&&(O.includes("?")||O.includes("#")||O.includes("://"))&&(O=new URL(O,window.location.origin).pathname);const B=b(O);return B.includes(":")?f(B).regex.test(x):B===x}async function A(E,{replace:x=!1}={}){if(!n){console.warn("[router] outlet non impostato. Usa JSswift.router.setOutlet('#app').");return}const O=typeof E=="string"?new URL(E,window.location.origin):E;d&&console.log("[router.navigate]",O.toString());const B=O.pathname+O.search+O.hash;y(O,x);const q=b(O.pathname),W=h(q,t),U={path:q,fullPath:B,params:W?W.params:{},query:m(O.search),hash:O.hash||"",navigate:L,outlet:n};if(a){const H=await a(U);if(H===!1)return;if(typeof H=="string"){L(H,{replace:!0});return}}if(typeof o=="function"){try{o()}catch(H){console.error("[router] unmount error:",H)}o=null}if(!W){const H=t._notFound;H?o=i.mount(n,()=>H(U),{clear:!0}):o=i.mount(n,_.div("404"),{clear:!0}),S(U),s=U,w(c,U);return}const Q=W.route.view,Z=W.parent;let ee=null;if(U.renderChild=H=>{if(!U._child)return null;const ne=typeof H=="string"?U.outlet.querySelector(H):H;return ne?(ee=i.mount(ne,()=>U._child.view(U._child.ctx),{clear:!0}),ee):(console.warn("[router] child outlet non trovato:",H),null)},Z){const H=W.route,ne={...U,params:{...U.params}};U._child={view:H.view,ctx:ne},o=i.mount(n,()=>Z.view(U),{clear:!0})}else U._child=null,o=i.mount(n,()=>Q(U),{clear:!0});S(U),s=U,w(c,U)}function L(E,x={}){const O=new URL(E,window.location.origin);A(O,x)}function D(){window.addEventListener("popstate",()=>{A(v(),{replace:!0})}),window.addEventListener("hashchange",()=>{(e==="hash"||e==="auto")&&A(v(),{replace:!0})}),document.addEventListener("click",E=>{var U,Q;const x=(Q=(U=E.target)==null?void 0:U.closest)==null?void 0:Q.call(U,"a");if(!x||E.defaultPrevented||E.button!==0||E.metaKey||E.ctrlKey||E.shiftKey||E.altKey||x.hasAttribute("download")||x.target&&x.target!=="_self")return;const O=x.getAttribute("href");if(!O||O.startsWith("mailto:")||O.startsWith("tel:"))return;const B=new URL(O,window.location.origin);if(B.origin!==window.location.origin)return;const q=new URL(window.location.href);B.pathname+B.search===q.pathname+q.search&&B.hash||(E.preventDefault(),L(B.pathname+B.search+B.hash))}),A(v(),{replace:!0})}function j(E){return n=typeof E=="string"?i.dom.q(E):E,n}function R(E){r=E?u(E):"",r==="/"&&(r="")}function P(E,x,O=null){const B=f(E),q={path:B.pattern,view:x,_compiled:B,children:[]};if(Array.isArray(O))for(const W of O){const[U,Q,Z]=W,ee=u(B.pattern+"/"+(U||"").replace(/^\//,""));q.children.push({path:ee,view:Q,_compiled:f(ee),children:Array.isArray(Z)?Z:[]})}t.push(q)}function M(E){t._notFound=E}function F(E){a=E}let g=new Set;function S(E){for(const x of g)try{x(E)}catch(O){console.error("[router] listener error:",O)}}function z(){if(!s)return"ROUTER \u23F3 not ready";const E=Object.keys(s.query||{}).length?"?":"";return`ROUTER ${s.path}${E} ${s.hash||""}`}function I(E="router"){if(!s)return console.warn("[router.inspect] nessuna route attiva"),null;const x={label:E,mode:typeof e!="undefined"?e:"unknown",base:r,path:s.path,params:s.params,query:s.query,hash:s.hash,outlet:n,timestamp:new Date().toISOString()};return console.groupCollapsed(`[JSswift.router.inspect] ${E}`),console.log(x),console.log("history:",c.slice()),console.groupEnd(),x}function J(E=!0){d=!!E,console.log("[JSswift.router.trace]",d?"ON":"OFF")}function N(){return c.slice()}return{meta:T,setOutlet:j,setBase:R,add:P,setURLOnly:C,notFound:M,beforeEach:F,start:D,navigate:L,isActive:k,subscribe(E){return g.add(E),()=>g.delete(E)},current(){return v?v():new URL(window.location.href)},status:z,inspect:I,trace:J,history:N}})(),($e=i.config)!=null&&$e.debug&&(window.$router=i.router),i.signal=i.reactive.signal,i.effect=i.reactive.effect,i.computed=i.reactive.computed,i.untracked=i.reactive.untracked,i.batch=i.reactive.batch;function se(e){return e==null?null:String(e).trim()||null}function ye(e){const t=Array.isArray(e)?e:typeof e=="string"?e.split(","):[],n=[],o=new Set;for(const r of t){const a=se(r);!a||o.has(a)||(o.add(a),n.push(a))}return n}function ge(){var e;return typeof document!="undefined"&&document.documentElement?document.documentElement:(e=i.dom)!=null&&e.q?i.dom.q("html"):null}function De(){try{return typeof globalThis!="undefined"&&globalThis.localStorage||null}catch(e){return null}}function fe(){var e;return se((e=i.theme)==null?void 0:e.storageKey)||"jsswift:theme"}function Oe(){const e=De();if(!e)return null;try{return se(e.getItem(fe()))}catch(t){return null}}function gt(e){const t=De();if(t)try{e==null?t.removeItem(fe()):t.setItem(fe(),e)}catch(n){}}function ze(e){var o,r,a,s,c;const t=ge(),n=[e,(o=i.theme)==null?void 0:o.themes,(r=i.config)==null?void 0:r.themes,typeof globalThis!="undefined"?(a=globalThis.JSswift_setting)==null?void 0:a.themes:null,typeof globalThis!="undefined"?(s=globalThis.JSswift_setting)==null?void 0:s.themeList:null,(c=t==null?void 0:t.getAttribute)==null?void 0:c.call(t,"data-themes")];for(const d of n){const u=ye(d);if(u.length)return u}return[]}i.theme=i.theme||{},i.theme.storageKey=fe(),ye(i.theme.themes).length||(i.theme.themes=ze()),i.setTheme=function(e,t={}){const n=se(e),o=ge();return o&&(n==null?o.removeAttribute("data-theme"):o.setAttribute("data-theme",n)),t.persist!==!1&&gt(n),o},i.getTheme=function(e={}){var r;const t=ge(),n=se((r=t==null?void 0:t.getAttribute)==null?void 0:r.call(t,"data-theme"));if(n)return n;if(e.storage===!1)return null;const o=Oe();return o&&t&&e.sync!==!1&&t.setAttribute("data-theme",o),o},i.toggleTheme=function(e,t={}){const n=ze(e),o=n.length?n:ye([i.getTheme({sync:!1}),"light","dark"]),r=i.getTheme({sync:!1}),a=se(t.fallback)||o[0]||"light",s=r?o.indexOf(r):-1,c=s>=0?o[(s+1)%o.length]:a;return i.theme.themes=o.slice(),i.setTheme(c,t),c};const Je=Oe();Je&&i.setTheme(Je,{persist:!1})})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsswift/core",
3
- "version": "1.0.49",
3
+ "version": "1.0.51",
4
4
  "description": "JSswift core runtime: renderer, reactive, rod, lifecycle and platform modules",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/10-overlay.js CHANGED
@@ -93,7 +93,10 @@
93
93
 
94
94
  // scroll lock + focus
95
95
  if (opts.lockScroll) lockScroll();
96
- if (opts.autoFocus !== false) setTimeout(() => focusFirst(panel), 0);
96
+ if (opts.autoFocus !== false) setTimeout(() => {
97
+ // Respect focus deliberately assigned by an onOpen callback.
98
+ if (panel.isConnected && stack.get(id) === entry && !panel.contains(document.activeElement)) focusFirst(panel);
99
+ }, 0);
97
100
 
98
101
  // positioning (for menus/tooltips)
99
102
  const position = (nextOpts = null) => {