jsswift 2.0.1 → 2.1.1

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.
Files changed (44) hide show
  1. package/AI.md +30 -3
  2. package/README.md +2 -0
  3. package/dist/build/build-configured-runtime.d.mts +29 -0
  4. package/dist/build/build-configured-runtime.mjs +92 -0
  5. package/dist/build/runtime-layout.mjs +13 -0
  6. package/dist/build/select-ui.mjs +167 -0
  7. package/dist/build/vite-jss.d.mts +2 -0
  8. package/dist/build/vite-jss.mjs +73 -0
  9. package/dist/cms.js +3522 -0
  10. package/dist/css/min-ui.css +1 -1
  11. package/dist/css/ui-components.css +13 -0
  12. package/dist/css/ui-light.css +13 -0
  13. package/dist/css/ui-light.min.css +1 -1
  14. package/dist/css/ui.css +13 -0
  15. package/dist/css/ui.min.css +1 -1
  16. package/dist/documentions/AI.md +30 -3
  17. package/dist/documentions/README.md +1 -0
  18. package/dist/documentions/components/table.md +3 -0
  19. package/dist/documentions/configured-runtime.md +82 -0
  20. package/dist/documentions/examples/crud.md +9 -5
  21. package/dist/documentions/knowledge-map.json +20 -1
  22. package/dist/jsswift.js +2 -2
  23. package/dist/jsswift.min.js +1 -1
  24. package/dist/min-jsswift.js +1 -1
  25. package/dist/ui-src/00-bootstrap.js +330 -0
  26. package/dist/ui-src/01-foundation-helpers.js +809 -0
  27. package/dist/ui-src/10-primitives-layout.js +5091 -0
  28. package/dist/ui-src/20-display-content.js +780 -0
  29. package/dist/ui-src/21-list-content.js +246 -0
  30. package/dist/ui-src/22-banner-content.js +376 -0
  31. package/dist/ui-src/23-tooltip.js +276 -0
  32. package/dist/ui-src/31-form-advanced.js +2784 -0
  33. package/dist/ui-src/40-navigation.js +1262 -0
  34. package/dist/ui-src/41-tab-panel.js +896 -0
  35. package/dist/ui-src/50-feedback.js +999 -0
  36. package/dist/ui-src/51-feedback-service.js +166 -0
  37. package/dist/ui-src/60-shell-app.js +1223 -0
  38. package/dist/ui-src/61-form-service.js +368 -0
  39. package/dist/ui-src/70-dialog.js +333 -0
  40. package/dist/ui-src/71-menu-overlays.js +1217 -0
  41. package/dist/ui-src/80-data.js +437 -0
  42. package/dist/ui-src/modules.json +212 -0
  43. package/dist/ui.js +12565 -0
  44. package/package.json +26 -2
@@ -31,4 +31,4 @@ background: var(--jss-primary);
31
31
  transition: width 200ms ease;
32
32
  `,l.appendChild(n);const i=document.createElement("div");i.style.cssText="display:flex; gap: 12px; align-items:center; width: 100%;",i.appendChild(t),i.appendChild(s),e.appendChild(i),e.appendChild(l),hn.appendChild(e),document.body.appendChild(hn);const c=document.createElement("style");return c.textContent=`
33
33
  @keyframes jssSpin { to { transform: rotate(360deg); } }
34
- `,document.head.appendChild(c),hn._textNode=s,hn._spinner=t,hn._progressWrap=l,hn._progressBar=n,hn._progressActive=!1,hn}function uo(e,t){if(typeof e=="object"&&e!==null)return{...e};const s=t&&typeof t=="object"?t:{};return typeof t=="string"&&(e==null||typeof e=="number")?{...s,message:t}:{...s,message:e}}function fo(e,t){const s=t==="progress";e._spinner.style.display=s?"none":"",e._progressWrap.style.display=s?"block":"none",e._mode=t}wt.loading.show=function(e="Loading...",t={}){const s=co(),l=uo(e,t);Hs++,s._progressActive=!1,s._textNode.textContent=l.message||"Loading...",fo(s,"spinner"),l.spinner===!1&&(s._spinner.style.display="none"),s.style.display="flex"},wt.loading.hide=function(){hn&&(Hs=Math.max(0,Hs-1),Hs===0&&(hn.style.display="none",hn._progressActive=!1))},wt.loading.progress=function(e=0,t={}){var s;const l=co();typeof e=="object"&&e!==null&&(t=e,e=(s=e.value)!=null?s:0);const n=uo(null,t);l._progressActive||(Hs++,l._progressActive=!0);const i=Math.max(0,Math.min(100,Number(e!=null?e:0)));l._textNode.textContent=n.message||"Loading...",l._progressBar.style.width=i+"%",fo(l,"progress"),l.style.display="flex"},wt.loading.wrap=async function(e,t){wt.loading.show(e);try{return await t()}finally{wt.loading.hide()}};function Wo(e){return typeof e=="function"?e():e||[]}function Fl(e,t){if(!(e==null||t==null))return typeof t!="string"||t.indexOf(".")<0?e==null?void 0:e[t]:t.split(".").reduce((s,l)=>s==null?s:s[l],e)}function Uo(e,t){return e==null&&t==null?0:e==null?-1:t==null?1:typeof e=="number"&&typeof t=="number"?e-t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:"base"})}function Go(e){const t=Wo(e);return Array.isArray(t)?t:[]}function po(e){var t,s,l,n;return(n=(l=(s=(t=e==null?void 0:e.label)!=null?t:e==null?void 0:e.title)!=null?s:e==null?void 0:e.header)!=null?l:e==null?void 0:e.key)!=null?n:""}function Dl(e,t){var s,l;return(l=(s=e==null?void 0:e.sortKey)!=null?s:e==null?void 0:e.key)!=null?l:`__col_${t}`}function ho(e,t){return e.find((s,l)=>Dl(s,l)===t||(s==null?void 0:s.key)===t)||null}function yl(e,t,s){return e?typeof e.get=="function"?e.get(t,{row:t,rowIndex:s,col:e}):typeof e.value=="function"?e.value(t,{row:t,rowIndex:s,col:e}):typeof e.key=="string"?Fl(t,e.key):e.key!=null?t==null?void 0:t[e.key]:t:t}function bl(e,t){return typeof e=="function"?e(t)||{}:e||{}}function vl(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(vl).filter(Boolean).join(" ");if(typeof Node!="undefined"&&e instanceof Node)return e.textContent||"";if(typeof e=="object"){if(typeof e.textContent=="string")return e.textContent;try{return JSON.stringify(e)}catch(t){return""}}return String(e)}function Ko(e,t){const l=(Array.isArray(e)?e:t).map(n=>Number(n)).filter(n=>Number.isFinite(n)&&n>0);return l.length?Array.from(new Set(l)):t}function qo(e,t,s,l){const n=l.searchBy||l.searchPredicate;if(typeof n=="function")return!!n(e,{query:s,columns:t});const i=String(s||"").trim().toLowerCase().split(/\s+/).filter(Boolean);if(!i.length)return!0;const c=Array.isArray(l.searchKeys)&&l.searchKeys.length?l.searchKeys:t.filter(r=>(r==null?void 0:r.searchable)!==!1).map(r=>{var z;return(z=r==null?void 0:r.searchKey)!=null?z:r==null?void 0:r.key}).filter(Boolean),a=[];if(c.length)for(const r of c)if(typeof r=="function")a.push(vl(r(e)));else{const z=t.find(d=>(d==null?void 0:d.key)===r||(d==null?void 0:d.searchKey)===r);a.push(vl(z?yl(z,e,-1):Fl(e,r)))}else a.push(vl(e));const v=a.join(" ").toLowerCase();return i.every(r=>v.includes(r))}xe.Table=(...e)=>{var t,s,l,n;const{props:i,children:c}=JSswift.uiNormalizeArgs(e),a=i.slots||{},v=Array.isArray(i.columns)?i.columns:[],r=Ko(i.pageSizeOptions,[5,10,20,50]),z=Number((s=(t=i.pageSize)!=null?t:r[0])!=null?s:10)||10,d=Array.from(new Set([...r,z])).sort((Re,C)=>Re-C),k=i.initialSort||(i.sortBy?{key:i.sortBy,dir:i.sortDir==="desc"?"desc":"asc"}:null),N=i.searchable===!0||typeof i.searchable=="string"||i.searchPlaceholder!=null||i.search!=null||i.query!=null||!!i.searchModel||!!i.queryModel||Array.isArray(i.searchKeys)||typeof i.searchBy=="function"||typeof i.searchPredicate=="function",p=en(i.searchModel||i.queryModel,"UI.Table:query"),[U,w]=wt.reactive.signal(Math.max(1,Number(i.page||1)||1)),[$,B]=wt.reactive.signal(z),[te,E]=wt.reactive.signal(k),[ve,le]=wt.reactive.signal(String((n=p?p.get():(l=i.search)!=null?l:i.query)!=null?n:"")),ie=Re=>{const C=String(Re!=null?Re:"");le(C),p&&p.set(C),w(1)},ge=Re=>{const C=Number(Re)||z;B(C),w(1)},ue=(Re,C)=>{const Se=Dl(Re,C),Fe=te();!Fe||Fe.key!==Se&&Fe.key!==(Re==null?void 0:Re.key)?E({key:Se,dir:"asc"}):Fe.dir==="asc"?E({key:Se,dir:"desc"}):E(null),w(1)};let fe=null,M;p&&(M=p.watch(Re=>{const C=String(Re!=null?Re:"");le(C),fe&&fe.value!==C&&(fe.value=C),w(1)},"UI.Table:queryWatch"));const me=JSswift.omit(i,["columns","rows","rowKey","loading","page","pageSize","pageSizeOptions","pagination","initialSort","sortBy","sortDir","search","query","searchable","searchPlaceholder","searchKeys","searchBy","searchPredicate","searchModel","queryModel","filter","actions","actionsLabel","emptyText","loadingText","onRowClick","onRowDblClick","tableClass","tableStyle","cardClass","dense","striped","hover","stickyHeader","toolbar","toolbarStart","toolbarEnd","caption","footer","status","rowClass","rowAttrs","minTableWidth","hideHeader","hideFooter","hideStatus","slots","body"]);me.class=re(["jss-table-card",i.class,i.cardClass]),i.dense!=null&&(me.dense=i.dense);const be=_.div({class:"jss-table-shell"}),de=D(a,"default",{},c);de.length&&be.appendChild(_.div({class:"jss-table-lead"},...de));const Z=D(a,"toolbarStart",{},i.toolbarStart),j=D(a,"toolbar",{},i.toolbar),I=D(a,"toolbarEnd",{},i.toolbarEnd),y=_.div({class:"jss-table-toolbar"}),P=_.div({class:"jss-table-toolbar-main"}),Q=_.div({class:"jss-table-toolbar-side"});Z.forEach(Re=>P.appendChild(Re)),j.forEach(Re=>P.appendChild(Re));const m=D(a,"search",{query:ve(),getQuery:ve,setQuery:ie},null);if(m.length)m.forEach(Re=>Q.appendChild(Re));else if(N){fe=_.input({type:"search",class:"jss-input",placeholder:typeof i.searchable=="string"?i.searchable:i.searchPlaceholder||"Cerca nella tabella",value:String(ve()||"")}),fe.addEventListener("input",()=>ie(fe.value));const Re=xe.Btn({class:"jss-table-search-clear",outline:!0,onClick:()=>{fe&&(fe.value=""),ie("")}},"Reset");Q.appendChild(_.div({class:"jss-singularity jss-table-search"},_.span({class:"jss-table-search-icon","aria-hidden":"true"},"\u2315"),fe,Re))}I.forEach(Re=>Q.appendChild(Re)),(P.childNodes.length||Q.childNodes.length)&&(y.appendChild(P),y.appendChild(Q),be.appendChild(y));const b=_.div({class:"jss-singularity jss-table-chip"},""),g=_.div({class:"jss-singularity jss-table-chip"},""),T=_.div({class:"jss-singularity jss-table-chip"},""),Y=D(a,"status",{},i.status),K=_.div({class:"jss-table-status"},b,g,T,...Y);i.hideStatus!==!0&&be.appendChild(K);const _e=D(a,"caption",{},i.caption);_e.length&&be.appendChild(_.div({class:"jss-table-caption"},..._e));const J=_.thead(),A=_.tbody(),L=!!i.actions||!!a.actions,O=re(["jss-table",pe(i.dense,"dense"),pe(i.striped,"striped"),pe(i.hover!==!1,"hover"),pe(i.stickyHeader!==!1,"sticky-head"),i.tableClass]),X={...i.tableStyle||{}};i.minTableWidth!=null&&(X["--jss-table-min-width"]=vt(i.minTableWidth));const we=_.table({class:O,style:X},J,A),Be=_.div({class:"jss-singularity jss-table-wrap"},we);be.appendChild(Be);const Ue=_.div({class:"jss-singularity jss-table-chip"},""),H=_.div({class:"jss-singularity jss-table-chip"},""),W=xe.Btn({outline:!0,onClick:()=>w(Math.max(1,U()-1))},"\u2039"),ee=xe.Btn({outline:!0,onClick:()=>w(U()+1)},"\u203A"),Ne=_.div({class:"jss-singularity jss-table-chip"},""),Te=_.select({class:"jss-input jss-table-size-select"},...d.map(Re=>Vs({value:String(Re)},String(Re))));Te.value=String($()),Te.addEventListener("change",()=>ge(Te.value));const oe=D(a,"footer",{},i.footer),Pe=_.div({class:"jss-table-foot"},_.div({class:"jss-table-foot-main"},Ue,H,_.label({class:"jss-table-size"},_.span("Righe"),Te)),_.div({class:"jss-table-foot-extra"},...oe,_.div({class:"jss-table-pager"},W,Ne,ee)));i.hideFooter!==!0&&be.appendChild(Pe);const Ie=()=>{if(J.innerHTML="",i.hideHeader)return;const Re=_.tr();if(v.forEach((C,Se)=>{var Fe,F;const f={col:C,colIndex:Se,sort:te()},h={...bl(C==null?void 0:C.style,{...f,header:!0}),...bl((Fe=C==null?void 0:C.headerStyle)!=null?Fe:C==null?void 0:C.thStyle,{...f,header:!0})};(C==null?void 0:C.width)!=null&&(h.width=vt(C.width)),(C==null?void 0:C.minWidth)!=null&&(h.minWidth=vt(C.minWidth)),(C==null?void 0:C.maxWidth)!=null&&(h.maxWidth=vt(C.maxWidth)),C!=null&&C.align&&(h.textAlign=C.align);let x=D(C==null?void 0:C.slots,"header",f,null);if(!x.length){const We=typeof(C==null?void 0:C.header)=="function"?C.header(f):(F=C==null?void 0:C.header)!=null?F:po(C);x=D(a,"header",f,We)}const ae=te(),Oe=Dl(C,Se),De=(C==null?void 0:C.sortable)!==!1&&((C==null?void 0:C.key)!=null||typeof(C==null?void 0:C.get)=="function"||typeof(C==null?void 0:C.compare)=="function"),Ge=!!ae&&(ae.key===Oe||ae.key===(C==null?void 0:C.key)),Ke=_.th({class:re(["jss-table-head-cell",pe(C==null?void 0:C.nowrap,"is-nowrap"),pe(De,"jss-table-sortable"),pe(Ge,"is-sorted"),C==null?void 0:C.headerClass]),style:h});De?Ke.appendChild(_.button({type:"button",class:"jss-table-head-button",onClick:()=>ue(C,Se)},_.span({class:"jss-table-head-label"},...x),_.span({class:"jss-table-head-arrow","aria-hidden":"true"},Ge?ae.dir==="asc"?"\u2191":"\u2193":"\u2195"))):x.forEach(We=>Ke.appendChild(We)),Re.appendChild(Ke)}),L){const C=D(a,"actionsHeader",{},i.actionsLabel||"Azioni");Re.appendChild(_.th({class:"jss-table-head-cell jss-table-head-actions",style:{textAlign:"right"}},...C))}J.appendChild(Re)},Le=(Re,C)=>{const Se={columns:v,count:v.length},Fe=D(a,Re,Se,C),F=String(v.length+(L?1:0));A.appendChild(_.tr(_.td({colSpan:F,class:"jss-table-state"},...Fe)))},Ye=wt.reactive.effect(()=>{const Re=Go(i.rows),C=String(ve()||"").trim(),Se=te(),Fe=typeof i.loading=="function"?!!i.loading():!!i.loading,F=i.pagination!==!1;if(Ie(),A.innerHTML="",fe&&fe.value!==ve()&&(fe.value=ve()),Te.value!==String($())&&(Te.value=String($())),Fe){b.textContent="Caricamento in corso",g.style.display="none",T.style.display="none",Ue.textContent="Loading\u2026",H.textContent="",Ne.textContent="Pagina 1",W.disabled=!0,ee.disabled=!0,Le("loading",i.loadingText||"Loading...");return}let f=Re.slice();const h=f.length;if(typeof i.filter=="function"&&(f=f.filter((et,tt)=>i.filter(et,{row:et,index:tt,query:C,rows:Re,columns:v}))),C&&(f=f.filter(et=>qo(et,v,C,i))),Se){const et=ho(v,Se.key);et&&f.sort((tt,dt)=>{const gt=yl(et,tt,-1),At=yl(et,dt,-1),It=typeof et.compare=="function"?et.compare(gt,At,tt,dt):Uo(gt,At);return Se.dir==="asc"?It:-It})}const x=f.length,ae=Math.max(1,Number($())||z),Oe=F?Math.max(1,Math.ceil(x/ae)):1,De=F?Math.min(U(),Oe):1;De!==U()&&w(De);const Ge=F?(De-1)*ae:0,Ke=F?Ge+ae:x,We=f.slice(Ge,Ke);if(b.textContent=x===h?`${x} righe`:`${x} di ${h} righe`,g.textContent=C?`Ricerca: ${C}`:"",g.style.display=C?"":"none",Se){const et=ho(v,Se.key);T.textContent=et?`Ordine: ${po(et)} ${Se.dir==="asc"?"\u2191":"\u2193"}`:"",T.style.display=et?"":"none"}else T.style.display="none";if(Ue.textContent=x?`${Ge+1}-${Math.min(Ke,x)} di ${x}`:"0 risultati",H.textContent=x!==h?`Dataset totale ${h}`:`Page size ${ae}`,Ne.textContent=F?`Pagina ${De} / ${Oe}`:"Tutte le righe",W.disabled=!F||De<=1,ee.disabled=!F||De>=Oe,Te.disabled=!F,Te.parentNode.style.display=F?"":"none",We.length===0){Le("empty",i.emptyText||"Nessun dato");return}for(let et=0;et<We.length;et++){const tt=We[et],dt=Ge+et,gt={row:tt,rowIndex:dt,pageIndex:et},At=typeof i.rowAttrs=="function"?i.rowAttrs(tt,gt)||{}:i.rowAttrs||{},It=typeof i.rowClass=="function"?i.rowClass(tt,gt):i.rowClass,$t=!!(i.onRowClick||i.onRowDblClick),zt=_.tr({...At,class:re(["jss-table-row",It,At.class,pe($t,"is-clickable")])});if(i.rowKey){const mt=typeof i.rowKey=="function"?i.rowKey(tt,gt):Fl(tt,i.rowKey);mt!=null&&(zt.dataset.key=String(mt))}const Xe=mt=>{const Nt=mt==null?void 0:mt.target;return!!(Nt&&Nt.closest&&Nt.closest("button, a, input, select, textarea, label, [data-table-action]"))};if(i.onRowClick&&zt.addEventListener("click",mt=>{Xe(mt)||i.onRowClick(tt,gt,mt)}),i.onRowDblClick&&zt.addEventListener("dblclick",mt=>{Xe(mt)||i.onRowDblClick(tt,gt,mt)}),v.forEach((mt,Nt)=>{var Zt,rn;const qt=yl(mt,tt,dt),Yt={...gt,col:mt,colIndex:Nt,value:qt},cn={...bl(mt==null?void 0:mt.style,Yt),...bl((Zt=mt==null?void 0:mt.cellStyle)!=null?Zt:mt==null?void 0:mt.tdStyle,Yt)};mt!=null&&mt.align&&(cn.textAlign=mt.align),(mt==null?void 0:mt.width)!=null&&(cn.width=vt(mt.width)),(mt==null?void 0:mt.minWidth)!=null&&(cn.minWidth=vt(mt.minWidth)),(mt==null?void 0:mt.maxWidth)!=null&&(cn.maxWidth=vt(mt.maxWidth));const Xt=typeof(mt==null?void 0:mt.cellClass)=="function"?mt.cellClass(tt,Yt):(mt==null?void 0:mt.cellClass)||(mt==null?void 0:mt.class),Ut=_.td({class:re(["jss-table-cell",Xt,pe(mt==null?void 0:mt.nowrap,"is-nowrap")]),style:cn});let tn=D(mt==null?void 0:mt.slots,"cell",Yt,null);if(!tn.length){const ln=typeof(mt==null?void 0:mt.render)=="function"?mt.render(tt,Yt):typeof(mt==null?void 0:mt.format)=="function"?mt.format(qt,tt,Yt):qt,Xn=ln==null?(rn=mt==null?void 0:mt.emptyText)!=null?rn:"":ln;tn=D(a,"cell",Yt,Xn)}tn.length||(tn=[""]),tn.forEach(ln=>Ut.appendChild(ln)),zt.appendChild(Ut)}),L){const mt={...gt},Nt=typeof i.actions=="function"?i.actions(tt,gt):i.actions;let Zt=D(a,"actions",mt,Nt);Zt.length||(Zt=D(null,"default",mt,Nt)),zt.appendChild(_.td({class:"jss-table-cell jss-table-cell-actions",style:{textAlign:"right"}},_.div({class:"jss-table-actions"},...Zt)))}A.appendChild(zt)}},"UI.Table:render");me.body=be;const ct=xe.Card(me);return JSswift._registerCleanup(ct,Ye),M&&JSswift._registerCleanup(ct,M),ct},xe.Menu=(...e)=>{const{props:t,children:s}=JSswift.uiNormalizeArgs(e),l=t.slots||{},n=["primary","secondary","warning","danger","success","info","light","dark"],i=["xs","sm","md","lg","xl"];let c={...t},a=null,v=null,r=null,z=null,d=null;const k=(A,L)=>Object.prototype.hasOwnProperty.call(A||{},L),N=(A,L)=>typeof A=="function"?A(L):A,p=A=>String(A||"").split(/\s+/).filter(Boolean),U=A=>A&&typeof A=="object"&&!A.nodeType&&!Array.isArray(A)&&!(A instanceof Function),w=A=>!!A&&typeof A=="object"&&(A.nodeType===1||typeof A.getBoundingClientRect=="function"),$=()=>{clearTimeout(z),clearTimeout(d),z=null,d=null},B=(A,L,O)=>{if(!A)return;const X=A[L]||[];X.length&&A.classList.remove(...X);const we=(O||[]).filter(Boolean);we.length&&A.classList.add(...we),A[L]=we},te=(A,L,O,X=we=>we)=>{if(A){if(O==null||O===""){A.style.removeProperty(L);return}A.style.setProperty(L,X(O))}},E=()=>c||{},ve=A=>{var L;const O=String(o((L=A.state)!=null?L:A.color)||"").toLowerCase();return n.includes(O)?O:""},le=A=>{const L=String(o(A.size)||"").toLowerCase();return i.includes(L)?L:""},ie=A=>{var L,O;return String(o((O=(L=A.placement)!=null?L:A.position)!=null?O:"bottom-start"))},ge=()=>{var A;const L=o((A=E().delay)!=null?A:E().showDelay),O=Number(L);return Number.isFinite(O)?Math.max(0,O):0},ue=()=>{const A=o(E().hideDelay),L=Number(A);return Number.isFinite(L)?Math.max(0,L):80},fe=(A=null)=>{var L,O,X;if(A)return A;const we=E();return v||o((X=(O=(L=we.anchorEl)!=null?L:we.triggerEl)!=null?O:we.target)!=null?X:we.anchor)||null},M=A=>{if(A==null||A===!0)return new Set(["click"]);if(A===!1)return new Set(["manual"]);const L=Array.isArray(A)?A:String(A).split(/[\s,|/]+/),O=new Set;return L.forEach(X=>{const we=String(X||"").trim().toLowerCase();we&&(we==="mouseenter"||we==="mouseover"?O.add("hover"):we==="blur"||we==="focusin"?O.add("focus"):we==="tap"?O.add("click"):O.add(we))}),O.size?O:new Set(["manual"])},me=(A,L)=>{var O,X,we;let Be=null,Ue=null;if(w(A))Be=A,U(L)&&(Ue=L);else if(U(A)){Ue=A;const H=(we=(X=(O=A.anchorEl)!=null?O:A.triggerEl)!=null?X:A.target)!=null?we:A.anchor;w(H)&&(Be=H)}else A!=null&&(Be=A);return{anchorEl:Be,nextProps:Ue}},be=(A=a==null?void 0:a.panel)=>{var L;return Array.from(((L=A==null?void 0:A.querySelectorAll)==null?void 0:L.call(A,"[data-menu-item]:not([disabled]):not([tabindex='-1']), .jss-menu-item:not([disabled]):not([tabindex='-1']), [role='menuitem']:not([disabled]):not([tabindex='-1']), a[href]:not([tabindex='-1']), button:not([disabled]):not([tabindex='-1'])"))||[]).filter(O=>O.offsetParent!==null&&O.getAttribute("aria-hidden")!=="true")},de=()=>{o(E().autoFocus)!==!1&&setTimeout(()=>{const A=be();if(!A.length)return;(A.find(O=>O.classList.contains("is-active")||O.classList.contains("is-selected")||O.classList.contains("is-checked"))||A[0]).focus()},0)},Z=(A,L,O="sm")=>{const X=N(A,L);return X==null?[]:typeof X=="string"?[xe.Icon({name:X,size:O})]:Bs(X,{...L,as:"icon"})},j=(A,L)=>{var O,X,we,Be,Ue,H,W,ee,Ne,Te,oe,Pe,Ie;const Le=N(A,L);if(Le==null||Le===!1)return[];if(Array.isArray(Le))return Le.flatMap((zt,Xe)=>j(zt,{...L,index:Xe}));if(typeof Le=="function")return j(Le(L),L);if(Le!=null&&Le.nodeType)return[Le];if(typeof Le=="string"||typeof Le=="number")return j({label:Le},L);if(!U(Le))return Bs(Le,{...L,as:"item"});const Ye=String((X=(O=Le.type)!=null?O:Le.kind)!=null?X:"").toLowerCase();if(Ye==="separator"||Ye==="divider"||Le.separator===!0||Le.divider===!0)return[_.div({class:"jss-menu-divider",role:"separator"})];const ct=(we=Le.items)!=null?we:Le.children;if((Ye==="group"||Ye==="section"||Array.isArray(ct))&&ct!=null){const zt={...L,item:Le},Xe=D(l,"groupLabel",zt,N((Be=Le.label)!=null?Be:Le.title,zt)),mt=j(ct,zt);return mt.length?[_.div({class:re(["jss-menu-group",Le.class])},Xe.length?_.div({class:"jss-menu-group-label"},...Xe):null,_.div({class:"jss-menu-group-items"},...mt))]:[]}const Re={...L,item:Le,close:Q,dismiss:Q,open:b,toggle:Y,update:m,isOpen:K,entry:()=>a,anchorEl:fe(),props:E()},C=!!o(Le.disabled),Se=Le.checked==null?null:!!o(Le.checked),Fe=!!o((Ue=Le.active)!=null?Ue:Le.selected),F=ve(Le),f=o(Le.href),h=o(Le.to),x=k(Le,"closeOnSelect")?!!o(Le.closeOnSelect):Le.keepOpen===!0?!1:E().closeOnSelect!==!1,ae=Le.role||(Se!=null?"menuitemcheckbox":"menuitem"),Oe=Z(Le.icon,Re),De=Z((H=Le.iconRight)!=null?H:Le.endIcon,Re),Ge=D(l,"itemTitle",Re,N((W=Le.title)!=null?W:Le.label,Re)),Ke=D(l,"itemSubtitle",Re,N((ee=Le.subtitle)!=null?ee:Le.description,Re)),We=D(l,"itemShortcut",Re,N(Le.shortcut,Re)),et=D(l,"itemBadge",Re,N(Le.badge,Re)),tt=D(l,"item",Re,N((Te=(Ne=Le.content)!=null?Ne:Le.body)!=null?Te:Le.render,Re)),dt=[...et,...We,...Se===!0&&!De.length&&!et.length?[_.span({class:"jss-menu-entry-check"},xe.Icon({name:Le.checkedIcon||"check",size:"sm"}))]:[],...De],At={class:re(["jss-menu-entry","jss-menu-item",F?`jss-state-${F}`:"",pe(Fe,"is-active"),pe(Se===!0,"is-checked"),pe(C,"is-disabled"),Le.class]),role:ae,tabIndex:C?-1:(oe=Le.tabIndex)!=null?oe:-1,"data-menu-item":!0,"data-menu-select":x?"true":"false","data-menu-close":Le.close===!0?"true":null,"data-menu-keep-open":x?null:"true","aria-disabled":C?"true":null,"aria-checked":Se==null?null:String(Se),title:(Ie=(Pe=Le.titleAttr)!=null?Pe:Le.tooltip)!=null?Ie:null,type:f?null:"button",href:f||null,target:Le.target||null,rel:Le.rel||(Le.target==="_blank"?"noopener noreferrer":null),onClick:zt=>{var Xe,mt,Nt,Zt;if(C){zt.preventDefault(),zt.stopPropagation();return}(mt=(Xe=E()).onItemClick)==null||mt.call(Xe,Le,Re,zt);const rn=(Nt=Le.onClick)==null?void 0:Nt.call(Le,Re,zt);zt.defaultPrevented||(h&&((Zt=JSswift.router)!=null&&Zt.navigate)&&(zt.preventDefault(),JSswift.router.navigate(h)),rn!==!1&&x&&Q())}};Le.attrs&&typeof Le.attrs=="object"&&Object.assign(At,Le.attrs);const It=f?_.a:_.button,$t=tt.length?tt:[Ge.length?_.div({class:"jss-menu-entry-title"},...Ge):null,Ke.length?_.div({class:"jss-menu-entry-subtitle"},...Ke):null].filter(Boolean);return[It(At,Oe.length?_.span({class:"jss-menu-entry-icon"},...Oe):null,_.span({class:"jss-menu-entry-main"},...$t),dt.length?_.span({class:"jss-menu-entry-aside"},...dt):null)]},I=()=>{var A,L,O,X,we,Be,Ue;const H=E(),W={close:Q,dismiss:Q,open:b,toggle:Y,update:m,isOpen:K,entry:()=>a,anchorEl:fe(),props:H},ee=Z(H.icon,W,H.iconSize||"md"),Ne=D(l,"eyebrow",W,N(H.eyebrow,W)),Te=D(l,"title",W,N((L=(A=H.title)!=null?A:H.heading)!=null?L:H.label,W)),oe=D(l,"subtitle",W,N((O=H.subtitle)!=null?O:H.description,W)),Pe=D(l,"before",W,N(H.before,W)),Ie=D(l,"header",W,N(H.header,W)),Le=D(l,"after",W,N(H.after,W)),Ye=D(l,"footer",W,N(H.footer,W)),ct=D(l,"status",W,N(H.status,W));let Re=(X=H.content)!=null?X:H.body;Re==null&&s&&s.length&&(Re=s);let C=D(l,"content",W,N(Re,W));C.length||(C=D(l,"body",W,N(Re,W))),C.length||(C=D(l,"default",W,N(Re,W)));const Se=j((Be=(we=H.items)!=null?we:H.actionsList)!=null?Be:H.entries,W),Fe=Se.length?[]:D(l,"empty",W,N((Ue=H.empty)!=null?Ue:H.emptyText,W));let F=null;return Ie.length?F=_.div({class:re(["jss-menu-head","jss-menu-head-custom",H.headerClass])},...Ie):(ee.length||Ne.length||Te.length||oe.length)&&(F=_.div({class:re(["jss-menu-head",H.headerClass])},ee.length?_.div({class:"jss-menu-head-icon"},...ee):null,_.div({class:"jss-menu-head-main"},Ne.length?_.div({class:"jss-menu-eyebrow"},...Ne):null,Te.length?_.div({class:"jss-menu-title"},...Te):null,oe.length?_.div({class:"jss-menu-subtitle"},...oe):null))),_.div({class:re(["jss-menu","jss-menu-shell",pe(H.dense,"dense"),pe(Se.length>0,"has-items"),pe(Ye.length>0||ct.length>0,"has-footer"),H.class]),style:H.style||{},role:H.role||"menu","aria-label":H.ariaLabel||null},Pe.length?_.div({class:"jss-menu-before"},...Pe):null,F,C.length?_.div({class:re(["jss-menu-content",H.contentClass])},...C):null,Se.length?_.div({class:re(["jss-menu-items",H.itemsClass])},...Se):null,!Se.length&&Fe.length?_.div({class:"jss-menu-empty"},...Fe):null,Le.length?_.div({class:"jss-menu-after"},...Le):null,ct.length||Ye.length?_.div({class:re(["jss-menu-footer",H.footerClass])},ct.length?_.div({class:"jss-menu-status"},...ct):null,Ye.length?_.div({class:"jss-menu-footer-actions"},...Ye):null):null)},y=A=>{var L;if(!(A!=null&&A.panel))return;const O=E(),X=ve(O),we=le(O);B(A.panel,"_menuClassTokens",["jss-menu-panel","jss-clear-set","jss-singularity",we?`jss-menu-${we}`:"",X?`jss-state-${X}`:"",o(O.outline)?"outline":"",...p(O.panelClass)]),B(A.overlay,"_menuOverlayClassTokens",[...p(O.overlayClass)]),A.panel.dataset.placement=ie(O),te(A.panel,"--jss-menu-width",o(O.width),vt),te(A.panel,"--jss-menu-min-width",o(O.minWidth),vt),te(A.panel,"--jss-menu-max-width",o(O.maxWidth),vt),te(A.panel,"--jss-menu-max-height",o(O.maxHeight),vt),te(A.panel,"--jss-menu-body-max-height",o((L=O.bodyMaxHeight)!=null?L:O.contentMaxHeight),vt),O.panelStyle&&Object.assign(A.panel.style,O.panelStyle),Et(A.panel,O)},P=()=>{a!=null&&a.panel&&a.panel.replaceChildren(I())},Q=()=>{if($(),!a)return;const A=a;a=null,Ns(A,()=>JSswift.overlay.close(A.id))},m=(A={})=>{var L,O,X,we;if(A&&typeof A=="object"&&(c={...c,...A}),a){const Be=E();y(a),P(),(we=a.reposition)==null||we.call(a,{anchorEl:a._anchorEl,placement:ie(Be),offsetX:(L=Be.offsetX)!=null?L:0,offsetY:(X=(O=Be.offsetY)!=null?O:Be.offset)!=null?X:8}),de()}return J},b=(A=null,L=null)=>{var O,X,we,Be,Ue,H,W,ee,Ne,Te,oe,Pe,Ie,Le,Ye,ct;$();const{anchorEl:Re,nextProps:C}=me(A,L);C&&(c={...c,...C});const Se=E(),Fe=fe(Re);if(!Fe||o(Se.disabled))return null;if(a&&a._anchorEl===Fe){const We=E();return y(a),P(),(Be=a.reposition)==null||Be.call(a,{anchorEl:a._anchorEl,placement:ie(We),offsetX:(O=We.offsetX)!=null?O:0,offsetY:(we=(X=We.offsetY)!=null?X:We.offset)!=null?we:8}),de(),a}a&&Q(),r=document.activeElement;let F=null;if(a=JSswift.overlay.open(()=>I(),{type:"menu",anchorEl:Fe,placement:ie(Se),offsetX:(Ue=Se.offsetX)!=null?Ue:0,offsetY:(W=(H=Se.offsetY)!=null?H:Se.offset)!=null?W:8,backdrop:Se.backdrop===!0,lockScroll:Se.lockScroll===!0,trapFocus:Se.trapFocus===!0,autoFocus:!1,closeOnOutside:Se.closeOnOutside!==!1,closeOnBackdrop:(ee=Se.closeOnBackdrop)!=null?ee:Se.backdrop===!0,closeOnEsc:Se.closeOnEsc!==!1,className:Bt(["jss-menu-panel"]),onClose:()=>{var We,et,tt;(We=F==null?void 0:F._menuCleanup)==null||We.call(F),(tt=(et=E()).onClose)==null||tt.call(et,F),E().returnFocus!==!1&&r&&typeof r.focus=="function"&&setTimeout(()=>r.focus(),0)}}),!(a!=null&&a.panel))return a;const f=a;F=f,f._anchorEl=Fe;const h=()=>{clearTimeout(d),d=null},x=()=>{T()},ae=We=>{const et=We.target;if(!et||!et.closest)return;if(et.closest("[data-menu-close]")){Q();return}if(E().closeOnSelect===!1)return;const tt=et.closest("[data-menu-item], [data-menu-select], .jss-menu-item, [role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio'], a[href], button:not([disabled])");tt&&(tt.closest("[data-menu-keep-open]")||tt.getAttribute("data-menu-select")!=="false"&&Q())},Oe=We=>{if(We.key==="Escape"){We.preventDefault(),Q();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(We.key))return;const et=be(f.panel);if(!et.length)return;We.preventDefault();const tt=et.indexOf(document.activeElement);if(We.key==="Home"){et[0].focus();return}if(We.key==="End"){et[et.length-1].focus();return}const dt=We.key==="ArrowDown"?1:-1,gt=tt<0?dt>0?0:et.length-1:(tt+dt+et.length)%et.length;et[gt].focus()};f.panel.addEventListener("click",ae),f.panel.addEventListener("keydown",Oe);const De=M((Te=(Ne=Se.trigger)!=null?Ne:Se.triggers)!=null?Te:k(Se,"open")?"manual":null),Ge=De.has("hover"),Ke=De.has("focus");return(Ge||Ke)&&(f.panel.addEventListener("mouseenter",h),f.panel.addEventListener("mouseleave",x),f.panel.addEventListener("focusin",h),f.panel.addEventListener("focusout",x)),f._menuCleanup=()=>{var We,et,tt,dt,gt,At;(We=f.panel)==null||We.removeEventListener("click",ae),(et=f.panel)==null||et.removeEventListener("keydown",Oe),(tt=f.panel)==null||tt.removeEventListener("mouseenter",h),(dt=f.panel)==null||dt.removeEventListener("mouseleave",x),(gt=f.panel)==null||gt.removeEventListener("focusin",h),(At=f.panel)==null||At.removeEventListener("focusout",x)},y(f),(Le=f.reposition)==null||Le.call(f,{anchorEl:Fe,placement:ie(Se),offsetX:(oe=Se.offsetX)!=null?oe:0,offsetY:(Ie=(Pe=Se.offsetY)!=null?Pe:Se.offset)!=null?Ie:8}),ks(f),(ct=(Ye=E()).onOpen)==null||ct.call(Ye,f),de(),f},g=(A,L=null)=>{clearTimeout(d),d=null,clearTimeout(z),z=setTimeout(()=>b(A,L),ge())},T=(A=!1)=>{if(clearTimeout(z),z=null,!!a){if(clearTimeout(d),A){Q();return}d=setTimeout(()=>Q(),ue())}},Y=(A=null,L=null)=>K()?(Q(),null):b(A,L),K=()=>!!a,J={open:b,close:Q,show:g,hide:T,toggle:Y,update:m,bind:A=>{var L,O;if(!A)return()=>{};v=A;const X=E(),we=M((O=(L=X.trigger)!=null?L:X.triggers)!=null?O:k(X,"open")?"manual":null),Be=we.has("hover"),Ue=we.has("focus"),H=we.has("click"),W=we.has("manual")||!Be&&!Ue&&!H,ee=[],Ne=()=>{$(),ee.forEach(Te=>Te()),v===A&&(v=null)};if(k(X,"open"))return ht(X.open)?JSswift.reactive.effect(()=>{v&&(o(E().open)?b(v):T(!0))},"UI.Menu:open"):X.open===!0?b(A):X.open===!1&&T(!0),Ne;if(W||o(X.disabled))return Ne;if(Be){const Te=()=>g(A),oe=()=>T();A.addEventListener("mouseenter",Te),A.addEventListener("mouseleave",oe),ee.push(()=>{A.removeEventListener("mouseenter",Te),A.removeEventListener("mouseleave",oe)})}if(Ue){const Te=()=>g(A),oe=()=>T();A.addEventListener("focus",Te),A.addEventListener("blur",oe),ee.push(()=>{A.removeEventListener("focus",Te),A.removeEventListener("blur",oe)})}if(H){const Te=oe=>{var Pe,Ie;(Ie=(Pe=E()).onTriggerClick)==null||Ie.call(Pe,oe),!oe.defaultPrevented&&Y(A)};A.addEventListener("click",Te),ee.push(()=>A.removeEventListener("click",Te))}return Ne},isOpen:K,entry:()=>a,props:()=>({...c})};return J},xe.Popover=(...e)=>{const{props:t,children:s}=JSswift.uiNormalizeArgs(e),l=t.slots||{},n=["primary","secondary","warning","danger","success","info","light","dark"],i=["xs","sm","md","lg","xl"];let c={...t},a=null,v=null,r=null,z=null,d=null;const k=(J,A)=>Object.prototype.hasOwnProperty.call(J||{},A),N=(J,A)=>typeof J=="function"?J(A):J,p=J=>String(J||"").split(/\s+/).filter(Boolean),U=J=>J&&typeof J=="object"&&!J.nodeType&&!Array.isArray(J)&&!(J instanceof Function),w=J=>!!J&&typeof J=="object"&&(J.nodeType===1||typeof J.getBoundingClientRect=="function"),$=()=>{clearTimeout(z),clearTimeout(d),z=null,d=null},B=(J,A,L)=>{if(!J)return;const O=J[A]||[];O.length&&J.classList.remove(...O);const X=(L||[]).filter(Boolean);X.length&&J.classList.add(...X),J[A]=X},te=(J,A,L,O=X=>X)=>{if(J){if(L==null||L===""){J.style.removeProperty(A);return}J.style.setProperty(A,O(L))}},E=()=>c,ve=J=>{var A;const L=o((A=J.state)!=null?A:J.color);return L?n.includes(L)?L:String(L):""},le=J=>{const A=o(J.size);return typeof A=="string"&&i.includes(A)?A:""},ie=J=>{var A,L,O;const X=String(o((O=(L=(A=J.actionsAlign)!=null?A:J.footerAlign)!=null?L:J.alignActions)!=null?O:"end")).toLowerCase();return["start","left"].includes(X)?"start":["center","middle"].includes(X)?"center":["between","space-between"].includes(X)?"between":["stretch","full"].includes(X)?"stretch":"end"},ge=J=>{var A,L;return String(o((L=(A=J.placement)!=null?A:J.position)!=null?L:"bottom-start"))},ue=(J,A)=>{const L=o(J);if(L==null||L==="")return A;const O=Number(L);return Number.isFinite(O)?O:A},fe=()=>ue(E().delay,0),M=()=>ue(E().hideDelay,120),me=J=>{var A,L;return((L=(A=J.closable)!=null?A:J.dismissible)!=null?L:J.closeButton)===!0},be=(J=null)=>{var A,L,O;if(J)return J;const X=E();return v||o((O=(L=(A=X.anchorEl)!=null?A:X.triggerEl)!=null?L:X.target)!=null?O:X.anchor)||null},de=J=>{if(J==null||J===!0)return new Set(["click"]);if(J===!1)return new Set(["manual"]);const A=Array.isArray(J)?J:String(J).split(/[\s,|/]+/),L=new Set;return A.forEach(O=>{const X=String(O||"").trim().toLowerCase();X&&(X==="mouseenter"||X==="mouseover"?L.add("hover"):X==="blur"||X==="focusin"?L.add("focus"):X==="tap"?L.add("click"):L.add(X))}),L.size?L:new Set(["manual"])},Z=(J,A)=>{var L,O,X;let we=null,Be=null;if(w(J))we=J,U(A)&&(Be=A);else if(U(J)){Be=J;const Ue=(X=(O=(L=J.anchorEl)!=null?L:J.triggerEl)!=null?O:J.target)!=null?X:J.anchor;w(Ue)&&(we=Ue)}else J!=null&&(we=J);return{anchorEl:we,nextProps:Be}},j=()=>{var J,A,L,O,X,we,Be,Ue,H;const W=E(),ee={close:P,dismiss:P,open:m,toggle:T,update:Q,isOpen:Y,entry:()=>a,anchorEl:be(),props:W},Ne=W.icon!=null?typeof W.icon=="string"?xe.Icon({name:W.icon,size:W.iconSize||"md"}):JSswift.ui.slot(W.icon,{as:"icon"}):null,Te=D(l,"eyebrow",ee,N(W.eyebrow,ee)),oe=D(l,"title",ee,N((A=(J=W.title)!=null?J:W.heading)!=null?A:W.label,ee)),Pe=D(l,"subtitle",ee,N((L=W.subtitle)!=null?L:W.description,ee)),Ie=D(l,"icon",ee,Ne),Le=D(l,"header",ee,N((X=(O=W.headerContent)!=null?O:W.head)!=null?X:W.header,ee)),Ye=me(W)?D(l,"close",ee,xe.Btn({class:"jss-dialog-close",size:"sm",outline:!0,"aria-label":W.closeLabel||"Chiudi popover","data-popover-close":!0},xe.Icon({name:W.closeIcon||"close",size:"sm"}))):[];let ct=(Ue=(Be=(we=W.content)!=null?we:W.body)!=null?Be:W.message)!=null?Ue:W.text;ct==null&&s&&s.length&&(ct=s);let Re=D(l,"content",ee,N(ct,ee));Re.length||(Re=D(l,"body",ee,N(ct,ee))),Re.length||(Re=D(l,"default",ee,N(ct,ee)));const C=N((H=W.footer)!=null?H:W.actions,ee);let Se=D(l,"footer",ee,C);Se.length||(Se=D(l,"actions",ee,C));let Fe=null;Le.length?Fe=_.div({class:"jss-dialog-head jss-dialog-head-custom"},...Le):(Te.length||oe.length||Pe.length||Ie.length||Ye.length)&&(Fe=_.div({class:"jss-dialog-head"},Ie.length?_.div({class:"jss-dialog-icon"},...Ie):null,_.div({class:"jss-dialog-head-main"},Te.length?_.div({class:"jss-dialog-eyebrow"},...Te):null,oe.length?_.div({class:"jss-dialog-title"},...oe):null,Pe.length?_.div({class:"jss-dialog-subtitle"},...Pe):null),Ye.length?_.div({class:"jss-dialog-close-wrap"},...Ye):null));const F=[];return Fe&&F.push(Fe),Re.length&&F.push(_.div({class:re(["jss-dialog-body",W.bodyClass])},...Re)),Se.length&&F.push(_.div({class:re(["jss-dialog-actions",`is-${ie(W)}`,pe(W.stackActions,"is-stacked"),W.actionsClass,W.footerClass])},...Se)),F.length||F.push(_.div({class:re(["jss-dialog-body",W.bodyClass])})),_.div({class:re(["jss-dialog-shell","jss-popover-shell",pe(!!Fe,"has-head"),pe(Se.length>0,"has-footer"),pe(W.divider!==!1,"with-divider")])},...F)},I=J=>{var A;if(!(J!=null&&J.panel))return;const L=E(),O=ve(L),X=le(L);B(J.panel,"_popoverClassTokens",["jss-dialog","jss-popover","jss-singularity","jss-clear-set",X?`jss-dialog-${X}`:"",O,O?`jss-state-${O}`:"",o(L.scrollable)?"scrollable":"",o(L.stickyHeader)?"sticky-head":"",o(L.stickyActions)?"sticky-actions":"",o(L.borderless)?"borderless":"",...p(L.class),...p(L.panelClass)]),B(J.overlay,"_popoverOverlayClassTokens",[...p(L.overlayClass)]),J.panel.dataset.placement=ge(L),te(J.panel,"--jss-dialog-width",o(L.width),vt),te(J.panel,"--jss-dialog-min-width",o(L.minWidth),vt),te(J.panel,"--jss-dialog-max-width",o(L.maxWidth),vt),te(J.panel,"--jss-dialog-max-height",o(L.maxHeight),vt),te(J.panel,"--jss-dialog-body-max-height",o((A=L.bodyMaxHeight)!=null?A:L.contentMaxHeight),vt),L.style&&Object.assign(J.panel.style,L.style),Et(J.panel,L),J.panel.setAttribute("role",L.role||"dialog"),J.panel.setAttribute("aria-modal",L.modal===!0?"true":"false"),L.ariaLabel?J.panel.setAttribute("aria-label",L.ariaLabel):J.panel.removeAttribute("aria-label")},y=()=>{a!=null&&a.panel&&a.panel.replaceChildren(j())},P=()=>{if($(),!a)return;const J=a;a=null,Ns(J,()=>JSswift.overlay.close(J.id))},Q=(J={})=>(J&&typeof J=="object"&&(c={...c,...J}),a&&(I(a),y()),_e),m=(J=null,A=null)=>{var L,O,X,we,Be,Ue,H,W;$();const{anchorEl:ee,nextProps:Ne}=Z(J,A);Ne&&(c={...c,...Ne});const Te=E(),oe=be(ee);if(!oe||o(Te.disabled))return null;if(a&&a._anchorEl===oe)return I(a),y(),a;a&&P(),r=document.activeElement;const Pe=de((O=(L=Te.trigger)!=null?L:Te.triggers)!=null?O:k(Te,"open")?"manual":null),Ie=Pe.has("hover"),Le=Pe.has("focus");let Ye=null;if(a=JSswift.overlay.open(()=>j(),{type:"popover",anchorEl:oe,placement:ge(Te),offsetX:(X=Te.offsetX)!=null?X:0,offsetY:(Be=(we=Te.offsetY)!=null?we:Te.offset)!=null?Be:10,backdrop:Te.backdrop===!0,lockScroll:Te.lockScroll===!0,trapFocus:Te.trapFocus===!0,autoFocus:Te.autoFocus===!0,closeOnOutside:Te.closeOnOutside!==!1,closeOnBackdrop:(Ue=Te.closeOnBackdrop)!=null?Ue:Te.backdrop===!0,closeOnEsc:Te.closeOnEsc!==!1,className:Bt(["jss-dialog","jss-popover"]),onClose:()=>{var Fe,F,f;(Fe=Ye==null?void 0:Ye._popoverCleanup)==null||Fe.call(Ye),(f=(F=E()).onClose)==null||f.call(F,Ye),E().returnFocus!==!1&&r&&typeof r.focus=="function"&&setTimeout(()=>r.focus(),0)}}),!(a!=null&&a.panel))return a;const ct=a;Ye=ct,ct._anchorEl=oe;const Re=()=>{clearTimeout(d),d=null},C=()=>{!Ie&&!Le||g()},Se=Fe=>{const F=Fe.target;if(!(!F||!F.closest)){if(F.closest("[data-popover-close]")||F.closest("[data-dialog-close]")){P();return}E().closeOnSelect===!0&&F.closest("[data-popover-select]")&&P()}};return ct.panel.addEventListener("click",Se),(Ie||Le)&&(ct.panel.addEventListener("mouseenter",Re),ct.panel.addEventListener("mouseleave",C),ct.panel.addEventListener("focusin",Re),ct.panel.addEventListener("focusout",C)),ct._popoverCleanup=()=>{var Fe,F,f,h,x;(Fe=ct.panel)==null||Fe.removeEventListener("click",Se),(F=ct.panel)==null||F.removeEventListener("mouseenter",Re),(f=ct.panel)==null||f.removeEventListener("mouseleave",C),(h=ct.panel)==null||h.removeEventListener("focusin",Re),(x=ct.panel)==null||x.removeEventListener("focusout",C)},I(ct),ks(ct),(W=(H=E()).onOpen)==null||W.call(H,ct),ct},b=(J,A=null)=>{clearTimeout(d),d=null,clearTimeout(z),z=setTimeout(()=>m(J,A),fe())},g=(J=!1)=>{if(clearTimeout(z),z=null,!!a){if(clearTimeout(d),J){P();return}d=setTimeout(()=>P(),M())}},T=(J=null,A=null)=>Y()?(P(),null):m(J,A),Y=()=>!!a,_e={open:m,close:P,show:b,hide:g,toggle:T,update:Q,bind:J=>{var A,L;if(!J)return()=>{};v=J;const O=E(),X=de((L=(A=O.trigger)!=null?A:O.triggers)!=null?L:k(O,"open")?"manual":null),we=X.has("hover"),Be=X.has("focus"),Ue=X.has("click"),H=X.has("manual")||!we&&!Be&&!Ue,W=[],ee=()=>{$(),W.forEach(Ne=>Ne()),v===J&&(v=null)};if(k(O,"open"))return ht(O.open)?JSswift.reactive.effect(()=>{v&&(o(E().open)?m(v):g(!0))},"UI.Popover:open"):O.open===!0?m(J):O.open===!1&&g(!0),ee;if(H||o(O.disabled))return ee;if(we){const Ne=()=>b(J),Te=()=>g();J.addEventListener("mouseenter",Ne),J.addEventListener("mouseleave",Te),W.push(()=>{J.removeEventListener("mouseenter",Ne),J.removeEventListener("mouseleave",Te)})}if(Be){const Ne=()=>b(J),Te=()=>g();J.addEventListener("focus",Ne),J.addEventListener("blur",Te),W.push(()=>{J.removeEventListener("focus",Ne),J.removeEventListener("blur",Te)})}if(Ue){const Ne=Te=>{var oe,Pe;(Pe=(oe=E()).onTriggerClick)==null||Pe.call(oe,Te),!Te.defaultPrevented&&T(J)};J.addEventListener("click",Ne),W.push(()=>J.removeEventListener("click",Ne))}return ee},isOpen:Y,entry:()=>a,props:()=>({...c})};return _e},xe.ContextMenu=(...e)=>{const{props:t,children:s}=JSswift.uiNormalizeArgs(e);let l={...t},n=null,i=null,c=null;const a=y=>y&&typeof y=="object"&&!y.nodeType&&!Array.isArray(y)&&!(y instanceof Function),v=y=>!!y&&typeof y=="object"&&(y.nodeType===1||typeof y.getBoundingClientRect=="function"),r=y=>!!y&&typeof y=="object"&&("clientX"in y||"type"in y||"target"in y||"currentTarget"in y),z=y=>!!y&&Number.isFinite(Number(y.x))&&Number.isFinite(Number(y.y)),d=()=>l,k=(y,P)=>{const Q=Number(y),m=Number(P);return!Number.isFinite(Q)||!Number.isFinite(m)?null:{x:Q,y:m}},N=y=>y?{_jssContextPoint:y,getBoundingClientRect:()=>({top:y.y,bottom:y.y,left:y.x,right:y.x,width:0,height:0})}:null,p=y=>{if(!v(y))return null;const P=y.getBoundingClientRect();return k(P.left+Math.min(P.width/2,24),P.top+Math.min(P.height/2,24))},U=y=>{var P,Q,m,b;return o((b=(m=(Q=(P=y==null?void 0:y.anchorEl)!=null?P:y==null?void 0:y.triggerEl)!=null?Q:y==null?void 0:y.target)!=null?m:y==null?void 0:y.anchor)!=null?b:null)},w=(y,P=null)=>{if(!y)return p(P||c);const Q=k(y.clientX,y.clientY);if(Q)return Q;const m=U({anchorEl:P||y.currentTarget||y.target||c});return p(m)},$=(y={})=>{if(!a(y))return{};const P={...y};return delete P.event,delete P.point,delete P.x,delete P.y,P},B=()=>{var y,P,Q;const m=d();return{...m,trigger:"manual",placement:m.placement||"bottom-start",offsetX:(y=m.offsetX)!=null?y:0,offsetY:(Q=(P=m.offsetY)!=null?P:m.offset)!=null?Q:4,closeOnOutside:m.closeOnOutside!==!1,closeOnEsc:m.closeOnEsc!==!1,role:m.role||"menu",ariaLabel:m.ariaLabel||m.title||"Context menu",class:re(["jss-context-menu-shell",m.class]),panelClass:re(["jss-context-menu-panel",m.panelClass])}},te=xe.Menu(B(),...s),E=(y=null,P=null,Q=null)=>{let m=null,b=null,g=null;if(r(y))m=w(y,c),g=a(P)?$(P):null;else if(typeof y=="number"||typeof P=="number")m=k(y,P),g=a(Q)?$(Q):null;else if(z(y))m=k(y.x,y.y),g=a(P)?$(P):null;else if(v(y))b=y,g=a(P)?$(P):null;else if(a(y)){const T=z(y.point)?y.point:z(y)?y:null,Y=U(y),K=y.event;m=T?k(T.x,T.y):w(K,Y||c),b=Y&&v(Y)?Y:null,g={...$(y),...a(P)?$(P):{}}}else n&&(m={...n});return{point:m,anchor:b,nextProps:g}},ve=(y,P=null)=>{i=y||i,n=P||y&&y._jssContextPoint||n},le=(y=null)=>{a(y)&&Object.keys(y).length&&(l={...l,...y})},ie=(y=null,P=null)=>{if(P)return N(P);if(y&&v(y))return y;const Q=U(d());return v(Q)?Q:n?N(n):v(i)?i:v(c)?c:null},ge=(y=null,P=null,Q=null)=>{const{point:m,anchor:b,nextProps:g}=E(y,P,Q);le(g);const T=ie(b,m);return T?(ve(T,m),te.open(T,B())):null},ue=(y,P,Q=null)=>ge(y,P,Q),fe=(y,P=null)=>ge(y,P),M=()=>(te.close(),I),me=(y=!0)=>(y===!1?te.hide(!1):te.close(),I),be=(y=null,P=null,Q=null)=>ge(y,P,Q),de=(y=null,P=null,Q=null)=>te.isOpen()?(M(),null):ge(y,P,Q),Z=(y={})=>(le($(y)),te.update(B()),I),I={open:ge,openAt:ue,openFromEvent:fe,show:be,hide:me,close:M,toggle:de,update:Z,bind:(y,P=null)=>{if(!y)return()=>{};const Q=a(P)?$(P):null,m=g=>{var T,Y;c=y,g.preventDefault(),!(((Y=(T=d()).onTrigger)==null?void 0:Y.call(T,g,{element:y,open:ge,close:M,update:Z}))===!1||o(d().disabled))&&ge({event:g,anchorEl:y},Q)},b=g=>{var T,Y;g.key!=="ContextMenu"&&!(g.shiftKey&&g.key==="F10")||(c=y,g.preventDefault(),((Y=(T=d()).onTrigger)==null?void 0:Y.call(T,g,{element:y,open:ge,close:M,update:Z}))===!1||o(d().disabled))||ge({event:g,anchorEl:y},Q)};return y.addEventListener("contextmenu",m),y.addEventListener("keydown",b),()=>{y.removeEventListener("contextmenu",m),y.removeEventListener("keydown",b)}},isOpen:te.isOpen,entry:te.entry,props:()=>({...l})};return I}})(JSswift);
34
+ `,document.head.appendChild(c),hn._textNode=s,hn._spinner=t,hn._progressWrap=l,hn._progressBar=n,hn._progressActive=!1,hn}function uo(e,t){if(typeof e=="object"&&e!==null)return{...e};const s=t&&typeof t=="object"?t:{};return typeof t=="string"&&(e==null||typeof e=="number")?{...s,message:t}:{...s,message:e}}function fo(e,t){const s=t==="progress";e._spinner.style.display=s?"none":"",e._progressWrap.style.display=s?"block":"none",e._mode=t}wt.loading.show=function(e="Loading...",t={}){const s=co(),l=uo(e,t);Hs++,s._progressActive=!1,s._textNode.textContent=l.message||"Loading...",fo(s,"spinner"),l.spinner===!1&&(s._spinner.style.display="none"),s.style.display="flex"},wt.loading.hide=function(){hn&&(Hs=Math.max(0,Hs-1),Hs===0&&(hn.style.display="none",hn._progressActive=!1))},wt.loading.progress=function(e=0,t={}){var s;const l=co();typeof e=="object"&&e!==null&&(t=e,e=(s=e.value)!=null?s:0);const n=uo(null,t);l._progressActive||(Hs++,l._progressActive=!0);const i=Math.max(0,Math.min(100,Number(e!=null?e:0)));l._textNode.textContent=n.message||"Loading...",l._progressBar.style.width=i+"%",fo(l,"progress"),l.style.display="flex"},wt.loading.wrap=async function(e,t){wt.loading.show(e);try{return await t()}finally{wt.loading.hide()}};function Wo(e){return typeof e=="function"?e():e||[]}function Fl(e,t){if(!(e==null||t==null))return typeof t!="string"||t.indexOf(".")<0?e==null?void 0:e[t]:t.split(".").reduce((s,l)=>s==null?s:s[l],e)}function Uo(e,t){return e==null&&t==null?0:e==null?-1:t==null?1:typeof e=="number"&&typeof t=="number"?e-t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:"base"})}function Go(e){const t=Wo(e);return Array.isArray(t)?t:[]}function po(e){var t,s,l,n;return(n=(l=(s=(t=e==null?void 0:e.label)!=null?t:e==null?void 0:e.title)!=null?s:e==null?void 0:e.header)!=null?l:e==null?void 0:e.key)!=null?n:""}function Dl(e,t){var s,l;return(l=(s=e==null?void 0:e.sortKey)!=null?s:e==null?void 0:e.key)!=null?l:`__col_${t}`}function ho(e,t){return e.find((s,l)=>Dl(s,l)===t||(s==null?void 0:s.key)===t)||null}function yl(e,t,s){return e?typeof e.get=="function"?e.get(t,{row:t,rowIndex:s,col:e}):typeof e.value=="function"?e.value(t,{row:t,rowIndex:s,col:e}):typeof e.key=="string"?Fl(t,e.key):e.key!=null?t==null?void 0:t[e.key]:t:t}function bl(e,t){return typeof e=="function"?e(t)||{}:e||{}}function vl(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(vl).filter(Boolean).join(" ");if(typeof Node!="undefined"&&e instanceof Node)return e.textContent||"";if(typeof e=="object"){if(typeof e.textContent=="string")return e.textContent;try{return JSON.stringify(e)}catch(t){return""}}return String(e)}function Ko(e,t){const l=(Array.isArray(e)?e:t).map(n=>Number(n)).filter(n=>Number.isFinite(n)&&n>0);return l.length?Array.from(new Set(l)):t}function qo(e,t,s,l){const n=l.searchBy||l.searchPredicate;if(typeof n=="function")return!!n(e,{query:s,columns:t});const i=String(s||"").trim().toLowerCase().split(/\s+/).filter(Boolean);if(!i.length)return!0;const c=Array.isArray(l.searchKeys)&&l.searchKeys.length?l.searchKeys:t.filter(r=>(r==null?void 0:r.searchable)!==!1).map(r=>{var z;return(z=r==null?void 0:r.searchKey)!=null?z:r==null?void 0:r.key}).filter(Boolean),a=[];if(c.length)for(const r of c)if(typeof r=="function")a.push(vl(r(e)));else{const z=t.find(d=>(d==null?void 0:d.key)===r||(d==null?void 0:d.searchKey)===r);a.push(vl(z?yl(z,e,-1):Fl(e,r)))}else a.push(vl(e));const v=a.join(" ").toLowerCase();return i.every(r=>v.includes(r))}xe.Table=(...e)=>{var t,s,l,n;const{props:i,children:c}=JSswift.uiNormalizeArgs(e),a=i.slots||{},v=Array.isArray(i.columns)?i.columns:[],r=Ko(i.pageSizeOptions,[5,10,20,50]),z=Number((s=(t=i.pageSize)!=null?t:r[0])!=null?s:10)||10,d=Array.from(new Set([...r,z])).sort((Re,C)=>Re-C),k=i.initialSort||(i.sortBy?{key:i.sortBy,dir:i.sortDir==="desc"?"desc":"asc"}:null),N=i.searchable===!0||typeof i.searchable=="string"||i.searchPlaceholder!=null||i.search!=null||i.query!=null||!!i.searchModel||!!i.queryModel||Array.isArray(i.searchKeys)||typeof i.searchBy=="function"||typeof i.searchPredicate=="function",p=en(i.searchModel||i.queryModel,"UI.Table:query"),[U,w]=wt.reactive.signal(Math.max(1,Number(i.page||1)||1)),[$,B]=wt.reactive.signal(z),[te,E]=wt.reactive.signal(k),[ve,le]=wt.reactive.signal(String((n=p?p.get():(l=i.search)!=null?l:i.query)!=null?n:"")),ie=Re=>{const C=String(Re!=null?Re:"");le(C),p&&p.set(C),w(1)},ge=Re=>{const C=Number(Re)||z;B(C),w(1)},ue=(Re,C)=>{const Se=Dl(Re,C),Fe=te();!Fe||Fe.key!==Se&&Fe.key!==(Re==null?void 0:Re.key)?E({key:Se,dir:"asc"}):Fe.dir==="asc"?E({key:Se,dir:"desc"}):E(null),w(1)};let fe=null,M;p&&(M=p.watch(Re=>{const C=String(Re!=null?Re:"");le(C),fe&&fe.value!==C&&(fe.value=C),w(1)},"UI.Table:queryWatch"));const me=JSswift.omit(i,["columns","rows","rowKey","loading","page","pageSize","pageSizeOptions","pagination","initialSort","sortBy","sortDir","search","query","searchable","searchPlaceholder","searchKeys","searchBy","searchPredicate","searchModel","queryModel","filter","actions","actionsLabel","emptyText","loadingText","onRowClick","onRowDblClick","tableClass","tableStyle","cardClass","dense","striped","hover","stickyHeader","toolbar","toolbarStart","toolbarEnd","caption","footer","status","rowClass","rowAttrs","embedded","minTableWidth","hideHeader","hideFooter","hideStatus","slots","body"]);me.class=re(["jss-table-card",i.embedded===!0&&"jss-table-embedded",i.class,i.cardClass]),i.dense!=null&&(me.dense=i.dense);const be=_.div({class:"jss-table-shell"}),de=D(a,"default",{},c);de.length&&be.appendChild(_.div({class:"jss-table-lead"},...de));const Z=D(a,"toolbarStart",{},i.toolbarStart),j=D(a,"toolbar",{},i.toolbar),I=D(a,"toolbarEnd",{},i.toolbarEnd),y=_.div({class:"jss-table-toolbar"}),P=_.div({class:"jss-table-toolbar-main"}),Q=_.div({class:"jss-table-toolbar-side"});Z.forEach(Re=>P.appendChild(Re)),j.forEach(Re=>P.appendChild(Re));const m=D(a,"search",{query:ve(),getQuery:ve,setQuery:ie},null);if(m.length)m.forEach(Re=>Q.appendChild(Re));else if(N){fe=_.input({type:"search",class:"jss-input",placeholder:typeof i.searchable=="string"?i.searchable:i.searchPlaceholder||"Cerca nella tabella",value:String(ve()||"")}),fe.addEventListener("input",()=>ie(fe.value));const Re=xe.Btn({class:"jss-table-search-clear",outline:!0,onClick:()=>{fe&&(fe.value=""),ie("")}},"Reset");Q.appendChild(_.div({class:"jss-singularity jss-table-search"},_.span({class:"jss-table-search-icon","aria-hidden":"true"},"\u2315"),fe,Re))}I.forEach(Re=>Q.appendChild(Re)),(P.childNodes.length||Q.childNodes.length)&&(y.appendChild(P),y.appendChild(Q),be.appendChild(y));const b=_.div({class:"jss-singularity jss-table-chip"},""),g=_.div({class:"jss-singularity jss-table-chip"},""),T=_.div({class:"jss-singularity jss-table-chip"},""),Y=D(a,"status",{},i.status),K=_.div({class:"jss-table-status"},b,g,T,...Y);i.hideStatus!==!0&&be.appendChild(K);const _e=D(a,"caption",{},i.caption);_e.length&&be.appendChild(_.div({class:"jss-table-caption"},..._e));const J=_.thead(),A=_.tbody(),L=!!i.actions||!!a.actions,O=re(["jss-table",pe(i.dense,"dense"),pe(i.striped,"striped"),pe(i.hover!==!1,"hover"),pe(i.stickyHeader!==!1,"sticky-head"),i.tableClass]),X={...i.tableStyle||{}};i.minTableWidth!=null&&(X["--jss-table-min-width"]=vt(i.minTableWidth));const we=_.table({class:O,style:X},J,A),Be=_.div({class:"jss-singularity jss-table-wrap"},we);be.appendChild(Be);const Ue=_.div({class:"jss-singularity jss-table-chip"},""),H=_.div({class:"jss-singularity jss-table-chip"},""),W=xe.Btn({outline:!0,onClick:()=>w(Math.max(1,U()-1))},"\u2039"),ee=xe.Btn({outline:!0,onClick:()=>w(U()+1)},"\u203A"),Ne=_.div({class:"jss-singularity jss-table-chip"},""),Te=_.select({class:"jss-input jss-table-size-select"},...d.map(Re=>Vs({value:String(Re)},String(Re))));Te.value=String($()),Te.addEventListener("change",()=>ge(Te.value));const oe=D(a,"footer",{},i.footer),Pe=_.div({class:"jss-table-foot"},_.div({class:"jss-table-foot-main"},Ue,H,_.label({class:"jss-table-size"},_.span("Righe"),Te)),_.div({class:"jss-table-foot-extra"},...oe,_.div({class:"jss-table-pager"},W,Ne,ee)));i.hideFooter!==!0&&be.appendChild(Pe);const Ie=()=>{if(J.innerHTML="",i.hideHeader)return;const Re=_.tr();if(v.forEach((C,Se)=>{var Fe,F;const f={col:C,colIndex:Se,sort:te()},h={...bl(C==null?void 0:C.style,{...f,header:!0}),...bl((Fe=C==null?void 0:C.headerStyle)!=null?Fe:C==null?void 0:C.thStyle,{...f,header:!0})};(C==null?void 0:C.width)!=null&&(h.width=vt(C.width)),(C==null?void 0:C.minWidth)!=null&&(h.minWidth=vt(C.minWidth)),(C==null?void 0:C.maxWidth)!=null&&(h.maxWidth=vt(C.maxWidth)),C!=null&&C.align&&(h.textAlign=C.align);let x=D(C==null?void 0:C.slots,"header",f,null);if(!x.length){const We=typeof(C==null?void 0:C.header)=="function"?C.header(f):(F=C==null?void 0:C.header)!=null?F:po(C);x=D(a,"header",f,We)}const ae=te(),Oe=Dl(C,Se),De=(C==null?void 0:C.sortable)!==!1&&((C==null?void 0:C.key)!=null||typeof(C==null?void 0:C.get)=="function"||typeof(C==null?void 0:C.compare)=="function"),Ge=!!ae&&(ae.key===Oe||ae.key===(C==null?void 0:C.key)),Ke=_.th({class:re(["jss-table-head-cell",pe(C==null?void 0:C.nowrap,"is-nowrap"),pe(De,"jss-table-sortable"),pe(Ge,"is-sorted"),C==null?void 0:C.headerClass]),style:h});De?Ke.appendChild(_.button({type:"button",class:"jss-table-head-button",onClick:()=>ue(C,Se)},_.span({class:"jss-table-head-label"},...x),_.span({class:"jss-table-head-arrow","aria-hidden":"true"},Ge?ae.dir==="asc"?"\u2191":"\u2193":"\u2195"))):x.forEach(We=>Ke.appendChild(We)),Re.appendChild(Ke)}),L){const C=D(a,"actionsHeader",{},i.actionsLabel||"Azioni");Re.appendChild(_.th({class:"jss-table-head-cell jss-table-head-actions",style:{textAlign:"right"}},...C))}J.appendChild(Re)},Le=(Re,C)=>{const Se={columns:v,count:v.length},Fe=D(a,Re,Se,C),F=String(v.length+(L?1:0));A.appendChild(_.tr(_.td({colSpan:F,class:"jss-table-state"},...Fe)))},Ye=wt.reactive.effect(()=>{const Re=Go(i.rows),C=String(ve()||"").trim(),Se=te(),Fe=typeof i.loading=="function"?!!i.loading():!!i.loading,F=i.pagination!==!1;if(Ie(),A.innerHTML="",fe&&fe.value!==ve()&&(fe.value=ve()),Te.value!==String($())&&(Te.value=String($())),Fe){b.textContent="Caricamento in corso",g.style.display="none",T.style.display="none",Ue.textContent="Loading\u2026",H.textContent="",Ne.textContent="Pagina 1",W.disabled=!0,ee.disabled=!0,Le("loading",i.loadingText||"Loading...");return}let f=Re.slice();const h=f.length;if(typeof i.filter=="function"&&(f=f.filter((et,tt)=>i.filter(et,{row:et,index:tt,query:C,rows:Re,columns:v}))),C&&(f=f.filter(et=>qo(et,v,C,i))),Se){const et=ho(v,Se.key);et&&f.sort((tt,dt)=>{const gt=yl(et,tt,-1),At=yl(et,dt,-1),It=typeof et.compare=="function"?et.compare(gt,At,tt,dt):Uo(gt,At);return Se.dir==="asc"?It:-It})}const x=f.length,ae=Math.max(1,Number($())||z),Oe=F?Math.max(1,Math.ceil(x/ae)):1,De=F?Math.min(U(),Oe):1;De!==U()&&w(De);const Ge=F?(De-1)*ae:0,Ke=F?Ge+ae:x,We=f.slice(Ge,Ke);if(b.textContent=x===h?`${x} righe`:`${x} di ${h} righe`,g.textContent=C?`Ricerca: ${C}`:"",g.style.display=C?"":"none",Se){const et=ho(v,Se.key);T.textContent=et?`Ordine: ${po(et)} ${Se.dir==="asc"?"\u2191":"\u2193"}`:"",T.style.display=et?"":"none"}else T.style.display="none";if(Ue.textContent=x?`${Ge+1}-${Math.min(Ke,x)} di ${x}`:"0 risultati",H.textContent=x!==h?`Dataset totale ${h}`:`Page size ${ae}`,Ne.textContent=F?`Pagina ${De} / ${Oe}`:"Tutte le righe",W.disabled=!F||De<=1,ee.disabled=!F||De>=Oe,Te.disabled=!F,Te.parentNode.style.display=F?"":"none",We.length===0){Le("empty",i.emptyText||"Nessun dato");return}for(let et=0;et<We.length;et++){const tt=We[et],dt=Ge+et,gt={row:tt,rowIndex:dt,pageIndex:et},At=typeof i.rowAttrs=="function"?i.rowAttrs(tt,gt)||{}:i.rowAttrs||{},It=typeof i.rowClass=="function"?i.rowClass(tt,gt):i.rowClass,$t=!!(i.onRowClick||i.onRowDblClick),zt=_.tr({...At,class:re(["jss-table-row",It,At.class,pe($t,"is-clickable")])});if(i.rowKey){const mt=typeof i.rowKey=="function"?i.rowKey(tt,gt):Fl(tt,i.rowKey);mt!=null&&(zt.dataset.key=String(mt))}const Xe=mt=>{const Nt=mt==null?void 0:mt.target;return!!(Nt&&Nt.closest&&Nt.closest("button, a, input, select, textarea, label, [data-table-action]"))};if(i.onRowClick&&zt.addEventListener("click",mt=>{Xe(mt)||i.onRowClick(tt,gt,mt)}),i.onRowDblClick&&zt.addEventListener("dblclick",mt=>{Xe(mt)||i.onRowDblClick(tt,gt,mt)}),v.forEach((mt,Nt)=>{var Zt,rn;const qt=yl(mt,tt,dt),Yt={...gt,col:mt,colIndex:Nt,value:qt},cn={...bl(mt==null?void 0:mt.style,Yt),...bl((Zt=mt==null?void 0:mt.cellStyle)!=null?Zt:mt==null?void 0:mt.tdStyle,Yt)};mt!=null&&mt.align&&(cn.textAlign=mt.align),(mt==null?void 0:mt.width)!=null&&(cn.width=vt(mt.width)),(mt==null?void 0:mt.minWidth)!=null&&(cn.minWidth=vt(mt.minWidth)),(mt==null?void 0:mt.maxWidth)!=null&&(cn.maxWidth=vt(mt.maxWidth));const Xt=typeof(mt==null?void 0:mt.cellClass)=="function"?mt.cellClass(tt,Yt):(mt==null?void 0:mt.cellClass)||(mt==null?void 0:mt.class),Ut=_.td({class:re(["jss-table-cell",Xt,pe(mt==null?void 0:mt.nowrap,"is-nowrap")]),style:cn});let tn=D(mt==null?void 0:mt.slots,"cell",Yt,null);if(!tn.length){const ln=typeof(mt==null?void 0:mt.render)=="function"?mt.render(tt,Yt):typeof(mt==null?void 0:mt.format)=="function"?mt.format(qt,tt,Yt):qt,Xn=ln==null?(rn=mt==null?void 0:mt.emptyText)!=null?rn:"":ln;tn=D(a,"cell",Yt,Xn)}tn.length||(tn=[""]),tn.forEach(ln=>Ut.appendChild(ln)),zt.appendChild(Ut)}),L){const mt={...gt},Nt=typeof i.actions=="function"?i.actions(tt,gt):i.actions;let Zt=D(a,"actions",mt,Nt);Zt.length||(Zt=D(null,"default",mt,Nt)),zt.appendChild(_.td({class:"jss-table-cell jss-table-cell-actions",style:{textAlign:"right"}},_.div({class:"jss-table-actions"},...Zt)))}A.appendChild(zt)}},"UI.Table:render");me.body=be;const ct=xe.Card(me);return JSswift._registerCleanup(ct,Ye),M&&JSswift._registerCleanup(ct,M),ct},xe.Menu=(...e)=>{const{props:t,children:s}=JSswift.uiNormalizeArgs(e),l=t.slots||{},n=["primary","secondary","warning","danger","success","info","light","dark"],i=["xs","sm","md","lg","xl"];let c={...t},a=null,v=null,r=null,z=null,d=null;const k=(A,L)=>Object.prototype.hasOwnProperty.call(A||{},L),N=(A,L)=>typeof A=="function"?A(L):A,p=A=>String(A||"").split(/\s+/).filter(Boolean),U=A=>A&&typeof A=="object"&&!A.nodeType&&!Array.isArray(A)&&!(A instanceof Function),w=A=>!!A&&typeof A=="object"&&(A.nodeType===1||typeof A.getBoundingClientRect=="function"),$=()=>{clearTimeout(z),clearTimeout(d),z=null,d=null},B=(A,L,O)=>{if(!A)return;const X=A[L]||[];X.length&&A.classList.remove(...X);const we=(O||[]).filter(Boolean);we.length&&A.classList.add(...we),A[L]=we},te=(A,L,O,X=we=>we)=>{if(A){if(O==null||O===""){A.style.removeProperty(L);return}A.style.setProperty(L,X(O))}},E=()=>c||{},ve=A=>{var L;const O=String(o((L=A.state)!=null?L:A.color)||"").toLowerCase();return n.includes(O)?O:""},le=A=>{const L=String(o(A.size)||"").toLowerCase();return i.includes(L)?L:""},ie=A=>{var L,O;return String(o((O=(L=A.placement)!=null?L:A.position)!=null?O:"bottom-start"))},ge=()=>{var A;const L=o((A=E().delay)!=null?A:E().showDelay),O=Number(L);return Number.isFinite(O)?Math.max(0,O):0},ue=()=>{const A=o(E().hideDelay),L=Number(A);return Number.isFinite(L)?Math.max(0,L):80},fe=(A=null)=>{var L,O,X;if(A)return A;const we=E();return v||o((X=(O=(L=we.anchorEl)!=null?L:we.triggerEl)!=null?O:we.target)!=null?X:we.anchor)||null},M=A=>{if(A==null||A===!0)return new Set(["click"]);if(A===!1)return new Set(["manual"]);const L=Array.isArray(A)?A:String(A).split(/[\s,|/]+/),O=new Set;return L.forEach(X=>{const we=String(X||"").trim().toLowerCase();we&&(we==="mouseenter"||we==="mouseover"?O.add("hover"):we==="blur"||we==="focusin"?O.add("focus"):we==="tap"?O.add("click"):O.add(we))}),O.size?O:new Set(["manual"])},me=(A,L)=>{var O,X,we;let Be=null,Ue=null;if(w(A))Be=A,U(L)&&(Ue=L);else if(U(A)){Ue=A;const H=(we=(X=(O=A.anchorEl)!=null?O:A.triggerEl)!=null?X:A.target)!=null?we:A.anchor;w(H)&&(Be=H)}else A!=null&&(Be=A);return{anchorEl:Be,nextProps:Ue}},be=(A=a==null?void 0:a.panel)=>{var L;return Array.from(((L=A==null?void 0:A.querySelectorAll)==null?void 0:L.call(A,"[data-menu-item]:not([disabled]):not([tabindex='-1']), .jss-menu-item:not([disabled]):not([tabindex='-1']), [role='menuitem']:not([disabled]):not([tabindex='-1']), a[href]:not([tabindex='-1']), button:not([disabled]):not([tabindex='-1'])"))||[]).filter(O=>O.offsetParent!==null&&O.getAttribute("aria-hidden")!=="true")},de=()=>{o(E().autoFocus)!==!1&&setTimeout(()=>{const A=be();if(!A.length)return;(A.find(O=>O.classList.contains("is-active")||O.classList.contains("is-selected")||O.classList.contains("is-checked"))||A[0]).focus()},0)},Z=(A,L,O="sm")=>{const X=N(A,L);return X==null?[]:typeof X=="string"?[xe.Icon({name:X,size:O})]:Bs(X,{...L,as:"icon"})},j=(A,L)=>{var O,X,we,Be,Ue,H,W,ee,Ne,Te,oe,Pe,Ie;const Le=N(A,L);if(Le==null||Le===!1)return[];if(Array.isArray(Le))return Le.flatMap((zt,Xe)=>j(zt,{...L,index:Xe}));if(typeof Le=="function")return j(Le(L),L);if(Le!=null&&Le.nodeType)return[Le];if(typeof Le=="string"||typeof Le=="number")return j({label:Le},L);if(!U(Le))return Bs(Le,{...L,as:"item"});const Ye=String((X=(O=Le.type)!=null?O:Le.kind)!=null?X:"").toLowerCase();if(Ye==="separator"||Ye==="divider"||Le.separator===!0||Le.divider===!0)return[_.div({class:"jss-menu-divider",role:"separator"})];const ct=(we=Le.items)!=null?we:Le.children;if((Ye==="group"||Ye==="section"||Array.isArray(ct))&&ct!=null){const zt={...L,item:Le},Xe=D(l,"groupLabel",zt,N((Be=Le.label)!=null?Be:Le.title,zt)),mt=j(ct,zt);return mt.length?[_.div({class:re(["jss-menu-group",Le.class])},Xe.length?_.div({class:"jss-menu-group-label"},...Xe):null,_.div({class:"jss-menu-group-items"},...mt))]:[]}const Re={...L,item:Le,close:Q,dismiss:Q,open:b,toggle:Y,update:m,isOpen:K,entry:()=>a,anchorEl:fe(),props:E()},C=!!o(Le.disabled),Se=Le.checked==null?null:!!o(Le.checked),Fe=!!o((Ue=Le.active)!=null?Ue:Le.selected),F=ve(Le),f=o(Le.href),h=o(Le.to),x=k(Le,"closeOnSelect")?!!o(Le.closeOnSelect):Le.keepOpen===!0?!1:E().closeOnSelect!==!1,ae=Le.role||(Se!=null?"menuitemcheckbox":"menuitem"),Oe=Z(Le.icon,Re),De=Z((H=Le.iconRight)!=null?H:Le.endIcon,Re),Ge=D(l,"itemTitle",Re,N((W=Le.title)!=null?W:Le.label,Re)),Ke=D(l,"itemSubtitle",Re,N((ee=Le.subtitle)!=null?ee:Le.description,Re)),We=D(l,"itemShortcut",Re,N(Le.shortcut,Re)),et=D(l,"itemBadge",Re,N(Le.badge,Re)),tt=D(l,"item",Re,N((Te=(Ne=Le.content)!=null?Ne:Le.body)!=null?Te:Le.render,Re)),dt=[...et,...We,...Se===!0&&!De.length&&!et.length?[_.span({class:"jss-menu-entry-check"},xe.Icon({name:Le.checkedIcon||"check",size:"sm"}))]:[],...De],At={class:re(["jss-menu-entry","jss-menu-item",F?`jss-state-${F}`:"",pe(Fe,"is-active"),pe(Se===!0,"is-checked"),pe(C,"is-disabled"),Le.class]),role:ae,tabIndex:C?-1:(oe=Le.tabIndex)!=null?oe:-1,"data-menu-item":!0,"data-menu-select":x?"true":"false","data-menu-close":Le.close===!0?"true":null,"data-menu-keep-open":x?null:"true","aria-disabled":C?"true":null,"aria-checked":Se==null?null:String(Se),title:(Ie=(Pe=Le.titleAttr)!=null?Pe:Le.tooltip)!=null?Ie:null,type:f?null:"button",href:f||null,target:Le.target||null,rel:Le.rel||(Le.target==="_blank"?"noopener noreferrer":null),onClick:zt=>{var Xe,mt,Nt,Zt;if(C){zt.preventDefault(),zt.stopPropagation();return}(mt=(Xe=E()).onItemClick)==null||mt.call(Xe,Le,Re,zt);const rn=(Nt=Le.onClick)==null?void 0:Nt.call(Le,Re,zt);zt.defaultPrevented||(h&&((Zt=JSswift.router)!=null&&Zt.navigate)&&(zt.preventDefault(),JSswift.router.navigate(h)),rn!==!1&&x&&Q())}};Le.attrs&&typeof Le.attrs=="object"&&Object.assign(At,Le.attrs);const It=f?_.a:_.button,$t=tt.length?tt:[Ge.length?_.div({class:"jss-menu-entry-title"},...Ge):null,Ke.length?_.div({class:"jss-menu-entry-subtitle"},...Ke):null].filter(Boolean);return[It(At,Oe.length?_.span({class:"jss-menu-entry-icon"},...Oe):null,_.span({class:"jss-menu-entry-main"},...$t),dt.length?_.span({class:"jss-menu-entry-aside"},...dt):null)]},I=()=>{var A,L,O,X,we,Be,Ue;const H=E(),W={close:Q,dismiss:Q,open:b,toggle:Y,update:m,isOpen:K,entry:()=>a,anchorEl:fe(),props:H},ee=Z(H.icon,W,H.iconSize||"md"),Ne=D(l,"eyebrow",W,N(H.eyebrow,W)),Te=D(l,"title",W,N((L=(A=H.title)!=null?A:H.heading)!=null?L:H.label,W)),oe=D(l,"subtitle",W,N((O=H.subtitle)!=null?O:H.description,W)),Pe=D(l,"before",W,N(H.before,W)),Ie=D(l,"header",W,N(H.header,W)),Le=D(l,"after",W,N(H.after,W)),Ye=D(l,"footer",W,N(H.footer,W)),ct=D(l,"status",W,N(H.status,W));let Re=(X=H.content)!=null?X:H.body;Re==null&&s&&s.length&&(Re=s);let C=D(l,"content",W,N(Re,W));C.length||(C=D(l,"body",W,N(Re,W))),C.length||(C=D(l,"default",W,N(Re,W)));const Se=j((Be=(we=H.items)!=null?we:H.actionsList)!=null?Be:H.entries,W),Fe=Se.length?[]:D(l,"empty",W,N((Ue=H.empty)!=null?Ue:H.emptyText,W));let F=null;return Ie.length?F=_.div({class:re(["jss-menu-head","jss-menu-head-custom",H.headerClass])},...Ie):(ee.length||Ne.length||Te.length||oe.length)&&(F=_.div({class:re(["jss-menu-head",H.headerClass])},ee.length?_.div({class:"jss-menu-head-icon"},...ee):null,_.div({class:"jss-menu-head-main"},Ne.length?_.div({class:"jss-menu-eyebrow"},...Ne):null,Te.length?_.div({class:"jss-menu-title"},...Te):null,oe.length?_.div({class:"jss-menu-subtitle"},...oe):null))),_.div({class:re(["jss-menu","jss-menu-shell",pe(H.dense,"dense"),pe(Se.length>0,"has-items"),pe(Ye.length>0||ct.length>0,"has-footer"),H.class]),style:H.style||{},role:H.role||"menu","aria-label":H.ariaLabel||null},Pe.length?_.div({class:"jss-menu-before"},...Pe):null,F,C.length?_.div({class:re(["jss-menu-content",H.contentClass])},...C):null,Se.length?_.div({class:re(["jss-menu-items",H.itemsClass])},...Se):null,!Se.length&&Fe.length?_.div({class:"jss-menu-empty"},...Fe):null,Le.length?_.div({class:"jss-menu-after"},...Le):null,ct.length||Ye.length?_.div({class:re(["jss-menu-footer",H.footerClass])},ct.length?_.div({class:"jss-menu-status"},...ct):null,Ye.length?_.div({class:"jss-menu-footer-actions"},...Ye):null):null)},y=A=>{var L;if(!(A!=null&&A.panel))return;const O=E(),X=ve(O),we=le(O);B(A.panel,"_menuClassTokens",["jss-menu-panel","jss-clear-set","jss-singularity",we?`jss-menu-${we}`:"",X?`jss-state-${X}`:"",o(O.outline)?"outline":"",...p(O.panelClass)]),B(A.overlay,"_menuOverlayClassTokens",[...p(O.overlayClass)]),A.panel.dataset.placement=ie(O),te(A.panel,"--jss-menu-width",o(O.width),vt),te(A.panel,"--jss-menu-min-width",o(O.minWidth),vt),te(A.panel,"--jss-menu-max-width",o(O.maxWidth),vt),te(A.panel,"--jss-menu-max-height",o(O.maxHeight),vt),te(A.panel,"--jss-menu-body-max-height",o((L=O.bodyMaxHeight)!=null?L:O.contentMaxHeight),vt),O.panelStyle&&Object.assign(A.panel.style,O.panelStyle),Et(A.panel,O)},P=()=>{a!=null&&a.panel&&a.panel.replaceChildren(I())},Q=()=>{if($(),!a)return;const A=a;a=null,Ns(A,()=>JSswift.overlay.close(A.id))},m=(A={})=>{var L,O,X,we;if(A&&typeof A=="object"&&(c={...c,...A}),a){const Be=E();y(a),P(),(we=a.reposition)==null||we.call(a,{anchorEl:a._anchorEl,placement:ie(Be),offsetX:(L=Be.offsetX)!=null?L:0,offsetY:(X=(O=Be.offsetY)!=null?O:Be.offset)!=null?X:8}),de()}return J},b=(A=null,L=null)=>{var O,X,we,Be,Ue,H,W,ee,Ne,Te,oe,Pe,Ie,Le,Ye,ct;$();const{anchorEl:Re,nextProps:C}=me(A,L);C&&(c={...c,...C});const Se=E(),Fe=fe(Re);if(!Fe||o(Se.disabled))return null;if(a&&a._anchorEl===Fe){const We=E();return y(a),P(),(Be=a.reposition)==null||Be.call(a,{anchorEl:a._anchorEl,placement:ie(We),offsetX:(O=We.offsetX)!=null?O:0,offsetY:(we=(X=We.offsetY)!=null?X:We.offset)!=null?we:8}),de(),a}a&&Q(),r=document.activeElement;let F=null;if(a=JSswift.overlay.open(()=>I(),{type:"menu",anchorEl:Fe,placement:ie(Se),offsetX:(Ue=Se.offsetX)!=null?Ue:0,offsetY:(W=(H=Se.offsetY)!=null?H:Se.offset)!=null?W:8,backdrop:Se.backdrop===!0,lockScroll:Se.lockScroll===!0,trapFocus:Se.trapFocus===!0,autoFocus:!1,closeOnOutside:Se.closeOnOutside!==!1,closeOnBackdrop:(ee=Se.closeOnBackdrop)!=null?ee:Se.backdrop===!0,closeOnEsc:Se.closeOnEsc!==!1,className:Bt(["jss-menu-panel"]),onClose:()=>{var We,et,tt;(We=F==null?void 0:F._menuCleanup)==null||We.call(F),(tt=(et=E()).onClose)==null||tt.call(et,F),E().returnFocus!==!1&&r&&typeof r.focus=="function"&&setTimeout(()=>r.focus(),0)}}),!(a!=null&&a.panel))return a;const f=a;F=f,f._anchorEl=Fe;const h=()=>{clearTimeout(d),d=null},x=()=>{T()},ae=We=>{const et=We.target;if(!et||!et.closest)return;if(et.closest("[data-menu-close]")){Q();return}if(E().closeOnSelect===!1)return;const tt=et.closest("[data-menu-item], [data-menu-select], .jss-menu-item, [role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio'], a[href], button:not([disabled])");tt&&(tt.closest("[data-menu-keep-open]")||tt.getAttribute("data-menu-select")!=="false"&&Q())},Oe=We=>{if(We.key==="Escape"){We.preventDefault(),Q();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(We.key))return;const et=be(f.panel);if(!et.length)return;We.preventDefault();const tt=et.indexOf(document.activeElement);if(We.key==="Home"){et[0].focus();return}if(We.key==="End"){et[et.length-1].focus();return}const dt=We.key==="ArrowDown"?1:-1,gt=tt<0?dt>0?0:et.length-1:(tt+dt+et.length)%et.length;et[gt].focus()};f.panel.addEventListener("click",ae),f.panel.addEventListener("keydown",Oe);const De=M((Te=(Ne=Se.trigger)!=null?Ne:Se.triggers)!=null?Te:k(Se,"open")?"manual":null),Ge=De.has("hover"),Ke=De.has("focus");return(Ge||Ke)&&(f.panel.addEventListener("mouseenter",h),f.panel.addEventListener("mouseleave",x),f.panel.addEventListener("focusin",h),f.panel.addEventListener("focusout",x)),f._menuCleanup=()=>{var We,et,tt,dt,gt,At;(We=f.panel)==null||We.removeEventListener("click",ae),(et=f.panel)==null||et.removeEventListener("keydown",Oe),(tt=f.panel)==null||tt.removeEventListener("mouseenter",h),(dt=f.panel)==null||dt.removeEventListener("mouseleave",x),(gt=f.panel)==null||gt.removeEventListener("focusin",h),(At=f.panel)==null||At.removeEventListener("focusout",x)},y(f),(Le=f.reposition)==null||Le.call(f,{anchorEl:Fe,placement:ie(Se),offsetX:(oe=Se.offsetX)!=null?oe:0,offsetY:(Ie=(Pe=Se.offsetY)!=null?Pe:Se.offset)!=null?Ie:8}),ks(f),(ct=(Ye=E()).onOpen)==null||ct.call(Ye,f),de(),f},g=(A,L=null)=>{clearTimeout(d),d=null,clearTimeout(z),z=setTimeout(()=>b(A,L),ge())},T=(A=!1)=>{if(clearTimeout(z),z=null,!!a){if(clearTimeout(d),A){Q();return}d=setTimeout(()=>Q(),ue())}},Y=(A=null,L=null)=>K()?(Q(),null):b(A,L),K=()=>!!a,J={open:b,close:Q,show:g,hide:T,toggle:Y,update:m,bind:A=>{var L,O;if(!A)return()=>{};v=A;const X=E(),we=M((O=(L=X.trigger)!=null?L:X.triggers)!=null?O:k(X,"open")?"manual":null),Be=we.has("hover"),Ue=we.has("focus"),H=we.has("click"),W=we.has("manual")||!Be&&!Ue&&!H,ee=[],Ne=()=>{$(),ee.forEach(Te=>Te()),v===A&&(v=null)};if(k(X,"open"))return ht(X.open)?JSswift.reactive.effect(()=>{v&&(o(E().open)?b(v):T(!0))},"UI.Menu:open"):X.open===!0?b(A):X.open===!1&&T(!0),Ne;if(W||o(X.disabled))return Ne;if(Be){const Te=()=>g(A),oe=()=>T();A.addEventListener("mouseenter",Te),A.addEventListener("mouseleave",oe),ee.push(()=>{A.removeEventListener("mouseenter",Te),A.removeEventListener("mouseleave",oe)})}if(Ue){const Te=()=>g(A),oe=()=>T();A.addEventListener("focus",Te),A.addEventListener("blur",oe),ee.push(()=>{A.removeEventListener("focus",Te),A.removeEventListener("blur",oe)})}if(H){const Te=oe=>{var Pe,Ie;(Ie=(Pe=E()).onTriggerClick)==null||Ie.call(Pe,oe),!oe.defaultPrevented&&Y(A)};A.addEventListener("click",Te),ee.push(()=>A.removeEventListener("click",Te))}return Ne},isOpen:K,entry:()=>a,props:()=>({...c})};return J},xe.Popover=(...e)=>{const{props:t,children:s}=JSswift.uiNormalizeArgs(e),l=t.slots||{},n=["primary","secondary","warning","danger","success","info","light","dark"],i=["xs","sm","md","lg","xl"];let c={...t},a=null,v=null,r=null,z=null,d=null;const k=(J,A)=>Object.prototype.hasOwnProperty.call(J||{},A),N=(J,A)=>typeof J=="function"?J(A):J,p=J=>String(J||"").split(/\s+/).filter(Boolean),U=J=>J&&typeof J=="object"&&!J.nodeType&&!Array.isArray(J)&&!(J instanceof Function),w=J=>!!J&&typeof J=="object"&&(J.nodeType===1||typeof J.getBoundingClientRect=="function"),$=()=>{clearTimeout(z),clearTimeout(d),z=null,d=null},B=(J,A,L)=>{if(!J)return;const O=J[A]||[];O.length&&J.classList.remove(...O);const X=(L||[]).filter(Boolean);X.length&&J.classList.add(...X),J[A]=X},te=(J,A,L,O=X=>X)=>{if(J){if(L==null||L===""){J.style.removeProperty(A);return}J.style.setProperty(A,O(L))}},E=()=>c,ve=J=>{var A;const L=o((A=J.state)!=null?A:J.color);return L?n.includes(L)?L:String(L):""},le=J=>{const A=o(J.size);return typeof A=="string"&&i.includes(A)?A:""},ie=J=>{var A,L,O;const X=String(o((O=(L=(A=J.actionsAlign)!=null?A:J.footerAlign)!=null?L:J.alignActions)!=null?O:"end")).toLowerCase();return["start","left"].includes(X)?"start":["center","middle"].includes(X)?"center":["between","space-between"].includes(X)?"between":["stretch","full"].includes(X)?"stretch":"end"},ge=J=>{var A,L;return String(o((L=(A=J.placement)!=null?A:J.position)!=null?L:"bottom-start"))},ue=(J,A)=>{const L=o(J);if(L==null||L==="")return A;const O=Number(L);return Number.isFinite(O)?O:A},fe=()=>ue(E().delay,0),M=()=>ue(E().hideDelay,120),me=J=>{var A,L;return((L=(A=J.closable)!=null?A:J.dismissible)!=null?L:J.closeButton)===!0},be=(J=null)=>{var A,L,O;if(J)return J;const X=E();return v||o((O=(L=(A=X.anchorEl)!=null?A:X.triggerEl)!=null?L:X.target)!=null?O:X.anchor)||null},de=J=>{if(J==null||J===!0)return new Set(["click"]);if(J===!1)return new Set(["manual"]);const A=Array.isArray(J)?J:String(J).split(/[\s,|/]+/),L=new Set;return A.forEach(O=>{const X=String(O||"").trim().toLowerCase();X&&(X==="mouseenter"||X==="mouseover"?L.add("hover"):X==="blur"||X==="focusin"?L.add("focus"):X==="tap"?L.add("click"):L.add(X))}),L.size?L:new Set(["manual"])},Z=(J,A)=>{var L,O,X;let we=null,Be=null;if(w(J))we=J,U(A)&&(Be=A);else if(U(J)){Be=J;const Ue=(X=(O=(L=J.anchorEl)!=null?L:J.triggerEl)!=null?O:J.target)!=null?X:J.anchor;w(Ue)&&(we=Ue)}else J!=null&&(we=J);return{anchorEl:we,nextProps:Be}},j=()=>{var J,A,L,O,X,we,Be,Ue,H;const W=E(),ee={close:P,dismiss:P,open:m,toggle:T,update:Q,isOpen:Y,entry:()=>a,anchorEl:be(),props:W},Ne=W.icon!=null?typeof W.icon=="string"?xe.Icon({name:W.icon,size:W.iconSize||"md"}):JSswift.ui.slot(W.icon,{as:"icon"}):null,Te=D(l,"eyebrow",ee,N(W.eyebrow,ee)),oe=D(l,"title",ee,N((A=(J=W.title)!=null?J:W.heading)!=null?A:W.label,ee)),Pe=D(l,"subtitle",ee,N((L=W.subtitle)!=null?L:W.description,ee)),Ie=D(l,"icon",ee,Ne),Le=D(l,"header",ee,N((X=(O=W.headerContent)!=null?O:W.head)!=null?X:W.header,ee)),Ye=me(W)?D(l,"close",ee,xe.Btn({class:"jss-dialog-close",size:"sm",outline:!0,"aria-label":W.closeLabel||"Chiudi popover","data-popover-close":!0},xe.Icon({name:W.closeIcon||"close",size:"sm"}))):[];let ct=(Ue=(Be=(we=W.content)!=null?we:W.body)!=null?Be:W.message)!=null?Ue:W.text;ct==null&&s&&s.length&&(ct=s);let Re=D(l,"content",ee,N(ct,ee));Re.length||(Re=D(l,"body",ee,N(ct,ee))),Re.length||(Re=D(l,"default",ee,N(ct,ee)));const C=N((H=W.footer)!=null?H:W.actions,ee);let Se=D(l,"footer",ee,C);Se.length||(Se=D(l,"actions",ee,C));let Fe=null;Le.length?Fe=_.div({class:"jss-dialog-head jss-dialog-head-custom"},...Le):(Te.length||oe.length||Pe.length||Ie.length||Ye.length)&&(Fe=_.div({class:"jss-dialog-head"},Ie.length?_.div({class:"jss-dialog-icon"},...Ie):null,_.div({class:"jss-dialog-head-main"},Te.length?_.div({class:"jss-dialog-eyebrow"},...Te):null,oe.length?_.div({class:"jss-dialog-title"},...oe):null,Pe.length?_.div({class:"jss-dialog-subtitle"},...Pe):null),Ye.length?_.div({class:"jss-dialog-close-wrap"},...Ye):null));const F=[];return Fe&&F.push(Fe),Re.length&&F.push(_.div({class:re(["jss-dialog-body",W.bodyClass])},...Re)),Se.length&&F.push(_.div({class:re(["jss-dialog-actions",`is-${ie(W)}`,pe(W.stackActions,"is-stacked"),W.actionsClass,W.footerClass])},...Se)),F.length||F.push(_.div({class:re(["jss-dialog-body",W.bodyClass])})),_.div({class:re(["jss-dialog-shell","jss-popover-shell",pe(!!Fe,"has-head"),pe(Se.length>0,"has-footer"),pe(W.divider!==!1,"with-divider")])},...F)},I=J=>{var A;if(!(J!=null&&J.panel))return;const L=E(),O=ve(L),X=le(L);B(J.panel,"_popoverClassTokens",["jss-dialog","jss-popover","jss-singularity","jss-clear-set",X?`jss-dialog-${X}`:"",O,O?`jss-state-${O}`:"",o(L.scrollable)?"scrollable":"",o(L.stickyHeader)?"sticky-head":"",o(L.stickyActions)?"sticky-actions":"",o(L.borderless)?"borderless":"",...p(L.class),...p(L.panelClass)]),B(J.overlay,"_popoverOverlayClassTokens",[...p(L.overlayClass)]),J.panel.dataset.placement=ge(L),te(J.panel,"--jss-dialog-width",o(L.width),vt),te(J.panel,"--jss-dialog-min-width",o(L.minWidth),vt),te(J.panel,"--jss-dialog-max-width",o(L.maxWidth),vt),te(J.panel,"--jss-dialog-max-height",o(L.maxHeight),vt),te(J.panel,"--jss-dialog-body-max-height",o((A=L.bodyMaxHeight)!=null?A:L.contentMaxHeight),vt),L.style&&Object.assign(J.panel.style,L.style),Et(J.panel,L),J.panel.setAttribute("role",L.role||"dialog"),J.panel.setAttribute("aria-modal",L.modal===!0?"true":"false"),L.ariaLabel?J.panel.setAttribute("aria-label",L.ariaLabel):J.panel.removeAttribute("aria-label")},y=()=>{a!=null&&a.panel&&a.panel.replaceChildren(j())},P=()=>{if($(),!a)return;const J=a;a=null,Ns(J,()=>JSswift.overlay.close(J.id))},Q=(J={})=>(J&&typeof J=="object"&&(c={...c,...J}),a&&(I(a),y()),_e),m=(J=null,A=null)=>{var L,O,X,we,Be,Ue,H,W;$();const{anchorEl:ee,nextProps:Ne}=Z(J,A);Ne&&(c={...c,...Ne});const Te=E(),oe=be(ee);if(!oe||o(Te.disabled))return null;if(a&&a._anchorEl===oe)return I(a),y(),a;a&&P(),r=document.activeElement;const Pe=de((O=(L=Te.trigger)!=null?L:Te.triggers)!=null?O:k(Te,"open")?"manual":null),Ie=Pe.has("hover"),Le=Pe.has("focus");let Ye=null;if(a=JSswift.overlay.open(()=>j(),{type:"popover",anchorEl:oe,placement:ge(Te),offsetX:(X=Te.offsetX)!=null?X:0,offsetY:(Be=(we=Te.offsetY)!=null?we:Te.offset)!=null?Be:10,backdrop:Te.backdrop===!0,lockScroll:Te.lockScroll===!0,trapFocus:Te.trapFocus===!0,autoFocus:Te.autoFocus===!0,closeOnOutside:Te.closeOnOutside!==!1,closeOnBackdrop:(Ue=Te.closeOnBackdrop)!=null?Ue:Te.backdrop===!0,closeOnEsc:Te.closeOnEsc!==!1,className:Bt(["jss-dialog","jss-popover"]),onClose:()=>{var Fe,F,f;(Fe=Ye==null?void 0:Ye._popoverCleanup)==null||Fe.call(Ye),(f=(F=E()).onClose)==null||f.call(F,Ye),E().returnFocus!==!1&&r&&typeof r.focus=="function"&&setTimeout(()=>r.focus(),0)}}),!(a!=null&&a.panel))return a;const ct=a;Ye=ct,ct._anchorEl=oe;const Re=()=>{clearTimeout(d),d=null},C=()=>{!Ie&&!Le||g()},Se=Fe=>{const F=Fe.target;if(!(!F||!F.closest)){if(F.closest("[data-popover-close]")||F.closest("[data-dialog-close]")){P();return}E().closeOnSelect===!0&&F.closest("[data-popover-select]")&&P()}};return ct.panel.addEventListener("click",Se),(Ie||Le)&&(ct.panel.addEventListener("mouseenter",Re),ct.panel.addEventListener("mouseleave",C),ct.panel.addEventListener("focusin",Re),ct.panel.addEventListener("focusout",C)),ct._popoverCleanup=()=>{var Fe,F,f,h,x;(Fe=ct.panel)==null||Fe.removeEventListener("click",Se),(F=ct.panel)==null||F.removeEventListener("mouseenter",Re),(f=ct.panel)==null||f.removeEventListener("mouseleave",C),(h=ct.panel)==null||h.removeEventListener("focusin",Re),(x=ct.panel)==null||x.removeEventListener("focusout",C)},I(ct),ks(ct),(W=(H=E()).onOpen)==null||W.call(H,ct),ct},b=(J,A=null)=>{clearTimeout(d),d=null,clearTimeout(z),z=setTimeout(()=>m(J,A),fe())},g=(J=!1)=>{if(clearTimeout(z),z=null,!!a){if(clearTimeout(d),J){P();return}d=setTimeout(()=>P(),M())}},T=(J=null,A=null)=>Y()?(P(),null):m(J,A),Y=()=>!!a,_e={open:m,close:P,show:b,hide:g,toggle:T,update:Q,bind:J=>{var A,L;if(!J)return()=>{};v=J;const O=E(),X=de((L=(A=O.trigger)!=null?A:O.triggers)!=null?L:k(O,"open")?"manual":null),we=X.has("hover"),Be=X.has("focus"),Ue=X.has("click"),H=X.has("manual")||!we&&!Be&&!Ue,W=[],ee=()=>{$(),W.forEach(Ne=>Ne()),v===J&&(v=null)};if(k(O,"open"))return ht(O.open)?JSswift.reactive.effect(()=>{v&&(o(E().open)?m(v):g(!0))},"UI.Popover:open"):O.open===!0?m(J):O.open===!1&&g(!0),ee;if(H||o(O.disabled))return ee;if(we){const Ne=()=>b(J),Te=()=>g();J.addEventListener("mouseenter",Ne),J.addEventListener("mouseleave",Te),W.push(()=>{J.removeEventListener("mouseenter",Ne),J.removeEventListener("mouseleave",Te)})}if(Be){const Ne=()=>b(J),Te=()=>g();J.addEventListener("focus",Ne),J.addEventListener("blur",Te),W.push(()=>{J.removeEventListener("focus",Ne),J.removeEventListener("blur",Te)})}if(Ue){const Ne=Te=>{var oe,Pe;(Pe=(oe=E()).onTriggerClick)==null||Pe.call(oe,Te),!Te.defaultPrevented&&T(J)};J.addEventListener("click",Ne),W.push(()=>J.removeEventListener("click",Ne))}return ee},isOpen:Y,entry:()=>a,props:()=>({...c})};return _e},xe.ContextMenu=(...e)=>{const{props:t,children:s}=JSswift.uiNormalizeArgs(e);let l={...t},n=null,i=null,c=null;const a=y=>y&&typeof y=="object"&&!y.nodeType&&!Array.isArray(y)&&!(y instanceof Function),v=y=>!!y&&typeof y=="object"&&(y.nodeType===1||typeof y.getBoundingClientRect=="function"),r=y=>!!y&&typeof y=="object"&&("clientX"in y||"type"in y||"target"in y||"currentTarget"in y),z=y=>!!y&&Number.isFinite(Number(y.x))&&Number.isFinite(Number(y.y)),d=()=>l,k=(y,P)=>{const Q=Number(y),m=Number(P);return!Number.isFinite(Q)||!Number.isFinite(m)?null:{x:Q,y:m}},N=y=>y?{_jssContextPoint:y,getBoundingClientRect:()=>({top:y.y,bottom:y.y,left:y.x,right:y.x,width:0,height:0})}:null,p=y=>{if(!v(y))return null;const P=y.getBoundingClientRect();return k(P.left+Math.min(P.width/2,24),P.top+Math.min(P.height/2,24))},U=y=>{var P,Q,m,b;return o((b=(m=(Q=(P=y==null?void 0:y.anchorEl)!=null?P:y==null?void 0:y.triggerEl)!=null?Q:y==null?void 0:y.target)!=null?m:y==null?void 0:y.anchor)!=null?b:null)},w=(y,P=null)=>{if(!y)return p(P||c);const Q=k(y.clientX,y.clientY);if(Q)return Q;const m=U({anchorEl:P||y.currentTarget||y.target||c});return p(m)},$=(y={})=>{if(!a(y))return{};const P={...y};return delete P.event,delete P.point,delete P.x,delete P.y,P},B=()=>{var y,P,Q;const m=d();return{...m,trigger:"manual",placement:m.placement||"bottom-start",offsetX:(y=m.offsetX)!=null?y:0,offsetY:(Q=(P=m.offsetY)!=null?P:m.offset)!=null?Q:4,closeOnOutside:m.closeOnOutside!==!1,closeOnEsc:m.closeOnEsc!==!1,role:m.role||"menu",ariaLabel:m.ariaLabel||m.title||"Context menu",class:re(["jss-context-menu-shell",m.class]),panelClass:re(["jss-context-menu-panel",m.panelClass])}},te=xe.Menu(B(),...s),E=(y=null,P=null,Q=null)=>{let m=null,b=null,g=null;if(r(y))m=w(y,c),g=a(P)?$(P):null;else if(typeof y=="number"||typeof P=="number")m=k(y,P),g=a(Q)?$(Q):null;else if(z(y))m=k(y.x,y.y),g=a(P)?$(P):null;else if(v(y))b=y,g=a(P)?$(P):null;else if(a(y)){const T=z(y.point)?y.point:z(y)?y:null,Y=U(y),K=y.event;m=T?k(T.x,T.y):w(K,Y||c),b=Y&&v(Y)?Y:null,g={...$(y),...a(P)?$(P):{}}}else n&&(m={...n});return{point:m,anchor:b,nextProps:g}},ve=(y,P=null)=>{i=y||i,n=P||y&&y._jssContextPoint||n},le=(y=null)=>{a(y)&&Object.keys(y).length&&(l={...l,...y})},ie=(y=null,P=null)=>{if(P)return N(P);if(y&&v(y))return y;const Q=U(d());return v(Q)?Q:n?N(n):v(i)?i:v(c)?c:null},ge=(y=null,P=null,Q=null)=>{const{point:m,anchor:b,nextProps:g}=E(y,P,Q);le(g);const T=ie(b,m);return T?(ve(T,m),te.open(T,B())):null},ue=(y,P,Q=null)=>ge(y,P,Q),fe=(y,P=null)=>ge(y,P),M=()=>(te.close(),I),me=(y=!0)=>(y===!1?te.hide(!1):te.close(),I),be=(y=null,P=null,Q=null)=>ge(y,P,Q),de=(y=null,P=null,Q=null)=>te.isOpen()?(M(),null):ge(y,P,Q),Z=(y={})=>(le($(y)),te.update(B()),I),I={open:ge,openAt:ue,openFromEvent:fe,show:be,hide:me,close:M,toggle:de,update:Z,bind:(y,P=null)=>{if(!y)return()=>{};const Q=a(P)?$(P):null,m=g=>{var T,Y;c=y,g.preventDefault(),!(((Y=(T=d()).onTrigger)==null?void 0:Y.call(T,g,{element:y,open:ge,close:M,update:Z}))===!1||o(d().disabled))&&ge({event:g,anchorEl:y},Q)},b=g=>{var T,Y;g.key!=="ContextMenu"&&!(g.shiftKey&&g.key==="F10")||(c=y,g.preventDefault(),((Y=(T=d()).onTrigger)==null?void 0:Y.call(T,g,{element:y,open:ge,close:M,update:Z}))===!1||o(d().disabled))||ge({event:g,anchorEl:y},Q)};return y.addEventListener("contextmenu",m),y.addEventListener("keydown",b),()=>{y.removeEventListener("contextmenu",m),y.removeEventListener("keydown",b)}},isOpen:te.isOpen,entry:te.entry,props:()=>({...l})};return I}})(JSswift);
@@ -0,0 +1,330 @@
1
+ // ===============================
2
+ // JSswift UI Kit MVP
3
+ // ===============================
4
+ (function initJSswiftUI(app) {
5
+ app.ui = app.ui || {};
6
+ app.services = app.services || {};
7
+ app.services.notify = app.services.notify || {};
8
+
9
+ const uiRodPathRaw = Symbol("jss.ui.rodPathRaw");
10
+ const uiRodPathEnhanced = Symbol("jss.ui.rodPathEnhanced");
11
+ const uiRodPathPatchedH = Symbol("jss.ui.rodPathPatchedH");
12
+ const uiRodPathWrappedUI = Symbol("jss.ui.rodPathWrappedUI");
13
+ const uiRodPathAccess = new WeakMap();
14
+ const uiRodPathProxyCache = new WeakMap();
15
+ const uiWrappedFunctionCache = new WeakMap();
16
+ const uiRodPathReadBuffer = [];
17
+ const uiIsIndexKey = (key) => {
18
+ if (typeof key === "number") return Number.isInteger(key) && key >= 0;
19
+ if (typeof key !== "string" || key === "") return false;
20
+ if (key[0] === "-" || key.includes(".")) return false;
21
+ const num = Number(key);
22
+ return Number.isInteger(num) && num >= 0 && String(num) === key;
23
+ };
24
+ const uiTrackablePrimitive = (v) => {
25
+ const t = typeof v;
26
+ return t === "string" || t === "number" || t === "boolean" || t === "bigint";
27
+ };
28
+ const uiIsPlainObject = (v) => {
29
+ if (!v || typeof v !== "object") return false;
30
+ const p = Object.getPrototypeOf(v);
31
+ return p === Object.prototype || p === null;
32
+ };
33
+ let uiRodPathReadFlushQueued = false;
34
+ const uiScheduleRodPathReadFlush = () => {
35
+ if (uiRodPathReadFlushQueued) return;
36
+ uiRodPathReadFlushQueued = true;
37
+ queueMicrotask(() => {
38
+ uiRodPathReadFlushQueued = false;
39
+ uiRodPathReadBuffer.length = 0;
40
+ });
41
+ };
42
+ const uiPushRodPathRead = (entry) => {
43
+ uiRodPathReadBuffer.push(entry);
44
+ if (uiRodPathReadBuffer.length > 128) {
45
+ uiRodPathReadBuffer.splice(0, uiRodPathReadBuffer.length - 128);
46
+ }
47
+ uiScheduleRodPathReadFlush();
48
+ };
49
+ const uiCreateRodPathCursor = () => {
50
+ if (!uiRodPathReadBuffer.length) return null;
51
+ const items = uiRodPathReadBuffer.slice();
52
+ uiRodPathReadBuffer.length = 0;
53
+ return { items, index: 0 };
54
+ };
55
+ const uiTakeRodPathMatch = (cursor, value) => {
56
+ if (!cursor) return null;
57
+ const entry = cursor.items[cursor.index];
58
+ if (!entry) return null;
59
+ if (!Object.is(entry.value, value)) return null;
60
+ cursor.index += 1;
61
+ return entry;
62
+ };
63
+ const uiUnwrapRodPathValue = (v) => {
64
+ if (v && typeof v === "object" && v[uiRodPathRaw]) return v[uiRodPathRaw];
65
+ return v;
66
+ };
67
+ const uiReadRodPath = (rod, path) => {
68
+ const access = uiRodPathAccess.get(rod);
69
+ if (!access) return undefined;
70
+ let cur = access.rawGet();
71
+ for (const key of path) {
72
+ if (cur == null) return undefined;
73
+ cur = cur[key];
74
+ }
75
+ return cur;
76
+ };
77
+ const uiWriteRodPath = (rod, path, nextValue) => {
78
+ const access = uiRodPathAccess.get(rod);
79
+ if (!access) return;
80
+ const unwrapped = uiUnwrapRodPathValue(nextValue);
81
+ if (!path.length) {
82
+ if (Object.is(access.rawGet(), unwrapped)) return;
83
+ access.rawSet(unwrapped);
84
+ return;
85
+ }
86
+ let root = access.rawGet();
87
+ if (!root || typeof root !== "object") {
88
+ root = uiIsIndexKey(path[0]) ? [] : {};
89
+ }
90
+ let cur = root;
91
+ for (let i = 0; i < path.length - 1; i++) {
92
+ const key = path[i];
93
+ let child = cur[key];
94
+ if (!child || typeof child !== "object") {
95
+ const nextKey = path[i + 1];
96
+ child = uiIsIndexKey(nextKey) ? [] : {};
97
+ cur[key] = child;
98
+ }
99
+ cur = child;
100
+ }
101
+ if (Object.is(cur[path[path.length - 1]], unwrapped)) return;
102
+ cur[path[path.length - 1]] = unwrapped;
103
+ access.rawSet(root);
104
+ };
105
+ const uiCreateRodPathModel = (rod, path) => [
106
+ () => uiReadRodPath(rod, path),
107
+ (nextValue) => uiWriteRodPath(rod, path, nextValue)
108
+ ];
109
+ const uiCreateRodPathProxy = (rod, target, path = []) => {
110
+ if (!target || typeof target !== "object") return target;
111
+ let byTarget = uiRodPathProxyCache.get(rod);
112
+ if (!byTarget) {
113
+ byTarget = new WeakMap();
114
+ uiRodPathProxyCache.set(rod, byTarget);
115
+ }
116
+ const cached = byTarget.get(target);
117
+ if (cached) return cached;
118
+ const proxy = new Proxy(target, {
119
+ get(obj, prop, receiver) {
120
+ if (prop === uiRodPathRaw) return obj;
121
+ const value = Reflect.get(obj, prop, receiver);
122
+ if (typeof prop === "symbol") return value;
123
+ const nextPath = path.concat(prop);
124
+ if (value && typeof value === "object") {
125
+ return uiCreateRodPathProxy(rod, value, nextPath);
126
+ }
127
+ if (typeof value === "function") {
128
+ return value.bind(receiver);
129
+ }
130
+ if (uiTrackablePrimitive(value)) {
131
+ uiPushRodPathRead({ rod, path: nextPath, value });
132
+ }
133
+ return value;
134
+ },
135
+ set(obj, prop, value, receiver) {
136
+ const nextValue = uiUnwrapRodPathValue(value);
137
+ const prevValue = Reflect.get(obj, prop, receiver);
138
+ if (Object.is(prevValue, nextValue)) return true;
139
+ const ok = Reflect.set(obj, prop, nextValue, receiver);
140
+ if (ok) {
141
+ const access = uiRodPathAccess.get(rod);
142
+ access?.rawSet(access.rawGet());
143
+ }
144
+ return ok;
145
+ },
146
+ deleteProperty(obj, prop) {
147
+ const hadKey = Reflect.has(obj, prop);
148
+ const ok = Reflect.deleteProperty(obj, prop);
149
+ if (ok && hadKey) {
150
+ const access = uiRodPathAccess.get(rod);
151
+ access?.rawSet(access.rawGet());
152
+ }
153
+ return ok;
154
+ }
155
+ });
156
+ byTarget.set(target, proxy);
157
+ return proxy;
158
+ };
159
+ const uiEnhanceRodPath = (rod) => {
160
+ if (!rod || typeof rod !== "object" || rod.type !== "rod" || rod[uiRodPathEnhanced]) return rod;
161
+ const desc = Object.getOwnPropertyDescriptor(rod, "value");
162
+ if (!desc || typeof desc.get !== "function" || typeof desc.set !== "function") return rod;
163
+ const rawGet = () => desc.get.call(rod);
164
+ const rawSet = (v) => desc.set.call(rod, uiUnwrapRodPathValue(v));
165
+ uiRodPathAccess.set(rod, { rawGet, rawSet });
166
+ Object.defineProperty(rod, "value", {
167
+ get() {
168
+ const raw = rawGet();
169
+ if (!raw || typeof raw !== "object") return raw;
170
+ return uiCreateRodPathProxy(rod, raw, []);
171
+ },
172
+ set(v) {
173
+ rawSet(v);
174
+ },
175
+ configurable: true
176
+ });
177
+ Object.defineProperty(rod, uiRodPathEnhanced, { value: true, configurable: false });
178
+ return rod;
179
+ };
180
+ const uiPatchRodFactory = () => {
181
+ if (typeof window._.rod !== "function" || window._.rod[uiRodPathEnhanced]) return;
182
+ const baseRod = window._.rod;
183
+ const patchedRod = function patchedRod(...args) {
184
+ return uiEnhanceRodPath(baseRod(...args));
185
+ };
186
+ Object.defineProperty(patchedRod, uiRodPathEnhanced, { value: true, configurable: false });
187
+ window._.rod = patchedRod;
188
+ };
189
+ app.ui.withoutRodPathCapture = (fn) => {
190
+ const length = uiRodPathReadBuffer.length;
191
+ try {
192
+ return fn();
193
+ } finally {
194
+ uiRodPathReadBuffer.length = length;
195
+ }
196
+ };
197
+ const uiPatchValueForH = (value, cursor, keyHint = "") => {
198
+ if (Array.isArray(value)) {
199
+ let changed = false;
200
+ const next = value.map((item) => {
201
+ const out = uiPatchValueForH(item, cursor, "");
202
+ if (out !== item) changed = true;
203
+ return out;
204
+ });
205
+ return changed ? next : value;
206
+ }
207
+ if (uiTrackablePrimitive(value)) {
208
+ const entry = uiTakeRodPathMatch(cursor, value);
209
+ if (!entry) return value;
210
+ if (keyHint === "model") return uiCreateRodPathModel(entry.rod, entry.path);
211
+ return () => uiReadRodPath(entry.rod, entry.path);
212
+ }
213
+ if (!uiIsPlainObject(value)) return value;
214
+ let changed = false;
215
+ const out = {};
216
+ for (const key of Object.keys(value)) {
217
+ const next = uiPatchValueForH(value[key], cursor, key);
218
+ out[key] = next;
219
+ if (next !== value[key]) changed = true;
220
+ }
221
+ return changed ? out : value;
222
+ };
223
+ const uiPatchValueForUI = (value, cursor, keyHint = "") => {
224
+ if (Array.isArray(value)) {
225
+ let changed = false;
226
+ const next = value.map((item) => {
227
+ const out = uiPatchValueForUI(item, cursor, "");
228
+ if (out !== item) changed = true;
229
+ return out;
230
+ });
231
+ return changed ? next : value;
232
+ }
233
+ if (uiTrackablePrimitive(value)) {
234
+ const entry = uiTakeRodPathMatch(cursor, value);
235
+ if (!entry) return value;
236
+ if (keyHint === "model") return uiCreateRodPathModel(entry.rod, entry.path);
237
+ return () => uiReadRodPath(entry.rod, entry.path);
238
+ }
239
+ if (!uiIsPlainObject(value)) return value;
240
+ let changed = false;
241
+ const out = {};
242
+ for (const key of Object.keys(value)) {
243
+ const shouldPatch = key === "model" || key === "children";
244
+ const next = shouldPatch ? uiPatchValueForUI(value[key], cursor, key) : value[key];
245
+ out[key] = next;
246
+ if (next !== value[key]) changed = true;
247
+ }
248
+ return changed ? out : value;
249
+ };
250
+ const uiWrapUIFunction = (fn) => {
251
+ if (typeof fn !== "function" || fn[uiRodPathWrappedUI]) return fn;
252
+ const cached = uiWrappedFunctionCache.get(fn);
253
+ if (cached) return cached;
254
+ const wrapped = function uiWrappedComponent(...args) {
255
+ const cursor = uiCreateRodPathCursor();
256
+ if (!cursor) return fn.apply(this, args);
257
+ let changed = false;
258
+ const patchedArgs = args.map((arg) => {
259
+ const out = uiPatchValueForUI(arg, cursor, "");
260
+ if (out !== arg) changed = true;
261
+ return out;
262
+ });
263
+ return fn.apply(this, changed ? patchedArgs : args);
264
+ };
265
+ Object.defineProperty(wrapped, uiRodPathWrappedUI, { value: true, configurable: false });
266
+ uiWrappedFunctionCache.set(fn, wrapped);
267
+ return wrapped;
268
+ };
269
+ const uiInstallUIProxy = () => {
270
+ const uiTarget = app.ui;
271
+ if (!uiTarget || uiTarget[uiRodPathWrappedUI]) return;
272
+ Object.defineProperty(uiTarget, uiRodPathWrappedUI, { value: true, configurable: false });
273
+ for (const key of Object.keys(uiTarget)) {
274
+ if (typeof uiTarget[key] === "function") {
275
+ uiTarget[key] = uiWrapUIFunction(uiTarget[key]);
276
+ }
277
+ }
278
+ app.ui = new Proxy(uiTarget, {
279
+ get(target, prop, receiver) {
280
+ return Reflect.get(target, prop, receiver);
281
+ },
282
+ set(target, prop, value, receiver) {
283
+ const next = typeof value === "function" ? uiWrapUIFunction(value) : value;
284
+ return Reflect.set(target, prop, next, receiver);
285
+ }
286
+ });
287
+ };
288
+ const uiPatchHyperscript = () => {
289
+ if (!window._ || window._[uiRodPathPatchedH]) return;
290
+ Object.defineProperty(window._, uiRodPathPatchedH, { value: true, configurable: false });
291
+ const skipKeys = new Set(["rod", "rodBind", "rodFromSignal"]);
292
+ for (const key of Object.keys(window._)) {
293
+ if (skipKeys.has(key)) continue;
294
+ const base = window._[key];
295
+ if (typeof base !== "function") continue;
296
+ window._[key] = function uiWrappedHyperscript(...args) {
297
+ const cursor = uiCreateRodPathCursor();
298
+ if (!cursor) return base.apply(this, args);
299
+ let changed = false;
300
+ const patchedArgs = args.map((arg) => {
301
+ const out = uiPatchValueForH(arg, cursor, "");
302
+ if (out !== arg) changed = true;
303
+ return out;
304
+ });
305
+ return base.apply(this, changed ? patchedArgs : args);
306
+ };
307
+ }
308
+ };
309
+
310
+ uiPatchRodFactory();
311
+ if (JSswift.rod?._all instanceof Set) {
312
+ JSswift.rod._all.forEach((rod) => uiEnhanceRodPath(rod));
313
+ }
314
+ uiPatchHyperscript();
315
+ uiInstallUIProxy();
316
+
317
+ const UI_STATE_ALIASES = {
318
+ error: "danger",
319
+ danger: "danger",
320
+ warn: "warning",
321
+ warning: "warning",
322
+ success: "success",
323
+ info: "info",
324
+ primary: "primary",
325
+ secondary: "secondary",
326
+ light: "light",
327
+ dark: "dark"
328
+ };
329
+ const UI_STATE_TOKENS = new Set(Object.values(UI_STATE_ALIASES));
330
+ const UI_RADIUS_TOKENS = new Set(["none", "xxs", "xs", "sm", "md", "lg", "xl", "xxl", "xxxl", "full"]);