@rettangoli/ui 0.1.2-rc33 → 0.1.2-rc34

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.
@@ -1,24 +1,24 @@
1
- var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)Vs(e,r,{get:t[r],enumerable:!0})};function I(e,...t){let r="";return e.forEach((s,n)=>{r+=s+(t[n]||"")}),r}var Rs=["xs","sm","md","lg","xl"],sr={mt:"margin-top",mr:"margin-right",mb:"margin-bottom",ml:"margin-left",m:"margin",mh:"margin-left margin-right",mv:"margin-top margin-bottom",pt:"padding-top",pr:"padding-right",pb:"padding-bottom",pl:"padding-left",p:"padding",ph:"padding-left padding-right",pv:"padding-top padding-bottom",g:"gap",gv:"row-gap",gh:"column-gap",bw:"border-width",bwt:"border-top-width",bwr:"border-right-width",bwb:"border-bottom-width",bwl:"border-left-width",bc:"border-color",br:"border-radius",pos:"position",shadow:"box-shadow",ta:"text-align",c:"color",cur:"cursor"},re=Object.keys(sr),se=e=>e.concat(Rs.flatMap(t=>e.map(r=>`${t}-${r}`))),ir={default:void 0,xl:"@media only screen and (max-width: 1280px)",lg:"@media only screen and (max-width: 1024px)",md:"@media only screen and (max-width: 768px)",sm:"@media only screen and (max-width: 640px)"},Q=(e,t={})=>{let r="";for(let[s,n]of Object.entries(ir)){s!=="default"&&(r+=`${n} {`);for(let[i,a]of Object.entries(e)){let o=t[i]?` ${t[i]} `:" ";for(let[l,p]of Object.entries(a)){let u=sr[i],c=p.startsWith("--")?`var(${p})`:p,h=s==="default"?i:`${s}-${i}`,y=s==="default"?`h-${i}`:`${s}-h-${i}`;if(u){let f=u.split(" ").map(m=>`${m}: ${c};`).join(" ");r+=`
2
- :host([${h}="${l}"])${o}{
1
+ var rettangoli=(()=>{var Ds=Object.defineProperty;var R=(e,t)=>{for(var r in t)Ds(e,r,{get:t[r],enumerable:!0})};function O(e,...t){let r="";return e.forEach((s,i)=>{r+=s+(t[i]||"")}),r}var Bs=["xs","sm","md","lg","xl"],ir={mt:"margin-top",mr:"margin-right",mb:"margin-bottom",ml:"margin-left",m:"margin",mh:"margin-left margin-right",mv:"margin-top margin-bottom",pt:"padding-top",pr:"padding-right",pb:"padding-bottom",pl:"padding-left",p:"padding",ph:"padding-left padding-right",pv:"padding-top padding-bottom",g:"gap",gv:"row-gap",gh:"column-gap",bw:"border-width",bwt:"border-top-width",bwr:"border-right-width",bwb:"border-bottom-width",bwl:"border-left-width",bc:"border-color",br:"border-radius",pos:"position",shadow:"box-shadow",ta:"text-align",c:"color",cur:"cursor"},se=Object.keys(ir),ie=e=>e.concat(Bs.flatMap(t=>e.map(r=>`${t}-${r}`))),nr={default:void 0,xl:"@media only screen and (max-width: 1280px)",lg:"@media only screen and (max-width: 1024px)",md:"@media only screen and (max-width: 768px)",sm:"@media only screen and (max-width: 640px)"},Z=(e,t={})=>{let r="";for(let[s,i]of Object.entries(nr)){s!=="default"&&(r+=`${i} {`);for(let[n,o]of Object.entries(e)){let a=t[n]?` ${t[n]} `:" ";for(let[l,p]of Object.entries(o)){let c=ir[n],u=p.startsWith("--")?`var(${p})`:p,d=s==="default"?n:`${s}-${n}`,y=s==="default"?`h-${n}`:`${s}-h-${n}`;if(c){let f=c.split(" ").map(m=>`${m}: ${u};`).join(" ");r+=`
2
+ :host([${d}="${l}"])${a}{
3
3
  ${f}
4
4
  }
5
- :host([${y}="${l}"]:hover)${o}{
5
+ :host([${y}="${l}"]:hover)${a}{
6
6
  ${f}
7
7
  }
8
8
  `}else r+=`
9
- :host([${h}="${l}"])${o}{
9
+ :host([${d}="${l}"])${a}{
10
10
  ${p}
11
11
  }
12
- :host([${y}="${l}"]:hover)${o}{
12
+ :host([${y}="${l}"]:hover)${a}{
13
13
  ${p}
14
14
  }
15
- `}}s!=="default"&&(r+="}")}return r};function Ps(e){if(e===null||e.includes("/"))return!1;let t=String(e);return/[0-9]$/.test(t)}var js=e=>/%$/.test(e),D=e=>{if(e!==void 0)return js(e)?e:Ps(e)?`${e}px`:Object.keys(N).includes(e)?`var(${N[e]})`:e},N={xs:"--spacing-xs",sm:"--spacing-sm",md:"--spacing-md",lg:"--spacing-lg",xl:"--spacing-xl"};function ie(e,t=":host"){let r="",s=["default","xl","lg","md","sm"];for(let n of s){let i=ir[n];if(!e[n]||Object.keys(e[n]).length===0)continue;n!=="default"&&(r+=`${i} {
16
- `);let a="";for(let[o,l]of Object.entries(e[n]))l!=null&&(a+=`${o}: ${l} !important;
15
+ `}}s!=="default"&&(r+="}")}return r};function Ws(e){if(e===null||e.includes("/"))return!1;let t=String(e);return/[0-9]$/.test(t)}var Ms=e=>/%$/.test(e),D=e=>{if(e!==void 0)return Ms(e)?e:Ws(e)?`${e}px`:Object.keys(N).includes(e)?`var(${N[e]})`:e},N={xs:"--spacing-xs",sm:"--spacing-sm",md:"--spacing-md",lg:"--spacing-lg",xl:"--spacing-xl"};function ne(e,t=":host"){let r="",s=["default","xl","lg","md","sm"];for(let i of s){let n=nr[i];if(!e[i]||Object.keys(e[i]).length===0)continue;i!=="default"&&(r+=`${n} {
16
+ `);let o="";for(let[a,l]of Object.entries(e[i]))l!=null&&(o+=`${a}: ${l} !important;
17
17
  `);r+=`${t} {
18
- ${a.trim()}
18
+ ${o.trim()}
19
19
  }
20
- `,n!=="default"&&(r+=`}
21
- `)}return r}var oe=(e,t)=>{if(e===t)return!0;if(e==null||t==null||typeof e!="object"||typeof t!="object")return!1;let r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(let n of r)if(!s.includes(n)||!oe(e[n],t[n]))return!1;return!0};var fe=I`
20
+ `,i!=="default"&&(r+=`}
21
+ `)}return r}var ae=(e,t)=>{if(e===t)return!0;if(e==null||t==null||typeof e!="object"||typeof t!="object")return!1;let r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(let i of r)if(!s.includes(i)||!ae(e[i],t[i]))return!1;return!0};var fe=O`
22
22
  :host([flex="0"]) {
23
23
  flex: 0;
24
24
  }
@@ -58,7 +58,7 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
58
58
  :host([flex="12"]) {
59
59
  flex: 12;
60
60
  }
61
- `;var Ds={mt:N,mr:N,mb:N,ml:N,m:N,mh:N,mv:N,s:{sm:`
61
+ `;var Fs={mt:N,mr:N,mb:N,ml:N,m:N,mh:N,mv:N,s:{sm:`
62
62
  height: 28px;
63
63
  padding-left: 12px;
64
64
  padding-right: 12px;
@@ -104,7 +104,7 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
104
104
  `,lk:`
105
105
  background-color: transparent;
106
106
  color: var(--foreground);
107
- `}},Bs={mt:"button",mr:"button",mb:"button",ml:"button",m:"button",mh:"button",mv:"button",s:"button",v:"button"},nr=Q(Ds,Bs);var ye=I`
107
+ `}},Ks={mt:"button",mr:"button",mb:"button",ml:"button",m:"button",mh:"button",mv:"button",s:"button",v:"button"},or=Z(Fs,Ks);var ye=O`
108
108
  a, a:link, a:visited, a:hover, a:active {
109
109
  color: inherit;
110
110
  text-decoration: none;
@@ -114,7 +114,7 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
114
114
  margin: 0;
115
115
  font: inherit;
116
116
  }
117
- `;var Ge=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(I`
117
+ `;var Ge=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
118
118
  :host {
119
119
  display: contents;
120
120
  }
@@ -256,9 +256,9 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
256
256
  display: contents;
257
257
  }
258
258
 
259
- ${nr}
259
+ ${or}
260
260
  ${fe}
261
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._containerElement=null,this._buttonElement=document.createElement("button"),this._slotElement=document.createElement("slot"),this._iconElement=null,this._buttonElement.appendChild(this._slotElement)}static get observedAttributes(){return["key","href","target","w","t","icon","disabled","v","s","sq","ip"]}connectedCallback(){this._updateButton()}attributeChangedCallback(t,r,s){this._updateButton()}_updateButton(){this.shadow.innerHTML="",this._updateIcon(),this.hasAttribute("sq")||this._updateWidth(),this.hasAttribute("disabled")?this._buttonElement.setAttribute("disabled",""):this._buttonElement.removeAttribute("disabled");let r=this.getAttribute("href");if(r){let s=document.createElement("a");s.setAttribute("href",r);let n=this.getAttribute("target");n&&s.setAttribute("target",n),s.appendChild(this._buttonElement),this.shadow.appendChild(s),this._containerElement=s}else this.shadow.appendChild(this._buttonElement),this._containerElement=this._buttonElement}_updateIcon(){this._iconElement&&(this._iconElement.remove(),this._iconElement=null);let t=this.getAttribute("icon");if(t){let r={pr:"pr-fg",se:"ac-fg",de:"pr-fg",ol:"ac-fg",gh:"ac-fg",lk:"ac-fg"},s={sm:14,md:18,lg:22},n=r[this.getAttribute("v")]||"pr-fg",i=18;if(this.hasAttribute("sq")){let o={sm:14,lg:22},l=this.getAttribute("s");i=o[l]||18}else i=s[this.getAttribute("t")]||18;this._iconElement=document.createElement("rtgl-svg"),this._iconElement.setAttribute("svg",t),this._iconElement.setAttribute("c",n),this._iconElement.setAttribute("wh",i.toString()),this.getAttribute("ip")==="s"?this._buttonElement.insertBefore(this._iconElement,this._slotElement):this._buttonElement.appendChild(this._iconElement)}}_updateWidth(){let t=D(this.getAttribute("w"));t==="f"?this._buttonElement.style.width="var(--width-stretch)":t!=null?(this._buttonElement.style.width=t,this._buttonElement.style.minWidth=t,this._buttonElement.style.maxWidth=t):(this._buttonElement.style.width="",this._buttonElement.style.minWidth="",this._buttonElement.style.maxWidth="")}getBoundingClientRect(){return this._buttonElement?this._buttonElement.getBoundingClientRect():super.getBoundingClientRect()}},or=({render:e,html:t})=>Ge;var ar=I`
261
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._containerElement=null,this._buttonElement=document.createElement("button"),this._slotElement=document.createElement("slot"),this._iconElement=null,this._buttonElement.appendChild(this._slotElement)}static get observedAttributes(){return["key","href","target","w","t","icon","disabled","v","s","sq","ip"]}connectedCallback(){this._updateButton()}attributeChangedCallback(t,r,s){this._updateButton()}_updateButton(){this.shadow.innerHTML="",this._updateIcon(),this.hasAttribute("sq")||this._updateWidth(),this.hasAttribute("disabled")?this._buttonElement.setAttribute("disabled",""):this._buttonElement.removeAttribute("disabled");let r=this.getAttribute("href");if(r){let s=document.createElement("a");s.setAttribute("href",r);let i=this.getAttribute("target");i&&s.setAttribute("target",i),s.appendChild(this._buttonElement),this.shadow.appendChild(s),this._containerElement=s}else this.shadow.appendChild(this._buttonElement),this._containerElement=this._buttonElement}_updateIcon(){this._iconElement&&(this._iconElement.remove(),this._iconElement=null);let t=this.getAttribute("icon");if(t){let r={pr:"pr-fg",se:"ac-fg",de:"pr-fg",ol:"ac-fg",gh:"ac-fg",lk:"ac-fg"},s={sm:14,md:18,lg:22},i=r[this.getAttribute("v")]||"pr-fg",n=18;if(this.hasAttribute("sq")){let a={sm:14,lg:22},l=this.getAttribute("s");n=a[l]||18}else n=s[this.getAttribute("t")]||18;this._iconElement=document.createElement("rtgl-svg"),this._iconElement.setAttribute("svg",t),this._iconElement.setAttribute("c",i),this._iconElement.setAttribute("wh",n.toString()),this.getAttribute("ip")==="s"?this._buttonElement.insertBefore(this._iconElement,this._slotElement):this._buttonElement.appendChild(this._iconElement)}}_updateWidth(){let t=D(this.getAttribute("w"));t==="f"?this._buttonElement.style.width="var(--width-stretch)":t!=null?(this._buttonElement.style.width=t,this._buttonElement.style.minWidth=t,this._buttonElement.style.maxWidth=t):(this._buttonElement.style.width="",this._buttonElement.style.minWidth="",this._buttonElement.style.maxWidth="")}getBoundingClientRect(){return this._buttonElement?this._buttonElement.getBoundingClientRect():super.getBoundingClientRect()}},ar=({render:e,html:t})=>Ge;var lr=O`
262
262
 
263
263
  :host([d="h"]) {
264
264
  flex-direction: row;
@@ -329,7 +329,7 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
329
329
  justify-content: center;
330
330
  }
331
331
  }
332
- `;var Ws={cur:{alias:"alias","all-scroll":"all-scroll",auto:"auto",cell:"cell","col-resize":"col-resize","context-menu":"context-menu",copy:"copy",crosshair:"crosshair",default:"default","e-resize":"e-resize","ew-resize":"ew-resize",grab:"grab",grabbing:"grabbing",help:"help",move:"move","n-resize":"n-resize","ne-resize":"ne-resize","nesw-resize":"nesw-resize","ns-resize":"ns-resize","nw-resize":"nw-resize","nwse-resize":"nwse-resize","no-drop":"no-drop",none:"none","not-allowed":"not-allowed",pointer:"pointer",progress:"progress","row-resize":"row-resize","s-resize":"s-resize","se-resize":"se-resize","sw-resize":"sw-resize",text:"text",url:"url","w-resize":"w-resize",wait:"wait","zoom-in":"zoom-in","zoom-out":"zoom-out",p:"pointer",m:"move"}},U=Q(Ws);var lr=I`
332
+ `;var Us={cur:{alias:"alias","all-scroll":"all-scroll",auto:"auto",cell:"cell","col-resize":"col-resize","context-menu":"context-menu",copy:"copy",crosshair:"crosshair",default:"default","e-resize":"e-resize","ew-resize":"ew-resize",grab:"grab",grabbing:"grabbing",help:"help",move:"move","n-resize":"n-resize","ne-resize":"ne-resize","nesw-resize":"nesw-resize","ns-resize":"ns-resize","nw-resize":"nw-resize","nwse-resize":"nwse-resize","no-drop":"no-drop",none:"none","not-allowed":"not-allowed",pointer:"pointer",progress:"progress","row-resize":"row-resize","s-resize":"s-resize","se-resize":"se-resize","sw-resize":"sw-resize",text:"text",url:"url","w-resize":"w-resize",wait:"wait","zoom-in":"zoom-in","zoom-out":"zoom-out",p:"pointer",m:"move"}},z=Z(Us);var pr=O`
333
333
  :host([sh]:not([sv])) {
334
334
  overflow-x: scroll;
335
335
  flex-wrap: nowrap;
@@ -347,7 +347,7 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
347
347
  flex-wrap: nowrap;
348
348
  }
349
349
 
350
- `;var _e={xs:"--border-width-xs",sm:"--border-width-sm",md:"--border-width-md",lg:"--border-width-lg",xl:"--border-width-xl"},Ms={bgc:{pr:`
350
+ `;var Ae={xs:"--border-width-xs",sm:"--border-width-sm",md:"--border-width-md",lg:"--border-width-lg",xl:"--border-width-xl"},zs={bgc:{pr:`
351
351
  background-color: var(--primary);
352
352
  `,se:`
353
353
  background-color: var(--secondary);
@@ -387,7 +387,7 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
387
387
  left: 0;
388
388
  top: 0;
389
389
  height: 100%;
390
- `},shadow:{sm:"--shadow-sm",md:"--shadow-md",lg:"--shadow-lg"},pt:N,pr:N,pb:N,pl:N,p:N,ph:N,pv:N,g:N,gv:N,gh:N,bw:_e,bwt:_e,bwr:_e,bwb:_e,bwl:_e,bc:{pr:"--primary",se:"--secondary",de:"--destructive",fg:"--foreground",bg:"--background",mu:"--muted",ac:"--accent",bo:"--border",tr:"transparent"},br:{xs:"--border-radius-xs",sm:"--border-radius-sm",md:"--border-radius-md",lg:"--border-radius-lg",xl:"--border-radius-xl",f:"--border-radius-f"}},Te=Q(Ms);var Ks={mt:N,mr:N,mb:N,ml:N,m:N,mh:N,mv:N},H=Q(Ks);var Xe=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(I`
390
+ `},shadow:{sm:"--shadow-sm",md:"--shadow-md",lg:"--shadow-lg"},pt:N,pr:N,pb:N,pl:N,p:N,ph:N,pv:N,g:N,gv:N,gh:N,bw:Ae,bwt:Ae,bwr:Ae,bwb:Ae,bwl:Ae,bc:{pr:"--primary",se:"--secondary",de:"--destructive",fg:"--foreground",bg:"--background",mu:"--muted",ac:"--accent",bo:"--border",tr:"transparent"},br:{xs:"--border-radius-xs",sm:"--border-radius-sm",md:"--border-radius-md",lg:"--border-radius-lg",xl:"--border-radius-xl",f:"--border-radius-f"}},Te=Z(zs);var Hs={mt:N,mr:N,mb:N,ml:N,m:N,mh:N,mv:N},H=Z(Hs);var Ye=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
391
391
  slot {
392
392
  display: contents;
393
393
  }
@@ -407,10 +407,10 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
407
407
  }
408
408
 
409
409
  ${fe}
410
+ ${pr}
410
411
  ${lr}
411
- ${ar}
412
412
  ${H}
413
- ${U}
413
+ ${z}
414
414
  ${Te}
415
415
  ${ye}
416
416
 
@@ -427,7 +427,7 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
427
427
  bottom: 0;
428
428
  z-index: 1;
429
429
  }
430
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styleElement=document.createElement("style"),this._slotElement=document.createElement("slot"),this._linkElement=null,this.shadow.appendChild(this._styleElement),this._updateDOM()}static get observedAttributes(){return["href","target","op",...se([...re,"wh","w","h","hide","show","sh","sv","z","d","ah","av","flex","fw","overflow"])]}_styles={default:{},sm:{},md:{},lg:{},xl:{}};_lastStyleString="";_updateDOM(){let t=this.getAttribute("href"),r=this.getAttribute("target");this._slotElement.parentNode!==this.shadow&&this.shadow.appendChild(this._slotElement),t?(this._linkElement||(this._linkElement=document.createElement("a"),this.shadow.appendChild(this._linkElement)),this._linkElement.href=t,r?this._linkElement.target=r:this._linkElement.removeAttribute("target")):this._linkElement&&(this.shadow.removeChild(this._linkElement),this._linkElement=null)}connectedCallback(){this.updateStyles()}updateStyles(){this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(r=>{let s=b=>`${r==="default"?"":`${r}-`}${b}`,n=this.getAttribute(s("wh")),i=D(n===null?this.getAttribute(s("w")):n),a=D(n===null?this.getAttribute(s("h")):n),o=this.getAttribute(s("op")),l=this.getAttribute(s("z"));l!==null&&(this._styles[r]["z-index"]=l),o!==null&&(this._styles[r].opacity=o),i==="f"?this._styles[r].width="var(--width-stretch)":i!==void 0&&(this._styles[r].width=i,this._styles[r]["min-width"]=i,this._styles[r]["max-width"]=i),a==="f"?this._styles[r].height="100%":a!==void 0&&(this._styles[r].height=a,this._styles[r]["min-height"]=a,this._styles[r]["max-height"]=a),this.hasAttribute(s("hide"))&&(this._styles[r].display="none"),this.hasAttribute(s("show"))&&(this._styles[r].display="flex");let p=this.getAttribute(s("d")),u=this.getAttribute(s("ah")),c=this.getAttribute(s("av"));p==="h"?this._styles[r]["flex-direction"]="row":p==="v"?this._styles[r]["flex-direction"]="column":r==="default"&&!p&&["sm","md","lg","xl"].some(E=>this.hasAttribute(`${E}-d`))&&(this._styles[r]["flex-direction"]="column");let h=p==="h",y=p==="v"||!p;h&&(u==="c"?this._styles[r]["justify-content"]="center":u==="e"?this._styles[r]["justify-content"]="flex-end":u==="s"&&(this._styles[r]["justify-content"]="flex-start"),c==="c"?(this._styles[r]["align-items"]="center",this._styles[r]["align-content"]="center"):c==="e"?(this._styles[r]["align-items"]="flex-end",this._styles[r]["align-content"]="flex-end"):c==="s"&&(this._styles[r]["align-items"]="flex-start")),y&&(u!==null||c!==null)&&(u==="c"?this._styles[r]["align-items"]="center":u==="e"?this._styles[r]["align-items"]="flex-end":u==="s"&&(this._styles[r]["align-items"]="flex-start"),c==="c"?this._styles[r]["justify-content"]="center":c==="e"?this._styles[r]["justify-content"]="flex-end":c==="s"&&(this._styles[r]["justify-content"]="flex-start"));let d=this.getAttribute(s("flex"));d!==null&&(this._styles[r].flex=d),this.getAttribute(s("fw"))==="w"&&(this._styles[r]["flex-wrap"]="wrap");let m=this.hasAttribute(s("sh")),v=this.hasAttribute(s("sv")),w=this.getAttribute(s("overflow"));m&&v?(this._styles[r].overflow="scroll",this._styles[r]["flex-wrap"]="nowrap"):m?(this._styles[r]["overflow-x"]="scroll",this._styles[r]["flex-wrap"]="nowrap"):v&&(this._styles[r]["overflow-y"]="scroll",this._styles[r]["flex-wrap"]="nowrap"),w==="hidden"&&(this._styles[r].overflow="hidden",this._styles[r]["flex-wrap"]="nowrap")});let t=ie(this._styles);t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}attributeChangedCallback(t,r,s){if(t==="href"||t==="target"){this._updateDOM();return}r!==s&&this.updateStyles()}},pr=({render:e,html:t})=>Xe;var Fs={ta:{s:"start",c:"center",e:"end",j:"justify"},s:{h1:`
430
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styleElement=document.createElement("style"),this._slotElement=document.createElement("slot"),this._linkElement=null,this.shadow.appendChild(this._styleElement),this._updateDOM()}static get observedAttributes(){return["href","target","op",...ie([...se,"wh","w","h","hide","show","sh","sv","z","d","ah","av","flex","fw","overflow"])]}_styles={default:{},sm:{},md:{},lg:{},xl:{}};_lastStyleString="";_updateDOM(){let t=this.getAttribute("href"),r=this.getAttribute("target");this._slotElement.parentNode!==this.shadow&&this.shadow.appendChild(this._slotElement),t?(this._linkElement||(this._linkElement=document.createElement("a"),this.shadow.appendChild(this._linkElement)),this._linkElement.href=t,r?this._linkElement.target=r:this._linkElement.removeAttribute("target")):this._linkElement&&(this.shadow.removeChild(this._linkElement),this._linkElement=null)}connectedCallback(){this.updateStyles()}updateStyles(){this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(r=>{let s=x=>`${r==="default"?"":`${r}-`}${x}`,i=this.getAttribute(s("wh")),n=D(i===null?this.getAttribute(s("w")):i),o=D(i===null?this.getAttribute(s("h")):i),a=this.getAttribute(s("op")),l=this.getAttribute(s("z"));l!==null&&(this._styles[r]["z-index"]=l),a!==null&&(this._styles[r].opacity=a),n==="f"?this._styles[r].width="var(--width-stretch)":n!==void 0&&(this._styles[r].width=n,this._styles[r]["min-width"]=n,this._styles[r]["max-width"]=n),o==="f"?this._styles[r].height="100%":o!==void 0&&(this._styles[r].height=o,this._styles[r]["min-height"]=o,this._styles[r]["max-height"]=o),this.hasAttribute(s("hide"))&&(this._styles[r].display="none"),this.hasAttribute(s("show"))&&(this._styles[r].display="flex");let p=this.getAttribute(s("d")),c=this.getAttribute(s("ah")),u=this.getAttribute(s("av"));p==="h"?this._styles[r]["flex-direction"]="row":p==="v"?this._styles[r]["flex-direction"]="column":r==="default"&&!p&&["sm","md","lg","xl"].some(_=>this.hasAttribute(`${_}-d`))&&(this._styles[r]["flex-direction"]="column");let d=p==="h",y=p==="v"||!p;d&&(c==="c"?this._styles[r]["justify-content"]="center":c==="e"?this._styles[r]["justify-content"]="flex-end":c==="s"&&(this._styles[r]["justify-content"]="flex-start"),u==="c"?(this._styles[r]["align-items"]="center",this._styles[r]["align-content"]="center"):u==="e"?(this._styles[r]["align-items"]="flex-end",this._styles[r]["align-content"]="flex-end"):u==="s"&&(this._styles[r]["align-items"]="flex-start")),y&&(c!==null||u!==null)&&(c==="c"?this._styles[r]["align-items"]="center":c==="e"?this._styles[r]["align-items"]="flex-end":c==="s"&&(this._styles[r]["align-items"]="flex-start"),u==="c"?this._styles[r]["justify-content"]="center":u==="e"?this._styles[r]["justify-content"]="flex-end":u==="s"&&(this._styles[r]["justify-content"]="flex-start"));let h=this.getAttribute(s("flex"));h!==null&&(this._styles[r].flex=h),this.getAttribute(s("fw"))==="w"&&(this._styles[r]["flex-wrap"]="wrap");let m=this.hasAttribute(s("sh")),v=this.hasAttribute(s("sv")),b=this.getAttribute(s("overflow"));m&&v?(this._styles[r].overflow="scroll",this._styles[r]["flex-wrap"]="nowrap"):m?(this._styles[r]["overflow-x"]="scroll",this._styles[r]["flex-wrap"]="nowrap"):v&&(this._styles[r]["overflow-y"]="scroll",this._styles[r]["flex-wrap"]="nowrap"),b==="hidden"&&(this._styles[r].overflow="hidden",this._styles[r]["flex-wrap"]="nowrap")});let t=ne(this._styles);t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}attributeChangedCallback(t,r,s){if(t==="href"||t==="target"){this._updateDOM();return}r!==s&&this.updateStyles()}},cr=({render:e,html:t})=>Ye;var Js={ta:{s:"start",c:"center",e:"end",j:"justify"},s:{h1:`
431
431
  font-size: var(--h1-font-size);
432
432
  font-weight: var(--h1-font-weight);
433
433
  line-height: var(--h1-line-height);
@@ -467,7 +467,7 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
467
467
  font-weight: var(--xs-font-weight);
468
468
  line-height: var(--xs-line-height);
469
469
  letter-spacing: var(--xs-letter-spacing);
470
- `}},cr=Q(Fs);var zs={c:{fg:"--foreground",de:"--destructive","pr-fg":"--primary-foreground","se-fg":"--secondary-foreground","mu-fg":"--muted-foreground","ac-fg":"--accent-foreground"}},Le=Q(zs);var Qe=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(I`
470
+ `}},ur=Z(Js);var qs={c:{fg:"--foreground",de:"--destructive","pr-fg":"--primary-foreground","se-fg":"--secondary-foreground","mu-fg":"--muted-foreground","ac-fg":"--accent-foreground"}},Le=Z(qs);var Xe=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
471
471
  :host {
472
472
  display: block;
473
473
  font-size: var(--md-font-size);
@@ -498,11 +498,11 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
498
498
  bottom: 0;
499
499
  z-index: 1;
500
500
  }
501
- ${cr}
501
+ ${ur}
502
502
  ${Le}
503
503
  ${H}
504
- ${U}
505
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._slotElement=document.createElement("slot"),this._linkElement=null,this._updateDOM()}static get observedAttributes(){return["key","w","ellipsis","href","target"]}connectedCallback(){this._updateStyling(),this._updateDOM()}attributeChangedCallback(t,r,s){t==="href"||t==="target"?this._updateDOM():this._updateStyling()}_updateStyling(){let t=D(this.getAttribute("w"));this.hasAttribute("ellipsis")?(this.style.overflow="hidden",this.style.textOverflow="ellipsis",this.style.whiteSpace="nowrap"):(this.style.overflow="",this.style.textOverflow="",this.style.whiteSpace=""),t==="f"?this.style.width="var(--width-stretch)":t!==void 0?this.style.width=t:this.style.width=""}_updateDOM(){let t=this.getAttribute("href"),r=this.getAttribute("target");this._slotElement.parentNode!==this.shadow&&this.shadow.appendChild(this._slotElement),t?(this._linkElement||(this._linkElement=document.createElement("a"),this.shadow.appendChild(this._linkElement)),this._linkElement.href=t,r?this._linkElement.target=r:this._linkElement.removeAttribute("target")):this._linkElement&&(this.shadow.removeChild(this._linkElement),this._linkElement=null)}},ur=({render:e,html:t})=>Qe;var Ze=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(I`
504
+ ${z}
505
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._slotElement=document.createElement("slot"),this._linkElement=null,this._updateDOM()}static get observedAttributes(){return["key","w","ellipsis","href","target"]}connectedCallback(){this._updateStyling(),this._updateDOM()}attributeChangedCallback(t,r,s){t==="href"||t==="target"?this._updateDOM():this._updateStyling()}_updateStyling(){let t=D(this.getAttribute("w"));this.hasAttribute("ellipsis")?(this.style.overflow="hidden",this.style.textOverflow="ellipsis",this.style.whiteSpace="nowrap"):(this.style.overflow="",this.style.textOverflow="",this.style.whiteSpace=""),t==="f"?this.style.width="var(--width-stretch)":t!==void 0?this.style.width=t:this.style.width=""}_updateDOM(){let t=this.getAttribute("href"),r=this.getAttribute("target");this._slotElement.parentNode!==this.shadow&&this.shadow.appendChild(this._slotElement),t?(this._linkElement||(this._linkElement=document.createElement("a"),this.shadow.appendChild(this._linkElement)),this._linkElement.href=t,r?this._linkElement.target=r:this._linkElement.removeAttribute("target")):this._linkElement&&(this.shadow.removeChild(this._linkElement),this._linkElement=null)}},hr=({render:e,html:t})=>Xe;var Qe=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
506
506
  :host {
507
507
  border-style: solid;
508
508
  box-sizing: border-box;
@@ -540,8 +540,8 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
540
540
 
541
541
  ${Te}
542
542
  ${H}
543
- ${U}
544
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styleElement=document.createElement("style"),this._imgElement=document.createElement("img"),this._linkElement=null,this.shadow.appendChild(this._styleElement),this._updateDOM()}static get observedAttributes(){return se([...re,"key","src","href","target","wh","w","h","hide","show","height","width","z"])}_styles={default:{},sm:{},md:{},lg:{},xl:{}};_lastStyleString="";_updateDOM(){let t=this.getAttribute("href"),r=this.getAttribute("target");t?(this._linkElement||(this._linkElement=document.createElement("a")),this._linkElement.href=t,r?this._linkElement.target=r:this._linkElement.removeAttribute("target"),this._linkElement.appendChild(this._imgElement),this._linkElement.parentNode!==this.shadow&&this.shadow.appendChild(this._linkElement)):this._linkElement?(this._imgElement.parentNode===this._linkElement&&this.shadow.appendChild(this._imgElement),this._linkElement.parentNode===this.shadow&&this.shadow.removeChild(this._linkElement),this._linkElement=null):this._imgElement.parentNode!==this.shadow&&this.shadow.appendChild(this._imgElement)}attributeChangedCallback(t,r,s){if(t==="href"||t==="target"){this._updateDOM();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(i=>{let a=h=>`${i==="default"?"":`${i}-`}${h}`,o=this.getAttribute(a("wh")),l=D(o===null?this.getAttribute(a("w")):o),p=D(o===null?this.getAttribute(a("h")):o),u=this.getAttribute(a("o")),c=this.getAttribute(a("z"));c!==null&&(this._styles[i]["z-index"]=c),u!==null&&(this._styles[i].opacity=u),l==="f"?this._styles[i].width="var(--width-stretch)":l!==void 0&&(this._styles[i].width=l,this._styles[i]["min-width"]=l,this._styles[i]["max-width"]=l),p==="f"?this._styles[i].height="100%":p!==void 0&&(this._styles[i].height=p,this._styles[i]["min-height"]=p,this._styles[i]["max-height"]=p),this.hasAttribute(a("hide"))&&(this._styles[i].display="none !important"),this.hasAttribute(a("show"))&&(this._styles[i].display="block !important")});let n=ie(this._styles);n!==this._lastStyleString&&(this._styleElement.textContent=n,this._lastStyleString=n),this._updateImageAttributes()}_updateImageAttributes(){let t=this.getAttribute("src"),r=this.getAttribute("width"),s=this.getAttribute("height");t!==null&&this._imgElement.setAttribute("src",t),r!==null&&this._imgElement.setAttribute("width",r),s!==null&&this._imgElement.setAttribute("height",s)}connectedCallback(){this._updateImageAttributes()}},dr=({render:e,html:t})=>Ze;var hr=I`
543
+ ${z}
544
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styleElement=document.createElement("style"),this._imgElement=document.createElement("img"),this._linkElement=null,this.shadow.appendChild(this._styleElement),this._updateDOM()}static get observedAttributes(){return ie([...se,"key","src","href","target","wh","w","h","hide","show","height","width","z"])}_styles={default:{},sm:{},md:{},lg:{},xl:{}};_lastStyleString="";_updateDOM(){let t=this.getAttribute("href"),r=this.getAttribute("target");t?(this._linkElement||(this._linkElement=document.createElement("a")),this._linkElement.href=t,r?this._linkElement.target=r:this._linkElement.removeAttribute("target"),this._linkElement.appendChild(this._imgElement),this._linkElement.parentNode!==this.shadow&&this.shadow.appendChild(this._linkElement)):this._linkElement?(this._imgElement.parentNode===this._linkElement&&this.shadow.appendChild(this._imgElement),this._linkElement.parentNode===this.shadow&&this.shadow.removeChild(this._linkElement),this._linkElement=null):this._imgElement.parentNode!==this.shadow&&this.shadow.appendChild(this._imgElement)}attributeChangedCallback(t,r,s){if(t==="href"||t==="target"){this._updateDOM();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(n=>{let o=d=>`${n==="default"?"":`${n}-`}${d}`,a=this.getAttribute(o("wh")),l=D(a===null?this.getAttribute(o("w")):a),p=D(a===null?this.getAttribute(o("h")):a),c=this.getAttribute(o("o")),u=this.getAttribute(o("z"));u!==null&&(this._styles[n]["z-index"]=u),c!==null&&(this._styles[n].opacity=c),l==="f"?this._styles[n].width="var(--width-stretch)":l!==void 0&&(this._styles[n].width=l,this._styles[n]["min-width"]=l,this._styles[n]["max-width"]=l),p==="f"?this._styles[n].height="100%":p!==void 0&&(this._styles[n].height=p,this._styles[n]["min-height"]=p,this._styles[n]["max-height"]=p),this.hasAttribute(o("hide"))&&(this._styles[n].display="none !important"),this.hasAttribute(o("show"))&&(this._styles[n].display="block !important")});let i=ne(this._styles);i!==this._lastStyleString&&(this._styleElement.textContent=i,this._lastStyleString=i),this._updateImageAttributes()}_updateImageAttributes(){let t=this.getAttribute("src"),r=this.getAttribute("width"),s=this.getAttribute("height");t!==null&&this._imgElement.setAttribute("src",t),r!==null&&this._imgElement.setAttribute("width",r),s!==null&&this._imgElement.setAttribute("height",s)}connectedCallback(){this._updateImageAttributes()}},dr=({render:e,html:t})=>Qe;var fr=O`
545
545
  :host([pt="xs"]) svg {
546
546
  padding-top: var(--spacing-xs);
547
547
  }
@@ -657,16 +657,16 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
657
657
  padding-top: var(--spacing-xl);
658
658
  padding-bottom: var(--spacing-xl);
659
659
  }
660
- `;var et=class e extends HTMLElement{static styleSheet=null;static _icons={};static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(I`
660
+ `;var Ze=class e extends HTMLElement{static styleSheet=null;static _icons={};static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
661
661
  :host {
662
662
  color: var(--foreground);
663
663
  }
664
664
  ${Le}
665
- ${hr}
665
+ ${fr}
666
666
  ${H}
667
667
  ${fe}
668
- ${U}
669
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet]}static get observedAttributes(){return["key","svg","w","h","wh"]}static get icons(){return e._icons}static addIcon(t,r){e._icons[t]=r}connectedCallback(){this._updateSizing(),this._render()}attributeChangedCallback(t,r,s){this._updateSizing(),this._render()}_updateSizing(){let t=this.getAttribute("wh"),r=D(t===null?this.getAttribute("w"):t),s=D(t===null?this.getAttribute("h"):t);r&&(this.style.width=r),s&&(this.style.height=s)}_render(){try{let t=this.getAttribute("svg"),r=e._icons[t]||(window.rtglIcons||{})[t];if(r){this.shadow.innerHTML=r;return}}catch(t){console.log("error in rtgl-svg render",t)}this.shadow.innerHTML=""}},fr=({render:e,html:t})=>et;var tt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(I`
668
+ ${z}
669
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet]}static get observedAttributes(){return["key","svg","w","h","wh"]}static get icons(){return e._icons}static addIcon(t,r){e._icons[t]=r}connectedCallback(){this._updateSizing(),this._render()}attributeChangedCallback(t,r,s){this._updateSizing(),this._render()}_updateSizing(){let t=this.getAttribute("wh"),r=D(t===null?this.getAttribute("w"):t),s=D(t===null?this.getAttribute("h"):t);r&&(this.style.width=r),s&&(this.style.height=s)}_render(){try{let t=this.getAttribute("svg"),r=e._icons[t]||(window.rtglIcons||{})[t];if(r){this.shadow.innerHTML=r;return}}catch(t){console.log("error in rtgl-svg render",t)}this.shadow.innerHTML=""}},yr=({render:e,html:t})=>Ze;var et=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
670
670
  :host {
671
671
  display: contents;
672
672
  }
@@ -700,8 +700,8 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
700
700
  cursor: not-allowed;
701
701
  }
702
702
  ${H}
703
- ${U}
704
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles={default:{},sm:{},md:{},lg:{},xl:{}},this._lastStyleString="",this._inputElement=document.createElement("input"),this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._inputElement),this._inputElement.addEventListener("input",this._onChange)}static get observedAttributes(){return["key","type","placeholder","disabled","value","s",...se([...re,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}focus(){this._inputElement.focus()}_onChange=t=>{this.dispatchEvent(new CustomEvent("input-change",{detail:{value:this._inputElement.value}}))};attributeChangedCallback(t,r,s){if(t==="key"&&r!==s){requestAnimationFrame(()=>{let i=this.getAttribute("value");this._inputElement.value=i??""});return}if(["type","placeholder","disabled","value","step","s"].includes(t)){this._updateInputAttributes();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(i=>{let a=h=>`${i==="default"?"":`${i}-`}${h}`,o=this.getAttribute(a("wh")),l=D(o===null?this.getAttribute(a("w")):o),p=D(o===null?this.getAttribute(a("h")):o),u=this.getAttribute(a("op")),c=this.getAttribute(a("z"));c!==null&&(this._styles[i]["z-index"]=c),u!==null&&(this._styles[i].opacity=u),l==="f"?this._styles[i].width="var(--width-stretch)":l!==void 0&&(this._styles[i].width=l,this._styles[i]["min-width"]=l,this._styles[i]["max-width"]=l),p==="f"?this._styles[i].height="100%":p!==void 0&&(this._styles[i].height=p,this._styles[i]["min-height"]=p,this._styles[i]["max-height"]=p),this.hasAttribute(a("hide"))&&(this._styles[i].display="none !important"),this.hasAttribute(a("show"))&&(this._styles[i].display="block !important")});let n=ie(this._styles,"input");n!==this._lastStyleString&&(this._styleElement.textContent=n,this._lastStyleString=n)}_updateInputAttributes(){let t=this.getAttribute("type")||"text",r=this.getAttribute("placeholder"),s=this.getAttribute("value"),n=this.getAttribute("step"),i=this.hasAttribute("disabled");this._inputElement.setAttribute("type",t),r!==null?this._inputElement.setAttribute("placeholder",r):this._inputElement.removeAttribute("placeholder"),s!==null&&(this._inputElement.value=s),n!==null?this._inputElement.setAttribute("step",n):this._inputElement.removeAttribute("step"),i?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes()}},yr=({render:e,html:t})=>tt;var rt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(I`
703
+ ${z}
704
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles={default:{},sm:{},md:{},lg:{},xl:{}},this._lastStyleString="",this._inputElement=document.createElement("input"),this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._inputElement),this._inputElement.addEventListener("input",this._onChange)}static get observedAttributes(){return["key","type","placeholder","disabled","value","s",...ie([...se,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}focus(){this._inputElement.focus()}_onChange=t=>{this.dispatchEvent(new CustomEvent("input-change",{detail:{value:this._inputElement.value}}))};attributeChangedCallback(t,r,s){if(t==="key"&&r!==s){requestAnimationFrame(()=>{let n=this.getAttribute("value");this._inputElement.value=n??""});return}if(["type","placeholder","disabled","value","step","s"].includes(t)){this._updateInputAttributes();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(n=>{let o=d=>`${n==="default"?"":`${n}-`}${d}`,a=this.getAttribute(o("wh")),l=D(a===null?this.getAttribute(o("w")):a),p=D(a===null?this.getAttribute(o("h")):a),c=this.getAttribute(o("op")),u=this.getAttribute(o("z"));u!==null&&(this._styles[n]["z-index"]=u),c!==null&&(this._styles[n].opacity=c),l==="f"?this._styles[n].width="var(--width-stretch)":l!==void 0&&(this._styles[n].width=l,this._styles[n]["min-width"]=l,this._styles[n]["max-width"]=l),p==="f"?this._styles[n].height="100%":p!==void 0&&(this._styles[n].height=p,this._styles[n]["min-height"]=p,this._styles[n]["max-height"]=p),this.hasAttribute(o("hide"))&&(this._styles[n].display="none !important"),this.hasAttribute(o("show"))&&(this._styles[n].display="block !important")});let i=ne(this._styles,"input");i!==this._lastStyleString&&(this._styleElement.textContent=i,this._lastStyleString=i)}_updateInputAttributes(){let t=this.getAttribute("type")||"text",r=this.getAttribute("placeholder"),s=this.getAttribute("value"),i=this.getAttribute("step"),n=this.hasAttribute("disabled");this._inputElement.setAttribute("type",t),r!==null?this._inputElement.setAttribute("placeholder",r):this._inputElement.removeAttribute("placeholder"),s!==null&&(this._inputElement.value=s),i!==null?this._inputElement.setAttribute("step",i):this._inputElement.removeAttribute("step"),n?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes()}},mr=({render:e,html:t})=>et;var tt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
705
705
  :host {
706
706
  display: contents;
707
707
  }
@@ -725,8 +725,8 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
725
725
  border-color: var(--foreground);
726
726
  }
727
727
  ${H}
728
- ${U}
729
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._textareaElement=document.createElement("textarea"),this._textareaElement.setAttribute("type","text"),this.shadow.appendChild(this._textareaElement),this._textareaElement.addEventListener("input",this._onChange)}_onChange=t=>{this.dispatchEvent(new CustomEvent("textarea-change",{detail:{value:this._textareaElement.value}}))};static get observedAttributes(){return["key","w","ellipsis","cols","rows","placeholder","value"]}get value(){return this._textareaElement.value}set value(t){this._textareaElement.value=t}connectedCallback(){this._updateTextareaAttributes()}attributeChangedCallback(t,r,s){if(t==="key"&&r!==s){requestAnimationFrame(()=>{let n=this.getAttribute("value");this._textareaElement.value=n??""});return}this._updateTextareaAttributes()}_updateTextareaAttributes(){let t=this.getAttribute("cols"),r=this.getAttribute("rows"),s=this.getAttribute("placeholder"),n=this.getAttribute("value");t!==null?this._textareaElement.setAttribute("cols",t):this._textareaElement.removeAttribute("cols"),r!==null?this._textareaElement.setAttribute("rows",r):this._textareaElement.removeAttribute("rows"),s!==null?this._textareaElement.setAttribute("placeholder",s):this._textareaElement.removeAttribute("placeholder"),n!==null&&(this._textareaElement.value=n)}},mr=({render:e,html:t})=>rt;var st=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(I`
728
+ ${z}
729
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._textareaElement=document.createElement("textarea"),this._textareaElement.setAttribute("type","text"),this.shadow.appendChild(this._textareaElement),this._textareaElement.addEventListener("input",this._onChange)}_onChange=t=>{this.dispatchEvent(new CustomEvent("textarea-change",{detail:{value:this._textareaElement.value}}))};static get observedAttributes(){return["key","w","ellipsis","cols","rows","placeholder","value"]}get value(){return this._textareaElement.value}set value(t){this._textareaElement.value=t}connectedCallback(){this._updateTextareaAttributes()}attributeChangedCallback(t,r,s){if(t==="key"&&r!==s){requestAnimationFrame(()=>{let i=this.getAttribute("value");this._textareaElement.value=i??""});return}this._updateTextareaAttributes()}_updateTextareaAttributes(){let t=this.getAttribute("cols"),r=this.getAttribute("rows"),s=this.getAttribute("placeholder"),i=this.getAttribute("value");t!==null?this._textareaElement.setAttribute("cols",t):this._textareaElement.removeAttribute("cols"),r!==null?this._textareaElement.setAttribute("rows",r):this._textareaElement.removeAttribute("rows"),s!==null?this._textareaElement.setAttribute("placeholder",s):this._textareaElement.removeAttribute("placeholder"),i!==null&&(this._textareaElement.value=i)}},gr=({render:e,html:t})=>tt;var rt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
730
730
  :host {
731
731
  display: contents;
732
732
  }
@@ -748,8 +748,8 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
748
748
  opacity: 0.5;
749
749
  }
750
750
  ${H}
751
- ${U}
752
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles={default:{},sm:{},md:{},lg:{},xl:{}},this._lastStyleString="",this._inputElement=document.createElement("input"),this._inputElement.type="color",this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._inputElement),this._inputElement.addEventListener("change",this._onChange),this._inputElement.addEventListener("input",this._onInput)}static get observedAttributes(){return["key","value","disabled",...se([...re,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}_onChange=t=>{this.dispatchEvent(new CustomEvent("colorpicker-change",{detail:{value:this._inputElement.value}}))};_onInput=t=>{this.dispatchEvent(new CustomEvent("colorpicker-input",{detail:{value:this._inputElement.value}}))};attributeChangedCallback(t,r,s){if(t==="key"&&r!==s){requestAnimationFrame(()=>{let i=this.getAttribute("value");this._inputElement.value=i??"#000000"});return}if(["value","disabled"].includes(t)){this._updateInputAttributes();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(i=>{let a=h=>`${i==="default"?"":`${i}-`}${h}`,o=this.getAttribute(a("wh")),l=D(o===null?this.getAttribute(a("w")):o),p=D(o===null?this.getAttribute(a("h")):o),u=this.getAttribute(a("op")),c=this.getAttribute(a("z"));c!==null&&(this._styles[i]["z-index"]=c),u!==null&&(this._styles[i].opacity=u),l==="f"?this._styles[i].width="var(--width-stretch)":l!==void 0&&(this._styles[i].width=l,this._styles[i]["min-width"]=l,this._styles[i]["max-width"]=l),p==="f"?this._styles[i].height="100%":p!==void 0&&(this._styles[i].height=p,this._styles[i]["min-height"]=p,this._styles[i]["max-height"]=p),this.hasAttribute(a("hide"))&&(this._styles[i].display="none !important"),this.hasAttribute(a("show"))&&(this._styles[i].display="block !important")});let n=ie(this._styles,'input[type="color"]');n!==this._lastStyleString&&(this._styleElement.textContent=n,this._lastStyleString=n)}_updateInputAttributes(){let t=this.getAttribute("value"),r=this.hasAttribute("disabled");t!==null&&(this._inputElement.value=t),r?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes()}},gr=({render:e,html:t})=>st;var it=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(I`
751
+ ${z}
752
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles={default:{},sm:{},md:{},lg:{},xl:{}},this._lastStyleString="",this._inputElement=document.createElement("input"),this._inputElement.type="color",this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._inputElement),this._inputElement.addEventListener("change",this._onChange),this._inputElement.addEventListener("input",this._onInput)}static get observedAttributes(){return["key","value","disabled",...ie([...se,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}_onChange=t=>{this.dispatchEvent(new CustomEvent("colorpicker-change",{detail:{value:this._inputElement.value}}))};_onInput=t=>{this.dispatchEvent(new CustomEvent("colorpicker-input",{detail:{value:this._inputElement.value}}))};attributeChangedCallback(t,r,s){if(t==="key"&&r!==s){requestAnimationFrame(()=>{let n=this.getAttribute("value");this._inputElement.value=n??"#000000"});return}if(["value","disabled"].includes(t)){this._updateInputAttributes();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(n=>{let o=d=>`${n==="default"?"":`${n}-`}${d}`,a=this.getAttribute(o("wh")),l=D(a===null?this.getAttribute(o("w")):a),p=D(a===null?this.getAttribute(o("h")):a),c=this.getAttribute(o("op")),u=this.getAttribute(o("z"));u!==null&&(this._styles[n]["z-index"]=u),c!==null&&(this._styles[n].opacity=c),l==="f"?this._styles[n].width="var(--width-stretch)":l!==void 0&&(this._styles[n].width=l,this._styles[n]["min-width"]=l,this._styles[n]["max-width"]=l),p==="f"?this._styles[n].height="100%":p!==void 0&&(this._styles[n].height=p,this._styles[n]["min-height"]=p,this._styles[n]["max-height"]=p),this.hasAttribute(o("hide"))&&(this._styles[n].display="none !important"),this.hasAttribute(o("show"))&&(this._styles[n].display="block !important")});let i=ne(this._styles,'input[type="color"]');i!==this._lastStyleString&&(this._styleElement.textContent=i,this._lastStyleString=i)}_updateInputAttributes(){let t=this.getAttribute("value"),r=this.hasAttribute("disabled");t!==null&&(this._inputElement.value=t),r?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes()}},vr=({render:e,html:t})=>rt;var st=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
753
753
  :host {
754
754
  display: contents;
755
755
  }
@@ -802,8 +802,8 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
802
802
  cursor: not-allowed;
803
803
  }
804
804
  ${H}
805
- ${U}
806
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles={default:{},sm:{},md:{},lg:{},xl:{}},this._lastStyleString="",this._inputElement=document.createElement("input"),this._inputElement.type="range",this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._inputElement),this._inputElement.addEventListener("input",this._onInput),this._inputElement.addEventListener("change",this._onChange)}static get observedAttributes(){return["key","value","min","max","step","disabled",...se([...re,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}_onInput=t=>{this.dispatchEvent(new CustomEvent("slider-input",{detail:{value:this._inputElement.value}}))};_onChange=t=>{this.dispatchEvent(new CustomEvent("slider-change",{detail:{value:this._inputElement.value}}))};attributeChangedCallback(t,r,s){if(t==="key"&&r!==s){requestAnimationFrame(()=>{let i=this.getAttribute("value"),a=this.getAttribute("min")||"0";this._inputElement.value=i??a});return}if(["value","min","max","step","disabled"].includes(t)){this._updateInputAttributes();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(i=>{let a=h=>`${i==="default"?"":`${i}-`}${h}`,o=this.getAttribute(a("wh")),l=D(o===null?this.getAttribute(a("w")):o),p=D(o===null?this.getAttribute(a("h")):o),u=this.getAttribute(a("op")),c=this.getAttribute(a("z"));c!==null&&(this._styles[i]["z-index"]=c),u!==null&&(this._styles[i].opacity=u),l==="f"?this._styles[i].width="var(--width-stretch)":l!==void 0&&(this._styles[i].width=l,this._styles[i]["min-width"]=l,this._styles[i]["max-width"]=l),p==="f"?this._styles[i].height="100%":p!==void 0&&(this._styles[i].height=p,this._styles[i]["min-height"]=p,this._styles[i]["max-height"]=p),this.hasAttribute(a("hide"))&&(this._styles[i].display="none !important"),this.hasAttribute(a("show"))&&(this._styles[i].display="block !important")});let n=ie(this._styles,'input[type="range"]');n!==this._lastStyleString&&(this._styleElement.textContent=n,this._lastStyleString=n)}_updateInputAttributes(){let t=this.getAttribute("value"),r=this.getAttribute("min"),s=this.getAttribute("max"),n=this.getAttribute("step"),i=this.hasAttribute("disabled");t!==null&&(this._inputElement.value=t),r!==null?this._inputElement.min=r:this._inputElement.min="0",s!==null?this._inputElement.max=s:this._inputElement.max="100",n!==null?this._inputElement.step=n:this._inputElement.step="1",i?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes()}},vr=({render:e,html:t})=>it;var nt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(I`
805
+ ${z}
806
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles={default:{},sm:{},md:{},lg:{},xl:{}},this._lastStyleString="",this._inputElement=document.createElement("input"),this._inputElement.type="range",this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._inputElement),this._inputElement.addEventListener("input",this._onInput),this._inputElement.addEventListener("change",this._onChange)}static get observedAttributes(){return["key","value","min","max","step","disabled",...ie([...se,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}_onInput=t=>{this.dispatchEvent(new CustomEvent("slider-input",{detail:{value:this._inputElement.value}}))};_onChange=t=>{this.dispatchEvent(new CustomEvent("slider-change",{detail:{value:this._inputElement.value}}))};attributeChangedCallback(t,r,s){if(t==="key"&&r!==s){requestAnimationFrame(()=>{let n=this.getAttribute("value"),o=this.getAttribute("min")||"0";this._inputElement.value=n??o});return}if(["value","min","max","step","disabled"].includes(t)){this._updateInputAttributes();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(n=>{let o=d=>`${n==="default"?"":`${n}-`}${d}`,a=this.getAttribute(o("wh")),l=D(a===null?this.getAttribute(o("w")):a),p=D(a===null?this.getAttribute(o("h")):a),c=this.getAttribute(o("op")),u=this.getAttribute(o("z"));u!==null&&(this._styles[n]["z-index"]=u),c!==null&&(this._styles[n].opacity=c),l==="f"?this._styles[n].width="var(--width-stretch)":l!==void 0&&(this._styles[n].width=l,this._styles[n]["min-width"]=l,this._styles[n]["max-width"]=l),p==="f"?this._styles[n].height="100%":p!==void 0&&(this._styles[n].height=p,this._styles[n]["min-height"]=p,this._styles[n]["max-height"]=p),this.hasAttribute(o("hide"))&&(this._styles[n].display="none !important"),this.hasAttribute(o("show"))&&(this._styles[n].display="block !important")});let i=ne(this._styles,'input[type="range"]');i!==this._lastStyleString&&(this._styleElement.textContent=i,this._lastStyleString=i)}_updateInputAttributes(){let t=this.getAttribute("value"),r=this.getAttribute("min"),s=this.getAttribute("max"),i=this.getAttribute("step"),n=this.hasAttribute("disabled");t!==null&&(this._inputElement.value=t),r!==null?this._inputElement.min=r:this._inputElement.min="0",s!==null?this._inputElement.max=s:this._inputElement.max="100",i!==null?this._inputElement.step=i:this._inputElement.step="1",n?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes()}},br=({render:e,html:t})=>st;var it=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
807
807
  :host {
808
808
  display: contents;
809
809
  }
@@ -874,7 +874,7 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
874
874
  dialog[open] slot[name="content"] {
875
875
  animation: dialog-in 150ms cubic-bezier(0.16, 1, 0.3, 1);
876
876
  }
877
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._dialogElement=document.createElement("dialog"),this.shadow.appendChild(this._dialogElement),this._slotElement=null,this._isConnected=!1,this._dialogElement.addEventListener("click",t=>{t.target===this._dialogElement&&this.dispatchEvent(new CustomEvent("close",{detail:{}}))}),this._dialogElement.addEventListener("contextmenu",t=>{t.target===this._dialogElement&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("close",{detail:{}})))}),this._dialogElement.addEventListener("cancel",t=>{t.preventDefault(),this.dispatchEvent(new CustomEvent("close",{detail:{}}))})}static get observedAttributes(){return["open","w","s"]}connectedCallback(){this._updateDialog(),this._isConnected=!0,this.hasAttribute("open")&&this._showModal()}attributeChangedCallback(t,r,s){t==="open"?s!==null&&!this._dialogElement.open&&this._isConnected?this._showModal():s===null&&this._dialogElement.open&&this._hideModal():t==="w"&&this._updateWidth()}_updateDialog(){this._updateWidth()}_updateWidth(){let t=this.getAttribute("w");t?this._dialogElement.style.width=t:this._dialogElement.style.width=""}_showModal(){this._dialogElement.open||(this._slotElement||(this._slotElement=document.createElement("slot"),this._slotElement.setAttribute("name","content"),this._dialogElement.appendChild(this._slotElement)),this._dialogElement.showModal(),this._dialogElement.scrollTop=0,this._applyAdaptiveCentering())}_hideModal(){this._dialogElement.open&&(this._dialogElement.close(),this._slotElement&&(this._slotElement.style.marginTop="",this._slotElement.style.marginBottom="",this._dialogElement.removeChild(this._slotElement),this._slotElement=null),this._dialogElement.style.height="")}_applyAdaptiveCentering(){this._slotElement&&requestAnimationFrame(()=>{if(!this._slotElement)return;let t=this._slotElement.offsetHeight,r=window.innerHeight,s=40;if(t>=r-2*s)this._slotElement.style.marginTop=`${s}px`,this._slotElement.style.marginBottom=`${s}px`,this._dialogElement.style.height="100vh";else{let n=r-t,i=Math.floor(n/2);this._slotElement.style.marginTop=`${i}px`,this._slotElement.style.marginBottom=`${i}px`,this._dialogElement.style.height="auto"}})}get dialog(){return this._dialogElement}},br=({render:e,html:t})=>nt;var ot=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(I`
877
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._dialogElement=document.createElement("dialog"),this.shadow.appendChild(this._dialogElement),this._slotElement=null,this._isConnected=!1,this._dialogElement.addEventListener("click",t=>{t.target===this._dialogElement&&this.dispatchEvent(new CustomEvent("close",{detail:{}}))}),this._dialogElement.addEventListener("contextmenu",t=>{t.target===this._dialogElement&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("close",{detail:{}})))}),this._dialogElement.addEventListener("cancel",t=>{t.preventDefault(),this.dispatchEvent(new CustomEvent("close",{detail:{}}))})}static get observedAttributes(){return["open","w","s"]}connectedCallback(){this._updateDialog(),this._isConnected=!0,this.hasAttribute("open")&&this._showModal()}attributeChangedCallback(t,r,s){t==="open"?s!==null&&!this._dialogElement.open&&this._isConnected?this._showModal():s===null&&this._dialogElement.open&&this._hideModal():t==="w"&&this._updateWidth()}_updateDialog(){this._updateWidth()}_updateWidth(){let t=this.getAttribute("w");t?this._dialogElement.style.width=t:this._dialogElement.style.width=""}_showModal(){this._dialogElement.open||(this._slotElement||(this._slotElement=document.createElement("slot"),this._slotElement.setAttribute("name","content"),this._dialogElement.appendChild(this._slotElement)),this._dialogElement.showModal(),this._dialogElement.scrollTop=0,this._applyAdaptiveCentering())}_hideModal(){this._dialogElement.open&&(this._dialogElement.close(),this._slotElement&&(this._slotElement.style.marginTop="",this._slotElement.style.marginBottom="",this._dialogElement.removeChild(this._slotElement),this._slotElement=null),this._dialogElement.style.height="")}_applyAdaptiveCentering(){this._slotElement&&requestAnimationFrame(()=>{if(!this._slotElement)return;let t=this._slotElement.offsetHeight,r=window.innerHeight,s=40;if(t>=r-2*s)this._slotElement.style.marginTop=`${s}px`,this._slotElement.style.marginBottom=`${s}px`,this._dialogElement.style.height="100vh";else{let i=r-t,n=Math.floor(i/2);this._slotElement.style.marginTop=`${n}px`,this._slotElement.style.marginBottom=`${n}px`,this._dialogElement.style.height="auto"}})}get dialog(){return this._dialogElement}},wr=({render:e,html:t})=>it;var nt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
878
878
  :host {
879
879
  display: contents;
880
880
  }
@@ -923,19 +923,19 @@ var rettangoli=(()=>{var Vs=Object.defineProperty;var P=(e,t)=>{for(var r in t)V
923
923
  min-width: 200px;
924
924
  max-width: 400px;
925
925
  }
926
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._popoverOverlay=document.createElement("div"),this._popoverOverlay.className="popover-overlay",this.shadow.appendChild(this._popoverOverlay),this._popoverOverlay.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("close",{detail:{}}))}),this._popoverOverlay.addEventListener("contextmenu",t=>{t.preventDefault(),this.dispatchEvent(new CustomEvent("close",{detail:{}}))}),this._popoverContainer=document.createElement("div"),this._popoverContainer.className="popover-container",this.shadow.appendChild(this._popoverContainer),this._slotElement=null,this._isOpen=!1,this._handleEscKey=this._handleEscKey.bind(this)}static get observedAttributes(){return["open","x","y","placement","no-overlay"]}connectedCallback(){this.hasAttribute("open")&&this._show()}disconnectedCallback(){this._removeGlobalListeners()}attributeChangedCallback(t,r,s){t==="open"?s!==null&&!this._isOpen?this._show():s===null&&this._isOpen&&this._hide():(t==="x"||t==="y"||t==="placement")&&this._isOpen&&this._updatePosition()}_show(){this._isOpen||(this._slotElement||(this._slotElement=document.createElement("slot"),this._slotElement.setAttribute("name","content"),this._popoverContainer.appendChild(this._slotElement)),this._isOpen=!0,this._updatePosition(),this._addGlobalListeners())}_hide(){this._isOpen&&(this._isOpen=!1,this._slotElement&&(this._popoverContainer.removeChild(this._slotElement),this._slotElement=null),this._removeGlobalListeners())}_updatePosition(){let t=parseFloat(this.getAttribute("x")||"0"),r=parseFloat(this.getAttribute("y")||"0"),s=this.getAttribute("placement")||"bottom-start";this.removeAttribute("positioned"),requestAnimationFrame(()=>{let n=this._popoverContainer.getBoundingClientRect(),{left:i,top:a}=this._calculatePosition(t,r,n.width,n.height,s);this._popoverContainer.style.left=`${i}px`,this._popoverContainer.style.top=`${a}px`,requestAnimationFrame(()=>{this.setAttribute("positioned","")})})}_calculatePosition(t,r,s,n,i){let o=t,l=r;switch(i){case"top":o=t-s/2,l=r-n-8;break;case"top-start":o=t,l=r-n-8;break;case"top-end":o=t-s,l=r-n-8;break;case"right":o=t+8,l=r-n/2;break;case"right-start":o=t+8,l=r;break;case"right-end":o=t+8,l=r-n;break;case"bottom":o=t-s/2,l=r+8;break;case"bottom-start":o=t,l=r+8;break;case"bottom-end":o=t-s,l=r+8;break;case"left":o=t-s-8,l=r-n/2;break;case"left-start":o=t-s-8,l=r;break;case"left-end":o=t-s-8,l=r-n;break}let p=8;return o=Math.max(p,Math.min(o,window.innerWidth-s-p)),l=Math.max(p,Math.min(l,window.innerHeight-n-p)),{left:o,top:l}}_addGlobalListeners(){setTimeout(()=>{document.addEventListener("keydown",this._handleEscKey)},0)}_removeGlobalListeners(){document.removeEventListener("keydown",this._handleEscKey)}_handleEscKey(t){t.key==="Escape"&&this.dispatchEvent(new CustomEvent("close",{detail:{}}))}get popover(){return this._popoverContainer}},wr=({render:e,html:t})=>ot;var at={};P(at,{handleClickItem:()=>Us});var Us=(e,t)=>{let{dispatchEvent:r}=t,s=e.currentTarget.dataset.id;r(new CustomEvent("item-click",{detail:{id:s}}))};var lt={};P(lt,{INITIAL_STATE:()=>Hs,toViewData:()=>Ys});var Hs=Object.freeze({}),Js=["id","class","style","slot"],qs=e=>Object.entries(e).filter(([t])=>!Js.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ys=({props:e,attrs:t})=>{let r=qs(t),s=e.items||[],n=e.separator||"breadcrumb-arrow",i=[];return s.forEach((a,o)=>{i.push(a),o<s.length-1&&i.push({isSeparator:!0})}),{containerAttrString:r,items:i,separator:n}};var xr={elementName:"rtgl-breadcrumb",viewDataSchema:{type:"object",properties:{containerAttrString:{type:"string"},items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"}}}},separator:{type:"string"}}},propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"}}}},separator:{type:"string",default:"breadcrumb-arrow"}}},refs:{"item-*":{eventListeners:{click:{handler:"handleClickItem"}}}},events:{"item-click":{type:"object",properties:{item:{type:"object",properties:{label:{type:"string"},id:{type:"string"}}},index:{type:"number"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c g=md p=sm ${containerAttrString}",value:{type:9,items:[{type:7,itemVar:"item",indexVar:null,iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:"$if item.isSeparator",value:{type:6,conditions:[{type:1,path:"item.isSeparator"},{type:1,path:"item.id"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-svg wh=16 svg=${separator} c=mu-fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg wh=16 svg=",{type:1,path:"separator"}," c=mu-fg"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#item-${item.id} data-id=${item.id} cur=p",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"item.label"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#item-",{type:1,path:"item.id"}," data-id=",{type:1,path:"item.id"}," cur=p"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"item.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view d=h av=c g=md p=sm ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var pt={};P(pt,{handleClickMenuItem:()=>Xs,handleClosePopover:()=>Gs});var Gs=(e,t)=>{let{dispatchEvent:r}=t;r(new CustomEvent("close"))},Xs=(e,t)=>{let{dispatchEvent:r}=t,s=parseInt(e.currentTarget.id.replace("option-","")),n=t.props.items[s];r(new CustomEvent("click-item",{detail:{index:s,item:n}}))};var ct={};P(ct,{INITIAL_STATE:()=>Qs,toViewData:()=>Zs});var Qs=Object.freeze({}),Zs=({props:e,attrs:t})=>({items:e.items||[],open:!!t.open,x:t.x,y:t.y,placement:t.placement});var Er={elementName:"rtgl-dropdown-menu",viewDataSchema:{type:"object"},propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},type:{type:"string",enum:["label","item","separator"]}}}}}},attrsSchema:{type:"object",properties:{open:{type:"string"},x:{type:"string"},y:{type:"string"},placement:{type:"string"}}},refs:{popover:{eventListeners:{close:{handler:"handleClosePopover"}}},"option-*":{eventListeners:{click:{handler:"handleClickMenuItem"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-popover#popover ?open=${open} x=${x} y=${y} placement=${placement}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view wh=300 g=xs slot=content bgc=background br=md",value:{type:9,items:[{type:7,itemVar:"item",indexVar:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:"$if item.type == 'label'",value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"item.type"},right:{type:0,value:"label"}},{type:4,op:0,left:{type:1,path:"item.type"},right:{type:0,value:"item"}},{type:4,op:0,left:{type:1,path:"item.type"},right:{type:0,value:"separator"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f ph=lg pv=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"item.label"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#option-${i} w=f h-bgc=ac ph=lg pv=md cur=p br=md bgc=mu",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"item.label"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#option-",{type:1,path:"i"}," w=f h-bgc=ac ph=lg pv=md cur=p br=md bgc=mu"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=1 ph=lg mv=md bgc=bo",value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-popover#popover ?open=",{type:1,path:"open"}," x=",{type:1,path:"x"}," y=",{type:1,path:"y"}," placement=",{type:1,path:"placement"}]}}],fast:!1}],fast:!1}};var ut={};P(ut,{handleActionClick:()=>ri,handleBeforeMount:()=>ei,handleColorPickerChange:()=>oi,handleImageClick:()=>pi,handleInputChange:()=>si,handleOnUpdate:()=>ti,handlePopoverInputChange:()=>ii,handleSelectAddOption:()=>ui,handleSelectChange:()=>ni,handleSliderChange:()=>ai,handleSliderInputChange:()=>li,handleTooltipMouseEnter:()=>di,handleTooltipMouseLeave:()=>hi,handleWaveformClick:()=>ci});var ei=e=>{let{store:t,props:r}=e;t.setFormValues(r.defaultValues)},ti=(e,t)=>{let{oldAttrs:r,newAttrs:s}=e,{store:n,props:i,render:a}=t;r?.key!==s?.key&&(n.setFormValues(i.defaultValues),a())},me=(e,t,r,s)=>{s(new CustomEvent("form-change",{detail:{name:e,fieldValue:t,formValues:r}}))},ri=(e,t)=>{let{store:r,dispatchEvent:s}=t,n=e.currentTarget.id.replace("action-","");s(new CustomEvent("action-click",{detail:{actionId:n,formValues:r.selectFormValues()}}))},si=(e,t)=>{let{store:r,dispatchEvent:s,props:n}=t,i=e.currentTarget.id.replace("input-","");i&&e.detail.value!==void 0&&(r.setFormFieldValue({name:i,value:e.detail.value,props:n}),me(i,e.detail.value,r.selectFormValues(),s))},ii=(e,t)=>{let{store:r,dispatchEvent:s,props:n}=t,i=e.currentTarget.id.replace("popover-input-","");i&&e.detail.value!==void 0&&(r.setFormFieldValue({name:i,value:e.detail.value,props:n}),me(i,e.detail.value,r.selectFormValues(),s))},ni=(e,t)=>{let{store:r,dispatchEvent:s,render:n,props:i}=t,a=e.currentTarget.id.replace("select-","");a&&e.detail.selectedValue!==void 0&&(r.setFormFieldValue({name:a,value:e.detail.selectedValue,props:i}),me(a,e.detail.selectedValue,r.selectFormValues(),s),n())},oi=(e,t)=>{let{store:r,dispatchEvent:s,props:n}=t,i=e.currentTarget.id.replace("colorpicker-","");i&&e.detail.value!==void 0&&(r.setFormFieldValue({name:i,value:e.detail.value,props:n}),me(i,e.detail.value,r.selectFormValues(),s))},ai=(e,t)=>{let{store:r,dispatchEvent:s,props:n}=t,i=e.currentTarget.id.replace("slider-","");i&&e.detail.value!==void 0&&(r.setFormFieldValue({name:i,value:e.detail.value,props:n}),me(i,e.detail.value,r.selectFormValues(),s))},li=(e,t)=>{let{store:r,dispatchEvent:s,props:n}=t,i=e.currentTarget.id.replace("slider-input-","");i&&e.detail.value!==void 0&&(r.setFormFieldValue({name:i,value:e.detail.value,props:n}),me(i,e.detail.value,r.selectFormValues(),s))},pi=(e,t)=>{e.type==="contextmenu"&&e.preventDefault();let{dispatchEvent:r}=t,s=e.currentTarget.id.replace("image-","");r(new CustomEvent("extra-event",{detail:{name:s,x:e.clientX,y:e.clientY,trigger:e.type}}))},ci=(e,t)=>{e.type==="contextmenu"&&e.preventDefault();let{dispatchEvent:r}=t,s=e.currentTarget.id.replace("waveform-","");r(new CustomEvent("extra-event",{detail:{name:s,x:e.clientX,y:e.clientY,trigger:e.type}}))},ui=(e,t)=>{let{store:r,dispatchEvent:s}=t,n=e.currentTarget.id.replace("select-","");s(new CustomEvent("action-click",{detail:{actionId:"select-options-add",name:n,formValues:r.selectFormValues()}}))},di=(e,t)=>{let{store:r,render:s,props:n}=t,i=e.currentTarget.id.replace("tooltip-icon-",""),o=n.form.fields.find(l=>l.name===i);if(o&&o.tooltip){let l=e.currentTarget.getBoundingClientRect();r.showTooltip({x:l.left+l.width/2,y:l.top-8,content:o.tooltip.content}),s()}},hi=(e,t)=>{let{store:r,render:s}=t;r.hideTooltip(),s()};var bt={};P(bt,{INITIAL_STATE:()=>Mi,getFormFieldValue:()=>qi,hideTooltip:()=>Qi,selectForm:()=>Ve,selectFormValues:()=>Ji,selectState:()=>Hi,setFormFieldValue:()=>Gi,setFormValues:()=>Yi,showTooltip:()=>Xi,toViewData:()=>Ui});var g={LITERAL:0,VARIABLE:1,INTERPOLATION:2,FUNCTION:3,BINARY:4,UNARY:5,CONDITIONAL:6,LOOP:7,OBJECT:8,ARRAY:9},B={EQ:0,NEQ:1,GT:2,LT:3,GTE:4,LTE:5,AND:6,OR:7,IN:8},Ae={NOT:0};var j=class extends Error{constructor(t){super(`Parse Error: ${t}`),this.name="JemplParseError"}},ge=class extends Error{constructor(t){super(`Render Error: ${t}`),this.name="JemplRenderError"}};var dt=e=>{if(!e||e.trim()==="")throw new j("Missing condition expression after '$if'");if(e.includes("===")||e.includes("!==")){let r=e.includes("===")?"==":"!=";throw new j(`Invalid comparison operator '${e.includes("===")?"===":"!=="}' - did you mean '${r}'? (got: '${e}')`)}let t=["<",">","<=",">=","==","!="];for(let r of t)if(e.trim().endsWith(r))throw new j(`Incomplete comparison expression - missing right operand (got: '${e}')`)},kr=e=>{if(e.trim().endsWith(" in"))throw new j(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(!e.includes(" in "))throw new j(`Invalid loop syntax - missing 'in' keyword (got: '$for ${e}')`);let[t,r]=e.split(" in ");if(!r||r.trim()==="")throw new j(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(t.includes(",")){let s=t.split(",").map(n=>n.trim());for(let n of s)if(!n)throw new j(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`)}else if(!t.trim())throw new j(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`)};var _r=(e,t)=>{if(t===null)return new ge(`Cannot iterate over null value at '$for ${e}'`);if(t===void 0)return new ge(`Cannot iterate over undefined value at '$for ${e}'`);let r=typeof t;return new ge(`Cannot iterate over non-array value (got: ${r}) at '$for ${e}'`)},Ar=(e,t)=>{let r=t&&Object.keys(t).length>0?Object.keys(t).join(", "):"no custom functions provided";return new ge(`Unknown function '${e}' (${r})`)};var fi=(e,t,r={})=>{let s=O(e,r,t,{});return s===void 0?{}:s},O=(e,t,r,s)=>{if(e.var&&!e.type)return K(e.var,r,s);if(e.type===g.LITERAL)return e.value;if(e.type===g.VARIABLE)return K(e.path,r,s);if(e.type===g.INTERPOLATION)return mi(e.parts,t,r,s);switch(e.type){case g.FUNCTION:return $r(e,t,r,s);case g.BINARY:return Cr(e,t,r,s);case g.UNARY:return Ir(e,t,r,s);case g.CONDITIONAL:return vi(e,t,r,s);case g.LOOP:return ki(e,t,r,s);case g.OBJECT:return Ai(e,t,r,s);case g.ARRAY:return Si(e,t,r,s);default:throw new Error(`Unknown node type: ${e.type}`)}},Sr=new Map,yi=e=>{let t=[],r="",s=!1;for(let n=0;n<e.length;n++){let i=e[n];if(i==="[")r&&(t.push({type:"property",value:r}),r=""),s=!0;else if(i==="]"){if(s&&r){let a=r.trim();/^\d+$/.test(a)?t.push({type:"index",value:parseInt(a,10)}):t.push({type:"property",value:`[${r}]`}),r=""}s=!1}else r+=i}return r&&t.push({type:"property",value:r}),t},K=(e,t,r)=>{if(!e)return;if(e in r)return r[e];let s=Sr.get(e);if(!s){let i=[],a="",o=0;for(let l=0;l<e.length;l++){let p=e[l];p==="["?(o++,a+=p):p==="]"?(o--,a+=p):p==="."&&o===0?a&&(i.push(a),a=""):a+=p}a&&i.push(a),s=[];for(let l of i){let p=yi(l.trim());s.push(...p)}Sr.set(e,s)}let n=t;for(let i=0;i<s.length;i++){let a=s[i];if(a.type==="property"&&a.value in r){n=r[a.value];continue}if(n==null)return;(a.type==="property"||a.type==="index")&&(n=n[a.value])}return n},mi=(e,t,r,s)=>{let n=[];for(let i of e)if(typeof i=="string")n.push(i);else{let a=O(i,t,r,s);n.push(a!=null?String(a):"")}return n.join("")},$r=(e,t,r,s)=>{let n=t[e.name];if(!n)throw Ar(e.name,t);let i=e.args.map(a=>O(a,t,r,s));return n(...i)},Se=(e,t,r,s)=>{if(e.var&&!e.type)return K(e.var,r,s);switch(e.type){case g.VARIABLE:return K(e.path,r,s);case g.LITERAL:return e.value;case g.BINARY:return Cr(e,t,r,s);case g.UNARY:return Ir(e,t,r,s);case g.FUNCTION:return $r(e,t,r,s);default:return O(e,t,r,s)}},Cr=(e,t,r,s)=>{if(e.op===B.AND||e.op===B.OR){let a=Se(e.left,t,r,s),o=Se(e.right,t,r,s);switch(e.op){case B.AND:return a&&o;case B.OR:return a||o}}let n=O(e.left,t,r,s),i=O(e.right,t,r,s);switch(e.op){case B.EQ:return n==i;case B.NEQ:return n!=i;case B.GT:return n>i;case B.LT:return n<i;case B.GTE:return n>=i;case B.LTE:return n<=i;case B.IN:return Array.isArray(i)?i.includes(n):!1;default:throw new Error(`Unknown binary operator: ${e.op}`)}},Ir=(e,t,r,s)=>{let n=e.op===Ae.NOT?Se(e.operand,t,r,s):O(e.operand,t,r,s);switch(e.op){case Ae.NOT:return!n;default:throw new Error(`Unknown unary operator: ${e.op}`)}},gi=(e,t,r,s)=>{if(e.conditions.length===2&&e.conditions[1]===null){let n=e.conditions[0];if(n.type===g.VARIABLE)if(K(n.path,r,s)){let a=e.bodies[0];if(a.type===g.OBJECT&&a.properties.length<=5){let o={};for(let l of a.properties){let p=l.parsedKey?O(l.parsedKey,t,r,s):l.key,u=l.value;if(u.type===g.LITERAL)o[p]=u.value;else if(u.type===g.VARIABLE)o[p]=K(u.path,r,s);else if(u.type===g.INTERPOLATION){let c=[];for(let h of u.parts)if(typeof h=="string")c.push(h);else if(h.type===g.VARIABLE){let y=K(h.path,r,s);c.push(y!=null?String(y):"")}else{let y=O(h,t,r,s);c.push(y!=null?String(y):"")}o[p]=c.join("")}else o[p]=O(u,t,r,s)}return o}}else{let a=e.bodies[1];if(a.type===g.OBJECT&&a.properties.length<=5){let o={};for(let l of a.properties){let p=l.parsedKey?O(l.parsedKey,t,r,s):l.key,u=l.value;if(u.type===g.LITERAL)o[p]=u.value;else if(u.type===g.VARIABLE)o[p]=K(u.path,r,s);else if(u.type===g.INTERPOLATION){let c=[];for(let h of u.parts)if(typeof h=="string")c.push(h);else if(h.type===g.VARIABLE){let y=K(h.path,r,s);c.push(y!=null?String(y):"")}else{let y=O(h,t,r,s);c.push(y!=null?String(y):"")}o[p]=c.join("")}else o[p]=O(u,t,r,s)}return o}}}return null},vi=(e,t,r,s)=>{let n=gi(e,t,r,s);if(n!==null)return n;for(let i=0;i<e.conditions.length;i++){let a=e.conditions[i];if(a===null||Se(a,t,r,s))return O(e.bodies[i],t,r,s)}return Or},bi=(e,t)=>{let r=e.body,s=e.itemVar;if(r.type===g.CONDITIONAL&&r.conditions.length===1&&r.conditions[0].type===g.VARIABLE){let n=r.conditions[0].path,i=r.bodies[0];if(n.startsWith(s+".")){let a=n.substring(s.length+1);if(i.type===g.OBJECT&&i.properties.length<=5){for(let l of i.properties)if(l.parsedKey)return null;let o=[];for(let l=0;l<t.length;l++){let p=t[l];if(p[a]){let u={};for(let c of i.properties){let h=c.key,y=c.value;if(y.type===g.LITERAL)u[h]=y.value;else if(y.type===g.VARIABLE){let d=y.path;if(d===s)u[h]=p;else if(d.startsWith(s+".")){let f=d.substring(s.length+1);u[h]=p[f]}else return null}else if(y.type===g.INTERPOLATION){let d=[],f=!0;for(let m of y.parts)if(typeof m=="string")d.push(m);else if(m.type===g.VARIABLE){let v=m.path;if(v===s)d.push(p!=null?String(p):"");else if(v.startsWith(s+".")){let w=v.substring(s.length+1),b=p[w];d.push(b!=null?String(b):"")}else{f=!1;break}}else{f=!1;break}if(!f)return null;u[h]=d.join("")}else return null}o.push(u)}}return o}}}return null},wi=(e,t)=>{let r=e.body,s=e.itemVar,n=bi(e,t);if(n!==null)return n;if(r.type===g.OBJECT&&r.properties.length<=5){for(let o of r.properties)if(o.parsedKey)return null;let i=[],a=!0;for(let o of r.properties){let l=o.key,p=o.value;if(p.type===g.LITERAL)i.push({key:l,type:"literal",value:p.value});else if(p.type===g.VARIABLE){let u=p.path;if(u===s)i.push({key:l,type:"item"});else if(u.startsWith(s+".")){let c=u.substring(s.length+1);if(!c.includes(".")&&!c.includes("["))i.push({key:l,type:"prop",prop:c});else{a=!1;break}}else{a=!1;break}}else if(p.type===g.INTERPOLATION&&p.parts.length===1){let u=p.parts[0];if(u.type===g.VARIABLE){let c=u.path;if(c===s)i.push({key:l,type:"item_string"});else if(c.startsWith(s+".")){let h=c.substring(s.length+1);if(!h.includes(".")&&!h.includes("["))i.push({key:l,type:"prop_string",prop:h});else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}if(a){let o=new Array(t.length);if(i.length===3&&i[0].type==="prop"&&i[0].key==="id"&&i[1].type==="prop_string"&&i[1].key==="title"&&i[2].type==="prop"&&i[2].key==="completed")for(let l=0;l<t.length;l++){let p=t[l];o[l]={id:p.id,title:p.title!=null?String(p.title):"",completed:p.completed}}else for(let l=0;l<t.length;l++){let p=t[l],u={};for(let c of i)if(c.type==="literal")u[c.key]=c.value;else if(c.type==="item")u[c.key]=p;else if(c.type==="prop")u[c.key]=p[c.prop];else if(c.type==="item_string")u[c.key]=p!=null?String(p):"";else if(c.type==="prop_string"){let h=p[c.prop];u[c.key]=h!=null?String(h):""}o[l]=u}return o}}return null},xi=(e,t,r,s,n)=>{let i=[],a=e.body;if(a.type===g.OBJECT&&a.fast!==!1){let o=e.itemVar,l=e.indexVar;for(let p=0;p<n.length;p++){let u=n[p],c={},h={...s,[o]:u,...l&&{[l]:p}};for(let y of a.properties){let d=y.parsedKey?O(y.parsedKey,t,r,h):y.key,f=y.value;if(f.type===g.LITERAL)c[d]=f.value;else if(f.type===g.VARIABLE){let m=f.path;if(m===o)c[d]=u;else if(m===l)c[d]=p;else if(m.startsWith(o+".")){let v=m.substring(o.length+1);!v.includes(".")&&!v.includes("[")?c[d]=u[v]:c[d]=K(m,r,{...s,[o]:u,...l&&{[l]:p}})}else c[d]=K(m,r,{...s,[o]:u,...l&&{[l]:p}})}else if(f.type===g.INTERPOLATION){let m=[];for(let v of f.parts)if(typeof v=="string")m.push(v);else if(v.type===g.VARIABLE){let w=v.path,b;if(w===o)b=u;else if(w===l)b=p;else if(w.startsWith(o+".")){let E=w.substring(o.length+1);!E.includes(".")&&!E.includes("[")?b=u[E]:b=K(w,r,{...s,[o]:u,...l&&{[l]:p}})}else b=K(w,r,{...s,[o]:u,...l&&{[l]:p}});m.push(b!=null?String(b):"")}else{let w={...s,[o]:u,...l&&{[l]:p}},b=O(v,t,r,w);m.push(b!=null?String(b):"")}c[d]=m.join("")}else{let m={...s,[o]:u,...l&&{[l]:p}};c[d]=O(f,t,r,m)}}i.push(c)}return i}return null},Ei=(e,t,r)=>{let s=e.body;if(s.type===g.OBJECT&&s.properties.length===1&&s.properties[0].key==="$if item.visible"){let i=s.properties[0].value;if(i.type===g.CONDITIONAL&&i.conditions.length===1&&i.conditions[0].type===g.VARIABLE&&i.conditions[0].path==="item.visible"){let a=i.bodies[0];if(a.type===g.OBJECT&&a.properties.length===2){let o=a.properties[0],l=a.properties[1];if(o.key==="id"&&o.value.type===g.VARIABLE&&o.value.path==="item.id"&&l.key==="$if item.highlighted"&&l.value.type===g.CONDITIONAL){let p=[];for(let u=0;u<t.length;u++){let c=t[u];if(c.visible){let h={id:c.id};c.highlighted?(h.highlight=!0,h.message=`This item is highlighted: ${c.name}`):(h.highlight=!1,h.message=c.name),p.push(h)}}return p}}}}return null},ki=(e,t,r,s)=>{let n=O(e.iterable,t,r,s);if(!Array.isArray(n)){let o=`${e.itemVar}${e.indexVar?`, ${e.indexVar}`:""} in ${e.iterable.path}`;throw _r(o,n)}if(!e.indexVar){let o=Ei(e,n,e.itemVar);if(o!==null)return o}if(!e.indexVar){let o=wi(e,n);if(o!==null)return o}let i=xi(e,t,r,s,n);if(i!==null)return i;let a=[];for(let o=0;o<n.length;o++){let l=e.indexVar?{...s,[e.itemVar]:n[o],[e.indexVar]:o}:{...s,[e.itemVar]:n[o]},p=O(e.body,t,r,l);Array.isArray(p)&&p.length===1?a.push(p[0]):a.push(p)}return a},_i=(e,t,r,s)=>{if(e.whenCondition)return null;if(e.properties.length===1){let n=e.properties[0],i=n.parsedKey?O(n.parsedKey,t,r,s):n.key,a=n.value;if(a.type===g.OBJECT&&a.properties.length<=10&&!a.whenCondition){let o={},l={},p=!0;for(let u of a.properties){let c=u.parsedKey?O(u.parsedKey,t,r,s):u.key,h=u.value;if(h.type===g.LITERAL)l[c]=h.value;else if(h.type===g.VARIABLE)l[c]=K(h.path,r,s);else if(h.type===g.INTERPOLATION){let y=[];for(let d of h.parts)if(typeof d=="string")y.push(d);else if(d.type===g.VARIABLE){let f=K(d.path,r,s);y.push(f!=null?String(f):"")}else{p=!1;break}if(!p)break;l[c]=y.join("")}else if(h.type===g.OBJECT&&h.properties.length<=5){let y={};for(let d of h.properties){let f=d.key,m=d.value;if(m.type===g.LITERAL)y[f]=m.value;else if(m.type===g.VARIABLE)y[f]=K(m.path,r,s);else if(m.type===g.INTERPOLATION){let v=[];for(let w of m.parts)if(typeof w=="string")v.push(w);else if(w.type===g.VARIABLE){let b=K(w.path,r,s);v.push(b!=null?String(b):"")}else{p=!1;break}if(!p)break;y[f]=v.join("")}else{p=!1;break}}if(!p)break;l[c]=y}else{p=!1;break}}if(p)return o[i]=l,o}}return null},Ai=(e,t,r,s)=>{if(e.whenCondition&&!Se(e.whenCondition,t,r,s))return;let n=_i(e,t,r,s);if(n!==null)return n;if(e.fast){let l={};for(let p of e.properties){let u=p.parsedKey?O(p.parsedKey,t,r,s):p.key,c=p.value;if(c.type===g.LITERAL)l[u]=c.value;else if(c.type===g.VARIABLE)l[u]=K(c.path,r,s);else if(c.type===g.INTERPOLATION){let h=[];for(let y of c.parts)if(typeof y=="string")h.push(y);else if(y.type===g.VARIABLE){let d=K(y.path,r,s);h.push(d!=null?String(d):"")}else{let d=O(y,t,r,s);h.push(d!=null?String(d):"")}l[u]=h.join("")}else l[u]=O(c,t,r,s)}return l}let i={},a=null,o=!1;for(let l of e.properties)if(!l.key.startsWith("$if ")&&!l.key.match(/^\$if\s+\w+.*:?$/)&&!l.key.startsWith("$elif")&&!l.key.startsWith("$else")&&!l.key.startsWith("$for ")){o=!0;break}for(let l of e.properties)if(l.key.startsWith("$if ")||l.key.match(/^\$if\s+\w+.*:?$/)){let p=O(l.value,t,r,s);if(!o&&p!==null&&p!==void 0)return Array.isArray(p)&&p.length===1?p[0]:p;typeof p=="object"&&p!==null&&!Array.isArray(p)&&Object.assign(i,p)}else if(!l.key.startsWith("$for ")){let p=l.value;if(p&&p.type===g.OBJECT&&p.properties){let u=p.properties.find(c=>c.key.startsWith("$for "));if(u){let c=O(u.value,t,r,s);c!==void 0&&(i[l.key]=c)}else{let c=O(l.value,t,r,s);c!==void 0&&(i[l.key]=c)}}else{let u=l.parsedKey?O(l.parsedKey,t,r,s):l.key,c=O(l.value,t,r,s);c!==void 0&&(i[u]=c)}}return i},Or={},Si=(e,t,r,s)=>{let n=[];for(let i of e.items)if(i.type===g.LOOP){let a=O(i,t,r,s);n.push(a)}else{let a=O(i,t,r,s);a!==Or&&a!==void 0&&n.push(a)}return n},ht=fi;var $i=/\$\{([^}]*)\}/g,Lr=e=>{let t=e.match(/^(\w+)\((.*)\)$/);if(!t)return{isFunction:!1};let[,r,s]=t,n=Ci(s);return{isFunction:!0,type:g.FUNCTION,name:r,args:n}},Ci=e=>e.trim()?Ii(e).map(r=>Oi(r.trim())):[],Ii=e=>{let t=[],r="",s=0,n=!1,i="";for(let a=0;a<e.length;a++){let o=e[a],l=a>0?e[a-1]:"";!n&&(o==='"'||o==="'")?(n=!0,i=o,r+=o):n&&o===i&&l!=="\\"?(n=!1,i="",r+=o):!n&&o==="("?(s++,r+=o):!n&&o===")"?(s--,r+=o):!n&&o===","&&s===0?(t.push(r),r=""):r+=o}return r&&t.push(r),t},Oi=e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:g.LITERAL,value:e.slice(1,-1)};if(/^-?\d+(\.\d+)?$/.test(e))return{type:g.LITERAL,value:parseFloat(e)};if(e==="true")return{type:g.LITERAL,value:!0};if(e==="false")return{type:g.LITERAL,value:!1};if(e==="null")return{type:g.LITERAL,value:null};let t=Lr(e);return t.isFunction?{type:t.type,name:t.name,args:t.args}:{type:g.VARIABLE,path:e}},Ti=/^\w+\(.*\)$/,Li=/\s[+\-*/%]\s|\|\||&&|\?\?|.*\?.*:/,Ni=e=>{if(!(!e||e.trim()===""||Ti.test(e))&&Li.test(e))throw e.includes("?")&&e.includes(":")?new j(`Complex expressions not supported in variable replacements - consider calculating the value in your data instead. Offending expression: "${e}"`):e.includes("||")||e.includes("&&")||e.includes("??")?new j(`Logical operators not supported in variable replacements - consider calculating the value in your data instead (operators like ||, &&, ?? are not supported). Offending expression: "${e}"`):new j(`Arithmetic expressions not supported in variable replacements - consider calculating '${e}' in your data instead (expressions with +, -, *, /, % are not supported). Offending expression: "${e}"`)},Tr=(e,t={})=>{let r=e.trim();Ni(r);let s=Lr(r);if(s.isFunction)return{type:s.type,name:s.name,args:s.args};if(r.includes("[")&&!/[\s+\-*/%|&?:]/.test(r)){let n=0;for(let i of r)i==="["?n++:i==="]"&&n--;if(n!==0)throw new Error("Invalid array index syntax")}return{type:g.VARIABLE,path:r}},ft=(e,t={})=>{let r=e,s=[];e.includes("\\${")&&(r=e.replace(/\\\\(\$\{[^}]*\})/g,"\\DOUBLE_ESC$1"),r=r.replace(/\\(\$\{[^}]*\})/g,(o,l)=>{let p=`__ESCAPED_${s.length}__`;return s.push(l),p}),r=r.replace(/\\DOUBLE_ESC/g,"\\"));let n=[...r.matchAll($i)];if(n.length===0){let o=r;for(let l=0;l<s.length;l++)o=o.replace(`__ESCAPED_${l}__`,s[l]);return{type:g.LITERAL,value:o}}if(n.length===1&&n[0][0]===r&&s.length===0)try{return Tr(n[0][1],t)}catch(o){if(o.message==="Invalid array index syntax")return{type:g.LITERAL,value:r};throw o}let i=[],a=0;for(let o of n){let[l,p]=o,u=o.index;if(u>a){let c=r.substring(a,u);for(let h=0;h<s.length;h++)c=c.replace(`__ESCAPED_${h}__`,s[h]);c&&i.push(c)}try{let c=Tr(p.trim(),t);i.push(c)}catch(c){if(c.message==="Invalid array index syntax")i.push(l);else throw c}a=u+l.length}if(a<r.length){let o=r.substring(a);for(let l=0;l<s.length;l++)o=o.replace(`__ESCAPED_${l}__`,s[l]);o&&i.push(o)}return{type:g.INTERPOLATION,parts:i}};var le=(e,t)=>typeof e=="string"?ft(e,t):typeof e=="object"&&e!==null?Array.isArray(e)?Vi(e,t):Ri(e,t):{type:g.LITERAL,value:e},Vi=(e,t)=>{let r=[],s=!1;for(let n=0;n<e.length;n++){let i=e[n];if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let o=Object.keys(i);if(o.length===1&&o[0].startsWith("$for ")){let l=Nr(o[0],i[o[0]],t);r.push(l),s=!0;continue}}let a=le(i,t);r.push(a),(a.type===g.FUNCTION||a.type===g.CONDITIONAL||a.type===g.LOOP||a.type===g.OBJECT&&!a.fast||a.type===g.ARRAY&&!a.fast)&&(s=!0)}return{type:g.ARRAY,items:r,fast:!s}},Ri=(e,t)=>{let r=[],s=!1,n=null,i=Object.entries(e),a=0;for(let[l,p]of i)if(l==="$when"){if(n!==null)throw new j("Multiple '$when' directives on the same object are not allowed");if(p==null)throw new j("Missing condition expression after '$when'");let u=typeof p=="string"?p:JSON.stringify(p);if(u.trim()==="")throw new j("Empty condition expression after '$when'");n=Z(u),s=!0}else if(l.startsWith("$when#")||l.startsWith("$when "))throw new j("'$when' does not support ID syntax or inline conditions - use '$when' as a property");for(;a<i.length;){let[l,p]=i[a];if(l==="$when"){a++;continue}if(l.startsWith("$if ")||l.match(/^\$if#\w+\s/)||l.match(/^\$if\s+\w+.*:$/)){let u=Pi(i,a,t);r.push({key:l,value:u.node}),s=!0,a=u.nextIndex}else if(l.startsWith("$for ")){let u=Nr(l,p,t);r.push({key:l,value:u}),s=!0,a++}else{if(l.startsWith("$elif ")||l.startsWith("$else"))throw new j(`'${l.split(" ")[0]}' without matching '$if'`);if(l==="$if"||l==="$if:")throw new j("Missing condition expression after '$if'");{let u=le(p,t);(u.type===g.FUNCTION||u.type===g.CONDITIONAL||u.type===g.LOOP||u.type===g.OBJECT&&!u.fast||u.type===g.ARRAY&&!u.fast)&&(s=!0);let c=ft(l,t),h={key:l,value:u};(c.type!==g.LITERAL||c.value!==l)&&(h.parsedKey=c),r.push(h),a++}}}let o={type:g.OBJECT,properties:r,fast:!s};return n&&(o.whenCondition=n),o},Pi=(e,t,r={})=>{let s=[],n=[],i=t,[a,o]=e[i],l=null,p;if(a.startsWith("$if#")){let c=a.match(/^\$if#(\w+)\s+(.+)$/);if(c)l=c[1],p=c[2];else throw new j(`Invalid conditional syntax: ${a}`)}else p=a.substring(4),p.endsWith(":")&&(p=p.slice(0,-1).trim());dt(p);let u=Z(p);for(s.push(u),n.push(le(o,r)),i++;i<e.length;){let[c,h]=e[i],y=!1,d;if(l?c.startsWith(`$elif#${l} `)?(d=c.substring(`$elif#${l} `.length),d.endsWith(":")&&(d=d.slice(0,-1).trim()),y=!0):(c===`$else#${l}`||c===`$else#${l}:`)&&(y=!0,d=null):c.startsWith("$elif ")?(d=c.substring(6),d.endsWith(":")&&(d=d.slice(0,-1).trim()),y=!0):(c==="$else"||c==="$else:")&&(y=!0,d=null),y){if(d===null)s.push(null);else{dt(d);let f=Z(d);s.push(f)}if(n.push(le(h,r)),i++,d===null)break}else break}return{node:{type:g.CONDITIONAL,conditions:s,bodies:n,id:l},nextIndex:i}},Z=e=>{if(e=e.trim(),e.startsWith("(")&&e.endsWith(")"))return Z(e.slice(1,-1));let t=Ne(e,"||");if(t!==-1)return{type:g.BINARY,op:B.OR,left:Z(e.substring(0,t).trim()),right:Z(e.substring(t+2).trim())};let r=Ne(e,"&&");if(r!==-1)return{type:g.BINARY,op:B.AND,left:Z(e.substring(0,r).trim()),right:Z(e.substring(r+2).trim())};let s=[{op:">=",type:B.GTE},{op:"<=",type:B.LTE},{op:"==",type:B.EQ},{op:"!=",type:B.NEQ},{op:">",type:B.GT},{op:"<",type:B.LT},{op:" in ",type:B.IN}];for(let{op:i,type:a}of s){let o=Ne(e,i);if(o!==-1)return{type:g.BINARY,op:a,left:Z(e.substring(0,o).trim()),right:Z(e.substring(o+i.length).trim())}}let n=[" + "," - "," * "," / "," % "];for(let i of n)if(Ne(e,i)!==-1)throw new j(`Arithmetic expressions not supported in conditionals - consider calculating '${e}' in your data instead (expressions with +, -, *, /, % are not supported). Offending expression: "${e}"`);return e.startsWith("!")?{type:g.UNARY,op:Ae.NOT,operand:Z(e.substring(1).trim())}:ji(e)},Ne=(e,t)=>{let r=0,s=0;for(;s<=e.length-t.length;){if(e[s]==="(")r++;else if(e[s]===")")r--;else if(r===0&&e.substring(s,s+t.length)===t)return s;s++}return-1},ji=e=>{if(e=e.trim(),e==="true")return{type:g.LITERAL,value:!0};if(e==="false")return{type:g.LITERAL,value:!1};if(e==="null")return{type:g.LITERAL,value:null};if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:g.LITERAL,value:e.slice(1,-1)};if(e==='""'||e==="''")return{type:g.LITERAL,value:""};let t=Number(e);return!isNaN(t)&&isFinite(t)?{type:g.LITERAL,value:t}:{type:g.VARIABLE,path:e}},Nr=(e,t,r)=>{let s=e.substring(5).trim();kr(s);let n=s.match(/^(.+?)\s+in\s+(.+)$/);if(!n)throw new j(`Invalid loop syntax - missing 'in' keyword (got: '$for ${s}')`);let i=n[1].trim(),a=n[2].trim(),o,l=null;if(i.includes(",")){let c=i.split(",").map(h=>h.trim());if(c.length!==2)throw new j(`Invalid loop variables: ${i}. Expected format: "item" or "item, index"`);o=c[0],l=c[1]}else o=i;let p={type:g.VARIABLE,path:a},u=le(t,r);return{type:g.LOOP,itemVar:o,indexVar:l,iterable:p,body:u}};var Di=(e,t={})=>{let{functions:r={}}=t;return le(e,r)},yt=Di;var mt={};P(mt,{now:()=>Bi});var Bi=()=>Date.now();var Wi=(e,t,r={})=>{let{functions:s={}}=r,n={...mt,...s},i=yt(e,{functions:n});return ht(i,t,n)},gt=Wi;var Vr=e=>{function t(r){let s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return r.replace(/[&<>"']/g,n=>s[n])}return e==null?"":`"${t(String(e))}"`};function Rr(e,t){return t.reduce((r,s)=>(s in e&&(r[s]=e[s]),r),{})}var Mi=Object.freeze({formValues:{},tooltipState:{open:!1,x:0,y:0,content:""}}),vt=(e,t,r=void 0)=>{if(!t)return;let s=t.split(/[\[\].]/).filter(i=>i!==""),n=e;for(let i of s){if(n==null||!(i in n))return r;n=n[i]}return n},Ki=(e,t,r)=>{let s=t.split(/[\[\].]/).filter(i=>i!=="");t.includes("[")&&t in e&&delete e[t];let n=e;for(let i=0;i<s.length-1;i++){let a=s[i];if(!(a in n)||typeof n[a]!="object"||n[a]===null){let o=s[i+1],l=/^\d+$/.test(o);n[a]=l?[]:{}}n=n[a]}return n[s[s.length-1]]=r,e},Fi=["id","class","style","slot"],zi=e=>Object.entries(e).filter(([t])=>!Fi.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ve=({state:e,props:t})=>{let{form:r}=t,{context:s}=t;return s?gt(r,s):r},Ui=({state:e,props:t,attrs:r})=>{let s=zi(r),n=t.defaultValues||{},i=Ve({state:e,props:t}),a=structuredClone(i.fields||[]);return a.forEach(o=>{let l=vt(e.formValues,o.name)??vt(n,o.name);if(["popover-input","select","read-only-text"].includes(o.inputType)?o.defaultValue=l:o.defaultValue=Vr(l),["inputText"].includes(o.inputType)&&(o.placeholder=Vr(o.placeholder)),o.inputType==="image"){let p=o.src;o.imageSrc=p&&p.trim()?p:null,o.placeholderText=o.placeholder||"No Image"}if(o.inputType==="waveform"){let p=o.waveformData;o.waveformData=p||null,o.placeholderText=o.placeholder||"No Waveform"}}),{key:r?.key,containerAttrString:s,title:i?.title||"",description:i?.description||"",fields:a,actions:t?.form?.actions||{buttons:[]},formValues:e.formValues,tooltipState:e.tooltipState}},Hi=({state:e})=>e,Ji=({state:e,props:t})=>{let r=Ve({state:e,props:t});return Rr(e.formValues,r.fields.map(s=>s.name))},qi=({state:e},t)=>vt(e.formValues,t),Yi=(e,t)=>{e.formValues=t||{}},Gi=(e,{name:t,value:r,props:s})=>{Ki(e.formValues,t,r);let n=Ve({state:e,props:s}),i=Rr(e.formValues,n.fields.map(a=>a.name));e.formValues=i},Xi=(e,{x:t,y:r,content:s})=>{e.tooltipState={open:!0,x:t,y:r,content:s}},Qi=e=>{e.tooltipState={...e.tooltipState,open:!1}};var Pr={elementName:"rtgl-form",viewDataSchema:{type:"object"},propsSchema:{type:"object",properties:{defaultValues:{type:"object"},context:{type:"object"},form:{type:"object",properties:{title:{type:"string"},description:{type:"string"},fields:{type:"array",items:{anyOf:[{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"inputText"},placeholder:{type:"string"},tooltip:{type:"object",properties:{content:{type:"string"}}}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"select"},placeholder:{type:"string"},noClear:{type:"boolean"},addOption:{type:"object",properties:{label:{type:"string"}}},options:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"any"}},required:["label","value"]}},tooltip:{type:"object",properties:{content:{type:"string"}}}},required:["name","label","inputType","options"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"colorPicker"},value:{type:"string"},tooltip:{type:"object",properties:{content:{type:"string"}}}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"slider"},min:{type:"number"},max:{type:"number"},step:{type:"number"},value:{type:"number"},tooltip:{type:"object",properties:{content:{type:"string"}}}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"slider-input"},min:{type:"number"},max:{type:"number"},step:{type:"number"},value:{type:"number"},tooltip:{type:"object",properties:{content:{type:"string"}}}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"image"},width:{type:"number"},height:{type:"number"},placeholder:{type:"string"},tooltip:{type:"object",properties:{content:{type:"string"}}}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"waveform"},width:{type:"number"},height:{type:"number"},placeholder:{type:"string"},defaultValue:{type:"object"},waveformData:{type:"object"},tooltip:{type:"object",properties:{content:{type:"string"}}}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"popover-input"},placeholder:{type:"string"},tooltip:{type:"object",properties:{content:{type:"string"}}}},required:["name","label","inputType"],additionalProperties:!1}]}},actions:{type:"object",properties:{buttons:{type:"array",items:{type:"object",properties:{id:{type:"string"},content:{type:"string"}},required:["id","content"]}}}}}}}},refs:{"action-*":{eventListeners:{click:{handler:"handleActionClick"}}},"tooltip-icon-*":{eventListeners:{mouseenter:{handler:"handleTooltipMouseEnter"},mouseleave:{handler:"handleTooltipMouseLeave"}}},"input-*":{eventListeners:{"input-change":{handler:"handleInputChange"}}},"select-*":{eventListeners:{"select-change":{handler:"handleSelectChange"},"add-option-selected":{handler:"handleSelectAddOption"}}},"colorpicker-*":{eventListeners:{"colorpicker-change":{handler:"handleColorPickerChange"}}},"slider-*":{eventListeners:{"slider-change":{handler:"handleSliderChange"}}},"slider-input-*":{eventListeners:{"slider-input-value-change":{handler:"handleSliderInputChange"}}},"image-*":{eventListeners:{click:{handler:"handleImageClick"},contextmenu:{handler:"handleImageClick"}}},"waveform-*":{eventListeners:{click:{handler:"handleWaveformClick"},contextmenu:{handler:"handleWaveformClick"}}},"popover-input-*":{eventListeners:{"input-change":{handler:"handlePopoverInputChange"}}}},events:{"form-change":{},"extra-event":{},"action-click":{}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f p=md g=lg ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=sm w=f",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"title"}}],fast:!0},{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:1,path:"description"}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-view g=lg w=f",value:{type:9,items:[{type:7,itemVar:"field",indexVar:"i",iterable:{type:1,path:"fields"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=md w=f",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=sm",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h g=md av=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"field.label"}}],fast:!0},{type:8,properties:[{key:"$if field.tooltip",value:{type:6,conditions:[{type:1,path:"field.tooltip"}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-svg#tooltip-icon-${field.name} svg="info" wh=16 c=mu-fg cur=help ml=xs',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg#tooltip-icon-",{type:1,path:"field.name"},' svg="info" wh=16 c=mu-fg cur=help ml=xs']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1},{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"field.description"}}],fast:!0}],fast:!1}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "read-only-text"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"read-only-text"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm",value:{type:1,path:"field.defaultValue"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "inputText"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"inputText"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input#input-${field.name} key=${key} w=f placeholder=${field.placeholder} value=${field.defaultValue}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#input-",{type:1,path:"field.name"}," key=",{type:1,path:"key"}," w=f placeholder=",{type:1,path:"field.placeholder"}," value=",{type:1,path:"field.defaultValue"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "popover-input"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"popover-input"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-popover-input#popover-input-${field.name} label="${field.label}" .defaultValue=fields[${i}].defaultValue',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-popover-input#popover-input-",{type:1,path:"field.name"},' label="',{type:1,path:"field.label"},'" .defaultValue=fields[',{type:1,path:"i"},"].defaultValue"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "select"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"select"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-select#select-${field.name} key=${key} w=f .options=fields[${i}].options .placeholder=fields[${i}].placeholder .selectedValue=fields[${i}].defaultValue ?no-clear=fields[${i}].noClear .addOption=fields[${i}].addOption",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-select#select-",{type:1,path:"field.name"}," key=",{type:1,path:"key"}," w=f .options=fields[",{type:1,path:"i"},"].options .placeholder=fields[",{type:1,path:"i"},"].placeholder .selectedValue=fields[",{type:1,path:"i"},"].defaultValue ?no-clear=fields[",{type:1,path:"i"},"].noClear .addOption=fields[",{type:1,path:"i"},"].addOption"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "colorPicker"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"colorPicker"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-color-picker#colorpicker-${field.name} key=${key} value=${field.defaultValue}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-color-picker#colorpicker-",{type:1,path:"field.name"}," key=",{type:1,path:"key"}," value=",{type:1,path:"field.defaultValue"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "slider"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"slider"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-slider#slider-${field.name} key=${key} w=f min=${field.min} max=${field.max} step=${field.step} value=${field.defaultValue}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider#slider-",{type:1,path:"field.name"}," key=",{type:1,path:"key"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," value=",{type:1,path:"field.defaultValue"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "slider-input"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"slider-input"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-slider-input#slider-input-${field.name} key=${key} w=f min=${field.min} max=${field.max} step=${field.step} defaultValue=${field.defaultValue}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider-input#slider-input-",{type:1,path:"field.name"}," key=",{type:1,path:"key"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," defaultValue=",{type:1,path:"field.defaultValue"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "image" && field.imageSrc',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"image"}},right:{type:1,path:"field.imageSrc"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image#image-${field.name} src=${field.imageSrc} w=${field.width} h=${field.height} cur=p",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image#image-",{type:1,path:"field.name"}," src=",{type:1,path:"field.imageSrc"}," w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," cur=p"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "image" && !field.imageSrc',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"image"}},right:{type:5,op:0,operand:{type:1,path:"field.imageSrc"}}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view#image-${field.name} w=${field.width} h=${field.height} bc=ac bw=sm ah=c av=c cur=p p=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg ta=c",value:{type:1,path:"field.placeholderText"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#image-",{type:1,path:"field.name"}," w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," bc=ac bw=sm ah=c av=c cur=p p=md"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "waveform" && field.waveformData',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"waveform"}},right:{type:1,path:"field.waveformData"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-waveform#waveform-${field.name} .waveformData=fields[${i}].waveformData w=${field.width} h=${field.height} cur=p",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-waveform#waveform-",{type:1,path:"field.name"}," .waveformData=fields[",{type:1,path:"i"},"].waveformData w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," cur=p"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "waveform" && !field.waveformData',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"waveform"}},right:{type:5,op:0,operand:{type:1,path:"field.waveformData"}}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view#waveform-${field.name} w=${field.width} h=${field.height} bc=ac bw=sm ah=c av=c cur=p p=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg ta=c",value:{type:1,path:"field.placeholder"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#waveform-",{type:1,path:"field.name"}," w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," bc=ac bw=sm ah=c av=c cur=p p=md"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "slot"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"slot"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'slot#slot-${field.slotName} name=${field.slot} style="display: contents;"',value:{type:0,value:null},parsedKey:{type:2,parts:["slot#slot-",{type:1,path:"field.slotName"}," name=",{type:1,path:"field.slot"},' style="display: contents;"']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}}],fast:!1},{type:8,properties:[{key:"rtgl-view g=sm w=f",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h ah=e g=sm w=f",value:{type:9,items:[{type:7,itemVar:"button",indexVar:"i",iterable:{type:1,path:"actions.buttons"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-button#action-${button.id}",value:{type:1,path:"button.content"},parsedKey:{type:2,parts:["rtgl-button#action-",{type:1,path:"button.id"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1},{type:8,properties:[{key:'rtgl-tooltip ?open=${tooltipState.open} x=${tooltipState.x} y=${tooltipState.y} placement="top" content="${tooltipState.content}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-tooltip ?open=",{type:1,path:"tooltipState.open"}," x=",{type:1,path:"tooltipState.x"}," y=",{type:1,path:"tooltipState.y"},' placement="top" content="',{type:1,path:"tooltipState.content"},'"']}}],fast:!0}],fast:!1},parsedKey:{type:2,parts:["rtgl-view w=f p=md g=lg ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var wt={};P(wt,{handleClickStart:()=>Zi});var Zi=(e,t)=>{let{dispatchEvent:r,store:s}=t;console.log("handle click start",s.selectPath()),r(new CustomEvent("clickStart",{detail:{path:s.selectPath()}}))};var xt={};P(xt,{INITIAL_STATE:()=>en,selectPath:()=>nn,setState:()=>on,toViewData:()=>sn});var en=Object.freeze({}),tn=["id","class","style","slot"],rn=e=>Object.entries(e).filter(([t])=>!tn.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),sn=({state:e,props:t,attrs:r})=>{console.log("attrs",{attrs:r,entries:Object.entries(r)});let s=r.start?JSON.parse(decodeURIComponent(r.start)):t.start;return{containerAttrString:rn(r),start:s||{label:"",image:{src:"",width:32,height:32,alt:""}}}},nn=({props:e})=>e.start.path,on=e=>{};var jr={elementName:"rtgl-navbar",viewDataSchema:{type:"object",properties:{containerAttrString:{type:"string"},start:{type:"object",properties:{label:{type:"string"},href:{type:"string"},image:{type:"object",properties:{src:{type:"string"}}},hasImage:{type:"boolean"},hasHref:{type:"boolean"}}}}},propsSchema:{type:"object",properties:{start:{type:"object",properties:{label:{type:"string"},href:{type:"string"},image:{type:"object",properties:{src:{type:"string"}}}}}}},refs:{start:{eventListeners:{click:{handler:"handleClickStart"}}}},events:{clickStart:{type:"object",properties:{path:{type:"string"}}}},anchors:[[{"rtgl-text s=lg":"${start.label}"},{"$if start.image && start.image.src":[{"rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}":null}]}]],template:{type:9,items:[{type:8,properties:[{key:"rtgl-view bgc=bg d=h h=48 av=c w=f ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"$if start.href",value:{type:6,conditions:[{type:1,path:"start.href"},{type:1,path:"start.path"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"a href=${start.href}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c g=lg g=md",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"start.label"}}],fast:!0},{type:8,properties:[{key:"$if start.image && start.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"start.image"},right:{type:1,path:"start.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"start.image.width"}," h=",{type:1,path:"start.image.height"}," src=",{type:1,path:"start.image.src"}," alt=",{type:1,path:"start.image.alt"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["a href=",{type:1,path:"start.href"}]}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view#start d=h av=c g=lg g=md cur=p",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"start.label"}}],fast:!0},{type:8,properties:[{key:"$if start.image && start.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"start.image"},right:{type:1,path:"start.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"start.image.width"}," h=",{type:1,path:"start.image.height"}," src=",{type:1,path:"start.image.src"}," alt=",{type:1,path:"start.image.alt"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c g=lg g=md",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"start.label"}}],fast:!0},{type:8,properties:[{key:"$if start.image && start.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"start.image"},right:{type:1,path:"start.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"start.image.width"}," h=",{type:1,path:"start.image.height"}," src=",{type:1,path:"start.image.src"}," alt=",{type:1,path:"start.image.alt"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-view flex=1",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:"rtgl-view d=h av=c g=lg",value:{type:9,items:[{type:8,properties:[{key:"slot name=right",value:{type:0,value:null}}],fast:!0}],fast:!0}}],fast:!0}],fast:!1},parsedKey:{type:2,parts:["rtgl-view bgc=bg d=h h=48 av=c w=f ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var Et={};P(Et,{handleBeforeMount:()=>ln});var Dr=(e,t,r)=>{let{store:s,render:n}=r,i,a=-1/0;if(e.forEach(o=>{let l=o.getBoundingClientRect();l.top<=t&&l.top>a&&(a=l.top,i=o.id)}),!i){let o=1/0;e.forEach(l=>{let p=l.getBoundingClientRect();p.top>t&&p.top<o&&(o=p.top,i=l.id)})}i&&i!==s.selectCurrentId()&&(s.setCurrentId(i),n())},an=(e,t,r,s)=>{let{store:n,render:i}=s,a=e.querySelectorAll("h1[id], h2[id], h3[id], h4[id], rtgl-text[id]"),o=Array.from(a),l=o.map(u=>{let c=1,h=u.tagName.toLowerCase();return h==="h1"?c=1:h==="h2"?c=2:h==="h3"?c=3:h==="h4"?c=4:h==="rtgl-text"&&(c=parseInt(u.getAttribute("data-level")||"1",10)),{id:u.id,href:`#${u.id}`,title:u.textContent,level:c}});n.setItems(l),Dr(o,r,s),i();let p=Dr.bind(void 0,o,r,s);return t.addEventListener("scroll",p,{passive:!0}),()=>{t.removeEventListener("scroll",p)}},ln=e=>{let{attrs:t}=e;requestAnimationFrame(()=>{let r=document.getElementById(t["target-id"]),s=window;t["scroll-container-id"]&&(s=document.getElementById(t["scroll-container-id"])||window);let n=parseInt(t["offset-top"]||"100",10),i=an(r,s,n,e);return()=>{i()}})};var kt={};P(kt,{INITIAL_STATE:()=>pn,selectCurrentId:()=>dn,selectState:()=>un,setContentContainer:()=>yn,setCurrentId:()=>fn,setItems:()=>hn,toViewData:()=>cn});var pn=Object.freeze({items:[],currentId:null,contentContainer:null}),cn=({state:e})=>{let r=((s,n)=>{let i=new Set,a=s.findIndex(l=>l.id===n);if(a===-1)return i;let o=s[a].level;for(let l=a-1;l>=0;l--)if(s[l].level<o){let p=s[l].level;i.add(s[l].id);for(let u=l-1;u>=0;u--)s[u].level<p&&(i.add(s[u].id),p=s[u].level);break}return i})(e.items,e.currentId);return{items:e.items.map(s=>{let n={1:"0",2:"12px",3:"24px",4:"32px"},i=s.id===e.currentId,a=r.has(s.id),o=i||a;return{...s,c:o?"fg":"mu-fg",ml:n[s.level]||"",bc:o?"fg":"mu-fg"}}),currentId:e.currentId}},un=({state:e})=>e,dn=({state:e})=>e.currentId,hn=(e,t)=>{e.items=t},fn=(e,t)=>{e.currentId=t},yn=(e,t)=>{e.contentContainer=t};var Br={elementName:"rtgl-page-outline",viewDataSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{slug:{type:"string"},title:{type:"string"}}}},selectedSlug:{type:"string",nullable:!0}}},propsSchema:{type:"object",properties:{}},refs:{},events:{onItemClick:{type:"object"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view h=f w=272 pr=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f mt=xl",value:{type:9,items:[{type:7,itemVar:"item",indexVar:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:'rtgl-view d=h bwl=xs bc="${item.bc}" pv=sm av=c href=${item.href} pl=md',value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=${item.ml}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-view w=",{type:1,path:"item.ml"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-text s=sm c=${item.c} h-c=fg",value:{type:1,path:"item.title"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.c"}," h-c=fg"]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:['rtgl-view d=h bwl=xs bc="',{type:1,path:"item.bc"},'" pv=sm av=c href=',{type:1,path:"item.href"}," pl=md"]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}};var _t={};P(_t,{handleBeforeMount:()=>mn,handleInputChange:()=>wn,handleInputKeydown:()=>En,handleOnUpdate:()=>gn,handlePopoverClose:()=>bn,handleSubmitClick:()=>xn,handleTextClick:()=>vn});var mn=e=>{let{store:t,props:r}=e;(r.value!==void 0||r.defaultValue!==void 0)&&t.setValue(r.value||r.defaultValue||"")},gn=(e,t)=>{let{oldProps:r,newProps:s}=e,{store:n,props:i,render:a}=t;r.defaultValue!==s.defaultValue&&n.setValue(i.defaultValue||""),a()},vn=(e,t)=>{let{store:r,render:s,getRefIds:n,attrs:i}=t,a=r.selectValue();r.setTempValue(a),r.openPopover({position:{x:e.currentTarget.getBoundingClientRect().left,y:e.currentTarget.getBoundingClientRect().bottom}});let{input:o}=n();o.elm.value=a,s(),i["auto-focus"]&&setTimeout(()=>{o.elm.focus()},50)},bn=(e,t)=>{let{store:r,render:s}=t;r.closePopover(),s()},wn=(e,t)=>{let{store:r,render:s,dispatchEvent:n}=t,i=e.detail.value;r.setTempValue(i),n(new CustomEvent("temp-input-change",{detail:{value:i},bubbles:!0})),s()},xn=(e,t)=>{let{store:r,render:s,dispatchEvent:n,getRefIds:i}=t,{input:a}=i(),o=a.elm.value;r.setValue(o),r.closePopover(),n(new CustomEvent("input-change",{detail:{value:o},bubbles:!0})),s()},En=(e,t)=>{let{store:r,render:s,dispatchEvent:n,getRefIds:i}=t;if(e.key==="Enter"){let{input:a}=i(),o=a.elm.value;r.closePopover(),n(new CustomEvent("input-change",{detail:{value:o},bubbles:!0})),s()}else e.key==="Escape"&&(r.closePopover(),s())};var At={};P(At,{INITIAL_STATE:()=>kn,closePopover:()=>$n,openPopover:()=>Sn,selectValue:()=>In,setTempValue:()=>An,setValue:()=>Cn,toViewData:()=>_n});var kn=Object.freeze({isOpen:!1,position:{x:0,y:0},value:"",tempValue:""}),_n=({attrs:e,state:t,props:r})=>{let s=t.value||"-";return{isOpen:t.isOpen,position:t.position,value:s??"-",tempValue:t.tempValue,placeholder:r.placeholder??"",label:e.label}},An=(e,t)=>{e.tempValue=t},Sn=(e,t)=>{let{position:r}=t;e.position=r,e.isOpen=!0,e.hasUnsavedChanges=!1},$n=e=>{e.isOpen=!1,e.tempValue=""},Cn=(e,t)=>{e.value=t},In=({state:e})=>e.value;var Wr={elementName:"rtgl-popover-input",viewDataSchema:{type:"object"},attrsSchema:{type:"object",properties:{"auto-focus":{type:"boolean"}}},propsSchema:{type:"object",properties:{value:{type:"string"},defaultValue:{type:"string"},placeholder:{type:"string"},onChange:{type:"function"}}},refs:{"text-display":{eventListeners:{click:{handler:"handleTextClick"}}},popover:{eventListeners:{close:{handler:"handlePopoverClose"}}},input:{eventListeners:{"input-change":{handler:"handleInputChange"},keydown:{handler:"handleInputKeydown"}}},submit:{eventListeners:{click:{handler:"handleSubmitClick"}}}},events:{"input-change":{}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view#text-display w=f cur=p",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"value"}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-popover#popover ?open=${isOpen} x=${position.x} y=${position.y}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=md w=240 slot=content bgc=background br=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"label"}}],fast:!0},{type:8,properties:[{key:"rtgl-input#input w=f placeholder=${placeholder}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#input w=f placeholder=",{type:1,path:"placeholder"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=f ah=e",value:{type:9,items:[{type:8,properties:[{key:"rtgl-button#submit",value:{type:0,value:"Submit"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-popover#popover ?open=",{type:1,path:"isOpen"}," x=",{type:1,path:"position.x"}," y=",{type:1,path:"position.y"}]}}],fast:!0}],fast:!0}};var St={};P(St,{handleAddOptionClick:()=>Dn,handleAddOptionMouseEnter:()=>Bn,handleAddOptionMouseLeave:()=>Wn,handleBeforeMount:()=>On,handleButtonClick:()=>Ln,handleClearClick:()=>jn,handleClickOptionsPopoverOverlay:()=>Nn,handleOnUpdate:()=>Tn,handleOptionClick:()=>Vn,handleOptionMouseEnter:()=>Rn,handleOptionMouseLeave:()=>Pn});var On=e=>{let{store:t,props:r,render:s}=e;if(r.selectedValue!==null&&r.selectedValue!==void 0&&r.options){let n=r.options.find(i=>oe(i.value,r.selectedValue));n&&(t.updateSelectOption(n),s())}},Tn=(e,t)=>{let{oldAttrs:r,newAttrs:s,oldProps:n,newProps:i}=e,{store:a,props:o,render:l}=t;if(r?.key!==s?.key&&s?.key){a.resetSelection();let p=i?.selectedValue||o?.selectedValue,u=i?.options||o?.options;if(p!=null&&u){let c=u.find(h=>oe(h.value,p));c&&a.updateSelectOption(c)}l()}},Ln=(e,t)=>{let{store:r,render:s,getRefIds:n,props:i}=t,a=n()["select-button"].elm,o=a.firstElementChild,l=o?o.getBoundingClientRect():a.getBoundingClientRect(),p=r.selectSelectedValue(),u=p!==null?p:i.selectedValue,c=null;u!=null&&i.options&&(c=i.options.findIndex(h=>oe(h.value,u)),c===-1&&(c=null)),r.openOptionsPopover({position:{y:l.bottom+12,x:l.left-24},selectedIndex:c}),s()},Nn=(e,t)=>{let{store:r,render:s}=t;r.closeOptionsPopover(),s()},Vn=(e,t)=>{let{render:r,dispatchEvent:s,props:n,store:i}=t,a=e.currentTarget.id.replace("option-",""),o=n.options[a];i.updateSelectOption(o),n.onChange&&typeof n.onChange=="function"&&n.onChange(o.value),s(new CustomEvent("option-selected",{detail:{value:o.value,label:o.label},bubbles:!0})),s(new CustomEvent("select-change",{detail:{selectedValue:o.value},bubbles:!0})),r()},Rn=(e,t)=>{let{store:r,render:s}=t,n=parseInt(e.currentTarget.id.replace("option-",""));r.setHoveredOption(n),s()},Pn=(e,t)=>{let{store:r,render:s}=t;r.clearHoveredOption(),s()},jn=(e,t)=>{let{store:r,render:s,dispatchEvent:n,props:i}=t;e.stopPropagation(),r.clearSelectedValue(),i.onChange&&typeof i.onChange=="function"&&i.onChange(void 0),n(new CustomEvent("option-selected",{detail:{value:void 0,label:void 0},bubbles:!0})),n(new CustomEvent("select-change",{detail:{selectedValue:void 0},bubbles:!0})),s()},Dn=(e,t)=>{let{store:r,render:s,dispatchEvent:n}=t;r.closeOptionsPopover(),n(new CustomEvent("add-option-selected",{bubbles:!0})),s()},Bn=(e,t)=>{let{store:r,render:s}=t;r.setHoveredAddOption(!0),s()},Wn=(e,t)=>{let{store:r,render:s}=t;r.setHoveredAddOption(!1),s()};var $t={};P($t,{INITIAL_STATE:()=>Fn,clearHoveredOption:()=>Qn,clearSelectedValue:()=>Zn,closeOptionsPopover:()=>qn,openOptionsPopover:()=>Jn,resetSelection:()=>Gn,selectSelectedValue:()=>Hn,selectState:()=>Un,setHoveredAddOption:()=>eo,setHoveredOption:()=>Xn,toViewData:()=>zn,updateSelectOption:()=>Yn});var Mn=["id","class","style","slot","placeholder","selectedValue","selected-value","onChange","on-change","options"],Kn=e=>Object.entries(e||{}).filter(([t])=>!Mn.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Fn=Object.freeze({isOpen:!1,position:{x:0,y:0},selectedValue:null,hoveredOptionId:null,hoveredAddOption:!1}),zn=({state:e,props:t,attrs:r})=>{let s=Kn(r),n=e.selectedValue!==null?e.selectedValue:t.selectedValue,i=t.placeholder||"Select an option",a=!0;if(n!=null&&t.options){let l=t.options.find(p=>oe(p.value,n));l&&(i=l.label,a=!1)}let o=(t.options||[]).map((l,p)=>{let u=oe(l.value,n),c=e.hoveredOptionId===p;return{...l,isSelected:u,bgc:c?"ac":u?"mu":""}});return{containerAttrString:s,isOpen:e.isOpen,position:e.position,options:o,selectedValue:n,selectedLabel:i,selectedLabelColor:a?"mu-fg":"fg",placeholder:t.placeholder||"Select an option",hasValue:n!=null,showClear:!r["no-clear"]&&!t["no-clear"]&&n!=null,showAddOption:!!t.addOption,addOptionLabel:t.addOption?.label?`+ ${t.addOption.label}`:"+ Add",addOptionBgc:e.hoveredAddOption?"ac":""}},Un=({state:e})=>e,Hn=({state:e})=>e.selectedValue,Jn=(e,t)=>{let{position:r,selectedIndex:s}=t;e.position=r,e.isOpen=!0,s!=null&&(e.hoveredOptionId=s)},qn=e=>{e.isOpen=!1},Yn=(e,t)=>{e.selectedValue=t.value,e.isOpen=!1},Gn=e=>{e.selectedValue=void 0},Xn=(e,t)=>{e.hoveredOptionId=t},Qn=e=>{e.hoveredOptionId=null},Zn=e=>{e.selectedValue=void 0},eo=(e,t)=>{e.hoveredAddOption=t};var Mr={elementName:"rtgl-select",viewDataSchema:{type:"object"},propsSchema:{type:"object",properties:{options:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"any"}}}},selectedValue:{type:"any"},placeholder:{type:"string"},onChange:{type:"function"},"no-clear":{type:"boolean"},addOption:{type:"object",properties:{label:{type:"string"}}}}},refs:{"select-button":{eventListeners:{click:{handler:"handleButtonClick"}}},"clear-button":{eventListeners:{click:{handler:"handleClearClick"}}},popover:{eventListeners:{close:{handler:"handleClickOptionsPopoverOverlay"}}},"option-*":{eventListeners:{click:{handler:"handleOptionClick"},mouseenter:{handler:"handleOptionMouseEnter"},mouseleave:{handler:"handleOptionMouseLeave"}}},"option-add":{eventListeners:{click:{handler:"handleAddOptionClick"},mouseenter:{handler:"handleAddOptionMouseEnter"},mouseleave:{handler:"handleAddOptionMouseLeave"}}}},events:{},template:{type:9,items:[{type:8,properties:[{key:"rtgl-button#select-button v=ol ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c w=f",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${selectedLabelColor}",value:{type:1,path:"selectedLabel"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"selectedLabelColor"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-view mh=md flex=1",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:"$if showClear",value:{type:6,conditions:[{type:1,path:"showClear"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-svg#clear-button mr=md svg=x wh=16 c=mu-fg cur=p",value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-svg svg=chevronDown wh=16 c=mu-fg",value:{type:0,value:null}}],fast:!0}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-button#select-button v=ol ",{type:1,path:"containerAttrString"}]}}],fast:!1},{type:8,properties:[{key:"rtgl-popover#popover ?open=${isOpen} x=${position.x} y=${position.y} placement=right-start",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view wh=300 g=xs slot=content bgc=background br=md sv=true",value:{type:9,items:[{type:7,itemVar:"option",indexVar:"i",iterable:{type:1,path:"options"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view#option-${i} w=f ph=lg pv=md cur=p br=md bgc=${option.bgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"option.label"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#option-",{type:1,path:"i"}," w=f ph=lg pv=md cur=p br=md bgc=",{type:1,path:"option.bgc"}]}}],fast:!0}],fast:!0}},{type:8,properties:[{key:"$if showAddOption",value:{type:6,conditions:[{type:1,path:"showAddOption"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f bw=xs bc=mu-bg bt=sm",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:"rtgl-view#option-add w=f ph=lg pv=md cur=p br=md bgc=${addOptionBgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=ac",value:{type:1,path:"addOptionLabel"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#option-add w=f ph=lg pv=md cur=p br=md bgc=",{type:1,path:"addOptionBgc"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-popover#popover ?open=",{type:1,path:"isOpen"}," x=",{type:1,path:"position.x"}," y=",{type:1,path:"position.y"}," placement=right-start"]}}],fast:!1}],fast:!1}};var Ct={};P(Ct,{handleHeaderClick:()=>to,handleItemClick:()=>ro});var to=(e,t)=>{let{store:r,dispatchEvent:s}=t,n,i=r.selectHeader();e.currentTarget.id==="header-label"?n=i.labelPath:e.currentTarget.id==="header-image"?n=i.image.path:e.currentTarget.id==="header"&&(n=i.path),s(new CustomEvent("headerClick",{detail:{path:n},bubbles:!0,composed:!0}))},ro=(e,t)=>{let{store:r,dispatchEvent:s}=t,n=e.currentTarget.id.replace("item-",""),i=r.selectItem(n);s(new CustomEvent("itemClick",{detail:{item:i},bubbles:!0,composed:!0}))};var Ot={};P(Ot,{INITIAL_STATE:()=>so,selectActiveItem:()=>lo,selectHeader:()=>ao,selectItem:()=>po,setState:()=>co,toViewData:()=>oo});var so=Object.freeze({}),io=["id","class","style","slot"],no=e=>Object.entries(e).filter(([t])=>!io.includes(t)).map(([t,r])=>`${t}=${r}`).join(" ");function It(e,t=null){let r=[];for(let s of e){let n=s.id||s.href||s.path,i=t===n;if(r.push({id:n,title:s.title,href:s.href,type:s.type||"item",icon:s.icon,hrefAttr:s.href?`href=${s.href}`:"",isSelected:i,itemBgc:i?"ac":"bg",itemHoverBgc:i?"ac":"mu"}),s.items&&Array.isArray(s.items))for(let a of s.items){let o=a.id||a.href||a.path,l=t===o;r.push({id:o,title:a.title,href:a.href,type:a.type||"item",icon:a.icon,hrefAttr:a.href?`href=${a.href}`:"",isSelected:l,itemBgc:l?"ac":"bg",itemHoverBgc:l?"ac":"mu"})}}return r}var oo=({state:e,props:t,attrs:r})=>{let s=r.header?JSON.parse(decodeURIComponent(r.header)):t.header,n=r.items?JSON.parse(decodeURIComponent(r.items)):t.items,i=r.selectedItemId||t.selectedItemId,a=no(r),o=r.mode||"full",l=s||{label:"",path:"",image:{src:"",alt:"",width:0,height:0}},p=n?It(n,i):[],u=o==="full"?272:64,c=o==="full"?"fs":"c",h=o==="full"?"fs":"c",y=o==="full"?"lg":"sm",d=o==="full"?"md":"sm",f=o==="shrunk-lg"?48:40,m=o==="shrunk-lg"?28:20,v=o==="shrunk-lg"?"md":"sm",w=o==="full",b=o==="full",E=o==="full"?"fs":"c",A=o==="full"?"":`ah=${h}`,k=o==="full"?"f":f;return{containerAttrString:a,mode:o,header:l,items:p,sidebarWidth:u,headerAlign:c,itemAlign:h,headerPadding:y,itemPadding:d,itemHeight:f,iconSize:m,firstLetterSize:v,showLabels:w,showGroupLabels:b,itemContentAlign:E,itemAlignAttr:A,itemWidth:k,headerWidth:k,selectedItemId:i,ah:o==="shrunk-lg"||o==="shrunk-md"?"c":""}},ao=({state:e,props:t,attrs:r})=>r.header?JSON.parse(decodeURIComponent(r.header)):t.header,lo=({state:e,props:t})=>(t.items?It(t.items):[]).find(s=>s.active),po=({state:e,props:t,attrs:r},s)=>{let n=r.items?JSON.parse(decodeURIComponent(r.items)):t.items;return(n?It(n):[]).find(a=>a.id===s)},co=e=>{};var Kr={elementName:"rtgl-sidebar",viewDataSchema:{type:"object",properties:{containerAttrString:{type:"string"},mode:{type:"string",enum:["full","shrunk","shrunk-lg"],default:"full"},sidebarWidth:{type:"number"},headerAlign:{type:"string"},itemAlign:{type:"string"},headerPadding:{type:"string"},itemPadding:{type:"string"},itemHeight:{type:"number"},iconSize:{type:"number"},firstLetterSize:{type:"string"},showLabels:{type:"boolean"},showGroupLabels:{type:"boolean"},itemContentAlign:{type:"string"},itemAlignAttr:{type:"string"},itemWidth:{type:"string"},headerWidth:{type:"string"},selectedItemId:{type:"string"},header:{type:"object",properties:{label:{type:"string"},href:{type:"string"},image:{type:"object",properties:{src:{type:"string"},width:{type:"number"},height:{type:"number"},alt:{type:"string"}}}}},items:{type:"array",items:{type:"object",properties:{title:{type:"string"},slug:{type:"string"},type:{type:"string"},active:{type:"boolean"},icon:{type:"string"}}}}}},propsSchema:{type:"object",properties:{selectedItemId:{type:"string"},header:{type:"object",properties:{label:{type:"string"},href:{type:"string"},image:{type:"object",properties:{src:{type:"string"},width:{type:"number"},height:{type:"number"},alt:{type:"string"}}}}},items:{type:"array",items:{type:"object",properties:{title:{type:"string"},slug:{type:"string"},type:{type:"string"},items:{type:"array"}}}}}},refs:{"header-image":{eventListeners:{click:{handler:"handleHeaderClick"}}},"header-label":{eventListeners:{click:{handler:"handleHeaderClick"}}},header:{eventListeners:{click:{handler:"handleHeaderClick"}}},"item-*":{eventListeners:{click:{handler:"handleItemClick"}}}},events:{headerClick:{type:"object",properties:{path:{type:"string"}}}},anchors:[[{"$if header.image && header.image.src":[{"$if header.image.href":[{"a href=${header.image.href}":[{'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"':null}]}],"$elif header.image.path":[{"rtgl-view#header-image cur=p":[{'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"':null}]}],$else:[{'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"':null}]}]},{"$if header.label && showLabels":[{"$if header.labelHref":[{"rtgl-text href=${header.labelHref} s=lg":"${header.label}"}],"$elif header.labelPath":[{"rtgl-view#header-label cur=p":[{"rtgl-text s=lg":"${header.label}"}]}],$else:[{"rtgl-text s=lg":"${header.label}"}]}]}]],template:{type:9,items:[{type:8,properties:[{key:"rtgl-view h=f w=${sidebarWidth} bwr=xs ah=${ah} ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view ph=${headerPadding} pv=lg",value:{type:9,items:[{type:8,properties:[{key:"$if header.href",value:{type:6,conditions:[{type:1,path:"header.href"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view href=${header.href} d=h av=c ah=${headerAlign} g=lg w=${headerWidth}",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"$if header.image && header.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"header.image"},right:{type:1,path:"header.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"$if header.image.href",value:{type:6,conditions:[{type:1,path:"header.image.href"},{type:1,path:"header.image.path"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"a href=${header.image.href}",value:{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a href=",{type:1,path:"header.image.href"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#header-image cur=p",value:{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"$if header.label && showLabels",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"header.label"},right:{type:1,path:"showLabels"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"$if header.labelHref",value:{type:6,conditions:[{type:1,path:"header.labelHref"},{type:1,path:"header.labelPath"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text href=${header.labelHref} s=lg",value:{type:1,path:"header.label"},parsedKey:{type:2,parts:["rtgl-text href=",{type:1,path:"header.labelHref"}," s=lg"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#header-label cur=p",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"header.label"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"header.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view href=",{type:1,path:"header.href"}," d=h av=c ah=",{type:1,path:"headerAlign"}," g=lg w=",{type:1,path:"headerWidth"}]}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view#header d=h av=c ah=${headerAlign} g=lg w=${headerWidth} cur=p",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"$if header.image && header.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"header.image"},right:{type:1,path:"header.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"$if header.image.href",value:{type:6,conditions:[{type:1,path:"header.image.href"},{type:1,path:"header.image.path"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"a href=${header.image.href}",value:{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a href=",{type:1,path:"header.image.href"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#header-image cur=p",value:{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"$if header.label && showLabels",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"header.label"},right:{type:1,path:"showLabels"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"$if header.labelHref",value:{type:6,conditions:[{type:1,path:"header.labelHref"},{type:1,path:"header.labelPath"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text href=${header.labelHref} s=lg",value:{type:1,path:"header.label"},parsedKey:{type:2,parts:["rtgl-text href=",{type:1,path:"header.labelHref"}," s=lg"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#header-label cur=p",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"header.label"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"header.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view#header d=h av=c ah=",{type:1,path:"headerAlign"}," g=lg w=",{type:1,path:"headerWidth"}," cur=p"]}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view ph=",{type:1,path:"headerPadding"}," pv=lg"]}}],fast:!1},{type:8,properties:[{key:"rtgl-view w=f ph=${headerPadding} pb=lg g=xs ah=${ah}",value:{type:9,items:[{type:7,itemVar:"item",indexVar:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:'$if item.type == "groupLabel"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"item.type"},right:{type:0,value:"groupLabel"}},null],bodies:[{type:9,items:[{type:8,properties:[{key:"$if showGroupLabels",value:{type:6,conditions:[{type:1,path:"showGroupLabels"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view mt=md h=32 av=c ph=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=xs c=mu-fg",value:{type:1,path:"item.title"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view mt=md h=1 bgc=mu-bg",value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view#item-${item.id} ${item.hrefAttr} h=${itemHeight} av=c ${itemAlignAttr} ph=${itemPadding} w=${itemWidth} h-bgc=${item.itemHoverBgc} br=lg bgc=${item.itemBgc} cur=p",value:{type:9,items:[{type:8,properties:[{key:"$if item.icon",value:{type:6,conditions:[{type:1,path:"item.icon"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"$if showLabels",value:{type:6,conditions:[{type:1,path:"showLabels"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h ah=${itemContentAlign} g=sm",value:{type:9,items:[{type:8,properties:[{key:"rtgl-svg wh=16 svg=${item.icon} c=fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg wh=16 svg=",{type:1,path:"item.icon"}," c=fg"]}}],fast:!0},{type:8,properties:[{key:"rtgl-text s=sm",value:{type:1,path:"item.title"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view d=h ah=",{type:1,path:"itemContentAlign"}," g=sm"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-svg wh=${iconSize} svg=${item.icon} c=fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg wh=",{type:1,path:"iconSize"}," svg=",{type:1,path:"item.icon"}," c=fg"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"$if showLabels",value:{type:6,conditions:[{type:1,path:"showLabels"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm",value:{type:1,path:"item.title"}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view wh=${iconSize} br=f bgc=mu av=c ah=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=${firstLetterSize} c=fg",value:{type:1,path:"item.title.charAt(0).toUpperCase()"},parsedKey:{type:2,parts:["rtgl-text s=",{type:1,path:"firstLetterSize"}," c=fg"]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view wh=",{type:1,path:"iconSize"}," br=f bgc=mu av=c ah=c"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view#item-",{type:1,path:"item.id"}," ",{type:1,path:"item.hrefAttr"}," h=",{type:1,path:"itemHeight"}," av=c ",{type:1,path:"itemAlignAttr"}," ph=",{type:1,path:"itemPadding"}," w=",{type:1,path:"itemWidth"}," h-bgc=",{type:1,path:"item.itemHoverBgc"}," br=lg bgc=",{type:1,path:"item.itemBgc"}," cur=p"]}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view w=f ph=",{type:1,path:"headerPadding"}," pb=lg g=xs ah=",{type:1,path:"ah"}]}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view h=f w=",{type:1,path:"sidebarWidth"}," bwr=xs ah=",{type:1,path:"ah"}," ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var Tt={};P(Tt,{handleBeforeMount:()=>uo,handleOnUpdate:()=>ho,handleValueChange:()=>fo});var uo=e=>{let{store:t,attrs:r}=e;t.setValue(r.defaultValue||0)},ho=(e,t)=>{let{oldAttrs:r,newAttrs:s}=e,{store:n,render:i,attrs:a}=t;if(r?.key!==s?.key&&s?.key){let o=s?.defaultValue||a?.defaultValue||0;n.setValue(o),i()}else if(r?.defaultValue!==s?.defaultValue){let o=s?.defaultValue||0;n.setValue(o),i()}},fo=(e,t)=>{let{store:r,render:s,dispatchEvent:n}=t,i=Number(e.detail.value);r.setValue(i),s(),n(new CustomEvent("slider-input-value-change",{detail:{value:i},bubbles:!0}))};var Lt={};P(Lt,{INITIAL_STATE:()=>yo,setValue:()=>go,toViewData:()=>mo});var yo=Object.freeze({value:0}),mo=({state:e,attrs:t})=>({key:t.key,value:e.value,w:t.w||"",min:t.min||0,max:t.max||100,step:t.step||1}),go=(e,t)=>{e.value=t};var Fr={elementName:"rtgl-slider-input",viewDataSchema:{type:"object"},attrsSchema:{type:"object",properties:{defaultValue:{type:"string",default:"0"},w:{type:"string",default:""},min:{type:"string",default:"0"},max:{type:"string",default:"100"},step:{type:"string",default:"1"}}},refs:{input:{eventListeners:{"input-change":{handler:"handleValueChange"}}},slider:{eventListeners:{"slider-change":{handler:"handleValueChange"}}}},events:{"form-change":{}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c g=md w=${w}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-slider#slider key=${key} w=f type=range min=${min} max=${max} step=${step} value=${value}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider#slider key=",{type:1,path:"key"}," w=f type=range min=",{type:1,path:"min"}," max=",{type:1,path:"max"}," step=",{type:1,path:"step"}," value=",{type:1,path:"value"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=84",value:{type:9,items:[{type:8,properties:[{key:"rtgl-input#input key=${key} w=f type=number min=${min} max=${max} step=${step} value=${value}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#input key=",{type:1,path:"key"}," w=f type=number min=",{type:1,path:"min"}," max=",{type:1,path:"max"}," step=",{type:1,path:"step"}," value=",{type:1,path:"value"}]}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view d=h av=c g=md w=",{type:1,path:"w"}]}}],fast:!0}],fast:!0}};var Nt={};P(Nt,{handleBeforeMount:()=>vo,handleHeaderClick:()=>wo,handleRowClick:()=>bo});var vo=e=>{},bo=(e,t)=>{let{dispatchEvent:r,props:s}=t,n=parseInt(e.currentTarget.id.replace("row-","")),i=s.data?.rows?.[n];i&&r(new CustomEvent("row-click",{detail:{rowIndex:n,rowData:i}}))},wo=(e,t)=>{let{store:r,render:s,dispatchEvent:n}=t,i=e.currentTarget.id.replace("header-",""),a=r.selectSortInfo(),o="asc";a.column===i&&(a.direction==="asc"?o="desc":a.direction==="desc"&&(o=null)),o?r.setSortColumn({column:i,direction:o}):r.clearSort(),s(),n(new CustomEvent("header-click",{detail:{column:i,direction:o,sortInfo:o?{column:i,direction:o}:null}}))};var Vt={};P(Vt,{INITIAL_STATE:()=>xo,clearSort:()=>Io,selectSortInfo:()=>$o,selectState:()=>So,setSortColumn:()=>Co,toViewData:()=>Ao});var xo=Object.freeze({sortColumn:null,sortDirection:null}),Eo=["id","class","style","slot"],ko=e=>Object.entries(e).filter(([t])=>!Eo.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),_o=(e,t)=>{let r=t.split("."),s=e;for(let n of r){if(s==null)return null;s=s[n]}return s},Ao=({state:e,props:t,attrs:r})=>{let s=ko(r),n=t.data||{columns:[],rows:[]},i=n.rows.map((a,o)=>{let l=n.columns.map(p=>{let u=_o(a,p.key);return{key:p.key,value:u!=null?String(u):""}});return{index:o,cells:l}});return{containerAttrString:s,columns:n.columns||[],rows:i||[]}},So=({state:e})=>e,$o=({state:e})=>({column:e.sortColumn,direction:e.sortDirection}),Co=(e,{column:t,direction:r})=>{e.sortColumn=t,e.sortDirection=r},Io=e=>{e.sortColumn=null,e.sortDirection=null};var zr={elementName:"rtgl-table",viewDataSchema:{type:"object",properties:{columns:{type:"array"},rows:{type:"array"},containerAttrString:{type:"string"}}},propsSchema:{type:"object",properties:{data:{type:"object",properties:{columns:{type:"array",items:{type:"object",properties:{key:{type:"string"},label:{type:"string"}}}},rows:{type:"array",items:{type:"object"}}}},responsive:{type:"boolean",default:!0}}},refs:{"row-*":{eventListeners:{click:{handler:"handleRowClick"}}},"header-*":{eventListeners:{click:{handler:"handleHeaderClick"}}}},events:{},styles:{table:{width:"100%","border-collapse":"collapse","border-spacing":0},thead:{"border-bottom":"2px solid var(--border)"},th:{padding:"12px","text-align":"left","font-weight":500,color:"var(--foreground)","background-color":"var(--muted)",cursor:"pointer",position:"sticky",top:0,"z-index":1},"tbody tr":{"border-bottom":"1px solid var(--border)"},"tbody tr:last-child":{"border-bottom":"none"},td:{padding:"12px",color:"var(--foreground)"},".table-container":{width:"100%",height:"100%",overflow:"auto"},".empty-state":{"text-align":"center",padding:"24px",color:"var(--muted-foreground)"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view.table-container ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"$if rows.length > 0",value:{type:6,conditions:[{type:4,op:2,left:{type:1,path:"rows.length"},right:{type:0,value:0}},null],bodies:[{type:9,items:[{type:8,properties:[{key:"table",value:{type:9,items:[{type:8,properties:[{key:"thead",value:{type:9,items:[{type:8,properties:[{key:"tr",value:{type:9,items:[{type:7,itemVar:"column",indexVar:"i",iterable:{type:1,path:"columns"},body:{type:9,items:[{type:8,properties:[{key:"th#header-${column.key}",value:{type:1,path:"column.label"},parsedKey:{type:2,parts:["th#header-",{type:1,path:"column.key"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1},{type:8,properties:[{key:"tbody",value:{type:9,items:[{type:7,itemVar:"row",indexVar:"rowIndex",iterable:{type:1,path:"rows"},body:{type:9,items:[{type:8,properties:[{key:"tr#row-${row.index}",value:{type:9,items:[{type:7,itemVar:"cell",indexVar:"cellIndex",iterable:{type:1,path:"row.cells"},body:{type:9,items:[{type:8,properties:[{key:"td",value:{type:1,path:"cell.value"}}],fast:!0}],fast:!0}}],fast:!1},parsedKey:{type:2,parts:["tr#row-",{type:1,path:"row.index"}]}}],fast:!1}],fast:!1}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view.empty-state w=f p=xl",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:0,value:"No data available"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view.table-container ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var Rt={};P(Rt,{handleClickItem:()=>Oo});var Oo=(e,t)=>{let{dispatchEvent:r}=t,s=e.currentTarget.dataset.id;r(new CustomEvent("item-click",{detail:{id:s}}))};var Pt={};P(Pt,{INITIAL_STATE:()=>To,toViewData:()=>Vo});var To=Object.freeze({}),Lo=["id","class","style","slot"],No=e=>Object.entries(e).filter(([t])=>!Lo.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Vo=({state:e,props:t,attrs:r})=>{let s=No(r),n=t.items||[],i=r["selected-tab"],a=n.map(o=>({...o,isSelected:o.id===i,bgColor:o.id===i?"ac":"",borderColor:o.id===i?"":"tr",textColor:o.id===i?"":"mu-fg"}));return{containerAttrString:s,items:a,selectedTab:i}};var Ur={elementName:"rtgl-tabs",viewDataSchema:{type:"object",properties:{containerAttrString:{type:"string"},items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"},isSelected:{type:"boolean"},bgColor:{type:"string"},textColor:{type:"string"},borderColor:{type:"string"}}}},selectedTab:{type:"string"}}},propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"}}}}}},attrsSchema:{type:"object",properties:{"selected-tab":{type:"string"}}},refs:{"tab-*":{eventListeners:{click:{handler:"handleClickItem"}}}},events:{"item-click":{type:"object",properties:{id:{type:"string"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h g=sm bgc=mu p=sm br=lg ${containerAttrString}",value:{type:9,items:[{type:7,itemVar:"item",indexVar:null,iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view#tab-${item.id} data-id=${item.id} cur=p bgc=${item.bgColor} bw=xs bc=${item.borderColor} pv=md ph=lg br=lg",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=${item.textColor}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.textColor"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#tab-",{type:1,path:"item.id"}," data-id=",{type:1,path:"item.id"}," cur=p bgc=",{type:1,path:"item.bgColor"}," bw=xs bc=",{type:1,path:"item.borderColor"}," pv=md ph=lg br=lg"]}}],fast:!0}],fast:!0}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view d=h g=sm bgc=mu p=sm br=lg ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var Hr={};var jt={};P(jt,{INITIAL_STATE:()=>Ro,toViewData:()=>Po});var Ro=Object.freeze({}),Po=({attrs:e})=>({open:!!e.open,x:e.x||0,y:e.y||0,placement:e.placement||"top",content:e.content||""});var Jr={elementName:"rtgl-tooltip",viewDataSchema:{type:"object"},attrsSchema:{type:"object",properties:{open:{type:"string"},x:{type:"string"},y:{type:"string"},placement:{type:"string"},content:{type:"string"}}},refs:{popover:null},template:{type:9,items:[{type:8,properties:[{key:"rtgl-popover#popover ?open=${open} x=${x} y=${y} placement=${placement} no-overlay",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view slot=content bgc=background bc=border br=md p=sm ah=c av=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text ta=c s=sm c=foreground",value:{type:1,path:"content"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-popover#popover ?open=",{type:1,path:"open"}," x=",{type:1,path:"x"}," y=",{type:1,path:"y"}," placement=",{type:1,path:"placement"}," no-overlay"]}}],fast:!0}],fast:!0}};var Dt={};P(Dt,{handleAfterMount:()=>jo,handleOnUpdate:()=>Do});var jo=async e=>{let{props:t,store:r,render:s,getRefIds:n}=e,{waveformData:i}=t;r.setWaveformData(i),s();let a=n().canvas?.elm;a&&qr(i,a)},Do=async(e,t)=>{let{store:r,render:s,getRefIds:n,props:i}=t,{waveformData:a}=i;if(!a){console.log("waveform handleOnUpdate: no waveformData provided");return}r.setWaveformData(a),s();let o=n().canvas?.elm;o&&qr(a,o)};async function qr(e,t){let r=t.getContext("2d"),s=t.getBoundingClientRect(),n=s.width,i=s.height;t.width=n,t.height=i;let a=t.width,o=t.height;if(r.clearRect(0,0,a,o),r.fillStyle="#1a1a1a",r.fillRect(0,0,a,o),!e||!e.amplitudes)return;let l=e.amplitudes,p=o/2,u=r.createLinearGradient(0,0,0,o);u.addColorStop(0,"#404040"),u.addColorStop(.5,"#A1A1A1"),u.addColorStop(1,"#404040");let c=Math.max(1,a/l.length),h=.2;for(let y=0;y<l.length;y++){let f=l[y]*(o*.85),m=y*c,v=p-f/2;r.fillStyle=u,r.fillRect(m,v,Math.max(1,c*(1-h)),f)}r.strokeStyle="rgba(255, 255, 255, 0.1)",r.lineWidth=1,r.beginPath(),r.moveTo(0,p),r.lineTo(a,p),r.stroke(),r.shadowBlur=10,r.shadowColor="#2196F3"}var Bt={};P(Bt,{INITIAL_STATE:()=>Bo,setWaveformData:()=>Wo,toViewData:()=>Mo});var Bo=Object.freeze({waveformData:null}),Wo=(e,t)=>{e.waveformData=t},Mo=({state:e,attrs:t,props:r})=>({isLoading:r.isLoading,w:t.w||"250",h:t.h||"150",cur:t.cur,waveformData:r.waveformData});var Yr={elementName:"rtgl-waveform",attrsSchema:{type:"object",properties:{w:{type:"string",description:"Width of the waveform visualizer",default:"250"},h:{type:"string",description:"Height of the waveform visualizer",default:"150"},cur:{type:"string",description:"cursor"}}},propsSchema:{type:"object",properties:{waveformData:{type:"object",description:"File ID of the waveform data in object storage"},isLoading:{type:"boolean",description:"Whether the waveform data is currently being loaded"}}},refs:{canvas:{selector:"canvas"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=f pos=rel w=${w} h=${h} cur=${cur}",value:{type:9,items:[{type:8,properties:[{key:"$if isLoading",value:{type:6,conditions:[{type:1,path:"isLoading"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=f av=c ah=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:0,value:"..."}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:'canvas#canvas style="width:100%; height:100%;"',value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view w=f h=f pos=rel w=",{type:1,path:"w"}," h=",{type:1,path:"h"}," cur=",{type:1,path:"cur"}]}}],fast:!1}],fast:!1}};var ts=Symbol.for("immer-nothing"),Gr=Symbol.for("immer-draftable"),q=Symbol.for("immer-state");function ee(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ve=Object.getPrototypeOf;function be(e){return!!e&&!!e[q]}function ce(e){return e?rs(e)||Array.isArray(e)||!!e[Gr]||!!e.constructor?.[Gr]||Be(e)||We(e):!1}var Ko=Object.prototype.constructor.toString();function rs(e){if(!e||typeof e!="object")return!1;let t=ve(e);if(t===null)return!0;let r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===Ko}function Re(e,t){De(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,s)=>t(s,r,e))}function De(e){let t=e[q];return t?t.type_:Array.isArray(e)?1:Be(e)?2:We(e)?3:0}function Kt(e,t){return De(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ss(e,t,r){let s=De(e);s===2?e.set(t,r):s===3?e.add(r):e[t]=r}function Fo(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Be(e){return e instanceof Map}function We(e){return e instanceof Set}function pe(e){return e.copy_||e.base_}function Ft(e,t){if(Be(e))return new Map(e);if(We(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=rs(e);if(t===!0||t==="class_only"&&!r){let s=Object.getOwnPropertyDescriptors(e);delete s[q];let n=Reflect.ownKeys(s);for(let i=0;i<n.length;i++){let a=n[i],o=s[a];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(s[a]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[a]})}return Object.create(ve(e),s)}else{let s=ve(e);if(s!==null&&r)return{...e};let n=Object.create(s);return Object.assign(n,e)}}function qt(e,t=!1){return Me(e)||be(e)||!ce(e)||(De(e)>1&&(e.set=e.add=e.clear=e.delete=zo),Object.freeze(e),t&&Object.entries(e).forEach(([r,s])=>qt(s,!0))),e}function zo(){ee(2)}function Me(e){return Object.isFrozen(e)}var Uo={};function ue(e){let t=Uo[e];return t||ee(0,e),t}var $e;function is(){return $e}function Ho(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Xr(e,t){t&&(ue("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function zt(e){Ut(e),e.drafts_.forEach(Jo),e.drafts_=null}function Ut(e){e===$e&&($e=e.parent_)}function Qr(e){return $e=Ho($e,e)}function Jo(e){let t=e[q];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Zr(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return e!==void 0&&e!==r?(r[q].modified_&&(zt(t),ee(4)),ce(e)&&(e=Pe(t,e),t.parent_||je(t,e)),t.patches_&&ue("Patches").generateReplacementPatches_(r[q].base_,e,t.patches_,t.inversePatches_)):e=Pe(t,r,[]),zt(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ts?e:void 0}function Pe(e,t,r){if(Me(t))return t;let s=t[q];if(!s)return Re(t,(n,i)=>es(e,s,t,n,i,r)),t;if(s.scope_!==e)return t;if(!s.modified_)return je(e,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;let n=s.copy_,i=n,a=!1;s.type_===3&&(i=new Set(n),n.clear(),a=!0),Re(i,(o,l)=>es(e,s,n,o,l,r,a)),je(e,n,!1),r&&e.patches_&&ue("Patches").generatePatches_(s,r,e.patches_,e.inversePatches_)}return s.copy_}function es(e,t,r,s,n,i,a){if(be(n)){let o=i&&t&&t.type_!==3&&!Kt(t.assigned_,s)?i.concat(s):void 0,l=Pe(e,n,o);if(ss(r,s,l),be(l))e.canAutoFreeze_=!1;else return}else a&&r.add(n);if(ce(n)&&!Me(n)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Pe(e,n),(!t||!t.scope_.parent_)&&typeof s!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,s)&&je(e,n)}}function je(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&qt(t,r)}function qo(e,t){let r=Array.isArray(e),s={type_:r?1:0,scope_:t?t.scope_:is(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},n=s,i=Yt;r&&(n=[s],i=Ce);let{revoke:a,proxy:o}=Proxy.revocable(n,i);return s.draft_=o,s.revoke_=a,o}var Yt={get(e,t){if(t===q)return e;let r=pe(e);if(!Kt(r,t))return Yo(e,r,t);let s=r[t];return e.finalized_||!ce(s)?s:s===Wt(e.base_,t)?(Mt(e),e.copy_[t]=Jt(s,e)):s},has(e,t){return t in pe(e)},ownKeys(e){return Reflect.ownKeys(pe(e))},set(e,t,r){let s=ns(pe(e),t);if(s?.set)return s.set.call(e.draft_,r),!0;if(!e.modified_){let n=Wt(pe(e),t),i=n?.[q];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(Fo(r,n)&&(r!==void 0||Kt(e.base_,t)))return!0;Mt(e),Ht(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Wt(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Mt(e),Ht(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=pe(e),s=Reflect.getOwnPropertyDescriptor(r,t);return s&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:s.enumerable,value:r[t]}},defineProperty(){ee(11)},getPrototypeOf(e){return ve(e.base_)},setPrototypeOf(){ee(12)}},Ce={};Re(Yt,(e,t)=>{Ce[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Ce.deleteProperty=function(e,t){return Ce.set.call(this,e,t,void 0)};Ce.set=function(e,t,r){return Yt.set.call(this,e[0],t,r,e[0])};function Wt(e,t){let r=e[q];return(r?pe(r):e)[t]}function Yo(e,t,r){let s=ns(t,r);return s?"value"in s?s.value:s.get?.call(e.draft_):void 0}function ns(e,t){if(!(t in e))return;let r=ve(e);for(;r;){let s=Object.getOwnPropertyDescriptor(r,t);if(s)return s;r=ve(r)}}function Ht(e){e.modified_||(e.modified_=!0,e.parent_&&Ht(e.parent_))}function Mt(e){e.copy_||(e.copy_=Ft(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Go=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,s)=>{if(typeof t=="function"&&typeof r!="function"){let i=r;r=t;let a=this;return function(l=i,...p){return a.produce(l,u=>r.call(this,u,...p))}}typeof r!="function"&&ee(6),s!==void 0&&typeof s!="function"&&ee(7);let n;if(ce(t)){let i=Qr(this),a=Jt(t,void 0),o=!0;try{n=r(a),o=!1}finally{o?zt(i):Ut(i)}return Xr(i,s),Zr(n,i)}else if(!t||typeof t!="object"){if(n=r(t),n===void 0&&(n=t),n===ts&&(n=void 0),this.autoFreeze_&&qt(n,!0),s){let i=[],a=[];ue("Patches").generateReplacementPatches_(t,n,i,a),s(i,a)}return n}else ee(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(a,...o)=>this.produceWithPatches(a,l=>t(l,...o));let s,n;return[this.produce(t,r,(a,o)=>{s=a,n=o}),s,n]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ce(e)||ee(8),be(e)&&(e=Xo(e));let t=Qr(this),r=Jt(e,void 0);return r[q].isManual_=!0,Ut(t),r}finishDraft(e,t){let r=e&&e[q];(!r||!r.isManual_)&&ee(9);let{scope_:s}=r;return Xr(s,t),Zr(void 0,s)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let n=t[r];if(n.path.length===0&&n.op==="replace"){e=n.value;break}}r>-1&&(t=t.slice(r+1));let s=ue("Patches").applyPatches_;return be(e)?s(e,t):this.produce(e,n=>s(n,t))}};function Jt(e,t){let r=Be(e)?ue("MapSet").proxyMap_(e,t):We(e)?ue("MapSet").proxySet_(e,t):qo(e,t);return(t?t.scope_:is()).drafts_.push(r),r}function Xo(e){return be(e)||ee(10,e),os(e)}function os(e){if(!ce(e)||Me(e))return e;let t=e[q],r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Ft(e,t.scope_.immer_.useStrictShallowCopy_)}else r=Ft(e,!0);return Re(r,(s,n)=>{ss(r,s,os(n))}),t&&(t.finalized_=!1),r}var Y=new Go,as=Y.produce,nc=Y.produceWithPatches.bind(Y),oc=Y.setAutoFreeze.bind(Y),ac=Y.setUseStrictShallowCopy.bind(Y),lc=Y.applyPatches.bind(Y),pc=Y.createDraft.bind(Y),cc=Y.finishDraft.bind(Y);var x={LITERAL:0,VARIABLE:1,INTERPOLATION:2,FUNCTION:3,BINARY:4,UNARY:5,CONDITIONAL:6,LOOP:7,OBJECT:8,ARRAY:9},G={EQ:0,NEQ:1,GT:2,LT:3,GTE:4,LTE:5,AND:6,OR:7,IN:8},Ke={NOT:0};var we=class extends Error{constructor(t){super(`Render Error: ${t}`),this.name="JemplRenderError"}};var ls=(e,t)=>{if(t===null)return new we(`Cannot iterate over null value at '$for ${e}'`);if(t===void 0)return new we(`Cannot iterate over undefined value at '$for ${e}'`);let r=typeof t;return new we(`Cannot iterate over non-array value (got: ${r}) at '$for ${e}'`)},ps=(e,t)=>{let r=t&&Object.keys(t).length>0?Object.keys(t).join(", "):"no custom functions provided";return new we(`Unknown function '${e}' (${r})`)};var Qo=(e,t,r={})=>T(e,r,t,{}),T=(e,t,r,s)=>{if(e.var&&!e.type)return z(e.var,r,s);if(e.type===x.LITERAL)return e.value;if(e.type===x.VARIABLE)return z(e.path,r,s);if(e.type===x.INTERPOLATION)return Zo(e.parts,t,r,s);switch(e.type){case x.FUNCTION:return cs(e,t,r,s);case x.BINARY:return us(e,t,r,s);case x.UNARY:return ds(e,t,r,s);case x.CONDITIONAL:return ta(e,t,r,s);case x.LOOP:return oa(e,t,r,s);case x.OBJECT:return la(e,t,r,s);case x.ARRAY:return pa(e,t,r,s);default:throw new Error(`Unknown node type: ${e.type}`)}},ae=new Map,z=(e,t,r)=>{if(!e)return;if(e in r)return r[e];let s=ae.get(e);s||(s=e.split("."),ae.set(e,s));let n=t;for(let i=0;i<s.length;i++){let a=s[i];if(a in r){n=r[a];continue}if(n==null)return;n=n[a]}return n},Zo=(e,t,r,s)=>{let n=[];for(let i of e)if(typeof i=="string")n.push(i);else{let a=T(i,t,r,s);n.push(a!=null?String(a):"")}return n.join("")},cs=(e,t,r,s)=>{let n=t[e.name];if(!n)throw ps(e.name,t);let i=e.args.map(a=>T(a,t,r,s));return n(...i)},Fe=(e,t,r,s)=>{if(e.var&&!e.type)return z(e.var,r,s);switch(e.type){case x.VARIABLE:return z(e.path,r,s);case x.LITERAL:return e.value;case x.BINARY:return us(e,t,r,s);case x.UNARY:return ds(e,t,r,s);case x.FUNCTION:return cs(e,t,r,s);default:return T(e,t,r,s)}},us=(e,t,r,s)=>{if(e.op===G.AND||e.op===G.OR){let a=Fe(e.left,t,r,s),o=Fe(e.right,t,r,s);switch(e.op){case G.AND:return a&&o;case G.OR:return a||o}}let n=T(e.left,t,r,s),i=T(e.right,t,r,s);switch(e.op){case G.EQ:return n==i;case G.NEQ:return n!=i;case G.GT:return n>i;case G.LT:return n<i;case G.GTE:return n>=i;case G.LTE:return n<=i;case G.IN:return Array.isArray(i)?i.includes(n):!1;default:throw new Error(`Unknown binary operator: ${e.op}`)}},ds=(e,t,r,s)=>{let n=e.op===Ke.NOT?Fe(e.operand,t,r,s):T(e.operand,t,r,s);switch(e.op){case Ke.NOT:return!n;default:throw new Error(`Unknown unary operator: ${e.op}`)}},ea=(e,t,r,s)=>{if(e.conditions.length===2&&e.conditions[1]===null){let n=e.conditions[0];if(n.type===x.VARIABLE)if(z(n.path,r,s)){let a=e.bodies[0];if(a.type===x.OBJECT&&a.properties.length<=5){let o={};for(let l of a.properties){let p=l.parsedKey?T(l.parsedKey,t,r,s):l.key,u=l.value;if(u.type===x.LITERAL)o[p]=u.value;else if(u.type===x.VARIABLE)o[p]=z(u.path,r,s);else if(u.type===x.INTERPOLATION){let c=[];for(let h of u.parts)if(typeof h=="string")c.push(h);else if(h.type===x.VARIABLE){let y=z(h.path,r,s);c.push(y!=null?String(y):"")}else{let y=T(h,t,r,s);c.push(y!=null?String(y):"")}o[p]=c.join("")}else o[p]=T(u,t,r,s)}return o}}else{let a=e.bodies[1];if(a.type===x.OBJECT&&a.properties.length<=5){let o={};for(let l of a.properties){let p=l.parsedKey?T(l.parsedKey,t,r,s):l.key,u=l.value;if(u.type===x.LITERAL)o[p]=u.value;else if(u.type===x.VARIABLE)o[p]=z(u.path,r,s);else if(u.type===x.INTERPOLATION){let c=[];for(let h of u.parts)if(typeof h=="string")c.push(h);else if(h.type===x.VARIABLE){let y=z(h.path,r,s);c.push(y!=null?String(y):"")}else{let y=T(h,t,r,s);c.push(y!=null?String(y):"")}o[p]=c.join("")}else o[p]=T(u,t,r,s)}return o}}}return null},ta=(e,t,r,s)=>{let n=ea(e,t,r,s);if(n!==null)return n;for(let i=0;i<e.conditions.length;i++){let a=e.conditions[i];if(a===null||Fe(a,t,r,s))return T(e.bodies[i],t,r,s)}return hs},ra=(e,t)=>{let r=e.body,s=e.itemVar;if(r.type===x.CONDITIONAL&&r.conditions.length===1&&r.conditions[0].type===x.VARIABLE){let n=r.conditions[0].path,i=r.bodies[0];if(n.startsWith(s+".")){let a=n.substring(s.length+1);if(i.type===x.OBJECT&&i.properties.length<=5){for(let l of i.properties)if(l.parsedKey)return null;let o=[];for(let l=0;l<t.length;l++){let p=t[l];if(p[a]){let u={};for(let c of i.properties){let h=c.key,y=c.value;if(y.type===x.LITERAL)u[h]=y.value;else if(y.type===x.VARIABLE){let d=y.path;if(d===s)u[h]=p;else if(d.startsWith(s+".")){let f=d.substring(s.length+1);u[h]=p[f]}else return null}else if(y.type===x.INTERPOLATION){let d=[],f=!0;for(let m of y.parts)if(typeof m=="string")d.push(m);else if(m.type===x.VARIABLE){let v=m.path;if(v===s)d.push(p!=null?String(p):"");else if(v.startsWith(s+".")){let w=v.substring(s.length+1),b=p[w];d.push(b!=null?String(b):"")}else{f=!1;break}}else{f=!1;break}if(!f)return null;u[h]=d.join("")}else return null}o.push(u)}}return o}}}return null},sa=(e,t)=>{let r=e.body,s=e.itemVar,n=ra(e,t);if(n!==null)return n;if(r.type===x.OBJECT&&r.properties.length<=5){for(let o of r.properties)if(o.parsedKey)return null;let i=[],a=!0;for(let o of r.properties){let l=o.key,p=o.value;if(p.type===x.LITERAL)i.push({key:l,type:"literal",value:p.value});else if(p.type===x.VARIABLE){let u=p.path;if(u===s)i.push({key:l,type:"item"});else if(u.startsWith(s+".")){let c=u.substring(s.length+1);if(!c.includes("."))i.push({key:l,type:"prop",prop:c});else{a=!1;break}}else{a=!1;break}}else if(p.type===x.INTERPOLATION&&p.parts.length===1){let u=p.parts[0];if(u.type===x.VARIABLE){let c=u.path;if(c===s)i.push({key:l,type:"item_string"});else if(c.startsWith(s+".")){let h=c.substring(s.length+1);if(!h.includes("."))i.push({key:l,type:"prop_string",prop:h});else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}if(a){let o=new Array(t.length);if(i.length===3&&i[0].type==="prop"&&i[0].key==="id"&&i[1].type==="prop_string"&&i[1].key==="title"&&i[2].type==="prop"&&i[2].key==="completed")for(let l=0;l<t.length;l++){let p=t[l];o[l]={id:p.id,title:p.title!=null?String(p.title):"",completed:p.completed}}else for(let l=0;l<t.length;l++){let p=t[l],u={};for(let c of i)if(c.type==="literal")u[c.key]=c.value;else if(c.type==="item")u[c.key]=p;else if(c.type==="prop")u[c.key]=p[c.prop];else if(c.type==="item_string")u[c.key]=p!=null?String(p):"";else if(c.type==="prop_string"){let h=p[c.prop];u[c.key]=h!=null?String(h):""}o[l]=u}return o}}return null},ia=(e,t,r,s,n)=>{let i=[],a=e.body;if(a.type===x.OBJECT&&a.fast!==!1){let o=e.itemVar,l=e.indexVar;for(let p=0;p<n.length;p++){let u=n[p],c={},h={...s,[o]:u,...l&&{[l]:p}};for(let y of a.properties){let d=y.parsedKey?T(y.parsedKey,t,r,h):y.key,f=y.value;if(f.type===x.LITERAL)c[d]=f.value;else if(f.type===x.VARIABLE){let m=f.path;if(m===o)c[d]=u;else if(m===l)c[d]=p;else if(m.startsWith(o+".")){let v=m.substring(o.length+1);if(!v.includes("."))c[d]=u[v];else{let w=ae.get(v)||(ae.set(v,v.split(".")),ae.get(v)),b=u;for(let E of w){if(b==null){b=void 0;break}b=b[E]}c[d]=b}}else c[d]=z(m,r,{...s,[o]:u,...l&&{[l]:p}})}else if(f.type===x.INTERPOLATION){let m=[];for(let v of f.parts)if(typeof v=="string")m.push(v);else if(v.type===x.VARIABLE){let w=v.path,b;if(w===o)b=u;else if(w===l)b=p;else if(w.startsWith(o+".")){let E=w.substring(o.length+1);if(!E.includes("."))b=u[E];else{let A=ae.get(E)||(ae.set(E,E.split(".")),ae.get(E)),k=u;for(let C of A){if(k==null){k=void 0;break}k=k[C]}b=k}}else b=z(w,r,{...s,[o]:u,...l&&{[l]:p}});m.push(b!=null?String(b):"")}else{let w={...s,[o]:u,...l&&{[l]:p}},b=T(v,t,r,w);m.push(b!=null?String(b):"")}c[d]=m.join("")}else{let m={...s,[o]:u,...l&&{[l]:p}};c[d]=T(f,t,r,m)}}i.push(c)}return i}return null},na=(e,t,r)=>{let s=e.body;if(s.type===x.OBJECT&&s.properties.length===1&&s.properties[0].key==="$if item.visible"){let i=s.properties[0].value;if(i.type===x.CONDITIONAL&&i.conditions.length===1&&i.conditions[0].type===x.VARIABLE&&i.conditions[0].path==="item.visible"){let a=i.bodies[0];if(a.type===x.OBJECT&&a.properties.length===2){let o=a.properties[0],l=a.properties[1];if(o.key==="id"&&o.value.type===x.VARIABLE&&o.value.path==="item.id"&&l.key==="$if item.highlighted"&&l.value.type===x.CONDITIONAL){let p=[];for(let u=0;u<t.length;u++){let c=t[u];if(c.visible){let h={id:c.id};c.highlighted?(h.highlight=!0,h.message=`This item is highlighted: ${c.name}`):(h.highlight=!1,h.message=c.name),p.push(h)}}return p}}}}return null},oa=(e,t,r,s)=>{let n=T(e.iterable,t,r,s);if(!Array.isArray(n)){let o=`${e.itemVar}${e.indexVar?`, ${e.indexVar}`:""} in ${e.iterable.path}`;throw ls(o,n)}if(!e.indexVar){let o=na(e,n,e.itemVar);if(o!==null)return o}if(!e.indexVar){let o=sa(e,n);if(o!==null)return o}let i=ia(e,t,r,s,n);if(i!==null)return i;let a=[];for(let o=0;o<n.length;o++){let l=e.indexVar?{...s,[e.itemVar]:n[o],[e.indexVar]:o}:{...s,[e.itemVar]:n[o]},p=T(e.body,t,r,l);Array.isArray(p)&&p.length===1?a.push(p[0]):a.push(p)}return a},aa=(e,t,r,s)=>{if(e.properties.length===1){let n=e.properties[0],i=n.parsedKey?T(n.parsedKey,t,r,s):n.key,a=n.value;if(a.type===x.OBJECT&&a.properties.length<=10){let o={},l={},p=!0;for(let u of a.properties){let c=u.parsedKey?T(u.parsedKey,t,r,s):u.key,h=u.value;if(h.type===x.LITERAL)l[c]=h.value;else if(h.type===x.VARIABLE)l[c]=z(h.path,r,s);else if(h.type===x.INTERPOLATION){let y=[];for(let d of h.parts)if(typeof d=="string")y.push(d);else if(d.type===x.VARIABLE){let f=z(d.path,r,s);y.push(f!=null?String(f):"")}else{p=!1;break}if(!p)break;l[c]=y.join("")}else if(h.type===x.OBJECT&&h.properties.length<=5){let y={};for(let d of h.properties){let f=d.key,m=d.value;if(m.type===x.LITERAL)y[f]=m.value;else if(m.type===x.VARIABLE)y[f]=z(m.path,r,s);else if(m.type===x.INTERPOLATION){let v=[];for(let w of m.parts)if(typeof w=="string")v.push(w);else if(w.type===x.VARIABLE){let b=z(w.path,r,s);v.push(b!=null?String(b):"")}else{p=!1;break}if(!p)break;y[f]=v.join("")}else{p=!1;break}}if(!p)break;l[c]=y}else{p=!1;break}}if(p)return o[i]=l,o}}return null},la=(e,t,r,s)=>{let n=aa(e,t,r,s);if(n!==null)return n;if(e.fast){let l={};for(let p of e.properties){let u=p.parsedKey?T(p.parsedKey,t,r,s):p.key,c=p.value;if(c.type===x.LITERAL)l[u]=c.value;else if(c.type===x.VARIABLE)l[u]=z(c.path,r,s);else if(c.type===x.INTERPOLATION){let h=[];for(let y of c.parts)if(typeof y=="string")h.push(y);else if(y.type===x.VARIABLE){let d=z(y.path,r,s);h.push(d!=null?String(d):"")}else{let d=T(y,t,r,s);h.push(d!=null?String(d):"")}l[u]=h.join("")}else l[u]=T(c,t,r,s)}return l}let i={},a=null,o=!1;for(let l of e.properties)if(!l.key.startsWith("$if ")&&!l.key.match(/^\$if\s+\w+.*:?$/)&&!l.key.startsWith("$elif")&&!l.key.startsWith("$else")&&!l.key.startsWith("$for ")){o=!0;break}for(let l of e.properties)if(l.key.startsWith("$if ")||l.key.match(/^\$if\s+\w+.*:?$/)){let p=T(l.value,t,r,s);if(!o&&p!==null&&p!==void 0)return Array.isArray(p)&&p.length===1?p[0]:p;typeof p=="object"&&p!==null&&!Array.isArray(p)&&Object.assign(i,p)}else if(!l.key.startsWith("$for ")){let p=l.value;if(p&&p.type===x.OBJECT&&p.properties){let u=p.properties.find(c=>c.key.startsWith("$for "));if(u){let c=T(u.value,t,r,s);c!==void 0&&(i[l.key]=c)}else{let c=T(l.value,t,r,s);c!==void 0&&(i[l.key]=c)}}else{let u=l.parsedKey?T(l.parsedKey,t,r,s):l.key,c=T(l.value,t,r,s);c!==void 0&&(i[u]=c)}}return i},hs={},pa=(e,t,r,s)=>{let n=[];for(let i of e.items)if(i.type===x.LOOP){let a=T(i,t,r,s);n.push(a)}else{let a=T(i,t,r,s);a!==hs&&n.push(a)}return n},ze=Qo;var Ue=e=>Array.isArray(e)?e.reduce((t,r)=>{if(Array.isArray(r))t.push(...Ue(r));else{if(r&&typeof r=="object"){let s=Object.entries(r);if(s.length>0){let[n,i]=s[0];Array.isArray(i)&&(r={[n]:Ue(i)})}}t.push(r)}return t},[]):e;var fs=(e,t)=>{if(!t)return e;let r=[],s="",n=!1,i=null;for(let a=0;a<t.length;a++){let o=t[a];if(!n&&o===".")s&&(r.push(s),s="");else if(!n&&o==="[")s&&(r.push(s),s=""),n=!0;else if(n&&o==="]"){if(s){if(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))r.push(s.slice(1,-1));else{let l=Number(s);r.push(isNaN(l)?s:l)}s=""}n=!1,i=null}else n&&(o==='"'||o==="'")&&(i?o===i&&(i=null):i=o),s+=o}return s&&r.push(s),r.reduce((a,o)=>a&&a[o],e)},ys=({h:e,template:t,viewData:r,refs:s,handlers:n})=>{let i=ze(t,r,{}),a=Ue(i),o=ha({h:e,items:a,refs:s,handlers:n,viewData:r});return e("div",{style:{display:"contents"}},o)},ha=({h:e,items:t,refs:r={},handlers:s={},viewData:n={}})=>{if(!Array.isArray(t))return console.error("Input to createVirtualDom must be an array."),[e("div",{},[])];function i(a,o=""){return a.map((l,p)=>{if(typeof l=="string"||typeof l=="number")return String(l);if(typeof l!="object"||l===null)return console.warn("Skipping invalid item in DOM structure:",l),null;let u=Object.entries(l);if(u.length===0)return null;let[c,h]=u[0];if(!isNaN(Number(c)))return Array.isArray(h)?i(h,`${o}.${c}`):typeof h=="object"&&h!==null&&Object.entries(h).length>0?i([h],`${o}.${c}`):String(h);u.length>1&&console.warn("Item has multiple keys, processing only the first:",c);let y,d,f=c.indexOf(" ");f===-1?(y=c,d=""):(y=c.substring(0,f),d=c.substring(f+1).trim());let m=y.split(/[.#]/)[0],v=m.includes("-"),w={},b={};if(d){let $=/(\S+?)=(?:\"([^\"]*)\"|\'([^\']*)\'|([^\s]+))/g,_,R=new Set;for(;(_=$.exec(d))!==null;)if(R.add(_[1]),_[1].startsWith(".")){let X=_[1].substring(1),ke=_[4];b[X]=fs(n,ke)}else if(_[1].startsWith("?")){let X=_[1].substring(1),ke=_[2]||_[3]||_[4],Oe;ke==="true"?Oe=!0:ke==="false"?Oe=!1:Oe=fs(n,ke),Oe&&(w[X]="")}else w[_[1]]=_[2]||_[3]||_[4];let W=d,F=[],te,qe=/(\S+?)=(?:\"([^\"]*)\"|\'([^\']*)\'|([^\s]+))/g;for(;(te=qe.exec(d))!==null;)F.push(te[0]);F.forEach(X=>{W=W.replace(X," ")});let Ye=/\b(\S+?)(?=\s|$)/g,M;for(;(M=Ye.exec(W))!==null;){let X=M[1];!R.has(X)&&!X.startsWith(".")&&!X.includes("=")&&(w[X]="")}}let E=y.match(/#([^.#\s]+)/);E&&!Object.prototype.hasOwnProperty.call(w,"id")&&(w.id=E[1]);let A=null;w.id?A=w.id:v&&(A=m);let k=Object.create(null),C=null;if(v)C=m;else{let $=y.match(/\.([^.#]+)/g);$&&$.forEach(R=>{let W=R.substring(1);k[W]=!0});let _=y.match(/#([^.#\s]+)/);_&&(C=_[1])}let S;typeof h=="string"||typeof h=="number"?S=String(h):Array.isArray(h)?S=i(h,`${o}.${c}`):S=[],C&&!v&&(w.id=C);let L=Object.create(null);if(A&&r){let $=[];if(Object.keys(r).forEach(_=>{if(_.includes("*")){let R="^"+_.replace(/[.*+?^${}()|[\\\]\\]/g,"\\$&").replace(/\\\*/g,".*")+"$";try{new RegExp(R).test(A)&&$.push(_)}catch(W){console.warn(`[Parser] Invalid regex pattern created from refKey '${_}': ${R}`,W)}}else A===_&&$.push(_)}),$.length>0){$.sort((R,W)=>{let F=!R.includes("*"),te=!W.includes("*");return F&&!te?-1:!F&&te?1:W.length-R.length});let _=$[0];if(r[_]&&r[_].eventListeners){let R=r[_].eventListeners;Object.entries(R).forEach(([W,F])=>{F.handler&&s[F.handler]?L[W]=te=>{s[F.handler](te)}:F.handler&&console.warn(`[Parser] Handler '${F.handler}' for refKey '${_}' (matching elementId '${A}') is referenced but not found in available handlers.`)})}}}let V={};if(A)V.key=A;else if(y){let $=o?`${o}.${p}`:String(p);if(V.key=`${y}-${$}`,Object.keys(b).length>0){let _=JSON.stringify(b).substring(0,50);V.key+=`-${_}`}}Object.keys(w).length>0&&(V.attrs=w),Object.keys(k).length>0&&(V.class=k),Object.keys(L).length>0&&(V.on=L),Object.keys(b).length>0&&(V.props=b),v&&(V.hook={update:($,_)=>{let R=$.data?.props||{},W=_.data?.props||{},F=$.data?.attrs||{},te=_.data?.attrs||{},qe=JSON.stringify(R)!==JSON.stringify(W),Ye=JSON.stringify(F)!==JSON.stringify(te);if(qe||Ye){let M=_.elm;M&&M.render&&typeof M.render=="function"&&(M.setAttribute("isDirty","true"),requestAnimationFrame(()=>{if(M.render(),M.removeAttribute("isDirty"),M.handlers&&M.handlers.handleOnUpdate){let X={...M.deps||{},store:M.store,render:M.render.bind(M),handlers:M.handlers,dispatchEvent:M.dispatchEvent.bind(M),refIds:M.refIds||{},getRefIds:()=>M.refIds||{}};M.handlers.handleOnUpdate({oldProps:R,newProps:W,oldAttrs:F,newAttrs:te},X)}}))}}});try{return e(m,V,S)}catch($){return console.error("Error creating virtual node:",$,{tagName:m,snabbdomData:V,childrenOrText:S}),e("div",{},["Error creating element"])}}).filter(Boolean)}return i(t)};var fa=(e,t)=>{if(!t||typeof t!="object")return"";let r="",s=i=>Object.entries(i).map(([a,o])=>` ${a}: ${o};`).join(`
927
- `),n=(i,a)=>{if(typeof a!="object"||a===null)return"";if(i.startsWith("@")){let o=Object.entries(a).map(([l,p])=>{let u=s(p);return` ${l} {
928
- ${u.split(`
929
- `).map(c=>c?` ${c}`:"").join(`
926
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._popoverOverlay=document.createElement("div"),this._popoverOverlay.className="popover-overlay",this.shadow.appendChild(this._popoverOverlay),this._popoverOverlay.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("close",{detail:{}}))}),this._popoverOverlay.addEventListener("contextmenu",t=>{t.preventDefault(),this.dispatchEvent(new CustomEvent("close",{detail:{}}))}),this._popoverContainer=document.createElement("div"),this._popoverContainer.className="popover-container",this.shadow.appendChild(this._popoverContainer),this._slotElement=null,this._isOpen=!1,this._handleEscKey=this._handleEscKey.bind(this)}static get observedAttributes(){return["open","x","y","placement","no-overlay"]}connectedCallback(){this.hasAttribute("open")&&this._show()}disconnectedCallback(){this._removeGlobalListeners()}attributeChangedCallback(t,r,s){t==="open"?s!==null&&!this._isOpen?this._show():s===null&&this._isOpen&&this._hide():(t==="x"||t==="y"||t==="placement")&&this._isOpen&&this._updatePosition()}_show(){this._isOpen||(this._slotElement||(this._slotElement=document.createElement("slot"),this._slotElement.setAttribute("name","content"),this._popoverContainer.appendChild(this._slotElement)),this._isOpen=!0,this._updatePosition(),this._addGlobalListeners())}_hide(){this._isOpen&&(this._isOpen=!1,this._slotElement&&(this._popoverContainer.removeChild(this._slotElement),this._slotElement=null),this._removeGlobalListeners())}_updatePosition(){let t=parseFloat(this.getAttribute("x")||"0"),r=parseFloat(this.getAttribute("y")||"0"),s=this.getAttribute("placement")||"bottom-start";this.removeAttribute("positioned"),requestAnimationFrame(()=>{let i=this._popoverContainer.getBoundingClientRect(),{left:n,top:o}=this._calculatePosition(t,r,i.width,i.height,s);this._popoverContainer.style.left=`${n}px`,this._popoverContainer.style.top=`${o}px`,requestAnimationFrame(()=>{this.setAttribute("positioned","")})})}_calculatePosition(t,r,s,i,n){let a=t,l=r;switch(n){case"top":a=t-s/2,l=r-i-8;break;case"top-start":a=t,l=r-i-8;break;case"top-end":a=t-s,l=r-i-8;break;case"right":a=t+8,l=r-i/2;break;case"right-start":a=t+8,l=r;break;case"right-end":a=t+8,l=r-i;break;case"bottom":a=t-s/2,l=r+8;break;case"bottom-start":a=t,l=r+8;break;case"bottom-end":a=t-s,l=r+8;break;case"left":a=t-s-8,l=r-i/2;break;case"left-start":a=t-s-8,l=r;break;case"left-end":a=t-s-8,l=r-i;break}let p=8;return a=Math.max(p,Math.min(a,window.innerWidth-s-p)),l=Math.max(p,Math.min(l,window.innerHeight-i-p)),{left:a,top:l}}_addGlobalListeners(){setTimeout(()=>{document.addEventListener("keydown",this._handleEscKey)},0)}_removeGlobalListeners(){document.removeEventListener("keydown",this._handleEscKey)}_handleEscKey(t){t.key==="Escape"&&this.dispatchEvent(new CustomEvent("close",{detail:{}}))}get popover(){return this._popoverContainer}},xr=({render:e,html:t})=>nt;var ot={};R(ot,{handleClickItem:()=>Gs});var Gs=(e,t)=>{let{dispatchEvent:r}=t,s=e.currentTarget.dataset.id;r(new CustomEvent("item-click",{detail:{id:s}}))};var at={};R(at,{INITIAL_STATE:()=>Ys,toViewData:()=>Zs});var Ys=Object.freeze({}),Xs=["id","class","style","slot"],Qs=e=>Object.entries(e).filter(([t])=>!Xs.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Zs=({props:e,attrs:t})=>{let r=Qs(t),s=e.items||[],i=e.separator||"breadcrumb-arrow",n=[];return s.forEach((o,a)=>{n.push(o),a<s.length-1&&n.push({isSeparator:!0})}),{containerAttrString:r,items:n,separator:i}};var _r={elementName:"rtgl-breadcrumb",viewDataSchema:{type:"object",properties:{containerAttrString:{type:"string"},items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"}}}},separator:{type:"string"}}},propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"}}}},separator:{type:"string",default:"breadcrumb-arrow"}}},refs:{"item-*":{eventListeners:{click:{handler:"handleClickItem"}}}},events:{"item-click":{type:"object",properties:{item:{type:"object",properties:{label:{type:"string"},id:{type:"string"}}},index:{type:"number"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c g=md p=sm ${containerAttrString}",value:{type:9,items:[{type:7,itemVar:"item",indexVar:null,iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:"$if item.isSeparator",value:{type:6,conditions:[{type:1,path:"item.isSeparator"},{type:1,path:"item.id"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-svg wh=16 svg=${separator} c=mu-fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg wh=16 svg=",{type:1,path:"separator"}," c=mu-fg"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#item-${item.id} data-id=${item.id} cur=p",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"item.label"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#item-",{type:1,path:"item.id"}," data-id=",{type:1,path:"item.id"}," cur=p"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"item.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view d=h av=c g=md p=sm ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var lt={};R(lt,{handleClickMenuItem:()=>ti,handleClosePopover:()=>ei});var ei=(e,t)=>{let{dispatchEvent:r}=t;r(new CustomEvent("close"))},ti=(e,t)=>{let{dispatchEvent:r}=t,s=parseInt(e.currentTarget.id.replace("option-","")),i=t.props.items[s];r(new CustomEvent("click-item",{detail:{index:s,item:i}}))};var pt={};R(pt,{INITIAL_STATE:()=>ri,toViewData:()=>si});var ri=Object.freeze({}),si=({props:e,attrs:t})=>({items:e.items||[],open:!!t.open,x:t.x,y:t.y,placement:t.placement});var Er={elementName:"rtgl-dropdown-menu",viewDataSchema:{type:"object"},propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},type:{type:"string",enum:["label","item","separator"]}}}}}},attrsSchema:{type:"object",properties:{open:{type:"string"},x:{type:"string"},y:{type:"string"},placement:{type:"string"}}},refs:{popover:{eventListeners:{close:{handler:"handleClosePopover"}}},"option-*":{eventListeners:{click:{handler:"handleClickMenuItem"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-popover#popover ?open=${open} x=${x} y=${y} placement=${placement}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view wh=300 g=xs slot=content bgc=background br=md",value:{type:9,items:[{type:7,itemVar:"item",indexVar:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:"$if item.type == 'label'",value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"item.type"},right:{type:0,value:"label"}},{type:4,op:0,left:{type:1,path:"item.type"},right:{type:0,value:"item"}},{type:4,op:0,left:{type:1,path:"item.type"},right:{type:0,value:"separator"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f ph=lg pv=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"item.label"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#option-${i} w=f h-bgc=ac ph=lg pv=md cur=p br=md bgc=mu",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"item.label"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#option-",{type:1,path:"i"}," w=f h-bgc=ac ph=lg pv=md cur=p br=md bgc=mu"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=1 ph=lg mv=md bgc=bo",value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-popover#popover ?open=",{type:1,path:"open"}," x=",{type:1,path:"x"}," y=",{type:1,path:"y"}," placement=",{type:1,path:"placement"}]}}],fast:!1}],fast:!1}};var ct={};R(ct,{handleActionClick:()=>oi,handleBeforeMount:()=>ii,handleColorPickerChange:()=>ci,handleImageClick:()=>di,handleInputChange:()=>ai,handleOnUpdate:()=>ni,handlePopoverInputChange:()=>li,handleSelectAddOption:()=>yi,handleSelectChange:()=>pi,handleSliderChange:()=>ui,handleSliderInputChange:()=>hi,handleTooltipMouseEnter:()=>mi,handleTooltipMouseLeave:()=>gi,handleWaveformClick:()=>fi});var ii=e=>{let{store:t,props:r}=e;t.setFormValues(r.defaultValues)},ni=(e,t)=>{let{oldAttrs:r,newAttrs:s}=e,{store:i,props:n,render:o}=t;r?.key!==s?.key&&(i.setFormValues(n.defaultValues),o())},me=(e,t,r,s)=>{s(new CustomEvent("form-change",{detail:{name:e,fieldValue:t,formValues:r}}))},oi=(e,t)=>{let{store:r,dispatchEvent:s}=t,i=e.currentTarget.id.replace("action-","");s(new CustomEvent("action-click",{detail:{actionId:i,formValues:r.selectFormValues()}}))},ai=(e,t)=>{let{store:r,dispatchEvent:s,props:i}=t,n=e.currentTarget.id.replace("input-","");n&&e.detail.value!==void 0&&(r.setFormFieldValue({name:n,value:e.detail.value,props:i}),me(n,e.detail.value,r.selectFormValues(),s))},li=(e,t)=>{let{store:r,dispatchEvent:s,props:i}=t,n=e.currentTarget.id.replace("popover-input-","");n&&e.detail.value!==void 0&&(r.setFormFieldValue({name:n,value:e.detail.value,props:i}),me(n,e.detail.value,r.selectFormValues(),s))},pi=(e,t)=>{let{store:r,dispatchEvent:s,render:i,props:n}=t,o=e.currentTarget.id.replace("select-","");o&&e.detail.selectedValue!==void 0&&(r.setFormFieldValue({name:o,value:e.detail.selectedValue,props:n}),me(o,e.detail.selectedValue,r.selectFormValues(),s),i())},ci=(e,t)=>{let{store:r,dispatchEvent:s,props:i}=t,n=e.currentTarget.id.replace("colorpicker-","");n&&e.detail.value!==void 0&&(r.setFormFieldValue({name:n,value:e.detail.value,props:i}),me(n,e.detail.value,r.selectFormValues(),s))},ui=(e,t)=>{let{store:r,dispatchEvent:s,props:i}=t,n=e.currentTarget.id.replace("slider-","");n&&e.detail.value!==void 0&&(r.setFormFieldValue({name:n,value:e.detail.value,props:i}),me(n,e.detail.value,r.selectFormValues(),s))},hi=(e,t)=>{let{store:r,dispatchEvent:s,props:i}=t,n=e.currentTarget.id.replace("slider-input-","");n&&e.detail.value!==void 0&&(r.setFormFieldValue({name:n,value:e.detail.value,props:i}),me(n,e.detail.value,r.selectFormValues(),s))},di=(e,t)=>{e.type==="contextmenu"&&e.preventDefault();let{dispatchEvent:r}=t,s=e.currentTarget.id.replace("image-","");r(new CustomEvent("extra-event",{detail:{name:s,x:e.clientX,y:e.clientY,trigger:e.type}}))},fi=(e,t)=>{e.type==="contextmenu"&&e.preventDefault();let{dispatchEvent:r}=t,s=e.currentTarget.id.replace("waveform-","");r(new CustomEvent("extra-event",{detail:{name:s,x:e.clientX,y:e.clientY,trigger:e.type}}))},yi=(e,t)=>{let{store:r,dispatchEvent:s}=t,i=e.currentTarget.id.replace("select-","");s(new CustomEvent("action-click",{detail:{actionId:"select-options-add",name:i,formValues:r.selectFormValues()}}))},mi=(e,t)=>{let{store:r,render:s,props:i}=t,n=e.currentTarget.id.replace("tooltip-icon-",""),a=i.form.fields.find(l=>l.name===n);if(a&&a.tooltip){let l=e.currentTarget.getBoundingClientRect();r.showTooltip({x:l.left+l.width/2,y:l.top-8,content:a.tooltip.content}),s()}},gi=(e,t)=>{let{store:r,render:s}=t;r.hideTooltip(),s()};var vt={};R(vt,{INITIAL_STATE:()=>zi,getFormFieldValue:()=>Qi,hideTooltip:()=>rn,selectForm:()=>Ve,selectFormValues:()=>Xi,selectState:()=>Yi,setFormFieldValue:()=>en,setFormValues:()=>Zi,showTooltip:()=>tn,toViewData:()=>Gi});var g={LITERAL:0,VARIABLE:1,INTERPOLATION:2,FUNCTION:3,BINARY:4,UNARY:5,CONDITIONAL:6,LOOP:7,OBJECT:8,ARRAY:9},B={EQ:0,NEQ:1,GT:2,LT:3,GTE:4,LTE:5,AND:6,OR:7,IN:8},ke={NOT:0};var j=class extends Error{constructor(t){super(`Parse Error: ${t}`),this.name="JemplParseError"}},ge=class extends Error{constructor(t){super(`Render Error: ${t}`),this.name="JemplRenderError"}};var ut=e=>{if(!e||e.trim()==="")throw new j("Missing condition expression after '$if'");if(e.includes("===")||e.includes("!==")){let r=e.includes("===")?"==":"!=";throw new j(`Invalid comparison operator '${e.includes("===")?"===":"!=="}' - did you mean '${r}'? (got: '${e}')`)}let t=["<",">","<=",">=","==","!="];for(let r of t)if(e.trim().endsWith(r))throw new j(`Incomplete comparison expression - missing right operand (got: '${e}')`)},Ar=e=>{if(e.trim().endsWith(" in"))throw new j(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(!e.includes(" in "))throw new j(`Invalid loop syntax - missing 'in' keyword (got: '$for ${e}')`);let[t,r]=e.split(" in ");if(!r||r.trim()==="")throw new j(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(t.includes(",")){let s=t.split(",").map(i=>i.trim());for(let i of s)if(!i)throw new j(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`)}else if(!t.trim())throw new j(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`)};var kr=(e,t)=>{if(t===null)return new ge(`Cannot iterate over null value at '$for ${e}'`);if(t===void 0)return new ge(`Cannot iterate over undefined value at '$for ${e}'`);let r=typeof t;return new ge(`Cannot iterate over non-array value (got: ${r}) at '$for ${e}'`)},Sr=(e,t)=>{let r=t&&Object.keys(t).length>0?Object.keys(t).join(", "):"no custom functions provided";return new ge(`Unknown function '${e}' (${r})`)};var vi=(e,t,r={})=>{let s=T(e,r,t,{});return s===void 0?{}:s},T=(e,t,r,s)=>{if(e.var&&!e.type)return F(e.var,r,s);if(e.type===g.LITERAL)return e.value;if(e.type===g.VARIABLE)return F(e.path,r,s);if(e.type===g.INTERPOLATION)return wi(e.parts,t,r,s);switch(e.type){case g.FUNCTION:return Cr(e,t,r,s);case g.BINARY:return Ir(e,t,r,s);case g.UNARY:return Or(e,t,r,s);case g.CONDITIONAL:return _i(e,t,r,s);case g.LOOP:return $i(e,t,r,s);case g.OBJECT:return Ii(e,t,r,s);case g.ARRAY:return Oi(e,t,r,s);default:throw new Error(`Unknown node type: ${e.type}`)}},$r=new Map,bi=e=>{let t=[],r="",s=!1;for(let i=0;i<e.length;i++){let n=e[i];if(n==="[")r&&(t.push({type:"property",value:r}),r=""),s=!0;else if(n==="]"){if(s&&r){let o=r.trim();/^\d+$/.test(o)?t.push({type:"index",value:parseInt(o,10)}):t.push({type:"property",value:`[${r}]`}),r=""}s=!1}else r+=n}return r&&t.push({type:"property",value:r}),t},F=(e,t,r)=>{if(!e)return;if(e in r)return r[e];let s=$r.get(e);if(!s){let n=[],o="",a=0;for(let l=0;l<e.length;l++){let p=e[l];p==="["?(a++,o+=p):p==="]"?(a--,o+=p):p==="."&&a===0?o&&(n.push(o),o=""):o+=p}o&&n.push(o),s=[];for(let l of n){let p=bi(l.trim());s.push(...p)}$r.set(e,s)}let i=t;for(let n=0;n<s.length;n++){let o=s[n];if(o.type==="property"&&o.value in r){i=r[o.value];continue}if(i==null)return;(o.type==="property"||o.type==="index")&&(i=i[o.value])}return i},wi=(e,t,r,s)=>{let i=[];for(let n of e)if(typeof n=="string")i.push(n);else{let o=T(n,t,r,s);i.push(o!=null?String(o):"")}return i.join("")},Cr=(e,t,r,s)=>{let i=t[e.name];if(!i)throw Sr(e.name,t);let n=e.args.map(o=>T(o,t,r,s));return i(...n)},Se=(e,t,r,s)=>{if(e.var&&!e.type)return F(e.var,r,s);switch(e.type){case g.VARIABLE:return F(e.path,r,s);case g.LITERAL:return e.value;case g.BINARY:return Ir(e,t,r,s);case g.UNARY:return Or(e,t,r,s);case g.FUNCTION:return Cr(e,t,r,s);default:return T(e,t,r,s)}},Ir=(e,t,r,s)=>{if(e.op===B.AND||e.op===B.OR){let o=Se(e.left,t,r,s),a=Se(e.right,t,r,s);switch(e.op){case B.AND:return o&&a;case B.OR:return o||a}}let i=T(e.left,t,r,s),n=T(e.right,t,r,s);switch(e.op){case B.EQ:return i==n;case B.NEQ:return i!=n;case B.GT:return i>n;case B.LT:return i<n;case B.GTE:return i>=n;case B.LTE:return i<=n;case B.IN:return Array.isArray(n)?n.includes(i):!1;default:throw new Error(`Unknown binary operator: ${e.op}`)}},Or=(e,t,r,s)=>{let i=e.op===ke.NOT?Se(e.operand,t,r,s):T(e.operand,t,r,s);switch(e.op){case ke.NOT:return!i;default:throw new Error(`Unknown unary operator: ${e.op}`)}},xi=(e,t,r,s)=>{if(e.conditions.length===2&&e.conditions[1]===null){let i=e.conditions[0];if(i.type===g.VARIABLE)if(F(i.path,r,s)){let o=e.bodies[0];if(o.type===g.OBJECT&&o.properties.length<=5){let a={};for(let l of o.properties){let p=l.parsedKey?T(l.parsedKey,t,r,s):l.key,c=l.value;if(c.type===g.LITERAL)a[p]=c.value;else if(c.type===g.VARIABLE)a[p]=F(c.path,r,s);else if(c.type===g.INTERPOLATION){let u=[];for(let d of c.parts)if(typeof d=="string")u.push(d);else if(d.type===g.VARIABLE){let y=F(d.path,r,s);u.push(y!=null?String(y):"")}else{let y=T(d,t,r,s);u.push(y!=null?String(y):"")}a[p]=u.join("")}else a[p]=T(c,t,r,s)}return a}}else{let o=e.bodies[1];if(o.type===g.OBJECT&&o.properties.length<=5){let a={};for(let l of o.properties){let p=l.parsedKey?T(l.parsedKey,t,r,s):l.key,c=l.value;if(c.type===g.LITERAL)a[p]=c.value;else if(c.type===g.VARIABLE)a[p]=F(c.path,r,s);else if(c.type===g.INTERPOLATION){let u=[];for(let d of c.parts)if(typeof d=="string")u.push(d);else if(d.type===g.VARIABLE){let y=F(d.path,r,s);u.push(y!=null?String(y):"")}else{let y=T(d,t,r,s);u.push(y!=null?String(y):"")}a[p]=u.join("")}else a[p]=T(c,t,r,s)}return a}}}return null},_i=(e,t,r,s)=>{let i=xi(e,t,r,s);if(i!==null)return i;for(let n=0;n<e.conditions.length;n++){let o=e.conditions[n];if(o===null||Se(o,t,r,s))return T(e.bodies[n],t,r,s)}return Tr},Ei=(e,t)=>{let r=e.body,s=e.itemVar;if(r.type===g.CONDITIONAL&&r.conditions.length===1&&r.conditions[0].type===g.VARIABLE){let i=r.conditions[0].path,n=r.bodies[0];if(i.startsWith(s+".")){let o=i.substring(s.length+1);if(n.type===g.OBJECT&&n.properties.length<=5){for(let l of n.properties)if(l.parsedKey)return null;let a=[];for(let l=0;l<t.length;l++){let p=t[l];if(p[o]){let c={};for(let u of n.properties){let d=u.key,y=u.value;if(y.type===g.LITERAL)c[d]=y.value;else if(y.type===g.VARIABLE){let h=y.path;if(h===s)c[d]=p;else if(h.startsWith(s+".")){let f=h.substring(s.length+1);c[d]=p[f]}else return null}else if(y.type===g.INTERPOLATION){let h=[],f=!0;for(let m of y.parts)if(typeof m=="string")h.push(m);else if(m.type===g.VARIABLE){let v=m.path;if(v===s)h.push(p!=null?String(p):"");else if(v.startsWith(s+".")){let b=v.substring(s.length+1),x=p[b];h.push(x!=null?String(x):"")}else{f=!1;break}}else{f=!1;break}if(!f)return null;c[d]=h.join("")}else return null}a.push(c)}}return a}}}return null},Ai=(e,t)=>{let r=e.body,s=e.itemVar,i=Ei(e,t);if(i!==null)return i;if(r.type===g.OBJECT&&r.properties.length<=5){for(let a of r.properties)if(a.parsedKey)return null;let n=[],o=!0;for(let a of r.properties){let l=a.key,p=a.value;if(p.type===g.LITERAL)n.push({key:l,type:"literal",value:p.value});else if(p.type===g.VARIABLE){let c=p.path;if(c===s)n.push({key:l,type:"item"});else if(c.startsWith(s+".")){let u=c.substring(s.length+1);if(!u.includes(".")&&!u.includes("["))n.push({key:l,type:"prop",prop:u});else{o=!1;break}}else{o=!1;break}}else if(p.type===g.INTERPOLATION&&p.parts.length===1){let c=p.parts[0];if(c.type===g.VARIABLE){let u=c.path;if(u===s)n.push({key:l,type:"item_string"});else if(u.startsWith(s+".")){let d=u.substring(s.length+1);if(!d.includes(".")&&!d.includes("["))n.push({key:l,type:"prop_string",prop:d});else{o=!1;break}}else{o=!1;break}}else{o=!1;break}}else{o=!1;break}}if(o){let a=new Array(t.length);if(n.length===3&&n[0].type==="prop"&&n[0].key==="id"&&n[1].type==="prop_string"&&n[1].key==="title"&&n[2].type==="prop"&&n[2].key==="completed")for(let l=0;l<t.length;l++){let p=t[l];a[l]={id:p.id,title:p.title!=null?String(p.title):"",completed:p.completed}}else for(let l=0;l<t.length;l++){let p=t[l],c={};for(let u of n)if(u.type==="literal")c[u.key]=u.value;else if(u.type==="item")c[u.key]=p;else if(u.type==="prop")c[u.key]=p[u.prop];else if(u.type==="item_string")c[u.key]=p!=null?String(p):"";else if(u.type==="prop_string"){let d=p[u.prop];c[u.key]=d!=null?String(d):""}a[l]=c}return a}}return null},ki=(e,t,r,s,i)=>{let n=[],o=e.body;if(o.type===g.OBJECT&&o.fast!==!1){let a=e.itemVar,l=e.indexVar;for(let p=0;p<i.length;p++){let c=i[p],u={},d={...s,[a]:c,...l&&{[l]:p}};for(let y of o.properties){let h=y.parsedKey?T(y.parsedKey,t,r,d):y.key,f=y.value;if(f.type===g.LITERAL)u[h]=f.value;else if(f.type===g.VARIABLE){let m=f.path;if(m===a)u[h]=c;else if(m===l)u[h]=p;else if(m.startsWith(a+".")){let v=m.substring(a.length+1);!v.includes(".")&&!v.includes("[")?u[h]=c[v]:u[h]=F(m,r,{...s,[a]:c,...l&&{[l]:p}})}else u[h]=F(m,r,{...s,[a]:c,...l&&{[l]:p}})}else if(f.type===g.INTERPOLATION){let m=[];for(let v of f.parts)if(typeof v=="string")m.push(v);else if(v.type===g.VARIABLE){let b=v.path,x;if(b===a)x=c;else if(b===l)x=p;else if(b.startsWith(a+".")){let _=b.substring(a.length+1);!_.includes(".")&&!_.includes("[")?x=c[_]:x=F(b,r,{...s,[a]:c,...l&&{[l]:p}})}else x=F(b,r,{...s,[a]:c,...l&&{[l]:p}});m.push(x!=null?String(x):"")}else{let b={...s,[a]:c,...l&&{[l]:p}},x=T(v,t,r,b);m.push(x!=null?String(x):"")}u[h]=m.join("")}else{let m={...s,[a]:c,...l&&{[l]:p}};u[h]=T(f,t,r,m)}}n.push(u)}return n}return null},Si=(e,t,r)=>{let s=e.body;if(s.type===g.OBJECT&&s.properties.length===1&&s.properties[0].key==="$if item.visible"){let n=s.properties[0].value;if(n.type===g.CONDITIONAL&&n.conditions.length===1&&n.conditions[0].type===g.VARIABLE&&n.conditions[0].path==="item.visible"){let o=n.bodies[0];if(o.type===g.OBJECT&&o.properties.length===2){let a=o.properties[0],l=o.properties[1];if(a.key==="id"&&a.value.type===g.VARIABLE&&a.value.path==="item.id"&&l.key==="$if item.highlighted"&&l.value.type===g.CONDITIONAL){let p=[];for(let c=0;c<t.length;c++){let u=t[c];if(u.visible){let d={id:u.id};u.highlighted?(d.highlight=!0,d.message=`This item is highlighted: ${u.name}`):(d.highlight=!1,d.message=u.name),p.push(d)}}return p}}}}return null},$i=(e,t,r,s)=>{let i=T(e.iterable,t,r,s);if(!Array.isArray(i)){let a=`${e.itemVar}${e.indexVar?`, ${e.indexVar}`:""} in ${e.iterable.path}`;throw kr(a,i)}if(!e.indexVar){let a=Si(e,i,e.itemVar);if(a!==null)return a}if(!e.indexVar){let a=Ai(e,i);if(a!==null)return a}let n=ki(e,t,r,s,i);if(n!==null)return n;let o=[];for(let a=0;a<i.length;a++){let l=e.indexVar?{...s,[e.itemVar]:i[a],[e.indexVar]:a}:{...s,[e.itemVar]:i[a]},p=T(e.body,t,r,l);Array.isArray(p)&&p.length===1?o.push(p[0]):o.push(p)}return o},Ci=(e,t,r,s)=>{if(e.whenCondition)return null;if(e.properties.length===1){let i=e.properties[0],n=i.parsedKey?T(i.parsedKey,t,r,s):i.key,o=i.value;if(o.type===g.OBJECT&&o.properties.length<=10&&!o.whenCondition){let a={},l={},p=!0;for(let c of o.properties){let u=c.parsedKey?T(c.parsedKey,t,r,s):c.key,d=c.value;if(d.type===g.LITERAL)l[u]=d.value;else if(d.type===g.VARIABLE)l[u]=F(d.path,r,s);else if(d.type===g.INTERPOLATION){let y=[];for(let h of d.parts)if(typeof h=="string")y.push(h);else if(h.type===g.VARIABLE){let f=F(h.path,r,s);y.push(f!=null?String(f):"")}else{p=!1;break}if(!p)break;l[u]=y.join("")}else if(d.type===g.OBJECT&&d.properties.length<=5){let y={};for(let h of d.properties){let f=h.key,m=h.value;if(m.type===g.LITERAL)y[f]=m.value;else if(m.type===g.VARIABLE)y[f]=F(m.path,r,s);else if(m.type===g.INTERPOLATION){let v=[];for(let b of m.parts)if(typeof b=="string")v.push(b);else if(b.type===g.VARIABLE){let x=F(b.path,r,s);v.push(x!=null?String(x):"")}else{p=!1;break}if(!p)break;y[f]=v.join("")}else{p=!1;break}}if(!p)break;l[u]=y}else{p=!1;break}}if(p)return a[n]=l,a}}return null},Ii=(e,t,r,s)=>{if(e.whenCondition&&!Se(e.whenCondition,t,r,s))return;let i=Ci(e,t,r,s);if(i!==null)return i;if(e.fast){let l={};for(let p of e.properties){let c=p.parsedKey?T(p.parsedKey,t,r,s):p.key,u=p.value;if(u.type===g.LITERAL)l[c]=u.value;else if(u.type===g.VARIABLE)l[c]=F(u.path,r,s);else if(u.type===g.INTERPOLATION){let d=[];for(let y of u.parts)if(typeof y=="string")d.push(y);else if(y.type===g.VARIABLE){let h=F(y.path,r,s);d.push(h!=null?String(h):"")}else{let h=T(y,t,r,s);d.push(h!=null?String(h):"")}l[c]=d.join("")}else l[c]=T(u,t,r,s)}return l}let n={},o=null,a=!1;for(let l of e.properties)if(!l.key.startsWith("$if ")&&!l.key.match(/^\$if\s+\w+.*:?$/)&&!l.key.startsWith("$elif")&&!l.key.startsWith("$else")&&!l.key.startsWith("$for ")){a=!0;break}for(let l of e.properties)if(l.key.startsWith("$if ")||l.key.match(/^\$if\s+\w+.*:?$/)){let p=T(l.value,t,r,s);if(!a&&p!==null&&p!==void 0)return Array.isArray(p)&&p.length===1?p[0]:p;typeof p=="object"&&p!==null&&!Array.isArray(p)&&Object.assign(n,p)}else if(!l.key.startsWith("$for ")){let p=l.value;if(p&&p.type===g.OBJECT&&p.properties){let c=p.properties.find(u=>u.key.startsWith("$for "));if(c){let u=T(c.value,t,r,s);u!==void 0&&(n[l.key]=u)}else{let u=T(l.value,t,r,s);u!==void 0&&(n[l.key]=u)}}else{let c=l.parsedKey?T(l.parsedKey,t,r,s):l.key,u=T(l.value,t,r,s);u!==void 0&&(n[c]=u)}}return n},Tr={},Oi=(e,t,r,s)=>{let i=[];for(let n of e.items)if(n.type===g.LOOP){let o=T(n,t,r,s);i.push(o)}else{let o=T(n,t,r,s);o!==Tr&&o!==void 0&&i.push(o)}return i},ht=vi;var Ti=/\$\{([^}]*)\}/g,Nr=e=>{let t=e.match(/^(\w+)\((.*)\)$/);if(!t)return{isFunction:!1};let[,r,s]=t,i=Li(s);return{isFunction:!0,type:g.FUNCTION,name:r,args:i}},Li=e=>e.trim()?Ni(e).map(r=>Vi(r.trim())):[],Ni=e=>{let t=[],r="",s=0,i=!1,n="";for(let o=0;o<e.length;o++){let a=e[o],l=o>0?e[o-1]:"";!i&&(a==='"'||a==="'")?(i=!0,n=a,r+=a):i&&a===n&&l!=="\\"?(i=!1,n="",r+=a):!i&&a==="("?(s++,r+=a):!i&&a===")"?(s--,r+=a):!i&&a===","&&s===0?(t.push(r),r=""):r+=a}return r&&t.push(r),t},Vi=e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:g.LITERAL,value:e.slice(1,-1)};if(/^-?\d+(\.\d+)?$/.test(e))return{type:g.LITERAL,value:parseFloat(e)};if(e==="true")return{type:g.LITERAL,value:!0};if(e==="false")return{type:g.LITERAL,value:!1};if(e==="null")return{type:g.LITERAL,value:null};let t=Nr(e);return t.isFunction?{type:t.type,name:t.name,args:t.args}:{type:g.VARIABLE,path:e}},Ri=/^\w+\(.*\)$/,Pi=/\s[+\-*/%]\s|\|\||&&|\?\?|.*\?.*:/,ji=e=>{if(!(!e||e.trim()===""||Ri.test(e))&&Pi.test(e))throw e.includes("?")&&e.includes(":")?new j(`Complex expressions not supported in variable replacements - consider calculating the value in your data instead. Offending expression: "${e}"`):e.includes("||")||e.includes("&&")||e.includes("??")?new j(`Logical operators not supported in variable replacements - consider calculating the value in your data instead (operators like ||, &&, ?? are not supported). Offending expression: "${e}"`):new j(`Arithmetic expressions not supported in variable replacements - consider calculating '${e}' in your data instead (expressions with +, -, *, /, % are not supported). Offending expression: "${e}"`)},Lr=(e,t={})=>{let r=e.trim();ji(r);let s=Nr(r);if(s.isFunction)return{type:s.type,name:s.name,args:s.args};if(r.includes("[")&&!/[\s+\-*/%|&?:]/.test(r)){let i=0;for(let n of r)n==="["?i++:n==="]"&&i--;if(i!==0)throw new Error("Invalid array index syntax")}return{type:g.VARIABLE,path:r}},dt=(e,t={})=>{let r=e,s=[];e.includes("\\${")&&(r=e.replace(/\\\\(\$\{[^}]*\})/g,"\\DOUBLE_ESC$1"),r=r.replace(/\\(\$\{[^}]*\})/g,(a,l)=>{let p=`__ESCAPED_${s.length}__`;return s.push(l),p}),r=r.replace(/\\DOUBLE_ESC/g,"\\"));let i=[...r.matchAll(Ti)];if(i.length===0){let a=r;for(let l=0;l<s.length;l++)a=a.replace(`__ESCAPED_${l}__`,s[l]);return{type:g.LITERAL,value:a}}if(i.length===1&&i[0][0]===r&&s.length===0)try{return Lr(i[0][1],t)}catch(a){if(a.message==="Invalid array index syntax")return{type:g.LITERAL,value:r};throw a}let n=[],o=0;for(let a of i){let[l,p]=a,c=a.index;if(c>o){let u=r.substring(o,c);for(let d=0;d<s.length;d++)u=u.replace(`__ESCAPED_${d}__`,s[d]);u&&n.push(u)}try{let u=Lr(p.trim(),t);n.push(u)}catch(u){if(u.message==="Invalid array index syntax")n.push(l);else throw u}o=c+l.length}if(o<r.length){let a=r.substring(o);for(let l=0;l<s.length;l++)a=a.replace(`__ESCAPED_${l}__`,s[l]);a&&n.push(a)}return{type:g.INTERPOLATION,parts:n}};var le=(e,t)=>typeof e=="string"?dt(e,t):typeof e=="object"&&e!==null?Array.isArray(e)?Di(e,t):Bi(e,t):{type:g.LITERAL,value:e},Di=(e,t)=>{let r=[],s=!1;for(let i=0;i<e.length;i++){let n=e[i];if(typeof n=="object"&&n!==null&&!Array.isArray(n)){let a=Object.keys(n);if(a.length===1&&a[0].startsWith("$for ")){let l=Vr(a[0],n[a[0]],t);r.push(l),s=!0;continue}}let o=le(n,t);r.push(o),(o.type===g.FUNCTION||o.type===g.CONDITIONAL||o.type===g.LOOP||o.type===g.OBJECT&&!o.fast||o.type===g.ARRAY&&!o.fast)&&(s=!0)}return{type:g.ARRAY,items:r,fast:!s}},Bi=(e,t)=>{let r=[],s=!1,i=null,n=Object.entries(e),o=0;for(let[l,p]of n)if(l==="$when"){if(i!==null)throw new j("Multiple '$when' directives on the same object are not allowed");if(p==null)throw new j("Missing condition expression after '$when'");let c=typeof p=="string"?p:JSON.stringify(p);if(c.trim()==="")throw new j("Empty condition expression after '$when'");i=ee(c),s=!0}else if(l.startsWith("$when#")||l.startsWith("$when "))throw new j("'$when' does not support ID syntax or inline conditions - use '$when' as a property");for(;o<n.length;){let[l,p]=n[o];if(l==="$when"){o++;continue}if(l.startsWith("$if ")||l.match(/^\$if#\w+\s/)||l.match(/^\$if\s+\w+.*:$/)){let c=Wi(n,o,t);r.push({key:l,value:c.node}),s=!0,o=c.nextIndex}else if(l.startsWith("$for ")){let c=Vr(l,p,t);r.push({key:l,value:c}),s=!0,o++}else{if(l.startsWith("$elif ")||l.startsWith("$else"))throw new j(`'${l.split(" ")[0]}' without matching '$if'`);if(l==="$if"||l==="$if:")throw new j("Missing condition expression after '$if'");{let c=le(p,t);(c.type===g.FUNCTION||c.type===g.CONDITIONAL||c.type===g.LOOP||c.type===g.OBJECT&&!c.fast||c.type===g.ARRAY&&!c.fast)&&(s=!0);let u=dt(l,t),d={key:l,value:c};(u.type!==g.LITERAL||u.value!==l)&&(d.parsedKey=u),r.push(d),o++}}}let a={type:g.OBJECT,properties:r,fast:!s};return i&&(a.whenCondition=i),a},Wi=(e,t,r={})=>{let s=[],i=[],n=t,[o,a]=e[n],l=null,p;if(o.startsWith("$if#")){let u=o.match(/^\$if#(\w+)\s+(.+)$/);if(u)l=u[1],p=u[2];else throw new j(`Invalid conditional syntax: ${o}`)}else p=o.substring(4),p.endsWith(":")&&(p=p.slice(0,-1).trim());ut(p);let c=ee(p);for(s.push(c),i.push(le(a,r)),n++;n<e.length;){let[u,d]=e[n],y=!1,h;if(l?u.startsWith(`$elif#${l} `)?(h=u.substring(`$elif#${l} `.length),h.endsWith(":")&&(h=h.slice(0,-1).trim()),y=!0):(u===`$else#${l}`||u===`$else#${l}:`)&&(y=!0,h=null):u.startsWith("$elif ")?(h=u.substring(6),h.endsWith(":")&&(h=h.slice(0,-1).trim()),y=!0):(u==="$else"||u==="$else:")&&(y=!0,h=null),y){if(h===null)s.push(null);else{ut(h);let f=ee(h);s.push(f)}if(i.push(le(d,r)),n++,h===null)break}else break}return{node:{type:g.CONDITIONAL,conditions:s,bodies:i,id:l},nextIndex:n}},ee=e=>{if(e=e.trim(),e.startsWith("(")&&e.endsWith(")"))return ee(e.slice(1,-1));let t=Ne(e,"||");if(t!==-1)return{type:g.BINARY,op:B.OR,left:ee(e.substring(0,t).trim()),right:ee(e.substring(t+2).trim())};let r=Ne(e,"&&");if(r!==-1)return{type:g.BINARY,op:B.AND,left:ee(e.substring(0,r).trim()),right:ee(e.substring(r+2).trim())};let s=[{op:">=",type:B.GTE},{op:"<=",type:B.LTE},{op:"==",type:B.EQ},{op:"!=",type:B.NEQ},{op:">",type:B.GT},{op:"<",type:B.LT},{op:" in ",type:B.IN}];for(let{op:n,type:o}of s){let a=Ne(e,n);if(a!==-1)return{type:g.BINARY,op:o,left:ee(e.substring(0,a).trim()),right:ee(e.substring(a+n.length).trim())}}let i=[" + "," - "," * "," / "," % "];for(let n of i)if(Ne(e,n)!==-1)throw new j(`Arithmetic expressions not supported in conditionals - consider calculating '${e}' in your data instead (expressions with +, -, *, /, % are not supported). Offending expression: "${e}"`);return e.startsWith("!")?{type:g.UNARY,op:ke.NOT,operand:ee(e.substring(1).trim())}:Mi(e)},Ne=(e,t)=>{let r=0,s=0;for(;s<=e.length-t.length;){if(e[s]==="(")r++;else if(e[s]===")")r--;else if(r===0&&e.substring(s,s+t.length)===t)return s;s++}return-1},Mi=e=>{if(e=e.trim(),e==="true")return{type:g.LITERAL,value:!0};if(e==="false")return{type:g.LITERAL,value:!1};if(e==="null")return{type:g.LITERAL,value:null};if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:g.LITERAL,value:e.slice(1,-1)};if(e==='""'||e==="''")return{type:g.LITERAL,value:""};let t=Number(e);return!isNaN(t)&&isFinite(t)?{type:g.LITERAL,value:t}:{type:g.VARIABLE,path:e}},Vr=(e,t,r)=>{let s=e.substring(5).trim();Ar(s);let i=s.match(/^(.+?)\s+in\s+(.+)$/);if(!i)throw new j(`Invalid loop syntax - missing 'in' keyword (got: '$for ${s}')`);let n=i[1].trim(),o=i[2].trim(),a,l=null;if(n.includes(",")){let u=n.split(",").map(d=>d.trim());if(u.length!==2)throw new j(`Invalid loop variables: ${n}. Expected format: "item" or "item, index"`);a=u[0],l=u[1]}else a=n;let p={type:g.VARIABLE,path:o},c=le(t,r);return{type:g.LOOP,itemVar:a,indexVar:l,iterable:p,body:c}};var Fi=(e,t={})=>{let{functions:r={}}=t;return le(e,r)},ft=Fi;var yt={};R(yt,{now:()=>Ki});var Ki=()=>Date.now();var Ui=(e,t,r={})=>{let{functions:s={}}=r,i={...yt,...s},n=ft(e,{functions:i});return ht(n,t,i)},mt=Ui;var Rr=e=>{function t(r){let s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return r.replace(/[&<>"']/g,i=>s[i])}return e==null?"":`"${t(String(e))}"`};function Pr(e,t){return t.reduce((r,s)=>(s in e&&(r[s]=e[s]),r),{})}var zi=Object.freeze({formValues:{},tooltipState:{open:!1,x:0,y:0,content:""}}),gt=(e,t,r=void 0)=>{if(!t)return;let s=t.split(/[\[\].]/).filter(n=>n!==""),i=e;for(let n of s){if(i==null||!(n in i))return r;i=i[n]}return i},Hi=(e,t,r)=>{let s=t.split(/[\[\].]/).filter(n=>n!=="");t.includes("[")&&t in e&&delete e[t];let i=e;for(let n=0;n<s.length-1;n++){let o=s[n];if(!(o in i)||typeof i[o]!="object"||i[o]===null){let a=s[n+1],l=/^\d+$/.test(a);i[o]=l?[]:{}}i=i[o]}return i[s[s.length-1]]=r,e},Ji=["id","class","style","slot"],qi=e=>Object.entries(e).filter(([t])=>!Ji.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ve=({state:e,props:t})=>{let{form:r}=t,{context:s}=t;return s?mt(r,s):r},Gi=({state:e,props:t,attrs:r})=>{let s=qi(r),i=t.defaultValues||{},n=Ve({state:e,props:t}),o=structuredClone(n.fields||[]);return o.forEach(a=>{let l=gt(e.formValues,a.name)??gt(i,a.name);if(["popover-input","select","read-only-text"].includes(a.inputType)?a.defaultValue=l:a.defaultValue=Rr(l),["inputText"].includes(a.inputType)&&(a.placeholder=Rr(a.placeholder)),a.inputType==="image"){let p=a.src;a.imageSrc=p&&p.trim()?p:null,a.placeholderText=a.placeholder||"No Image"}if(a.inputType==="waveform"){let p=a.waveformData;a.waveformData=p||null,a.placeholderText=a.placeholder||"No Waveform"}}),{key:r?.key,containerAttrString:s,title:n?.title||"",description:n?.description||"",fields:o,actions:t?.form?.actions||{buttons:[]},formValues:e.formValues,tooltipState:e.tooltipState}},Yi=({state:e})=>e,Xi=({state:e,props:t})=>{let r=Ve({state:e,props:t});return Pr(e.formValues,r.fields.map(s=>s.name))},Qi=({state:e},t)=>gt(e.formValues,t),Zi=(e,t)=>{e.formValues=t||{}},en=(e,{name:t,value:r,props:s})=>{Hi(e.formValues,t,r);let i=Ve({state:e,props:s}),n=Pr(e.formValues,i.fields.map(o=>o.name));e.formValues=n},tn=(e,{x:t,y:r,content:s})=>{e.tooltipState={open:!0,x:t,y:r,content:s}},rn=e=>{e.tooltipState={...e.tooltipState,open:!1}};var jr={elementName:"rtgl-form",viewDataSchema:{type:"object"},propsSchema:{type:"object",properties:{defaultValues:{type:"object"},context:{type:"object"},form:{type:"object",properties:{title:{type:"string"},description:{type:"string"},fields:{type:"array",items:{anyOf:[{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"inputText"},placeholder:{type:"string"},tooltip:{type:"object",properties:{content:{type:"string"}}}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"select"},placeholder:{type:"string"},noClear:{type:"boolean"},addOption:{type:"object",properties:{label:{type:"string"}}},options:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"any"}},required:["label","value"]}},tooltip:{type:"object",properties:{content:{type:"string"}}}},required:["name","label","inputType","options"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"colorPicker"},value:{type:"string"},tooltip:{type:"object",properties:{content:{type:"string"}}}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"slider"},min:{type:"number"},max:{type:"number"},step:{type:"number"},value:{type:"number"},tooltip:{type:"object",properties:{content:{type:"string"}}}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"slider-input"},min:{type:"number"},max:{type:"number"},step:{type:"number"},value:{type:"number"},tooltip:{type:"object",properties:{content:{type:"string"}}}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"image"},width:{type:"number"},height:{type:"number"},placeholder:{type:"string"},tooltip:{type:"object",properties:{content:{type:"string"}}}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"waveform"},width:{type:"number"},height:{type:"number"},placeholder:{type:"string"},defaultValue:{type:"object"},waveformData:{type:"object"},tooltip:{type:"object",properties:{content:{type:"string"}}}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"popover-input"},placeholder:{type:"string"},tooltip:{type:"object",properties:{content:{type:"string"}}}},required:["name","label","inputType"],additionalProperties:!1}]}},actions:{type:"object",properties:{buttons:{type:"array",items:{type:"object",properties:{id:{type:"string"},content:{type:"string"}},required:["id","content"]}}}}}}}},refs:{"action-*":{eventListeners:{click:{handler:"handleActionClick"}}},"tooltip-icon-*":{eventListeners:{mouseenter:{handler:"handleTooltipMouseEnter"},mouseleave:{handler:"handleTooltipMouseLeave"}}},"input-*":{eventListeners:{"input-change":{handler:"handleInputChange"}}},"select-*":{eventListeners:{"select-change":{handler:"handleSelectChange"},"add-option-selected":{handler:"handleSelectAddOption"}}},"colorpicker-*":{eventListeners:{"colorpicker-change":{handler:"handleColorPickerChange"}}},"slider-*":{eventListeners:{"slider-change":{handler:"handleSliderChange"}}},"slider-input-*":{eventListeners:{"slider-input-value-change":{handler:"handleSliderInputChange"}}},"image-*":{eventListeners:{click:{handler:"handleImageClick"},contextmenu:{handler:"handleImageClick"}}},"waveform-*":{eventListeners:{click:{handler:"handleWaveformClick"},contextmenu:{handler:"handleWaveformClick"}}},"popover-input-*":{eventListeners:{"input-change":{handler:"handlePopoverInputChange"}}}},events:{"form-change":{},"extra-event":{},"action-click":{}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f p=md g=lg ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=sm w=f",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"title"}}],fast:!0},{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:1,path:"description"}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-view g=lg w=f",value:{type:9,items:[{type:7,itemVar:"field",indexVar:"i",iterable:{type:1,path:"fields"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=md w=f",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=sm",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h g=md av=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"field.label"}}],fast:!0},{type:8,properties:[{key:"$if field.tooltip",value:{type:6,conditions:[{type:1,path:"field.tooltip"}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-svg#tooltip-icon-${field.name} svg="info" wh=16 c=mu-fg cur=help ml=xs',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg#tooltip-icon-",{type:1,path:"field.name"},' svg="info" wh=16 c=mu-fg cur=help ml=xs']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1},{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"field.description"}}],fast:!0}],fast:!1}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "read-only-text"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"read-only-text"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm",value:{type:1,path:"field.defaultValue"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "inputText"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"inputText"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input#input-${field.name} key=${key} w=f placeholder=${field.placeholder} value=${field.defaultValue}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#input-",{type:1,path:"field.name"}," key=",{type:1,path:"key"}," w=f placeholder=",{type:1,path:"field.placeholder"}," value=",{type:1,path:"field.defaultValue"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "popover-input"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"popover-input"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-popover-input#popover-input-${field.name} label="${field.label}" .defaultValue=fields[${i}].defaultValue',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-popover-input#popover-input-",{type:1,path:"field.name"},' label="',{type:1,path:"field.label"},'" .defaultValue=fields[',{type:1,path:"i"},"].defaultValue"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "select"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"select"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-select#select-${field.name} key=${key} w=f .options=fields[${i}].options .placeholder=fields[${i}].placeholder .selectedValue=fields[${i}].defaultValue ?no-clear=fields[${i}].noClear .addOption=fields[${i}].addOption",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-select#select-",{type:1,path:"field.name"}," key=",{type:1,path:"key"}," w=f .options=fields[",{type:1,path:"i"},"].options .placeholder=fields[",{type:1,path:"i"},"].placeholder .selectedValue=fields[",{type:1,path:"i"},"].defaultValue ?no-clear=fields[",{type:1,path:"i"},"].noClear .addOption=fields[",{type:1,path:"i"},"].addOption"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "colorPicker"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"colorPicker"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-color-picker#colorpicker-${field.name} key=${key} value=${field.defaultValue}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-color-picker#colorpicker-",{type:1,path:"field.name"}," key=",{type:1,path:"key"}," value=",{type:1,path:"field.defaultValue"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "slider"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"slider"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-slider#slider-${field.name} key=${key} w=f min=${field.min} max=${field.max} step=${field.step} value=${field.defaultValue}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider#slider-",{type:1,path:"field.name"}," key=",{type:1,path:"key"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," value=",{type:1,path:"field.defaultValue"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "slider-input"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"slider-input"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-slider-input#slider-input-${field.name} key=${key} w=f min=${field.min} max=${field.max} step=${field.step} defaultValue=${field.defaultValue}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider-input#slider-input-",{type:1,path:"field.name"}," key=",{type:1,path:"key"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," defaultValue=",{type:1,path:"field.defaultValue"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "image" && field.imageSrc',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"image"}},right:{type:1,path:"field.imageSrc"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image#image-${field.name} src=${field.imageSrc} w=${field.width} h=${field.height} cur=p",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image#image-",{type:1,path:"field.name"}," src=",{type:1,path:"field.imageSrc"}," w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," cur=p"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "image" && !field.imageSrc',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"image"}},right:{type:5,op:0,operand:{type:1,path:"field.imageSrc"}}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view#image-${field.name} w=${field.width} h=${field.height} bc=ac bw=sm ah=c av=c cur=p p=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg ta=c",value:{type:1,path:"field.placeholderText"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#image-",{type:1,path:"field.name"}," w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," bc=ac bw=sm ah=c av=c cur=p p=md"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "waveform" && field.waveformData',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"waveform"}},right:{type:1,path:"field.waveformData"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-waveform#waveform-${field.name} .waveformData=fields[${i}].waveformData w=${field.width} h=${field.height} cur=p",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-waveform#waveform-",{type:1,path:"field.name"}," .waveformData=fields[",{type:1,path:"i"},"].waveformData w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," cur=p"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "waveform" && !field.waveformData',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"waveform"}},right:{type:5,op:0,operand:{type:1,path:"field.waveformData"}}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view#waveform-${field.name} w=${field.width} h=${field.height} bc=ac bw=sm ah=c av=c cur=p p=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg ta=c",value:{type:1,path:"field.placeholder"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#waveform-",{type:1,path:"field.name"}," w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," bc=ac bw=sm ah=c av=c cur=p p=md"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "slot"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"slot"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'slot#slot-${field.slotName} name=${field.slot} style="display: contents;"',value:{type:0,value:null},parsedKey:{type:2,parts:["slot#slot-",{type:1,path:"field.slotName"}," name=",{type:1,path:"field.slot"},' style="display: contents;"']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}}],fast:!1},{type:8,properties:[{key:"rtgl-view g=sm w=f",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h ah=e g=sm w=f",value:{type:9,items:[{type:7,itemVar:"button",indexVar:"i",iterable:{type:1,path:"actions.buttons"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-button#action-${button.id}",value:{type:1,path:"button.content"},parsedKey:{type:2,parts:["rtgl-button#action-",{type:1,path:"button.id"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1},{type:8,properties:[{key:'rtgl-tooltip ?open=${tooltipState.open} x=${tooltipState.x} y=${tooltipState.y} placement="top" content="${tooltipState.content}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-tooltip ?open=",{type:1,path:"tooltipState.open"}," x=",{type:1,path:"tooltipState.x"}," y=",{type:1,path:"tooltipState.y"},' placement="top" content="',{type:1,path:"tooltipState.content"},'"']}}],fast:!0}],fast:!1},parsedKey:{type:2,parts:["rtgl-view w=f p=md g=lg ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var bt={};R(bt,{handleCancel:()=>on,handleConfirm:()=>nn,handleDialogClose:()=>sn,showAlert:()=>an,showConfirm:()=>ln});var sn=(e,t)=>{let{store:r,render:s}=t;r.closeDialog(),s()},nn=(e,t)=>{let{store:r,render:s,globalUI:i}=t;r.closeDialog(),s(),i.emit("event",!0)},on=(e,t)=>{let{store:r,render:s,globalUI:i}=t;r.closeDialog(),s(),i.emit("event",!1)},an=(e,t)=>{let{store:r,render:s}=t;if(r.selectIsOpen())throw new Error("A dialog is already open");r.setAlertConfig(e),s()},ln=async(e,t)=>{let{store:r,render:s,globalUI:i}=t;if(r.selectIsOpen())throw new Error("A dialog is already open");return r.setConfirmConfig(e),s(),new Promise(n=>{i.once("event",o=>{n(o)})})};var wt={};R(wt,{INITIAL_STATE:()=>pn,closeDialog:()=>hn,selectConfig:()=>dn,selectIsOpen:()=>fn,setAlertConfig:()=>cn,setConfirmConfig:()=>un,toViewData:()=>yn});var pn=Object.freeze({isOpen:!1,config:{status:void 0,title:"",message:"",confirmText:"OK",cancelText:"Cancel",mode:"alert"}}),cn=(e,t)=>{if(!t.message)throw new Error("message is required for showAlert");e.config={status:t.status||void 0,title:t.title||"",message:t.message,confirmText:t.confirmText||"OK",cancelText:"",mode:"alert"},e.isOpen=!0},un=(e,t)=>{if(!t.message)throw new Error("message is required for showConfirm");e.config={status:t.status||void 0,title:t.title||"",message:t.message,confirmText:t.confirmText||"Yes",cancelText:t.cancelText||"Cancel",mode:"confirm"},e.isOpen=!0},hn=e=>{e.isOpen=!1},dn=({state:e})=>e.config,fn=({state:e})=>e.isOpen,yn=({state:e})=>({isOpen:e.isOpen,config:e.config});var Dr={elementName:"rtgl-global-ui",viewDataSchema:{type:"object",properties:{isOpen:{type:"boolean"},config:{type:"object",properties:{status:{type:"string"},title:{type:"string"},message:{type:"string"},confirmText:{type:"string"},cancelText:{type:"string"},mode:{type:"string"}}}}},refs:{dialog:{eventListeners:{close:{handler:"handleDialogClose"}}},"confirm-button":{eventListeners:{click:{handler:"handleConfirm"}}},"cancel-button":{eventListeners:{click:{handler:"handleCancel"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-dialog#dialog ?open=${isOpen} s=sm",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view slot=content g=lg p=lg",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h ah=c g=md",value:{type:9,items:[{type:8,properties:[{key:"$if config.status == 'error'",value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"config.status"},right:{type:0,value:"error"}},{type:4,op:0,left:{type:1,path:"config.status"},right:{type:0,value:"warning"}},{type:4,op:0,left:{type:1,path:"config.status"},right:{type:0,value:"info"}},{type:1,path:"config.status"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-icon name=x-circle c=error s=lg",value:{type:0,value:null}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-icon name=alert-triangle c=warning s=lg",value:{type:0,value:null}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-icon name=info c=primary s=lg",value:{type:0,value:null}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-icon name=check-circle c=success s=lg",value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if config.title",value:{type:6,conditions:[{type:1,path:"config.title"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text fs=lg fw=600",value:{type:1,path:"config.title"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1},{type:8,properties:[{key:"rtgl-view p=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"config.message"}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-view d=h jc=fe g=md mt=lg",value:{type:9,items:[{type:8,properties:[{key:"$if config.mode == 'confirm'",value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"config.mode"},right:{type:0,value:"confirm"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-button#cancel-button variant=se",value:{type:1,path:"config.cancelText"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-button#confirm-button variant=pr",value:{type:1,path:"config.confirmText"}}],fast:!0}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-dialog#dialog ?open=",{type:1,path:"isOpen"}," s=sm"]}}],fast:!1}],fast:!1}};var xt={};R(xt,{handleClickStart:()=>mn});var mn=(e,t)=>{let{dispatchEvent:r,store:s}=t;console.log("handle click start",s.selectPath()),r(new CustomEvent("clickStart",{detail:{path:s.selectPath()}}))};var _t={};R(_t,{INITIAL_STATE:()=>gn,selectPath:()=>xn,setState:()=>_n,toViewData:()=>wn});var gn=Object.freeze({}),vn=["id","class","style","slot"],bn=e=>Object.entries(e).filter(([t])=>!vn.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),wn=({state:e,props:t,attrs:r})=>{console.log("attrs",{attrs:r,entries:Object.entries(r)});let s=r.start?JSON.parse(decodeURIComponent(r.start)):t.start;return{containerAttrString:bn(r),start:s||{label:"",image:{src:"",width:32,height:32,alt:""}}}},xn=({props:e})=>e.start.path,_n=e=>{};var Br={elementName:"rtgl-navbar",viewDataSchema:{type:"object",properties:{containerAttrString:{type:"string"},start:{type:"object",properties:{label:{type:"string"},href:{type:"string"},image:{type:"object",properties:{src:{type:"string"}}},hasImage:{type:"boolean"},hasHref:{type:"boolean"}}}}},propsSchema:{type:"object",properties:{start:{type:"object",properties:{label:{type:"string"},href:{type:"string"},image:{type:"object",properties:{src:{type:"string"}}}}}}},refs:{start:{eventListeners:{click:{handler:"handleClickStart"}}}},events:{clickStart:{type:"object",properties:{path:{type:"string"}}}},anchors:[[{"rtgl-text s=lg":"${start.label}"},{"$if start.image && start.image.src":[{"rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}":null}]}]],template:{type:9,items:[{type:8,properties:[{key:"rtgl-view bgc=bg d=h h=48 av=c w=f ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"$if start.href",value:{type:6,conditions:[{type:1,path:"start.href"},{type:1,path:"start.path"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"a href=${start.href}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c g=lg g=md",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"start.label"}}],fast:!0},{type:8,properties:[{key:"$if start.image && start.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"start.image"},right:{type:1,path:"start.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"start.image.width"}," h=",{type:1,path:"start.image.height"}," src=",{type:1,path:"start.image.src"}," alt=",{type:1,path:"start.image.alt"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["a href=",{type:1,path:"start.href"}]}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view#start d=h av=c g=lg g=md cur=p",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"start.label"}}],fast:!0},{type:8,properties:[{key:"$if start.image && start.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"start.image"},right:{type:1,path:"start.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"start.image.width"}," h=",{type:1,path:"start.image.height"}," src=",{type:1,path:"start.image.src"}," alt=",{type:1,path:"start.image.alt"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c g=lg g=md",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"start.label"}}],fast:!0},{type:8,properties:[{key:"$if start.image && start.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"start.image"},right:{type:1,path:"start.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"start.image.width"}," h=",{type:1,path:"start.image.height"}," src=",{type:1,path:"start.image.src"}," alt=",{type:1,path:"start.image.alt"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-view flex=1",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:"rtgl-view d=h av=c g=lg",value:{type:9,items:[{type:8,properties:[{key:"slot name=right",value:{type:0,value:null}}],fast:!0}],fast:!0}}],fast:!0}],fast:!1},parsedKey:{type:2,parts:["rtgl-view bgc=bg d=h h=48 av=c w=f ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var Et={};R(Et,{handleBeforeMount:()=>An});var Wr=(e,t,r)=>{let{store:s,render:i}=r,n,o=-1/0;if(e.forEach(a=>{let l=a.getBoundingClientRect();l.top<=t&&l.top>o&&(o=l.top,n=a.id)}),!n){let a=1/0;e.forEach(l=>{let p=l.getBoundingClientRect();p.top>t&&p.top<a&&(a=p.top,n=l.id)})}n&&n!==s.selectCurrentId()&&(s.setCurrentId(n),i())},En=(e,t,r,s)=>{let{store:i,render:n}=s,o=e.querySelectorAll("h1[id], h2[id], h3[id], h4[id], rtgl-text[id]"),a=Array.from(o),l=a.map(c=>{let u=1,d=c.tagName.toLowerCase();return d==="h1"?u=1:d==="h2"?u=2:d==="h3"?u=3:d==="h4"?u=4:d==="rtgl-text"&&(u=parseInt(c.getAttribute("data-level")||"1",10)),{id:c.id,href:`#${c.id}`,title:c.textContent,level:u}});i.setItems(l),Wr(a,r,s),n();let p=Wr.bind(void 0,a,r,s);return t.addEventListener("scroll",p,{passive:!0}),()=>{t.removeEventListener("scroll",p)}},An=e=>{let{attrs:t}=e;requestAnimationFrame(()=>{let r=document.getElementById(t["target-id"]),s=window;t["scroll-container-id"]&&(s=document.getElementById(t["scroll-container-id"])||window);let i=parseInt(t["offset-top"]||"100",10),n=En(r,s,i,e);return()=>{n()}})};var At={};R(At,{INITIAL_STATE:()=>kn,selectCurrentId:()=>Cn,selectState:()=>$n,setContentContainer:()=>Tn,setCurrentId:()=>On,setItems:()=>In,toViewData:()=>Sn});var kn=Object.freeze({items:[],currentId:null,contentContainer:null}),Sn=({state:e})=>{let r=((s,i)=>{let n=new Set,o=s.findIndex(l=>l.id===i);if(o===-1)return n;let a=s[o].level;for(let l=o-1;l>=0;l--)if(s[l].level<a){let p=s[l].level;n.add(s[l].id);for(let c=l-1;c>=0;c--)s[c].level<p&&(n.add(s[c].id),p=s[c].level);break}return n})(e.items,e.currentId);return{items:e.items.map(s=>{let i={1:"0",2:"12px",3:"24px",4:"32px"},n=s.id===e.currentId,o=r.has(s.id),a=n||o;return{...s,c:a?"fg":"mu-fg",ml:i[s.level]||"",bc:a?"fg":"mu-fg"}}),currentId:e.currentId}},$n=({state:e})=>e,Cn=({state:e})=>e.currentId,In=(e,t)=>{e.items=t},On=(e,t)=>{e.currentId=t},Tn=(e,t)=>{e.contentContainer=t};var Mr={elementName:"rtgl-page-outline",viewDataSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{slug:{type:"string"},title:{type:"string"}}}},selectedSlug:{type:"string",nullable:!0}}},propsSchema:{type:"object",properties:{}},refs:{},events:{onItemClick:{type:"object"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view h=f w=272 pr=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f mt=xl",value:{type:9,items:[{type:7,itemVar:"item",indexVar:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:'rtgl-view d=h bwl=xs bc="${item.bc}" pv=sm av=c href=${item.href} pl=md',value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=${item.ml}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-view w=",{type:1,path:"item.ml"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-text s=sm c=${item.c} h-c=fg",value:{type:1,path:"item.title"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.c"}," h-c=fg"]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:['rtgl-view d=h bwl=xs bc="',{type:1,path:"item.bc"},'" pv=sm av=c href=',{type:1,path:"item.href"}," pl=md"]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}};var kt={};R(kt,{handleBeforeMount:()=>Ln,handleInputChange:()=>Pn,handleInputKeydown:()=>Dn,handleOnUpdate:()=>Nn,handlePopoverClose:()=>Rn,handleSubmitClick:()=>jn,handleTextClick:()=>Vn});var Ln=e=>{let{store:t,props:r}=e;(r.value!==void 0||r.defaultValue!==void 0)&&t.setValue(r.value||r.defaultValue||"")},Nn=(e,t)=>{let{oldProps:r,newProps:s}=e,{store:i,props:n,render:o}=t;r.defaultValue!==s.defaultValue&&i.setValue(n.defaultValue||""),o()},Vn=(e,t)=>{let{store:r,render:s,getRefIds:i,attrs:n}=t,o=r.selectValue();r.setTempValue(o),r.openPopover({position:{x:e.currentTarget.getBoundingClientRect().left,y:e.currentTarget.getBoundingClientRect().bottom}});let{input:a}=i();a.elm.value=o,s(),n["auto-focus"]&&setTimeout(()=>{a.elm.focus()},50)},Rn=(e,t)=>{let{store:r,render:s}=t;r.closePopover(),s()},Pn=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=t,n=e.detail.value;r.setTempValue(n),i(new CustomEvent("temp-input-change",{detail:{value:n},bubbles:!0})),s()},jn=(e,t)=>{let{store:r,render:s,dispatchEvent:i,getRefIds:n}=t,{input:o}=n(),a=o.elm.value;r.setValue(a),r.closePopover(),i(new CustomEvent("input-change",{detail:{value:a},bubbles:!0})),s()},Dn=(e,t)=>{let{store:r,render:s,dispatchEvent:i,getRefIds:n}=t;if(e.key==="Enter"){let{input:o}=n(),a=o.elm.value;r.closePopover(),i(new CustomEvent("input-change",{detail:{value:a},bubbles:!0})),s()}else e.key==="Escape"&&(r.closePopover(),s())};var St={};R(St,{INITIAL_STATE:()=>Bn,closePopover:()=>Kn,openPopover:()=>Fn,selectValue:()=>zn,setTempValue:()=>Mn,setValue:()=>Un,toViewData:()=>Wn});var Bn=Object.freeze({isOpen:!1,position:{x:0,y:0},value:"",tempValue:""}),Wn=({attrs:e,state:t,props:r})=>{let s=t.value||"-";return{isOpen:t.isOpen,position:t.position,value:s??"-",tempValue:t.tempValue,placeholder:r.placeholder??"",label:e.label}},Mn=(e,t)=>{e.tempValue=t},Fn=(e,t)=>{let{position:r}=t;e.position=r,e.isOpen=!0,e.hasUnsavedChanges=!1},Kn=e=>{e.isOpen=!1,e.tempValue=""},Un=(e,t)=>{e.value=t},zn=({state:e})=>e.value;var Fr={elementName:"rtgl-popover-input",viewDataSchema:{type:"object"},attrsSchema:{type:"object",properties:{"auto-focus":{type:"boolean"}}},propsSchema:{type:"object",properties:{value:{type:"string"},defaultValue:{type:"string"},placeholder:{type:"string"},onChange:{type:"function"}}},refs:{"text-display":{eventListeners:{click:{handler:"handleTextClick"}}},popover:{eventListeners:{close:{handler:"handlePopoverClose"}}},input:{eventListeners:{"input-change":{handler:"handleInputChange"},keydown:{handler:"handleInputKeydown"}}},submit:{eventListeners:{click:{handler:"handleSubmitClick"}}}},events:{"input-change":{}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view#text-display w=f cur=p",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"value"}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-popover#popover ?open=${isOpen} x=${position.x} y=${position.y}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=md w=240 slot=content bgc=background br=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"label"}}],fast:!0},{type:8,properties:[{key:"rtgl-input#input w=f placeholder=${placeholder}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#input w=f placeholder=",{type:1,path:"placeholder"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=f ah=e",value:{type:9,items:[{type:8,properties:[{key:"rtgl-button#submit",value:{type:0,value:"Submit"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-popover#popover ?open=",{type:1,path:"isOpen"}," x=",{type:1,path:"position.x"}," y=",{type:1,path:"position.y"}]}}],fast:!0}],fast:!0}};var $t={};R($t,{handleAddOptionClick:()=>eo,handleAddOptionMouseEnter:()=>to,handleAddOptionMouseLeave:()=>ro,handleBeforeMount:()=>Hn,handleButtonClick:()=>qn,handleClearClick:()=>Zn,handleClickOptionsPopoverOverlay:()=>Gn,handleOnUpdate:()=>Jn,handleOptionClick:()=>Yn,handleOptionMouseEnter:()=>Xn,handleOptionMouseLeave:()=>Qn});var Hn=e=>{let{store:t,props:r,render:s}=e;if(r.selectedValue!==null&&r.selectedValue!==void 0&&r.options){let i=r.options.find(n=>ae(n.value,r.selectedValue));i&&(t.updateSelectOption(i),s())}},Jn=(e,t)=>{let{oldAttrs:r,newAttrs:s,oldProps:i,newProps:n}=e,{store:o,props:a,render:l}=t;if(r?.key!==s?.key&&s?.key){o.resetSelection();let p=n?.selectedValue||a?.selectedValue,c=n?.options||a?.options;if(p!=null&&c){let u=c.find(d=>ae(d.value,p));u&&o.updateSelectOption(u)}l()}},qn=(e,t)=>{let{store:r,render:s,getRefIds:i,props:n}=t,o=i()["select-button"].elm,a=o.firstElementChild,l=a?a.getBoundingClientRect():o.getBoundingClientRect(),p=r.selectSelectedValue(),c=p!==null?p:n.selectedValue,u=null;c!=null&&n.options&&(u=n.options.findIndex(d=>ae(d.value,c)),u===-1&&(u=null)),r.openOptionsPopover({position:{y:l.bottom+12,x:l.left-24},selectedIndex:u}),s()},Gn=(e,t)=>{let{store:r,render:s}=t;r.closeOptionsPopover(),s()},Yn=(e,t)=>{let{render:r,dispatchEvent:s,props:i,store:n}=t,o=e.currentTarget.id.replace("option-",""),a=i.options[o];n.updateSelectOption(a),i.onChange&&typeof i.onChange=="function"&&i.onChange(a.value),s(new CustomEvent("option-selected",{detail:{value:a.value,label:a.label},bubbles:!0})),s(new CustomEvent("select-change",{detail:{selectedValue:a.value},bubbles:!0})),r()},Xn=(e,t)=>{let{store:r,render:s}=t,i=parseInt(e.currentTarget.id.replace("option-",""));r.setHoveredOption(i),s()},Qn=(e,t)=>{let{store:r,render:s}=t;r.clearHoveredOption(),s()},Zn=(e,t)=>{let{store:r,render:s,dispatchEvent:i,props:n}=t;e.stopPropagation(),r.clearSelectedValue(),n.onChange&&typeof n.onChange=="function"&&n.onChange(void 0),i(new CustomEvent("option-selected",{detail:{value:void 0,label:void 0},bubbles:!0})),i(new CustomEvent("select-change",{detail:{selectedValue:void 0},bubbles:!0})),s()},eo=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=t;r.closeOptionsPopover(),i(new CustomEvent("add-option-selected",{bubbles:!0})),s()},to=(e,t)=>{let{store:r,render:s}=t;r.setHoveredAddOption(!0),s()},ro=(e,t)=>{let{store:r,render:s}=t;r.setHoveredAddOption(!1),s()};var Ct={};R(Ct,{INITIAL_STATE:()=>no,clearHoveredOption:()=>yo,clearSelectedValue:()=>mo,closeOptionsPopover:()=>co,openOptionsPopover:()=>po,resetSelection:()=>ho,selectSelectedValue:()=>lo,selectState:()=>ao,setHoveredAddOption:()=>go,setHoveredOption:()=>fo,toViewData:()=>oo,updateSelectOption:()=>uo});var so=["id","class","style","slot","placeholder","selectedValue","selected-value","onChange","on-change","options"],io=e=>Object.entries(e||{}).filter(([t])=>!so.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),no=Object.freeze({isOpen:!1,position:{x:0,y:0},selectedValue:null,hoveredOptionId:null,hoveredAddOption:!1}),oo=({state:e,props:t,attrs:r})=>{let s=io(r),i=e.selectedValue!==null?e.selectedValue:t.selectedValue,n=t.placeholder||"Select an option",o=!0;if(i!=null&&t.options){let l=t.options.find(p=>ae(p.value,i));l&&(n=l.label,o=!1)}let a=(t.options||[]).map((l,p)=>{let c=ae(l.value,i),u=e.hoveredOptionId===p;return{...l,isSelected:c,bgc:u?"ac":c?"mu":""}});return{containerAttrString:s,isOpen:e.isOpen,position:e.position,options:a,selectedValue:i,selectedLabel:n,selectedLabelColor:o?"mu-fg":"fg",placeholder:t.placeholder||"Select an option",hasValue:i!=null,showClear:!r["no-clear"]&&!t["no-clear"]&&i!=null,showAddOption:!!t.addOption,addOptionLabel:t.addOption?.label?`+ ${t.addOption.label}`:"+ Add",addOptionBgc:e.hoveredAddOption?"ac":""}},ao=({state:e})=>e,lo=({state:e})=>e.selectedValue,po=(e,t)=>{let{position:r,selectedIndex:s}=t;e.position=r,e.isOpen=!0,s!=null&&(e.hoveredOptionId=s)},co=e=>{e.isOpen=!1},uo=(e,t)=>{e.selectedValue=t.value,e.isOpen=!1},ho=e=>{e.selectedValue=void 0},fo=(e,t)=>{e.hoveredOptionId=t},yo=e=>{e.hoveredOptionId=null},mo=e=>{e.selectedValue=void 0},go=(e,t)=>{e.hoveredAddOption=t};var Kr={elementName:"rtgl-select",viewDataSchema:{type:"object"},propsSchema:{type:"object",properties:{options:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"any"}}}},selectedValue:{type:"any"},placeholder:{type:"string"},onChange:{type:"function"},"no-clear":{type:"boolean"},addOption:{type:"object",properties:{label:{type:"string"}}}}},refs:{"select-button":{eventListeners:{click:{handler:"handleButtonClick"}}},"clear-button":{eventListeners:{click:{handler:"handleClearClick"}}},popover:{eventListeners:{close:{handler:"handleClickOptionsPopoverOverlay"}}},"option-*":{eventListeners:{click:{handler:"handleOptionClick"},mouseenter:{handler:"handleOptionMouseEnter"},mouseleave:{handler:"handleOptionMouseLeave"}}},"option-add":{eventListeners:{click:{handler:"handleAddOptionClick"},mouseenter:{handler:"handleAddOptionMouseEnter"},mouseleave:{handler:"handleAddOptionMouseLeave"}}}},events:{},template:{type:9,items:[{type:8,properties:[{key:"rtgl-button#select-button v=ol ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c w=f",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${selectedLabelColor}",value:{type:1,path:"selectedLabel"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"selectedLabelColor"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-view mh=md flex=1",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:"$if showClear",value:{type:6,conditions:[{type:1,path:"showClear"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-svg#clear-button mr=md svg=x wh=16 c=mu-fg cur=p",value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-svg svg=chevronDown wh=16 c=mu-fg",value:{type:0,value:null}}],fast:!0}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-button#select-button v=ol ",{type:1,path:"containerAttrString"}]}}],fast:!1},{type:8,properties:[{key:"rtgl-popover#popover ?open=${isOpen} x=${position.x} y=${position.y} placement=right-start",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view wh=300 g=xs slot=content bgc=background br=md sv=true",value:{type:9,items:[{type:7,itemVar:"option",indexVar:"i",iterable:{type:1,path:"options"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view#option-${i} w=f ph=lg pv=md cur=p br=md bgc=${option.bgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"option.label"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#option-",{type:1,path:"i"}," w=f ph=lg pv=md cur=p br=md bgc=",{type:1,path:"option.bgc"}]}}],fast:!0}],fast:!0}},{type:8,properties:[{key:"$if showAddOption",value:{type:6,conditions:[{type:1,path:"showAddOption"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f bw=xs bc=mu-bg bt=sm",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:"rtgl-view#option-add w=f ph=lg pv=md cur=p br=md bgc=${addOptionBgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=ac",value:{type:1,path:"addOptionLabel"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#option-add w=f ph=lg pv=md cur=p br=md bgc=",{type:1,path:"addOptionBgc"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-popover#popover ?open=",{type:1,path:"isOpen"}," x=",{type:1,path:"position.x"}," y=",{type:1,path:"position.y"}," placement=right-start"]}}],fast:!1}],fast:!1}};var It={};R(It,{handleHeaderClick:()=>vo,handleItemClick:()=>bo});var vo=(e,t)=>{let{store:r,dispatchEvent:s}=t,i,n=r.selectHeader();e.currentTarget.id==="header-label"?i=n.labelPath:e.currentTarget.id==="header-image"?i=n.image.path:e.currentTarget.id==="header"&&(i=n.path),s(new CustomEvent("headerClick",{detail:{path:i},bubbles:!0,composed:!0}))},bo=(e,t)=>{let{store:r,dispatchEvent:s}=t,i=e.currentTarget.id.replace("item-",""),n=r.selectItem(i);s(new CustomEvent("itemClick",{detail:{item:n},bubbles:!0,composed:!0}))};var Tt={};R(Tt,{INITIAL_STATE:()=>wo,selectActiveItem:()=>ko,selectHeader:()=>Ao,selectItem:()=>So,setState:()=>$o,toViewData:()=>Eo});var wo=Object.freeze({}),xo=["id","class","style","slot"],_o=e=>Object.entries(e).filter(([t])=>!xo.includes(t)).map(([t,r])=>`${t}=${r}`).join(" ");function Ot(e,t=null){let r=[];for(let s of e){let i=s.id||s.href||s.path,n=t===i;if(r.push({id:i,title:s.title,href:s.href,type:s.type||"item",icon:s.icon,hrefAttr:s.href?`href=${s.href}`:"",isSelected:n,itemBgc:n?"ac":"bg",itemHoverBgc:n?"ac":"mu"}),s.items&&Array.isArray(s.items))for(let o of s.items){let a=o.id||o.href||o.path,l=t===a;r.push({id:a,title:o.title,href:o.href,type:o.type||"item",icon:o.icon,hrefAttr:o.href?`href=${o.href}`:"",isSelected:l,itemBgc:l?"ac":"bg",itemHoverBgc:l?"ac":"mu"})}}return r}var Eo=({state:e,props:t,attrs:r})=>{let s=r.header?JSON.parse(decodeURIComponent(r.header)):t.header,i=r.items?JSON.parse(decodeURIComponent(r.items)):t.items,n=r.selectedItemId||t.selectedItemId,o=_o(r),a=r.mode||"full",l=s||{label:"",path:"",image:{src:"",alt:"",width:0,height:0}},p=i?Ot(i,n):[],c=a==="full"?272:64,u=a==="full"?"fs":"c",d=a==="full"?"fs":"c",y=a==="full"?"lg":"sm",h=a==="full"?"md":"sm",f=a==="shrunk-lg"?48:40,m=a==="shrunk-lg"?28:20,v=a==="shrunk-lg"?"md":"sm",b=a==="full",x=a==="full",_=a==="full"?"fs":"c",A=a==="full"?"":`ah=${d}`,k=a==="full"?"f":f;return{containerAttrString:o,mode:a,header:l,items:p,sidebarWidth:c,headerAlign:u,itemAlign:d,headerPadding:y,itemPadding:h,itemHeight:f,iconSize:m,firstLetterSize:v,showLabels:b,showGroupLabels:x,itemContentAlign:_,itemAlignAttr:A,itemWidth:k,headerWidth:k,selectedItemId:n,ah:a==="shrunk-lg"||a==="shrunk-md"?"c":""}},Ao=({state:e,props:t,attrs:r})=>r.header?JSON.parse(decodeURIComponent(r.header)):t.header,ko=({state:e,props:t})=>(t.items?Ot(t.items):[]).find(s=>s.active),So=({state:e,props:t,attrs:r},s)=>{let i=r.items?JSON.parse(decodeURIComponent(r.items)):t.items;return(i?Ot(i):[]).find(o=>o.id===s)},$o=e=>{};var Ur={elementName:"rtgl-sidebar",viewDataSchema:{type:"object",properties:{containerAttrString:{type:"string"},mode:{type:"string",enum:["full","shrunk","shrunk-lg"],default:"full"},sidebarWidth:{type:"number"},headerAlign:{type:"string"},itemAlign:{type:"string"},headerPadding:{type:"string"},itemPadding:{type:"string"},itemHeight:{type:"number"},iconSize:{type:"number"},firstLetterSize:{type:"string"},showLabels:{type:"boolean"},showGroupLabels:{type:"boolean"},itemContentAlign:{type:"string"},itemAlignAttr:{type:"string"},itemWidth:{type:"string"},headerWidth:{type:"string"},selectedItemId:{type:"string"},header:{type:"object",properties:{label:{type:"string"},href:{type:"string"},image:{type:"object",properties:{src:{type:"string"},width:{type:"number"},height:{type:"number"},alt:{type:"string"}}}}},items:{type:"array",items:{type:"object",properties:{title:{type:"string"},slug:{type:"string"},type:{type:"string"},active:{type:"boolean"},icon:{type:"string"}}}}}},propsSchema:{type:"object",properties:{selectedItemId:{type:"string"},header:{type:"object",properties:{label:{type:"string"},href:{type:"string"},image:{type:"object",properties:{src:{type:"string"},width:{type:"number"},height:{type:"number"},alt:{type:"string"}}}}},items:{type:"array",items:{type:"object",properties:{title:{type:"string"},slug:{type:"string"},type:{type:"string"},items:{type:"array"}}}}}},refs:{"header-image":{eventListeners:{click:{handler:"handleHeaderClick"}}},"header-label":{eventListeners:{click:{handler:"handleHeaderClick"}}},header:{eventListeners:{click:{handler:"handleHeaderClick"}}},"item-*":{eventListeners:{click:{handler:"handleItemClick"}}}},events:{headerClick:{type:"object",properties:{path:{type:"string"}}}},anchors:[[{"$if header.image && header.image.src":[{"$if header.image.href":[{"a href=${header.image.href}":[{'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"':null}]}],"$elif header.image.path":[{"rtgl-view#header-image cur=p":[{'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"':null}]}],$else:[{'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"':null}]}]},{"$if header.label && showLabels":[{"$if header.labelHref":[{"rtgl-text href=${header.labelHref} s=lg":"${header.label}"}],"$elif header.labelPath":[{"rtgl-view#header-label cur=p":[{"rtgl-text s=lg":"${header.label}"}]}],$else:[{"rtgl-text s=lg":"${header.label}"}]}]}]],template:{type:9,items:[{type:8,properties:[{key:"rtgl-view h=f w=${sidebarWidth} bwr=xs ah=${ah} ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view ph=${headerPadding} pv=lg",value:{type:9,items:[{type:8,properties:[{key:"$if header.href",value:{type:6,conditions:[{type:1,path:"header.href"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view href=${header.href} d=h av=c ah=${headerAlign} g=lg w=${headerWidth}",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"$if header.image && header.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"header.image"},right:{type:1,path:"header.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"$if header.image.href",value:{type:6,conditions:[{type:1,path:"header.image.href"},{type:1,path:"header.image.path"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"a href=${header.image.href}",value:{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a href=",{type:1,path:"header.image.href"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#header-image cur=p",value:{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"$if header.label && showLabels",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"header.label"},right:{type:1,path:"showLabels"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"$if header.labelHref",value:{type:6,conditions:[{type:1,path:"header.labelHref"},{type:1,path:"header.labelPath"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text href=${header.labelHref} s=lg",value:{type:1,path:"header.label"},parsedKey:{type:2,parts:["rtgl-text href=",{type:1,path:"header.labelHref"}," s=lg"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#header-label cur=p",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"header.label"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"header.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view href=",{type:1,path:"header.href"}," d=h av=c ah=",{type:1,path:"headerAlign"}," g=lg w=",{type:1,path:"headerWidth"}]}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view#header d=h av=c ah=${headerAlign} g=lg w=${headerWidth} cur=p",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"$if header.image && header.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"header.image"},right:{type:1,path:"header.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"$if header.image.href",value:{type:6,conditions:[{type:1,path:"header.image.href"},{type:1,path:"header.image.path"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"a href=${header.image.href}",value:{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a href=",{type:1,path:"header.image.href"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#header-image cur=p",value:{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"$if header.label && showLabels",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"header.label"},right:{type:1,path:"showLabels"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"$if header.labelHref",value:{type:6,conditions:[{type:1,path:"header.labelHref"},{type:1,path:"header.labelPath"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text href=${header.labelHref} s=lg",value:{type:1,path:"header.label"},parsedKey:{type:2,parts:["rtgl-text href=",{type:1,path:"header.labelHref"}," s=lg"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#header-label cur=p",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"header.label"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"header.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view#header d=h av=c ah=",{type:1,path:"headerAlign"}," g=lg w=",{type:1,path:"headerWidth"}," cur=p"]}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view ph=",{type:1,path:"headerPadding"}," pv=lg"]}}],fast:!1},{type:8,properties:[{key:"rtgl-view w=f ph=${headerPadding} pb=lg g=xs ah=${ah}",value:{type:9,items:[{type:7,itemVar:"item",indexVar:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:'$if item.type == "groupLabel"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"item.type"},right:{type:0,value:"groupLabel"}},null],bodies:[{type:9,items:[{type:8,properties:[{key:"$if showGroupLabels",value:{type:6,conditions:[{type:1,path:"showGroupLabels"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view mt=md h=32 av=c ph=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=xs c=mu-fg",value:{type:1,path:"item.title"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view mt=md h=1 bgc=mu-bg",value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view#item-${item.id} ${item.hrefAttr} h=${itemHeight} av=c ${itemAlignAttr} ph=${itemPadding} w=${itemWidth} h-bgc=${item.itemHoverBgc} br=lg bgc=${item.itemBgc} cur=p",value:{type:9,items:[{type:8,properties:[{key:"$if item.icon",value:{type:6,conditions:[{type:1,path:"item.icon"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"$if showLabels",value:{type:6,conditions:[{type:1,path:"showLabels"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h ah=${itemContentAlign} g=sm",value:{type:9,items:[{type:8,properties:[{key:"rtgl-svg wh=16 svg=${item.icon} c=fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg wh=16 svg=",{type:1,path:"item.icon"}," c=fg"]}}],fast:!0},{type:8,properties:[{key:"rtgl-text s=sm",value:{type:1,path:"item.title"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view d=h ah=",{type:1,path:"itemContentAlign"}," g=sm"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-svg wh=${iconSize} svg=${item.icon} c=fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg wh=",{type:1,path:"iconSize"}," svg=",{type:1,path:"item.icon"}," c=fg"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"$if showLabels",value:{type:6,conditions:[{type:1,path:"showLabels"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm",value:{type:1,path:"item.title"}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view wh=${iconSize} br=f bgc=mu av=c ah=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=${firstLetterSize} c=fg",value:{type:1,path:"item.title.charAt(0).toUpperCase()"},parsedKey:{type:2,parts:["rtgl-text s=",{type:1,path:"firstLetterSize"}," c=fg"]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view wh=",{type:1,path:"iconSize"}," br=f bgc=mu av=c ah=c"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view#item-",{type:1,path:"item.id"}," ",{type:1,path:"item.hrefAttr"}," h=",{type:1,path:"itemHeight"}," av=c ",{type:1,path:"itemAlignAttr"}," ph=",{type:1,path:"itemPadding"}," w=",{type:1,path:"itemWidth"}," h-bgc=",{type:1,path:"item.itemHoverBgc"}," br=lg bgc=",{type:1,path:"item.itemBgc"}," cur=p"]}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view w=f ph=",{type:1,path:"headerPadding"}," pb=lg g=xs ah=",{type:1,path:"ah"}]}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view h=f w=",{type:1,path:"sidebarWidth"}," bwr=xs ah=",{type:1,path:"ah"}," ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var Lt={};R(Lt,{handleBeforeMount:()=>Co,handleOnUpdate:()=>Io,handleValueChange:()=>Oo});var Co=e=>{let{store:t,attrs:r}=e;t.setValue(r.defaultValue||0)},Io=(e,t)=>{let{oldAttrs:r,newAttrs:s}=e,{store:i,render:n,attrs:o}=t;if(r?.key!==s?.key&&s?.key){let a=s?.defaultValue||o?.defaultValue||0;i.setValue(a),n()}else if(r?.defaultValue!==s?.defaultValue){let a=s?.defaultValue||0;i.setValue(a),n()}},Oo=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=t,n=Number(e.detail.value);r.setValue(n),s(),i(new CustomEvent("slider-input-value-change",{detail:{value:n},bubbles:!0}))};var Nt={};R(Nt,{INITIAL_STATE:()=>To,setValue:()=>No,toViewData:()=>Lo});var To=Object.freeze({value:0}),Lo=({state:e,attrs:t})=>({key:t.key,value:e.value,w:t.w||"",min:t.min||0,max:t.max||100,step:t.step||1}),No=(e,t)=>{e.value=t};var zr={elementName:"rtgl-slider-input",viewDataSchema:{type:"object"},attrsSchema:{type:"object",properties:{defaultValue:{type:"string",default:"0"},w:{type:"string",default:""},min:{type:"string",default:"0"},max:{type:"string",default:"100"},step:{type:"string",default:"1"}}},refs:{input:{eventListeners:{"input-change":{handler:"handleValueChange"}}},slider:{eventListeners:{"slider-change":{handler:"handleValueChange"}}}},events:{"form-change":{}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c g=md w=${w}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-slider#slider key=${key} w=f type=range min=${min} max=${max} step=${step} value=${value}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider#slider key=",{type:1,path:"key"}," w=f type=range min=",{type:1,path:"min"}," max=",{type:1,path:"max"}," step=",{type:1,path:"step"}," value=",{type:1,path:"value"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=84",value:{type:9,items:[{type:8,properties:[{key:"rtgl-input#input key=${key} w=f type=number min=${min} max=${max} step=${step} value=${value}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#input key=",{type:1,path:"key"}," w=f type=number min=",{type:1,path:"min"}," max=",{type:1,path:"max"}," step=",{type:1,path:"step"}," value=",{type:1,path:"value"}]}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view d=h av=c g=md w=",{type:1,path:"w"}]}}],fast:!0}],fast:!0}};var Vt={};R(Vt,{handleBeforeMount:()=>Vo,handleHeaderClick:()=>Po,handleRowClick:()=>Ro});var Vo=e=>{},Ro=(e,t)=>{let{dispatchEvent:r,props:s}=t,i=parseInt(e.currentTarget.id.replace("row-","")),n=s.data?.rows?.[i];n&&r(new CustomEvent("row-click",{detail:{rowIndex:i,rowData:n}}))},Po=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=t,n=e.currentTarget.id.replace("header-",""),o=r.selectSortInfo(),a="asc";o.column===n&&(o.direction==="asc"?a="desc":o.direction==="desc"&&(a=null)),a?r.setSortColumn({column:n,direction:a}):r.clearSort(),s(),i(new CustomEvent("header-click",{detail:{column:n,direction:a,sortInfo:a?{column:n,direction:a}:null}}))};var Rt={};R(Rt,{INITIAL_STATE:()=>jo,clearSort:()=>zo,selectSortInfo:()=>Ko,selectState:()=>Fo,setSortColumn:()=>Uo,toViewData:()=>Mo});var jo=Object.freeze({sortColumn:null,sortDirection:null}),Do=["id","class","style","slot"],Bo=e=>Object.entries(e).filter(([t])=>!Do.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Wo=(e,t)=>{let r=t.split("."),s=e;for(let i of r){if(s==null)return null;s=s[i]}return s},Mo=({state:e,props:t,attrs:r})=>{let s=Bo(r),i=t.data||{columns:[],rows:[]},n=i.rows.map((o,a)=>{let l=i.columns.map(p=>{let c=Wo(o,p.key);return{key:p.key,value:c!=null?String(c):""}});return{index:a,cells:l}});return{containerAttrString:s,columns:i.columns||[],rows:n||[]}},Fo=({state:e})=>e,Ko=({state:e})=>({column:e.sortColumn,direction:e.sortDirection}),Uo=(e,{column:t,direction:r})=>{e.sortColumn=t,e.sortDirection=r},zo=e=>{e.sortColumn=null,e.sortDirection=null};var Hr={elementName:"rtgl-table",viewDataSchema:{type:"object",properties:{columns:{type:"array"},rows:{type:"array"},containerAttrString:{type:"string"}}},propsSchema:{type:"object",properties:{data:{type:"object",properties:{columns:{type:"array",items:{type:"object",properties:{key:{type:"string"},label:{type:"string"}}}},rows:{type:"array",items:{type:"object"}}}},responsive:{type:"boolean",default:!0}}},refs:{"row-*":{eventListeners:{click:{handler:"handleRowClick"}}},"header-*":{eventListeners:{click:{handler:"handleHeaderClick"}}}},events:{},styles:{table:{width:"100%","border-collapse":"collapse","border-spacing":0},thead:{"border-bottom":"2px solid var(--border)"},th:{padding:"12px","text-align":"left","font-weight":500,color:"var(--foreground)","background-color":"var(--muted)",cursor:"pointer",position:"sticky",top:0,"z-index":1},"tbody tr":{"border-bottom":"1px solid var(--border)"},"tbody tr:last-child":{"border-bottom":"none"},td:{padding:"12px",color:"var(--foreground)"},".table-container":{width:"100%",height:"100%",overflow:"auto"},".empty-state":{"text-align":"center",padding:"24px",color:"var(--muted-foreground)"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view.table-container ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"$if rows.length > 0",value:{type:6,conditions:[{type:4,op:2,left:{type:1,path:"rows.length"},right:{type:0,value:0}},null],bodies:[{type:9,items:[{type:8,properties:[{key:"table",value:{type:9,items:[{type:8,properties:[{key:"thead",value:{type:9,items:[{type:8,properties:[{key:"tr",value:{type:9,items:[{type:7,itemVar:"column",indexVar:"i",iterable:{type:1,path:"columns"},body:{type:9,items:[{type:8,properties:[{key:"th#header-${column.key}",value:{type:1,path:"column.label"},parsedKey:{type:2,parts:["th#header-",{type:1,path:"column.key"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1},{type:8,properties:[{key:"tbody",value:{type:9,items:[{type:7,itemVar:"row",indexVar:"rowIndex",iterable:{type:1,path:"rows"},body:{type:9,items:[{type:8,properties:[{key:"tr#row-${row.index}",value:{type:9,items:[{type:7,itemVar:"cell",indexVar:"cellIndex",iterable:{type:1,path:"row.cells"},body:{type:9,items:[{type:8,properties:[{key:"td",value:{type:1,path:"cell.value"}}],fast:!0}],fast:!0}}],fast:!1},parsedKey:{type:2,parts:["tr#row-",{type:1,path:"row.index"}]}}],fast:!1}],fast:!1}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view.empty-state w=f p=xl",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:0,value:"No data available"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view.table-container ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var Pt={};R(Pt,{handleClickItem:()=>Ho});var Ho=(e,t)=>{let{dispatchEvent:r}=t,s=e.currentTarget.dataset.id;r(new CustomEvent("item-click",{detail:{id:s}}))};var jt={};R(jt,{INITIAL_STATE:()=>Jo,toViewData:()=>Yo});var Jo=Object.freeze({}),qo=["id","class","style","slot"],Go=e=>Object.entries(e).filter(([t])=>!qo.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Yo=({state:e,props:t,attrs:r})=>{let s=Go(r),i=t.items||[],n=r["selected-tab"],o=i.map(a=>({...a,isSelected:a.id===n,bgColor:a.id===n?"ac":"",borderColor:a.id===n?"":"tr",textColor:a.id===n?"":"mu-fg"}));return{containerAttrString:s,items:o,selectedTab:n}};var Jr={elementName:"rtgl-tabs",viewDataSchema:{type:"object",properties:{containerAttrString:{type:"string"},items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"},isSelected:{type:"boolean"},bgColor:{type:"string"},textColor:{type:"string"},borderColor:{type:"string"}}}},selectedTab:{type:"string"}}},propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"}}}}}},attrsSchema:{type:"object",properties:{"selected-tab":{type:"string"}}},refs:{"tab-*":{eventListeners:{click:{handler:"handleClickItem"}}}},events:{"item-click":{type:"object",properties:{id:{type:"string"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h g=sm bgc=mu p=sm br=lg ${containerAttrString}",value:{type:9,items:[{type:7,itemVar:"item",indexVar:null,iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view#tab-${item.id} data-id=${item.id} cur=p bgc=${item.bgColor} bw=xs bc=${item.borderColor} pv=md ph=lg br=lg",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=${item.textColor}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.textColor"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#tab-",{type:1,path:"item.id"}," data-id=",{type:1,path:"item.id"}," cur=p bgc=",{type:1,path:"item.bgColor"}," bw=xs bc=",{type:1,path:"item.borderColor"}," pv=md ph=lg br=lg"]}}],fast:!0}],fast:!0}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view d=h g=sm bgc=mu p=sm br=lg ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var qr={};var Dt={};R(Dt,{INITIAL_STATE:()=>Xo,toViewData:()=>Qo});var Xo=Object.freeze({}),Qo=({attrs:e})=>({open:!!e.open,x:e.x||0,y:e.y||0,placement:e.placement||"top",content:e.content||""});var Gr={elementName:"rtgl-tooltip",viewDataSchema:{type:"object"},attrsSchema:{type:"object",properties:{open:{type:"string"},x:{type:"string"},y:{type:"string"},placement:{type:"string"},content:{type:"string"}}},refs:{popover:null},template:{type:9,items:[{type:8,properties:[{key:"rtgl-popover#popover ?open=${open} x=${x} y=${y} placement=${placement} no-overlay",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view slot=content bgc=background bc=border br=md p=sm ah=c av=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text ta=c s=sm c=foreground",value:{type:1,path:"content"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-popover#popover ?open=",{type:1,path:"open"}," x=",{type:1,path:"x"}," y=",{type:1,path:"y"}," placement=",{type:1,path:"placement"}," no-overlay"]}}],fast:!0}],fast:!0}};var Bt={};R(Bt,{handleAfterMount:()=>Zo,handleOnUpdate:()=>ea});var Zo=async e=>{let{props:t,store:r,render:s,getRefIds:i}=e,{waveformData:n}=t;r.setWaveformData(n),s();let o=i().canvas?.elm;o&&Yr(n,o)},ea=async(e,t)=>{let{store:r,render:s,getRefIds:i,props:n}=t,{waveformData:o}=n;if(!o){console.log("waveform handleOnUpdate: no waveformData provided");return}r.setWaveformData(o),s();let a=i().canvas?.elm;a&&Yr(o,a)};async function Yr(e,t){let r=t.getContext("2d"),s=t.getBoundingClientRect(),i=s.width,n=s.height;t.width=i,t.height=n;let o=t.width,a=t.height;if(r.clearRect(0,0,o,a),r.fillStyle="#1a1a1a",r.fillRect(0,0,o,a),!e||!e.amplitudes)return;let l=e.amplitudes,p=a/2,c=r.createLinearGradient(0,0,0,a);c.addColorStop(0,"#404040"),c.addColorStop(.5,"#A1A1A1"),c.addColorStop(1,"#404040");let u=Math.max(1,o/l.length),d=.2;for(let y=0;y<l.length;y++){let f=l[y]*(a*.85),m=y*u,v=p-f/2;r.fillStyle=c,r.fillRect(m,v,Math.max(1,u*(1-d)),f)}r.strokeStyle="rgba(255, 255, 255, 0.1)",r.lineWidth=1,r.beginPath(),r.moveTo(0,p),r.lineTo(o,p),r.stroke(),r.shadowBlur=10,r.shadowColor="#2196F3"}var Wt={};R(Wt,{INITIAL_STATE:()=>ta,setWaveformData:()=>ra,toViewData:()=>sa});var ta=Object.freeze({waveformData:null}),ra=(e,t)=>{e.waveformData=t},sa=({state:e,attrs:t,props:r})=>({isLoading:r.isLoading,w:t.w||"250",h:t.h||"150",cur:t.cur,waveformData:r.waveformData});var Xr={elementName:"rtgl-waveform",attrsSchema:{type:"object",properties:{w:{type:"string",description:"Width of the waveform visualizer",default:"250"},h:{type:"string",description:"Height of the waveform visualizer",default:"150"},cur:{type:"string",description:"cursor"}}},propsSchema:{type:"object",properties:{waveformData:{type:"object",description:"File ID of the waveform data in object storage"},isLoading:{type:"boolean",description:"Whether the waveform data is currently being loaded"}}},refs:{canvas:{selector:"canvas"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=f pos=rel w=${w} h=${h} cur=${cur}",value:{type:9,items:[{type:8,properties:[{key:"$if isLoading",value:{type:6,conditions:[{type:1,path:"isLoading"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=f av=c ah=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:0,value:"..."}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:'canvas#canvas style="width:100%; height:100%;"',value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view w=f h=f pos=rel w=",{type:1,path:"w"}," h=",{type:1,path:"h"}," cur=",{type:1,path:"cur"}]}}],fast:!1}],fast:!1}};var ss=Symbol.for("immer-nothing"),Qr=Symbol.for("immer-draftable"),Y=Symbol.for("immer-state");function te(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ve=Object.getPrototypeOf;function be(e){return!!e&&!!e[Y]}function ce(e){return e?is(e)||Array.isArray(e)||!!e[Qr]||!!e.constructor?.[Qr]||Be(e)||We(e):!1}var ia=Object.prototype.constructor.toString();function is(e){if(!e||typeof e!="object")return!1;let t=ve(e);if(t===null)return!0;let r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===ia}function Re(e,t){De(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,s)=>t(s,r,e))}function De(e){let t=e[Y];return t?t.type_:Array.isArray(e)?1:Be(e)?2:We(e)?3:0}function Kt(e,t){return De(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ns(e,t,r){let s=De(e);s===2?e.set(t,r):s===3?e.add(r):e[t]=r}function na(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Be(e){return e instanceof Map}function We(e){return e instanceof Set}function pe(e){return e.copy_||e.base_}function Ut(e,t){if(Be(e))return new Map(e);if(We(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=is(e);if(t===!0||t==="class_only"&&!r){let s=Object.getOwnPropertyDescriptors(e);delete s[Y];let i=Reflect.ownKeys(s);for(let n=0;n<i.length;n++){let o=i[n],a=s[o];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(s[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(ve(e),s)}else{let s=ve(e);if(s!==null&&r)return{...e};let i=Object.create(s);return Object.assign(i,e)}}function Gt(e,t=!1){return Me(e)||be(e)||!ce(e)||(De(e)>1&&(e.set=e.add=e.clear=e.delete=oa),Object.freeze(e),t&&Object.entries(e).forEach(([r,s])=>Gt(s,!0))),e}function oa(){te(2)}function Me(e){return Object.isFrozen(e)}var aa={};function ue(e){let t=aa[e];return t||te(0,e),t}var $e;function os(){return $e}function la(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Zr(e,t){t&&(ue("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function zt(e){Ht(e),e.drafts_.forEach(pa),e.drafts_=null}function Ht(e){e===$e&&($e=e.parent_)}function es(e){return $e=la($e,e)}function pa(e){let t=e[Y];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function ts(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return e!==void 0&&e!==r?(r[Y].modified_&&(zt(t),te(4)),ce(e)&&(e=Pe(t,e),t.parent_||je(t,e)),t.patches_&&ue("Patches").generateReplacementPatches_(r[Y].base_,e,t.patches_,t.inversePatches_)):e=Pe(t,r,[]),zt(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ss?e:void 0}function Pe(e,t,r){if(Me(t))return t;let s=t[Y];if(!s)return Re(t,(i,n)=>rs(e,s,t,i,n,r)),t;if(s.scope_!==e)return t;if(!s.modified_)return je(e,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;let i=s.copy_,n=i,o=!1;s.type_===3&&(n=new Set(i),i.clear(),o=!0),Re(n,(a,l)=>rs(e,s,i,a,l,r,o)),je(e,i,!1),r&&e.patches_&&ue("Patches").generatePatches_(s,r,e.patches_,e.inversePatches_)}return s.copy_}function rs(e,t,r,s,i,n,o){if(be(i)){let a=n&&t&&t.type_!==3&&!Kt(t.assigned_,s)?n.concat(s):void 0,l=Pe(e,i,a);if(ns(r,s,l),be(l))e.canAutoFreeze_=!1;else return}else o&&r.add(i);if(ce(i)&&!Me(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Pe(e,i),(!t||!t.scope_.parent_)&&typeof s!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,s)&&je(e,i)}}function je(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Gt(t,r)}function ca(e,t){let r=Array.isArray(e),s={type_:r?1:0,scope_:t?t.scope_:os(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=s,n=Yt;r&&(i=[s],n=Ce);let{revoke:o,proxy:a}=Proxy.revocable(i,n);return s.draft_=a,s.revoke_=o,a}var Yt={get(e,t){if(t===Y)return e;let r=pe(e);if(!Kt(r,t))return ua(e,r,t);let s=r[t];return e.finalized_||!ce(s)?s:s===Mt(e.base_,t)?(Ft(e),e.copy_[t]=qt(s,e)):s},has(e,t){return t in pe(e)},ownKeys(e){return Reflect.ownKeys(pe(e))},set(e,t,r){let s=as(pe(e),t);if(s?.set)return s.set.call(e.draft_,r),!0;if(!e.modified_){let i=Mt(pe(e),t),n=i?.[Y];if(n&&n.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(na(r,i)&&(r!==void 0||Kt(e.base_,t)))return!0;Ft(e),Jt(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Mt(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ft(e),Jt(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=pe(e),s=Reflect.getOwnPropertyDescriptor(r,t);return s&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:s.enumerable,value:r[t]}},defineProperty(){te(11)},getPrototypeOf(e){return ve(e.base_)},setPrototypeOf(){te(12)}},Ce={};Re(Yt,(e,t)=>{Ce[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Ce.deleteProperty=function(e,t){return Ce.set.call(this,e,t,void 0)};Ce.set=function(e,t,r){return Yt.set.call(this,e[0],t,r,e[0])};function Mt(e,t){let r=e[Y];return(r?pe(r):e)[t]}function ua(e,t,r){let s=as(t,r);return s?"value"in s?s.value:s.get?.call(e.draft_):void 0}function as(e,t){if(!(t in e))return;let r=ve(e);for(;r;){let s=Object.getOwnPropertyDescriptor(r,t);if(s)return s;r=ve(r)}}function Jt(e){e.modified_||(e.modified_=!0,e.parent_&&Jt(e.parent_))}function Ft(e){e.copy_||(e.copy_=Ut(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var ha=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,s)=>{if(typeof t=="function"&&typeof r!="function"){let n=r;r=t;let o=this;return function(l=n,...p){return o.produce(l,c=>r.call(this,c,...p))}}typeof r!="function"&&te(6),s!==void 0&&typeof s!="function"&&te(7);let i;if(ce(t)){let n=es(this),o=qt(t,void 0),a=!0;try{i=r(o),a=!1}finally{a?zt(n):Ht(n)}return Zr(n,s),ts(i,n)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===ss&&(i=void 0),this.autoFreeze_&&Gt(i,!0),s){let n=[],o=[];ue("Patches").generateReplacementPatches_(t,i,n,o),s(n,o)}return i}else te(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(o,...a)=>this.produceWithPatches(o,l=>t(l,...a));let s,i;return[this.produce(t,r,(o,a)=>{s=o,i=a}),s,i]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ce(e)||te(8),be(e)&&(e=da(e));let t=es(this),r=qt(e,void 0);return r[Y].isManual_=!0,Ht(t),r}finishDraft(e,t){let r=e&&e[Y];(!r||!r.isManual_)&&te(9);let{scope_:s}=r;return Zr(s,t),ts(void 0,s)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));let s=ue("Patches").applyPatches_;return be(e)?s(e,t):this.produce(e,i=>s(i,t))}};function qt(e,t){let r=Be(e)?ue("MapSet").proxyMap_(e,t):We(e)?ue("MapSet").proxySet_(e,t):ca(e,t);return(t?t.scope_:os()).drafts_.push(r),r}function da(e){return be(e)||te(10,e),ls(e)}function ls(e){if(!ce(e)||Me(e))return e;let t=e[Y],r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Ut(e,t.scope_.immer_.useStrictShallowCopy_)}else r=Ut(e,!0);return Re(r,(s,i)=>{ns(r,s,ls(i))}),t&&(t.finalized_=!1),r}var X=new ha,ps=X.produce,$c=X.produceWithPatches.bind(X),Cc=X.setAutoFreeze.bind(X),Ic=X.setUseStrictShallowCopy.bind(X),Oc=X.applyPatches.bind(X),Tc=X.createDraft.bind(X),Lc=X.finishDraft.bind(X);var w={LITERAL:0,VARIABLE:1,INTERPOLATION:2,FUNCTION:3,BINARY:4,UNARY:5,CONDITIONAL:6,LOOP:7,OBJECT:8,ARRAY:9,PARTIAL:10,PATH_REFERENCE:11},J={EQ:0,NEQ:1,GT:2,LT:3,GTE:4,LTE:5,AND:6,OR:7,IN:8,ADD:10,SUBTRACT:11},Fe={NOT:0};var q=class extends Error{constructor(t){super(`Render Error: ${t}`),this.name="JemplRenderError"}};var cs=(e,t,r=!1)=>{if(t===null)return new q(`Cannot iterate over null value at '$for ${e}'`);if(t===void 0)return new q(`Cannot iterate over undefined value at '$for ${e}'`);let s=typeof t;return r?new q(`Cannot iterate over non-array value in loop '${e}' - got ${s} instead`):new q(`Cannot iterate over non-array value (got: ${s}) at '$for ${e}'`)},us=(e,t)=>{let r=t&&Object.keys(t).length>0?Object.keys(t).join(", "):"no custom functions provided";return new q(`Unknown function '${e}' (${r})`)};var fa=(e,t,r={})=>{let s={},i={};r&&typeof r=="object"&&(r.functions!==void 0||r.partials!==void 0?(s=r.functions||{},i=r.partials||{}):typeof r=="object"&&(s=r));let o=I(e,{functions:s,partials:i},t,{});return o===void 0?{}:o},I=(e,t,r,s)=>{let i=t.functions||t;if(e.var&&!e.type)return K(e.var,r,s);if(e.type===w.LITERAL)return e.value;if(e.type===w.VARIABLE)return K(e.path,r,s);if(e.type===w.INTERPOLATION)return ma(e.parts,t,r,s);switch(e.type){case w.FUNCTION:return ds(e,t,r,s);case w.BINARY:return fs(e,t,r,s);case w.UNARY:return ys(e,t,r,s);case w.CONDITIONAL:return va(e,t,r,s);case w.LOOP:return Ea(e,t,r,s);case w.OBJECT:return ka(e,t,r,s);case w.ARRAY:return Sa(e,t,r,s);case w.PARTIAL:return $a(e,t,r,s);case w.PATH_REFERENCE:return Ca(e,t,r,s);default:throw new Error(`Unknown node type: ${e.type}`)}},hs=new Map,ya=e=>{let t=[],r="",s=!1;for(let i=0;i<e.length;i++){let n=e[i];if(n==="[")r&&(t.push({type:"property",value:r}),r=""),s=!0;else if(n==="]"){if(s&&r){let o=r.trim();if(/^\d+$/.test(o))t.push({type:"index",value:parseInt(o,10)});else if(o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'")){let a=o.slice(1,-1);t.push({type:"property",value:a})}else t.push({type:"property",value:o});r=""}s=!1}else r+=n}return r&&t.push({type:"property",value:r}),t},K=(e,t,r)=>{if(!e)return;if(e in r)return r[e];let s=hs.get(e);if(!s){let n=[],o="",a=0;for(let l=0;l<e.length;l++){let p=e[l];p==="["?(a++,o+=p):p==="]"?(a--,o+=p):p==="."&&a===0?o&&(n.push(o),o=""):o+=p}o&&n.push(o),s=[];for(let l of n){let p=ya(l.trim());s.push(...p)}hs.set(e,s)}let i=t;for(let n=0;n<s.length;n++){let o=s[n];if(o.type==="property"&&o.value in r){i=r[o.value];continue}if(i==null)return;(o.type==="property"||o.type==="index")&&(i=i[o.value])}return i},ma=(e,t,r,s)=>{let i=[];for(let n of e)if(typeof n=="string")i.push(n);else{let o=I(n,t,r,s);i.push(o!=null?String(o):"")}return i.join("")},ds=(e,t,r,s)=>{let i=t.functions||t,n=i[e.name];if(!n)throw us(e.name,i);let o=e.args.map(a=>I(a,t,r,s));return n(...o)},we=(e,t,r,s)=>{if(e.var&&!e.type)return K(e.var,r,s);switch(e.type){case w.VARIABLE:return K(e.path,r,s);case w.LITERAL:return e.value;case w.BINARY:return fs(e,t,r,s);case w.UNARY:return ys(e,t,r,s);case w.FUNCTION:return ds(e,t,r,s);default:return I(e,t,r,s)}},fs=(e,t,r,s)=>{if(e.op===J.AND||e.op===J.OR){let o=we(e.left,t,r,s),a=we(e.right,t,r,s);switch(e.op){case J.AND:return o&&a;case J.OR:return o||a}}let i=I(e.left,t,r,s),n=I(e.right,t,r,s);switch(e.op){case J.EQ:return i==n;case J.NEQ:return i!=n;case J.GT:return i>n;case J.LT:return i<n;case J.GTE:return i>=n;case J.LTE:return i<=n;case J.IN:return Array.isArray(n)?n.includes(i):!1;case J.ADD:if(typeof i!="number"||typeof n!="number")throw new q(`Arithmetic operations require numbers. Got ${typeof i} + ${typeof n}`);return i+n;case J.SUBTRACT:if(typeof i!="number"||typeof n!="number")throw new q(`Arithmetic operations require numbers. Got ${typeof i} - ${typeof n}`);return i-n;default:throw new Error(`Unknown binary operator: ${e.op}`)}},ys=(e,t,r,s)=>{let i=e.op===Fe.NOT?we(e.operand,t,r,s):I(e.operand,t,r,s);switch(e.op){case Fe.NOT:return!i;default:throw new Error(`Unknown unary operator: ${e.op}`)}},ga=(e,t,r,s)=>{if(e.conditions.length===2&&e.conditions[1]===null){let i=e.conditions[0];if(i.type===w.VARIABLE)if(K(i.path,r,s)){let o=e.bodies[0];if(o.type===w.OBJECT&&o.properties.length<=5){let a={};for(let l of o.properties){let p=l.parsedKey?I(l.parsedKey,t,r,s):l.key,c=l.value;if(c.type===w.LITERAL)a[p]=c.value;else if(c.type===w.VARIABLE)a[p]=K(c.path,r,s);else if(c.type===w.INTERPOLATION){let u=[];for(let d of c.parts)if(typeof d=="string")u.push(d);else if(d.type===w.VARIABLE){let y=K(d.path,r,s);u.push(y!=null?String(y):"")}else{let y=I(d,t,r,s);u.push(y!=null?String(y):"")}a[p]=u.join("")}else a[p]=I(c,t,r,s)}return a}}else{let o=e.bodies[1];if(o.type===w.OBJECT&&o.properties.length<=5){let a={};for(let l of o.properties){let p=l.parsedKey?I(l.parsedKey,t,r,s):l.key,c=l.value;if(c.type===w.LITERAL)a[p]=c.value;else if(c.type===w.VARIABLE)a[p]=K(c.path,r,s);else if(c.type===w.INTERPOLATION){let u=[];for(let d of c.parts)if(typeof d=="string")u.push(d);else if(d.type===w.VARIABLE){let y=K(d.path,r,s);u.push(y!=null?String(y):"")}else{let y=I(d,t,r,s);u.push(y!=null?String(y):"")}a[p]=u.join("")}else a[p]=I(c,t,r,s)}return a}}}return null},va=(e,t,r,s)=>{let i=ga(e,t,r,s);if(i!==null)return i;for(let n=0;n<e.conditions.length;n++){let o=e.conditions[n];if(o===null||we(o,t,r,s))return I(e.bodies[n],t,r,s)}return ms},ba=(e,t)=>{let r=e.body,s=e.itemVar;if(r.type===w.CONDITIONAL&&r.conditions.length===1&&r.conditions[0].type===w.VARIABLE){let i=r.conditions[0].path,n=r.bodies[0];if(i.startsWith(s+".")){let o=i.substring(s.length+1);if(n.type===w.OBJECT&&n.properties.length<=5){for(let l of n.properties)if(l.parsedKey)return null;let a=[];for(let l=0;l<t.length;l++){let p=t[l];if(p[o]){let c={};for(let u of n.properties){let d=u.key,y=u.value;if(y.type===w.LITERAL)c[d]=y.value;else if(y.type===w.VARIABLE){let h=y.path;if(h===s)c[d]=p;else if(h.startsWith(s+".")){let f=h.substring(s.length+1);c[d]=p[f]}else return null}else if(y.type===w.INTERPOLATION){let h=[],f=!0;for(let m of y.parts)if(typeof m=="string")h.push(m);else if(m.type===w.VARIABLE){let v=m.path;if(v===s)h.push(p!=null?String(p):"");else if(v.startsWith(s+".")){let b=v.substring(s.length+1),x=p[b];h.push(x!=null?String(x):"")}else{f=!1;break}}else{f=!1;break}if(!f)return null;c[d]=h.join("")}else return null}a.push(c)}}return a}}}return null},wa=(e,t)=>{let r=e.body,s=e.itemVar,i=ba(e,t);if(i!==null)return i;if(r.type===w.OBJECT&&r.properties.length<=5){for(let a of r.properties)if(a.parsedKey)return null;let n=[],o=!0;for(let a of r.properties){let l=a.key,p=a.value;if(p.type===w.LITERAL)n.push({key:l,type:"literal",value:p.value});else if(p.type===w.VARIABLE){let c=p.path;if(c===s)n.push({key:l,type:"item"});else if(c.startsWith(s+".")){let u=c.substring(s.length+1);if(!u.includes(".")&&!u.includes("["))n.push({key:l,type:"prop",prop:u});else{o=!1;break}}else{o=!1;break}}else if(p.type===w.INTERPOLATION&&p.parts.length===1){let c=p.parts[0];if(c.type===w.VARIABLE){let u=c.path;if(u===s)n.push({key:l,type:"item_string"});else if(u.startsWith(s+".")){let d=u.substring(s.length+1);if(!d.includes(".")&&!d.includes("["))n.push({key:l,type:"prop_string",prop:d});else{o=!1;break}}else{o=!1;break}}else{o=!1;break}}else{o=!1;break}}if(o){let a=new Array(t.length);if(n.length===3&&n[0].type==="prop"&&n[0].key==="id"&&n[1].type==="prop_string"&&n[1].key==="title"&&n[2].type==="prop"&&n[2].key==="completed")for(let l=0;l<t.length;l++){let p=t[l];a[l]={id:p.id,title:p.title!=null?String(p.title):"",completed:p.completed}}else for(let l=0;l<t.length;l++){let p=t[l],c={};for(let u of n)if(u.type==="literal")c[u.key]=u.value;else if(u.type==="item")c[u.key]=p;else if(u.type==="prop")c[u.key]=p[u.prop];else if(u.type==="item_string")c[u.key]=p!=null?String(p):"";else if(u.type==="prop_string"){let d=p[u.prop];c[u.key]=d!=null?String(d):""}a[l]=c}return a}}return null},xa=(e,t,r,s,i)=>{let n=[],o=e.body;if(o.type===w.OBJECT&&o.fast!==!1){let a=e.itemVar,l=e.indexVar;for(let p=0;p<i.length;p++){let c=i[p],u={},d={...s,[a]:c,...l&&{[l]:p}};d.__paths__||(d.__paths__=s.__paths__||{});let y=e.iterable.path||"";if(s&&s.__paths__&&y){let h=y.split("."),f=h[0];f in s.__paths__&&(y=s.__paths__[f],h.length>1&&(y+="."+h.slice(1).join(".")))}d.__paths__={...d.__paths__,[a]:`${y}[${p}]`,...l&&{[l]:p}};for(let h of o.properties){let f=h.parsedKey?I(h.parsedKey,t,r,d):h.key,m=h.value;if(m.type===w.LITERAL)u[f]=m.value;else if(m.type===w.VARIABLE){let v=m.path;if(v===a)u[f]=c;else if(v===l)u[f]=p;else if(v.startsWith(a+".")){let b=v.substring(a.length+1);!b.includes(".")&&!b.includes("[")?u[f]=c[b]:u[f]=K(v,r,{...s,[a]:c,...l&&{[l]:p}})}else u[f]=K(v,r,{...s,[a]:c,...l&&{[l]:p}})}else if(m.type===w.INTERPOLATION){let v=[];for(let b of m.parts)if(typeof b=="string")v.push(b);else if(b.type===w.VARIABLE){let x=b.path,_;if(x===a)_=c;else if(x===l)_=p;else if(x.startsWith(a+".")){let A=x.substring(a.length+1);!A.includes(".")&&!A.includes("[")?_=c[A]:_=K(x,r,{...s,[a]:c,...l&&{[l]:p}})}else _=K(x,r,{...s,[a]:c,...l&&{[l]:p}});v.push(_!=null?String(_):"")}else{let x={...s,[a]:c,...l&&{[l]:p}},_=I(b,t,r,x);v.push(_!=null?String(_):"")}u[f]=v.join("")}else{let v={...s,[a]:c,...l&&{[l]:p}};u[f]=I(m,t,r,v)}}n.push(u)}return n}return null},_a=(e,t,r)=>{let s=e.body;if(s.type===w.OBJECT&&s.properties.length===1&&s.properties[0].key==="$if item.visible"){let n=s.properties[0].value;if(n.type===w.CONDITIONAL&&n.conditions.length===1&&n.conditions[0].type===w.VARIABLE&&n.conditions[0].path==="item.visible"){let o=n.bodies[0];if(o.type===w.OBJECT&&o.properties.length===2){let a=o.properties[0],l=o.properties[1];if(a.key==="id"&&a.value.type===w.VARIABLE&&a.value.path==="item.id"&&l.key==="$if item.highlighted"&&l.value.type===w.CONDITIONAL){let p=[];for(let c=0;c<t.length;c++){let u=t[c];if(u.visible){let d={id:u.id};u.highlighted?(d.highlight=!0,d.message=`This item is highlighted: ${u.name}`):(d.highlight=!1,d.message=u.name),p.push(d)}}return p}}}}return null},Ea=(e,t,r,s)=>{let i=I(e.iterable,t,r,s);if(!Array.isArray(i)){let p,c=!1;if(e.iterable.type===w.FUNCTION){c=!0;let d=e.iterable.args.map(y=>y.type===w.LITERAL?typeof y.value=="string"?`'${y.value}'`:String(y.value):y.type===w.VARIABLE?y.path:y.type===w.FUNCTION?`${y.name}(...)`:"?").join(", ");p=`${e.iterable.name}(${d})`}else p=e.iterable.path||"undefined";let u=`${e.itemVar}${e.indexVar?`, ${e.indexVar}`:""} in ${p}`;throw cs(u,i,c)}if(!e.indexVar){let p=_a(e,i,e.itemVar);if(p!==null)return p}if(!e.indexVar){let p=wa(e,i);if(p!==null)return p}let n=xa(e,t,r,s,i);if(n!==null)return n;let o=[],a=e.iterable.path||"";if(s&&s.__paths__&&a){let p=a.split("."),c=p[0];c in s.__paths__&&(a=s.__paths__[c],p.length>1&&(a+="."+p.slice(1).join(".")))}let l=!1;e.body.type===w.ARRAY&&(e.body.items.length<=1?l=!1:l=e.body._shouldPreserveArray??=e.body.items.some(p=>p.type===w.OBJECT&&p.properties.some(c=>c.key.startsWith("$if ")||c.key.startsWith("$when "))));for(let p=0;p<i.length;p++){let c=e.indexVar?{...s,[e.itemVar]:i[p],[e.indexVar]:p}:{...s,[e.itemVar]:i[p]};c.__paths__||(c.__paths__=s.__paths__||{}),c.__paths__={...c.__paths__,[e.itemVar]:`${a}[${p}]`},e.indexVar&&(c.__paths__[e.indexVar]=p);let u=I(e.body,t,r,c);Array.isArray(u)&&u.length===1&&!l?o.push(u[0]):o.push(u)}return o},Aa=(e,t,r,s)=>{if(e.whenCondition)return null;if(e.properties.length===1){let i=e.properties[0],n=i.parsedKey?I(i.parsedKey,t,r,s):i.key,o=i.value;if(o.type===w.OBJECT&&o.properties.length<=10&&!o.whenCondition){let a={},l={},p=!0;for(let c of o.properties){let u=c.parsedKey?I(c.parsedKey,t,r,s):c.key,d=c.value;if(d.type===w.LITERAL)l[u]=d.value;else if(d.type===w.VARIABLE)l[u]=K(d.path,r,s);else if(d.type===w.INTERPOLATION){let y=[];for(let h of d.parts)if(typeof h=="string")y.push(h);else if(h.type===w.VARIABLE){let f=K(h.path,r,s);y.push(f!=null?String(f):"")}else{p=!1;break}if(!p)break;l[u]=y.join("")}else if(d.type===w.OBJECT&&d.properties.length<=5){let y={};for(let h of d.properties){let f=h.key,m=h.value;if(m.type===w.LITERAL)y[f]=m.value;else if(m.type===w.VARIABLE)y[f]=K(m.path,r,s);else if(m.type===w.INTERPOLATION){let v=[];for(let b of m.parts)if(typeof b=="string")v.push(b);else if(b.type===w.VARIABLE){let x=K(b.path,r,s);v.push(x!=null?String(x):"")}else{p=!1;break}if(!p)break;y[f]=v.join("")}else{p=!1;break}}if(!p)break;l[u]=y}else{p=!1;break}}if(p)return a[n]=l,a}}return null},ka=(e,t,r,s)=>{let i=t.functions||t;if(e.whenCondition&&!we(e.whenCondition,i,r,s))return;let n=Aa(e,t,r,s);if(n!==null)return n;if(e.fast){let p={};for(let c of e.properties){let u=c.parsedKey?I(c.parsedKey,t,r,s):c.key,d=c.value;if(d.type===w.LITERAL)p[u]=d.value;else if(d.type===w.VARIABLE)p[u]=K(d.path,r,s);else if(d.type===w.INTERPOLATION){let y=[];for(let h of d.parts)if(typeof h=="string")y.push(h);else if(h.type===w.VARIABLE){let f=K(h.path,r,s);y.push(f!=null?String(f):"")}else{let f=I(h,t,r,s);y.push(f!=null?String(f):"")}p[u]=y.join("")}else p[u]=I(d,t,r,s)}return p}let o={},a=null,l=!1;for(let p of e.properties)if(!p.key.startsWith("$if ")&&!p.key.match(/^\$if\s+\w+.*:?$/)&&!p.key.startsWith("$elif")&&!p.key.startsWith("$else")&&!p.key.startsWith("$for ")){l=!0;break}for(let p of e.properties)if(p.key.startsWith("$if ")||p.key.match(/^\$if\s+\w+.*:?$/)){let c=I(p.value,t,r,s);if(!l&&c!==null&&c!==void 0)return Array.isArray(c)&&c.length===1?c[0]:c;typeof c=="object"&&c!==null&&!Array.isArray(c)&&Object.assign(o,c)}else if(p.key.startsWith("$for ")){if(e.properties.length===1)return I(p.value,t,r,s)}else{let c=p.value;if(c&&c.type===w.OBJECT&&c.properties){let u=c.properties.find(d=>d.key.startsWith("$for "));if(u){let d=I(u.value,t,r,s);d!==void 0&&(o[p.key]=d)}else{let d=I(p.value,t,r,s);d!==void 0&&(o[p.key]=d)}}else{let u=p.parsedKey?I(p.parsedKey,t,r,s):p.key,d=I(p.value,t,r,s);d!==void 0&&(o[u]=d)}}return o},ms={},Sa=(e,t,r,s)=>{let i=[];for(let n of e.items)if(n.type===w.LOOP){let o=I(n,t,r,s);i.push(o)}else{let o=I(n,t,r,s);o!==ms&&o!==void 0&&i.push(o)}return i},$a=(e,t,r,s)=>{let{name:i,data:n,whenCondition:o}=e,a=t.partials||{},l=t.functions||t;if(o&&!we(o,l,r,s))return;if(!a[i])throw new q(`Partial '${i}' is not defined`);let p=s._partialStack||[];if(p.includes(i))throw new q(`Circular partial reference detected: ${i}`);let c=a[i],u=r,d={...s,_partialStack:[...p,i]};if(s){u={...r};for(let y of Object.keys(s))y.startsWith("_")||(u[y]=s[y])}if(n){let y=I(n,t,r,s);u={...u,...y}}return I(c,t,u,d)},Ca=(e,t,r,s)=>{let{path:i}=e,n=i.split("."),o=n[0],a=n.slice(1);if(!s||!(o in s))throw new q(`Path reference '#{${i}}' refers to '${o}' which is not a loop variable in the current scope`);if(s.__paths__||(s.__paths__={}),!(o in s.__paths__))throw new q(`Path reference '#{${i}}' cannot be resolved - path tracking may not be initialized properly`);let l=s.__paths__[o];if(typeof l=="number"){if(a.length>0)throw new q(`Path reference '#{${i}}' - cannot access properties on index variable '${o}'`);return String(l)}return a.length>0&&(l+="."+a.join(".")),l},Ke=fa;var Ue=e=>Array.isArray(e)?e.reduce((t,r)=>{if(Array.isArray(r))t.push(...Ue(r));else{if(r&&typeof r=="object"){let s=Object.entries(r);if(s.length>0){let[i,n]=s[0];Array.isArray(n)&&(r={[i]:Ue(n)})}}t.push(r)}return t},[]):e;var gs=(e,t)=>{if(!t)return e;let r=[],s="",i=!1,n=null;for(let o=0;o<t.length;o++){let a=t[o];if(!i&&a===".")s&&(r.push(s),s="");else if(!i&&a==="[")s&&(r.push(s),s=""),i=!0;else if(i&&a==="]"){if(s){if(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))r.push(s.slice(1,-1));else{let l=Number(s);r.push(isNaN(l)?s:l)}s=""}i=!1,n=null}else i&&(a==='"'||a==="'")&&(n?a===n&&(n=null):n=a),s+=a}return s&&r.push(s),r.reduce((o,a)=>o&&o[a],e)},vs=({h:e,template:t,viewData:r,refs:s,handlers:i})=>{let n=Ke(t,r,{}),o=Ue(n),a=La({h:e,items:o,refs:s,handlers:i,viewData:r});return e("div",{style:{display:"contents"}},a)},La=({h:e,items:t,refs:r={},handlers:s={},viewData:i={}})=>{if(!Array.isArray(t))return console.error("Input to createVirtualDom must be an array."),[e("div",{},[])];function n(o,a=""){return o.map((l,p)=>{if(typeof l=="string"||typeof l=="number")return String(l);if(typeof l!="object"||l===null)return console.warn("Skipping invalid item in DOM structure:",l),null;let c=Object.entries(l);if(c.length===0)return null;let[u,d]=c[0];if(!isNaN(Number(u)))return Array.isArray(d)?n(d,`${a}.${u}`):typeof d=="object"&&d!==null&&Object.entries(d).length>0?n([d],`${a}.${u}`):String(d);c.length>1&&console.warn("Item has multiple keys, processing only the first:",u);let y,h,f=u.indexOf(" ");f===-1?(y=u,h=""):(y=u.substring(0,f),h=u.substring(f+1).trim());let m=y.split(/[.#]/)[0],v=m.includes("-"),b={},x={};if(h){let $=/(\S+?)=(?:\"([^\"]*)\"|\'([^\']*)\'|([^\s]+))/g,E,P=new Set;for(;(E=$.exec(h))!==null;)if(P.add(E[1]),E[1].startsWith(".")){let Q=E[1].substring(1),Ee=E[4];x[Q]=gs(i,Ee)}else if(E[1].startsWith("?")){let Q=E[1].substring(1),Ee=E[2]||E[3]||E[4],Oe;Ee==="true"?Oe=!0:Ee==="false"?Oe=!1:Oe=gs(i,Ee),Oe&&(b[Q]="")}else b[E[1]]=E[2]||E[3]||E[4];let W=h,U=[],re,Je=/(\S+?)=(?:\"([^\"]*)\"|\'([^\']*)\'|([^\s]+))/g;for(;(re=Je.exec(h))!==null;)U.push(re[0]);U.forEach(Q=>{W=W.replace(Q," ")});let qe=/\b(\S+?)(?=\s|$)/g,M;for(;(M=qe.exec(W))!==null;){let Q=M[1];!P.has(Q)&&!Q.startsWith(".")&&!Q.includes("=")&&(b[Q]="")}}let _=y.match(/#([^.#\s]+)/);_&&!Object.prototype.hasOwnProperty.call(b,"id")&&(b.id=_[1]);let A=null;b.id?A=b.id:v&&(A=m);let k=Object.create(null),C=null;if(v)C=m;else{let $=y.match(/\.([^.#]+)/g);$&&$.forEach(P=>{let W=P.substring(1);k[W]=!0});let E=y.match(/#([^.#\s]+)/);E&&(C=E[1])}let S;typeof d=="string"||typeof d=="number"?S=String(d):Array.isArray(d)?S=n(d,`${a}.${u}`):S=[],C&&!v&&(b.id=C);let L=Object.create(null);if(A&&r){let $=[];if(Object.keys(r).forEach(E=>{if(E.includes("*")){let P="^"+E.replace(/[.*+?^${}()|[\\\]\\]/g,"\\$&").replace(/\\\*/g,".*")+"$";try{new RegExp(P).test(A)&&$.push(E)}catch(W){console.warn(`[Parser] Invalid regex pattern created from refKey '${E}': ${P}`,W)}}else A===E&&$.push(E)}),$.length>0){$.sort((P,W)=>{let U=!P.includes("*"),re=!W.includes("*");return U&&!re?-1:!U&&re?1:W.length-P.length});let E=$[0];if(r[E]&&r[E].eventListeners){let P=r[E].eventListeners;Object.entries(P).forEach(([W,U])=>{U.handler&&s[U.handler]?L[W]=re=>{s[U.handler](re)}:U.handler&&console.warn(`[Parser] Handler '${U.handler}' for refKey '${E}' (matching elementId '${A}') is referenced but not found in available handlers.`)})}}}let V={};if(A)V.key=A;else if(y){let $=a?`${a}.${p}`:String(p);if(V.key=`${y}-${$}`,Object.keys(x).length>0){let E=JSON.stringify(x).substring(0,50);V.key+=`-${E}`}}Object.keys(b).length>0&&(V.attrs=b),Object.keys(k).length>0&&(V.class=k),Object.keys(L).length>0&&(V.on=L),Object.keys(x).length>0&&(V.props=x),v&&(V.hook={update:($,E)=>{let P=$.data?.props||{},W=E.data?.props||{},U=$.data?.attrs||{},re=E.data?.attrs||{},Je=JSON.stringify(P)!==JSON.stringify(W),qe=JSON.stringify(U)!==JSON.stringify(re);if(Je||qe){let M=E.elm;M&&M.render&&typeof M.render=="function"&&(M.setAttribute("isDirty","true"),requestAnimationFrame(()=>{if(M.render(),M.removeAttribute("isDirty"),M.handlers&&M.handlers.handleOnUpdate){let Q={...M.deps||{},store:M.store,render:M.render.bind(M),handlers:M.handlers,dispatchEvent:M.dispatchEvent.bind(M),refIds:M.refIds||{},getRefIds:()=>M.refIds||{}};M.handlers.handleOnUpdate({oldProps:P,newProps:W,oldAttrs:U,newAttrs:re},Q)}}))}}});try{return e(m,V,S)}catch($){return console.error("Error creating virtual node:",$,{tagName:m,snabbdomData:V,childrenOrText:S}),e("div",{},["Error creating element"])}}).filter(Boolean)}return n(t)};var Na=(e,t)=>{if(!t||typeof t!="object")return"";let r="",s=n=>Object.entries(n).map(([o,a])=>` ${o}: ${a};`).join(`
927
+ `),i=(n,o)=>{if(typeof o!="object"||o===null)return"";if(n.startsWith("@")){let a=Object.entries(o).map(([l,p])=>{let c=s(p);return` ${l} {
928
+ ${c.split(`
929
+ `).map(u=>u?` ${u}`:"").join(`
930
930
  `)}
931
931
  }`}).join(`
932
- `);return`${i} {
933
- ${o}
934
- }`}else{let o=s(a);return`${i} {
935
- ${o}
936
- }`}};return Object.entries(t).forEach(([i,a])=>{let o=n(i,a);o&&(r+=(r?`
932
+ `);return`${n} {
933
+ ${a}
934
+ }`}else{let a=s(o);return`${n} {
935
+ ${a}
936
+ }`}};return Object.entries(t).forEach(([n,o])=>{let a=i(n,o);a&&(r+=(r?`
937
937
 
938
- `:"")+o)}),r},ya=e=>{let t=e.map(r=>r.subscribe());return()=>{for(let r of t)r&&typeof r.unsubscribe=="function"&&r.unsubscribe()}};function ma(e){return new Proxy({},{get(t,r){if(typeof r=="string"){let s=e.getAttribute(r);return s===""?!0:s}},set(){throw new Error("Cannot assign to read-only proxy")},defineProperty(){throw new Error("Cannot define properties on read-only proxy")},deleteProperty(){throw new Error("Cannot delete properties from read-only proxy")},has(t,r){return typeof r=="string"&&e.hasAttribute(r)},ownKeys(){return e.getAttributeNames()},getOwnPropertyDescriptor(t,r){if(typeof r=="string"&&e.hasAttribute(r))return{configurable:!0,enumerable:!0,get:()=>e.getAttribute(r)}}})}function ga(e,t){let r=new Set(t);return new Proxy({},{get(s,n){if(typeof n=="string"&&r.has(n))return e[n]},set(){throw new Error("Cannot assign to read-only proxy")},defineProperty(){throw new Error("Cannot define properties on read-only proxy")},deleteProperty(){throw new Error("Cannot delete properties from read-only proxy")},has(s,n){return typeof n=="string"&&r.has(n)},ownKeys(){return[...r]},getOwnPropertyDescriptor(s,n){if(typeof n=="string"&&r.has(n))return{configurable:!0,enumerable:!0,get:()=>e[n]}}})}var Gt=class extends HTMLElement{elementName;styles;h;store;props;propsSchema;template;handlers;transformedHandlers={};refs;refIds={};patch;_unmountCallback;_oldVNode;deps;cssText;static get observedAttributes(){return["key"]}get viewData(){return this.store.toViewData()}connectedCallback(){this.shadow=this.attachShadow({mode:"open"});let t=new CSSStyleSheet;t.replaceSync(`
938
+ `:"")+a)}),r},Va=e=>{let t=e.map(r=>r.subscribe());return()=>{for(let r of t)r&&typeof r.unsubscribe=="function"&&r.unsubscribe()}};function Ra(e){return new Proxy({},{get(t,r){if(typeof r=="string"){let s=e.getAttribute(r);return s===""?!0:s}},set(){throw new Error("Cannot assign to read-only proxy")},defineProperty(){throw new Error("Cannot define properties on read-only proxy")},deleteProperty(){throw new Error("Cannot delete properties from read-only proxy")},has(t,r){return typeof r=="string"&&e.hasAttribute(r)},ownKeys(){return e.getAttributeNames()},getOwnPropertyDescriptor(t,r){if(typeof r=="string"&&e.hasAttribute(r))return{configurable:!0,enumerable:!0,get:()=>e.getAttribute(r)}}})}function Pa(e,t){let r=new Set(t);return new Proxy({},{get(s,i){if(typeof i=="string"&&r.has(i))return e[i]},set(){throw new Error("Cannot assign to read-only proxy")},defineProperty(){throw new Error("Cannot define properties on read-only proxy")},deleteProperty(){throw new Error("Cannot delete properties from read-only proxy")},has(s,i){return typeof i=="string"&&r.has(i)},ownKeys(){return[...r]},getOwnPropertyDescriptor(s,i){if(typeof i=="string"&&r.has(i))return{configurable:!0,enumerable:!0,get:()=>e[i]}}})}var Xt=class extends HTMLElement{elementName;styles;h;store;props;propsSchema;template;handlers;transformedHandlers={};refs;refIds={};patch;_unmountCallback;_oldVNode;deps;cssText;static get observedAttributes(){return["key"]}get viewData(){return this.store.toViewData()}connectedCallback(){this.shadow=this.attachShadow({mode:"open"});let t=new CSSStyleSheet;t.replaceSync(`
939
939
  a, a:link, a:visited, a:hover, a:active {
940
940
  display: contents;
941
941
  color: inherit;
@@ -947,4 +947,4 @@ ${o}
947
947
  font: inherit;
948
948
  cursor: pointer;
949
949
  }
950
- `);let r=[t];if(this.cssText){let n=new CSSStyleSheet;n.replaceSync(this.cssText),r.push(n)}this.shadow.adoptedStyleSheets=r,this.renderTarget=document.createElement("div"),this.renderTarget.style.cssText="display: contents;",this.shadow.appendChild(this.renderTarget),this.transformedHandlers={},this.renderTarget.parentNode||this.appendChild(this.renderTarget),this.style.display="contents";let s={...this.deps,refIds:this.refIds,getRefIds:()=>this.refIds,dispatchEvent:this.dispatchEvent.bind(this)};if(Object.keys(this.handlers||{}).forEach(n=>{this.transformedHandlers[n]=i=>this.handlers[n](i,s)}),this.handlers?.handleBeforeMount&&(this._unmountCallback=this.handlers?.handleBeforeMount(s),this._unmountCallback&&typeof this._unmountCallback.then=="function"))throw new Error("handleBeforeMount must be synchronous and cannot return a Promise.");this.render(),this.handlers?.handleAfterMount&&this.handlers?.handleAfterMount(s),this.handlers?.subscriptions&&(this.unsubscribeAll=ya(this.handlers.subscriptions(s)))}disconnectedCallback(){this._unmountCallback&&this._unmountCallback(),this.unsubscribeAll&&this.unsubscribeAll()}attributeChangedCallback(t,r,s){if(r!==s&&this.render)if(this.handlers?.handleOnUpdate){let n={oldAttrs:{[t]:r},newAttrs:{[t]:s}},i={...this.deps,refIds:this.refIds,getRefIds:()=>this.refIds,dispatchEvent:this.dispatchEvent.bind(this),store:this.store,render:this.render.bind(this)};this.handlers.handleOnUpdate(n,i)}else requestAnimationFrame(()=>{this.render()})}render=()=>{if(!this.patch){console.error("Patch function is not defined!");return}if(!this.template){console.error("Template is not defined!");return}try{let t={...this.deps,refIds:this.refIds,getRefIds:()=>this.refIds,dispatchEvent:this.dispatchEvent.bind(this),store:this.store,render:this.render.bind(this)},r=ys({h:this.h,template:this.template,viewData:this.viewData,refs:this.refs,handlers:this.transformedHandlers}),s={},n=i=>{i.data?.attrs&&i.data.attrs.id&&(s[i.data.attrs.id]=i),i.children&&i.children.forEach(n)};n(r),this.refIds=s,this._oldVNode?this._oldVNode=this.patch(this._oldVNode,r):this._oldVNode=this.patch(this.renderTarget,r)}catch(t){console.error("Error during patching:",t)}}},va=(e,t,r)=>{let{INITIAL_STATE:s,toViewData:n,...i}=e,a={},o={},l=structuredClone(s);return Object.entries(i).forEach(([p,u])=>{p.startsWith("select")?a[p]=(...c)=>u({state:l,props:t,attrs:r},...c):o[p]=c=>(l=as(l,h=>u(h,c)),l)}),{toViewData:()=>n({state:l,props:t,attrs:r}),getState:()=>l,...o,...a}},ba=({handlers:e,view:t,store:r,patch:s,h:n},i)=>{let{elementName:a,propsSchema:o,attrsSchema:l,template:p,refs:u,styles:c}=t;if(!s)throw new Error("Patch is not defined");if(!n)throw new Error("h is not defined");if(!t)throw new Error("view is not defined");class h extends Gt{static get observedAttributes(){let d=["key"],f=l?.properties?Object.keys(l.properties):[];return[...d,...f]}constructor(){super();let d=ma(this);this.propsSchema=o,this.props=o?ga(this,Object.keys(o.properties)):{},this.elementName=a,this.styles=c,this.store=va(r,this.props,d),this.template=p,this.handlers=e,this.refs=u,this.patch=s,this.deps={...i,store:this.store,render:this.render,handlers:e,attrs:d,props:this.props},this.h=n,this.cssText=fa(a,c)}}return h},Xt=ba;function de(e,t,r,s,n){let i=t===void 0?void 0:t.key;return{sel:e,data:t,children:r,text:s,elm:n,key:i}}var xe=Array.isArray;function Ee(e){return typeof e=="string"||typeof e=="number"||e instanceof String||e instanceof Number}function wa(e,t){return document.createElement(e,t)}function xa(e,t,r){return document.createElementNS(e,t,r)}function Ea(){return he(document.createDocumentFragment())}function ka(e){return document.createTextNode(e)}function _a(e){return document.createComment(e)}function Aa(e,t,r){if(ne(e)){let s=e;for(;s&&ne(s);)s=he(s).parent;e=s??e}ne(t)&&(t=he(t,e)),r&&ne(r)&&(r=he(r).firstChildNode),e.insertBefore(t,r)}function Sa(e,t){e.removeChild(t)}function $a(e,t){ne(t)&&(t=he(t,e)),e.appendChild(t)}function gs(e){if(ne(e)){for(;e&&ne(e);)e=he(e).parent;return e??null}return e.parentNode}function Ca(e){var t;if(ne(e)){let r=he(e),s=gs(r);if(s&&r.lastChildNode){let n=Array.from(s.childNodes),i=n.indexOf(r.lastChildNode);return(t=n[i+1])!==null&&t!==void 0?t:null}return null}return e.nextSibling}function Ia(e){return e.tagName}function Oa(e,t){e.textContent=t}function Ta(e){return e.textContent}function La(e){return e.nodeType===1}function Na(e){return e.nodeType===3}function Va(e){return e.nodeType===8}function ne(e){return e.nodeType===11}function he(e,t){var r,s,n;let i=e;return(r=i.parent)!==null&&r!==void 0||(i.parent=t??null),(s=i.firstChildNode)!==null&&s!==void 0||(i.firstChildNode=e.firstChild),(n=i.lastChildNode)!==null&&n!==void 0||(i.lastChildNode=e.lastChild),i}var vs={createElement:wa,createElementNS:xa,createTextNode:ka,createDocumentFragment:Ea,createComment:_a,insertBefore:Aa,removeChild:Sa,appendChild:$a,parentNode:gs,nextSibling:Ca,tagName:Ia,setTextContent:Oa,getTextContent:Ta,isElement:La,isText:Na,isComment:Va,isDocumentFragment:ne};function He(e){return e===void 0}function J(e){return e!==void 0}var Qt=de("",{},[],void 0,void 0);function Ie(e,t){var r,s;let n=e.key===t.key,i=((r=e.data)===null||r===void 0?void 0:r.is)===((s=t.data)===null||s===void 0?void 0:s.is),a=e.sel===t.sel,o=!e.sel&&e.sel===t.sel?typeof e.text==typeof t.text:!0;return a&&n&&i&&o}function Ra(){throw new Error("The document fragment is not supported on this platform.")}function Pa(e,t){return e.isElement(t)}function ja(e,t){return e.isDocumentFragment(t)}function Da(e,t,r){var s;let n={};for(let i=t;i<=r;++i){let a=(s=e[i])===null||s===void 0?void 0:s.key;a!==void 0&&(n[a]=i)}return n}var Ba=["create","update","remove","destroy","pre","post"];function bs(e,t,r){let s={create:[],update:[],remove:[],destroy:[],pre:[],post:[]},n=t!==void 0?t:vs;for(let d of Ba)for(let f of e){let m=f[d];m!==void 0&&s[d].push(m)}function i(d){let f=d.id?"#"+d.id:"",m=d.getAttribute("class"),v=m?"."+m.split(" ").join("."):"";return de(n.tagName(d).toLowerCase()+f+v,{},[],void 0,d)}function a(d){return de(void 0,{},[],void 0,d)}function o(d,f){return function(){if(--f===0){let v=n.parentNode(d);v!==null&&n.removeChild(v,d)}}}function l(d,f){var m,v,w,b;let E,A=d.data;if(A!==void 0){let S=(m=A.hook)===null||m===void 0?void 0:m.init;J(S)&&(S(d),A=d.data)}let k=d.children,C=d.sel;if(C==="!")He(d.text)&&(d.text=""),d.elm=n.createComment(d.text);else if(C==="")d.elm=n.createTextNode(d.text);else if(C!==void 0){let S=C.indexOf("#"),L=C.indexOf(".",S),V=S>0?S:C.length,$=L>0?L:C.length,_=S!==-1||L!==-1?C.slice(0,Math.min(V,$)):C,R=d.elm=J(A)&&J(E=A.ns)?n.createElementNS(E,_,A):n.createElement(_,A);for(V<$&&R.setAttribute("id",C.slice(V+1,$)),L>0&&R.setAttribute("class",C.slice($+1).replace(/\./g," ")),E=0;E<s.create.length;++E)s.create[E](Qt,d);if(Ee(d.text)&&(!xe(k)||k.length===0)&&n.appendChild(R,n.createTextNode(d.text)),xe(k))for(E=0;E<k.length;++E){let F=k[E];F!=null&&n.appendChild(R,l(F,f))}let W=d.data.hook;J(W)&&((v=W.create)===null||v===void 0||v.call(W,Qt,d),W.insert&&f.push(d))}else if(!((w=r?.experimental)===null||w===void 0)&&w.fragments&&d.children){for(d.elm=((b=n.createDocumentFragment)!==null&&b!==void 0?b:Ra)(),E=0;E<s.create.length;++E)s.create[E](Qt,d);for(E=0;E<d.children.length;++E){let S=d.children[E];S!=null&&n.appendChild(d.elm,l(S,f))}}else d.elm=n.createTextNode(d.text);return d.elm}function p(d,f,m,v,w,b){for(;v<=w;++v){let E=m[v];E!=null&&n.insertBefore(d,l(E,b),f)}}function u(d){var f,m;let v=d.data;if(v!==void 0){(m=(f=v?.hook)===null||f===void 0?void 0:f.destroy)===null||m===void 0||m.call(f,d);for(let w=0;w<s.destroy.length;++w)s.destroy[w](d);if(d.children!==void 0)for(let w=0;w<d.children.length;++w){let b=d.children[w];b!=null&&typeof b!="string"&&u(b)}}}function c(d,f,m,v){for(var w,b;m<=v;++m){let E,A,k=f[m];if(k!=null)if(J(k.sel)){u(k),E=s.remove.length+1,A=o(k.elm,E);for(let S=0;S<s.remove.length;++S)s.remove[S](k,A);let C=(b=(w=k?.data)===null||w===void 0?void 0:w.hook)===null||b===void 0?void 0:b.remove;J(C)?C(k,A):A()}else k.children?(u(k),c(d,k.children,0,k.children.length-1)):n.removeChild(d,k.elm)}}function h(d,f,m,v){let w=0,b=0,E=f.length-1,A=f[0],k=f[E],C=m.length-1,S=m[0],L=m[C],V,$,_,R;for(;w<=E&&b<=C;)A==null?A=f[++w]:k==null?k=f[--E]:S==null?S=m[++b]:L==null?L=m[--C]:Ie(A,S)?(y(A,S,v),A=f[++w],S=m[++b]):Ie(k,L)?(y(k,L,v),k=f[--E],L=m[--C]):Ie(A,L)?(y(A,L,v),n.insertBefore(d,A.elm,n.nextSibling(k.elm)),A=f[++w],L=m[--C]):Ie(k,S)?(y(k,S,v),n.insertBefore(d,k.elm,A.elm),k=f[--E],S=m[++b]):(V===void 0&&(V=Da(f,w,E)),$=V[S.key],He($)?(n.insertBefore(d,l(S,v),A.elm),S=m[++b]):He(V[L.key])?(n.insertBefore(d,l(L,v),n.nextSibling(k.elm)),L=m[--C]):(_=f[$],_.sel!==S.sel?n.insertBefore(d,l(S,v),A.elm):(y(_,S,v),f[$]=void 0,n.insertBefore(d,_.elm,A.elm)),S=m[++b]));b<=C&&(R=m[C+1]==null?null:m[C+1].elm,p(d,R,m,b,C,v)),w<=E&&c(d,f,w,E)}function y(d,f,m){var v,w,b,E,A,k,C,S;let L=(v=f.data)===null||v===void 0?void 0:v.hook;(w=L?.prepatch)===null||w===void 0||w.call(L,d,f);let V=f.elm=d.elm;if(d===f)return;if(f.data!==void 0||J(f.text)&&f.text!==d.text){(b=f.data)!==null&&b!==void 0||(f.data={}),(E=d.data)!==null&&E!==void 0||(d.data={});for(let R=0;R<s.update.length;++R)s.update[R](d,f);(C=(k=(A=f.data)===null||A===void 0?void 0:A.hook)===null||k===void 0?void 0:k.update)===null||C===void 0||C.call(k,d,f)}let $=d.children,_=f.children;He(f.text)?J($)&&J(_)?$!==_&&h(V,$,_,m):J(_)?(J(d.text)&&n.setTextContent(V,""),p(V,null,_,0,_.length-1,m)):J($)?c(V,$,0,$.length-1):J(d.text)&&n.setTextContent(V,""):d.text!==f.text&&(J($)&&c(V,$,0,$.length-1),n.setTextContent(V,f.text)),(S=L?.postpatch)===null||S===void 0||S.call(L,d,f)}return function(f,m){let v,w,b,E=[];for(v=0;v<s.pre.length;++v)s.pre[v]();for(Pa(n,f)?f=i(f):ja(n,f)&&(f=a(f)),Ie(f,m)?y(f,m,E):(w=f.elm,b=n.parentNode(w),l(m,E),b!==null&&(n.insertBefore(b,m.elm,n.nextSibling(w)),c(b,[f],0,0))),v=0;v<E.length;++v)E[v].data.hook.insert(E[v]);for(v=0;v<s.post.length;++v)s.post[v]();return m}}function ws(e,t){let r,s,n=t.elm,i=e.data.class,a=t.data.class;if(!(!i&&!a)&&i!==a){i=i||{},a=a||{};for(s in i)i[s]&&!Object.prototype.hasOwnProperty.call(a,s)&&n.classList.remove(s);for(s in a)r=a[s],r!==i[s]&&n.classList[r?"add":"remove"](s)}}var xs={create:ws,update:ws};function Es(e,t){let r,s,n,i=t.elm,a=e.data.props,o=t.data.props;if(!(!a&&!o)&&a!==o){a=a||{},o=o||{};for(r in o)s=o[r],n=a[r],n!==s&&(r!=="value"||i[r]!==s)&&(i[r]=s)}}var ks={create:Es,update:Es};var Wa="http://www.w3.org/1999/xlink",Ma="http://www.w3.org/2000/xmlns/",Ka="http://www.w3.org/XML/1998/namespace";function _s(e,t){let r,s=t.elm,n=e.data.attrs,i=t.data.attrs;if(!(!n&&!i)&&n!==i){n=n||{},i=i||{};for(r in i){let a=i[r];n[r]!==a&&(a===!0?s.setAttribute(r,""):a===!1?s.removeAttribute(r):r.charCodeAt(0)!==120?s.setAttribute(r,a):r.charCodeAt(3)===58?s.setAttributeNS(Ka,r,a):r.charCodeAt(5)===58?r.charCodeAt(1)===109?s.setAttributeNS(Ma,r,a):s.setAttributeNS(Wa,r,a):s.setAttribute(r,a))}for(r in n)r in i||s.removeAttribute(r)}}var As={create:_s,update:_s};var Ss=typeof window?.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):setTimeout,Fa=function(e){Ss(function(){Ss(e)})},Zt=!1;function za(e,t,r){Fa(function(){e[t]=r})}function $s(e,t){let r,s,n=t.elm,i=e.data.style,a=t.data.style;if(!i&&!a||i===a)return;i=i||{},a=a||{};let o="delayed"in i;for(s in i)s in a||(s[0]==="-"&&s[1]==="-"?n.style.removeProperty(s):n.style[s]="");for(s in a)if(r=a[s],s==="delayed"&&a.delayed)for(let l in a.delayed)r=a.delayed[l],(!o||r!==i.delayed[l])&&za(n.style,l,r);else s!=="remove"&&r!==i[s]&&(s[0]==="-"&&s[1]==="-"?n.style.setProperty(s,r):n.style[s]=r)}function Ua(e){let t,r,s=e.elm,n=e.data.style;if(!(!n||!(t=n.destroy)))for(r in t)s.style[r]=t[r]}function Ha(e,t){let r=e.data.style;if(!r||!r.remove){t();return}Zt||(e.elm.offsetLeft,Zt=!0);let s,n=e.elm,i=0,a=r.remove,o=0,l=[];for(s in a)l.push(s),n.style[s]=a[s];let u=getComputedStyle(n)["transition-property"].split(", ");for(;i<u.length;++i)l.indexOf(u[i])!==-1&&o++;n.addEventListener("transitionend",function(c){c.target===n&&--o,o===0&&t()})}function Ja(){Zt=!1}var Cs={pre:Ja,create:$s,update:$s,destroy:Ua,remove:Ha};function Is(e,t,r){if(typeof e=="function")e.call(t,r,t);else if(typeof e=="object")for(let s=0;s<e.length;s++)Is(e[s],t,r)}function qa(e,t){let r=e.type,s=t.data.on;s&&s[r]&&Is(s[r],t,e)}function Ya(){return function e(t){qa(t,e.vnode)}}function er(e,t){let r=e.data.on,s=e.listener,n=e.elm,i=t&&t.data.on,a=t&&t.elm,o;if(r!==i){if(r&&s)if(i)for(o in r)i[o]||n.removeEventListener(o,s,!1);else for(o in r)n.removeEventListener(o,s,!1);if(i){let l=t.listener=e.listener||Ya();if(l.vnode=t,r)for(o in i)r[o]||a.addEventListener(o,l,!1);else for(o in i)a.addEventListener(o,l,!1)}}}var Os={create:er,update:er,destroy:er};var Ga=()=>bs([xs,ks,As,Cs,Os]),tr=Ga;function Ts(e,t,r){if(e.ns="http://www.w3.org/2000/svg",r!=="foreignObject"&&t!==void 0)for(let s=0;s<t.length;++s){let n=t[s];if(typeof n=="string")continue;let i=n.data;i!==void 0&&Ts(i,n.children,n.sel)}}function rr(e,t,r){let s={},n,i,a;if(r!==void 0?(t!==null&&(s=t),xe(r)?n=r:Ee(r)?i=r.toString():r&&r.sel&&(n=[r])):t!=null&&(xe(t)?n=t:Ee(t)?i=t.toString():t&&t.sel?n=[t]:s=t),n!==void 0)for(a=0;a<n.length;++a)Ee(n[a])&&(n[a]=de(void 0,void 0,void 0,n[a],void 0));return e.startsWith("svg")&&(e.length===3||e[3]==="."||e[3]==="#")&&Ts(s,n,e),de(e,s,n,i,void 0)}var Xa={},Ls={components:Xa},Ns=tr();var Je={components:{breadcrumb:{handlers:at,store:lt,view:xr},dropdownMenu:{handlers:pt,store:ct,view:Er},form:{handlers:ut,store:bt,view:Pr},navbar:{handlers:wt,store:xt,view:jr},pageOutline:{handlers:Et,store:kt,view:Br},popoverInput:{handlers:_t,store:At,view:Wr},select:{handlers:St,store:$t,view:Mr},sidebar:{handlers:Ct,store:Ot,view:Kr},sliderInput:{handlers:Tt,store:Lt,view:Fr},table:{handlers:Nt,store:Vt,view:zr},tabs:{handlers:Rt,store:Pt,view:Ur},tooltip:{handlers:Hr,store:jt,view:Jr},waveform:{handlers:Dt,store:Bt,view:Yr}}};Object.keys(Je).forEach(e=>{Object.keys(Je[e]).forEach(t=>{let r=Xt({...Je[e][t],patch:Ns,h:rr},Ls[e]);customElements.define(Je[e][t].view.elementName,r)})});customElements.define("rtgl-button",or({}));customElements.define("rtgl-view",pr({}));customElements.define("rtgl-text",ur({}));customElements.define("rtgl-image",dr({}));customElements.define("rtgl-svg",fr({}));customElements.define("rtgl-input",yr({}));customElements.define("rtgl-textarea",mr({}));customElements.define("rtgl-color-picker",gr({}));customElements.define("rtgl-slider",vr({}));customElements.define("rtgl-dialog",br({}));customElements.define("rtgl-popover",wr({}));})();
950
+ `);let r=[t];if(this.cssText){let i=new CSSStyleSheet;i.replaceSync(this.cssText),r.push(i)}this.shadow.adoptedStyleSheets=r,this.renderTarget=document.createElement("div"),this.renderTarget.style.cssText="display: contents;",this.shadow.appendChild(this.renderTarget),this.transformedHandlers={},this.renderTarget.parentNode||this.appendChild(this.renderTarget),this.style.display="contents";let s={...this.deps,refIds:this.refIds,getRefIds:()=>this.refIds,dispatchEvent:this.dispatchEvent.bind(this)};if(Object.keys(this.handlers||{}).forEach(i=>{this.transformedHandlers[i]=n=>this.handlers[i](n,s)}),this.handlers?.handleBeforeMount&&(this._unmountCallback=this.handlers?.handleBeforeMount(s),this._unmountCallback&&typeof this._unmountCallback.then=="function"))throw new Error("handleBeforeMount must be synchronous and cannot return a Promise.");this.render(),this.handlers?.handleAfterMount&&this.handlers?.handleAfterMount(s),this.handlers?.subscriptions&&(this.unsubscribeAll=Va(this.handlers.subscriptions(s)))}disconnectedCallback(){this._unmountCallback&&this._unmountCallback(),this.unsubscribeAll&&this.unsubscribeAll()}attributeChangedCallback(t,r,s){if(r!==s&&this.render)if(this.handlers?.handleOnUpdate){let i={oldAttrs:{[t]:r},newAttrs:{[t]:s}},n={...this.deps,refIds:this.refIds,getRefIds:()=>this.refIds,dispatchEvent:this.dispatchEvent.bind(this),store:this.store,render:this.render.bind(this)};this.handlers.handleOnUpdate(i,n)}else requestAnimationFrame(()=>{this.render()})}render=()=>{if(!this.patch){console.error("Patch function is not defined!");return}if(!this.template){console.error("Template is not defined!");return}try{let t={...this.deps,refIds:this.refIds,getRefIds:()=>this.refIds,dispatchEvent:this.dispatchEvent.bind(this),store:this.store,render:this.render.bind(this)},r=vs({h:this.h,template:this.template,viewData:this.viewData,refs:this.refs,handlers:this.transformedHandlers}),s={},i=n=>{n.data?.attrs&&n.data.attrs.id&&(s[n.data.attrs.id]=n),n.children&&n.children.forEach(i)};i(r),this.refIds=s,this._oldVNode?this._oldVNode=this.patch(this._oldVNode,r):this._oldVNode=this.patch(this.renderTarget,r)}catch(t){console.error("Error during patching:",t)}}},ja=(e,t,r)=>{let{INITIAL_STATE:s,toViewData:i,...n}=e,o={},a={},l=structuredClone(s);return Object.entries(n).forEach(([p,c])=>{p.startsWith("select")?o[p]=(...u)=>c({state:l,props:t,attrs:r},...u):a[p]=u=>(l=ps(l,d=>c(d,u)),l)}),{toViewData:()=>i({state:l,props:t,attrs:r}),getState:()=>l,...a,...o}},Da=({handlers:e,view:t,store:r,patch:s,h:i},n)=>{let{elementName:o,propsSchema:a,attrsSchema:l,template:p,refs:c,styles:u}=t;if(!s)throw new Error("Patch is not defined");if(!i)throw new Error("h is not defined");if(!t)throw new Error("view is not defined");class d extends Xt{static get observedAttributes(){let h=["key"],f=l?.properties?Object.keys(l.properties):[];return[...h,...f]}constructor(){super();let h=Ra(this);this.propsSchema=a,this.props=a?Pa(this,Object.keys(a.properties)):{},this.elementName=o,this.styles=u,this.store=ja(r,this.props,h),this.template=p,this.handlers=e,this.refs=c,this.patch=s,this.deps={...n,store:this.store,render:this.render,handlers:e,attrs:h,props:this.props},this.h=i,this.cssText=Na(o,u)}}return d},Qt=Da;function he(e,t,r,s,i){let n=t===void 0?void 0:t.key;return{sel:e,data:t,children:r,text:s,elm:i,key:n}}var xe=Array.isArray;function _e(e){return typeof e=="string"||typeof e=="number"||e instanceof String||e instanceof Number}function Ba(e,t){return document.createElement(e,t)}function Wa(e,t,r){return document.createElementNS(e,t,r)}function Ma(){return de(document.createDocumentFragment())}function Fa(e){return document.createTextNode(e)}function Ka(e){return document.createComment(e)}function Ua(e,t,r){if(oe(e)){let s=e;for(;s&&oe(s);)s=de(s).parent;e=s??e}oe(t)&&(t=de(t,e)),r&&oe(r)&&(r=de(r).firstChildNode),e.insertBefore(t,r)}function za(e,t){e.removeChild(t)}function Ha(e,t){oe(t)&&(t=de(t,e)),e.appendChild(t)}function ws(e){if(oe(e)){for(;e&&oe(e);)e=de(e).parent;return e??null}return e.parentNode}function Ja(e){var t;if(oe(e)){let r=de(e),s=ws(r);if(s&&r.lastChildNode){let i=Array.from(s.childNodes),n=i.indexOf(r.lastChildNode);return(t=i[n+1])!==null&&t!==void 0?t:null}return null}return e.nextSibling}function qa(e){return e.tagName}function Ga(e,t){e.textContent=t}function Ya(e){return e.textContent}function Xa(e){return e.nodeType===1}function Qa(e){return e.nodeType===3}function Za(e){return e.nodeType===8}function oe(e){return e.nodeType===11}function de(e,t){var r,s,i;let n=e;return(r=n.parent)!==null&&r!==void 0||(n.parent=t??null),(s=n.firstChildNode)!==null&&s!==void 0||(n.firstChildNode=e.firstChild),(i=n.lastChildNode)!==null&&i!==void 0||(n.lastChildNode=e.lastChild),n}var xs={createElement:Ba,createElementNS:Wa,createTextNode:Fa,createDocumentFragment:Ma,createComment:Ka,insertBefore:Ua,removeChild:za,appendChild:Ha,parentNode:ws,nextSibling:Ja,tagName:qa,setTextContent:Ga,getTextContent:Ya,isElement:Xa,isText:Qa,isComment:Za,isDocumentFragment:oe};function ze(e){return e===void 0}function G(e){return e!==void 0}var Zt=he("",{},[],void 0,void 0);function Ie(e,t){var r,s;let i=e.key===t.key,n=((r=e.data)===null||r===void 0?void 0:r.is)===((s=t.data)===null||s===void 0?void 0:s.is),o=e.sel===t.sel,a=!e.sel&&e.sel===t.sel?typeof e.text==typeof t.text:!0;return o&&i&&n&&a}function el(){throw new Error("The document fragment is not supported on this platform.")}function tl(e,t){return e.isElement(t)}function rl(e,t){return e.isDocumentFragment(t)}function sl(e,t,r){var s;let i={};for(let n=t;n<=r;++n){let o=(s=e[n])===null||s===void 0?void 0:s.key;o!==void 0&&(i[o]=n)}return i}var il=["create","update","remove","destroy","pre","post"];function _s(e,t,r){let s={create:[],update:[],remove:[],destroy:[],pre:[],post:[]},i=t!==void 0?t:xs;for(let h of il)for(let f of e){let m=f[h];m!==void 0&&s[h].push(m)}function n(h){let f=h.id?"#"+h.id:"",m=h.getAttribute("class"),v=m?"."+m.split(" ").join("."):"";return he(i.tagName(h).toLowerCase()+f+v,{},[],void 0,h)}function o(h){return he(void 0,{},[],void 0,h)}function a(h,f){return function(){if(--f===0){let v=i.parentNode(h);v!==null&&i.removeChild(v,h)}}}function l(h,f){var m,v,b,x;let _,A=h.data;if(A!==void 0){let S=(m=A.hook)===null||m===void 0?void 0:m.init;G(S)&&(S(h),A=h.data)}let k=h.children,C=h.sel;if(C==="!")ze(h.text)&&(h.text=""),h.elm=i.createComment(h.text);else if(C==="")h.elm=i.createTextNode(h.text);else if(C!==void 0){let S=C.indexOf("#"),L=C.indexOf(".",S),V=S>0?S:C.length,$=L>0?L:C.length,E=S!==-1||L!==-1?C.slice(0,Math.min(V,$)):C,P=h.elm=G(A)&&G(_=A.ns)?i.createElementNS(_,E,A):i.createElement(E,A);for(V<$&&P.setAttribute("id",C.slice(V+1,$)),L>0&&P.setAttribute("class",C.slice($+1).replace(/\./g," ")),_=0;_<s.create.length;++_)s.create[_](Zt,h);if(_e(h.text)&&(!xe(k)||k.length===0)&&i.appendChild(P,i.createTextNode(h.text)),xe(k))for(_=0;_<k.length;++_){let U=k[_];U!=null&&i.appendChild(P,l(U,f))}let W=h.data.hook;G(W)&&((v=W.create)===null||v===void 0||v.call(W,Zt,h),W.insert&&f.push(h))}else if(!((b=r?.experimental)===null||b===void 0)&&b.fragments&&h.children){for(h.elm=((x=i.createDocumentFragment)!==null&&x!==void 0?x:el)(),_=0;_<s.create.length;++_)s.create[_](Zt,h);for(_=0;_<h.children.length;++_){let S=h.children[_];S!=null&&i.appendChild(h.elm,l(S,f))}}else h.elm=i.createTextNode(h.text);return h.elm}function p(h,f,m,v,b,x){for(;v<=b;++v){let _=m[v];_!=null&&i.insertBefore(h,l(_,x),f)}}function c(h){var f,m;let v=h.data;if(v!==void 0){(m=(f=v?.hook)===null||f===void 0?void 0:f.destroy)===null||m===void 0||m.call(f,h);for(let b=0;b<s.destroy.length;++b)s.destroy[b](h);if(h.children!==void 0)for(let b=0;b<h.children.length;++b){let x=h.children[b];x!=null&&typeof x!="string"&&c(x)}}}function u(h,f,m,v){for(var b,x;m<=v;++m){let _,A,k=f[m];if(k!=null)if(G(k.sel)){c(k),_=s.remove.length+1,A=a(k.elm,_);for(let S=0;S<s.remove.length;++S)s.remove[S](k,A);let C=(x=(b=k?.data)===null||b===void 0?void 0:b.hook)===null||x===void 0?void 0:x.remove;G(C)?C(k,A):A()}else k.children?(c(k),u(h,k.children,0,k.children.length-1)):i.removeChild(h,k.elm)}}function d(h,f,m,v){let b=0,x=0,_=f.length-1,A=f[0],k=f[_],C=m.length-1,S=m[0],L=m[C],V,$,E,P;for(;b<=_&&x<=C;)A==null?A=f[++b]:k==null?k=f[--_]:S==null?S=m[++x]:L==null?L=m[--C]:Ie(A,S)?(y(A,S,v),A=f[++b],S=m[++x]):Ie(k,L)?(y(k,L,v),k=f[--_],L=m[--C]):Ie(A,L)?(y(A,L,v),i.insertBefore(h,A.elm,i.nextSibling(k.elm)),A=f[++b],L=m[--C]):Ie(k,S)?(y(k,S,v),i.insertBefore(h,k.elm,A.elm),k=f[--_],S=m[++x]):(V===void 0&&(V=sl(f,b,_)),$=V[S.key],ze($)?(i.insertBefore(h,l(S,v),A.elm),S=m[++x]):ze(V[L.key])?(i.insertBefore(h,l(L,v),i.nextSibling(k.elm)),L=m[--C]):(E=f[$],E.sel!==S.sel?i.insertBefore(h,l(S,v),A.elm):(y(E,S,v),f[$]=void 0,i.insertBefore(h,E.elm,A.elm)),S=m[++x]));x<=C&&(P=m[C+1]==null?null:m[C+1].elm,p(h,P,m,x,C,v)),b<=_&&u(h,f,b,_)}function y(h,f,m){var v,b,x,_,A,k,C,S;let L=(v=f.data)===null||v===void 0?void 0:v.hook;(b=L?.prepatch)===null||b===void 0||b.call(L,h,f);let V=f.elm=h.elm;if(h===f)return;if(f.data!==void 0||G(f.text)&&f.text!==h.text){(x=f.data)!==null&&x!==void 0||(f.data={}),(_=h.data)!==null&&_!==void 0||(h.data={});for(let P=0;P<s.update.length;++P)s.update[P](h,f);(C=(k=(A=f.data)===null||A===void 0?void 0:A.hook)===null||k===void 0?void 0:k.update)===null||C===void 0||C.call(k,h,f)}let $=h.children,E=f.children;ze(f.text)?G($)&&G(E)?$!==E&&d(V,$,E,m):G(E)?(G(h.text)&&i.setTextContent(V,""),p(V,null,E,0,E.length-1,m)):G($)?u(V,$,0,$.length-1):G(h.text)&&i.setTextContent(V,""):h.text!==f.text&&(G($)&&u(V,$,0,$.length-1),i.setTextContent(V,f.text)),(S=L?.postpatch)===null||S===void 0||S.call(L,h,f)}return function(f,m){let v,b,x,_=[];for(v=0;v<s.pre.length;++v)s.pre[v]();for(tl(i,f)?f=n(f):rl(i,f)&&(f=o(f)),Ie(f,m)?y(f,m,_):(b=f.elm,x=i.parentNode(b),l(m,_),x!==null&&(i.insertBefore(x,m.elm,i.nextSibling(b)),u(x,[f],0,0))),v=0;v<_.length;++v)_[v].data.hook.insert(_[v]);for(v=0;v<s.post.length;++v)s.post[v]();return m}}function Es(e,t){let r,s,i=t.elm,n=e.data.class,o=t.data.class;if(!(!n&&!o)&&n!==o){n=n||{},o=o||{};for(s in n)n[s]&&!Object.prototype.hasOwnProperty.call(o,s)&&i.classList.remove(s);for(s in o)r=o[s],r!==n[s]&&i.classList[r?"add":"remove"](s)}}var As={create:Es,update:Es};function ks(e,t){let r,s,i,n=t.elm,o=e.data.props,a=t.data.props;if(!(!o&&!a)&&o!==a){o=o||{},a=a||{};for(r in a)s=a[r],i=o[r],i!==s&&(r!=="value"||n[r]!==s)&&(n[r]=s)}}var Ss={create:ks,update:ks};var nl="http://www.w3.org/1999/xlink",ol="http://www.w3.org/2000/xmlns/",al="http://www.w3.org/XML/1998/namespace";function $s(e,t){let r,s=t.elm,i=e.data.attrs,n=t.data.attrs;if(!(!i&&!n)&&i!==n){i=i||{},n=n||{};for(r in n){let o=n[r];i[r]!==o&&(o===!0?s.setAttribute(r,""):o===!1?s.removeAttribute(r):r.charCodeAt(0)!==120?s.setAttribute(r,o):r.charCodeAt(3)===58?s.setAttributeNS(al,r,o):r.charCodeAt(5)===58?r.charCodeAt(1)===109?s.setAttributeNS(ol,r,o):s.setAttributeNS(nl,r,o):s.setAttribute(r,o))}for(r in i)r in n||s.removeAttribute(r)}}var Cs={create:$s,update:$s};var Is=typeof window?.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):setTimeout,ll=function(e){Is(function(){Is(e)})},er=!1;function pl(e,t,r){ll(function(){e[t]=r})}function Os(e,t){let r,s,i=t.elm,n=e.data.style,o=t.data.style;if(!n&&!o||n===o)return;n=n||{},o=o||{};let a="delayed"in n;for(s in n)s in o||(s[0]==="-"&&s[1]==="-"?i.style.removeProperty(s):i.style[s]="");for(s in o)if(r=o[s],s==="delayed"&&o.delayed)for(let l in o.delayed)r=o.delayed[l],(!a||r!==n.delayed[l])&&pl(i.style,l,r);else s!=="remove"&&r!==n[s]&&(s[0]==="-"&&s[1]==="-"?i.style.setProperty(s,r):i.style[s]=r)}function cl(e){let t,r,s=e.elm,i=e.data.style;if(!(!i||!(t=i.destroy)))for(r in t)s.style[r]=t[r]}function ul(e,t){let r=e.data.style;if(!r||!r.remove){t();return}er||(e.elm.offsetLeft,er=!0);let s,i=e.elm,n=0,o=r.remove,a=0,l=[];for(s in o)l.push(s),i.style[s]=o[s];let c=getComputedStyle(i)["transition-property"].split(", ");for(;n<c.length;++n)l.indexOf(c[n])!==-1&&a++;i.addEventListener("transitionend",function(u){u.target===i&&--a,a===0&&t()})}function hl(){er=!1}var Ts={pre:hl,create:Os,update:Os,destroy:cl,remove:ul};function Ls(e,t,r){if(typeof e=="function")e.call(t,r,t);else if(typeof e=="object")for(let s=0;s<e.length;s++)Ls(e[s],t,r)}function dl(e,t){let r=e.type,s=t.data.on;s&&s[r]&&Ls(s[r],t,e)}function fl(){return function e(t){dl(t,e.vnode)}}function tr(e,t){let r=e.data.on,s=e.listener,i=e.elm,n=t&&t.data.on,o=t&&t.elm,a;if(r!==n){if(r&&s)if(n)for(a in r)n[a]||i.removeEventListener(a,s,!1);else for(a in r)i.removeEventListener(a,s,!1);if(n){let l=t.listener=e.listener||fl();if(l.vnode=t,r)for(a in n)r[a]||o.addEventListener(a,l,!1);else for(a in n)o.addEventListener(a,l,!1)}}}var Ns={create:tr,update:tr,destroy:tr};var yl=()=>_s([As,Ss,Cs,Ts,Ns]),rr=yl;var ml=e=>{let t={};return{once:(r,s)=>{t[r]||(t[r]=[]);let i=(...n)=>{s(...n),t[r]=t[r].filter(o=>o!==i)};t[r].push(i)},emit:(r,...s)=>{t[r]&&t[r].forEach(i=>{i(...s)})},showAlert:async r=>{if(!e)throw new Error("globalUIElement is not set. Make sure to initialize the global UI component and pass it to createGlobalUIManager.");e.transformedHandlers.showAlert(r)},showConfirm:async r=>{if(!e)throw new Error("globalUIElement is not set. Make sure to initialize the global UI component and pass it to createGlobalUIManager.");return e.transformedHandlers.showConfirm(r)}}},Vs=ml;function Rs(e,t,r){if(e.ns="http://www.w3.org/2000/svg",r!=="foreignObject"&&t!==void 0)for(let s=0;s<t.length;++s){let i=t[s];if(typeof i=="string")continue;let n=i.data;n!==void 0&&Rs(n,i.children,i.sel)}}function sr(e,t,r){let s={},i,n,o;if(r!==void 0?(t!==null&&(s=t),xe(r)?i=r:_e(r)?n=r.toString():r&&r.sel&&(i=[r])):t!=null&&(xe(t)?i=t:_e(t)?n=t.toString():t&&t.sel?i=[t]:s=t),i!==void 0)for(o=0;o<i.length;++o)_e(i[o])&&(i[o]=he(void 0,void 0,void 0,i[o],void 0));return e.startsWith("svg")&&(e.length===3||e[3]==="."||e[3]==="#")&&Rs(s,i,e),he(e,s,i,n,void 0)}var gl=Vs(),vl={globalUI:gl},Ps={components:vl},js=rr();var He={components:{breadcrumb:{handlers:ot,store:at,view:_r},dropdownMenu:{handlers:lt,store:pt,view:Er},form:{handlers:ct,store:vt,view:jr},globalUi:{handlers:bt,store:wt,view:Dr},navbar:{handlers:xt,store:_t,view:Br},pageOutline:{handlers:Et,store:At,view:Mr},popoverInput:{handlers:kt,store:St,view:Fr},select:{handlers:$t,store:Ct,view:Kr},sidebar:{handlers:It,store:Tt,view:Ur},sliderInput:{handlers:Lt,store:Nt,view:zr},table:{handlers:Vt,store:Rt,view:Hr},tabs:{handlers:Pt,store:jt,view:Jr},tooltip:{handlers:qr,store:Dt,view:Gr},waveform:{handlers:Bt,store:Wt,view:Xr}}};Object.keys(He).forEach(e=>{Object.keys(He[e]).forEach(t=>{let r=Qt({...He[e][t],patch:js,h:sr},Ps[e]);customElements.define(He[e][t].view.elementName,r)})});customElements.define("rtgl-button",ar({}));customElements.define("rtgl-view",cr({}));customElements.define("rtgl-text",hr({}));customElements.define("rtgl-image",dr({}));customElements.define("rtgl-svg",yr({}));customElements.define("rtgl-input",mr({}));customElements.define("rtgl-textarea",gr({}));customElements.define("rtgl-color-picker",vr({}));customElements.define("rtgl-slider",br({}));customElements.define("rtgl-dialog",wr({}));customElements.define("rtgl-popover",xr({}));})();