@rettangoli/ui 1.0.0-rc13 → 1.0.0-rc15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/rettangoli-iife-layout.min.js +81 -49
  2. package/dist/rettangoli-iife-ui.min.js +150 -49
  3. package/package.json +10 -5
  4. package/src/common/dimensions.js +85 -0
  5. package/src/common/responsive.js +72 -0
  6. package/src/common.js +6 -4
  7. package/src/components/dropdownMenu/dropdownMenu.schema.yaml +1 -1
  8. package/src/components/form/form.handlers.js +328 -152
  9. package/src/components/form/form.methods.js +205 -0
  10. package/src/components/form/form.schema.yaml +16 -271
  11. package/src/components/form/form.store.js +535 -95
  12. package/src/components/form/form.view.yaml +73 -52
  13. package/src/components/globalUi/globalUi.handlers.js +4 -4
  14. package/src/components/popoverInput/popoverInput.handlers.js +64 -50
  15. package/src/components/popoverInput/popoverInput.schema.yaml +3 -1
  16. package/src/components/popoverInput/popoverInput.store.js +9 -3
  17. package/src/components/popoverInput/popoverInput.view.yaml +4 -4
  18. package/src/components/select/select.handlers.js +15 -19
  19. package/src/components/select/select.schema.yaml +2 -0
  20. package/src/components/select/select.store.js +8 -6
  21. package/src/components/select/select.view.yaml +4 -4
  22. package/src/components/sliderInput/sliderInput.handlers.js +15 -1
  23. package/src/components/sliderInput/sliderInput.schema.yaml +3 -0
  24. package/src/components/sliderInput/sliderInput.store.js +2 -1
  25. package/src/components/sliderInput/sliderInput.view.yaml +2 -2
  26. package/src/components/tooltip/tooltip.schema.yaml +1 -1
  27. package/src/deps/createGlobalUI.js +4 -4
  28. package/src/entry-iife-layout.js +6 -0
  29. package/src/entry-iife-ui.js +8 -0
  30. package/src/index.js +8 -0
  31. package/src/primitives/checkbox.js +295 -0
  32. package/src/primitives/input-date.js +31 -0
  33. package/src/primitives/input-datetime.js +31 -0
  34. package/src/primitives/input-time.js +31 -0
  35. package/src/primitives/input.js +43 -1
  36. package/src/primitives/textarea.js +3 -0
  37. package/src/primitives/view.js +6 -2
@@ -1,4 +1,4 @@
1
- var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)In(e,r,{get:t[r],enumerable:!0})};var Oe=`
1
+ var rettangoli=(()=>{var ua=Object.defineProperty;var R=(e,t)=>{for(var r in t)ua(e,r,{get:t[r],enumerable:!0})};var je=`
2
2
  :host([href]) {
3
3
  cursor: pointer;
4
4
  position: relative;
@@ -12,7 +12,7 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
12
12
  bottom: 0;
13
13
  z-index: 1;
14
14
  }
15
- `,Te=({linkElement:e,href:t,newTab:r,rel:s})=>{e.href=t,r?e.target="_blank":e.removeAttribute("target"),s!=null?e.rel=s:r?e.rel="noopener noreferrer":e.removeAttribute("rel")},Le=({shadowRoot:e,slotElement:t,linkElement:r,href:s,newTab:i,rel:n})=>{if(t.parentNode!==e&&e.appendChild(t),!s)return r&&r.parentNode===e&&e.removeChild(r),null;let a=r||document.createElement("a");return Te({linkElement:a,href:s,newTab:i,rel:n}),a.parentNode!==e&&e.appendChild(a),a},mt=({shadowRoot:e,childElement:t,linkElement:r,href:s,newTab:i,rel:n})=>{if(!s)return r?(t.parentNode===r&&e.appendChild(t),r.parentNode===e&&e.removeChild(r),null):(t.parentNode!==e&&e.appendChild(t),null);let a=r||document.createElement("a");return Te({linkElement:a,href:s,newTab:i,rel:n}),t.parentNode!==a&&a.appendChild(t),a.parentNode!==e&&e.appendChild(a),a};var ne=["default","sm","md","lg","xl"],K=()=>ne.reduce((e,t)=>(e[t]={},e),{});var On=/^([1-9]|1[0-2])fg$/,yt=e=>typeof e=="string"&&On.test(e),H=({styleBucket:e,axis:t,dimension:r,fillValue:s,allowFlexGrow:i=!1,lockBounds:n=!0})=>{if(r!==void 0){if(r==="f"){e[t]=s;return}if(i&&yt(r)){e["flex-grow"]=r.slice(0,-2),e["flex-basis"]="0%";return}e[t]=r,n&&(e[`min-${t}`]=r,e[`max-${t}`]=r)}},gt=({style:e,width:t,fillValue:r="var(--width-stretch)",allowFlexGrow:s=!0,flexMinWidth:i="0"})=>{if(t==="f"){e.width=r,e.flexGrow="",e.flexBasis="",e.minWidth="";return}if(s&&yt(t)){e.width="",e.flexGrow=t.slice(0,-2),e.flexBasis="0%",e.minWidth=i;return}if(t!=null){e.width=t,e.flexGrow="",e.flexBasis="",e.minWidth="";return}e.width="",e.flexGrow="",e.flexBasis="",e.minWidth=""};function L(e,...t){let r="";return e.forEach((s,i)=>{r+=s+(t[i]||"")}),r}var Tn=["sm","md","lg","xl"],Rr={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",cur:"cursor"},ue=Object.keys(Rr),ee=e=>e.concat(Tn.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)"},G=(e,t={},r=null)=>{let s="";for(let[i,n]of Object.entries(Nr)){i!=="default"&&(s+=`${n} {`);for(let[a,l]of Object.entries(e))for(let[p,o]of Object.entries(l)){let c=Rr[a],u=o.startsWith("--")?`var(${o})`:o,d=i==="default"?a:`${i}-${a}`,h=i==="default"?`h-${a}`:`${i}-h-${a}`,f=(m,g=!1)=>{let y=g?`:host([${m}="${p}"]:hover)`:`:host([${m}="${p}"])`;if(r)return r.split(",").map(_=>`${y} ${_.trim()}`).join(", ");let w=t[a];return w?`${y} ${w}`:y};if(c){let g=c.split(" ").map(y=>`${y}: ${u};`).join(" ");s+=`
15
+ `,Fe=({linkElement:e,href:t,newTab:r,rel:s})=>{e.href=t,r?e.target="_blank":e.removeAttribute("target"),s!=null?e.rel=s:r?e.rel="noopener noreferrer":e.removeAttribute("rel")},Me=({shadowRoot:e,slotElement:t,linkElement:r,href:s,newTab:i,rel:n})=>{if(t.parentNode!==e&&e.appendChild(t),!s)return r&&r.parentNode===e&&e.removeChild(r),null;let a=r||document.createElement("a");return Fe({linkElement:a,href:s,newTab:i,rel:n}),a.parentNode!==e&&e.appendChild(a),a},Ot=({shadowRoot:e,childElement:t,linkElement:r,href:s,newTab:i,rel:n})=>{if(!s)return r?(t.parentNode===r&&e.appendChild(t),r.parentNode===e&&e.removeChild(r),null):(t.parentNode!==e&&e.appendChild(t),null);let a=r||document.createElement("a");return Fe({linkElement:a,href:s,newTab:i,rel:n}),t.parentNode!==a&&a.appendChild(t),a.parentNode!==e&&e.appendChild(a),a};var le=["default","sm","md","lg","xl"],G=()=>le.reduce((e,t)=>(e[t]={},e),{}),ss=["sm","md","lg","xl"],da=({size:e,attr:t})=>e==="default"?t:`${e}-${t}`,fa=({size:e,includeDefault:t=!0})=>{if(e==="default")return["default"];let r=ss.indexOf(e);if(r===-1)return t?["default"]:[];let s=ss.slice(r);return t&&s.push("default"),s},Tt=({element:e,size:t,attr:r,includeDefault:s=!0})=>{let i=fa({size:t,includeDefault:s});for(let n of i){let a=da({size:n,attr:r}),l=e.getAttribute(a);if(l!==null)return l}return null};var ha=/^([1-9]|1[0-2])fg$/,ma=/^([1-9]\d*)\/([1-9]\d*)fb$/,Lt=e=>typeof e=="string"&&ha.test(e),is=e=>{if(typeof e!="string")return null;let t=e.match(ma);if(!t)return null;let r=Number(t[1]),s=Number(t[2]);return!Number.isInteger(r)||!Number.isInteger(s)||s<=0||r>s?null:{numerator:r,denominator:s}};function ns({numerator:e,denominator:t,gapVar:r}){return e===t?"100%":e===1?`calc((100% - ((${t} - 1) * ${r})) / ${t})`:`calc(((100% - ((${t} - 1) * ${r})) * ${e}) / ${t})`}var q=({styleBucket:e,axis:t,dimension:r,fillValue:s,allowFlexGrow:i=!1,flexMinDimension:n="0",lockBounds:a=!0})=>{let l=()=>{!i||t!=="width"||(e["flex-grow"]="0",e["flex-shrink"]="1",e["flex-basis"]="auto")},p=()=>{e[`min-${t}`]="unset",e[`max-${t}`]="unset"};if(r===void 0)return;if(r==="f"){l(),e[t]=s,p();return}if(i&&Lt(r)){e["flex-grow"]=r.slice(0,-2),e["flex-basis"]="0%",e[`min-${t}`]=n,e[`max-${t}`]="unset";return}let o=i?is(r):null;if(o){e["flex-grow"]="0",e["flex-shrink"]="0",e["flex-basis"]=ns({...o,gapVar:"var(--rtgl-flex-gap, 0px)"}),e[`min-${t}`]=n,e[`max-${t}`]="unset";return}l(),e[t]=r,a&&(e[`min-${t}`]=r,e[`max-${t}`]=r)},Rt=({style:e,width:t,fillValue:r="var(--width-stretch)",allowFlexGrow:s=!0,flexMinWidth:i="0"})=>{if(t==="f"){e.width=r,e.flexGrow="",e.flexBasis="",e.minWidth="";return}if(s&&Lt(t)){e.width="",e.flexGrow=t.slice(0,-2),e.flexShrink="",e.flexBasis="0%",e.minWidth=i;return}let n=s?is(t):null;if(n){e.width="",e.flexGrow="0",e.flexShrink="0",e.flexBasis=ns({...n,gapVar:"var(--rtgl-flex-gap, 0px)"}),e.minWidth=i;return}if(t!=null){e.width=t,e.flexGrow="",e.flexShrink="",e.flexBasis="",e.minWidth="";return}e.width="",e.flexGrow="",e.flexShrink="",e.flexBasis="",e.minWidth=""};function O(e,...t){let r="";return e.forEach((s,i)=>{r+=s+(t[i]||"")}),r}var ya=["sm","md","lg","xl"],as={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 --rtgl-flex-gap",gv:"row-gap --rtgl-flex-gap",gh:"column-gap --rtgl-flex-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",cur:"cursor"},ue=Object.keys(as),J=e=>e.concat(ya.flatMap(t=>e.map(r=>`${t}-${r}`))),os={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)"},Y=(e,t={},r=null)=>{let s="";for(let[i,n]of Object.entries(os)){i!=="default"&&(s+=`${n} {`);for(let[a,l]of Object.entries(e))for(let[p,o]of Object.entries(l)){let u=as[a],c=o.startsWith("--")?`var(${o})`:o,d=i==="default"?a:`${i}-${a}`,h=i==="default"?`h-${a}`:`${i}-h-${a}`,f=(m,g=!1)=>{let y=g?`:host([${m}="${p}"]:hover)`:`:host([${m}="${p}"])`;if(r)return r.split(",").map(_=>`${y} ${_.trim()}`).join(", ");let w=t[a];return w?`${y} ${w}`:y};if(u){let g=u.split(" ").map(y=>`${y}: ${c};`).join(" ");s+=`
16
16
  ${f(d)}{
17
17
  ${g}
18
18
  }
@@ -26,13 +26,13 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
26
26
  ${f(h,!0)}{
27
27
  ${o}
28
28
  }
29
- `}i!=="default"&&(s+="}")}return s};function Ln(e){if(e===null||e.includes("/"))return!1;let t=String(e);return/[0-9]$/.test(t)}var Rn=e=>/%$/.test(e),Nn=e=>/^([1-9]|1[0-2])fg$/.test(e),N=e=>{if(e!==void 0)return Nn(e)||Rn(e)?e:Ln(e)?`${e}px`:Object.keys(S).includes(e)?`var(${S[e]})`:e},S={xs:"--spacing-xs",sm:"--spacing-sm",md:"--spacing-md",lg:"--spacing-lg",xl:"--spacing-xl"};function te(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} {
29
+ `}i!=="default"&&(s+="}")}return s};function ga(e){if(e===null||e.includes("/"))return!1;let t=String(e);return/[0-9]$/.test(t)}var ba=e=>/%$/.test(e),va=e=>/^([1-9]|1[0-2])fg$/.test(e),N=e=>{if(e!=null)return va(e)||ba(e)?e:ga(e)?`${e}px`:Object.keys(S).includes(e)?`var(${S[e]})`:e},S={xs:"--spacing-xs",sm:"--spacing-sm",md:"--spacing-md",lg:"--spacing-lg",xl:"--spacing-xl"};function X(e,t=":host"){let r="",s=["default","xl","lg","md","sm"];for(let i of s){let n=os[i];if(!e[i]||Object.keys(e[i]).length===0)continue;i!=="default"&&(r+=`${n} {
30
30
  `);let a="";for(let[l,p]of Object.entries(e[i]))p!=null&&(a+=`${l}: ${p} !important;
31
31
  `);r+=`${t} {
32
32
  ${a.trim()}
33
33
  }
34
34
  `,i!=="default"&&(r+=`}
35
- `)}return r}var de=(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)||!de(e[i],t[i]))return!1;return!0};var Pn={mt:S,mr:S,mb:S,ml:S,m:S,mh:S,mv:S,s:{sm:`
35
+ `)}return r}var Ee=(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)||!Ee(e[i],t[i]))return!1;return!0};var wa={mt:S,mr:S,mb:S,ml:S,m:S,mh:S,mv:S,s:{sm:`
36
36
  height: 28px;
37
37
  padding-left: 12px;
38
38
  padding-right: 12px;
@@ -81,7 +81,7 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
81
81
  `,lk:`
82
82
  background-color: transparent;
83
83
  color: var(--foreground);
84
- `}},Pr=G(Pn,{},".surface");var Vn=[{prefix:"sm",maxWidth:640},{prefix:"md",maxWidth:768},{prefix:"lg",maxWidth:1024},{prefix:"xl",maxWidth:1280}],vt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(L`
84
+ `}},ls=Y(wa,{},".surface");var _a=[{prefix:"sm",maxWidth:640},{prefix:"md",maxWidth:768},{prefix:"lg",maxWidth:1024},{prefix:"xl",maxWidth:1280}],Nt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
85
85
  :host {
86
86
  display: inline-flex;
87
87
  }
@@ -248,8 +248,8 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
248
248
  color: inherit;
249
249
  }
250
250
 
251
- ${Pr}
252
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._containerElement=null,this._surfaceElement=document.createElement("button"),this._slotElement=document.createElement("slot"),this._prefixIcon=null,this._suffixIcon=null,this._surfaceElement.className="surface",this._surfaceElement.appendChild(this._slotElement),this._onWindowResize=this._onWindowResize.bind(this)}static get observedAttributes(){return["key","href","new-tab","rel","w","pre","suf","disabled","v","s","sq","sm-s","md-s","lg-s","xl-s"]}connectedCallback(){window.addEventListener("resize",this._onWindowResize),this._updateButton()}disconnectedCallback(){window.removeEventListener("resize",this._onWindowResize)}attributeChangedCallback(t,r,s){this._updateButton()}_onWindowResize(){(this.hasAttribute("sm-s")||this.hasAttribute("md-s")||this.hasAttribute("lg-s")||this.hasAttribute("xl-s"))&&this._updateIcon()}_resolveResponsiveSizeToken(){let t=window.innerWidth;for(let{prefix:r,maxWidth:s}of Vn){let i=`${r}-s`;if(t<=s&&this.hasAttribute(i))return this.getAttribute(i)}return this.getAttribute("s")}_updateButton(){this.shadow.innerHTML="";let t=this.hasAttribute("disabled"),r=this.getAttribute("href"),s=this.hasAttribute("new-tab"),i=this.getAttribute("rel"),n=r&&!t,a=n?"a":"button";if(this._surfaceElement.tagName.toLowerCase()!==a){let l=document.createElement(a);l.className="surface",l.appendChild(this._slotElement),this._surfaceElement=l}this._updateIcon(),this.hasAttribute("sq")?(this.style.width="",this.style.minWidth="",this.style.maxWidth="",this._surfaceElement.style.width="",this._surfaceElement.style.minWidth="",this._surfaceElement.style.maxWidth=""):this._updateWidth(),n?(Te({linkElement:this._surfaceElement,href:r,newTab:s,rel:i}),this._surfaceElement.removeAttribute("disabled")):(this._surfaceElement.removeAttribute("href"),this._surfaceElement.removeAttribute("target"),this._surfaceElement.removeAttribute("rel"),t?this._surfaceElement.setAttribute("disabled",""):this._surfaceElement.removeAttribute("disabled")),this.shadow.appendChild(this._surfaceElement),this._containerElement=this._surfaceElement}_updateIcon(){this._prefixIcon&&(this._prefixIcon.remove(),this._prefixIcon=null),this._suffixIcon&&(this._suffixIcon.remove(),this._suffixIcon=null);let t={sm:14,md:18,lg:22},r=this._resolveResponsiveSizeToken(),s=18;this.hasAttribute("sq")?s={sm:14,lg:22}[r]||18:s=t[r]||18;let i=this.getAttribute("pre");i&&(this._prefixIcon=document.createElement("rtgl-svg"),this._prefixIcon.setAttribute("svg",i),this._prefixIcon.setAttribute("wh",s.toString()),this._prefixIcon.style.color="inherit",this._surfaceElement.insertBefore(this._prefixIcon,this._slotElement));let n=this.getAttribute("suf");n&&(this._suffixIcon=document.createElement("rtgl-svg"),this._suffixIcon.setAttribute("svg",n),this._suffixIcon.setAttribute("wh",s.toString()),this._suffixIcon.style.color="inherit",this._surfaceElement.appendChild(this._suffixIcon))}_updateWidth(){let t=N(this.getAttribute("w"));t==="f"?(this.style.width="var(--width-stretch)",this.style.minWidth="",this.style.maxWidth="",this._surfaceElement.style.width="100%",this._surfaceElement.style.minWidth="",this._surfaceElement.style.maxWidth=""):t!=null?(this.style.width=t,this.style.minWidth=t,this.style.maxWidth=t,this._surfaceElement.style.width="100%",this._surfaceElement.style.minWidth="",this._surfaceElement.style.maxWidth=""):(this.style.width="",this.style.minWidth="",this.style.maxWidth="",this._surfaceElement.style.width="",this._surfaceElement.style.minWidth="",this._surfaceElement.style.maxWidth="")}getBoundingClientRect(){return this._surfaceElement?this._surfaceElement.getBoundingClientRect():super.getBoundingClientRect()}},Vr=({render:e,html:t})=>vt;var Dr=L`
251
+ ${ls}
252
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._containerElement=null,this._surfaceElement=document.createElement("button"),this._slotElement=document.createElement("slot"),this._prefixIcon=null,this._suffixIcon=null,this._surfaceElement.className="surface",this._surfaceElement.appendChild(this._slotElement),this._onWindowResize=this._onWindowResize.bind(this)}static get observedAttributes(){return["key","href","new-tab","rel","w","pre","suf","disabled","v","s","sq","sm-s","md-s","lg-s","xl-s"]}connectedCallback(){window.addEventListener("resize",this._onWindowResize),this._updateButton()}disconnectedCallback(){window.removeEventListener("resize",this._onWindowResize)}attributeChangedCallback(t,r,s){this._updateButton()}_onWindowResize(){(this.hasAttribute("sm-s")||this.hasAttribute("md-s")||this.hasAttribute("lg-s")||this.hasAttribute("xl-s"))&&this._updateIcon()}_resolveResponsiveSizeToken(){let t=window.innerWidth;for(let{prefix:r,maxWidth:s}of _a){let i=`${r}-s`;if(t<=s&&this.hasAttribute(i))return this.getAttribute(i)}return this.getAttribute("s")}_updateButton(){this.shadow.innerHTML="";let t=this.hasAttribute("disabled"),r=this.getAttribute("href"),s=this.hasAttribute("new-tab"),i=this.getAttribute("rel"),n=r&&!t,a=n?"a":"button";if(this._surfaceElement.tagName.toLowerCase()!==a){let l=document.createElement(a);l.className="surface",l.appendChild(this._slotElement),this._surfaceElement=l}this._updateIcon(),this.hasAttribute("sq")?(this.style.width="",this.style.minWidth="",this.style.maxWidth="",this._surfaceElement.style.width="",this._surfaceElement.style.minWidth="",this._surfaceElement.style.maxWidth=""):this._updateWidth(),n?(Fe({linkElement:this._surfaceElement,href:r,newTab:s,rel:i}),this._surfaceElement.removeAttribute("disabled")):(this._surfaceElement.removeAttribute("href"),this._surfaceElement.removeAttribute("target"),this._surfaceElement.removeAttribute("rel"),t?this._surfaceElement.setAttribute("disabled",""):this._surfaceElement.removeAttribute("disabled")),this.shadow.appendChild(this._surfaceElement),this._containerElement=this._surfaceElement}_updateIcon(){this._prefixIcon&&(this._prefixIcon.remove(),this._prefixIcon=null),this._suffixIcon&&(this._suffixIcon.remove(),this._suffixIcon=null);let t={sm:14,md:18,lg:22},r=this._resolveResponsiveSizeToken(),s=18;this.hasAttribute("sq")?s={sm:14,lg:22}[r]||18:s=t[r]||18;let i=this.getAttribute("pre");i&&(this._prefixIcon=document.createElement("rtgl-svg"),this._prefixIcon.setAttribute("svg",i),this._prefixIcon.setAttribute("wh",s.toString()),this._prefixIcon.style.color="inherit",this._surfaceElement.insertBefore(this._prefixIcon,this._slotElement));let n=this.getAttribute("suf");n&&(this._suffixIcon=document.createElement("rtgl-svg"),this._suffixIcon.setAttribute("svg",n),this._suffixIcon.setAttribute("wh",s.toString()),this._suffixIcon.style.color="inherit",this._surfaceElement.appendChild(this._suffixIcon))}_updateWidth(){let t=N(this.getAttribute("w"));t==="f"?(this.style.width="var(--width-stretch)",this.style.minWidth="",this.style.maxWidth="",this._surfaceElement.style.width="100%",this._surfaceElement.style.minWidth="",this._surfaceElement.style.maxWidth=""):t!=null?(this.style.width=t,this.style.minWidth=t,this.style.maxWidth=t,this._surfaceElement.style.width="100%",this._surfaceElement.style.minWidth="",this._surfaceElement.style.maxWidth=""):(this.style.width="",this.style.minWidth="",this.style.maxWidth="",this._surfaceElement.style.width="",this._surfaceElement.style.minWidth="",this._surfaceElement.style.maxWidth="")}getBoundingClientRect(){return this._surfaceElement?this._surfaceElement.getBoundingClientRect():super.getBoundingClientRect()}},ps=({render:e,html:t})=>Nt;var cs=O`
253
253
 
254
254
  :host([d="h"]) {
255
255
  flex-direction: row;
@@ -320,7 +320,7 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
320
320
  justify-content: center;
321
321
  }
322
322
  }
323
- `;var Dn={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"}},F=G(Dn);var jr=L`
323
+ `;var xa={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"}},F=Y(xa);var us=O`
324
324
  :host([sh]:not([sv])) {
325
325
  overflow-x: scroll;
326
326
  flex-wrap: nowrap;
@@ -367,7 +367,7 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
367
367
  flex-wrap: nowrap;
368
368
  }
369
369
 
370
- `;var Re={none:"0",xs:"--border-width-xs",sm:"--border-width-sm",md:"--border-width-md",lg:"--border-width-lg",xl:"--border-width-xl"},jn={bgc:{pr:`
370
+ `;var We={none:"0",xs:"--border-width-xs",sm:"--border-width-sm",md:"--border-width-md",lg:"--border-width-lg",xl:"--border-width-xl"},Ea={bgc:{pr:`
371
371
  background-color: var(--primary);
372
372
  `,se:`
373
373
  background-color: var(--secondary);
@@ -407,7 +407,7 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
407
407
  left: 0;
408
408
  top: 0;
409
409
  height: 100%;
410
- `},shadow:{sm:"--shadow-sm",md:"--shadow-md",lg:"--shadow-lg"},pt:S,pr:S,pb:S,pl:S,p:S,ph:S,pv:S,g:S,gv:S,gh:S,bw:Re,bwt:Re,bwr:Re,bwb:Re,bwl:Re,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"}},Br=G(jn);var Bn={mt:S,mr:S,mb:S,ml:S,m:S,mh:S,mv:S},q=G(Bn);var He=L`
410
+ `},shadow:{sm:"--shadow-sm",md:"--shadow-md",lg:"--shadow-lg"},pt:S,pr:S,pb:S,pl:S,p:S,ph:S,pv:S,g:S,gv:S,gh:S,bw:We,bwt:We,bwr:We,bwb:We,bwl:We,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"}},ds=Y(Ea);var Aa={mt:S,mr:S,mb:S,ml:S,m:S,mh:S,mv:S},U=Y(Aa);var ot=O`
411
411
  a, a:link, a:visited, a:hover, a:active {
412
412
  color: inherit;
413
413
  text-decoration: none;
@@ -417,7 +417,7 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
417
417
  margin: 0;
418
418
  font: inherit;
419
419
  }
420
- `;var bt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(L`
420
+ `;var Vt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
421
421
  slot {
422
422
  display: contents;
423
423
  }
@@ -433,14 +433,14 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
433
433
  }
434
434
 
435
435
 
436
- ${jr}
437
- ${Dr}
438
- ${q}
436
+ ${us}
437
+ ${cs}
438
+ ${U}
439
439
  ${F}
440
- ${Br}
441
- ${He}
442
- ${Oe}
443
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),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","new-tab","rel",...ee([...ue,"op","wh","w","h","hide","show","sh","sv","z","d","ah","av","wrap","no-wrap","overflow"])]}_styles=K();_lastStyleString="";_updateDOM(){let t=this.getAttribute("href"),r=this.hasAttribute("new-tab"),s=this.getAttribute("rel");this._linkElement=Le({shadowRoot:this.shadow,slotElement:this._slotElement,linkElement:this._linkElement,href:t,newTab:r,rel:s})}connectedCallback(){this.updateStyles()}updateStyles(){this._styles=K();let t=this.getAttribute("d");ne.forEach(s=>{let i=A=>`${s==="default"?"":`${s}-`}${A}`,n=this.getAttribute(i("wh")),a=N(n===null?this.getAttribute(i("w")):n),l=N(n===null?this.getAttribute(i("h")):n),p=this.getAttribute(i("op")),o=this.getAttribute(i("z"));o!==null&&(this._styles[s]["z-index"]=o),p!==null&&(this._styles[s].opacity=p),H({styleBucket:this._styles[s],axis:"width",dimension:a,fillValue:"var(--width-stretch)",allowFlexGrow:!0}),H({styleBucket:this._styles[s],axis:"height",dimension:l,fillValue:"100%",allowFlexGrow:!0}),this.hasAttribute(i("hide"))&&(this._styles[s].display="none"),this.hasAttribute(i("show"))&&(this._styles[s].display="flex");let c=this.getAttribute(i("d")),u=this.getAttribute(i("ah")),d=this.getAttribute(i("av")),h=c??t;c==="h"?this._styles[s]["flex-direction"]="row":c==="v"?this._styles[s]["flex-direction"]="column":s==="default"&&!c&&["sm","md","lg","xl"].some(E=>this.hasAttribute(`${E}-d`))&&(this._styles[s]["flex-direction"]="column");let f=h==="h",m=h==="v"||!h;f&&(u==="c"?this._styles[s]["justify-content"]="center":u==="e"?this._styles[s]["justify-content"]="flex-end":u==="s"&&(this._styles[s]["justify-content"]="flex-start"),d==="c"?(this._styles[s]["align-items"]="center",this._styles[s]["align-content"]="center"):d==="e"?(this._styles[s]["align-items"]="flex-end",this._styles[s]["align-content"]="flex-end"):d==="s"&&(this._styles[s]["align-items"]="flex-start")),m&&(u!==null||d!==null)&&(u==="c"?this._styles[s]["align-items"]="center":u==="e"?this._styles[s]["align-items"]="flex-end":u==="s"&&(this._styles[s]["align-items"]="flex-start"),d==="c"?this._styles[s]["justify-content"]="center":d==="e"?this._styles[s]["justify-content"]="flex-end":d==="s"&&(this._styles[s]["justify-content"]="flex-start"));let g=this.hasAttribute(i("wrap")),y=this.hasAttribute(i("no-wrap"));g&&(this._styles[s]["flex-wrap"]="wrap"),y&&(this._styles[s]["flex-wrap"]="nowrap");let w=this.hasAttribute(i("sh")),_=this.hasAttribute(i("sv")),x=this.getAttribute(i("overflow"));w&&_?(this._styles[s].overflow="scroll",this._styles[s]["flex-wrap"]="nowrap"):w?(this._styles[s]["overflow-x"]="scroll",this._styles[s]["flex-wrap"]="nowrap"):_&&(this._styles[s]["overflow-y"]="scroll",this._styles[s]["flex-wrap"]="nowrap"),x==="hidden"&&(this._styles[s].overflow="hidden",this._styles[s]["flex-wrap"]="nowrap")});let r=te(this._styles);r!==this._lastStyleString&&(this._styleElement.textContent=r,this._lastStyleString=r)}attributeChangedCallback(t,r,s){if(t==="href"||t==="new-tab"||t==="rel"){this._updateDOM();return}r!==s&&this.updateStyles()}},Wr=({render:e,html:t})=>bt;var Wn={ta:{s:"text-align: start;",c:"text-align: center;",e:"text-align: end;",j:"text-align: justify;"},s:{h1:`
440
+ ${ds}
441
+ ${ot}
442
+ ${je}
443
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),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","new-tab","rel",...J([...ue,"op","wh","w","h","hide","show","sh","sv","z","d","ah","av","wrap","no-wrap","overflow"])]}_styles=G();_lastStyleString="";_updateDOM(){let t=this.getAttribute("href"),r=this.hasAttribute("new-tab"),s=this.getAttribute("rel");this._linkElement=Me({shadowRoot:this.shadow,slotElement:this._slotElement,linkElement:this._linkElement,href:t,newTab:r,rel:s})}connectedCallback(){this.updateStyles()}updateStyles(){this._styles=G(),le.forEach(r=>{let s=x=>`${r==="default"?"":`${r}-`}${x}`,i=this.getAttribute(s("wh")),n=N(i===null?this.getAttribute(s("w")):i),a=N(i===null?this.getAttribute(s("h")):i),l=this.getAttribute(s("op")),p=this.getAttribute(s("z"));p!==null&&(this._styles[r]["z-index"]=p),l!==null&&(this._styles[r].opacity=l),q({styleBucket:this._styles[r],axis:"width",dimension:n,fillValue:"var(--width-stretch)",allowFlexGrow:!0}),q({styleBucket:this._styles[r],axis:"height",dimension:a,fillValue:"100%",allowFlexGrow:!0}),this.hasAttribute(s("hide"))&&(this._styles[r].display="none"),this.hasAttribute(s("show"))&&(this._styles[r].display="flex");let o=this.getAttribute(s("d")),u=this.getAttribute(s("ah")),c=this.getAttribute(s("av")),d=Tt({element:this,size:r,attr:"d"});o==="h"?this._styles[r]["flex-direction"]="row":o==="v"?this._styles[r]["flex-direction"]="column":r==="default"&&!o&&["sm","md","lg","xl"].some(E=>this.hasAttribute(`${E}-d`))&&(this._styles[r]["flex-direction"]="column");let h=d==="h",f=d==="v"||!d;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")),f&&(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 m=this.hasAttribute(s("wrap")),g=this.hasAttribute(s("no-wrap"));m&&(this._styles[r]["flex-wrap"]="wrap"),g&&(this._styles[r]["flex-wrap"]="nowrap");let y=this.hasAttribute(s("sh")),w=this.hasAttribute(s("sv")),_=this.getAttribute(s("overflow"));y&&w?(this._styles[r].overflow="scroll",this._styles[r]["flex-wrap"]="nowrap"):y?(this._styles[r]["overflow-x"]="scroll",this._styles[r]["flex-wrap"]="nowrap"):w&&(this._styles[r]["overflow-y"]="scroll",this._styles[r]["flex-wrap"]="nowrap"),_==="hidden"&&(this._styles[r].overflow="hidden",this._styles[r]["flex-wrap"]="nowrap")});let t=X(this._styles);t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}attributeChangedCallback(t,r,s){if(t==="href"||t==="new-tab"||t==="rel"){this._updateDOM();return}r!==s&&this.updateStyles()}},fs=({render:e,html:t})=>Vt;var ka={ta:{s:"text-align: start;",c:"text-align: center;",e:"text-align: end;",j:"text-align: justify;"},s:{h1:`
444
444
  font-size: var(--h1-font-size);
445
445
  font-weight: var(--h1-font-weight);
446
446
  line-height: var(--h1-line-height);
@@ -480,7 +480,7 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
480
480
  font-weight: var(--xs-font-weight);
481
481
  line-height: var(--xs-line-height);
482
482
  letter-spacing: var(--xs-letter-spacing);
483
- `}},Mr=G(Wn);var Mn={c:{pr:"color: var(--primary);",se:"color: var(--secondary);",de:"color: var(--destructive);",fg:"color: var(--foreground);",bg:"color: var(--background);",mu:"color: var(--muted-foreground);",ac:"color: var(--accent);",bo:"color: var(--border);",tr:"color: transparent;","pr-fg":"color: var(--primary-foreground);","se-fg":"color: var(--secondary-foreground);","de-fg":"color: var(--destructive-foreground);","mu-fg":"color: var(--muted-foreground);","ac-fg":"color: var(--accent-foreground);"}},Ge=G(Mn);var wt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(L`
483
+ `}},hs=Y(ka);var $a={c:{pr:"color: var(--primary);",se:"color: var(--secondary);",de:"color: var(--destructive);",fg:"color: var(--foreground);",bg:"color: var(--background);",mu:"color: var(--muted-foreground);",ac:"color: var(--accent);",bo:"color: var(--border);",tr:"color: transparent;","pr-fg":"color: var(--primary-foreground);","se-fg":"color: var(--secondary-foreground);","de-fg":"color: var(--destructive-foreground);","mu-fg":"color: var(--muted-foreground);","ac-fg":"color: var(--accent-foreground);"}},lt=Y($a);var Pt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
484
484
  :host {
485
485
  display: block;
486
486
  font-size: var(--md-font-size);
@@ -499,12 +499,12 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
499
499
  text-decoration: var(--anchor-text-decoration-hover);
500
500
  color: var(--anchor-color-hover);
501
501
  }
502
- ${Oe}
503
- ${Mr}
504
- ${Ge}
505
- ${q}
502
+ ${je}
503
+ ${hs}
504
+ ${lt}
505
+ ${U}
506
506
  ${F}
507
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._slotElement=document.createElement("slot"),this._linkElement=null,this._updateDOM()}static get observedAttributes(){return["key","w","ellipsis","href","new-tab","rel"]}connectedCallback(){this._updateStyling(),this._updateDOM()}attributeChangedCallback(t,r,s){t==="href"||t==="new-tab"||t==="rel"?this._updateDOM():this._updateStyling()}_updateStyling(){let t=N(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=""),gt({style:this.style,width:t,flexMinWidth:"0"})}_updateDOM(){let t=this.getAttribute("href"),r=this.hasAttribute("new-tab"),s=this.getAttribute("rel");this._linkElement=Le({shadowRoot:this.shadow,slotElement:this._slotElement,linkElement:this._linkElement,href:t,newTab:r,rel:s})}},zr=({render:e,html:t})=>wt;var Ne={none:"0",xs:"--border-width-xs",sm:"--border-width-sm",md:"--border-width-md",lg:"--border-width-lg",xl:"--border-width-xl"},zn={bgc:{pr:"background-color: var(--primary);",se:"background-color: var(--secondary);",de:"background-color: var(--destructive);",fg:"background-color: var(--foreground);",bg:"background-color: var(--background);",mu:"background-color: var(--muted);",ac:"background-color: var(--accent);",bo:"background-color: var(--border);"},pos:{rel:"relative",abs:"absolute",fix:"fixed"},shadow:{sm:"--shadow-sm",md:"--shadow-md",lg:"--shadow-lg"},bw:Ne,bwt:Ne,bwr:Ne,bwb:Ne,bwl:Ne,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"}},Fr=e=>G(zn,{},e);var Fn={mt:S,mr:S,mb:S,ml:S,m:S,mh:S,mv:S},Ur=e=>G(Fn,{},e);var _t=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(L`
507
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._slotElement=document.createElement("slot"),this._linkElement=null,this._updateDOM()}static get observedAttributes(){return["key","w","ellipsis","href","new-tab","rel"]}connectedCallback(){this._updateStyling(),this._updateDOM()}attributeChangedCallback(t,r,s){t==="href"||t==="new-tab"||t==="rel"?this._updateDOM():this._updateStyling()}_updateStyling(){let t=N(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=""),Rt({style:this.style,width:t,flexMinWidth:"0"})}_updateDOM(){let t=this.getAttribute("href"),r=this.hasAttribute("new-tab"),s=this.getAttribute("rel");this._linkElement=Me({shadowRoot:this.shadow,slotElement:this._slotElement,linkElement:this._linkElement,href:t,newTab:r,rel:s})}},ms=({render:e,html:t})=>Pt;var ze={none:"0",xs:"--border-width-xs",sm:"--border-width-sm",md:"--border-width-md",lg:"--border-width-lg",xl:"--border-width-xl"},Sa={bgc:{pr:"background-color: var(--primary);",se:"background-color: var(--secondary);",de:"background-color: var(--destructive);",fg:"background-color: var(--foreground);",bg:"background-color: var(--background);",mu:"background-color: var(--muted);",ac:"background-color: var(--accent);",bo:"background-color: var(--border);"},pos:{rel:"relative",abs:"absolute",fix:"fixed"},shadow:{sm:"--shadow-sm",md:"--shadow-md",lg:"--shadow-lg"},bw:ze,bwt:ze,bwr:ze,bwb:ze,bwl:ze,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"}},ys=e=>Y(Sa,{},e);var Ca={mt:S,mr:S,mb:S,ml:S,m:S,mh:S,mv:S},gs=e=>Y(Ca,{},e);var Dt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
508
508
  :host {
509
509
  display: contents;
510
510
  }
@@ -531,7 +531,7 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
531
531
  height: auto;
532
532
  }
533
533
 
534
- ${He}
534
+ ${ot}
535
535
 
536
536
  a {
537
537
  display: block;
@@ -539,10 +539,10 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
539
539
  width: 100%;
540
540
  }
541
541
 
542
- ${Fr("img, a")}
543
- ${Ur("img, a")}
542
+ ${ys("img, a")}
543
+ ${gs("img, a")}
544
544
  ${F}
545
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),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 ee([...ue,"key","src","alt","href","new-tab","rel","wh","w","h","hide","show","op","z","of"])}_styles=K();_lastStyleString="";_updateDOM(){let t=this.getAttribute("href"),r=this.hasAttribute("new-tab"),s=this.getAttribute("rel");this._linkElement=mt({shadowRoot:this.shadow,childElement:this._imgElement,linkElement:this._linkElement,href:t,newTab:r,rel:s})}connectedCallback(){this._updateImageAttributes(),this.updateStyles()}attributeChangedCallback(t,r,s){if(t==="href"||t==="new-tab"||t==="rel"){this._updateDOM();return}if(t==="src"||t==="alt"){this._updateImageAttributes();return}r!==s&&this.updateStyles()}updateStyles(){this._styles=K(),ne.forEach(r=>{let s=o=>`${r==="default"?"":`${r}-`}${o}`,i=this.getAttribute(s("wh")),n=N(i===null?this.getAttribute(s("w")):i),a=N(i===null?this.getAttribute(s("h")):i),l=this.getAttribute(s("op")),p=this.getAttribute(s("z"));p!==null&&(this._styles[r]["z-index"]=p),l!==null&&(this._styles[r].opacity=l),H({styleBucket:this._styles[r],axis:"width",dimension:n,fillValue:"var(--width-stretch)"}),H({styleBucket:this._styles[r],axis:"height",dimension:a,fillValue:"100%"}),this.hasAttribute(s("hide"))&&(this._styles[r].display="none !important"),this.hasAttribute(s("show"))&&(this._styles[r].display="block !important")});let t=te(this._styles,"img, a");t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}_updateImageAttributes(){let t=this.getAttribute("src"),r=this.getAttribute("alt");t!==null?this._imgElement.setAttribute("src",t):this._imgElement.removeAttribute("src"),r!==null?this._imgElement.setAttribute("alt",r):this._imgElement.removeAttribute("alt")}},Kr=({render:e,html:t})=>_t;var Hr=L`
545
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),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 J([...ue,"key","src","alt","href","new-tab","rel","wh","w","h","hide","show","op","z","of"])}_styles=G();_lastStyleString="";_updateDOM(){let t=this.getAttribute("href"),r=this.hasAttribute("new-tab"),s=this.getAttribute("rel");this._linkElement=Ot({shadowRoot:this.shadow,childElement:this._imgElement,linkElement:this._linkElement,href:t,newTab:r,rel:s})}connectedCallback(){this._updateImageAttributes(),this.updateStyles()}attributeChangedCallback(t,r,s){if(t==="href"||t==="new-tab"||t==="rel"){this._updateDOM();return}if(t==="src"||t==="alt"){this._updateImageAttributes();return}r!==s&&this.updateStyles()}updateStyles(){this._styles=G(),le.forEach(r=>{let s=o=>`${r==="default"?"":`${r}-`}${o}`,i=this.getAttribute(s("wh")),n=N(i===null?this.getAttribute(s("w")):i),a=N(i===null?this.getAttribute(s("h")):i),l=this.getAttribute(s("op")),p=this.getAttribute(s("z"));p!==null&&(this._styles[r]["z-index"]=p),l!==null&&(this._styles[r].opacity=l),q({styleBucket:this._styles[r],axis:"width",dimension:n,fillValue:"var(--width-stretch)"}),q({styleBucket:this._styles[r],axis:"height",dimension:a,fillValue:"100%"}),this.hasAttribute(s("hide"))&&(this._styles[r].display="none !important"),this.hasAttribute(s("show"))&&(this._styles[r].display="block !important")});let t=X(this._styles,"img, a");t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}_updateImageAttributes(){let t=this.getAttribute("src"),r=this.getAttribute("alt");t!==null?this._imgElement.setAttribute("src",t):this._imgElement.removeAttribute("src"),r!==null?this._imgElement.setAttribute("alt",r):this._imgElement.removeAttribute("alt")}},bs=({render:e,html:t})=>Dt;var vs=O`
546
546
  :host([pt="xs"]) svg {
547
547
  padding-top: var(--spacing-xs);
548
548
  }
@@ -658,16 +658,16 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
658
658
  padding-top: var(--spacing-xl);
659
659
  padding-bottom: var(--spacing-xl);
660
660
  }
661
- `;var xt=class e extends HTMLElement{static styleSheet=null;static _icons={};static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(L`
661
+ `;var Bt=class e extends HTMLElement{static styleSheet=null;static _icons={};static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
662
662
  :host {
663
663
  color: var(--foreground);
664
664
  flex-shrink: 0;
665
665
  }
666
- ${Ge}
667
- ${Hr}
668
- ${q}
666
+ ${lt}
667
+ ${vs}
668
+ ${U}
669
669
  ${F}
670
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),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=N(t===null?this.getAttribute("w"):t),s=N(t===null?this.getAttribute("h"):t);r!=null?this.style.width=r:this.style.width="",s!=null?this.style.height=s:this.style.height=""}_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=""}},Gr=({render:e,html:t})=>xt;var Un=["mt","mr","mb","ml","m","mh","mv","cur"],At=class e extends HTMLElement{static styleSheet=null;static inputSpecificAttributes=["type","disabled","s"];static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(L`
670
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),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=N(t===null?this.getAttribute("w"):t),s=N(t===null?this.getAttribute("h"):t);r!=null?this.style.width=r:this.style.width="",s!=null?this.style.height=s:this.style.height=""}_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=""}},ws=({render:e,html:t})=>Bt;var Ia=["mt","mr","mb","ml","m","mh","mv","cur"],jt=class e extends HTMLElement{static styleSheet=null;static inputSpecificAttributes=["type","disabled","min","max","step","s"];static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
671
671
  :host {
672
672
  display: contents;
673
673
  }
@@ -700,9 +700,38 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
700
700
  input:disabled {
701
701
  cursor: not-allowed;
702
702
  }
703
- ${q}
703
+ input[type="date"],
704
+ input[type="time"],
705
+ input[type="datetime-local"] {
706
+ color: var(--foreground);
707
+ min-width: 0;
708
+ }
709
+ input[type="date"]::-webkit-calendar-picker-indicator,
710
+ input[type="time"]::-webkit-calendar-picker-indicator,
711
+ input[type="datetime-local"]::-webkit-calendar-picker-indicator {
712
+ cursor: pointer;
713
+ border-radius: var(--border-radius-sm);
714
+ opacity: 1;
715
+ padding: 2px;
716
+ }
717
+ input[type="date"]::-webkit-datetime-edit,
718
+ input[type="time"]::-webkit-datetime-edit,
719
+ input[type="datetime-local"]::-webkit-datetime-edit {
720
+ color: var(--foreground);
721
+ }
722
+ input[type="date"]::-webkit-datetime-edit-fields-wrapper,
723
+ input[type="time"]::-webkit-datetime-edit-fields-wrapper,
724
+ input[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper {
725
+ padding: 0;
726
+ }
727
+ input[type="date"]::-webkit-date-and-time-value,
728
+ input[type="time"]::-webkit-date-and-time-value,
729
+ input[type="datetime-local"]::-webkit-date-and-time-value {
730
+ text-align: left;
731
+ }
732
+ ${U}
704
733
  ${F}
705
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles=K(),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._onInput),this._inputElement.addEventListener("change",this._onChange)}static get observedAttributes(){return["key","type","placeholder","disabled","value","s",...ee([...Un,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}focus(){this._inputElement.focus()}_onInput=()=>{this.dispatchEvent(new CustomEvent("value-input",{detail:{value:this._inputElement.value},bubbles:!0}))};_onChange=()=>{this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this._inputElement.value},bubbles:!0}))};attributeChangedCallback(t,r,s){if(r!==s){if(t==="key"){this._syncValueAttribute();return}if(t==="value"){this._syncValueAttribute();return}if(t==="placeholder"){this._syncPlaceholderAttribute();return}if(e.inputSpecificAttributes.includes(t)){this._updateInputAttributes();return}this.updateStyles()}}updateStyles(){this._styles=K(),ne.forEach(r=>{let s=o=>`${r==="default"?"":`${r}-`}${o}`,i=this.getAttribute(s("wh")),n=N(i===null?this.getAttribute(s("w")):i),a=N(i===null?this.getAttribute(s("h")):i),l=this.getAttribute(s("op")),p=this.getAttribute(s("z"));p!==null&&(this._styles[r]["z-index"]=p),l!==null&&(this._styles[r].opacity=l),H({styleBucket:this._styles[r],axis:"width",dimension:n,fillValue:"var(--width-stretch)"}),H({styleBucket:this._styles[r],axis:"height",dimension:a,fillValue:"100%"}),this.hasAttribute(s("hide"))&&(this._styles[r].display="none"),this.hasAttribute(s("show"))&&(this._styles[r].display="block")});let t=te(this._styles,"input");t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}_setOrRemoveInputAttribute(t,r){if(r==null||r==="null"){this._inputElement.removeAttribute(t);return}this._inputElement.setAttribute(t,r)}_syncValueAttribute(){this._inputElement.value=this.getAttribute("value")??""}_syncPlaceholderAttribute(){this._setOrRemoveInputAttribute("placeholder",this.getAttribute("placeholder"))}_updateInputAttributes(){let r=this.getAttribute("type")==="password"?"password":"text",s=this.hasAttribute("disabled");this._setOrRemoveInputAttribute("type",r),s?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes(),this._syncValueAttribute(),this._syncPlaceholderAttribute(),this.updateStyles()}},qr=({render:e,html:t})=>At;var Kn=["mt","mr","mb","ml","m","mh","mv","cur"],Et=class e extends HTMLElement{static styleSheet=null;static inputSpecificAttributes=["disabled","step","min","max","s"];static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(L`
734
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles=G(),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._onInput),this._inputElement.addEventListener("change",this._onChange)}static get observedAttributes(){return["key","type","placeholder","disabled","value","min","max","step","s",...J([...Ia,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}focus(){this._inputElement.focus()}_onInput=()=>{this.dispatchEvent(new CustomEvent("value-input",{detail:{value:this._inputElement.value},bubbles:!0}))};_onChange=()=>{this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this._inputElement.value},bubbles:!0}))};attributeChangedCallback(t,r,s){if(r!==s){if(t==="key"){this._syncValueAttribute();return}if(t==="value"){this._syncValueAttribute();return}if(t==="placeholder"){this._syncPlaceholderAttribute();return}if(e.inputSpecificAttributes.includes(t)){this._updateInputAttributes();return}this.updateStyles()}}updateStyles(){this._styles=G(),le.forEach(r=>{let s=o=>`${r==="default"?"":`${r}-`}${o}`,i=this.getAttribute(s("wh")),n=N(i===null?this.getAttribute(s("w")):i),a=N(i===null?this.getAttribute(s("h")):i),l=this.getAttribute(s("op")),p=this.getAttribute(s("z"));p!==null&&(this._styles[r]["z-index"]=p),l!==null&&(this._styles[r].opacity=l),q({styleBucket:this._styles[r],axis:"width",dimension:n,fillValue:"var(--width-stretch)"}),q({styleBucket:this._styles[r],axis:"height",dimension:a,fillValue:"100%"}),this.hasAttribute(s("hide"))&&(this._styles[r].display="none"),this.hasAttribute(s("show"))&&(this._styles[r].display="block")});let t=X(this._styles,"input");t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}_setOrRemoveInputAttribute(t,r){if(r==null||r==="null"){this._inputElement.removeAttribute(t);return}this._inputElement.setAttribute(t,r)}_syncValueAttribute(){this._inputElement.value=this.getAttribute("value")??""}_syncPlaceholderAttribute(){this._setOrRemoveInputAttribute("placeholder",this.getAttribute("placeholder"))}_updateInputAttributes(){let t=this.getAttribute("type"),s=new Set(["text","password","date","time","datetime-local"]).has(t)?t:"text",i=this.getAttribute("min"),n=this.getAttribute("max"),a=this.getAttribute("step"),l=this.hasAttribute("disabled");this._setOrRemoveInputAttribute("type",s),this._setOrRemoveInputAttribute("min",i),this._setOrRemoveInputAttribute("max",n),this._setOrRemoveInputAttribute("step",a),l?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes(),this._syncValueAttribute(),this._syncPlaceholderAttribute(),this.updateStyles()}},be=({render:e,html:t})=>jt;var Oa=be({}),Ue="date",Ft=class extends Oa{connectedCallback(){this.getAttribute("type")!==Ue&&super.setAttribute("type",Ue),super.connectedCallback&&super.connectedCallback()}attributeChangedCallback(t,r,s){if(t==="type"&&s!==Ue){this.getAttribute("type")!==Ue&&super.setAttribute("type",Ue);return}super.attributeChangedCallback&&super.attributeChangedCallback(t,r,s)}},_s=({render:e,html:t})=>Ft;var Ta=be({}),Ke="time",Mt=class extends Ta{connectedCallback(){this.getAttribute("type")!==Ke&&super.setAttribute("type",Ke),super.connectedCallback&&super.connectedCallback()}attributeChangedCallback(t,r,s){if(t==="type"&&s!==Ke){this.getAttribute("type")!==Ke&&super.setAttribute("type",Ke);return}super.attributeChangedCallback&&super.attributeChangedCallback(t,r,s)}},xs=({render:e,html:t})=>Mt;var La=be({}),He="datetime-local",Wt=class extends La{connectedCallback(){this.getAttribute("type")!==He&&super.setAttribute("type",He),super.connectedCallback&&super.connectedCallback()}attributeChangedCallback(t,r,s){if(t==="type"&&s!==He){this.getAttribute("type")!==He&&super.setAttribute("type",He);return}super.attributeChangedCallback&&super.attributeChangedCallback(t,r,s)}},Es=({render:e,html:t})=>Wt;var Ra=["mt","mr","mb","ml","m","mh","mv","cur"],zt=class e extends HTMLElement{static styleSheet=null;static inputSpecificAttributes=["disabled","step","min","max","s"];static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
706
735
  :host {
707
736
  display: contents;
708
737
  }
@@ -735,9 +764,9 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
735
764
  input:disabled {
736
765
  cursor: not-allowed;
737
766
  }
738
- ${q}
767
+ ${U}
739
768
  ${F}
740
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles=K(),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._onInput),this._inputElement.addEventListener("change",this._onChange)}static get observedAttributes(){return["key","placeholder","disabled","value","step","min","max","s",...ee([...Kn,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}focus(){this._inputElement.focus()}_emitValueEvent=t=>{let r=this._inputElement.value;if(r.trim()===""){this.dispatchEvent(new CustomEvent(t,{detail:{value:null},bubbles:!0}));return}let s=parseFloat(r);isNaN(s)||(s=this._clampValueToBounds(s),this._inputElement.value=s.toString(),this.dispatchEvent(new CustomEvent(t,{detail:{value:s},bubbles:!0})))};_onInput=()=>{this._emitValueEvent("value-input")};_onChange=()=>{this._emitValueEvent("value-change")};attributeChangedCallback(t,r,s){if(r!==s){if(t==="key"){this._syncValueAttribute();return}if(t==="value"){this._syncValueAttribute();return}if(t==="placeholder"){this._syncPlaceholderAttribute();return}if(e.inputSpecificAttributes.includes(t)){this._updateInputAttributes(),(t==="min"||t==="max")&&this._syncValueAttribute();return}this.updateStyles()}}updateStyles(){this._styles=K(),ne.forEach(r=>{let s=o=>`${r==="default"?"":`${r}-`}${o}`,i=this.getAttribute(s("wh")),n=N(i===null?this.getAttribute(s("w")):i),a=N(i===null?this.getAttribute(s("h")):i),l=this.getAttribute(s("op")),p=this.getAttribute(s("z"));p!==null&&(this._styles[r]["z-index"]=p),l!==null&&(this._styles[r].opacity=l),H({styleBucket:this._styles[r],axis:"width",dimension:n,fillValue:"var(--width-stretch)"}),H({styleBucket:this._styles[r],axis:"height",dimension:a,fillValue:"100%"}),this.hasAttribute(s("hide"))&&(this._styles[r].display="none"),this.hasAttribute(s("show"))&&(this._styles[r].display="block")});let t=te(this._styles,"input");t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}_setOrRemoveInputAttribute(t,r){if(r==null||r==="null"){this._inputElement.removeAttribute(t);return}this._inputElement.setAttribute(t,r)}_clampValueToBounds(t){let r=t,s=this.getAttribute("min");if(s!==null){let n=parseFloat(s);isNaN(n)||(r=Math.max(r,n))}let i=this.getAttribute("max");if(i!==null){let n=parseFloat(i);isNaN(n)||(r=Math.min(r,n))}return r}_syncValueAttribute(){let t=this.getAttribute("value");if(t==null||t===""){this._inputElement.value="";return}let r=parseFloat(t);if(isNaN(r)){this._inputElement.value="";return}let s=this._clampValueToBounds(r);this._inputElement.value=s.toString()}_syncPlaceholderAttribute(){this._setOrRemoveInputAttribute("placeholder",this.getAttribute("placeholder"))}_updateInputAttributes(){let t=this.getAttribute("step"),r=this.getAttribute("min"),s=this.getAttribute("max"),i=this.hasAttribute("disabled");this._inputElement.setAttribute("type","number"),this._setOrRemoveInputAttribute("step",t),this._setOrRemoveInputAttribute("min",r),this._setOrRemoveInputAttribute("max",s),i?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes(),this._syncValueAttribute(),this._syncPlaceholderAttribute(),this.updateStyles()}},Jr=({render:e,html:t})=>Et;var kt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(L`
769
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles=G(),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._onInput),this._inputElement.addEventListener("change",this._onChange)}static get observedAttributes(){return["key","placeholder","disabled","value","step","min","max","s",...J([...Ra,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}focus(){this._inputElement.focus()}_emitValueEvent=t=>{let r=this._inputElement.value;if(r.trim()===""){this.dispatchEvent(new CustomEvent(t,{detail:{value:null},bubbles:!0}));return}let s=parseFloat(r);isNaN(s)||(s=this._clampValueToBounds(s),this._inputElement.value=s.toString(),this.dispatchEvent(new CustomEvent(t,{detail:{value:s},bubbles:!0})))};_onInput=()=>{this._emitValueEvent("value-input")};_onChange=()=>{this._emitValueEvent("value-change")};attributeChangedCallback(t,r,s){if(r!==s){if(t==="key"){this._syncValueAttribute();return}if(t==="value"){this._syncValueAttribute();return}if(t==="placeholder"){this._syncPlaceholderAttribute();return}if(e.inputSpecificAttributes.includes(t)){this._updateInputAttributes(),(t==="min"||t==="max")&&this._syncValueAttribute();return}this.updateStyles()}}updateStyles(){this._styles=G(),le.forEach(r=>{let s=o=>`${r==="default"?"":`${r}-`}${o}`,i=this.getAttribute(s("wh")),n=N(i===null?this.getAttribute(s("w")):i),a=N(i===null?this.getAttribute(s("h")):i),l=this.getAttribute(s("op")),p=this.getAttribute(s("z"));p!==null&&(this._styles[r]["z-index"]=p),l!==null&&(this._styles[r].opacity=l),q({styleBucket:this._styles[r],axis:"width",dimension:n,fillValue:"var(--width-stretch)"}),q({styleBucket:this._styles[r],axis:"height",dimension:a,fillValue:"100%"}),this.hasAttribute(s("hide"))&&(this._styles[r].display="none"),this.hasAttribute(s("show"))&&(this._styles[r].display="block")});let t=X(this._styles,"input");t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}_setOrRemoveInputAttribute(t,r){if(r==null||r==="null"){this._inputElement.removeAttribute(t);return}this._inputElement.setAttribute(t,r)}_clampValueToBounds(t){let r=t,s=this.getAttribute("min");if(s!==null){let n=parseFloat(s);isNaN(n)||(r=Math.max(r,n))}let i=this.getAttribute("max");if(i!==null){let n=parseFloat(i);isNaN(n)||(r=Math.min(r,n))}return r}_syncValueAttribute(){let t=this.getAttribute("value");if(t==null||t===""){this._inputElement.value="";return}let r=parseFloat(t);if(isNaN(r)){this._inputElement.value="";return}let s=this._clampValueToBounds(r);this._inputElement.value=s.toString()}_syncPlaceholderAttribute(){this._setOrRemoveInputAttribute("placeholder",this.getAttribute("placeholder"))}_updateInputAttributes(){let t=this.getAttribute("step"),r=this.getAttribute("min"),s=this.getAttribute("max"),i=this.hasAttribute("disabled");this._inputElement.setAttribute("type","number"),this._setOrRemoveInputAttribute("step",t),this._setOrRemoveInputAttribute("min",r),this._setOrRemoveInputAttribute("max",s),i?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes(),this._syncValueAttribute(),this._syncPlaceholderAttribute(),this.updateStyles()}},As=({render:e,html:t})=>zt;var Ut=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
741
770
  :host {
742
771
  display: contents;
743
772
  }
@@ -760,9 +789,12 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
760
789
  textarea:focus {
761
790
  border-color: var(--foreground);
762
791
  }
763
- ${q}
792
+ textarea:disabled {
793
+ cursor: not-allowed;
794
+ }
795
+ ${U}
764
796
  ${F}
765
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles={default:{},sm:{},md:{},lg:{},xl:{}},this._lastStyleString="",this._textareaElement=document.createElement("textarea"),this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._textareaElement),this._textareaElement.addEventListener("input",this._onInput),this._textareaElement.addEventListener("change",this._onChange)}_onInput=()=>{this.dispatchEvent(new CustomEvent("value-input",{detail:{value:this._textareaElement.value},bubbles:!0}))};_onChange=()=>{this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this._textareaElement.value},bubbles:!0}))};static get observedAttributes(){return["key","placeholder","disabled","value","cols","rows",...ee([...ue,"wh","w","h","hide","show","op","z"])]}get value(){return this._textareaElement.value}set value(t){this._textareaElement.value=t}connectedCallback(){this._updateTextareaAttributes()}focus(){this._textareaElement&&this._textareaElement.focus()}select(){this._textareaElement&&this._textareaElement.select()}attributeChangedCallback(t,r,s){if(t==="key"){requestAnimationFrame(()=>{let n=this.getAttribute("value");this._textareaElement.value=n??""});return}if(t==="value"&&requestAnimationFrame(()=>{let n=this.getAttribute("value");this._textareaElement.value=n??""}),t==="placeholder"&&requestAnimationFrame(()=>{let n=this.getAttribute("placeholder");n===void 0||n==="null"?this._textareaElement.removeAttribute("placeholder"):this._textareaElement.setAttribute("placeholder",n??"")}),["cols","rows","disabled"].includes(t)){this._updateTextareaAttributes();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(n=>{let a=d=>`${n==="default"?"":`${n}-`}${d}`,l=this.getAttribute(a("wh")),p=N(l===null?this.getAttribute(a("w")):l),o=N(l===null?this.getAttribute(a("h")):l),c=this.getAttribute(a("op")),u=this.getAttribute(a("z"));u!==null&&(this._styles[n]["z-index"]=u),c!==null&&(this._styles[n].opacity=c),p==="f"?this._styles[n].width="var(--width-stretch)":p!==void 0&&(this._styles[n].width=p,this._styles[n]["min-width"]=p,this._styles[n]["max-width"]=p),o==="f"?this._styles[n].height="100%":o!==void 0&&(this._styles[n].height=o,this._styles[n]["min-height"]=o,this._styles[n]["max-height"]=o),this.hasAttribute(a("hide"))&&(this._styles[n].display="none"),this.hasAttribute(a("show"))&&(this._styles[n].display="block")});let i=te(this._styles,"textarea");i!==this._lastStyleString&&(this._styleElement.textContent=i,this._lastStyleString=i)}_updateTextareaAttributes(){let t=this.getAttribute("cols"),r=this.getAttribute("rows"),s=this.hasAttribute("disabled");t!==null?this._textareaElement.setAttribute("cols",t):this._textareaElement.removeAttribute("cols"),r!==null?this._textareaElement.setAttribute("rows",r):this._textareaElement.removeAttribute("rows"),s?this._textareaElement.setAttribute("disabled",""):this._textareaElement.removeAttribute("disabled")}},Yr=({render:e,html:t})=>kt;var Hn=["mt","mr","mb","ml","m","mh","mv","cur"],Gn=/^#[0-9a-fA-F]{6}$/,$t=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(L`
797
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles={default:{},sm:{},md:{},lg:{},xl:{}},this._lastStyleString="",this._textareaElement=document.createElement("textarea"),this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._textareaElement),this._textareaElement.addEventListener("input",this._onInput),this._textareaElement.addEventListener("change",this._onChange)}_onInput=()=>{this.dispatchEvent(new CustomEvent("value-input",{detail:{value:this._textareaElement.value},bubbles:!0}))};_onChange=()=>{this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this._textareaElement.value},bubbles:!0}))};static get observedAttributes(){return["key","placeholder","disabled","value","cols","rows",...J([...ue,"wh","w","h","hide","show","op","z"])]}get value(){return this._textareaElement.value}set value(t){this._textareaElement.value=t}connectedCallback(){this._updateTextareaAttributes()}focus(){this._textareaElement&&this._textareaElement.focus()}select(){this._textareaElement&&this._textareaElement.select()}attributeChangedCallback(t,r,s){if(t==="key"){requestAnimationFrame(()=>{let n=this.getAttribute("value");this._textareaElement.value=n??""});return}if(t==="value"&&requestAnimationFrame(()=>{let n=this.getAttribute("value");this._textareaElement.value=n??""}),t==="placeholder"&&requestAnimationFrame(()=>{let n=this.getAttribute("placeholder");n===void 0||n==="null"?this._textareaElement.removeAttribute("placeholder"):this._textareaElement.setAttribute("placeholder",n??"")}),["cols","rows","disabled"].includes(t)){this._updateTextareaAttributes();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(n=>{let a=d=>`${n==="default"?"":`${n}-`}${d}`,l=this.getAttribute(a("wh")),p=N(l===null?this.getAttribute(a("w")):l),o=N(l===null?this.getAttribute(a("h")):l),u=this.getAttribute(a("op")),c=this.getAttribute(a("z"));c!==null&&(this._styles[n]["z-index"]=c),u!==null&&(this._styles[n].opacity=u),p==="f"?this._styles[n].width="var(--width-stretch)":p!==void 0&&(this._styles[n].width=p,this._styles[n]["min-width"]=p,this._styles[n]["max-width"]=p),o==="f"?this._styles[n].height="100%":o!==void 0&&(this._styles[n].height=o,this._styles[n]["min-height"]=o,this._styles[n]["max-height"]=o),this.hasAttribute(a("hide"))&&(this._styles[n].display="none"),this.hasAttribute(a("show"))&&(this._styles[n].display="block")});let i=X(this._styles,"textarea");i!==this._lastStyleString&&(this._styleElement.textContent=i,this._lastStyleString=i)}_updateTextareaAttributes(){let t=this.getAttribute("cols"),r=this.getAttribute("rows"),s=this.hasAttribute("disabled");t!==null?this._textareaElement.setAttribute("cols",t):this._textareaElement.removeAttribute("cols"),r!==null?this._textareaElement.setAttribute("rows",r):this._textareaElement.removeAttribute("rows"),s?this._textareaElement.setAttribute("disabled",""):this._textareaElement.removeAttribute("disabled")}},ks=({render:e,html:t})=>Ut;var Na=["mt","mr","mb","ml","m","mh","mv","cur"],Va=/^#[0-9a-fA-F]{6}$/,Kt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
766
798
  :host {
767
799
  display: contents;
768
800
  }
@@ -783,9 +815,9 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
783
815
  cursor: not-allowed;
784
816
  opacity: 0.5;
785
817
  }
786
- ${q}
818
+ ${U}
787
819
  ${F}
788
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles=K(),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",...ee([...Hn,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}_onChange=()=>{this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this._inputElement.value},bubbles:!0}))};_onInput=()=>{this.dispatchEvent(new CustomEvent("value-input",{detail:{value:this._inputElement.value},bubbles:!0}))};attributeChangedCallback(t,r,s){if(r!==s){if(t==="key"){this._syncValueAttribute();return}if(["value","disabled"].includes(t)){this._updateInputAttributes();return}this.updateStyles()}}updateStyles(){this._styles=K(),ne.forEach(r=>{let s=o=>`${r==="default"?"":`${r}-`}${o}`,i=this.getAttribute(s("wh")),n=N(i===null?this.getAttribute(s("w")):i),a=N(i===null?this.getAttribute(s("h")):i),l=this.getAttribute(s("op")),p=this.getAttribute(s("z"));p!==null&&(this._styles[r]["z-index"]=p),l!==null&&(this._styles[r].opacity=l),H({styleBucket:this._styles[r],axis:"width",dimension:n,fillValue:"var(--width-stretch)"}),H({styleBucket:this._styles[r],axis:"height",dimension:a,fillValue:"100%"}),this.hasAttribute(s("hide"))&&(this._styles[r].display="none"),this.hasAttribute(s("show"))&&(this._styles[r].display="block")});let t=te(this._styles,'input[type="color"]');t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}_syncValueAttribute(){let t=this.getAttribute("value");if(t===null){this._inputElement.value="#000000";return}this._inputElement.value=Gn.test(t)?t:"#000000"}_updateInputAttributes(){let t=this.hasAttribute("disabled");this._syncValueAttribute(),t?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes(),this.updateStyles()}},Xr=({render:e,html:t})=>$t;var St=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(L`
820
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles=G(),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",...J([...Na,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}_onChange=()=>{this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this._inputElement.value},bubbles:!0}))};_onInput=()=>{this.dispatchEvent(new CustomEvent("value-input",{detail:{value:this._inputElement.value},bubbles:!0}))};attributeChangedCallback(t,r,s){if(r!==s){if(t==="key"){this._syncValueAttribute();return}if(["value","disabled"].includes(t)){this._updateInputAttributes();return}this.updateStyles()}}updateStyles(){this._styles=G(),le.forEach(r=>{let s=o=>`${r==="default"?"":`${r}-`}${o}`,i=this.getAttribute(s("wh")),n=N(i===null?this.getAttribute(s("w")):i),a=N(i===null?this.getAttribute(s("h")):i),l=this.getAttribute(s("op")),p=this.getAttribute(s("z"));p!==null&&(this._styles[r]["z-index"]=p),l!==null&&(this._styles[r].opacity=l),q({styleBucket:this._styles[r],axis:"width",dimension:n,fillValue:"var(--width-stretch)"}),q({styleBucket:this._styles[r],axis:"height",dimension:a,fillValue:"100%"}),this.hasAttribute(s("hide"))&&(this._styles[r].display="none"),this.hasAttribute(s("show"))&&(this._styles[r].display="block")});let t=X(this._styles,'input[type="color"]');t!==this._lastStyleString&&(this._styleElement.textContent=t,this._lastStyleString=t)}_syncValueAttribute(){let t=this.getAttribute("value");if(t===null){this._inputElement.value="#000000";return}this._inputElement.value=Va.test(t)?t:"#000000"}_updateInputAttributes(){let t=this.hasAttribute("disabled");this._syncValueAttribute(),t?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes(),this.updateStyles()}},$s=({render:e,html:t})=>Kt;var Ht=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
789
821
  :host {
790
822
  display: contents;
791
823
  }
@@ -837,9 +869,78 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
837
869
  input[type="range"]:disabled::-moz-range-thumb {
838
870
  cursor: not-allowed;
839
871
  }
840
- ${q}
872
+ ${U}
873
+ ${F}
874
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),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",...J([...ue,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}_onInput=()=>{this.dispatchEvent(new CustomEvent("value-input",{detail:{value:Number(this._inputElement.value)},bubbles:!0}))};_onChange=()=>{this.dispatchEvent(new CustomEvent("value-change",{detail:{value:Number(this._inputElement.value)},bubbles:!0}))};attributeChangedCallback(t,r,s){if(t==="key"&&r!==s){requestAnimationFrame(()=>{let n=this.getAttribute("value"),a=this.getAttribute("min")||"0";this._inputElement.value=n??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(n=>{let a=d=>`${n==="default"?"":`${n}-`}${d}`,l=this.getAttribute(a("wh")),p=N(l===null?this.getAttribute(a("w")):l),o=N(l===null?this.getAttribute(a("h")):l),u=this.getAttribute(a("op")),c=this.getAttribute(a("z"));c!==null&&(this._styles[n]["z-index"]=c),u!==null&&(this._styles[n].opacity=u),p==="f"?this._styles[n].width="var(--width-stretch)":p!==void 0&&(this._styles[n].width=p,this._styles[n]["min-width"]=p,this._styles[n]["max-width"]=p),o==="f"?this._styles[n].height="100%":o!==void 0&&(this._styles[n].height=o,this._styles[n]["min-height"]=o,this._styles[n]["max-height"]=o),this.hasAttribute(a("hide"))&&(this._styles[n].display="none"),this.hasAttribute(a("show"))&&(this._styles[n].display="block")});let i=X(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:this._inputElement.value=r??0,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()}},Ss=({render:e,html:t})=>Ht;var Gt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
875
+ :host {
876
+ display: inline-flex;
877
+ }
878
+ .checkbox-wrapper {
879
+ display: inline-flex;
880
+ align-items: flex-start;
881
+ cursor: pointer;
882
+ color: var(--foreground);
883
+ }
884
+ :host([has-label]) .checkbox-wrapper {
885
+ gap: var(--spacing-sm);
886
+ }
887
+ :host([disabled]) .checkbox-wrapper {
888
+ cursor: not-allowed;
889
+ }
890
+ .checkbox-label {
891
+ display: none;
892
+ font-size: var(--sm-font-size);
893
+ font-weight: var(--sm-font-weight);
894
+ line-height: var(--sm-line-height);
895
+ letter-spacing: var(--sm-letter-spacing);
896
+ user-select: none;
897
+ }
898
+ :host([has-label]) .checkbox-label {
899
+ display: block;
900
+ }
901
+ input[type="checkbox"] {
902
+ -webkit-appearance: none;
903
+ appearance: none;
904
+ width: 18px;
905
+ height: 18px;
906
+ border: 2px solid var(--muted-foreground);
907
+ border-radius: var(--border-radius-sm);
908
+ background: var(--muted);
909
+ cursor: pointer;
910
+ transition: all 0.2s ease;
911
+ position: relative;
912
+ margin: 0;
913
+ flex-shrink: 0;
914
+ }
915
+ input[type="checkbox"]:checked {
916
+ background: var(--muted);
917
+ border-color: var(--foreground);
918
+ }
919
+ input[type="checkbox"]:checked::after {
920
+ content: "";
921
+ position: absolute;
922
+ left: 4px;
923
+ top: 1px;
924
+ width: 6px;
925
+ height: 10px;
926
+ border: solid var(--foreground);
927
+ border-width: 0 2px 2px 0;
928
+ transform: rotate(45deg);
929
+ }
930
+ input[type="checkbox"]:hover {
931
+ border-color: var(--foreground);
932
+ }
933
+ input[type="checkbox"]:focus {
934
+ outline: 2px solid var(--ring);
935
+ outline-offset: 2px;
936
+ }
937
+ input[type="checkbox"]:disabled {
938
+ cursor: not-allowed;
939
+ opacity: 0.5;
940
+ }
941
+ ${U}
841
942
  ${F}
842
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),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",...ee([...ue,"wh","w","h","hide","show","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}_onInput=()=>{this.dispatchEvent(new CustomEvent("value-input",{detail:{value:Number(this._inputElement.value)},bubbles:!0}))};_onChange=()=>{this.dispatchEvent(new CustomEvent("value-change",{detail:{value:Number(this._inputElement.value)},bubbles:!0}))};attributeChangedCallback(t,r,s){if(t==="key"&&r!==s){requestAnimationFrame(()=>{let n=this.getAttribute("value"),a=this.getAttribute("min")||"0";this._inputElement.value=n??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(n=>{let a=d=>`${n==="default"?"":`${n}-`}${d}`,l=this.getAttribute(a("wh")),p=N(l===null?this.getAttribute(a("w")):l),o=N(l===null?this.getAttribute(a("h")):l),c=this.getAttribute(a("op")),u=this.getAttribute(a("z"));u!==null&&(this._styles[n]["z-index"]=u),c!==null&&(this._styles[n].opacity=c),p==="f"?this._styles[n].width="var(--width-stretch)":p!==void 0&&(this._styles[n].width=p,this._styles[n]["min-width"]=p,this._styles[n]["max-width"]=p),o==="f"?this._styles[n].height="100%":o!==void 0&&(this._styles[n].height=o,this._styles[n]["min-height"]=o,this._styles[n]["max-height"]=o),this.hasAttribute(a("hide"))&&(this._styles[n].display="none"),this.hasAttribute(a("show"))&&(this._styles[n].display="block")});let i=te(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:this._inputElement.value=r??0,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()}},Zr=({render:e,html:t})=>St;var Ct=40,qn=6,It=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(L`
943
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles={default:{},sm:{},md:{},lg:{},xl:{}},this._lastStyleString="",this._inputElement=document.createElement("input"),this._inputElement.type="checkbox",this._wrapperElement=document.createElement("label"),this._wrapperElement.className="checkbox-wrapper",this._labelElement=document.createElement("span"),this._labelElement.className="checkbox-label",this._labelSlotElement=document.createElement("slot"),this._labelSlotElement.addEventListener("slotchange",()=>{this._updateLabelState()}),this._labelElement.appendChild(this._labelSlotElement),this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this._wrapperElement.appendChild(this._inputElement),this._wrapperElement.appendChild(this._labelElement),this.shadow.appendChild(this._wrapperElement),this._inputElement.addEventListener("change",this._onChange)}static get observedAttributes(){return["key","checked","disabled","label",...J([...ue,"wh","w","h","hide","show","op","z"])]}get checked(){return this._inputElement.checked}set checked(t){this._inputElement.checked=!!t}get value(){return this._inputElement.checked}set value(t){this._inputElement.checked=!!t}_onChange=()=>{this.dispatchEvent(new CustomEvent("value-change",{detail:{value:this._inputElement.checked},bubbles:!0}))};attributeChangedCallback(t,r,s){if(t==="key"&&r!==s){requestAnimationFrame(()=>{let n=this.hasAttribute("checked");this._inputElement.checked=n});return}if(t==="checked"){this._inputElement.checked=s!==null;return}if(t==="disabled"){s!==null?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled");return}if(t==="label"){this._updateLabelState();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(n=>{let a=d=>`${n==="default"?"":`${n}-`}${d}`,l=this.getAttribute(a("wh")),p=N(l===null?this.getAttribute(a("w")):l),o=N(l===null?this.getAttribute(a("h")):l),u=this.getAttribute(a("op")),c=this.getAttribute(a("z"));c!==null&&(this._styles[n]["z-index"]=c),u!==null&&(this._styles[n].opacity=u),p==="f"?this._styles[n].width="var(--width-stretch)":p!==void 0&&(this._styles[n].width=p,this._styles[n]["min-width"]=p,this._styles[n]["max-width"]=p),o==="f"?this._styles[n].height="100%":o!==void 0&&(this._styles[n].height=o,this._styles[n]["min-height"]=o,this._styles[n]["max-height"]=o),this.hasAttribute(a("hide"))&&(this._styles[n].display="none"),this.hasAttribute(a("show"))&&(this._styles[n].display="block")});let i=X(this._styles,'input[type="checkbox"]');i!==this._lastStyleString&&(this._styleElement.textContent=i,this._lastStyleString=i)}connectedCallback(){let t=this.hasAttribute("checked");this._inputElement.checked=t,this.hasAttribute("disabled")&&this._inputElement.setAttribute("disabled",""),this._updateLabelState()}_updateLabelState(){let t=this.getAttribute("label");this._labelSlotElement.textContent=t??"";let s=this._labelSlotElement.assignedNodes({flatten:!0}).some(n=>n.nodeType===Node.TEXT_NODE?n.textContent.trim().length>0:n.nodeType===Node.ELEMENT_NODE),i=typeof t=="string"&&t.trim().length>0;s||i?this.setAttribute("has-label",""):this.removeAttribute("has-label")}},Cs=({render:e,html:t})=>Gt;var qt=40,Pa=6,Jt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
843
944
  :host {
844
945
  display: contents;
845
946
  }
@@ -916,7 +1017,7 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
916
1017
  animation: none;
917
1018
  }
918
1019
  }
919
- `))}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._adaptiveFrameId=null,this._layoutRetryCount=0,this._observedContentElement=null,this._resizeObserver=typeof ResizeObserver<"u"?new ResizeObserver(()=>{this._scheduleAdaptiveCentering()}):null,this._onSlotChange=()=>{this._observeAssignedContent(),this._scheduleAdaptiveCentering({resetRetries:!0})},this._onWindowResize=()=>{this._scheduleAdaptiveCentering({resetRetries:!0})},this._mouseDownInContent=!1,this._dialogElement.addEventListener("mousedown",t=>{this._mouseDownInContent=t.target!==this._dialogElement}),this._dialogElement.addEventListener("click",t=>{t.target===this._dialogElement&&!this._mouseDownInContent&&this._attemptClose(),this._mouseDownInContent=!1}),this._dialogElement.addEventListener("contextmenu",t=>{t.target===this._dialogElement&&!this._mouseDownInContent&&(t.preventDefault(),this._attemptClose()),this._mouseDownInContent=!1}),this._dialogElement.addEventListener("cancel",t=>{t.preventDefault(),this._attemptClose()})}_attemptClose(){this.dispatchEvent(new CustomEvent("close",{detail:{},bubbles:!0}))}static get observedAttributes(){return["open","w","s"]}connectedCallback(){this._updateDialog(),this._isConnected=!0,this.hasAttribute("open")&&this._showModal()}disconnectedCallback(){this._isConnected=!1,this._stopAdaptiveObservers(),this._slotElement&&this._slotElement.removeEventListener("slotchange",this._onSlotChange),this._dialogElement.open&&this._dialogElement.close()}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._slotElement.addEventListener("slotchange",this._onSlotChange),this._dialogElement.appendChild(this._slotElement)),this._dialogElement.showModal(),this._dialogElement.scrollTop=0,window.addEventListener("resize",this._onWindowResize),this._observeAssignedContent(),this._scheduleAdaptiveCentering({resetRetries:!0}))}_hideModal(){this._dialogElement.open&&(this._stopAdaptiveObservers(),this._dialogElement.close(),this._slotElement&&(this._slotElement.removeEventListener("slotchange",this._onSlotChange),this._slotElement.style.marginTop="",this._slotElement.style.marginBottom="",this._dialogElement.removeChild(this._slotElement),this._slotElement=null),this._dialogElement.style.height="")}_stopAdaptiveObservers(){this._adaptiveFrameId!==null&&(cancelAnimationFrame(this._adaptiveFrameId),this._adaptiveFrameId=null),this._layoutRetryCount=0,window.removeEventListener("resize",this._onWindowResize),this._resizeObserver&&this._observedContentElement&&this._resizeObserver.unobserve(this._observedContentElement),this._observedContentElement=null}_getAssignedContentElement(){if(!this._slotElement)return null;let t=this._slotElement.assignedElements({flatten:!0});return t.length>0?t[0]:null}_observeAssignedContent(){if(!this._resizeObserver)return;let t=this._getAssignedContentElement();this._observedContentElement!==t&&(this._observedContentElement&&this._resizeObserver.unobserve(this._observedContentElement),this._observedContentElement=t,this._observedContentElement&&this._resizeObserver.observe(this._observedContentElement))}_scheduleAdaptiveCentering({resetRetries:t=!1}={}){!this._slotElement||!this._dialogElement.open||(t&&(this._layoutRetryCount=0),this._adaptiveFrameId!==null&&cancelAnimationFrame(this._adaptiveFrameId),this._adaptiveFrameId=requestAnimationFrame(()=>{this._adaptiveFrameId=requestAnimationFrame(()=>{this._adaptiveFrameId=null,this._applyAdaptiveCentering()})}))}_applyAdaptiveCentering(){if(!this._slotElement||!this._dialogElement.open)return;this._observeAssignedContent();let t=this._getAssignedContentElement(),r=t?Math.round(t.getBoundingClientRect().height):0;if(r<=0){this._layoutRetryCount<qn&&(this._layoutRetryCount+=1,this._scheduleAdaptiveCentering());return}this._layoutRetryCount=0;let s=window.innerHeight;if(r>=s-2*Ct){this._slotElement.style.marginTop=`${Ct}px`,this._slotElement.style.marginBottom=`${Ct}px`,this._dialogElement.style.height="100vh";return}let i=s-r,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}},Qr=({render:e,html:t})=>It;var Ot=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(L`
1020
+ `))}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._adaptiveFrameId=null,this._layoutRetryCount=0,this._observedContentElement=null,this._resizeObserver=typeof ResizeObserver<"u"?new ResizeObserver(()=>{this._scheduleAdaptiveCentering()}):null,this._onSlotChange=()=>{this._observeAssignedContent(),this._scheduleAdaptiveCentering({resetRetries:!0})},this._onWindowResize=()=>{this._scheduleAdaptiveCentering({resetRetries:!0})},this._mouseDownInContent=!1,this._dialogElement.addEventListener("mousedown",t=>{this._mouseDownInContent=t.target!==this._dialogElement}),this._dialogElement.addEventListener("click",t=>{t.target===this._dialogElement&&!this._mouseDownInContent&&this._attemptClose(),this._mouseDownInContent=!1}),this._dialogElement.addEventListener("contextmenu",t=>{t.target===this._dialogElement&&!this._mouseDownInContent&&(t.preventDefault(),this._attemptClose()),this._mouseDownInContent=!1}),this._dialogElement.addEventListener("cancel",t=>{t.preventDefault(),this._attemptClose()})}_attemptClose(){this.dispatchEvent(new CustomEvent("close",{detail:{},bubbles:!0}))}static get observedAttributes(){return["open","w","s"]}connectedCallback(){this._updateDialog(),this._isConnected=!0,this.hasAttribute("open")&&this._showModal()}disconnectedCallback(){this._isConnected=!1,this._stopAdaptiveObservers(),this._slotElement&&this._slotElement.removeEventListener("slotchange",this._onSlotChange),this._dialogElement.open&&this._dialogElement.close()}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._slotElement.addEventListener("slotchange",this._onSlotChange),this._dialogElement.appendChild(this._slotElement)),this._dialogElement.showModal(),this._dialogElement.scrollTop=0,window.addEventListener("resize",this._onWindowResize),this._observeAssignedContent(),this._scheduleAdaptiveCentering({resetRetries:!0}))}_hideModal(){this._dialogElement.open&&(this._stopAdaptiveObservers(),this._dialogElement.close(),this._slotElement&&(this._slotElement.removeEventListener("slotchange",this._onSlotChange),this._slotElement.style.marginTop="",this._slotElement.style.marginBottom="",this._dialogElement.removeChild(this._slotElement),this._slotElement=null),this._dialogElement.style.height="")}_stopAdaptiveObservers(){this._adaptiveFrameId!==null&&(cancelAnimationFrame(this._adaptiveFrameId),this._adaptiveFrameId=null),this._layoutRetryCount=0,window.removeEventListener("resize",this._onWindowResize),this._resizeObserver&&this._observedContentElement&&this._resizeObserver.unobserve(this._observedContentElement),this._observedContentElement=null}_getAssignedContentElement(){if(!this._slotElement)return null;let t=this._slotElement.assignedElements({flatten:!0});return t.length>0?t[0]:null}_observeAssignedContent(){if(!this._resizeObserver)return;let t=this._getAssignedContentElement();this._observedContentElement!==t&&(this._observedContentElement&&this._resizeObserver.unobserve(this._observedContentElement),this._observedContentElement=t,this._observedContentElement&&this._resizeObserver.observe(this._observedContentElement))}_scheduleAdaptiveCentering({resetRetries:t=!1}={}){!this._slotElement||!this._dialogElement.open||(t&&(this._layoutRetryCount=0),this._adaptiveFrameId!==null&&cancelAnimationFrame(this._adaptiveFrameId),this._adaptiveFrameId=requestAnimationFrame(()=>{this._adaptiveFrameId=requestAnimationFrame(()=>{this._adaptiveFrameId=null,this._applyAdaptiveCentering()})}))}_applyAdaptiveCentering(){if(!this._slotElement||!this._dialogElement.open)return;this._observeAssignedContent();let t=this._getAssignedContentElement(),r=t?Math.round(t.getBoundingClientRect().height):0;if(r<=0){this._layoutRetryCount<Pa&&(this._layoutRetryCount+=1,this._scheduleAdaptiveCentering());return}this._layoutRetryCount=0;let s=window.innerHeight;if(r>=s-2*qt){this._slotElement.style.marginTop=`${qt}px`,this._slotElement.style.marginBottom=`${qt}px`,this._dialogElement.style.height="100vh";return}let i=s-r,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}},Is=({render:e,html:t})=>Jt;var Yt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(O`
920
1021
  :host {
921
1022
  display: contents;
922
1023
  }
@@ -970,9 +1071,9 @@ var rettangoli=(()=>{var In=Object.defineProperty;var R=(e,t)=>{for(var r in t)I
970
1071
  min-width: 200px;
971
1072
  max-width: 400px;
972
1073
  }
973
- `))}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._dialogElement.addEventListener("click",t=>{t.stopPropagation();let r=t.composedPath();(r[0]===this._dialogElement||r[0].nodeName==="DIALOG"&&r[0]===this._dialogElement)&&this._emitClose()}),this._dialogElement.addEventListener("contextmenu",t=>{let r=t.composedPath();(r[0]===this._dialogElement||r[0].nodeName==="DIALOG"&&r[0]===this._dialogElement)&&(t.preventDefault(),this._emitClose())}),this._dialogElement.addEventListener("cancel",t=>{t.preventDefault(),this._emitClose()}),this._popoverContainer=document.createElement("div"),this._popoverContainer.className="popover-container",this._dialogElement.appendChild(this._popoverContainer),this._slotElement=null,this._isOpen=!1}_emitClose(){this.dispatchEvent(new CustomEvent("close",{detail:{},bubbles:!0}))}static get observedAttributes(){return["open","x","y","place","no-overlay"]}connectedCallback(){this.hasAttribute("open")&&this._show()}disconnectedCallback(){this._isOpen&&this._dialogElement.open&&this._dialogElement.close()}attributeChangedCallback(t,r,s){t==="open"?s!==null&&!this._isOpen?this.isConnected&&this._show():s===null&&this._isOpen&&this._hide():(t==="x"||t==="y"||t==="place")&&this._isOpen?this._updatePosition():t==="no-overlay"&&r!==s&&this._isOpen&&(this._hide(),this._show())}_show(){this._isOpen||(this._slotElement||(this._slotElement=document.createElement("slot"),this._slotElement.setAttribute("name","content"),this._popoverContainer.appendChild(this._slotElement)),this._isOpen=!0,this._dialogElement.open||setTimeout(()=>{this._dialogElement&&!this._dialogElement.open&&(this.hasAttribute("no-overlay")?this._dialogElement.show():this._dialogElement.showModal())},0),requestAnimationFrame(()=>{this._updatePosition()}))}_hide(){this._isOpen&&(this._isOpen=!1,this._dialogElement.open&&this._dialogElement.close(),this._slotElement&&(this._popoverContainer.removeChild(this._slotElement),this._slotElement=null))}_updatePosition(){let t=parseFloat(this.getAttribute("x")||"0"),r=parseFloat(this.getAttribute("y")||"0"),s=this.getAttribute("place")||"bs";this.removeAttribute("positioned"),requestAnimationFrame(()=>{let i=this._popoverContainer.getBoundingClientRect(),{left:n,top:a}=this._calculatePosition(t,r,i.width,i.height,s);this._popoverContainer.style.left=`${n}px`,this._popoverContainer.style.top=`${a}px`,requestAnimationFrame(()=>{this.setAttribute("positioned","")})})}_calculatePosition(t,r,s,i,n){let l=t,p=r;switch(n){case"t":l=t-s/2,p=r-i-8;break;case"ts":l=t,p=r-i-8;break;case"te":l=t-s,p=r-i-8;break;case"r":l=t+8,p=r-i/2;break;case"rs":l=t+8,p=r;break;case"re":l=t+8,p=r-i;break;case"b":l=t-s/2,p=r+8;break;case"bs":l=t,p=r+8;break;case"be":l=t-s,p=r+8;break;case"l":l=t-s-8,p=r-i/2;break;case"ls":l=t-s-8,p=r;break;case"le":l=t-s-8,p=r-i;break;default:l=t,p=r+8;break}let o=8;return l=Math.max(o,Math.min(l,window.innerWidth-s-o)),p=Math.max(o,Math.min(p,window.innerHeight-i-o)),{left:l,top:p}}get popover(){return this._popoverContainer}},es=({render:e,html:t})=>Ot;var Tt={};R(Tt,{handleClickHeader:()=>Jn});var Jn=(e,t)=>{let{store:r,render:s}=e;r.toggleOpen({}),s()};var ts={componentName:"rtgl-accordion-item",propsSchema:{type:"object",properties:{label:{type:"string"},content:{type:"string"},w:{type:"string"}}},events:[],methods:{type:"object",properties:{}}};var Lt={};R(Lt,{createInitialState:()=>Yn,selectViewData:()=>Qn,toggleOpen:()=>ea});var Yn=()=>Object.freeze({open:!1}),Xn=["id","class","style","slot","label","content"],Zn=(e={})=>Object.entries(e).filter(([t])=>!Xn.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Qn=({state:e,props:t})=>({label:t.label||"",content:t.content||"",openClass:e.open?"content-wrapper open":"content-wrapper",chevronIcon:e.open?"chevronUp":"chevronDown",containerAttrString:Zn(t)}),ea=({state:e})=>{e.open=!e.open};var rs={refs:{header:{eventListeners:{click:{handler:"handleClickHeader"}}}},styles:{".content-wrapper":{display:"grid","grid-template-rows":"0fr",transition:"grid-template-rows 0.2s ease-out"},".content-wrapper.open":{"grid-template-rows":"1fr"},".content-inner":{overflow:"hidden"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=v ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view#header d=h av=c w=f pv=md cur=pointer",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"label"}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=1fg",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:"rtgl-svg svg=${chevronIcon} wh=16 c=mu-fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg svg=",{type:1,path:"chevronIcon"}," wh=16 c=mu-fg"]}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:'div class="${openClass}"',value:{type:9,items:[{type:8,properties:[{key:"div class=content-inner",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view pb=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:1,path:"content"}}],fast:!0},{type:8,properties:[{key:"slot name=content",value:{type:0,value:null}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:['div class="',{type:1,path:"openClass"},'"']}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view d=v ",{type:1,path:"containerAttrString"}]}}],fast:!0}],fast:!0}};var Rt={};R(Rt,{handleClickItem:()=>ta});var ta=(e,t)=>{let{dispatchEvent:r,props:s}=e,i=t._event,n=Number(i.currentTarget.dataset.index),a=Array.isArray(s.items)?s.items[n]:void 0;if(!a)return;if(a.disabled||a.current){i.preventDefault();return}typeof a.href=="string"&&a.href.length>0||i.preventDefault(),r(new CustomEvent("item-click",{detail:{id:a.id,path:a.path,href:a.href,item:a,index:n,trigger:i.type}}))};var ss={componentName:"rtgl-breadcrumb",propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"},href:{type:"string"},path:{type:"string"},current:{type:"boolean"},disabled:{type:"boolean"},click:{type:"boolean"},newTab:{type:"boolean"},rel:{type:"string"}}}},sep:{type:"string",default:"breadcrumb-arrow"},max:{type:"number"}}},events:{"item-click":{type:"object",properties:{id:{type:"string"},path:{type:"string"},href:{type:"string"},item:{type:"object"},index:{type:"number"},trigger:{type:"string"}}}},methods:{type:"object",properties:{}}};var Nt={};R(Nt,{createInitialState:()=>ra,selectViewData:()=>pa});var ra=()=>Object.freeze({}),sa=["id","class","style","slot","items","sep","max","separator"],ia=(e={})=>Object.entries(e).filter(([t])=>!sa.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),na=e=>{if(e==null||e==="")return;let t=Number(e);return Number.isNaN(t)?void 0:t},aa=e=>`${e}`.replace(/"/g,"&quot;"),oa=(e,t)=>{if(!t||t<3||e.length<=t)return e;let r=t-2;return[e[0],{isEllipsis:!0,label:"..."},...e.slice(-r)]},la=e=>e.map((t,r)=>{let s=typeof t.href=="string"&&t.href.length>0,i=t.path!==void 0&&t.path!==null&&`${t.path}`!="",n=!!t.current,a=!!t.disabled,l=!n&&!a&&(s||i||!!t.click),p=t.rel||(t.newTab?"noopener noreferrer":""),o=[t.newTab?'target="_blank"':"",p?`rel="${aa(p)}"`:""].filter(Boolean).join(" ");return{...t,label:t.label||"",index:r,href:s?t.href:void 0,path:i?t.path:void 0,isCurrent:n,isDisabled:a,isInteractive:l,linkExtraAttrs:o,c:n?"fg":"mu-fg"}}),pa=({props:e})=>{let t=ia(e),r=Array.isArray(e.items)?e.items:[],s=na(e.max),i=e.sep||"breadcrumb-arrow",n=la(r),a=oa(n,s),l=[];return a.forEach((p,o)=>{l.push(p),o<a.length-1&&l.push({isSeparator:!0})}),{containerAttrString:t,items:l,sep:i}};var is={refs:{"item*":{eventListeners:{click:{handler:"handleClickItem"}}}},styles:{a:{"text-decoration":"none",color:"inherit"}},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:"i",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.isEllipsis"},{type:4,op:6,left:{type:1,path:"item.isInteractive"},right:{type:1,path:"item.href"}},{type:1,path:"item.isInteractive"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-svg wh=16 svg=${sep} c=mu-fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg wh=16 svg=",{type:1,path:"sep"}," c=mu-fg"]}}],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},{type:9,items:[{type:8,properties:[{key:"a#item${i} href=${item.href} ${item.linkExtraAttrs} data-index=${item.index}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a#item",{type:1,path:"i"}," href=",{type:1,path:"item.href"}," ",{type:1,path:"item.linkExtraAttrs"}," data-index=",{type:1,path:"item.index"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#item${i} data-index=${item.index} cur=pointer",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#item",{type:1,path:"i"}," data-index=",{type:1,path:"item.index"}," cur=pointer"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.c"}]}}],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={};R(Pt,{handleClickMenuItem:()=>ua,handleClosePopover:()=>ca});var ca=(e,t)=>{let{dispatchEvent:r}=e;r(new CustomEvent("close"))},ua=(e,t)=>{let{dispatchEvent:r,props:s}=e,i=t._event,n=Number(i.currentTarget.dataset.index??i.currentTarget.id.slice(6)),a=s.items[n],l=a?.type||"item";if(!a||l!=="item"||a.disabled){i.preventDefault();return}a.href||i.preventDefault(),r(new CustomEvent("item-click",{detail:{index:n,item:a,id:a.id,path:a.path,href:a.href,trigger:i.type}}))};var ns={componentName:"rtgl-dropdown-menu",propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},type:{type:"string",enum:["label","item","separator"]},id:{type:"string"},path:{type:"string"},href:{type:"string"},disabled:{type:"boolean"},newTab:{type:"boolean"},rel:{type:"string"},testId:{type:"string"}}}},open:{type:"string"},x:{type:"string"},y:{type:"string"},place:{type:"string"},w:{type:"string"},h:{type:"string"}}},events:{close:{type:"object"},"item-click":{type:"object",properties:{index:{type:"number"},item:{type:"object"},id:{type:"string"},path:{type:"string"},href:{type:"string"},trigger:{type:"string"}}}},methods:{type:"object",properties:{}}};var Vt={};R(Vt,{createInitialState:()=>da,selectViewData:()=>ma});var da=()=>Object.freeze({}),fa=e=>`${e}`.replace(/"/g,"&quot;"),ha=e=>e.map((t,r)=>{let s=t.type||"item",i=s==="separator",n=s==="label",a=s==="item",l=!!t.disabled,p=a&&!l,o=l?"mu-fg":"fg",c=l?"mu":"",u=l?"":"ac",d=typeof t.href=="string"&&t.href.length>0,h=t.rel||(t.newTab?"noopener noreferrer":""),f=[t.newTab?'target="_blank"':"",h?`rel="${fa(h)}"`:""].filter(Boolean).join(" ");return{...t,index:r,type:s,isSeparator:i,isLabel:n,isItem:a,isDisabled:l,isInteractive:p,hasHref:d,linkExtraAttrs:f,c:o,bgc:c,hoverBgc:u}}),ma=({props:e})=>{let t=Array.isArray(e.items)?e.items:[];return{items:ha(t),open:!!e.open,x:e.x||0,y:e.y||0,w:e.w||"300",h:e.h||"300",place:e.place||"bs"}};var as={refs:{popover:{eventListeners:{close:{handler:"handleClosePopover"}}},"option*":{eventListeners:{click:{handler:"handleClickMenuItem"}}}},styles:{a:{display:"block",width:"100%","text-decoration":"none",color:"inherit"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-popover#popover ?open=${open} x=${x} y=${y} place=${place}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=${w} h=${h} sv g=xs slot=content bgc=mu 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.isLabel",value:{type:6,conditions:[{type:1,path:"item.isLabel"},{type:4,op:6,left:{type:1,path:"item.isItem"},right:{type:1,path:"item.isDisabled"}},{type:4,op:6,left:{type:1,path:"item.isItem"},right:{type:4,op:6,left:{type:1,path:"item.hasHref"},right:{type:1,path:"item.linkExtraAttrs"}}},{type:4,op:6,left:{type:1,path:"item.isItem"},right:{type:1,path:"item.hasHref"}},{type:1,path:"item.isItem"},{type:1,path:"item.isSeparator"}],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 w=f ph=lg pv=md br=md bgc=${item.bgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view w=f ph=lg pv=md br=md bgc=",{type:1,path:"item.bgc"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"a#option${i} href=${item.href} ${item.linkExtraAttrs} data-index=${item.index} data-testid=${item.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h-bgc=${item.hoverBgc} ph=lg pv=md cur=pointer br=md bgc=${item.bgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view w=f h-bgc=",{type:1,path:"item.hoverBgc"}," ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"item.bgc"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a#option",{type:1,path:"i"}," href=",{type:1,path:"item.href"}," ",{type:1,path:"item.linkExtraAttrs"}," data-index=",{type:1,path:"item.index"}," data-testid=",{type:1,path:"item.testId"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"a#option${i} href=${item.href} data-index=${item.index} data-testid=${item.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h-bgc=${item.hoverBgc} ph=lg pv=md cur=pointer br=md bgc=${item.bgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view w=f h-bgc=",{type:1,path:"item.hoverBgc"}," ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"item.bgc"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a#option",{type:1,path:"i"}," href=",{type:1,path:"item.href"}," data-index=",{type:1,path:"item.index"}," data-testid=",{type:1,path:"item.testId"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#option${i} w=f h-bgc=${item.hoverBgc} ph=lg pv=md cur=pointer br=md bgc=${item.bgc} data-index=${item.index} data-testid=${item.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#option",{type:1,path:"i"}," w=f h-bgc=",{type:1,path:"item.hoverBgc"}," ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"item.bgc"}," data-index=",{type:1,path:"item.index"}," data-testid=",{type:1,path:"item.testId"}]}}],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},parsedKey:{type:2,parts:["rtgl-view w=",{type:1,path:"w"}," h=",{type:1,path:"h"}," sv g=xs slot=content bgc=mu br=md"]}}],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"}," place=",{type:1,path:"place"}]}}],fast:!1}],fast:!1}};var Dt={};R(Dt,{handleActionClick:()=>_a,handleAfterMount:()=>va,handleBeforeMount:()=>ga,handleImageClick:()=>Aa,handleInputChange:()=>xa,handleKeyDown:()=>Ca,handleOnUpdate:()=>ba,handleSelectAddOption:()=>ka,handleTooltipMouseEnter:()=>$a,handleTooltipMouseLeave:()=>Sa,handleWaveformClick:()=>Ea});var os=({form:e,defaultValues:t={},refs:r})=>{let{fields:s=[]}=e;s.forEach((i,n)=>{let a=r[`field${n}`];if(a){if(["input-textarea","input-text","input-number","color-picker","slider","slider-input","popover-input"].includes(i.inputType)){let l=t[i.name];l==null?a.removeAttribute("value"):a.setAttribute("value",l)}["input-text","input-textarea"].includes(i.inputType)&&i.placeholder&&a.getAttribute("placeholder")!==i.placeholder&&(i.placeholder===void 0||i.placeholder===null?a.removeAttribute("placeholder"):a.setAttribute("placeholder",i.placeholder))}})},ya=e=>{for(let t in e)if(t.startsWith("field")){let r=e[t];if(r&&r.focus){r.focus();return}}},ga=e=>{let{store:t,props:r}=e;t.setFormValues({formValues:r.defaultValues})},va=e=>{let{props:t,refs:r,render:s}=e,{form:i={},defaultValues:n}=t;os({form:i,defaultValues:n,refs:r}),s(),t?.autofocus&&setTimeout(()=>{ya(r)},50)},ba=(e,t)=>{let{oldProps:r,newProps:s}=t,{store:i,render:n,refs:a}=e,{form:l={},defaultValues:p}=s;if(r?.key!==s?.key){os({form:l,defaultValues:p,refs:a}),i.setFormValues({formValues:p}),n();return}n()},wa=(e,t,r,s)=>{s(new CustomEvent("form-change",{detail:{name:e,fieldValue:t,formValues:r}}))},_a=(e,t)=>{let{store:r,dispatchEvent:s}=e,i=t._event,n=i.currentTarget.dataset.actionId||i.currentTarget.id.slice(6);s(new CustomEvent("action-click",{detail:{actionId:n,formValues:r.selectFormValues()}}))},xa=(e,t)=>{let{store:r,dispatchEvent:s}=e,i=t._event,n=i.currentTarget.dataset.fieldName||i.currentTarget.id.slice(5);if(n&&i.detail&&Object.prototype.hasOwnProperty.call(i.detail,"value")){let a=i.detail.value;r.setFormFieldValue({name:n,value:a}),wa(n,a,r.selectFormValues(),s)}},Aa=(e,t)=>{let r=t._event;r.type==="contextmenu"&&r.preventDefault();let{dispatchEvent:s}=e,i=r.currentTarget.dataset.fieldName||r.currentTarget.id.slice(5);s(new CustomEvent("extra-event",{detail:{name:i,x:r.clientX,y:r.clientY,trigger:r.type}}))},Ea=(e,t)=>{let r=t._event;r.type==="contextmenu"&&r.preventDefault();let{dispatchEvent:s}=e,i=r.currentTarget.dataset.fieldName||r.currentTarget.id.slice(8);s(new CustomEvent("extra-event",{detail:{name:i,x:r.clientX,y:r.clientY,trigger:r.type}}))},ka=(e,t)=>{let{store:r,dispatchEvent:s}=e,i=t._event,n=i.currentTarget.dataset.fieldName||i.currentTarget.id.slice(5);s(new CustomEvent("action-click",{detail:{actionId:"select-options-add",name:n,formValues:r.selectFormValues()}}))},$a=(e,t)=>{let{store:r,render:s,props:i}=e,n=t._event,a=n.currentTarget.dataset.fieldName||n.currentTarget.id.slice(11),p=i.form.fields.find(o=>o.name===a);if(p&&p.tooltip){let o=n.currentTarget.getBoundingClientRect();r.showTooltip({x:o.left+o.width/2,y:o.top-8,content:p.tooltip.content}),s()}},Sa=e=>{let{store:t,render:r}=e;t.hideTooltip({}),r()},Ca=(e,t)=>{let{store:r,dispatchEvent:s,props:i}=e,n=t._event;if(n.key==="Enter"&&!n.shiftKey){let a=n.target;if(a.tagName==="TEXTAREA"||a.tagName==="RTGL-TEXTAREA")return;n.preventDefault();let o=((i.form||{}).actions||{}).buttons||[];if(o.length>0){let c=o[0].id,u=r.selectFormValues();s(new CustomEvent("action-click",{detail:{actionId:c,formValues:u}}))}}};var ls={componentName:"rtgl-form",propsSchema:{type:"object",properties:{key:{type:"string"},autofocus:{type:"boolean"},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:"input-text"},placeholder:{type:"string"},testId:{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"]}},testId:{type:"string"},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:"color-picker"},value:{type:"string"},testId:{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"},testId:{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-input"},min:{type:"number"},max:{type:"number"},step:{type:"number"},value:{type:"number"},testId:{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:"image"},width:{type:"number"},height:{type:"number"},placeholder:{type:"string"},testId:{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"},testId:{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:"popover-input"},placeholder:{type:"string"},testId:{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"},testId:{type:"string"}},required:["id","content"]}}}}}}}},events:{"form-change":{},"extra-event":{},"action-click":{}},methods:{type:"object",properties:{}}};var Ft={};R(Ft,{createInitialState:()=>ao,getFormFieldValue:()=>ho,hideTooltip:()=>vo,selectForm:()=>Je,selectFormValues:()=>fo,selectState:()=>uo,selectViewData:()=>co,setFormFieldValue:()=>yo,setFormValues:()=>mo,showTooltip:()=>go});var b={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},V={EQ:0,NEQ:1,GT:2,LT:3,GTE:4,LTE:5,AND:6,OR:7,IN:8,ADD:10,SUBTRACT:11},Pe={NOT:0};var k=class extends Error{constructor(t){super(`Parse Error: ${t}`),this.name="JemplParseError"}},Z=class extends Error{constructor(t){super(`Render Error: ${t}`),this.name="JemplRenderError"}};var jt=e=>{if(!e||e.trim()==="")throw new k("Missing condition expression after '$if'");if(e.includes("===")||e.includes("!==")){let r=e.includes("===")?"==":"!=";throw new k(`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 k(`Incomplete comparison expression - missing right operand (got: '${e}')`)},ps=e=>{if(e.trim().endsWith(" in"))throw new k(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(!e.includes(" in "))throw new k(`Invalid loop syntax - missing 'in' keyword (got: '$for ${e}')`);let[t,r]=e.split(" in ");if(!r||r.trim()==="")throw new k(`Missing iterable expression after 'in' (got: '$for ${e}')`);let s=t.includes(",")?t.split(",").map(i=>i.trim()):[t.trim()];for(let i of s){if(!i)throw new k(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`);if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))throw new k(`Invalid loop syntax (got: '$for ${e}')`)}};var cs=(e,t,r=!1)=>{if(t===null)return new Z(`Cannot iterate over null value at '$for ${e}'`);if(t===void 0)return new Z(`Cannot iterate over undefined value at '$for ${e}'`);let s=typeof t;return r?new Z(`Cannot iterate over non-array value in loop '${e}' - got ${s} instead`):new Z(`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 Z(`Unknown function '${e}' (${r})`)};var Ia=(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 a=C(e,{functions:s,partials:i},t,{});return a===void 0?{}:a},C=(e,t,r,s)=>{let i=t.functions||t;if(e.var&&!e.type)return M(e.var,r,s);if(e.type===b.LITERAL)return e.value;if(e.type===b.VARIABLE)return M(e.path,r,s);if(e.type===b.INTERPOLATION)return Ta(e.parts,t,r,s);switch(e.type){case b.FUNCTION:return fs(e,t,r,s);case b.BINARY:return hs(e,t,r,s);case b.UNARY:return ms(e,t,r,s);case b.CONDITIONAL:return Ra(e,t,r,s);case b.LOOP:return ja(e,t,r,s);case b.OBJECT:return Wa(e,t,r,s);case b.ARRAY:return Ma(e,t,r,s);case b.PARTIAL:return za(e,t,r,s);case b.PATH_REFERENCE:return Fa(e,t,r,s);default:throw new Error(`Unknown node type: ${e.type}`)}},ds=new Map,Oa=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 a=r.trim();if(/^\d+$/.test(a))t.push({type:"index",value:parseInt(a,10)});else if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'")){let l=a.slice(1,-1);t.push({type:"property",value:l})}else t.push({type:"property",value:a});r=""}s=!1}else r+=n}return r&&t.push({type:"property",value:r}),t},M=(e,t,r)=>{if(!e)return;if(e in r)return r[e];let s=ds.get(e);if(!s){let n=[],a="",l=0;for(let p=0;p<e.length;p++){let o=e[p];o==="["?(l++,a+=o):o==="]"?(l--,a+=o):o==="."&&l===0?a&&(n.push(a),a=""):a+=o}a&&n.push(a),s=[];for(let p of n){let o=Oa(p.trim());s.push(...o)}ds.set(e,s)}let i=t;for(let n=0;n<s.length;n++){let a=s[n];if(a.type==="property"&&a.value in r){i=r[a.value];continue}if(i==null)return;(a.type==="property"||a.type==="index")&&(i=i[a.value])}return i},Ta=(e,t,r,s)=>{let i=[];for(let n of e)if(typeof n=="string")i.push(n);else{let a=C(n,t,r,s);i.push(a!=null?String(a):"")}return i.join("")},fs=(e,t,r,s)=>{let i=t.functions||t,n=i[e.name];if(!n)throw us(e.name,i);let a=e.args.map(l=>C(l,t,r,s));return n(...a)},Ee=(e,t,r,s)=>{if(e.var&&!e.type)return M(e.var,r,s);switch(e.type){case b.VARIABLE:return M(e.path,r,s);case b.LITERAL:return e.value;case b.BINARY:return hs(e,t,r,s);case b.UNARY:return ms(e,t,r,s);case b.FUNCTION:return fs(e,t,r,s);default:return C(e,t,r,s)}},hs=(e,t,r,s)=>{if(e.op===V.AND||e.op===V.OR){let a=Ee(e.left,t,r,s),l=Ee(e.right,t,r,s);switch(e.op){case V.AND:return a&&l;case V.OR:return a||l}}let i=C(e.left,t,r,s),n=C(e.right,t,r,s);switch(e.op){case V.EQ:return i==n;case V.NEQ:return i!=n;case V.GT:return i>n;case V.LT:return i<n;case V.GTE:return i>=n;case V.LTE:return i<=n;case V.IN:return Array.isArray(n)?n.includes(i):!1;case V.ADD:if(typeof i!="number"||typeof n!="number")throw new Z(`Arithmetic operations require numbers. Got ${typeof i} + ${typeof n}`);return i+n;case V.SUBTRACT:if(typeof i!="number"||typeof n!="number")throw new Z(`Arithmetic operations require numbers. Got ${typeof i} - ${typeof n}`);return i-n;default:throw new Error(`Unknown binary operator: ${e.op}`)}},ms=(e,t,r,s)=>{let i=e.op===Pe.NOT?Ee(e.operand,t,r,s):C(e.operand,t,r,s);switch(e.op){case Pe.NOT:return!i;default:throw new Error(`Unknown unary operator: ${e.op}`)}},La=(e,t,r,s)=>{if(e.conditions.length===2&&e.conditions[1]===null){let i=e.conditions[0];if(i.type===b.VARIABLE)if(M(i.path,r,s)){let a=e.bodies[0];if(a.type===b.OBJECT&&a.properties.length<=5){let l={};for(let p of a.properties){let o=p.parsedKey?C(p.parsedKey,t,r,s):p.key,c=p.value;if(c.type===b.LITERAL)l[o]=c.value;else if(c.type===b.VARIABLE)l[o]=M(c.path,r,s);else if(c.type===b.INTERPOLATION){let u=[];for(let d of c.parts)if(typeof d=="string")u.push(d);else if(d.type===b.VARIABLE){let h=M(d.path,r,s);u.push(h!=null?String(h):"")}else{let h=C(d,t,r,s);u.push(h!=null?String(h):"")}l[o]=u.join("")}else l[o]=C(c,t,r,s)}return l}}else{let a=e.bodies[1];if(a.type===b.OBJECT&&a.properties.length<=5){let l={};for(let p of a.properties){let o=p.parsedKey?C(p.parsedKey,t,r,s):p.key,c=p.value;if(c.type===b.LITERAL)l[o]=c.value;else if(c.type===b.VARIABLE)l[o]=M(c.path,r,s);else if(c.type===b.INTERPOLATION){let u=[];for(let d of c.parts)if(typeof d=="string")u.push(d);else if(d.type===b.VARIABLE){let h=M(d.path,r,s);u.push(h!=null?String(h):"")}else{let h=C(d,t,r,s);u.push(h!=null?String(h):"")}l[o]=u.join("")}else l[o]=C(c,t,r,s)}return l}}}return null},Ra=(e,t,r,s)=>{let i=La(e,t,r,s);if(i!==null)return i;for(let n=0;n<e.conditions.length;n++){let a=e.conditions[n];if(a===null||Ee(a,t,r,s))return C(e.bodies[n],t,r,s)}return ys},Na=(e,t)=>{let r=e.body,s=e.itemVar;if(r.type===b.CONDITIONAL&&r.conditions.length===1&&r.conditions[0].type===b.VARIABLE){let i=r.conditions[0].path,n=r.bodies[0];if(i.startsWith(s+".")){let a=i.substring(s.length+1);if(n.type===b.OBJECT&&n.properties.length<=5){for(let p of n.properties)if(p.parsedKey)return null;let l=[];for(let p=0;p<t.length;p++){let o=t[p];if(o[a]){let c={};for(let u of n.properties){let d=u.key,h=u.value;if(h.type===b.LITERAL)c[d]=h.value;else if(h.type===b.VARIABLE){let f=h.path;if(f===s)c[d]=o;else if(f.startsWith(s+".")){let m=f.substring(s.length+1);c[d]=o[m]}else return null}else if(h.type===b.INTERPOLATION){let f=[],m=!0;for(let g of h.parts)if(typeof g=="string")f.push(g);else if(g.type===b.VARIABLE){let y=g.path;if(y===s)f.push(o!=null?String(o):"");else if(y.startsWith(s+".")){let w=y.substring(s.length+1),_=o[w];f.push(_!=null?String(_):"")}else{m=!1;break}}else{m=!1;break}if(!m)return null;c[d]=f.join("")}else return null}l.push(c)}}return l}}}return null},Pa=(e,t)=>{let r=e.body,s=e.itemVar,i=Na(e,t);if(i!==null)return i;if(r.type===b.OBJECT&&r.properties.length<=5&&!r.whenCondition){for(let l of r.properties)if(l.parsedKey)return null;let n=[],a=!0;for(let l of r.properties){let p=l.key,o=l.value;if(o.type===b.LITERAL)n.push({key:p,type:"literal",value:o.value});else if(o.type===b.VARIABLE){let c=o.path;if(c===s)n.push({key:p,type:"item"});else if(c.startsWith(s+".")){let u=c.substring(s.length+1);if(!u.includes(".")&&!u.includes("["))n.push({key:p,type:"prop",prop:u});else{a=!1;break}}else{a=!1;break}}else if(o.type===b.INTERPOLATION&&o.parts.length===1){let c=o.parts[0];if(c.type===b.VARIABLE){let u=c.path;if(u===s)n.push({key:p,type:"item_string"});else if(u.startsWith(s+".")){let d=u.substring(s.length+1);if(!d.includes(".")&&!d.includes("["))n.push({key:p,type:"prop_string",prop:d});else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}if(a){let l=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 p=0;p<t.length;p++){let o=t[p];l[p]={id:o.id,title:o.title!=null?String(o.title):"",completed:o.completed}}else for(let p=0;p<t.length;p++){let o=t[p],c={};for(let u of n)if(u.type==="literal")c[u.key]=u.value;else if(u.type==="item")c[u.key]=o;else if(u.type==="prop")c[u.key]=o[u.prop];else if(u.type==="item_string")c[u.key]=o!=null?String(o):"";else if(u.type==="prop_string"){let d=o[u.prop];c[u.key]=d!=null?String(d):""}l[p]=c}return l}}return null},Va=(e,t,r,s,i)=>{let n=[],a=e.body;if(a.type===b.OBJECT&&a.fast!==!1){let l=e.itemVar,p=e.indexVar;for(let o=0;o<i.length;o++){let c=i[o],u={},d={...s,[l]:c,...p&&{[p]:o}};d.__paths__||(d.__paths__=s.__paths__||{});let h=e.iterable.path||"";if(s&&s.__paths__&&h){let f=h.split("."),m=f[0];m in s.__paths__&&(h=s.__paths__[m],f.length>1&&(h+="."+f.slice(1).join(".")))}d.__paths__={...d.__paths__,[l]:`${h}[${o}]`,...p&&{[p]:o}};for(let f of a.properties){let m=f.parsedKey?C(f.parsedKey,t,r,d):f.key,g=f.value;if(g.type===b.LITERAL)u[m]=g.value;else if(g.type===b.VARIABLE){let y=g.path;if(y===l)u[m]=c;else if(y===p)u[m]=o;else if(y.startsWith(l+".")){let w=y.substring(l.length+1);!w.includes(".")&&!w.includes("[")?u[m]=c[w]:u[m]=M(y,r,{...s,[l]:c,...p&&{[p]:o}})}else u[m]=M(y,r,{...s,[l]:c,...p&&{[p]:o}})}else if(g.type===b.INTERPOLATION){let y=[];for(let w of g.parts)if(typeof w=="string")y.push(w);else if(w.type===b.VARIABLE){let _=w.path,x;if(_===l)x=c;else if(_===p)x=o;else if(_.startsWith(l+".")){let A=_.substring(l.length+1);!A.includes(".")&&!A.includes("[")?x=c[A]:x=M(_,r,{...s,[l]:c,...p&&{[p]:o}})}else x=M(_,r,{...s,[l]:c,...p&&{[p]:o}});y.push(x!=null?String(x):"")}else{let _={...s,[l]:c,...p&&{[p]:o}},x=C(w,t,r,_);y.push(x!=null?String(x):"")}u[m]=y.join("")}else{let y={...s,[l]:c,...p&&{[p]:o}};u[m]=C(g,t,r,y)}}n.push(u)}return n}return null},Da=(e,t,r)=>{let s=e.body;if(s.type===b.OBJECT&&s.properties.length===1&&s.properties[0].key==="$if item.visible"){let n=s.properties[0].value;if(n.type===b.CONDITIONAL&&n.conditions.length===1&&n.conditions[0].type===b.VARIABLE&&n.conditions[0].path==="item.visible"){let a=n.bodies[0];if(a.type===b.OBJECT&&a.properties.length===2){let l=a.properties[0],p=a.properties[1];if(l.key==="id"&&l.value.type===b.VARIABLE&&l.value.path==="item.id"&&p.key==="$if item.highlighted"&&p.value.type===b.CONDITIONAL){let o=[];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),o.push(d)}}return o}}}}return null},ja=(e,t,r,s)=>{let i=C(e.iterable,t,r,s);if(!Array.isArray(i)){let o,c=!1;if(e.iterable.type===b.FUNCTION){c=!0;let d=e.iterable.args.map(h=>h.type===b.LITERAL?typeof h.value=="string"?`'${h.value}'`:String(h.value):h.type===b.VARIABLE?h.path:h.type===b.FUNCTION?`${h.name}(...)`:"?").join(", ");o=`${e.iterable.name}(${d})`}else o=e.iterable.path||"undefined";let u=`${e.itemVar}${e.indexVar?`, ${e.indexVar}`:""} in ${o}`;throw cs(u,i,c)}if(!e.indexVar){let o=Da(e,i,e.itemVar);if(o!==null)return o}if(!e.indexVar){let o=Pa(e,i);if(o!==null)return o}let n=Va(e,t,r,s,i);if(n!==null)return n;let a=[],l=e.iterable.path||"";if(s&&s.__paths__&&l){let o=l.split("."),c=o[0];c in s.__paths__&&(l=s.__paths__[c],o.length>1&&(l+="."+o.slice(1).join(".")))}let p=!1;e.body.type===b.ARRAY&&(e.body.items.length<=1?p=!1:p=e.body._shouldPreserveArray??=e.body.items.some(o=>o.type===b.OBJECT&&o.properties.some(c=>c.key.startsWith("$if ")||c.key.startsWith("$when "))));for(let o=0;o<i.length;o++){let c=e.indexVar?{...s,[e.itemVar]:i[o],[e.indexVar]:o}:{...s,[e.itemVar]:i[o]};c.__paths__||(c.__paths__=s.__paths__||{}),c.__paths__={...c.__paths__,[e.itemVar]:`${l}[${o}]`},e.indexVar&&(c.__paths__[e.indexVar]=o);let u=C(e.body,t,r,c);if(Array.isArray(u)&&u.length===1&&!p){let d=u[0];a.push(d===void 0?{}:d)}else a.push(u===void 0?{}:u)}return a},Ba=(e,t,r,s)=>{if(e.whenCondition)return null;if(e.properties.length===1){let i=e.properties[0],n=i.parsedKey?C(i.parsedKey,t,r,s):i.key,a=i.value;if(a.type===b.OBJECT&&a.properties.length<=10&&!a.whenCondition){let l={},p={},o=!0;for(let c of a.properties){let u=c.parsedKey?C(c.parsedKey,t,r,s):c.key,d=c.value;if(d.type===b.LITERAL)p[u]=d.value;else if(d.type===b.VARIABLE)p[u]=M(d.path,r,s);else if(d.type===b.INTERPOLATION){let h=[];for(let f of d.parts)if(typeof f=="string")h.push(f);else if(f.type===b.VARIABLE){let m=M(f.path,r,s);h.push(m!=null?String(m):"")}else{o=!1;break}if(!o)break;p[u]=h.join("")}else if(d.type===b.OBJECT&&d.properties.length<=5){let h={};for(let f of d.properties){let m=f.key,g=f.value;if(g.type===b.LITERAL)h[m]=g.value;else if(g.type===b.VARIABLE)h[m]=M(g.path,r,s);else if(g.type===b.INTERPOLATION){let y=[];for(let w of g.parts)if(typeof w=="string")y.push(w);else if(w.type===b.VARIABLE){let _=M(w.path,r,s);y.push(_!=null?String(_):"")}else{o=!1;break}if(!o)break;h[m]=y.join("")}else{o=!1;break}}if(!o)break;p[u]=h}else{o=!1;break}}if(o)return l[n]=p,l}}return null},Wa=(e,t,r,s)=>{let i=t.functions||t;if(e.whenCondition&&!Ee(e.whenCondition,i,r,s))return;let n=Ba(e,t,r,s);if(n!==null)return n;if(e.fast){let o={};for(let c of e.properties){let u=c.parsedKey?C(c.parsedKey,t,r,s):c.key,d=c.value;if(d.type===b.LITERAL)o[u]=d.value;else if(d.type===b.VARIABLE)o[u]=M(d.path,r,s);else if(d.type===b.INTERPOLATION){let h=[];for(let f of d.parts)if(typeof f=="string")h.push(f);else if(f.type===b.VARIABLE){let m=M(f.path,r,s);h.push(m!=null?String(m):"")}else{let m=C(f,t,r,s);h.push(m!=null?String(m):"")}o[u]=h.join("")}else o[u]=C(d,t,r,s)}return o}let a={},l=null,p=!1;for(let o of e.properties)if(!o.key.startsWith("$if ")&&!o.key.match(/^\$if\s+\w+.*:?$/)&&!o.key.startsWith("$elif")&&!o.key.startsWith("$else")&&!o.key.startsWith("$for ")){p=!0;break}for(let o of e.properties)if(o.key.startsWith("$if ")||o.key.match(/^\$if\s+\w+.*:?$/)){let c=C(o.value,t,r,s);if(!p&&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(a,c)}else if(o.key.startsWith("$for ")){if(e.properties.length===1)return C(o.value,t,r,s)}else{let c=o.value;if(c&&c.type===b.OBJECT&&c.properties){let u=c.properties.find(d=>d.key.startsWith("$for "));if(u){let d=C(u.value,t,r,s);d!==void 0&&(a[o.key]=d)}else{let d=C(o.value,t,r,s);d!==void 0&&(a[o.key]=d)}}else{let u=o.parsedKey?C(o.parsedKey,t,r,s):o.key,d=C(o.value,t,r,s);d!==void 0&&(a[u]=d)}}return a},ys={},Ma=(e,t,r,s)=>{let i=[];for(let n of e.items)if(n.type===b.LOOP){let a=C(n,t,r,s);Array.isArray(a)&&n.flatten!==!1?i.push(...a):i.push(a)}else{let a=C(n,t,r,s);a!==ys&&a!==void 0&&i.push(a)}return i},za=(e,t,r,s)=>{let{name:i,data:n,whenCondition:a}=e,l=t.partials||{},p=t.functions||t;if(a&&!Ee(a,p,r,s))return;if(!l[i])throw new Z(`Partial '${i}' is not defined`);let o=s._partialStack||[];if(o.includes(i))throw new Z(`Circular partial reference detected: ${i}`);let c=l[i],u=r,d={...s,_partialStack:[...o,i]};if(s){u={...r};for(let h of Object.keys(s))h.startsWith("_")||(u[h]=s[h])}if(n){let h=C(n,t,r,s);u={...u,...h}}return C(c,t,u,d)},Fa=(e,t,r,s)=>{let{path:i}=e,n=i.split("."),a=n[0],l=n.slice(1);if(!s||!(a in s))throw new Z(`Path reference '#{${i}}' refers to '${a}' which is not a loop variable in the current scope`);if(s.__paths__||(s.__paths__={}),!(a in s.__paths__))throw new Z(`Path reference '#{${i}}' cannot be resolved - path tracking may not be initialized properly`);let p=s.__paths__[a];if(typeof p=="number"){if(l.length>0)throw new Z(`Path reference '#{${i}}' - cannot access properties on index variable '${a}'`);return String(p)}return l.length>0&&(p+="."+l.join(".")),p},Bt=Ia;var Ua=/\$\{([^}]*)\}/g,Ka=/#\{([^}]*)\}/g,vs=(e,t={})=>{let r=e.match(/^(\w+)\((.*)\)$/);if(!r)return{isFunction:!1};let[,s,i]=r,n=Ha(i,t);return{isFunction:!0,type:b.FUNCTION,name:s,args:n}},Ha=(e,t={})=>e.trim()?Ga(e).map(s=>qa(s.trim(),t)):[],Ga=e=>{let t=[],r="",s=0,i=!1,n="";for(let a=0;a<e.length;a++){let l=e[a],p=a>0?e[a-1]:"";!i&&(l==='"'||l==="'")?(i=!0,n=l,r+=l):i&&l===n&&p!=="\\"?(i=!1,n="",r+=l):!i&&l==="("?(s++,r+=l):!i&&l===")"?(s--,r+=l):!i&&l===","&&s===0?(t.push(r),r=""):r+=l}return r&&t.push(r),t},qa=(e,t={})=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:b.LITERAL,value:e.slice(1,-1)};if(/^-?\d+(\.\d+)?$/.test(e))return{type:b.LITERAL,value:parseFloat(e)};if(e==="true")return{type:b.LITERAL,value:!0};if(e==="false")return{type:b.LITERAL,value:!1};if(e==="null")return{type:b.LITERAL,value:null};let r=vs(e,t);if(r.isFunction)return{type:r.type,name:r.name,args:r.args};let s=e.trim(),i=[{op:" + ",type:"ADD"},{op:" - ",type:"SUBTRACT"}],n=-1,a=null;for(let{op:l,type:p}of i){let o=0;for(;o<s.length;){let c=ge(s.substring(o),l);if(c===-1)break;let u=o+c;u>n&&(n=u,a={op:l,type:p}),o=u+l.length}}if(n!==-1)try{return J(s,t)}catch{return{type:b.VARIABLE,path:s}}return{type:b.VARIABLE,path:s}},bs=/^\w+\(.*\)$/,Ja=/\s[+\-*/%]\s|\|\||&&|\?\?|.*\?.*:/,Ya=e=>{if(!(!e||e.trim()===""||bs.test(e))&&Ja.test(e))throw e.includes("?")&&e.includes(":")?new k(`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 k(`Logical operators not supported in variable replacements - consider calculating the value in your data instead (operators like ||, &&, ?? are not supported). Offending expression: "${e}"`):new k(`Arithmetic expressions not supported in variable replacements - consider calculating '${e}' in your data instead (expressions with +, -, *, /, % are not supported). Offending expression: "${e}"`)},gs=e=>{let t=e.trim();if(bs.test(t))throw new k(`Functions are not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(t.includes("["))throw new k(`Array indices not supported in path references - use simple variable names or properties. Offending expression: "#{${e}}"`);if(/[+\-*/%]/.test(t))throw new k(`Arithmetic expressions not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(/\|\||&&/.test(t))throw new k(`Logical operators not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(t.includes("?")&&t.includes(":"))throw new k(`Complex expressions not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);return{type:b.PATH_REFERENCE,path:t}},Ve=(e,t={})=>{let r=e.trim();Ya(r);let s=vs(r,t);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:b.VARIABLE,path:r}},Wt=(e,t={})=>{let r=e,s=[];(e.includes("\\${")||e.includes("\\#{"))&&(r=e.replace(/\\\\(\$\{[^}]*\})/g,"\\DOUBLE_ESC_VAR$1"),r=r.replace(/\\\\(#\{[^}]*\})/g,"\\DOUBLE_ESC_PATH$1"),r=r.replace(/\\(\$\{[^}]*\})/g,(o,c)=>{let u=`__ESCAPED_${s.length}__`;return s.push(c),u}),r=r.replace(/\\(#\{[^}]*\})/g,(o,c)=>{let u=`__ESCAPED_${s.length}__`;return s.push(c),u}),r=r.replace(/\\DOUBLE_ESC_VAR/g,"\\"),r=r.replace(/\\DOUBLE_ESC_PATH/g,"\\"));let i=[...r.matchAll(Ua)],n=[...r.matchAll(Ka)],a=[...i.map(o=>({match:o,type:"variable"})),...n.map(o=>({match:o,type:"pathref"}))].sort((o,c)=>o.match.index-c.match.index);if(a.length===0){let o=r;for(let c=0;c<s.length;c++)o=o.replace(`__ESCAPED_${c}__`,s[c]);return{type:b.LITERAL,value:o}}if(a.length===1&&a[0].match[0]===r&&s.length===0){let{match:o,type:c}=a[0];try{return c==="variable"?Ve(o[1],t):gs(o[1])}catch(u){if(u.message==="Invalid array index syntax")return{type:b.LITERAL,value:r};throw u}}let l=[],p=0;for(let{match:o,type:c}of a){let[u,d]=o,h=o.index;if(h>p){let f=r.substring(p,h);for(let m=0;m<s.length;m++)f=f.replace(`__ESCAPED_${m}__`,s[m]);f&&l.push(f)}try{let f;c==="variable"?f=Ve(d.trim(),t):f=gs(d.trim()),l.push(f)}catch(f){if(f.message==="Invalid array index syntax")l.push(u);else throw f}p=h+u.length}if(p<r.length){let o=r.substring(p);for(let c=0;c<s.length;c++)o=o.replace(`__ESCAPED_${c}__`,s[c]);o&&l.push(o)}return{type:b.INTERPOLATION,parts:l}};var fe=(e,t)=>typeof e=="string"?Wt(e,t):typeof e=="object"&&e!==null?Array.isArray(e)?Za(e,t):Qa(e,t):{type:b.LITERAL,value:e},Xa=e=>{let{$each:t,...r}=e;if(typeof t!="string")throw new k("$each value must be a non-empty string");let s=t.trim();if(s==="")throw new k("$each value must be a non-empty string");if(Object.keys(r).length===0)throw new k("Empty $each body not allowed");if(r.$partial!==void 0)throw new k("Cannot use $partial with $each at the same level. Wrap $partial in a parent object if you need conditionals.");return{[`$for ${s}`]:r}},Za=(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)){if(n.$each!==void 0)try{let p=Xa(n),o=Object.keys(p);if(o.length===1&&/^\$for(?::\w+)?\s/.test(o[0])){let c=ws(o[0],p[o[0]],t,!0);r.push(c),s=!0;continue}}catch(p){throw p instanceof k?p:new k(p.message)}let l=Object.keys(n);if(l.length===1&&/^\$for(?::\w+)?\s/.test(l[0])){let p=ws(l[0],n[l[0]],t);r.push(p),s=!0;continue}}let a=fe(n,t);r.push(a),(a.type===b.FUNCTION||a.type===b.CONDITIONAL||a.type===b.LOOP||a.type===b.PARTIAL||a.type===b.OBJECT&&!a.fast||a.type===b.ARRAY&&!a.fast)&&(s=!0)}return{type:b.ARRAY,items:r,fast:!s}},Qa=(e,t)=>{let r=[],s=!1,i=null,n=Object.entries(e),a=0;if(e.$partial!==void 0){if(typeof e.$partial!="string")throw new k("$partial value must be a string");if(e.$partial.trim()==="")throw new k("$partial value cannot be an empty string");let p=["$if","$elif","$else","$for"],o=[];for(let[y]of n)for(let w of p)if(y===w||y.startsWith(w+" ")||y.startsWith(w+"#")){o.push(w);break}if(o.length>0)throw new k(`Cannot use $partial with ${o.join(", ")} at the same level. Wrap $partial in a parent object if you need conditionals.`);let{$partial:c,$when:u,...d}=e,h={},f=!1;for(let[y,w]of Object.entries(d)){let _=y;(y.startsWith("\\$")||y.startsWith("$$"))&&(_=y.slice(1)),h[_]=w,f=!0}let m=null;if(f&&(m=fe(h,t),m.type===b.OBJECT)){let y=!1;for(let w of m.properties)if(w.value.type===b.VARIABLE||w.value.type===b.INTERPOLATION||w.value.type===b.FUNCTION||w.value.type===b.CONDITIONAL||w.value.type===b.OBJECT&&!w.value.fast||w.value.type===b.ARRAY&&!w.value.fast){y=!0;break}y&&(m.fast=!1)}let g={type:b.PARTIAL,name:c,data:m};if(u!==void 0){let y;if(typeof u=="string"){if(u.trim()==="")throw new k("Empty condition expression after '$when'");y=J(u,t)}else y={type:b.LITERAL,value:u};g.whenCondition=y}return g}for(let[p,o]of n)if(p==="$when"){if(i!==null)throw new k("Multiple '$when' directives on the same object are not allowed");if(o==null)throw new k("Missing condition expression after '$when'");let c=typeof o=="string"?o:JSON.stringify(o);if(c.trim()==="")throw new k("Empty condition expression after '$when'");i=J(c,t),s=!0}else if(p.startsWith("$when#")||p.startsWith("$when "))throw new k("'$when' does not support ID syntax or inline conditions - use '$when' as a property");for(;a<n.length;){let[p,o]=n[a];if(p==="$when"){a++;continue}if(p==="$each")throw new k("$each can only be used inside arrays");if(p.startsWith("$if ")||p.match(/^\$if#\w+\s/)||p.match(/^\$if\s+\w+.*:$/)){let c=eo(n,a,t);r.push({key:p,value:c.node}),s=!0,a=c.nextIndex}else if(/^\$for(?::\w+)?\s/.test(p)){let c=p.match(/^\$for(?::(\w+))?\s/)?.[1]||"",u=c?`:${c}`:"";throw new k(`$for loops must be inside arrays - use '- $for${u} item in items:' instead of '$for${u} item in items:'. For cleaner object generation syntax, consider using $each.`)}else{if(p.startsWith("$elif ")||p.startsWith("$else"))throw new k(`'${p.split(" ")[0]}' without matching '$if'`);if(p==="$if"||p==="$if:")throw new k("Missing condition expression after '$if'");{let c=fe(o,t);(c.type===b.FUNCTION||c.type===b.CONDITIONAL||c.type===b.PARTIAL||c.type===b.OBJECT&&!c.fast||c.type===b.ARRAY&&!c.fast)&&(s=!0);let u=Wt(p,t),d={key:p,value:c};(u.type!==b.LITERAL||u.value!==p)&&(d.parsedKey=u),r.push(d),a++}}}let l={type:b.OBJECT,properties:r,fast:!s};return i&&(l.whenCondition=i),l},eo=(e,t,r={})=>{let s=[],i=[],n=t,[a,l]=e[n],p=null,o;if(a.startsWith("$if#")){let u=a.match(/^\$if#(\w+)\s+(.+)$/);if(u)p=u[1],o=u[2];else throw new k(`Invalid conditional syntax: ${a}`)}else o=a.substring(4),o.endsWith(":")&&(o=o.slice(0,-1).trim());jt(o);let c=J(o,r);for(s.push(c),i.push(fe(l,r)),n++;n<e.length;){let[u,d]=e[n],h=!1,f;if(p?u.startsWith(`$elif#${p} `)?(f=u.substring(`$elif#${p} `.length),f.endsWith(":")&&(f=f.slice(0,-1).trim()),h=!0):(u===`$else#${p}`||u===`$else#${p}:`)&&(h=!0,f=null):u.startsWith("$elif ")?(f=u.substring(6),f.endsWith(":")&&(f=f.slice(0,-1).trim()),h=!0):(u==="$else"||u==="$else:")&&(h=!0,f=null),h){if(f===null)s.push(null);else{jt(f);let m=J(f,r);s.push(m)}if(i.push(fe(d,r)),n++,f===null)break}else break}return{node:{type:b.CONDITIONAL,conditions:s,bodies:i,id:p},nextIndex:n}},J=(e,t={})=>{if(e=e.trim(),e.startsWith("(")&&e.endsWith(")")){let o=e.slice(1,-1),c=0,u=!0;for(let d=0;d<o.length;d++)if(o[d]==="("?c++:o[d]===")"&&c--,c<0){u=!1;break}if(u&&c===0)return J(o,t)}let r=ge(e,"||");if(r!==-1)return{type:b.BINARY,op:V.OR,left:J(e.substring(0,r).trim(),t),right:J(e.substring(r+2).trim(),t)};let s=ge(e,"&&");if(s!==-1)return{type:b.BINARY,op:V.AND,left:J(e.substring(0,s).trim(),t),right:J(e.substring(s+2).trim(),t)};let i=[{op:">=",type:V.GTE},{op:"<=",type:V.LTE},{op:"==",type:V.EQ},{op:"!=",type:V.NEQ},{op:">",type:V.GT},{op:"<",type:V.LT},{op:" in ",type:V.IN}];for(let{op:o,type:c}of i){let u=ge(e,o);if(u!==-1)return{type:b.BINARY,op:c,left:J(e.substring(0,u).trim(),t),right:J(e.substring(u+o.length).trim(),t)}}let n=-1,a=null,l=[{op:" + ",type:V.ADD},{op:" - ",type:V.SUBTRACT}];for(let{op:o,type:c}of l){let u=0;for(;u<e.length;){let d=ge(e.substring(u),o);if(d===-1)break;let h=u+d;h>n&&(n=h,a={op:o,type:c}),u=h+o.length}}if(n!==-1&&a)return{type:b.BINARY,op:a.type,left:J(e.substring(0,n).trim(),t),right:J(e.substring(n+a.op.length).trim(),t)};let p=[" * "," / "," % "];for(let o of p)if(ge(e,o)!==-1)throw new k(`Arithmetic operations are not allowed in conditionals: "${o}"`);return e.startsWith("!")?{type:b.UNARY,op:Pe.NOT,operand:J(e.substring(1).trim(),t)}:_s(e,t)},ge=(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},to=e=>{if(e=e.trim(),e==="true")return{type:b.LITERAL,value:!0};if(e==="false")return{type:b.LITERAL,value:!1};if(e==="null")return{type:b.LITERAL,value:null};if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:b.LITERAL,value:e.slice(1,-1)};if(e==='""'||e==="''")return{type:b.LITERAL,value:""};if(e==="{}")return{type:b.LITERAL,value:{}};if(e==="[]")return{type:b.LITERAL,value:[]};let t=Number(e);return!isNaN(t)&&isFinite(t)?{type:b.LITERAL,value:t}:{type:b.VARIABLE,path:e}},_s=(e,t)=>{let r=e.trim();if(r.match(/^(\w+)\((.*)\)$/))return Ve(r,t);let i=to(r);if(i.type===b.LITERAL)return i;if(/^[a-zA-Z_$][\w.$]*$/.test(r))return{type:b.VARIABLE,path:r};try{return Ve(r,t)}catch(n){if(n.message&&n.message.includes("not supported"))return i;throw n}},ro=(e,t=!1)=>{let r=t?"$each":"$for";try{ps(e)}catch(s){if(s instanceof k&&t){let i=s.message.replace(/\$for/g,"$each");throw new k(i.replace("Parse Error: ",""))}throw s}},ws=(e,t,r,s=!1)=>{let i=/^\$for(?::(\w+))?\s+(.+)$/,n=e.match(i);if(!n){let g=s?"$each":"$for";throw new k(`Invalid loop syntax (got: '${e.replace("$for",g)}')`)}let a=n[1],l=n[2].trim();ro(l,s);let p=l.match(/^(.+?)\s+in\s+(.+)$/);if(!p){let g=s?"$each":"$for";throw new k(`Invalid loop syntax - missing 'in' keyword (got: '${g} ${l}')`)}let o=p[1].trim(),c=p[2].trim(),u,d=null;if(o.includes(",")){let g=o.split(",").map(y=>y.trim());if(g.length!==2)throw new k(`Invalid loop variables: ${o}. Expected format: "item" or "item, index"`);u=g[0],d=g[1]}else u=o;let h=["this","undefined","null","true","false"];if(h.includes(u))throw new k(`Reserved variable name: ${u}`);if(d&&h.includes(d))throw new k(`Reserved variable name: ${d}`);let f=_s(c,r),m=fe(t,r);return{type:b.LOOP,itemVar:u,indexVar:d,iterable:f,body:m,flatten:a!=="nested"}};var so=(e,t={})=>{let{functions:r={}}=t;return fe(e,r)},qe=so;var Mt={};R(Mt,{now:()=>io});var io=()=>Date.now();var no=(e,t,r={})=>{let{functions:s={},partials:i={}}=r,n={...Mt,...s},a=qe(e,{functions:n}),l={};for(let[p,o]of Object.entries(i))l[p]=qe(o,{functions:n});return Bt(a,t,{functions:n,partials:l})},zt=no;function xs(e,t){return t.reduce((r,s)=>(s in e&&(r[s]=e[s]),r),{})}var ao=()=>Object.freeze({formValues:{},tooltipState:{open:!1,x:0,y:0,content:""}}),As=(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},oo=(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 a=s[n];if(!(a in i)||typeof i[a]!="object"||i[a]===null){let l=s[n+1],p=/^\d+$/.test(l);i[a]=p?[]:{}}i=i[a]}return i[s[s.length-1]]=r,e},lo=["id","class","style","slot","form","defaultValues","context","autofocus","key"],po=(e={})=>Object.entries(e).filter(([t])=>!lo.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Je=({props:e})=>{let{form:t={}}=e,{context:r}=e;return r?zt(t,r):t},co=({state:e,props:t})=>{let r=po(t),s=Je({state:e,props:t}),i=structuredClone(s.fields||[]);return i.forEach(n=>{let a=As(e.formValues,n.name);if(["read-only-text"].includes(n.inputType)&&(n.defaultValue=a),["select"].includes(n.inputType)){let l=t?.defaultValues;l&&l[n.name]!==void 0&&(n.selectedValue=l[n.name])}if(n.inputType==="image"){let l=n.src;n.imageSrc=l&&l.trim()?l:null,n.placeholderText=n.placeholder||"No Image"}if(n.inputType==="waveform"){let l=n.waveformData;n.waveformData=l||null,n.placeholderText=n.placeholder||"No Waveform"}}),{key:t?.key,containerAttrString:r,title:s?.title||"",description:s?.description||"",fields:i,actions:t?.form?.actions||{buttons:[]},formValues:e.formValues,tooltipState:e.tooltipState}},uo=({state:e})=>e,fo=({state:e,props:t})=>{let r=Je({state:e,props:t});return xs(e.formValues,r.fields.map(s=>s.name))},ho=({state:e},t)=>As(e.formValues,t),mo=({state:e},t={})=>{e.formValues=t.formValues||{}},yo=({state:e,props:t},r={})=>{let{name:s,value:i}=r;if(!s)return;oo(e.formValues,s,i);let n=Je({state:e,props:t}),a=xs(e.formValues,n.fields.map(l=>l.name));e.formValues=a},go=({state:e},t={})=>{let{x:r,y:s,content:i}=t;e.tooltipState={open:!0,x:r,y:s,content:i}},vo=({state:e})=>{e.tooltipState={...e.tooltipState,open:!1}};var Es={refs:{formContainer:{eventListeners:{keydown:{handler:"handleKeyDown"}}},"action*":{eventListeners:{click:{handler:"handleActionClick"}}},"tooltipIcon*":{eventListeners:{mouseenter:{handler:"handleTooltipMouseEnter"},mouseleave:{handler:"handleTooltipMouseLeave"}}},"field*":{eventListeners:{"value-input":{handler:"handleInputChange"},"value-change":{handler:"handleInputChange"},"add-option-click":{handler:"handleSelectAddOption"}}},"image*":{eventListeners:{click:{handler:"handleImageClick"},contextmenu:{handler:"handleImageClick"}}},"waveform*":{eventListeners:{click:{handler:"handleWaveformClick"},contextmenu:{handler:"handleWaveformClick"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view#formContainer 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:"$if title",value:{type:6,conditions:[{type:1,path:"title"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"title"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if description",value:{type:6,conditions:[{type:1,path:"description"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:1,path:"description"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1},{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:"$if field.label || field.description",value:{type:6,conditions:[{type:4,op:7,left:{type:1,path:"field.label"},right:{type:1,path:"field.description"}}],bodies:[{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:"$if field.label",value:{type:6,conditions:[{type:1,path:"field.label"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"field.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if field.label && field.tooltip",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"field.label"},right:{type:1,path:"field.tooltip"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-svg#tooltipIcon${i} data-field-name=${field.name} svg="info" wh=16 c=mu-fg cur=help ml=xs',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg#tooltipIcon",{type:1,path:"i"}," data-field-name=",{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:"$if field.description",value:{type:6,conditions:[{type:1,path:"field.description"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"field.description"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],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 == "input-text"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"input-text"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input#field${i} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} data-testid=${field.testId}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#field",{type:1,path:"i"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," data-testid=",{type:1,path:"field.testId"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "input-number"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"input-number"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input-number#field${i} data-field-name=${field.name} w=f data-testid=${field.testId}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input-number#field",{type:1,path:"i"}," data-field-name=",{type:1,path:"field.name"}," w=f data-testid=",{type:1,path:"field.testId"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "input-textarea"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"input-textarea"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-textarea#field${i} data-field-name=${field.name} w=f rows=${field.rows} data-testid=${field.testId}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-textarea#field",{type:1,path:"i"}," data-field-name=",{type:1,path:"field.name"}," w=f rows=",{type:1,path:"field.rows"}," data-testid=",{type:1,path:"field.testId"}]}}],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#field${i} data-field-name=${field.name} label="${field.label}" data-testid=${field.testId}',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-popover-input#field",{type:1,path:"i"}," data-field-name=",{type:1,path:"field.name"},' label="',{type:1,path:"field.label"},'" data-testid=',{type:1,path:"field.testId"}]}}],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#field${i} data-field-name=${field.name} key=${key} w=f :options=fields[${i}].options ?no-clear=fields[${i}].noClear :addOption=fields[${i}].addOption :selectedValue=#{field.selectedValue} :placeholder=#{field.placeholder} data-testid=${field.testId}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-select#field",{type:1,path:"i"}," data-field-name=",{type:1,path:"field.name"}," key=",{type:1,path:"key"}," w=f :options=fields[",{type:1,path:"i"},"].options ?no-clear=fields[",{type:1,path:"i"},"].noClear :addOption=fields[",{type:1,path:"i"},"].addOption :selectedValue=",{type:11,path:"field.selectedValue"}," :placeholder=",{type:11,path:"field.placeholder"}," data-testid=",{type:1,path:"field.testId"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "color-picker"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"color-picker"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-color-picker#field${i} data-field-name=${field.name} key=${key} data-testid=${field.testId}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-color-picker#field",{type:1,path:"i"}," data-field-name=",{type:1,path:"field.name"}," key=",{type:1,path:"key"}," data-testid=",{type:1,path:"field.testId"}]}}],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#field${i} data-field-name=${field.name} key=${key} w=f min=${field.min} max=${field.max} step=${field.step} data-testid=${field.testId}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider#field",{type:1,path:"i"}," data-field-name=",{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"}," data-testid=",{type:1,path:"field.testId"}]}}],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#field${i} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} data-testid=${field.testId}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider-input#field",{type:1,path:"i"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," data-testid=",{type:1,path:"field.testId"}]}}],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${i} data-field-name=${field.name} src=${field.imageSrc} w=${field.width} h=${field.height} cur=pointer data-testid=${field.testId}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image#image",{type:1,path:"i"}," data-field-name=",{type:1,path:"field.name"}," src=",{type:1,path:"field.imageSrc"}," w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," cur=pointer data-testid=",{type:1,path:"field.testId"}]}}],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${i} data-field-name=${field.name} w=${field.width} h=${field.height} bc=ac bw=sm ah=c av=c cur=pointer p=md data-testid=${field.testId}",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:"i"}," data-field-name=",{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=pointer p=md data-testid=",{type:1,path:"field.testId"}]}}],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${i} data-field-name=${field.name} :waveformData=fields[${i}].waveformData w=${field.width} h=${field.height} cur=pointer data-testid=${field.testId}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-waveform#waveform",{type:1,path:"i"}," data-field-name=",{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=pointer data-testid=",{type:1,path:"field.testId"}]}}],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${i} data-field-name=${field.name} w=${field.width} h=${field.height} bc=ac bw=sm ah=c av=c cur=pointer p=md data-testid=${field.testId}",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:"i"}," data-field-name=",{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=pointer p=md data-testid=",{type:1,path:"field.testId"}]}}],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#fieldSlot${i} data-field-name=${field.name} name=${field.slot} style="display: contents;"',value:{type:0,value:null},parsedKey:{type:2,parts:["slot#fieldSlot",{type:1,path:"i"}," data-field-name=",{type:1,path:"field.name"}," 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${i} data-action-id=${button.id} data-testid=${button.testId}",value:{type:1,path:"button.content"},parsedKey:{type:2,parts:["rtgl-button#action",{type:1,path:"i"}," data-action-id=",{type:1,path:"button.id"}," data-testid=",{type:1,path:"button.testId"}]}}],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} place="t" 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"},' place="t" content="',{type:1,path:"tooltipState.content"},'"']}}],fast:!0}],fast:!1},parsedKey:{type:2,parts:["rtgl-view#formContainer w=f p=md g=lg ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var Ut={};R(Ut,{closeAll:()=>So,handleCancel:()=>_o,handleConfirm:()=>wo,handleDialogClose:()=>bo,handleDropdownClose:()=>xo,handleDropdownItemClick:()=>Ao,showAlert:()=>Eo,showConfirm:()=>ko,showDropdownMenu:()=>$o});var bo=(e,t)=>{let{store:r,render:s}=e;r.closeAll(),s()},wo=(e,t)=>{let{store:r,render:s,globalUI:i}=e;r.closeAll(),s(),i.emit("event",!0)},_o=(e,t)=>{let{store:r,render:s,globalUI:i}=e;r.closeAll(),s(),i.emit("event",!1)},xo=(e,t)=>{let{store:r,render:s,globalUI:i}=e;r.closeAll(),s(),i.emit("event",null)},Ao=(e,t)=>{let{store:r,render:s,globalUI:i}=e,n=t._event,{index:a,item:l}=n.detail;r.closeAll(),s(),i.emit("event",{index:a,item:l})},Eo=(e,t)=>{let{store:r,render:s}=e,i=t;r.selectIsOpen()&&(r.closeAll(),s()),r.setAlertConfig(i),s()},ko=async(e,t)=>{let{store:r,render:s,globalUI:i}=e,n=t;return r.selectIsOpen()&&(r.closeAll(),s()),r.setConfirmConfig(n),s(),new Promise(a=>{i.once("event",l=>{a(l)})})},$o=async(e,t)=>{let{store:r,render:s,globalUI:i}=e,n=t;return r.selectIsOpen()&&(r.closeAll(),s()),r.setDropdownConfig(n),s(),new Promise(a=>{i.once("event",l=>{a(l)})})},So=e=>{let{store:t,render:r}=e;t.selectIsOpen()&&(t.closeAll(),r())};var ks={componentName:"rtgl-global-ui",propsSchema:{type:"object",properties:{}},events:[],methods:{type:"object",properties:{}}};var Kt={};R(Kt,{closeAll:()=>Lo,createInitialState:()=>Co,selectConfig:()=>Ro,selectDropdownConfig:()=>No,selectIsOpen:()=>Vo,selectUiType:()=>Po,selectViewData:()=>Do,setAlertConfig:()=>Io,setConfirmConfig:()=>Oo,setDropdownConfig:()=>To});var Co=()=>Object.freeze({isOpen:!1,uiType:"dialog",config:{status:void 0,title:"",message:"",confirmText:"OK",cancelText:"Cancel",mode:"alert"},dropdownConfig:{items:[],x:0,y:0,place:"bs"}}),Io=({state: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.uiType="dialog",e.isOpen=!0},Oo=({state: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.uiType="dialog",e.isOpen=!0},To=({state:e},t={})=>{if(!t.items||!Array.isArray(t.items))throw new Error("items array is required for showDropdown");e.dropdownConfig={items:t.items,x:t.x||0,y:t.y||0,place:t.place||"bs"},e.uiType="dropdown",e.isOpen=!0},Lo=({state:e})=>{e.isOpen=!1,e.uiType="dialog"},Ro=({state:e})=>e.config,No=({state:e})=>e.dropdownConfig,Po=({state:e})=>e.uiType,Vo=({state:e})=>e.isOpen,Do=({state:e})=>({isOpen:e.isOpen,uiType:e.uiType,config:e.config,dropdownConfig:{items:e.dropdownConfig?.items||[],x:e.dropdownConfig?.x||0,y:e.dropdownConfig?.y||0,place:e.dropdownConfig?.place||"bs"},isDialogOpen:e.isOpen&&e.uiType==="dialog",isDropdownOpen:e.isOpen&&e.uiType==="dropdown"});var $s={refs:{dialog:{eventListeners:{close:{handler:"handleDialogClose"}}},confirmButton:{eventListeners:{click:{handler:"handleConfirm"}}},cancelButton:{eventListeners:{click:{handler:"handleCancel"}}},dropdownMenu:{eventListeners:{close:{handler:"handleDropdownClose"},"item-click":{handler:"handleDropdownItemClick"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-dialog#dialog ?open=${isDialogOpen} 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 g=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h ah=c av=c g=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=md",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:"rtgl-view h=24 av=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"config.title"}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"config.message"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-view d=h g=md mt=lg w=f ah=e",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#cancelButton v=se",value:{type:1,path:"config.cancelText"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-button#confirmButton v=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:"isDialogOpen"}," s=sm"]}}],fast:!1},{type:8,properties:[{key:"rtgl-dropdown-menu#dropdownMenu ?open=${isDropdownOpen} x=${dropdownConfig.x} y=${dropdownConfig.y} place=${dropdownConfig.place} :items=dropdownConfig.items key=dropdown-${isDropdownOpen}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-dropdown-menu#dropdownMenu ?open=",{type:1,path:"isDropdownOpen"}," x=",{type:1,path:"dropdownConfig.x"}," y=",{type:1,path:"dropdownConfig.y"}," place=",{type:1,path:"dropdownConfig.place"}," :items=dropdownConfig.items key=dropdown-",{type:1,path:"isDropdownOpen"}]}}],fast:!0}],fast:!1}};var Ht={};R(Ht,{handleClickStart:()=>jo});var jo=(e,t)=>{let{dispatchEvent:r,store:s}=e,i=t._event;console.log("handle click start",s.selectPath()),r(new CustomEvent("start-click",{detail:{path:s.selectPath()}}))};var Ss={componentName:"rtgl-navbar",propsSchema:{type:"object",properties:{start:{type:"object",properties:{label:{type:"string"},href:{type:"string"},image:{type:"object",properties:{src:{type:"string"}}}}}}},events:{"start-click":{type:"object",properties:{path:{type:"string"}}}},methods:{type:"object",properties:{}}};var Gt={};R(Gt,{createInitialState:()=>Bo,selectPath:()=>Uo,selectViewData:()=>Fo,setState:()=>Ko});var Bo=()=>Object.freeze({}),Wo=["id","class","style","slot","start"],Mo=(e={})=>Object.entries(e).filter(([t])=>!Wo.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),zo=e=>{if(e!=null){if(typeof e=="object")return e;if(typeof e=="string")try{return JSON.parse(decodeURIComponent(e))}catch{try{return JSON.parse(e)}catch{return}}}},Fo=({props:e})=>{let t=zo(e.start)||e.start;return{containerAttrString:Mo(e),start:t||{label:"",image:{src:"",width:32,height:32,alt:""}}}},Uo=({props:e})=>e.start?.path,Ko=({state:e})=>{};var Cs={refs:{start:{eventListeners:{click:{handler:"handleClickStart"}}}},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=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=md cur=pointer",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=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 w=1fg",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 qt={};R(qt,{handleBeforeMount:()=>Go});var Is=(e,t,r)=>{let{store:s,render:i}=r,n,a=-1/0;if(e.forEach(l=>{let p=l.getBoundingClientRect();p.top<=t&&p.top>a&&(a=p.top,n=l.id)}),!n){let l=1/0;e.forEach(p=>{let o=p.getBoundingClientRect();o.top>t&&o.top<l&&(l=o.top,n=p.id)})}n&&n!==s.selectCurrentId()&&(s.setCurrentId({id:n}),i())},Ho=(e,t,r,s)=>{let{store:i,render:n}=s,a=e.querySelectorAll("h1[id], h2[id], h3[id], h4[id], rtgl-text[id]"),l=Array.from(a),p=l.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({items:p}),Is(l,r,s),n();let o=Is.bind(void 0,l,r,s);return t.addEventListener("scroll",o,{passive:!0}),()=>{t.removeEventListener("scroll",o)}},Go=e=>{let{props:t}=e,r=()=>{};return requestAnimationFrame(()=>{let s=document.getElementById(t.targetId);if(!s)return;let i=window;t.scrollContainerId&&(i=document.getElementById(t.scrollContainerId)||window);let n=parseInt(t.offsetTop||"100",10);r=Ho(s,i,n,e)}),()=>{r()}};var Os={componentName:"rtgl-page-outline",propsSchema:{type:"object",properties:{targetId:{type:"string"},scrollContainerId:{type:"string"},offsetTop:{type:"string"}}},events:{onItemClick:{type:"object"}},methods:{type:"object",properties:{}}};var Jt={};R(Jt,{createInitialState:()=>qo,selectCurrentId:()=>Xo,selectState:()=>Yo,selectViewData:()=>Jo,setContentContainer:()=>el,setCurrentId:()=>Qo,setItems:()=>Zo});var qo=()=>Object.freeze({items:[],currentId:null,contentContainer:null}),Jo=({state:e})=>{let r=((s,i)=>{let n=new Set,a=s.findIndex(p=>p.id===i);if(a===-1)return n;let l=s[a].level;for(let p=a-1;p>=0;p--)if(s[p].level<l){let o=s[p].level;n.add(s[p].id);for(let c=p-1;c>=0;c--)s[c].level<o&&(n.add(s[c].id),o=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,a=r.has(s.id),l=n||a;return{...s,c:l?"fg":"mu-fg",ml:i[s.level]||"",bc:l?"fg":"mu-fg"}}),currentId:e.currentId}},Yo=({state:e})=>e,Xo=({state:e})=>e.currentId,Zo=({state:e},t={})=>{e.items=Array.isArray(t.items)?t.items:[]},Qo=({state:e},t={})=>{e.currentId=t.id},el=({state:e},t={})=>{e.contentContainer=t.container};var Ts={refs:{},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view h=f w=272 d=v pr=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=1fg sv 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 Yt={};R(Yt,{handleBeforeMount:()=>tl,handleInputChange:()=>nl,handleInputKeydown:()=>ol,handleOnUpdate:()=>rl,handlePopoverClose:()=>il,handleSubmitClick:()=>al,handleTextClick:()=>sl});var tl=e=>{let{store:t,props:r}=e;r.value!==void 0&&t.setValue({value:r.value||""})},rl=(e,t)=>{let{oldProps:r,newProps:s}=t,{store:i,render:n}=e;if(r?.value!==s?.value){let a=s?.value??"";i.setValue({value:a})}n()},sl=(e,t)=>{let{store:r,render:s,refs:i,props:n}=e,a=t._event,l=r.selectValue();r.setTempValue({value:l}),r.openPopover({position:{x:a.currentTarget.getBoundingClientRect().left,y:a.currentTarget.getBoundingClientRect().bottom}});let{input:p}=i;p.value=l,s(),n.autoFocus&&setTimeout(()=>{p.focus()},50)},il=(e,t)=>{let{store:r,render:s}=e;r.closePopover({}),s()},nl=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,a=t._event.detail.value;r.setTempValue({value:a}),i(new CustomEvent("value-input",{detail:{value:a},bubbles:!0})),s()},al=e=>{let{store:t,render:r,dispatchEvent:s,refs:i}=e,{input:n}=i,a=n.value;t.setValue({value:a}),t.closePopover({}),s(new CustomEvent("value-change",{detail:{value:a},bubbles:!0})),r()},ol=(e,t)=>{let{store:r,render:s,dispatchEvent:i,refs:n}=e,a=t._event;if(a.key==="Enter"){let{input:l}=n,p=l.value;r.closePopover({}),i(new CustomEvent("value-change",{detail:{value:p},bubbles:!0})),s()}else a.key==="Escape"&&(r.closePopover({}),s())};var Ls={componentName:"rtgl-popover-input",propsSchema:{type:"object",properties:{value:{type:"string"},placeholder:{type:"string"},label:{type:"string"},autoFocus:{type:"boolean"}}},events:{"value-input":{},"value-change":{}},methods:{type:"object",properties:{}}};var Xt={};R(Xt,{closePopover:()=>dl,createInitialState:()=>ll,openPopover:()=>ul,selectValue:()=>hl,selectViewData:()=>pl,setTempValue:()=>cl,setValue:()=>fl});var ll=()=>Object.freeze({isOpen:!1,position:{x:0,y:0},value:"",tempValue:""}),pl=({props:e,state:t})=>{let r=t.value||"-";return{isOpen:t.isOpen,position:t.position,value:r,tempValue:t.tempValue,placeholder:e.placeholder??"",label:e.label}},cl=({state:e},t={})=>{e.tempValue=t.value},ul=({state:e},t={})=>{let{position:r}=t;e.position=r,e.isOpen=!0,e.hasUnsavedChanges=!1},dl=({state:e})=>{e.isOpen=!1,e.tempValue=""},fl=({state:e},t={})=>{e.value=t.value},hl=({state:e})=>e.value;var Rs={refs:{textDisplay:{eventListeners:{click:{handler:"handleTextClick"}}},popover:{eventListeners:{close:{handler:"handlePopoverClose"}}},input:{eventListeners:{"value-input":{handler:"handleInputChange"},keydown:{handler:"handleInputKeydown"}}},submit:{eventListeners:{click:{handler:"handleSubmitClick"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view#textDisplay w=f cur=pointer",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=bg 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 Zt={};R(Zt,{handleAddOptionClick:()=>Al,handleAddOptionMouseEnter:()=>El,handleAddOptionMouseLeave:()=>kl,handleBeforeMount:()=>ml,handleButtonClick:()=>gl,handleClearClick:()=>xl,handleClickOptionsPopoverOverlay:()=>vl,handleOnUpdate:()=>yl,handleOptionClick:()=>bl,handleOptionMouseEnter:()=>wl,handleOptionMouseLeave:()=>_l});var ml=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=>de(n.value,r.selectedValue));i&&(t.updateSelectedValue({value:i?.value}),s())}},yl=(e,t)=>{let{oldProps:r,newProps:s}=t,{store:i,render:n}=e;if(r?.key!==s?.key&&s?.key){i.resetSelection({});let a=s?.selectedValue,l=s?.options||[];if(a!=null&&l){let p=l.find(o=>de(o.value,a));p&&i.updateSelectedValue({value:p.value})}n()}else r.selectedValue!==s.selectedValue&&(i.updateSelectedValue({value:s.selectedValue}),n())},gl=(e,t)=>{let{store:r,render:s,refs:i,props:n}=e;t._event.stopPropagation();let l=i.selectButton,p=l.firstElementChild,o=p?p.getBoundingClientRect():l.getBoundingClientRect(),c=r.selectSelectedValue(),u=c!==null?c:n.selectedValue,d=null;u!=null&&n.options&&(d=n.options.findIndex(h=>de(h.value,u)),d===-1&&(d=null)),r.openOptionsPopover({position:{y:o.bottom+12,x:o.left-24},selectedIndex:d}),s()},vl=e=>{let{store:t,render:r}=e;t.closeOptionsPopover({}),r()},bl=(e,t)=>{let{render:r,dispatchEvent:s,props:i,store:n}=e,a=t._event;a.stopPropagation();let l=a.currentTarget.id.slice(6),p=Number(l),o=i.options[l];n.updateSelectedValue({value:o?.value}),i.onChange&&typeof i.onChange=="function"&&i.onChange(o.value),s(new CustomEvent("value-change",{detail:{value:o.value,label:o.label,index:p,item:o},bubbles:!0})),r()},wl=(e,t)=>{let{store:r,render:s}=e,i=t._event,n=parseInt(i.currentTarget.id.slice(6),10);r.setHoveredOption({optionId:n}),s()},_l=(e,t)=>{let{store:r,render:s}=e;r.clearHoveredOption({}),s()},xl=(e,t)=>{let{store:r,render:s,dispatchEvent:i,props:n}=e;t._event.stopPropagation(),r.clearSelectedValue({}),n.onChange&&typeof n.onChange=="function"&&n.onChange(void 0),i(new CustomEvent("value-change",{detail:{value:void 0,label:void 0,index:null,item:void 0},bubbles:!0})),s()},Al=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,{_event:n}=t;n.stopPropagation(),r.closeOptionsPopover({}),i(new CustomEvent("add-option-click",{bubbles:!0})),s()},El=(e,t)=>{let{store:r,render:s}=e;r.setHoveredAddOption({isHovered:!0}),s()},kl=(e,t)=>{let{store:r,render:s}=e;r.setHoveredAddOption({isHovered:!1}),s()};var Ns={componentName:"rtgl-select",propsSchema:{type:"object",properties:{placeholder:{type:"string"},options:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"any"},testId:{type:"string"}}}},selectedValue:{type:"any"},onChange:{type:"function"},noClear:{type:"boolean"},addOption:{type:"object",properties:{label:{type:"string"}}},w:{type:"string"}}},events:{"value-change":{},"add-option-click":{}},methods:{type:"object",properties:{}}};var Qt={};R(Qt,{clearHoveredOption:()=>Dl,clearSelectedValue:()=>jl,closeOptionsPopover:()=>Rl,createInitialState:()=>Cl,openOptionsPopover:()=>Ll,resetSelection:()=>Pl,selectSelectedValue:()=>Tl,selectState:()=>Ol,selectViewData:()=>Il,setHoveredAddOption:()=>Bl,setHoveredOption:()=>Vl,updateSelectedValue:()=>Nl});var $l=["id","class","style","slot","placeholder","selectedValue","onChange","options","noClear","addOption"],Sl=(e={})=>Object.entries(e).filter(([t])=>!$l.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Cl=()=>Object.freeze({isOpen:!1,position:{x:0,y:0},selectedValue:null,hoveredOptionId:null,hoveredAddOption:!1}),Il=({state:e,props:t})=>{let r=Sl(t),s=e.selectedValue!==null?e.selectedValue:t.selectedValue,i=t.placeholder||"Select an option",n=!0,a=t.options||[],l=a.find(o=>de(o.value,s));l&&(i=l.label,n=!1);let p=a.map((o,c)=>{let u=de(o.value,s),d=e.hoveredOptionId===c;return{...o,isSelected:u,bgc:d?"ac":u?"mu":""}});return{containerAttrString:r,isOpen:e.isOpen,position:e.position,options:p,selectedValue:s,selectedLabel:i,selectedLabelColor:n?"mu-fg":"fg",hasValue:s!=null,showClear:!t.noClear&&s!=null,showAddOption:!!t.addOption,addOptionLabel:t.addOption?.label?`+ ${t.addOption.label}`:"+ Add",addOptionBgc:e.hoveredAddOption?"ac":""}},Ol=({state:e})=>e,Tl=({state:e})=>e.selectedValue,Ll=({state:e},t={})=>{let{position:r,selectedIndex:s}=t;e.position=r,e.isOpen=!0,s!=null&&(e.hoveredOptionId=s)},Rl=({state:e})=>{e.isOpen=!1},Nl=({state:e},t={})=>{e.selectedValue=t.value,e.isOpen=!1},Pl=({state:e})=>{e.selectedValue=void 0},Vl=({state:e},t={})=>{e.hoveredOptionId=t.optionId},Dl=({state:e})=>{e.hoveredOptionId=null},jl=({state:e})=>{e.selectedValue=void 0},Bl=({state:e},t={})=>{e.hoveredAddOption=!!t.isHovered};var Ps={refs:{selectButton:{eventListeners:{click:{handler:"handleButtonClick"}}},clearButton:{eventListeners:{click:{handler:"handleClearClick"}}},popover:{eventListeners:{close:{handler:"handleClickOptionsPopoverOverlay"}}},"option*":{eventListeners:{click:{handler:"handleOptionClick"},mouseenter:{handler:"handleOptionMouseEnter"},mouseleave:{handler:"handleOptionMouseLeave"}}},optionAdd:{eventListeners:{click:{handler:"handleAddOptionClick"},mouseenter:{handler:"handleAddOptionMouseEnter"},mouseleave:{handler:"handleAddOptionMouseLeave"}}}},template:{type:9,items:[{type:8,properties:[{key:'rtgl-button#selectButton v=ol ${containerAttrString} data-testid="select-button"',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 w=1fg c=${selectedLabelColor} ellipsis",value:{type:1,path:"selectedLabel"},parsedKey:{type:2,parts:["rtgl-text w=1fg c=",{type:1,path:"selectedLabelColor"}," ellipsis"]}}],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#clearButton ml=md svg=x wh=16 c=mu-fg cur=pointer data-testid="select-clear-button"',value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-svg ml=md 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#selectButton v=ol ",{type:1,path:"containerAttrString"},' data-testid="select-button"']}}],fast:!1},{type:8,properties:[{key:"rtgl-popover#popover ?open=${isOpen} x=${position.x} y=${position.y} place=rs",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view wh=300 g=xs slot=content bgc=mu 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=pointer br=md bgc=${option.bgc} data-testid=${option.testId}",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=pointer br=md bgc=",{type:1,path:"option.bgc"}," data-testid=",{type:1,path:"option.testId"}]}}],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 bwt=sm",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:'rtgl-view#optionAdd w=f ph=lg pv=md cur=pointer br=md bgc=${addOptionBgc} data-testid="select-add-option"',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#optionAdd w=f ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"addOptionBgc"},' data-testid="select-add-option"']}}],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"}," place=rs"]}}],fast:!1}],fast:!1}};var er={};R(er,{handleHeaderClick:()=>Wl,handleItemClick:()=>Ml});var Wl=(e,t)=>{let{store:r,dispatchEvent:s}=e,i=t._event,n,a=r.selectHeader();i.currentTarget.id==="headerLabel"?n=a.labelPath:i.currentTarget.id==="headerImage"?n=a.image.path:i.currentTarget.id==="header"&&(n=a.path),s(new CustomEvent("header-click",{detail:{path:n},bubbles:!0,composed:!0}))},Ml=(e,t)=>{let{store:r,dispatchEvent:s}=e,i=t._event,n=i.currentTarget.dataset.itemId||i.currentTarget.id.slice(4),a=r.selectItem(n);s(new CustomEvent("item-click",{detail:{item:a},bubbles:!0,composed:!0}))};var Vs={componentName:"rtgl-sidebar",propsSchema:{type:"object",properties:{mode:{type:"string"},hideHeader:{type:"boolean",default:!1},w:{type:"string"},bwr:{type:"string"},selectedItemId:{type:"string"},header:{type:"object",properties:{label:{type:"string"},href:{type:"string"},testId:{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"},testId:{type:"string"}}}}}},events:{"header-click":{type:"object",properties:{path:{type:"string"}}},"item-click":{type:"object",properties:{item:{type:"object"}}}},methods:{type:"object",properties:{}}};var rr={};R(rr,{createInitialState:()=>zl,selectActiveItem:()=>Jl,selectHeader:()=>ql,selectItem:()=>Yl,selectViewData:()=>Gl,setState:()=>Xl});var zl=()=>Object.freeze({}),Fl=["id","class","style","slot","header","items","selectedItemId","mode","hideHeader","w","bwr"],Ul=(e={})=>Object.entries(e).filter(([t])=>!Fl.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),De=e=>{if(e!=null){if(typeof e=="object")return e;if(typeof e=="string")try{return JSON.parse(decodeURIComponent(e))}catch{try{return JSON.parse(e)}catch{return}}}},Kl=e=>{if(e===!0)return!0;if(e===!1||e===void 0||e===null)return!1;if(typeof e=="string"){let t=e.trim().toLowerCase();return t===""||t==="true"}return!1},Hl=(e,t)=>e!=null&&e!==""?e:t==="full"?272:64;function tr(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 a of s.items){let l=a.id||a.href||a.path,p=t===l;r.push({id:l,title:a.title,href:a.href,type:a.type||"item",icon:a.icon,hrefAttr:a.href?`href=${a.href}`:"",isSelected:p,itemBgc:p?"ac":"bg",itemHoverBgc:p?"ac":"mu"})}}return r}var Gl=({props:e})=>{let t=De(e.header)||e.header,r=De(e.items)||e.items,s=e.selectedItemId,i=Ul(e),n=e.mode||"full",a=t||{label:"",path:"",image:{src:"",alt:"",width:0,height:0}},l=r?tr(r,s):[],p=!Kl(e.hideHeader),o=e.bwr||"xs",c=Hl(e.w,n),u=n==="full"?"fs":"c",d=n==="full"?"fs":"c",h=n==="full"?"lg":"sm",f=n==="full"?"md":"sm",m=n==="shrunk-lg"?48:40,g=n==="shrunk-lg"?28:20,y=n==="shrunk-lg"?"md":"sm",w=n==="full",_=n==="full",x=n==="full"?"fs":"c",A=n==="full"?"":`ah=${d}`,E=n==="full"?"f":m;return{containerAttrString:i,mode:n,header:a,items:l,sidebarWidth:c,headerAlign:u,itemAlign:d,headerPadding:h,itemPadding:f,itemHeight:m,iconSize:g,firstLetterSize:y,showLabels:w,showGroupLabels:_,itemContentAlign:x,itemAlignAttr:A,itemWidth:E,headerWidth:E,selectedItemId:s,ah:n==="shrunk-lg"||n==="shrunk-md"?"c":"",showHeader:p,rightBorderWidth:o}},ql=({props:e})=>De(e.header)||e.header,Jl=({state:e,props:t})=>{let r=De(t.items)||t.items;return(r?tr(r):[]).find(i=>i.active)},Yl=({props:e},t)=>{let r=De(e.items)||e.items;return(r?tr(r):[]).find(i=>i.id===t)},Xl=({state:e})=>{};var Ds={refs:{headerImage:{eventListeners:{click:{handler:"handleHeaderClick"}}},headerLabel:{eventListeners:{click:{handler:"handleHeaderClick"}}},header:{eventListeners:{click:{handler:"handleHeaderClick"}}},"item*":{eventListeners:{click:{handler:"handleItemClick"}}}},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#headerImage cur=pointer":[{'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#headerLabel cur=pointer":[{"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} d=v bwr=${rightBorderWidth} ah=${ah} ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"$if showHeader",value:{type:6,conditions:[{type:1,path:"showHeader"}],bodies:[{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#headerImage cur=pointer",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#headerLabel cur=pointer",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=pointer data-testid=${header.testId}",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#headerImage cur=pointer",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#headerLabel cur=pointer",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=pointer data-testid=",{type:1,path:"header.testId"}]}}],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}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-view w=f h=1fg sv 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",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${i} data-item-id=${item.id} ${item.hrefAttr} h=${itemHeight} av=c ${itemAlignAttr} ph=${itemPadding} w=${itemWidth} h-bgc=${item.itemHoverBgc} br=lg bgc=${item.itemBgc} cur=pointer data-testid=${item.testId}",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:"i"}," data-item-id=",{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=pointer data-testid=",{type:1,path:"item.testId"}]}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view w=f h=1fg sv 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"}," d=v bwr=",{type:1,path:"rightBorderWidth"}," ah=",{type:1,path:"ah"}," ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var sr={};R(sr,{handleBeforeMount:()=>Zl,handleOnUpdate:()=>Ql,handleValueChange:()=>ep,handleValueInput:()=>tp});var Zl=e=>{let{store:t,props:r}=e;t.setValue({value:r.value??0})},Ql=(e,t)=>{let{oldProps:r,newProps:s}=t,{store:i,render:n}=e;if(r?.value!==s?.value){let a=s?.value??0;i.setValue({value:a}),n()}},ep=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,n=t._event,a=Number(n.detail.value);r.setValue({value:a}),s(),i(new CustomEvent("value-change",{detail:{value:a},bubbles:!0}))},tp=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,n=t._event,a=Number(n.detail.value);r.setValue({value:a}),s(),i(new CustomEvent("value-input",{detail:{value:a},bubbles:!0}))};var js={componentName:"rtgl-slider-input",propsSchema:{type:"object",properties:{key:{type:"string"},value:{type:"string",default:"0"},w:{type:"string",default:""},min:{type:"string",default:"0"},max:{type:"string",default:"100"},step:{type:"string",default:"1"}}},events:{"value-input":{},"value-change":{}},methods:{type:"object",properties:{}}};var ir={};R(ir,{createInitialState:()=>rp,selectViewData:()=>sp,setValue:()=>ip});var rp=()=>Object.freeze({value:0}),sp=({state:e,props:t})=>({key:t.key,value:e.value,w:t.w||"",min:t.min||0,max:t.max||100,step:t.step||1}),ip=({state:e},t={})=>{e.value=t.value};var Bs={refs:{input:{eventListeners:{"value-input":{handler:"handleValueInput"},"value-change":{handler:"handleValueChange"}}},slider:{eventListeners:{"value-change":{handler:"handleValueChange"},"value-input":{handler:"handleValueInput"}}}},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 nr={};R(nr,{handleBeforeMount:()=>np,handleHeaderClick:()=>op,handleRowClick:()=>ap});var np=e=>{},ap=(e,t)=>{let{dispatchEvent:r,props:s}=e,i=t._event,n=parseInt(i.currentTarget.id.slice(3),10),a=s.data?.rows?.[n];a&&r(new CustomEvent("row-click",{detail:{rowIndex:n,rowData:a}}))},op=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,a=t._event.currentTarget.dataset.columnKey,l=r.selectSortInfo(),p="asc";l.column===a&&(l.direction==="asc"?p="desc":l.direction==="desc"&&(p=null)),p?r.setSortColumn({column:a,direction:p}):r.clearSort(),s(),i(new CustomEvent("header-click",{detail:{column:a,direction:p,sortInfo:p?{column:a,direction:p}:null}}))};var Ws={componentName:"rtgl-table",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}}},events:{},methods:{type:"object",properties:{}}};var ar={};R(ar,{clearSort:()=>yp,createInitialState:()=>lp,selectSortInfo:()=>hp,selectState:()=>fp,selectViewData:()=>dp,setSortColumn:()=>mp});var lp=()=>Object.freeze({sortColumn:null,sortDirection:null}),pp=["id","class","style","slot","data"],cp=(e={})=>Object.entries(e).filter(([t])=>!pp.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),up=(e,t)=>{let r=t.split("."),s=e;for(let i of r){if(s==null)return null;s=s[i]}return s},dp=({state:e,props:t})=>{let r=cp(t),s=t.data||{columns:[],rows:[]},i=s.rows.map((n,a)=>{let l=s.columns.map(p=>{let o=up(n,p.key);return{key:p.key,value:o!=null?String(o):""}});return{index:a,cells:l}});return{containerAttrString:r,columns:s.columns||[],rows:i||[]}},fp=({state:e})=>e,hp=({state:e})=>({column:e.sortColumn,direction:e.sortDirection}),mp=({state:e},{column:t,direction:r}={})=>{e.sortColumn=t,e.sortDirection=r},yp=({state:e})=>{e.sortColumn=null,e.sortDirection=null};var Ms={refs:{"row*":{eventListeners:{click:{handler:"handleRowClick"}}},"header*":{eventListeners:{click:{handler:"handleHeaderClick"}}}},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${i} data-column-key=${column.key}",value:{type:1,path:"column.label"},parsedKey:{type:2,parts:["th#header",{type:1,path:"i"}," data-column-key=",{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${rowIndex}",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:"rowIndex"}]}}],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 or={};R(or,{handleClickItem:()=>gp});var gp=(e,t)=>{let{dispatchEvent:r}=e,i=t._event.currentTarget.dataset.id;r(new CustomEvent("item-click",{detail:{id:i}}))};var zs={componentName:"rtgl-tabs",propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"},testId:{type:"string"}}}},selectedTab:{type:"string"}}},events:{"item-click":{type:"object",properties:{id:{type:"string"}}}},methods:{type:"object",properties:{}}};var lr={};R(lr,{createInitialState:()=>vp,selectViewData:()=>_p});var vp=()=>Object.freeze({}),bp=["id","class","style","slot","items","selectedTab"],wp=(e={})=>Object.entries(e).filter(([t])=>!bp.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),_p=({props:e})=>{let t=wp(e),r=e.items||[],s=e.selectedTab,i=r.map(n=>({...n,isSelected:n.id===s,bgColor:n.id===s?"ac":"",borderColor:n.id===s?"":"tr",textColor:n.id===s?"":"mu-fg"}));return{containerAttrString:t,items:i,selectedTab:s}};var Fs={refs:{"tab*":{eventListeners:{click:{handler:"handleClickItem"}}}},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:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view#tab${i} data-id=${item.id} cur=pointer bgc=${item.bgColor} bw=xs bc=${item.borderColor} pv=md ph=lg br=lg data-testid=${item.testId}",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:"i"}," data-id=",{type:1,path:"item.id"}," cur=pointer bgc=",{type:1,path:"item.bgColor"}," bw=xs bc=",{type:1,path:"item.borderColor"}," pv=md ph=lg br=lg data-testid=",{type:1,path:"item.testId"}]}}],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 Us={};var Ks={componentName:"rtgl-tooltip",propsSchema:{type:"object",properties:{open:{type:"string"},x:{type:"string"},y:{type:"string"},place:{type:"string"},content:{type:"string"}}},events:[],methods:{type:"object",properties:{}}};var pr={};R(pr,{createInitialState:()=>xp,selectViewData:()=>Ap});var xp=()=>Object.freeze({}),Ap=({props:e})=>({open:!!e.open,x:e.x||0,y:e.y||0,place:e.place||"t",content:e.content||""});var Hs={template:{type:9,items:[{type:8,properties:[{key:"rtgl-popover#popover ?open=${open} x=${x} y=${y} place=${place} no-overlay",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view slot=content bgc=bg bc=bo br=md p=sm ah=c av=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text ta=c s=sm c=fg",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"}," place=",{type:1,path:"place"}," no-overlay"]}}],fast:!0}],fast:!0},refs:{}};var cr={};R(cr,{handleAfterMount:()=>Ep,handleOnUpdate:()=>kp});var Ep=async e=>{let{props:t,store:r,render:s,refs:i}=e,{waveformData:n}=t;r.setWaveformData({data:n}),s();let a=i.canvas;a&&Gs(n,a)},kp=async(e,t)=>{let{store:r,render:s,refs:i,props:n}=e,{waveformData:a}=n;if(!a){console.log("waveform handleOnUpdate: no waveformData provided");return}r.setWaveformData({data:a}),s();let l=i.canvas;l&&Gs(a,l)};async function Gs(e,t){let r=t.getContext("2d"),s=t.getBoundingClientRect(),i=s.width,n=s.height;t.width=i,t.height=n;let a=t.width,l=t.height;if(r.clearRect(0,0,a,l),r.fillStyle="#1a1a1a",r.fillRect(0,0,a,l),!e||!e.amplitudes)return;let p=e.amplitudes,o=l/2,c=r.createLinearGradient(0,0,0,l);c.addColorStop(0,"#404040"),c.addColorStop(.5,"#A1A1A1"),c.addColorStop(1,"#404040");let u=Math.max(1,a/p.length),d=.2;for(let h=0;h<p.length;h++){let m=p[h]/255*(l*.85),g=h*u,y=o-m/2;r.fillStyle=c,r.fillRect(g,y,Math.max(1,u*(1-d)),m)}r.strokeStyle="rgba(255, 255, 255, 0.1)",r.lineWidth=1,r.beginPath(),r.moveTo(0,o),r.lineTo(a,o),r.stroke(),r.shadowBlur=10,r.shadowColor="#2196F3"}var qs={componentName:"rtgl-waveform",propsSchema:{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"},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"}}},events:[],methods:{type:"object",properties:{}}};var ur={};R(ur,{createInitialState:()=>$p,selectViewData:()=>Cp,setWaveformData:()=>Sp});var $p=()=>Object.freeze({waveformData:null}),Sp=({state:e},t={})=>{e.waveformData=t.data},Cp=({state:e,props:t})=>({isLoading:t.isLoading,w:t.w||"250",h:t.h||"150",cur:t.cur,waveformData:t.waveformData});var Js={refs:{canvas:{selector:"canvas"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view 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 pos=rel w=",{type:1,path:"w"}," h=",{type:1,path:"h"}," cur=",{type:1,path:"cur"}]}}],fast:!1}],fast:!1}};var dr=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Xe=e=>e.replace(/-([a-z0-9])/g,(t,r)=>r.toUpperCase()),Ye=e=>{if(e!=null)return e===""?!0:e},Ys=(e,t)=>{let r=e.getAttribute(t);if(r!==null)return Ye(r);let s=dr(t);if(s!==t){let i=e.getAttribute(s);if(i!==null)return Ye(i)}},Xs=(e,t)=>{let r=new Set(t);return new Proxy({},{get(s,i){if(typeof i=="string"&&r.has(i)){let n=e[i];return n!==void 0?n:Ys(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:()=>{let n=e[i];return n!==void 0?n:Ys(e,i)}}}})};var Zs=({schema:e,methodExports:t=[]})=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("componentName is required.");if(typeof e.componentName!="string"||e.componentName.trim()==="")throw new Error("componentName is required.");if(Object.prototype.hasOwnProperty.call(e,"attrsSchema"))throw new Error("attrsSchema is not supported.");if(Object.prototype.hasOwnProperty.call(e,"methods")){let r=e.methods;if(!r||typeof r!="object"||Array.isArray(r))throw new Error("methods must be an object schema with a properties map.");if(Object.prototype.hasOwnProperty.call(r,"type")&&r.type!=="object")throw new Error("methods.type must be 'object'.");if(!r.properties||typeof r.properties!="object"||Array.isArray(r.properties))throw new Error("methods.properties must be an object keyed by method name.");for(let s of Object.keys(r.properties))if(!t.includes(s))throw new Error(`method '${s}' is declared in schema but missing in .methods.js exports.`)}return!0};var v={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},D={EQ:0,NEQ:1,GT:2,LT:3,GTE:4,LTE:5,AND:6,OR:7,IN:8,ADD:10,SUBTRACT:11},je={NOT:0};var O=class extends Error{constructor(t){super(`Parse Error: ${t}`),this.name="JemplParseError"}},Q=class extends Error{constructor(t){super(`Render Error: ${t}`),this.name="JemplRenderError"}};var fr=e=>{if(!e||e.trim()==="")throw new O("Missing condition expression after '$if'");if(e.includes("===")||e.includes("!==")){let r=e.includes("===")?"==":"!=";throw new O(`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 O(`Incomplete comparison expression - missing right operand (got: '${e}')`)},Qs=e=>{if(e.trim().endsWith(" in"))throw new O(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(!e.includes(" in "))throw new O(`Invalid loop syntax - missing 'in' keyword (got: '$for ${e}')`);let[t,r]=e.split(" in ");if(!r||r.trim()==="")throw new O(`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 O(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`)}else if(!t.trim())throw new O(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`)};var ei=(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}'`)},ti=(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 Ip=(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 a=I(e,{functions:s,partials:i},t,{});return a===void 0?{}:a},I=(e,t,r,s)=>{let i=t.functions||t;if(e.var&&!e.type)return z(e.var,r,s);if(e.type===v.LITERAL)return e.value;if(e.type===v.VARIABLE)return z(e.path,r,s);if(e.type===v.INTERPOLATION)return Tp(e.parts,t,r,s);switch(e.type){case v.FUNCTION:return si(e,t,r,s);case v.BINARY:return ii(e,t,r,s);case v.UNARY:return ni(e,t,r,s);case v.CONDITIONAL:return Rp(e,t,r,s);case v.LOOP:return jp(e,t,r,s);case v.OBJECT:return Wp(e,t,r,s);case v.ARRAY:return Mp(e,t,r,s);case v.PARTIAL:return zp(e,t,r,s);case v.PATH_REFERENCE:return Fp(e,t,r,s);default:throw new Error(`Unknown node type: ${e.type}`)}},ri=new Map,Op=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 a=r.trim();if(/^\d+$/.test(a))t.push({type:"index",value:parseInt(a,10)});else if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'")){let l=a.slice(1,-1);t.push({type:"property",value:l})}else t.push({type:"property",value:a});r=""}s=!1}else r+=n}return r&&t.push({type:"property",value:r}),t},z=(e,t,r)=>{if(!e)return;if(e in r)return r[e];let s=ri.get(e);if(!s){let n=[],a="",l=0;for(let p=0;p<e.length;p++){let o=e[p];o==="["?(l++,a+=o):o==="]"?(l--,a+=o):o==="."&&l===0?a&&(n.push(a),a=""):a+=o}a&&n.push(a),s=[];for(let p of n){let o=Op(p.trim());s.push(...o)}ri.set(e,s)}let i=t;for(let n=0;n<s.length;n++){let a=s[n];if(a.type==="property"&&a.value in r){i=r[a.value];continue}if(i==null)return;(a.type==="property"||a.type==="index")&&(i=i[a.value])}return i},Tp=(e,t,r,s)=>{let i=[];for(let n of e)if(typeof n=="string")i.push(n);else{let a=I(n,t,r,s);i.push(a!=null?String(a):"")}return i.join("")},si=(e,t,r,s)=>{let i=t.functions||t,n=i[e.name];if(!n)throw ti(e.name,i);let a=e.args.map(l=>I(l,t,r,s));return n(...a)},ke=(e,t,r,s)=>{if(e.var&&!e.type)return z(e.var,r,s);switch(e.type){case v.VARIABLE:return z(e.path,r,s);case v.LITERAL:return e.value;case v.BINARY:return ii(e,t,r,s);case v.UNARY:return ni(e,t,r,s);case v.FUNCTION:return si(e,t,r,s);default:return I(e,t,r,s)}},ii=(e,t,r,s)=>{if(e.op===D.AND||e.op===D.OR){let a=ke(e.left,t,r,s),l=ke(e.right,t,r,s);switch(e.op){case D.AND:return a&&l;case D.OR:return a||l}}let i=I(e.left,t,r,s),n=I(e.right,t,r,s);switch(e.op){case D.EQ:return i==n;case D.NEQ:return i!=n;case D.GT:return i>n;case D.LT:return i<n;case D.GTE:return i>=n;case D.LTE:return i<=n;case D.IN:return Array.isArray(n)?n.includes(i):!1;case D.ADD:if(typeof i!="number"||typeof n!="number")throw new Q(`Arithmetic operations require numbers. Got ${typeof i} + ${typeof n}`);return i+n;case D.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}`)}},ni=(e,t,r,s)=>{let i=e.op===je.NOT?ke(e.operand,t,r,s):I(e.operand,t,r,s);switch(e.op){case je.NOT:return!i;default:throw new Error(`Unknown unary operator: ${e.op}`)}},Lp=(e,t,r,s)=>{if(e.conditions.length===2&&e.conditions[1]===null){let i=e.conditions[0];if(i.type===v.VARIABLE)if(z(i.path,r,s)){let a=e.bodies[0];if(a.type===v.OBJECT&&a.properties.length<=5){let l={};for(let p of a.properties){let o=p.parsedKey?I(p.parsedKey,t,r,s):p.key,c=p.value;if(c.type===v.LITERAL)l[o]=c.value;else if(c.type===v.VARIABLE)l[o]=z(c.path,r,s);else if(c.type===v.INTERPOLATION){let u=[];for(let d of c.parts)if(typeof d=="string")u.push(d);else if(d.type===v.VARIABLE){let h=z(d.path,r,s);u.push(h!=null?String(h):"")}else{let h=I(d,t,r,s);u.push(h!=null?String(h):"")}l[o]=u.join("")}else l[o]=I(c,t,r,s)}return l}}else{let a=e.bodies[1];if(a.type===v.OBJECT&&a.properties.length<=5){let l={};for(let p of a.properties){let o=p.parsedKey?I(p.parsedKey,t,r,s):p.key,c=p.value;if(c.type===v.LITERAL)l[o]=c.value;else if(c.type===v.VARIABLE)l[o]=z(c.path,r,s);else if(c.type===v.INTERPOLATION){let u=[];for(let d of c.parts)if(typeof d=="string")u.push(d);else if(d.type===v.VARIABLE){let h=z(d.path,r,s);u.push(h!=null?String(h):"")}else{let h=I(d,t,r,s);u.push(h!=null?String(h):"")}l[o]=u.join("")}else l[o]=I(c,t,r,s)}return l}}}return null},Rp=(e,t,r,s)=>{let i=Lp(e,t,r,s);if(i!==null)return i;for(let n=0;n<e.conditions.length;n++){let a=e.conditions[n];if(a===null||ke(a,t,r,s))return I(e.bodies[n],t,r,s)}return ai},Np=(e,t)=>{let r=e.body,s=e.itemVar;if(r.type===v.CONDITIONAL&&r.conditions.length===1&&r.conditions[0].type===v.VARIABLE){let i=r.conditions[0].path,n=r.bodies[0];if(i.startsWith(s+".")){let a=i.substring(s.length+1);if(n.type===v.OBJECT&&n.properties.length<=5){for(let p of n.properties)if(p.parsedKey)return null;let l=[];for(let p=0;p<t.length;p++){let o=t[p];if(o[a]){let c={};for(let u of n.properties){let d=u.key,h=u.value;if(h.type===v.LITERAL)c[d]=h.value;else if(h.type===v.VARIABLE){let f=h.path;if(f===s)c[d]=o;else if(f.startsWith(s+".")){let m=f.substring(s.length+1);c[d]=o[m]}else return null}else if(h.type===v.INTERPOLATION){let f=[],m=!0;for(let g of h.parts)if(typeof g=="string")f.push(g);else if(g.type===v.VARIABLE){let y=g.path;if(y===s)f.push(o!=null?String(o):"");else if(y.startsWith(s+".")){let w=y.substring(s.length+1),_=o[w];f.push(_!=null?String(_):"")}else{m=!1;break}}else{m=!1;break}if(!m)return null;c[d]=f.join("")}else return null}l.push(c)}}return l}}}return null},Pp=(e,t)=>{let r=e.body,s=e.itemVar,i=Np(e,t);if(i!==null)return i;if(r.type===v.OBJECT&&r.properties.length<=5){for(let l of r.properties)if(l.parsedKey)return null;let n=[],a=!0;for(let l of r.properties){let p=l.key,o=l.value;if(o.type===v.LITERAL)n.push({key:p,type:"literal",value:o.value});else if(o.type===v.VARIABLE){let c=o.path;if(c===s)n.push({key:p,type:"item"});else if(c.startsWith(s+".")){let u=c.substring(s.length+1);if(!u.includes(".")&&!u.includes("["))n.push({key:p,type:"prop",prop:u});else{a=!1;break}}else{a=!1;break}}else if(o.type===v.INTERPOLATION&&o.parts.length===1){let c=o.parts[0];if(c.type===v.VARIABLE){let u=c.path;if(u===s)n.push({key:p,type:"item_string"});else if(u.startsWith(s+".")){let d=u.substring(s.length+1);if(!d.includes(".")&&!d.includes("["))n.push({key:p,type:"prop_string",prop:d});else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}if(a){let l=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 p=0;p<t.length;p++){let o=t[p];l[p]={id:o.id,title:o.title!=null?String(o.title):"",completed:o.completed}}else for(let p=0;p<t.length;p++){let o=t[p],c={};for(let u of n)if(u.type==="literal")c[u.key]=u.value;else if(u.type==="item")c[u.key]=o;else if(u.type==="prop")c[u.key]=o[u.prop];else if(u.type==="item_string")c[u.key]=o!=null?String(o):"";else if(u.type==="prop_string"){let d=o[u.prop];c[u.key]=d!=null?String(d):""}l[p]=c}return l}}return null},Vp=(e,t,r,s,i)=>{let n=[],a=e.body;if(a.type===v.OBJECT&&a.fast!==!1){let l=e.itemVar,p=e.indexVar;for(let o=0;o<i.length;o++){let c=i[o],u={},d={...s,[l]:c,...p&&{[p]:o}};d.__paths__||(d.__paths__=s.__paths__||{});let h=e.iterable.path||"";if(s&&s.__paths__&&h){let f=h.split("."),m=f[0];m in s.__paths__&&(h=s.__paths__[m],f.length>1&&(h+="."+f.slice(1).join(".")))}d.__paths__={...d.__paths__,[l]:`${h}[${o}]`,...p&&{[p]:o}};for(let f of a.properties){let m=f.parsedKey?I(f.parsedKey,t,r,d):f.key,g=f.value;if(g.type===v.LITERAL)u[m]=g.value;else if(g.type===v.VARIABLE){let y=g.path;if(y===l)u[m]=c;else if(y===p)u[m]=o;else if(y.startsWith(l+".")){let w=y.substring(l.length+1);!w.includes(".")&&!w.includes("[")?u[m]=c[w]:u[m]=z(y,r,{...s,[l]:c,...p&&{[p]:o}})}else u[m]=z(y,r,{...s,[l]:c,...p&&{[p]:o}})}else if(g.type===v.INTERPOLATION){let y=[];for(let w of g.parts)if(typeof w=="string")y.push(w);else if(w.type===v.VARIABLE){let _=w.path,x;if(_===l)x=c;else if(_===p)x=o;else if(_.startsWith(l+".")){let A=_.substring(l.length+1);!A.includes(".")&&!A.includes("[")?x=c[A]:x=z(_,r,{...s,[l]:c,...p&&{[p]:o}})}else x=z(_,r,{...s,[l]:c,...p&&{[p]:o}});y.push(x!=null?String(x):"")}else{let _={...s,[l]:c,...p&&{[p]:o}},x=I(w,t,r,_);y.push(x!=null?String(x):"")}u[m]=y.join("")}else{let y={...s,[l]:c,...p&&{[p]:o}};u[m]=I(g,t,r,y)}}n.push(u)}return n}return null},Dp=(e,t,r)=>{let s=e.body;if(s.type===v.OBJECT&&s.properties.length===1&&s.properties[0].key==="$if item.visible"){let n=s.properties[0].value;if(n.type===v.CONDITIONAL&&n.conditions.length===1&&n.conditions[0].type===v.VARIABLE&&n.conditions[0].path==="item.visible"){let a=n.bodies[0];if(a.type===v.OBJECT&&a.properties.length===2){let l=a.properties[0],p=a.properties[1];if(l.key==="id"&&l.value.type===v.VARIABLE&&l.value.path==="item.id"&&p.key==="$if item.highlighted"&&p.value.type===v.CONDITIONAL){let o=[];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),o.push(d)}}return o}}}}return null},jp=(e,t,r,s)=>{let i=I(e.iterable,t,r,s);if(!Array.isArray(i)){let o,c=!1;if(e.iterable.type===v.FUNCTION){c=!0;let d=e.iterable.args.map(h=>h.type===v.LITERAL?typeof h.value=="string"?`'${h.value}'`:String(h.value):h.type===v.VARIABLE?h.path:h.type===v.FUNCTION?`${h.name}(...)`:"?").join(", ");o=`${e.iterable.name}(${d})`}else o=e.iterable.path||"undefined";let u=`${e.itemVar}${e.indexVar?`, ${e.indexVar}`:""} in ${o}`;throw ei(u,i,c)}if(!e.indexVar){let o=Dp(e,i,e.itemVar);if(o!==null)return o}if(!e.indexVar){let o=Pp(e,i);if(o!==null)return o}let n=Vp(e,t,r,s,i);if(n!==null)return n;let a=[],l=e.iterable.path||"";if(s&&s.__paths__&&l){let o=l.split("."),c=o[0];c in s.__paths__&&(l=s.__paths__[c],o.length>1&&(l+="."+o.slice(1).join(".")))}let p=!1;e.body.type===v.ARRAY&&(e.body.items.length<=1?p=!1:p=e.body._shouldPreserveArray??=e.body.items.some(o=>o.type===v.OBJECT&&o.properties.some(c=>c.key.startsWith("$if ")||c.key.startsWith("$when "))));for(let o=0;o<i.length;o++){let c=e.indexVar?{...s,[e.itemVar]:i[o],[e.indexVar]:o}:{...s,[e.itemVar]:i[o]};c.__paths__||(c.__paths__=s.__paths__||{}),c.__paths__={...c.__paths__,[e.itemVar]:`${l}[${o}]`},e.indexVar&&(c.__paths__[e.indexVar]=o);let u=I(e.body,t,r,c);Array.isArray(u)&&u.length===1&&!p?a.push(u[0]):a.push(u)}return a},Bp=(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,a=i.value;if(a.type===v.OBJECT&&a.properties.length<=10&&!a.whenCondition){let l={},p={},o=!0;for(let c of a.properties){let u=c.parsedKey?I(c.parsedKey,t,r,s):c.key,d=c.value;if(d.type===v.LITERAL)p[u]=d.value;else if(d.type===v.VARIABLE)p[u]=z(d.path,r,s);else if(d.type===v.INTERPOLATION){let h=[];for(let f of d.parts)if(typeof f=="string")h.push(f);else if(f.type===v.VARIABLE){let m=z(f.path,r,s);h.push(m!=null?String(m):"")}else{o=!1;break}if(!o)break;p[u]=h.join("")}else if(d.type===v.OBJECT&&d.properties.length<=5){let h={};for(let f of d.properties){let m=f.key,g=f.value;if(g.type===v.LITERAL)h[m]=g.value;else if(g.type===v.VARIABLE)h[m]=z(g.path,r,s);else if(g.type===v.INTERPOLATION){let y=[];for(let w of g.parts)if(typeof w=="string")y.push(w);else if(w.type===v.VARIABLE){let _=z(w.path,r,s);y.push(_!=null?String(_):"")}else{o=!1;break}if(!o)break;h[m]=y.join("")}else{o=!1;break}}if(!o)break;p[u]=h}else{o=!1;break}}if(o)return l[n]=p,l}}return null},Wp=(e,t,r,s)=>{let i=t.functions||t;if(e.whenCondition&&!ke(e.whenCondition,i,r,s))return;let n=Bp(e,t,r,s);if(n!==null)return n;if(e.fast){let o={};for(let c of e.properties){let u=c.parsedKey?I(c.parsedKey,t,r,s):c.key,d=c.value;if(d.type===v.LITERAL)o[u]=d.value;else if(d.type===v.VARIABLE)o[u]=z(d.path,r,s);else if(d.type===v.INTERPOLATION){let h=[];for(let f of d.parts)if(typeof f=="string")h.push(f);else if(f.type===v.VARIABLE){let m=z(f.path,r,s);h.push(m!=null?String(m):"")}else{let m=I(f,t,r,s);h.push(m!=null?String(m):"")}o[u]=h.join("")}else o[u]=I(d,t,r,s)}return o}let a={},l=null,p=!1;for(let o of e.properties)if(!o.key.startsWith("$if ")&&!o.key.match(/^\$if\s+\w+.*:?$/)&&!o.key.startsWith("$elif")&&!o.key.startsWith("$else")&&!o.key.startsWith("$for ")){p=!0;break}for(let o of e.properties)if(o.key.startsWith("$if ")||o.key.match(/^\$if\s+\w+.*:?$/)){let c=I(o.value,t,r,s);if(!p&&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(a,c)}else if(o.key.startsWith("$for ")){if(e.properties.length===1)return I(o.value,t,r,s)}else{let c=o.value;if(c&&c.type===v.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&&(a[o.key]=d)}else{let d=I(o.value,t,r,s);d!==void 0&&(a[o.key]=d)}}else{let u=o.parsedKey?I(o.parsedKey,t,r,s):o.key,d=I(o.value,t,r,s);d!==void 0&&(a[u]=d)}}return a},ai={},Mp=(e,t,r,s)=>{let i=[];for(let n of e.items)if(n.type===v.LOOP){let a=I(n,t,r,s);i.push(a)}else{let a=I(n,t,r,s);a!==ai&&a!==void 0&&i.push(a)}return i},zp=(e,t,r,s)=>{let{name:i,data:n,whenCondition:a}=e,l=t.partials||{},p=t.functions||t;if(a&&!ke(a,p,r,s))return;if(!l[i])throw new Q(`Partial '${i}' is not defined`);let o=s._partialStack||[];if(o.includes(i))throw new Q(`Circular partial reference detected: ${i}`);let c=l[i],u=r,d={...s,_partialStack:[...o,i]};if(s){u={...r};for(let h of Object.keys(s))h.startsWith("_")||(u[h]=s[h])}if(n){let h=I(n,t,r,s);u={...u,...h}}return I(c,t,u,d)},Fp=(e,t,r,s)=>{let{path:i}=e,n=i.split("."),a=n[0],l=n.slice(1);if(!s||!(a in s))throw new Q(`Path reference '#{${i}}' refers to '${a}' which is not a loop variable in the current scope`);if(s.__paths__||(s.__paths__={}),!(a in s.__paths__))throw new Q(`Path reference '#{${i}}' cannot be resolved - path tracking may not be initialized properly`);let p=s.__paths__[a];if(typeof p=="number"){if(l.length>0)throw new Q(`Path reference '#{${i}}' - cannot access properties on index variable '${a}'`);return String(p)}return l.length>0&&(p+="."+l.join(".")),p},Be=Ip;var Up=/\$\{([^}]*)\}/g,Kp=/#\{([^}]*)\}/g,li=(e,t={})=>{let r=e.match(/^(\w+)\((.*)\)$/);if(!r)return{isFunction:!1};let[,s,i]=r,n=Hp(i,t);return{isFunction:!0,type:v.FUNCTION,name:s,args:n}},Hp=(e,t={})=>e.trim()?Gp(e).map(s=>qp(s.trim(),t)):[],Gp=e=>{let t=[],r="",s=0,i=!1,n="";for(let a=0;a<e.length;a++){let l=e[a],p=a>0?e[a-1]:"";!i&&(l==='"'||l==="'")?(i=!0,n=l,r+=l):i&&l===n&&p!=="\\"?(i=!1,n="",r+=l):!i&&l==="("?(s++,r+=l):!i&&l===")"?(s--,r+=l):!i&&l===","&&s===0?(t.push(r),r=""):r+=l}return r&&t.push(r),t},qp=(e,t={})=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:v.LITERAL,value:e.slice(1,-1)};if(/^-?\d+(\.\d+)?$/.test(e))return{type:v.LITERAL,value:parseFloat(e)};if(e==="true")return{type:v.LITERAL,value:!0};if(e==="false")return{type:v.LITERAL,value:!1};if(e==="null")return{type:v.LITERAL,value:null};let r=li(e,t);if(r.isFunction)return{type:r.type,name:r.name,args:r.args};let s=e.trim(),i=[{op:" + ",type:"ADD"},{op:" - ",type:"SUBTRACT"}],n=-1,a=null;for(let{op:l,type:p}of i){let o=0;for(;o<s.length;){let c=ve(s.substring(o),l);if(c===-1)break;let u=o+c;u>n&&(n=u,a={op:l,type:p}),o=u+l.length}}if(n!==-1)try{return Y(s,t)}catch{return{type:v.VARIABLE,path:s}}return{type:v.VARIABLE,path:s}},pi=/^\w+\(.*\)$/,Jp=/\s[+\-*/%]\s|\|\||&&|\?\?|.*\?.*:/,Yp=e=>{if(!(!e||e.trim()===""||pi.test(e))&&Jp.test(e))throw e.includes("?")&&e.includes(":")?new O(`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 O(`Logical operators not supported in variable replacements - consider calculating the value in your data instead (operators like ||, &&, ?? are not supported). Offending expression: "${e}"`):new O(`Arithmetic expressions not supported in variable replacements - consider calculating '${e}' in your data instead (expressions with +, -, *, /, % are not supported). Offending expression: "${e}"`)},oi=e=>{let t=e.trim();if(pi.test(t))throw new O(`Functions are not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(t.includes("["))throw new O(`Array indices not supported in path references - use simple variable names or properties. Offending expression: "#{${e}}"`);if(/[+\-*/%]/.test(t))throw new O(`Arithmetic expressions not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(/\|\||&&/.test(t))throw new O(`Logical operators not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(t.includes("?")&&t.includes(":"))throw new O(`Complex expressions not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);return{type:v.PATH_REFERENCE,path:t}},We=(e,t={})=>{let r=e.trim();Yp(r);let s=li(r,t);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:v.VARIABLE,path:r}},hr=(e,t={})=>{let r=e,s=[];(e.includes("\\${")||e.includes("\\#{"))&&(r=e.replace(/\\\\(\$\{[^}]*\})/g,"\\DOUBLE_ESC_VAR$1"),r=r.replace(/\\\\(#\{[^}]*\})/g,"\\DOUBLE_ESC_PATH$1"),r=r.replace(/\\(\$\{[^}]*\})/g,(o,c)=>{let u=`__ESCAPED_${s.length}__`;return s.push(c),u}),r=r.replace(/\\(#\{[^}]*\})/g,(o,c)=>{let u=`__ESCAPED_${s.length}__`;return s.push(c),u}),r=r.replace(/\\DOUBLE_ESC_VAR/g,"\\"),r=r.replace(/\\DOUBLE_ESC_PATH/g,"\\"));let i=[...r.matchAll(Up)],n=[...r.matchAll(Kp)],a=[...i.map(o=>({match:o,type:"variable"})),...n.map(o=>({match:o,type:"pathref"}))].sort((o,c)=>o.match.index-c.match.index);if(a.length===0){let o=r;for(let c=0;c<s.length;c++)o=o.replace(`__ESCAPED_${c}__`,s[c]);return{type:v.LITERAL,value:o}}if(a.length===1&&a[0].match[0]===r&&s.length===0){let{match:o,type:c}=a[0];try{return c==="variable"?We(o[1],t):oi(o[1])}catch(u){if(u.message==="Invalid array index syntax")return{type:v.LITERAL,value:r};throw u}}let l=[],p=0;for(let{match:o,type:c}of a){let[u,d]=o,h=o.index;if(h>p){let f=r.substring(p,h);for(let m=0;m<s.length;m++)f=f.replace(`__ESCAPED_${m}__`,s[m]);f&&l.push(f)}try{let f;c==="variable"?f=We(d.trim(),t):f=oi(d.trim()),l.push(f)}catch(f){if(f.message==="Invalid array index syntax")l.push(u);else throw f}p=h+u.length}if(p<r.length){let o=r.substring(p);for(let c=0;c<s.length;c++)o=o.replace(`__ESCAPED_${c}__`,s[c]);o&&l.push(o)}return{type:v.INTERPOLATION,parts:l}};var he=(e,t)=>typeof e=="string"?hr(e,t):typeof e=="object"&&e!==null?Array.isArray(e)?Xp(e,t):Zp(e,t):{type:v.LITERAL,value:e},Xp=(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 l=Object.keys(n);if(l.length===1&&l[0].startsWith("$for ")){let p=ui(l[0],n[l[0]],t);r.push(p),s=!0;continue}}let a=he(n,t);r.push(a),(a.type===v.FUNCTION||a.type===v.CONDITIONAL||a.type===v.LOOP||a.type===v.PARTIAL||a.type===v.OBJECT&&!a.fast||a.type===v.ARRAY&&!a.fast)&&(s=!0)}return{type:v.ARRAY,items:r,fast:!s}},Zp=(e,t)=>{let r=[],s=!1,i=null,n=Object.entries(e),a=0;if(e.$partial!==void 0){if(typeof e.$partial!="string")throw new O("$partial value must be a string");if(e.$partial.trim()==="")throw new O("$partial value cannot be an empty string");let p=["$if","$elif","$else","$for"],o=[];for(let[y]of n)for(let w of p)if(y===w||y.startsWith(w+" ")||y.startsWith(w+"#")){o.push(w);break}if(o.length>0)throw new O(`Cannot use $partial with ${o.join(", ")} at the same level. Wrap $partial in a parent object if you need conditionals.`);let{$partial:c,$when:u,...d}=e,h={},f=!1;for(let[y,w]of Object.entries(d)){let _=y;(y.startsWith("\\$")||y.startsWith("$$"))&&(_=y.slice(1)),h[_]=w,f=!0}let m=null;if(f&&(m=he(h,t),m.type===v.OBJECT)){let y=!1;for(let w of m.properties)if(w.value.type===v.VARIABLE||w.value.type===v.INTERPOLATION||w.value.type===v.FUNCTION||w.value.type===v.CONDITIONAL||w.value.type===v.LOOP||w.value.type===v.OBJECT&&!w.value.fast||w.value.type===v.ARRAY&&!w.value.fast){y=!0;break}y&&(m.fast=!1)}let g={type:v.PARTIAL,name:c,data:m};if(u!==void 0){let y;if(typeof u=="string"){if(u.trim()==="")throw new O("Empty condition expression after '$when'");y=Y(u,t)}else y={type:v.LITERAL,value:u};g.whenCondition=y}return g}for(let[p,o]of n)if(p==="$when"){if(i!==null)throw new O("Multiple '$when' directives on the same object are not allowed");if(o==null)throw new O("Missing condition expression after '$when'");let c=typeof o=="string"?o:JSON.stringify(o);if(c.trim()==="")throw new O("Empty condition expression after '$when'");i=Y(c,t),s=!0}else if(p.startsWith("$when#")||p.startsWith("$when "))throw new O("'$when' does not support ID syntax or inline conditions - use '$when' as a property");for(;a<n.length;){let[p,o]=n[a];if(p==="$when"){a++;continue}if(p.startsWith("$if ")||p.match(/^\$if#\w+\s/)||p.match(/^\$if\s+\w+.*:$/)){let c=Qp(n,a,t);r.push({key:p,value:c.node}),s=!0,a=c.nextIndex}else if(p.startsWith("$for ")){let c=ui(p,o,t);r.push({key:p,value:c}),s=!0,a++}else{if(p.startsWith("$elif ")||p.startsWith("$else"))throw new O(`'${p.split(" ")[0]}' without matching '$if'`);if(p==="$if"||p==="$if:")throw new O("Missing condition expression after '$if'");{let c=he(o,t);(c.type===v.FUNCTION||c.type===v.CONDITIONAL||c.type===v.LOOP||c.type===v.PARTIAL||c.type===v.OBJECT&&!c.fast||c.type===v.ARRAY&&!c.fast)&&(s=!0);let u=hr(p,t),d={key:p,value:c};(u.type!==v.LITERAL||u.value!==p)&&(d.parsedKey=u),r.push(d),a++}}}let l={type:v.OBJECT,properties:r,fast:!s};return i&&(l.whenCondition=i),l},Qp=(e,t,r={})=>{let s=[],i=[],n=t,[a,l]=e[n],p=null,o;if(a.startsWith("$if#")){let u=a.match(/^\$if#(\w+)\s+(.+)$/);if(u)p=u[1],o=u[2];else throw new O(`Invalid conditional syntax: ${a}`)}else o=a.substring(4),o.endsWith(":")&&(o=o.slice(0,-1).trim());fr(o);let c=Y(o,r);for(s.push(c),i.push(he(l,r)),n++;n<e.length;){let[u,d]=e[n],h=!1,f;if(p?u.startsWith(`$elif#${p} `)?(f=u.substring(`$elif#${p} `.length),f.endsWith(":")&&(f=f.slice(0,-1).trim()),h=!0):(u===`$else#${p}`||u===`$else#${p}:`)&&(h=!0,f=null):u.startsWith("$elif ")?(f=u.substring(6),f.endsWith(":")&&(f=f.slice(0,-1).trim()),h=!0):(u==="$else"||u==="$else:")&&(h=!0,f=null),h){if(f===null)s.push(null);else{fr(f);let m=Y(f,r);s.push(m)}if(i.push(he(d,r)),n++,f===null)break}else break}return{node:{type:v.CONDITIONAL,conditions:s,bodies:i,id:p},nextIndex:n}},Y=(e,t={})=>{if(e=e.trim(),e.startsWith("(")&&e.endsWith(")")){let o=e.slice(1,-1),c=0,u=!0;for(let d=0;d<o.length;d++)if(o[d]==="("?c++:o[d]===")"&&c--,c<0){u=!1;break}if(u&&c===0)return Y(o,t)}let r=ve(e,"||");if(r!==-1)return{type:v.BINARY,op:D.OR,left:Y(e.substring(0,r).trim(),t),right:Y(e.substring(r+2).trim(),t)};let s=ve(e,"&&");if(s!==-1)return{type:v.BINARY,op:D.AND,left:Y(e.substring(0,s).trim(),t),right:Y(e.substring(s+2).trim(),t)};let i=[{op:">=",type:D.GTE},{op:"<=",type:D.LTE},{op:"==",type:D.EQ},{op:"!=",type:D.NEQ},{op:">",type:D.GT},{op:"<",type:D.LT},{op:" in ",type:D.IN}];for(let{op:o,type:c}of i){let u=ve(e,o);if(u!==-1)return{type:v.BINARY,op:c,left:Y(e.substring(0,u).trim(),t),right:Y(e.substring(u+o.length).trim(),t)}}let n=-1,a=null,l=[{op:" + ",type:D.ADD},{op:" - ",type:D.SUBTRACT}];for(let{op:o,type:c}of l){let u=0;for(;u<e.length;){let d=ve(e.substring(u),o);if(d===-1)break;let h=u+d;h>n&&(n=h,a={op:o,type:c}),u=h+o.length}}if(n!==-1&&a)return{type:v.BINARY,op:a.type,left:Y(e.substring(0,n).trim(),t),right:Y(e.substring(n+a.op.length).trim(),t)};let p=[" * "," / "," % "];for(let o of p)if(ve(e,o)!==-1)throw new O(`Arithmetic operations are not allowed in conditionals: "${o}"`);return e.startsWith("!")?{type:v.UNARY,op:je.NOT,operand:Y(e.substring(1).trim(),t)}:ci(e,t)},ve=(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},ec=e=>{if(e=e.trim(),e==="true")return{type:v.LITERAL,value:!0};if(e==="false")return{type:v.LITERAL,value:!1};if(e==="null")return{type:v.LITERAL,value:null};if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:v.LITERAL,value:e.slice(1,-1)};if(e==='""'||e==="''")return{type:v.LITERAL,value:""};if(e==="{}")return{type:v.LITERAL,value:{}};if(e==="[]")return{type:v.LITERAL,value:[]};let t=Number(e);return!isNaN(t)&&isFinite(t)?{type:v.LITERAL,value:t}:{type:v.VARIABLE,path:e}},ci=(e,t)=>{let r=e.trim();if(r.match(/^(\w+)\((.*)\)$/))return We(r,t);let i=ec(r);if(i.type===v.LITERAL)return i;if(/^[a-zA-Z_$][\w.$]*$/.test(r))return{type:v.VARIABLE,path:r};try{return We(r,t)}catch(n){if(n.message&&n.message.includes("not supported"))return i;throw n}},ui=(e,t,r)=>{let s=e.substring(5).trim();Qs(s);let i=s.match(/^(.+?)\s+in\s+(.+)$/);if(!i)throw new O(`Invalid loop syntax - missing 'in' keyword (got: '$for ${s}')`);let n=i[1].trim(),a=i[2].trim(),l,p=null;if(n.includes(",")){let u=n.split(",").map(d=>d.trim());if(u.length!==2)throw new O(`Invalid loop variables: ${n}. Expected format: "item" or "item, index"`);l=u[0],p=u[1]}else l=n;let o=ci(a,r),c=he(t,r);return{type:v.LOOP,itemVar:l,indexVar:p,iterable:o,body:c}};var tc=(e,t={})=>{let{functions:r={}}=t;return he(e,r)},Ze=tc;var mr={};R(mr,{now:()=>rc});var rc=()=>Date.now();var sc=(e,t,r={})=>{let{functions:s={},partials:i={}}=r,n={...mr,...s},a=Ze(e,{functions:n}),l={};for(let[p,o]of Object.entries(i))l[p]=Ze(o,{functions:n});return Be(a,t,{functions:n,partials:l})},Me=sc;var me=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);var di=(e,t)=>{!t||typeof t!="object"||Object.entries(t).forEach(([r,s])=>{if(r==="default")throw new Error("[Methods] Invalid method name 'default'. Use named exports in .methods.js; default export is not supported.");if(typeof s=="function"){if(r in e)throw new Error(`[Methods] Cannot define method '${r}' because it already exists on the component instance.`);Object.defineProperty(e,r,{configurable:!0,enumerable:!1,writable:!1,value:(i={})=>{let n=i===void 0?{}:i;if(!me(n))throw new Error(`[Methods] Method '${r}' expects payload to be an object.`);return s.call(e,n)}})}})};var vi=Symbol.for("immer-nothing"),fi=Symbol.for("immer-draftable"),se=Symbol.for("immer-state");function ae(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var $e=Object.getPrototypeOf;function Se(e){return!!e&&!!e[se]}function we(e){return e?bi(e)||Array.isArray(e)||!!e[fi]||!!e.constructor?.[fi]||st(e)||it(e):!1}var ic=Object.prototype.constructor.toString();function bi(e){if(!e||typeof e!="object")return!1;let t=$e(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)===ic}function Qe(e,t){rt(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,s)=>t(s,r,e))}function rt(e){let t=e[se];return t?t.type_:Array.isArray(e)?1:st(e)?2:it(e)?3:0}function vr(e,t){return rt(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function wi(e,t,r){let s=rt(e);s===2?e.set(t,r):s===3?e.add(r):e[t]=r}function nc(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function st(e){return e instanceof Map}function it(e){return e instanceof Set}function be(e){return e.copy_||e.base_}function br(e,t){if(st(e))return new Map(e);if(it(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=bi(e);if(t===!0||t==="class_only"&&!r){let s=Object.getOwnPropertyDescriptors(e);delete s[se];let i=Reflect.ownKeys(s);for(let n=0;n<i.length;n++){let a=i[n],l=s[a];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(s[a]={configurable:!0,writable:!0,enumerable:l.enumerable,value:e[a]})}return Object.create($e(e),s)}else{let s=$e(e);if(s!==null&&r)return{...e};let i=Object.create(s);return Object.assign(i,e)}}function Er(e,t=!1){return nt(e)||Se(e)||!we(e)||(rt(e)>1&&(e.set=e.add=e.clear=e.delete=ac),Object.freeze(e),t&&Object.entries(e).forEach(([r,s])=>Er(s,!0))),e}function ac(){ae(2)}function nt(e){return Object.isFrozen(e)}var oc={};function _e(e){let t=oc[e];return t||ae(0,e),t}var ze;function _i(){return ze}function lc(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function hi(e,t){t&&(_e("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function wr(e){_r(e),e.drafts_.forEach(pc),e.drafts_=null}function _r(e){e===ze&&(ze=e.parent_)}function mi(e){return ze=lc(ze,e)}function pc(e){let t=e[se];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function yi(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return e!==void 0&&e!==r?(r[se].modified_&&(wr(t),ae(4)),we(e)&&(e=et(t,e),t.parent_||tt(t,e)),t.patches_&&_e("Patches").generateReplacementPatches_(r[se].base_,e,t.patches_,t.inversePatches_)):e=et(t,r,[]),wr(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==vi?e:void 0}function et(e,t,r){if(nt(t))return t;let s=t[se];if(!s)return Qe(t,(i,n)=>gi(e,s,t,i,n,r)),t;if(s.scope_!==e)return t;if(!s.modified_)return tt(e,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;let i=s.copy_,n=i,a=!1;s.type_===3&&(n=new Set(i),i.clear(),a=!0),Qe(n,(l,p)=>gi(e,s,i,l,p,r,a)),tt(e,i,!1),r&&e.patches_&&_e("Patches").generatePatches_(s,r,e.patches_,e.inversePatches_)}return s.copy_}function gi(e,t,r,s,i,n,a){if(Se(i)){let l=n&&t&&t.type_!==3&&!vr(t.assigned_,s)?n.concat(s):void 0,p=et(e,i,l);if(wi(r,s,p),Se(p))e.canAutoFreeze_=!1;else return}else a&&r.add(i);if(we(i)&&!nt(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;et(e,i),(!t||!t.scope_.parent_)&&typeof s!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,s)&&tt(e,i)}}function tt(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Er(t,r)}function cc(e,t){let r=Array.isArray(e),s={type_:r?1:0,scope_:t?t.scope_:_i(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=s,n=kr;r&&(i=[s],n=Fe);let{revoke:a,proxy:l}=Proxy.revocable(i,n);return s.draft_=l,s.revoke_=a,l}var kr={get(e,t){if(t===se)return e;let r=be(e);if(!vr(r,t))return uc(e,r,t);let s=r[t];return e.finalized_||!we(s)?s:s===yr(e.base_,t)?(gr(e),e.copy_[t]=Ar(s,e)):s},has(e,t){return t in be(e)},ownKeys(e){return Reflect.ownKeys(be(e))},set(e,t,r){let s=xi(be(e),t);if(s?.set)return s.set.call(e.draft_,r),!0;if(!e.modified_){let i=yr(be(e),t),n=i?.[se];if(n&&n.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(nc(r,i)&&(r!==void 0||vr(e.base_,t)))return!0;gr(e),xr(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 yr(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,gr(e),xr(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=be(e),s=Reflect.getOwnPropertyDescriptor(r,t);return s&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:s.enumerable,value:r[t]}},defineProperty(){ae(11)},getPrototypeOf(e){return $e(e.base_)},setPrototypeOf(){ae(12)}},Fe={};Qe(kr,(e,t)=>{Fe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Fe.deleteProperty=function(e,t){return Fe.set.call(this,e,t,void 0)};Fe.set=function(e,t,r){return kr.set.call(this,e[0],t,r,e[0])};function yr(e,t){let r=e[se];return(r?be(r):e)[t]}function uc(e,t,r){let s=xi(t,r);return s?"value"in s?s.value:s.get?.call(e.draft_):void 0}function xi(e,t){if(!(t in e))return;let r=$e(e);for(;r;){let s=Object.getOwnPropertyDescriptor(r,t);if(s)return s;r=$e(r)}}function xr(e){e.modified_||(e.modified_=!0,e.parent_&&xr(e.parent_))}function gr(e){e.copy_||(e.copy_=br(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var dc=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 a=this;return function(p=n,...o){return a.produce(p,c=>r.call(this,c,...o))}}typeof r!="function"&&ae(6),s!==void 0&&typeof s!="function"&&ae(7);let i;if(we(t)){let n=mi(this),a=Ar(t,void 0),l=!0;try{i=r(a),l=!1}finally{l?wr(n):_r(n)}return hi(n,s),yi(i,n)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===vi&&(i=void 0),this.autoFreeze_&&Er(i,!0),s){let n=[],a=[];_e("Patches").generateReplacementPatches_(t,i,n,a),s(n,a)}return i}else ae(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(a,...l)=>this.produceWithPatches(a,p=>t(p,...l));let s,i;return[this.produce(t,r,(a,l)=>{s=a,i=l}),s,i]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){we(e)||ae(8),Se(e)&&(e=fc(e));let t=mi(this),r=Ar(e,void 0);return r[se].isManual_=!0,_r(t),r}finishDraft(e,t){let r=e&&e[se];(!r||!r.isManual_)&&ae(9);let{scope_:s}=r;return hi(s,t),yi(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=_e("Patches").applyPatches_;return Se(e)?s(e,t):this.produce(e,i=>s(i,t))}};function Ar(e,t){let r=st(e)?_e("MapSet").proxyMap_(e,t):it(e)?_e("MapSet").proxySet_(e,t):cc(e,t);return(t?t.scope_:_i()).drafts_.push(r),r}function fc(e){return Se(e)||ae(10,e),Ai(e)}function Ai(e){if(!we(e)||nt(e))return e;let t=e[se],r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=br(e,t.scope_.immer_.useStrictShallowCopy_)}else r=br(e,!0);return Qe(r,(s,i)=>{wi(r,s,Ai(i))}),t&&(t.finalized_=!1),r}var ie=new dc,Ei=ie.produce,gh=ie.produceWithPatches.bind(ie),vh=ie.setAutoFreeze.bind(ie),bh=ie.setUseStrictShallowCopy.bind(ie),wh=ie.applyPatches.bind(ie),_h=ie.createDraft.bind(ie),xh=ie.finishDraft.bind(ie);var ki=(e,t,r)=>{let{createInitialState:s,...i}=e,n={},a={},l={};return s&&(l=s({props:t,constants:r})),Object.entries(i).forEach(([p,o])=>{if(p.startsWith("select")){n[p]=(...c)=>o({state:l,props:t,constants:r},...c);return}a[p]=(c={})=>{let u=c===void 0?{}:c;if(!me(u))throw new Error(`[Store] Action '${p}' expects payload to be an object.`);return l=Ei(l,d=>o({state:d,props:t,constants:r},u)),l}}),{getState:()=>l,...a,...n}};var $i=e=>!me(e)||Object.isFrozen(e)?e:(Object.values(e).forEach(t=>{$i(t)}),Object.freeze(e)),Si=({setupConstants:e,fileConstants:t})=>{let r=me(e)?e:{},s=me(t)?t:{};return $i({...r,...s})};var Ci=(e,t)=>{if(!t||typeof t!="object")return"";let r="",s=n=>Object.entries(n).map(([a,l])=>` ${a}: ${l};`).join(`
974
- `),i=(n,a)=>{if(typeof a!="object"||a===null)return"";if(n.startsWith("@")){let p=Object.entries(a).map(([o,c])=>{let u=s(c);return` ${o} {
975
- ${u.split(`
1074
+ `))}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._dialogElement.addEventListener("click",t=>{t.stopPropagation();let r=t.composedPath();(r[0]===this._dialogElement||r[0].nodeName==="DIALOG"&&r[0]===this._dialogElement)&&this._emitClose()}),this._dialogElement.addEventListener("contextmenu",t=>{let r=t.composedPath();(r[0]===this._dialogElement||r[0].nodeName==="DIALOG"&&r[0]===this._dialogElement)&&(t.preventDefault(),this._emitClose())}),this._dialogElement.addEventListener("cancel",t=>{t.preventDefault(),this._emitClose()}),this._popoverContainer=document.createElement("div"),this._popoverContainer.className="popover-container",this._dialogElement.appendChild(this._popoverContainer),this._slotElement=null,this._isOpen=!1}_emitClose(){this.dispatchEvent(new CustomEvent("close",{detail:{},bubbles:!0}))}static get observedAttributes(){return["open","x","y","place","no-overlay"]}connectedCallback(){this.hasAttribute("open")&&this._show()}disconnectedCallback(){this._isOpen&&this._dialogElement.open&&this._dialogElement.close()}attributeChangedCallback(t,r,s){t==="open"?s!==null&&!this._isOpen?this.isConnected&&this._show():s===null&&this._isOpen&&this._hide():(t==="x"||t==="y"||t==="place")&&this._isOpen?this._updatePosition():t==="no-overlay"&&r!==s&&this._isOpen&&(this._hide(),this._show())}_show(){this._isOpen||(this._slotElement||(this._slotElement=document.createElement("slot"),this._slotElement.setAttribute("name","content"),this._popoverContainer.appendChild(this._slotElement)),this._isOpen=!0,this._dialogElement.open||setTimeout(()=>{this._dialogElement&&!this._dialogElement.open&&(this.hasAttribute("no-overlay")?this._dialogElement.show():this._dialogElement.showModal())},0),requestAnimationFrame(()=>{this._updatePosition()}))}_hide(){this._isOpen&&(this._isOpen=!1,this._dialogElement.open&&this._dialogElement.close(),this._slotElement&&(this._popoverContainer.removeChild(this._slotElement),this._slotElement=null))}_updatePosition(){let t=parseFloat(this.getAttribute("x")||"0"),r=parseFloat(this.getAttribute("y")||"0"),s=this.getAttribute("place")||"bs";this.removeAttribute("positioned"),requestAnimationFrame(()=>{let i=this._popoverContainer.getBoundingClientRect(),{left:n,top:a}=this._calculatePosition(t,r,i.width,i.height,s);this._popoverContainer.style.left=`${n}px`,this._popoverContainer.style.top=`${a}px`,requestAnimationFrame(()=>{this.setAttribute("positioned","")})})}_calculatePosition(t,r,s,i,n){let l=t,p=r;switch(n){case"t":l=t-s/2,p=r-i-8;break;case"ts":l=t,p=r-i-8;break;case"te":l=t-s,p=r-i-8;break;case"r":l=t+8,p=r-i/2;break;case"rs":l=t+8,p=r;break;case"re":l=t+8,p=r-i;break;case"b":l=t-s/2,p=r+8;break;case"bs":l=t,p=r+8;break;case"be":l=t-s,p=r+8;break;case"l":l=t-s-8,p=r-i/2;break;case"ls":l=t-s-8,p=r;break;case"le":l=t-s-8,p=r-i;break;default:l=t,p=r+8;break}let o=8;return l=Math.max(o,Math.min(l,window.innerWidth-s-o)),p=Math.max(o,Math.min(p,window.innerHeight-i-o)),{left:l,top:p}}get popover(){return this._popoverContainer}},Os=({render:e,html:t})=>Yt;var Xt={};R(Xt,{handleClickHeader:()=>Da});var Da=(e,t)=>{let{store:r,render:s}=e;r.toggleOpen({}),s()};var Ts={componentName:"rtgl-accordion-item",propsSchema:{type:"object",properties:{label:{type:"string"},content:{type:"string"},w:{type:"string"}}},events:[],methods:{type:"object",properties:{}}};var Zt={};R(Zt,{createInitialState:()=>Ba,selectViewData:()=>Ma,toggleOpen:()=>Wa});var Ba=()=>Object.freeze({open:!1}),ja=["id","class","style","slot","label","content"],Fa=(e={})=>Object.entries(e).filter(([t])=>!ja.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ma=({state:e,props:t})=>({label:t.label||"",content:t.content||"",openClass:e.open?"content-wrapper open":"content-wrapper",chevronIcon:e.open?"chevronUp":"chevronDown",containerAttrString:Fa(t)}),Wa=({state:e})=>{e.open=!e.open};var Ls={refs:{header:{eventListeners:{click:{handler:"handleClickHeader"}}}},styles:{".content-wrapper":{display:"grid","grid-template-rows":"0fr",transition:"grid-template-rows 0.2s ease-out"},".content-wrapper.open":{"grid-template-rows":"1fr"},".content-inner":{overflow:"hidden"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=v ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view#header d=h av=c w=f pv=md cur=pointer",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"label"}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=1fg",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:"rtgl-svg svg=${chevronIcon} wh=16 c=mu-fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg svg=",{type:1,path:"chevronIcon"}," wh=16 c=mu-fg"]}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:'div class="${openClass}"',value:{type:9,items:[{type:8,properties:[{key:"div class=content-inner",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view pb=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:1,path:"content"}}],fast:!0},{type:8,properties:[{key:"slot name=content",value:{type:0,value:null}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:['div class="',{type:1,path:"openClass"},'"']}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view d=v ",{type:1,path:"containerAttrString"}]}}],fast:!0}],fast:!0}};var Qt={};R(Qt,{handleClickItem:()=>za});var za=(e,t)=>{let{dispatchEvent:r,props:s}=e,i=t._event,n=Number(i.currentTarget.dataset.index),a=Array.isArray(s.items)?s.items[n]:void 0;if(!a)return;if(a.disabled||a.current){i.preventDefault();return}typeof a.href=="string"&&a.href.length>0||i.preventDefault(),r(new CustomEvent("item-click",{detail:{id:a.id,path:a.path,href:a.href,item:a,index:n,trigger:i.type}}))};var Rs={componentName:"rtgl-breadcrumb",propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"},href:{type:"string"},path:{type:"string"},current:{type:"boolean"},disabled:{type:"boolean"},click:{type:"boolean"},newTab:{type:"boolean"},rel:{type:"string"}}}},sep:{type:"string",default:"breadcrumb-arrow"},max:{type:"number"}}},events:{"item-click":{type:"object",properties:{id:{type:"string"},path:{type:"string"},href:{type:"string"},item:{type:"object"},index:{type:"number"},trigger:{type:"string"}}}},methods:{type:"object",properties:{}}};var er={};R(er,{createInitialState:()=>Ua,selectViewData:()=>Xa});var Ua=()=>Object.freeze({}),Ka=["id","class","style","slot","items","sep","max","separator"],Ha=(e={})=>Object.entries(e).filter(([t])=>!Ka.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ga=e=>{if(e==null||e==="")return;let t=Number(e);return Number.isNaN(t)?void 0:t},qa=e=>`${e}`.replace(/"/g,"&quot;"),Ja=(e,t)=>{if(!t||t<3||e.length<=t)return e;let r=t-2;return[e[0],{isEllipsis:!0,label:"..."},...e.slice(-r)]},Ya=e=>e.map((t,r)=>{let s=typeof t.href=="string"&&t.href.length>0,i=t.path!==void 0&&t.path!==null&&`${t.path}`!="",n=!!t.current,a=!!t.disabled,l=!n&&!a&&(s||i||!!t.click),p=t.rel||(t.newTab?"noopener noreferrer":""),o=[t.newTab?'target="_blank"':"",p?`rel="${qa(p)}"`:""].filter(Boolean).join(" ");return{...t,label:t.label||"",index:r,href:s?t.href:void 0,path:i?t.path:void 0,isCurrent:n,isDisabled:a,isInteractive:l,linkExtraAttrs:o,c:n?"fg":"mu-fg"}}),Xa=({props:e})=>{let t=Ha(e),r=Array.isArray(e.items)?e.items:[],s=Ga(e.max),i=e.sep||"breadcrumb-arrow",n=Ya(r),a=Ja(n,s),l=[];return a.forEach((p,o)=>{l.push(p),o<a.length-1&&l.push({isSeparator:!0})}),{containerAttrString:t,items:l,sep:i}};var Ns={refs:{"item*":{eventListeners:{click:{handler:"handleClickItem"}}}},styles:{a:{"text-decoration":"none",color:"inherit"}},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:"i",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.isEllipsis"},{type:4,op:6,left:{type:1,path:"item.isInteractive"},right:{type:1,path:"item.href"}},{type:1,path:"item.isInteractive"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-svg wh=16 svg=${sep} c=mu-fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg wh=16 svg=",{type:1,path:"sep"}," c=mu-fg"]}}],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},{type:9,items:[{type:8,properties:[{key:"a#item${i} href=${item.href} ${item.linkExtraAttrs} data-index=${item.index}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a#item",{type:1,path:"i"}," href=",{type:1,path:"item.href"}," ",{type:1,path:"item.linkExtraAttrs"}," data-index=",{type:1,path:"item.index"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#item${i} data-index=${item.index} cur=pointer",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#item",{type:1,path:"i"}," data-index=",{type:1,path:"item.index"}," cur=pointer"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.c"}]}}],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 tr={};R(tr,{handleClickMenuItem:()=>Qa,handleClosePopover:()=>Za});var Za=(e,t)=>{let{dispatchEvent:r}=e;r(new CustomEvent("close"))},Qa=(e,t)=>{let{dispatchEvent:r,props:s}=e,i=t._event,n=Number(i.currentTarget.dataset.index??i.currentTarget.id.slice(6)),a=s.items[n],l=a?.type||"item";if(!a||l!=="item"||a.disabled){i.preventDefault();return}a.href||i.preventDefault(),r(new CustomEvent("item-click",{detail:{index:n,item:a,id:a.id,path:a.path,href:a.href,trigger:i.type}}))};var Vs={componentName:"rtgl-dropdown-menu",propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},type:{type:"string",enum:["label","item","separator"]},id:{type:"string"},path:{type:"string"},href:{type:"string"},disabled:{type:"boolean"},newTab:{type:"boolean"},rel:{type:"string"},testId:{type:"string"}}}},open:{type:"boolean"},x:{type:"string"},y:{type:"string"},place:{type:"string"},w:{type:"string"},h:{type:"string"}}},events:{close:{type:"object"},"item-click":{type:"object",properties:{index:{type:"number"},item:{type:"object"},id:{type:"string"},path:{type:"string"},href:{type:"string"},trigger:{type:"string"}}}},methods:{type:"object",properties:{}}};var rr={};R(rr,{createInitialState:()=>eo,selectViewData:()=>so});var eo=()=>Object.freeze({}),to=e=>`${e}`.replace(/"/g,"&quot;"),ro=e=>e.map((t,r)=>{let s=t.type||"item",i=s==="separator",n=s==="label",a=s==="item",l=!!t.disabled,p=a&&!l,o=l?"mu-fg":"fg",u=l?"mu":"",c=l?"":"ac",d=typeof t.href=="string"&&t.href.length>0,h=t.rel||(t.newTab?"noopener noreferrer":""),f=[t.newTab?'target="_blank"':"",h?`rel="${to(h)}"`:""].filter(Boolean).join(" ");return{...t,index:r,type:s,isSeparator:i,isLabel:n,isItem:a,isDisabled:l,isInteractive:p,hasHref:d,linkExtraAttrs:f,c:o,bgc:u,hoverBgc:c}}),so=({props:e})=>{let t=Array.isArray(e.items)?e.items:[];return{items:ro(t),open:!!e.open,x:e.x||0,y:e.y||0,w:e.w||"300",h:e.h||"300",place:e.place||"bs"}};var Ps={refs:{popover:{eventListeners:{close:{handler:"handleClosePopover"}}},"option*":{eventListeners:{click:{handler:"handleClickMenuItem"}}}},styles:{a:{display:"block",width:"100%","text-decoration":"none",color:"inherit"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-popover#popover ?open=${open} x=${x} y=${y} place=${place}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=${w} h=${h} sv g=xs slot=content bgc=mu 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.isLabel",value:{type:6,conditions:[{type:1,path:"item.isLabel"},{type:4,op:6,left:{type:1,path:"item.isItem"},right:{type:1,path:"item.isDisabled"}},{type:4,op:6,left:{type:1,path:"item.isItem"},right:{type:4,op:6,left:{type:1,path:"item.hasHref"},right:{type:1,path:"item.linkExtraAttrs"}}},{type:4,op:6,left:{type:1,path:"item.isItem"},right:{type:1,path:"item.hasHref"}},{type:1,path:"item.isItem"},{type:1,path:"item.isSeparator"}],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 w=f ph=lg pv=md br=md bgc=${item.bgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view w=f ph=lg pv=md br=md bgc=",{type:1,path:"item.bgc"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"a#option${i} href=${item.href} ${item.linkExtraAttrs} data-index=${item.index} data-testid=${item.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h-bgc=${item.hoverBgc} ph=lg pv=md cur=pointer br=md bgc=${item.bgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view w=f h-bgc=",{type:1,path:"item.hoverBgc"}," ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"item.bgc"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a#option",{type:1,path:"i"}," href=",{type:1,path:"item.href"}," ",{type:1,path:"item.linkExtraAttrs"}," data-index=",{type:1,path:"item.index"}," data-testid=",{type:1,path:"item.testId"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"a#option${i} href=${item.href} data-index=${item.index} data-testid=${item.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h-bgc=${item.hoverBgc} ph=lg pv=md cur=pointer br=md bgc=${item.bgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view w=f h-bgc=",{type:1,path:"item.hoverBgc"}," ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"item.bgc"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a#option",{type:1,path:"i"}," href=",{type:1,path:"item.href"}," data-index=",{type:1,path:"item.index"}," data-testid=",{type:1,path:"item.testId"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#option${i} w=f h-bgc=${item.hoverBgc} ph=lg pv=md cur=pointer br=md bgc=${item.bgc} data-index=${item.index} data-testid=${item.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#option",{type:1,path:"i"}," w=f h-bgc=",{type:1,path:"item.hoverBgc"}," ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"item.bgc"}," data-index=",{type:1,path:"item.index"}," data-testid=",{type:1,path:"item.testId"}]}}],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},parsedKey:{type:2,parts:["rtgl-view w=",{type:1,path:"w"}," h=",{type:1,path:"h"}," sv g=xs slot=content bgc=mu br=md"]}}],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"}," place=",{type:1,path:"place"}]}}],fast:!1}],fast:!1}};var dr={};R(dr,{handleActionClick:()=>yl,handleAfterMount:()=>dl,handleBeforeMount:()=>ul,handleImageClick:()=>gl,handleKeyDown:()=>bl,handleOnUpdate:()=>fl,handleTooltipMouseEnter:()=>vl,handleTooltipMouseLeave:()=>wl,handleValueChange:()=>ml,handleValueInput:()=>hl});var ur={};R(ur,{clearFieldError:()=>al,collectAllDataFields:()=>Q,createInitialState:()=>el,flattenFields:()=>cr,get:()=>ie,getDefaultValue:()=>Ye,hideTooltip:()=>pl,isDataField:()=>pr,pruneHiddenValues:()=>Re,resetFormValues:()=>il,selectForm:()=>K,selectFormValues:()=>me,selectViewData:()=>tl,set:()=>pe,setErrors:()=>nl,setFormFieldValue:()=>rl,setFormValues:()=>sl,setReactiveMode:()=>ol,showTooltip:()=>ll,validateField:()=>Je,validateForm:()=>Le});var v={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},P={EQ:0,NEQ:1,GT:2,LT:3,GTE:4,LTE:5,AND:6,OR:7,IN:8,ADD:10,SUBTRACT:11},Ge={NOT:0};var k=class extends Error{constructor(t){super(`Parse Error: ${t}`),this.name="JemplParseError"}},re=class extends Error{constructor(t){super(`Render Error: ${t}`),this.name="JemplRenderError"}};var sr=e=>{if(!e||e.trim()==="")throw new k("Missing condition expression after '$if'");if(e.includes("===")||e.includes("!==")){let r=e.includes("===")?"==":"!=";throw new k(`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 k(`Incomplete comparison expression - missing right operand (got: '${e}')`)},Ds=e=>{if(e.trim().endsWith(" in"))throw new k(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(!e.includes(" in "))throw new k(`Invalid loop syntax - missing 'in' keyword (got: '$for ${e}')`);let[t,r]=e.split(" in ");if(!r||r.trim()==="")throw new k(`Missing iterable expression after 'in' (got: '$for ${e}')`);let s=t.includes(",")?t.split(",").map(i=>i.trim()):[t.trim()];for(let i of s){if(!i)throw new k(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`);if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))throw new k(`Invalid loop syntax (got: '$for ${e}')`)}};var Bs=(e,t,r=!1)=>{if(t===null)return new re(`Cannot iterate over null value at '$for ${e}'`);if(t===void 0)return new re(`Cannot iterate over undefined value at '$for ${e}'`);let s=typeof t;return r?new re(`Cannot iterate over non-array value in loop '${e}' - got ${s} instead`):new re(`Cannot iterate over non-array value (got: ${s}) at '$for ${e}'`)},js=(e,t)=>{let r=t&&Object.keys(t).length>0?Object.keys(t).join(", "):"no custom functions provided";return new re(`Unknown function '${e}' (${r})`)};var io=(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 a=C(e,{functions:s,partials:i},t,{});return a===void 0?{}:a},C=(e,t,r,s)=>{let i=t.functions||t;if(e.var&&!e.type)return W(e.var,r,s);if(e.type===v.LITERAL)return e.value;if(e.type===v.VARIABLE)return W(e.path,r,s);if(e.type===v.INTERPOLATION)return ao(e.parts,t,r,s);switch(e.type){case v.FUNCTION:return Ms(e,t,r,s);case v.BINARY:return Ws(e,t,r,s);case v.UNARY:return zs(e,t,r,s);case v.CONDITIONAL:return lo(e,t,r,s);case v.LOOP:return ho(e,t,r,s);case v.OBJECT:return yo(e,t,r,s);case v.ARRAY:return go(e,t,r,s);case v.PARTIAL:return bo(e,t,r,s);case v.PATH_REFERENCE:return vo(e,t,r,s);default:throw new Error(`Unknown node type: ${e.type}`)}},Fs=new Map,no=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 a=r.trim();if(/^\d+$/.test(a))t.push({type:"index",value:parseInt(a,10)});else if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'")){let l=a.slice(1,-1);t.push({type:"property",value:l})}else t.push({type:"property",value:a});r=""}s=!1}else r+=n}return r&&t.push({type:"property",value:r}),t},W=(e,t,r)=>{if(!e)return;if(e in r)return r[e];let s=Fs.get(e);if(!s){let n=[],a="",l=0;for(let p=0;p<e.length;p++){let o=e[p];o==="["?(l++,a+=o):o==="]"?(l--,a+=o):o==="."&&l===0?a&&(n.push(a),a=""):a+=o}a&&n.push(a),s=[];for(let p of n){let o=no(p.trim());s.push(...o)}Fs.set(e,s)}let i=t;for(let n=0;n<s.length;n++){let a=s[n];if(a.type==="property"&&a.value in r){i=r[a.value];continue}if(i==null)return;(a.type==="property"||a.type==="index")&&(i=i[a.value])}return i},ao=(e,t,r,s)=>{let i=[];for(let n of e)if(typeof n=="string")i.push(n);else{let a=C(n,t,r,s);i.push(a!=null?String(a):"")}return i.join("")},Ms=(e,t,r,s)=>{let i=t.functions||t,n=i[e.name];if(!n)throw js(e.name,i);let a=e.args.map(l=>C(l,t,r,s));return n(...a)},Te=(e,t,r,s)=>{if(e.var&&!e.type)return W(e.var,r,s);switch(e.type){case v.VARIABLE:return W(e.path,r,s);case v.LITERAL:return e.value;case v.BINARY:return Ws(e,t,r,s);case v.UNARY:return zs(e,t,r,s);case v.FUNCTION:return Ms(e,t,r,s);default:return C(e,t,r,s)}},Ws=(e,t,r,s)=>{if(e.op===P.AND||e.op===P.OR){let a=Te(e.left,t,r,s),l=Te(e.right,t,r,s);switch(e.op){case P.AND:return a&&l;case P.OR:return a||l}}let i=C(e.left,t,r,s),n=C(e.right,t,r,s);switch(e.op){case P.EQ:return i==n;case P.NEQ:return i!=n;case P.GT:return i>n;case P.LT:return i<n;case P.GTE:return i>=n;case P.LTE:return i<=n;case P.IN:return Array.isArray(n)?n.includes(i):!1;case P.ADD:if(typeof i!="number"||typeof n!="number")throw new re(`Arithmetic operations require numbers. Got ${typeof i} + ${typeof n}`);return i+n;case P.SUBTRACT:if(typeof i!="number"||typeof n!="number")throw new re(`Arithmetic operations require numbers. Got ${typeof i} - ${typeof n}`);return i-n;default:throw new Error(`Unknown binary operator: ${e.op}`)}},zs=(e,t,r,s)=>{let i=e.op===Ge.NOT?Te(e.operand,t,r,s):C(e.operand,t,r,s);switch(e.op){case Ge.NOT:return!i;default:throw new Error(`Unknown unary operator: ${e.op}`)}},oo=(e,t,r,s)=>{if(e.conditions.length===2&&e.conditions[1]===null){let i=e.conditions[0];if(i.type===v.VARIABLE)if(W(i.path,r,s)){let a=e.bodies[0];if(a.type===v.OBJECT&&a.properties.length<=5){let l={};for(let p of a.properties){let o=p.parsedKey?C(p.parsedKey,t,r,s):p.key,u=p.value;if(u.type===v.LITERAL)l[o]=u.value;else if(u.type===v.VARIABLE)l[o]=W(u.path,r,s);else if(u.type===v.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===v.VARIABLE){let h=W(d.path,r,s);c.push(h!=null?String(h):"")}else{let h=C(d,t,r,s);c.push(h!=null?String(h):"")}l[o]=c.join("")}else l[o]=C(u,t,r,s)}return l}}else{let a=e.bodies[1];if(a.type===v.OBJECT&&a.properties.length<=5){let l={};for(let p of a.properties){let o=p.parsedKey?C(p.parsedKey,t,r,s):p.key,u=p.value;if(u.type===v.LITERAL)l[o]=u.value;else if(u.type===v.VARIABLE)l[o]=W(u.path,r,s);else if(u.type===v.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===v.VARIABLE){let h=W(d.path,r,s);c.push(h!=null?String(h):"")}else{let h=C(d,t,r,s);c.push(h!=null?String(h):"")}l[o]=c.join("")}else l[o]=C(u,t,r,s)}return l}}}return null},lo=(e,t,r,s)=>{let i=oo(e,t,r,s);if(i!==null)return i;for(let n=0;n<e.conditions.length;n++){let a=e.conditions[n];if(a===null||Te(a,t,r,s))return C(e.bodies[n],t,r,s)}return Us},po=(e,t)=>{let r=e.body,s=e.itemVar;if(r.type===v.CONDITIONAL&&r.conditions.length===1&&r.conditions[0].type===v.VARIABLE){let i=r.conditions[0].path,n=r.bodies[0];if(i.startsWith(s+".")){let a=i.substring(s.length+1);if(n.type===v.OBJECT&&n.properties.length<=5){for(let p of n.properties)if(p.parsedKey)return null;let l=[];for(let p=0;p<t.length;p++){let o=t[p];if(o[a]){let u={};for(let c of n.properties){let d=c.key,h=c.value;if(h.type===v.LITERAL)u[d]=h.value;else if(h.type===v.VARIABLE){let f=h.path;if(f===s)u[d]=o;else if(f.startsWith(s+".")){let m=f.substring(s.length+1);u[d]=o[m]}else return null}else if(h.type===v.INTERPOLATION){let f=[],m=!0;for(let g of h.parts)if(typeof g=="string")f.push(g);else if(g.type===v.VARIABLE){let y=g.path;if(y===s)f.push(o!=null?String(o):"");else if(y.startsWith(s+".")){let w=y.substring(s.length+1),_=o[w];f.push(_!=null?String(_):"")}else{m=!1;break}}else{m=!1;break}if(!m)return null;u[d]=f.join("")}else return null}l.push(u)}}return l}}}return null},co=(e,t)=>{let r=e.body,s=e.itemVar,i=po(e,t);if(i!==null)return i;if(r.type===v.OBJECT&&r.properties.length<=5&&!r.whenCondition){for(let l of r.properties)if(l.parsedKey)return null;let n=[],a=!0;for(let l of r.properties){let p=l.key,o=l.value;if(o.type===v.LITERAL)n.push({key:p,type:"literal",value:o.value});else if(o.type===v.VARIABLE){let u=o.path;if(u===s)n.push({key:p,type:"item"});else if(u.startsWith(s+".")){let c=u.substring(s.length+1);if(!c.includes(".")&&!c.includes("["))n.push({key:p,type:"prop",prop:c});else{a=!1;break}}else{a=!1;break}}else if(o.type===v.INTERPOLATION&&o.parts.length===1){let u=o.parts[0];if(u.type===v.VARIABLE){let c=u.path;if(c===s)n.push({key:p,type:"item_string"});else if(c.startsWith(s+".")){let d=c.substring(s.length+1);if(!d.includes(".")&&!d.includes("["))n.push({key:p,type:"prop_string",prop:d});else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}if(a){let l=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 p=0;p<t.length;p++){let o=t[p];l[p]={id:o.id,title:o.title!=null?String(o.title):"",completed:o.completed}}else for(let p=0;p<t.length;p++){let o=t[p],u={};for(let c of n)if(c.type==="literal")u[c.key]=c.value;else if(c.type==="item")u[c.key]=o;else if(c.type==="prop")u[c.key]=o[c.prop];else if(c.type==="item_string")u[c.key]=o!=null?String(o):"";else if(c.type==="prop_string"){let d=o[c.prop];u[c.key]=d!=null?String(d):""}l[p]=u}return l}}return null},uo=(e,t,r,s,i)=>{let n=[],a=e.body;if(a.type===v.OBJECT&&a.fast!==!1){let l=e.itemVar,p=e.indexVar;for(let o=0;o<i.length;o++){let u=i[o],c={},d={...s,[l]:u,...p&&{[p]:o}};d.__paths__||(d.__paths__=s.__paths__||{});let h=e.iterable.path||"";if(s&&s.__paths__&&h){let f=h.split("."),m=f[0];m in s.__paths__&&(h=s.__paths__[m],f.length>1&&(h+="."+f.slice(1).join(".")))}d.__paths__={...d.__paths__,[l]:`${h}[${o}]`,...p&&{[p]:o}};for(let f of a.properties){let m=f.parsedKey?C(f.parsedKey,t,r,d):f.key,g=f.value;if(g.type===v.LITERAL)c[m]=g.value;else if(g.type===v.VARIABLE){let y=g.path;if(y===l)c[m]=u;else if(y===p)c[m]=o;else if(y.startsWith(l+".")){let w=y.substring(l.length+1);!w.includes(".")&&!w.includes("[")?c[m]=u[w]:c[m]=W(y,r,{...s,[l]:u,...p&&{[p]:o}})}else c[m]=W(y,r,{...s,[l]:u,...p&&{[p]:o}})}else if(g.type===v.INTERPOLATION){let y=[];for(let w of g.parts)if(typeof w=="string")y.push(w);else if(w.type===v.VARIABLE){let _=w.path,x;if(_===l)x=u;else if(_===p)x=o;else if(_.startsWith(l+".")){let E=_.substring(l.length+1);!E.includes(".")&&!E.includes("[")?x=u[E]:x=W(_,r,{...s,[l]:u,...p&&{[p]:o}})}else x=W(_,r,{...s,[l]:u,...p&&{[p]:o}});y.push(x!=null?String(x):"")}else{let _={...s,[l]:u,...p&&{[p]:o}},x=C(w,t,r,_);y.push(x!=null?String(x):"")}c[m]=y.join("")}else{let y={...s,[l]:u,...p&&{[p]:o}};c[m]=C(g,t,r,y)}}n.push(c)}return n}return null},fo=(e,t,r)=>{let s=e.body;if(s.type===v.OBJECT&&s.properties.length===1&&s.properties[0].key==="$if item.visible"){let n=s.properties[0].value;if(n.type===v.CONDITIONAL&&n.conditions.length===1&&n.conditions[0].type===v.VARIABLE&&n.conditions[0].path==="item.visible"){let a=n.bodies[0];if(a.type===v.OBJECT&&a.properties.length===2){let l=a.properties[0],p=a.properties[1];if(l.key==="id"&&l.value.type===v.VARIABLE&&l.value.path==="item.id"&&p.key==="$if item.highlighted"&&p.value.type===v.CONDITIONAL){let o=[];for(let u=0;u<t.length;u++){let c=t[u];if(c.visible){let d={id:c.id};c.highlighted?(d.highlight=!0,d.message=`This item is highlighted: ${c.name}`):(d.highlight=!1,d.message=c.name),o.push(d)}}return o}}}}return null},ho=(e,t,r,s)=>{let i=C(e.iterable,t,r,s);if(!Array.isArray(i)){let o,u=!1;if(e.iterable.type===v.FUNCTION){u=!0;let d=e.iterable.args.map(h=>h.type===v.LITERAL?typeof h.value=="string"?`'${h.value}'`:String(h.value):h.type===v.VARIABLE?h.path:h.type===v.FUNCTION?`${h.name}(...)`:"?").join(", ");o=`${e.iterable.name}(${d})`}else o=e.iterable.path||"undefined";let c=`${e.itemVar}${e.indexVar?`, ${e.indexVar}`:""} in ${o}`;throw Bs(c,i,u)}if(!e.indexVar){let o=fo(e,i,e.itemVar);if(o!==null)return o}if(!e.indexVar){let o=co(e,i);if(o!==null)return o}let n=uo(e,t,r,s,i);if(n!==null)return n;let a=[],l=e.iterable.path||"";if(s&&s.__paths__&&l){let o=l.split("."),u=o[0];u in s.__paths__&&(l=s.__paths__[u],o.length>1&&(l+="."+o.slice(1).join(".")))}let p=!1;e.body.type===v.ARRAY&&(e.body.items.length<=1?p=!1:p=e.body._shouldPreserveArray??=e.body.items.some(o=>o.type===v.OBJECT&&o.properties.some(u=>u.key.startsWith("$if ")||u.key.startsWith("$when "))));for(let o=0;o<i.length;o++){let u=e.indexVar?{...s,[e.itemVar]:i[o],[e.indexVar]:o}:{...s,[e.itemVar]:i[o]};u.__paths__||(u.__paths__=s.__paths__||{}),u.__paths__={...u.__paths__,[e.itemVar]:`${l}[${o}]`},e.indexVar&&(u.__paths__[e.indexVar]=o);let c=C(e.body,t,r,u);if(Array.isArray(c)&&c.length===1&&!p){let d=c[0];a.push(d===void 0?{}:d)}else a.push(c===void 0?{}:c)}return a},mo=(e,t,r,s)=>{if(e.whenCondition)return null;if(e.properties.length===1){let i=e.properties[0],n=i.parsedKey?C(i.parsedKey,t,r,s):i.key,a=i.value;if(a.type===v.OBJECT&&a.properties.length<=10&&!a.whenCondition){let l={},p={},o=!0;for(let u of a.properties){let c=u.parsedKey?C(u.parsedKey,t,r,s):u.key,d=u.value;if(d.type===v.LITERAL)p[c]=d.value;else if(d.type===v.VARIABLE)p[c]=W(d.path,r,s);else if(d.type===v.INTERPOLATION){let h=[];for(let f of d.parts)if(typeof f=="string")h.push(f);else if(f.type===v.VARIABLE){let m=W(f.path,r,s);h.push(m!=null?String(m):"")}else{o=!1;break}if(!o)break;p[c]=h.join("")}else if(d.type===v.OBJECT&&d.properties.length<=5){let h={};for(let f of d.properties){let m=f.key,g=f.value;if(g.type===v.LITERAL)h[m]=g.value;else if(g.type===v.VARIABLE)h[m]=W(g.path,r,s);else if(g.type===v.INTERPOLATION){let y=[];for(let w of g.parts)if(typeof w=="string")y.push(w);else if(w.type===v.VARIABLE){let _=W(w.path,r,s);y.push(_!=null?String(_):"")}else{o=!1;break}if(!o)break;h[m]=y.join("")}else{o=!1;break}}if(!o)break;p[c]=h}else{o=!1;break}}if(o)return l[n]=p,l}}return null},yo=(e,t,r,s)=>{let i=t.functions||t;if(e.whenCondition&&!Te(e.whenCondition,i,r,s))return;let n=mo(e,t,r,s);if(n!==null)return n;if(e.fast){let o={};for(let u of e.properties){let c=u.parsedKey?C(u.parsedKey,t,r,s):u.key,d=u.value;if(d.type===v.LITERAL)o[c]=d.value;else if(d.type===v.VARIABLE)o[c]=W(d.path,r,s);else if(d.type===v.INTERPOLATION){let h=[];for(let f of d.parts)if(typeof f=="string")h.push(f);else if(f.type===v.VARIABLE){let m=W(f.path,r,s);h.push(m!=null?String(m):"")}else{let m=C(f,t,r,s);h.push(m!=null?String(m):"")}o[c]=h.join("")}else o[c]=C(d,t,r,s)}return o}let a={},l=null,p=!1;for(let o of e.properties)if(!o.key.startsWith("$if ")&&!o.key.match(/^\$if\s+\w+.*:?$/)&&!o.key.startsWith("$elif")&&!o.key.startsWith("$else")&&!o.key.startsWith("$for ")){p=!0;break}for(let o of e.properties)if(o.key.startsWith("$if ")||o.key.match(/^\$if\s+\w+.*:?$/)){let u=C(o.value,t,r,s);if(!p&&u!==null&&u!==void 0)return Array.isArray(u)&&u.length===1?u[0]:u;typeof u=="object"&&u!==null&&!Array.isArray(u)&&Object.assign(a,u)}else if(o.key.startsWith("$for ")){if(e.properties.length===1)return C(o.value,t,r,s)}else{let u=o.value;if(u&&u.type===v.OBJECT&&u.properties){let c=u.properties.find(d=>d.key.startsWith("$for "));if(c){let d=C(c.value,t,r,s);d!==void 0&&(a[o.key]=d)}else{let d=C(o.value,t,r,s);d!==void 0&&(a[o.key]=d)}}else{let c=o.parsedKey?C(o.parsedKey,t,r,s):o.key,d=C(o.value,t,r,s);d!==void 0&&(a[c]=d)}}return a},Us={},go=(e,t,r,s)=>{let i=[];for(let n of e.items)if(n.type===v.LOOP){let a=C(n,t,r,s);Array.isArray(a)&&n.flatten!==!1?i.push(...a):i.push(a)}else{let a=C(n,t,r,s);a!==Us&&a!==void 0&&i.push(a)}return i},bo=(e,t,r,s)=>{let{name:i,data:n,whenCondition:a}=e,l=t.partials||{},p=t.functions||t;if(a&&!Te(a,p,r,s))return;if(!l[i])throw new re(`Partial '${i}' is not defined`);let o=s._partialStack||[];if(o.includes(i))throw new re(`Circular partial reference detected: ${i}`);let u=l[i],c=r,d={...s,_partialStack:[...o,i]};if(s){c={...r};for(let h of Object.keys(s))h.startsWith("_")||(c[h]=s[h])}if(n){let h=C(n,t,r,s);c={...c,...h}}return C(u,t,c,d)},vo=(e,t,r,s)=>{let{path:i}=e,n=i.split("."),a=n[0],l=n.slice(1);if(!s||!(a in s))throw new re(`Path reference '#{${i}}' refers to '${a}' which is not a loop variable in the current scope`);if(s.__paths__||(s.__paths__={}),!(a in s.__paths__))throw new re(`Path reference '#{${i}}' cannot be resolved - path tracking may not be initialized properly`);let p=s.__paths__[a];if(typeof p=="number"){if(l.length>0)throw new re(`Path reference '#{${i}}' - cannot access properties on index variable '${a}'`);return String(p)}return l.length>0&&(p+="."+l.join(".")),p},ir=io;var wo=/\$\{([^}]*)\}/g,_o=/#\{([^}]*)\}/g,Hs=(e,t={})=>{let r=e.match(/^(\w+)\((.*)\)$/);if(!r)return{isFunction:!1};let[,s,i]=r,n=xo(i,t);return{isFunction:!0,type:v.FUNCTION,name:s,args:n}},xo=(e,t={})=>e.trim()?Eo(e).map(s=>Ao(s.trim(),t)):[],Eo=e=>{let t=[],r="",s=0,i=!1,n="";for(let a=0;a<e.length;a++){let l=e[a],p=a>0?e[a-1]:"";!i&&(l==='"'||l==="'")?(i=!0,n=l,r+=l):i&&l===n&&p!=="\\"?(i=!1,n="",r+=l):!i&&l==="("?(s++,r+=l):!i&&l===")"?(s--,r+=l):!i&&l===","&&s===0?(t.push(r),r=""):r+=l}return r&&t.push(r),t},Ao=(e,t={})=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:v.LITERAL,value:e.slice(1,-1)};if(/^-?\d+(\.\d+)?$/.test(e))return{type:v.LITERAL,value:parseFloat(e)};if(e==="true")return{type:v.LITERAL,value:!0};if(e==="false")return{type:v.LITERAL,value:!1};if(e==="null")return{type:v.LITERAL,value:null};let r=Hs(e,t);if(r.isFunction)return{type:r.type,name:r.name,args:r.args};let s=e.trim(),i=[{op:" + ",type:"ADD"},{op:" - ",type:"SUBTRACT"}],n=-1,a=null;for(let{op:l,type:p}of i){let o=0;for(;o<s.length;){let u=Ae(s.substring(o),l);if(u===-1)break;let c=o+u;c>n&&(n=c,a={op:l,type:p}),o=c+l.length}}if(n!==-1)try{return Z(s,t)}catch{return{type:v.VARIABLE,path:s}}return{type:v.VARIABLE,path:s}},Gs=/^\w+\(.*\)$/,ko=/\s[+\-*/%]\s|\|\||&&|\?\?|.*\?.*:/,$o=e=>{if(!(!e||e.trim()===""||Gs.test(e))&&ko.test(e))throw e.includes("?")&&e.includes(":")?new k(`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 k(`Logical operators not supported in variable replacements - consider calculating the value in your data instead (operators like ||, &&, ?? are not supported). Offending expression: "${e}"`):new k(`Arithmetic expressions not supported in variable replacements - consider calculating '${e}' in your data instead (expressions with +, -, *, /, % are not supported). Offending expression: "${e}"`)},Ks=e=>{let t=e.trim();if(Gs.test(t))throw new k(`Functions are not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(t.includes("["))throw new k(`Array indices not supported in path references - use simple variable names or properties. Offending expression: "#{${e}}"`);if(/[+\-*/%]/.test(t))throw new k(`Arithmetic expressions not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(/\|\||&&/.test(t))throw new k(`Logical operators not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(t.includes("?")&&t.includes(":"))throw new k(`Complex expressions not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);return{type:v.PATH_REFERENCE,path:t}},qe=(e,t={})=>{let r=e.trim();$o(r);let s=Hs(r,t);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:v.VARIABLE,path:r}},nr=(e,t={})=>{let r=e,s=[];(e.includes("\\${")||e.includes("\\#{"))&&(r=e.replace(/\\\\(\$\{[^}]*\})/g,"\\DOUBLE_ESC_VAR$1"),r=r.replace(/\\\\(#\{[^}]*\})/g,"\\DOUBLE_ESC_PATH$1"),r=r.replace(/\\(\$\{[^}]*\})/g,(o,u)=>{let c=`__ESCAPED_${s.length}__`;return s.push(u),c}),r=r.replace(/\\(#\{[^}]*\})/g,(o,u)=>{let c=`__ESCAPED_${s.length}__`;return s.push(u),c}),r=r.replace(/\\DOUBLE_ESC_VAR/g,"\\"),r=r.replace(/\\DOUBLE_ESC_PATH/g,"\\"));let i=[...r.matchAll(wo)],n=[...r.matchAll(_o)],a=[...i.map(o=>({match:o,type:"variable"})),...n.map(o=>({match:o,type:"pathref"}))].sort((o,u)=>o.match.index-u.match.index);if(a.length===0){let o=r;for(let u=0;u<s.length;u++)o=o.replace(`__ESCAPED_${u}__`,s[u]);return{type:v.LITERAL,value:o}}if(a.length===1&&a[0].match[0]===r&&s.length===0){let{match:o,type:u}=a[0];try{return u==="variable"?qe(o[1],t):Ks(o[1])}catch(c){if(c.message==="Invalid array index syntax")return{type:v.LITERAL,value:r};throw c}}let l=[],p=0;for(let{match:o,type:u}of a){let[c,d]=o,h=o.index;if(h>p){let f=r.substring(p,h);for(let m=0;m<s.length;m++)f=f.replace(`__ESCAPED_${m}__`,s[m]);f&&l.push(f)}try{let f;u==="variable"?f=qe(d.trim(),t):f=Ks(d.trim()),l.push(f)}catch(f){if(f.message==="Invalid array index syntax")l.push(c);else throw f}p=h+c.length}if(p<r.length){let o=r.substring(p);for(let u=0;u<s.length;u++)o=o.replace(`__ESCAPED_${u}__`,s[u]);o&&l.push(o)}return{type:v.INTERPOLATION,parts:l}};var ve=(e,t)=>typeof e=="string"?nr(e,t):typeof e=="object"&&e!==null?Array.isArray(e)?Co(e,t):Io(e,t):{type:v.LITERAL,value:e},So=e=>{let{$each:t,...r}=e;if(typeof t!="string")throw new k("$each value must be a non-empty string");let s=t.trim();if(s==="")throw new k("$each value must be a non-empty string");if(Object.keys(r).length===0)throw new k("Empty $each body not allowed");if(r.$partial!==void 0)throw new k("Cannot use $partial with $each at the same level. Wrap $partial in a parent object if you need conditionals.");return{[`$for ${s}`]:r}},Co=(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)){if(n.$each!==void 0)try{let p=So(n),o=Object.keys(p);if(o.length===1&&/^\$for(?::\w+)?\s/.test(o[0])){let u=qs(o[0],p[o[0]],t,!0);r.push(u),s=!0;continue}}catch(p){throw p instanceof k?p:new k(p.message)}let l=Object.keys(n);if(l.length===1&&/^\$for(?::\w+)?\s/.test(l[0])){let p=qs(l[0],n[l[0]],t);r.push(p),s=!0;continue}}let a=ve(n,t);r.push(a),(a.type===v.FUNCTION||a.type===v.CONDITIONAL||a.type===v.LOOP||a.type===v.PARTIAL||a.type===v.OBJECT&&!a.fast||a.type===v.ARRAY&&!a.fast)&&(s=!0)}return{type:v.ARRAY,items:r,fast:!s}},Io=(e,t)=>{let r=[],s=!1,i=null,n=Object.entries(e),a=0;if(e.$partial!==void 0){if(typeof e.$partial!="string")throw new k("$partial value must be a string");if(e.$partial.trim()==="")throw new k("$partial value cannot be an empty string");let p=["$if","$elif","$else","$for"],o=[];for(let[y]of n)for(let w of p)if(y===w||y.startsWith(w+" ")||y.startsWith(w+"#")){o.push(w);break}if(o.length>0)throw new k(`Cannot use $partial with ${o.join(", ")} at the same level. Wrap $partial in a parent object if you need conditionals.`);let{$partial:u,$when:c,...d}=e,h={},f=!1;for(let[y,w]of Object.entries(d)){let _=y;(y.startsWith("\\$")||y.startsWith("$$"))&&(_=y.slice(1)),h[_]=w,f=!0}let m=null;if(f&&(m=ve(h,t),m.type===v.OBJECT)){let y=!1;for(let w of m.properties)if(w.value.type===v.VARIABLE||w.value.type===v.INTERPOLATION||w.value.type===v.FUNCTION||w.value.type===v.CONDITIONAL||w.value.type===v.OBJECT&&!w.value.fast||w.value.type===v.ARRAY&&!w.value.fast){y=!0;break}y&&(m.fast=!1)}let g={type:v.PARTIAL,name:u,data:m};if(c!==void 0){let y;if(typeof c=="string"){if(c.trim()==="")throw new k("Empty condition expression after '$when'");y=Z(c,t)}else y={type:v.LITERAL,value:c};g.whenCondition=y}return g}for(let[p,o]of n)if(p==="$when"){if(i!==null)throw new k("Multiple '$when' directives on the same object are not allowed");if(o==null)throw new k("Missing condition expression after '$when'");let u=typeof o=="string"?o:JSON.stringify(o);if(u.trim()==="")throw new k("Empty condition expression after '$when'");i=Z(u,t),s=!0}else if(p.startsWith("$when#")||p.startsWith("$when "))throw new k("'$when' does not support ID syntax or inline conditions - use '$when' as a property");for(;a<n.length;){let[p,o]=n[a];if(p==="$when"){a++;continue}if(p==="$each")throw new k("$each can only be used inside arrays");if(p.startsWith("$if ")||p.match(/^\$if#\w+\s/)||p.match(/^\$if\s+\w+.*:$/)){let u=Oo(n,a,t);r.push({key:p,value:u.node}),s=!0,a=u.nextIndex}else if(/^\$for(?::\w+)?\s/.test(p)){let u=p.match(/^\$for(?::(\w+))?\s/)?.[1]||"",c=u?`:${u}`:"";throw new k(`$for loops must be inside arrays - use '- $for${c} item in items:' instead of '$for${c} item in items:'. For cleaner object generation syntax, consider using $each.`)}else{if(p.startsWith("$elif ")||p.startsWith("$else"))throw new k(`'${p.split(" ")[0]}' without matching '$if'`);if(p==="$if"||p==="$if:")throw new k("Missing condition expression after '$if'");{let u=ve(o,t);(u.type===v.FUNCTION||u.type===v.CONDITIONAL||u.type===v.PARTIAL||u.type===v.OBJECT&&!u.fast||u.type===v.ARRAY&&!u.fast)&&(s=!0);let c=nr(p,t),d={key:p,value:u};(c.type!==v.LITERAL||c.value!==p)&&(d.parsedKey=c),r.push(d),a++}}}let l={type:v.OBJECT,properties:r,fast:!s};return i&&(l.whenCondition=i),l},Oo=(e,t,r={})=>{let s=[],i=[],n=t,[a,l]=e[n],p=null,o;if(a.startsWith("$if#")){let c=a.match(/^\$if#(\w+)\s+(.+)$/);if(c)p=c[1],o=c[2];else throw new k(`Invalid conditional syntax: ${a}`)}else o=a.substring(4),o.endsWith(":")&&(o=o.slice(0,-1).trim());sr(o);let u=Z(o,r);for(s.push(u),i.push(ve(l,r)),n++;n<e.length;){let[c,d]=e[n],h=!1,f;if(p?c.startsWith(`$elif#${p} `)?(f=c.substring(`$elif#${p} `.length),f.endsWith(":")&&(f=f.slice(0,-1).trim()),h=!0):(c===`$else#${p}`||c===`$else#${p}:`)&&(h=!0,f=null):c.startsWith("$elif ")?(f=c.substring(6),f.endsWith(":")&&(f=f.slice(0,-1).trim()),h=!0):(c==="$else"||c==="$else:")&&(h=!0,f=null),h){if(f===null)s.push(null);else{sr(f);let m=Z(f,r);s.push(m)}if(i.push(ve(d,r)),n++,f===null)break}else break}return{node:{type:v.CONDITIONAL,conditions:s,bodies:i,id:p},nextIndex:n}},Z=(e,t={})=>{if(e=e.trim(),e.startsWith("(")&&e.endsWith(")")){let o=e.slice(1,-1),u=0,c=!0;for(let d=0;d<o.length;d++)if(o[d]==="("?u++:o[d]===")"&&u--,u<0){c=!1;break}if(c&&u===0)return Z(o,t)}let r=Ae(e,"||");if(r!==-1)return{type:v.BINARY,op:P.OR,left:Z(e.substring(0,r).trim(),t),right:Z(e.substring(r+2).trim(),t)};let s=Ae(e,"&&");if(s!==-1)return{type:v.BINARY,op:P.AND,left:Z(e.substring(0,s).trim(),t),right:Z(e.substring(s+2).trim(),t)};let i=[{op:">=",type:P.GTE},{op:"<=",type:P.LTE},{op:"==",type:P.EQ},{op:"!=",type:P.NEQ},{op:">",type:P.GT},{op:"<",type:P.LT},{op:" in ",type:P.IN}];for(let{op:o,type:u}of i){let c=Ae(e,o);if(c!==-1)return{type:v.BINARY,op:u,left:Z(e.substring(0,c).trim(),t),right:Z(e.substring(c+o.length).trim(),t)}}let n=-1,a=null,l=[{op:" + ",type:P.ADD},{op:" - ",type:P.SUBTRACT}];for(let{op:o,type:u}of l){let c=0;for(;c<e.length;){let d=Ae(e.substring(c),o);if(d===-1)break;let h=c+d;h>n&&(n=h,a={op:o,type:u}),c=h+o.length}}if(n!==-1&&a)return{type:v.BINARY,op:a.type,left:Z(e.substring(0,n).trim(),t),right:Z(e.substring(n+a.op.length).trim(),t)};let p=[" * "," / "," % "];for(let o of p)if(Ae(e,o)!==-1)throw new k(`Arithmetic operations are not allowed in conditionals: "${o}"`);return e.startsWith("!")?{type:v.UNARY,op:Ge.NOT,operand:Z(e.substring(1).trim(),t)}:Js(e,t)},Ae=(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},To=e=>{if(e=e.trim(),e==="true")return{type:v.LITERAL,value:!0};if(e==="false")return{type:v.LITERAL,value:!1};if(e==="null")return{type:v.LITERAL,value:null};if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:v.LITERAL,value:e.slice(1,-1)};if(e==='""'||e==="''")return{type:v.LITERAL,value:""};if(e==="{}")return{type:v.LITERAL,value:{}};if(e==="[]")return{type:v.LITERAL,value:[]};let t=Number(e);return!isNaN(t)&&isFinite(t)?{type:v.LITERAL,value:t}:{type:v.VARIABLE,path:e}},Js=(e,t)=>{let r=e.trim();if(r.match(/^(\w+)\((.*)\)$/))return qe(r,t);let i=To(r);if(i.type===v.LITERAL)return i;if(/^[a-zA-Z_$][\w.$]*$/.test(r))return{type:v.VARIABLE,path:r};try{return qe(r,t)}catch(n){if(n.message&&n.message.includes("not supported"))return i;throw n}},Lo=(e,t=!1)=>{let r=t?"$each":"$for";try{Ds(e)}catch(s){if(s instanceof k&&t){let i=s.message.replace(/\$for/g,"$each");throw new k(i.replace("Parse Error: ",""))}throw s}},qs=(e,t,r,s=!1)=>{let i=/^\$for(?::(\w+))?\s+(.+)$/,n=e.match(i);if(!n){let g=s?"$each":"$for";throw new k(`Invalid loop syntax (got: '${e.replace("$for",g)}')`)}let a=n[1],l=n[2].trim();Lo(l,s);let p=l.match(/^(.+?)\s+in\s+(.+)$/);if(!p){let g=s?"$each":"$for";throw new k(`Invalid loop syntax - missing 'in' keyword (got: '${g} ${l}')`)}let o=p[1].trim(),u=p[2].trim(),c,d=null;if(o.includes(",")){let g=o.split(",").map(y=>y.trim());if(g.length!==2)throw new k(`Invalid loop variables: ${o}. Expected format: "item" or "item, index"`);c=g[0],d=g[1]}else c=o;let h=["this","undefined","null","true","false"];if(h.includes(c))throw new k(`Reserved variable name: ${c}`);if(d&&h.includes(d))throw new k(`Reserved variable name: ${d}`);let f=Js(u,r),m=ve(t,r);return{type:v.LOOP,itemVar:c,indexVar:d,iterable:f,body:m,flatten:a!=="nested"}};var Ro=(e,t={})=>{let{functions:r={}}=t;return ve(e,r)},pt=Ro;var ar={};R(ar,{now:()=>No});var No=()=>Date.now();var Vo=(e,t,r={})=>{let{functions:s={},partials:i={}}=r,n={...ar,...s},a=pt(e,{functions:n}),l={};for(let[p,o]of Object.entries(i))l[p]=pt(o,{functions:n});return ir(a,t,{functions:n,partials:l})},or=Vo;var lr=e=>e!==null&&typeof e=="object",ct=e=>lr(e)&&!Array.isArray(e),Po=e=>typeof e=="string"&&e.includes("."),Ys=e=>typeof e=="string"&&/[\[\]]/.test(e);function Xs(e,t){let r={};for(let s of t){if(typeof s!="string"||s.length===0)continue;let i=ie(e,s);i!==void 0&&pe(r,s,i)}return r}function Do(e){if(!ct(e)||!Array.isArray(e.fields))return e;let t=(r=[])=>r.map(s=>{if(!ct(s))return s;if(typeof s.$when=="string"&&s.$when.trim().length>0){let{$when:i,...n}=s,a=Array.isArray(n.fields)?{...n,fields:t(n.fields)}:n;return{[`$if ${i}`]:a}}return Array.isArray(s.fields)?{...s,fields:t(s.fields)}:s});return{...e,fields:t(e.fields)}}var ie=(e,t,r=void 0)=>{if(!t||!lr(e)||Ys(t))return r;let s=t.split(".").filter(n=>n!==""),i=e;for(let n of s){if(i==null||!(n in i))return Object.prototype.hasOwnProperty.call(e,t)?e[t]:r;i=i[n]}return i},pe=(e,t,r)=>{if(!lr(e)||typeof t!="string"||t.length===0||Ys(t))return e;let s=t.split(".").filter(n=>n!=="");if(s.length===0)return e;Po(t)&&Object.prototype.hasOwnProperty.call(e,t)&&delete e[t];let i=e;for(let n=0;n<s.length-1;n++){let a=s[n];(!(a in i)||typeof i[a]!="object"||i[a]===null)&&(i[a]={}),i=i[a]}return i[s[s.length-1]]=r,e},Bo=["id","class","style","slot","form","defaultValues","disabled"],jo=(e={})=>Object.entries(e).filter(([t])=>!Bo.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Fo={email:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,url:/^https?:\/\/.+/},de={required:"This field is required",minLength:e=>`Must be at least ${e} characters`,maxLength:e=>`Must be at most ${e} characters`,pattern:"Invalid format",invalidDate:"Invalid date format",invalidTime:"Invalid time format",invalidDateTime:"Invalid date and time format",minTemporal:e=>`Must be on or after ${e}`,maxTemporal:e=>`Must be on or before ${e}`},Mo="input-date",Wo="input-time",zo="input-datetime",Uo=/^(\d{4})-(\d{2})-(\d{2})$/,Ko=/^(\d{2}):(\d{2})(?::(\d{2}))?$/,Ho=/^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}(?::\d{2})?)$/,Go=e=>{if(typeof e!="string")return null;let t=Uo.exec(e);if(!t)return null;let r=Number(t[1]),s=Number(t[2]),i=Number(t[3]);if(!Number.isInteger(r)||!Number.isInteger(s)||!Number.isInteger(i)||s<1||s>12||i<1||i>31)return null;let n=new Date(Date.UTC(r,s-1,i));return n.getUTCFullYear()===r&&n.getUTCMonth()===s-1&&n.getUTCDate()===i?{year:r,month:s,day:i}:null},qo=e=>{if(typeof e!="string")return null;let t=Ko.exec(e);if(!t)return null;let r=Number(t[1]),s=Number(t[2]),i=t[3]===void 0?0:Number(t[3]);return!Number.isInteger(r)||!Number.isInteger(s)||!Number.isInteger(i)||r<0||r>23||s<0||s>59||i<0||i>59?null:{hour:r,minute:s,second:i}},Zs=e=>{let t=qo(e);return t?`${String(t.hour).padStart(2,"0")}:${String(t.minute).padStart(2,"0")}:${String(t.second).padStart(2,"0")}`:null},Qs=e=>Go(e)?e:null,Jo=e=>{if(typeof e!="string")return null;let t=Ho.exec(e);if(!t)return null;let r=Qs(t[1]),s=Zs(t[2]);return!r||!s?null:`${r}T${s}`},Yo=e=>e===Mo?{normalize:Qs,invalidMessage:de.invalidDate}:e===Wo?{normalize:Zs,invalidMessage:de.invalidTime}:e===zo?{normalize:Jo,invalidMessage:de.invalidDateTime}:null,Xo=(e,t)=>{let r=Yo(e.type);if(!r||t==null||t==="")return null;let s=r.normalize(String(t));if(!s)return r.invalidMessage;if(e.min!==void 0&&e.min!==null&&String(e.min)!==""){let i=r.normalize(String(e.min));if(i&&s<i)return de.minTemporal(String(e.min))}if(e.max!==void 0&&e.max!==null&&String(e.max)!==""){let i=r.normalize(String(e.max));if(i&&s>i)return de.maxTemporal(String(e.max))}return null},Je=(e,t)=>{if(e.required){let s=t==null||t===""||typeof t=="boolean"&&t===!1,i=e.type==="input-number"&&t===null;if(e.type==="input-number"?i:s)return typeof e.required=="object"&&e.required.message?e.required.message:de.required}let r=Xo(e,t);if(r)return r;if(Array.isArray(e.rules))for(let s of e.rules){let i=Zo(s,t);if(i)return i}return null},Zo=(e,t)=>{if(t==null||t==="")return null;let r=String(t);switch(e.rule){case"minLength":return r.length<e.value?e.message||de.minLength(e.value):null;case"maxLength":return r.length>e.value?e.message||de.maxLength(e.value):null;case"pattern":{let i=Fo[e.value];if(!i)try{i=new RegExp(e.value)}catch{return e.message||de.pattern}return i.test(r)?null:e.message||de.pattern}default:return null}},Le=(e,t)=>{let r={},s=Q(e);for(let i of s){let n=ie(t,i.name),a=Je(i,n);a&&(r[i.name]=a)}return{valid:Object.keys(r).length===0,errors:r}},Qo=["section","read-only-text","slot"],pr=e=>!Qo.includes(e.type),Q=e=>{let t=[];for(let r of e)r.type==="section"&&Array.isArray(r.fields)?t.push(...Q(r.fields)):pr(r)&&t.push(r);return t},Ye=e=>{switch(e.type){case"input-text":case"input-date":case"input-time":case"input-datetime":case"input-textarea":case"popover-input":return"";case"input-number":return null;case"select":return null;case"checkbox":return!1;case"color-picker":return"#000000";case"slider":case"slider-with-input":return e.min!==void 0?e.min:0;case"image":return null;default:return null}},cr=(e,t=0)=>{let r=[],s=t;for(let i of e)if(i.type==="section"){if(r.push({...i,_isSection:!0,_idx:s}),s++,Array.isArray(i.fields)){let n=cr(i.fields,s);r.push(...n),s+=n.length}}else r.push({...i,_isSection:!1,_idx:s}),s++;return r},el=()=>Object.freeze({formValues:{},errors:{},reactiveMode:!1,tooltipState:{open:!1,x:0,y:0,content:""}}),K=({state:e,props:t})=>{let{form:r={}}=t||{},s=Do(r),i=ct(t?.context)?t.context:{},n=ct(e?.formValues)?e.formValues:{},a={...i,...n,formValues:n};return Object.keys(a).length>0?or(s,a):s},tl=({state:e,props:t})=>{let r=jo(t),s=K({state:e,props:t}),i=s.fields||[],n=!!t?.disabled,a=cr(i);a.forEach((c,d)=>{if(c._arrIdx=d,c._isSection)return;let h=pr(c);if(c._disabled=n||!!c.disabled,h&&c.name&&(c._error=e.errors[c.name]||null),c.type==="input-text"&&(c._inputType=c.inputType||"text"),c.type==="select"){let f=ie(e.formValues,c.name);c._selectedValue=f!==void 0?f:null,c.placeholder=c.placeholder||"",c.noClear=c.clearable===!1}if(c.type==="image"){let f=ie(e.formValues,c.name);c._imageSrc=f&&String(f).trim()?f:null,c.placeholderText=c.placeholderText||"No Image"}if(c.type==="read-only-text"&&(c.content=c.content||""),c.type==="checkbox"){let f=typeof c.content=="string"?c.content:typeof c.checkboxLabel=="string"?c.checkboxLabel:"";c._checkboxText=f}});let l=s.actions||{buttons:[]},p=l.layout||"split",o=(l.buttons||[]).map((c,d)=>({...c,_globalIdx:d,variant:c.variant||"se",_disabled:n||!!c.disabled,pre:c.pre||"",suf:c.suf||""})),u;return p==="split"?u={_layout:"split",buttons:o,_leftButtons:o.filter(c=>c.align==="left"),_rightButtons:o.filter(c=>c.align!=="left")}:u={_layout:p,buttons:o,_allButtons:o},{containerAttrString:r,title:s?.title||"",description:s?.description||"",flatFields:a,actions:u,formValues:e.formValues,tooltipState:e.tooltipState}},me=({state:e,props:t})=>{let r=K({state:e,props:t}),s=Q(r.fields||[]);return Xs(e.formValues,s.map(i=>i.name).filter(i=>typeof i=="string"&&i.length>0))},rl=({state:e,props:t},r={})=>{let{name:s,value:i}=r;s&&(pe(e.formValues,s,i),Re({state:e,props:t}))},Re=({state:e,props:t})=>{if(!t)return;let r=K({state:e,props:t}),s=Q(r.fields||[]);e.formValues=Xs(e.formValues,s.map(i=>i.name).filter(i=>typeof i=="string"&&i.length>0))},sl=({state:e},t={})=>{let{values:r}=t;!r||typeof r!="object"||Object.keys(r).forEach(s=>{pe(e.formValues,s,r[s])})},il=({state:e},t={})=>{let{defaultValues:r={}}=t;e.formValues=r?structuredClone(r):{},e.errors={},e.reactiveMode=!1},nl=({state:e},t={})=>{e.errors=t.errors||{}},al=({state:e},t={})=>{let{name:r}=t;r&&e.errors[r]&&delete e.errors[r]},ol=({state:e})=>{e.reactiveMode=!0},ll=({state:e},t={})=>{let{x:r,y:s,content:i}=t;e.tooltipState={open:!0,x:r,y:s,content:i}},pl=({state:e})=>{e.tooltipState={...e.tooltipState,open:!1}};var ei=({field:e,target:t,value:r})=>{!e||!t||["slider-with-input","popover-input"].includes(e.type)&&(r==null?t.removeAttribute("value"):t.setAttribute("value",String(r)))},ti=({form:e,formValues:t={},refs:r,formDisabled:s=!1})=>{let i=e.fields||[],n=0,a=l=>{for(let p of l){if(p.type==="section"){n++,Array.isArray(p.fields)&&a(p.fields);continue}let o=r[`field${n}`];if(n++,!o)continue;let u=s||!!p.disabled;if(["input-text","input-date","input-time","input-datetime","input-number","input-textarea","color-picker","slider","slider-with-input","popover-input"].includes(p.type)){let c=ie(t,p.name);if(c==null?o.removeAttribute("value"):o.setAttribute("value",String(c)),p.type==="slider-with-input"&&o.store?.setValue){let d=Number(c??0);o.store.setValue({value:Number.isFinite(d)?d:0}),typeof o.render=="function"&&o.render()}p.type==="popover-input"&&o.store?.setValue&&(o.store.setValue({value:c==null?"":String(c)}),typeof o.render=="function"&&o.render())}p.type==="checkbox"&&(ie(t,p.name)?o.setAttribute("checked",""):o.removeAttribute("checked")),["input-text","input-date","input-time","input-datetime","input-number","input-textarea","popover-input"].includes(p.type)&&p.placeholder&&o.getAttribute("placeholder")!==p.placeholder&&(p.placeholder===void 0||p.placeholder===null?o.removeAttribute("placeholder"):o.setAttribute("placeholder",p.placeholder)),u?o.setAttribute("disabled",""):o.removeAttribute("disabled")}};a(i)},cl=(e,t)=>{let r=t?.defaultValues||{},s={};Object.keys(r).forEach(l=>{pe(s,l,r[l])});let i=K({state:{formValues:s},props:t}),n=Q(i.fields||[]),a={};for(let l of n){let p=ie(r,l.name);p!==void 0?pe(a,l.name,p):pe(a,l.name,Ye(l))}e.resetFormValues({defaultValues:a})},ul=e=>{let{store:t,props:r}=e;cl(t,r)},dl=e=>{let{props:t,refs:r,render:s}=e,i=e.store.getState(),n=K({state:i,props:t});ti({form:n,formValues:i.formValues,refs:r,formDisabled:!!t?.disabled}),s()},fl=(e,t)=>{let{newProps:r}=t,{store:s,render:i,refs:n}=e,a=!!r?.disabled,l=s.getState();Re({state:l,props:r});let p=K({state:l,props:r});ti({form:p,formValues:l.formValues,refs:n,formDisabled:a}),i()},hl=(e,t)=>{let{store:r,dispatchEvent:s,render:i,props:n}=e,a=t._event,l=a.currentTarget.dataset.fieldName;if(!l||!a.detail||!Object.prototype.hasOwnProperty.call(a.detail,"value"))return;let p=a.detail.value;r.setFormFieldValue({name:l,value:p});let o=r.getState();Re({state:o,props:n});let u=K({state:o,props:n}),d=Q(u.fields||[]).find(h=>h.name===l);if(ei({field:d,target:a.currentTarget,value:p}),o.reactiveMode&&d){let h=Je(d,p);h?r.setErrors({errors:{...o.errors,[l]:h}}):r.clearFieldError({name:l})}i(),s(new CustomEvent("form-input",{bubbles:!0,detail:{name:l,value:p,values:me({state:r.getState(),props:n})}}))},ml=(e,t)=>{let{store:r,dispatchEvent:s,render:i,props:n}=e,a=t._event,l=a.currentTarget.dataset.fieldName;if(!l||!a.detail||!Object.prototype.hasOwnProperty.call(a.detail,"value"))return;let p=a.detail.value;r.setFormFieldValue({name:l,value:p});let o=r.getState();Re({state:o,props:n});let u=K({state:o,props:n}),d=Q(u.fields||[]).find(h=>h.name===l);if(ei({field:d,target:a.currentTarget,value:p}),o.reactiveMode&&d){let h=Je(d,p);h?r.setErrors({errors:{...o.errors,[l]:h}}):r.clearFieldError({name:l})}i(),s(new CustomEvent("form-change",{bubbles:!0,detail:{name:l,value:p,values:me({state:r.getState(),props:n})}}))},yl=(e,t)=>{let{store:r,dispatchEvent:s,render:i,props:n}=e,l=t._event.currentTarget.dataset.actionId;if(!l)return;let p=r.getState(),o=K({state:p,props:n}),d=((o.actions||{}).buttons||[]).find(f=>f.id===l),h=me({state:p,props:n});if(d&&d.validate){let f=Q(o.fields||[]),{valid:m,errors:g}=Le(f,p.formValues);r.setErrors({errors:g}),m||r.setReactiveMode(),i(),s(new CustomEvent("form-action",{bubbles:!0,detail:{actionId:l,values:h,valid:m,errors:g}}))}else s(new CustomEvent("form-action",{bubbles:!0,detail:{actionId:l,values:h}}))},gl=(e,t)=>{let r=t._event;r.type==="contextmenu"&&r.preventDefault();let{store:s,dispatchEvent:i,props:n}=e,a=r.currentTarget.dataset.fieldName;i(new CustomEvent("form-field-event",{bubbles:!0,detail:{name:a,event:r.type,values:me({state:s.getState(),props:n})}}))},bl=(e,t)=>{let{store:r,dispatchEvent:s,render:i,props:n}=e,a=t._event;if(a.key==="Enter"&&!a.shiftKey){let l=a.target;if(l.tagName==="TEXTAREA"||l.tagName==="RTGL-TEXTAREA")return;a.preventDefault();let p=r.getState(),o=K({state:p,props:n}),c=(o.actions||{}).buttons||[],h=c.find(m=>m.validate)||c[0];if(!h)return;let f=me({state:p,props:n});if(h.validate){let m=Q(o.fields||[]),{valid:g,errors:y}=Le(m,p.formValues);r.setErrors({errors:y}),g||r.setReactiveMode(),i(),s(new CustomEvent("form-action",{bubbles:!0,detail:{actionId:h.id,values:f,valid:g,errors:y}}))}else s(new CustomEvent("form-action",{bubbles:!0,detail:{actionId:h.id,values:f}}))}},vl=(e,t)=>{let{store:r,render:s,props:i}=e,n=t._event,a=n.currentTarget.dataset.fieldName,l=K({state:r.getState(),props:i}),o=Q(l.fields||[]).find(u=>u.name===a);if(o&&o.tooltip){let u=n.currentTarget.getBoundingClientRect();r.showTooltip({x:u.left+u.width/2,y:u.top-8,content:typeof o.tooltip=="string"?o.tooltip:o.tooltip.content||""}),s()}},wl=e=>{let{store:t,render:r}=e;t.hideTooltip({}),r()};var fr={};R(fr,{getValues:()=>$l,reset:()=>Il,setValues:()=>Sl,validate:()=>Cl});var _l=["input-text","input-date","input-time","input-datetime","input-number","input-textarea","color-picker","slider","slider-with-input","popover-input"],xl=["input-text","input-date","input-time","input-datetime","input-number","input-textarea","popover-input","slider-with-input"],El=({ref:e,fieldType:t,value:r,forceRefresh:s=!1})=>{if(_l.includes(t)){if(s&&e.removeAttribute("value"),r==null){if(xl.includes(t)&&s){if(t==="popover-input"){e.removeAttribute("value");return}e.setAttribute("value","");return}e.removeAttribute("value");return}e.setAttribute("value",String(r))}},si=({ref:e,value:t})=>{e&&e?.store?.updateSelectedValue&&(e.store.updateSelectedValue({value:t}),typeof e.render=="function"&&e.render())},Al=e=>{let t=new Map;return!e||typeof e.querySelectorAll!="function"||e.querySelectorAll("[data-field-name]").forEach(r=>{let s=r.getAttribute("data-field-name");s&&t.set(s,r)}),t},ri=e=>e?.renderTarget?e.renderTarget:e?.shadowRoot?e.shadowRoot:e?.shadow,kl=({root:e,values:t={}})=>{if(!e||typeof e.querySelectorAll!="function")return;e.querySelectorAll("rtgl-select[data-field-name]").forEach(s=>{let i=s.dataset?.fieldName;if(!i)return;let n=ie(t,i);si({ref:s,value:n})})},$l=function(){let e=this.store.getState();return me({state:e,props:this.props})},Sl=function(e={}){let t=e&&typeof e=="object"&&e.values&&typeof e.values=="object"?e.values:e;if(!t||typeof t!="object"||Array.isArray(t))return;this.store.setFormValues({values:t}),this.store.pruneHiddenValues();let r=this.store.getState(),s=K({state:r,props:this.props}),i=Q(s.fields||[]),n=Al(ri(this));for(let l of i){if(!l.name)continue;let p=n.get(l.name);if(!p)continue;let o=Object.prototype.hasOwnProperty.call(t,l.name),u=ie(t,l.name);if(!o&&u===void 0)continue;let c=ie(r.formValues,l.name);El({ref:p,fieldType:l.type,value:c,forceRefresh:!0}),typeof p?.tagName=="string"&&p.tagName.toUpperCase()==="RTGL-SELECT"&&si({ref:p,value:c}),l.type==="checkbox"&&(c?p.setAttribute("checked",""):p.removeAttribute("checked"))}this.render();let a=()=>{let l=this.store.getState();kl({root:ri(this),values:l.formValues})};a(),setTimeout(()=>{a()},0)},Cl=function(){let e=this.store.getState(),t=K({state:e,props:this.props}),r=Q(t.fields||[]),{valid:s,errors:i}=Le(r,e.formValues);return this.store.setErrors({errors:i}),s||this.store.setReactiveMode(),this.render(),{valid:s,errors:i}},Il=function(){let e=this.props?.defaultValues||{},t={};Object.keys(e).forEach(n=>{pe(t,n,e[n])});let r=K({state:{formValues:t},props:this.props}),s=Q(r.fields||[]),i={};for(let n of s){let a=ie(e,n.name);a!==void 0?pe(i,n.name,a):pe(i,n.name,Ye(n))}this.store.resetFormValues({defaultValues:i}),this.setValues(i)};var ii={componentName:"rtgl-form",propsSchema:{type:"object",properties:{form:{type:"object"},defaultValues:{type:"object"},context:{type:"object"},disabled:{type:"boolean"}}},events:{"form-input":{},"form-change":{},"form-field-event":{},"form-action":{}},methods:{type:"object",properties:{getValues:{type:"function"},setValues:{type:"function"},validate:{type:"function"},reset:{type:"function"}}}};var ni={refs:{formContainer:{eventListeners:{keydown:{handler:"handleKeyDown"}}},"action*":{eventListeners:{click:{handler:"handleActionClick"}}},"tooltipIcon*":{eventListeners:{mouseenter:{handler:"handleTooltipMouseEnter"},mouseleave:{handler:"handleTooltipMouseLeave"}}},"field*":{eventListeners:{"value-input":{handler:"handleValueInput"},"value-change":{handler:"handleValueChange"}}},"image*":{eventListeners:{click:{handler:"handleImageClick"},contextmenu:{handler:"handleImageClick"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view#formContainer 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:"$if title",value:{type:6,conditions:[{type:1,path:"title"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"title"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if description",value:{type:6,conditions:[{type:1,path:"description"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:1,path:"description"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1},{type:8,properties:[{key:"rtgl-view g=lg w=f",value:{type:9,items:[{type:7,itemVar:"field",indexVar:"i",iterable:{type:1,path:"flatFields"},body:{type:9,items:[{type:8,properties:[{key:"$if field._isSection",value:{type:6,conditions:[{type:1,path:"field._isSection"}],bodies:[{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:"$if field.label",value:{type:6,conditions:[{type:1,path:"field.label"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=md",value:{type:1,path:"field.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if field.description",value:{type:6,conditions:[{type:1,path:"field.description"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"field.description"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"$if !field._isSection",value:{type:6,conditions:[{type:5,op:0,operand:{type:1,path:"field._isSection"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view g=md w=f",value:{type:9,items:[{type:8,properties:[{key:"$if field.label || field.description",value:{type:6,conditions:[{type:4,op:7,left:{type:1,path:"field.label"},right:{type:1,path:"field.description"}}],bodies:[{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:"$if field.label",value:{type:6,conditions:[{type:1,path:"field.label"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"field.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if field.required",value:{type:6,conditions:[{type:1,path:"field.required"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text c=fg s=sm",value:{type:0,value:"*"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{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#tooltipIcon${field._idx} data-field-name=${field.name} svg="info" wh=16 c=mu-fg cur=help ml=xs',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg#tooltipIcon",{type:1,path:"field._idx"}," data-field-name=",{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:"$if field.description",value:{type:6,conditions:[{type:1,path:"field.description"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"field.description"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-text"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-text"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input#field${field._idx} data-field-name=${field.name} w=f type=${field._inputType} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f type=",{type:1,path:"field._inputType"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-date"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-date"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input-date#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input-date#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-time"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-time"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input-time#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input-time#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-datetime"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-datetime"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input-datetime#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input-datetime#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-number"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-number"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input-number#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input-number#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-textarea"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-textarea"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-textarea#field${field._idx} data-field-name=${field.name} w=f rows=${field.rows} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-textarea#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f rows=",{type:1,path:"field.rows"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "select"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"select"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-select#field${field._idx} data-field-name=${field.name} w=f :options=flatFields[${field._arrIdx}].options ?no-clear=flatFields[${field._arrIdx}].noClear :selectedValue=#{field._selectedValue} :placeholder=#{field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-select#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f :options=flatFields[",{type:1,path:"field._arrIdx"},"].options ?no-clear=flatFields[",{type:1,path:"field._arrIdx"},"].noClear :selectedValue=",{type:11,path:"field._selectedValue"}," :placeholder=",{type:11,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "color-picker"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"color-picker"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-color-picker#field${field._idx} data-field-name=${field.name} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-color-picker#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "slider"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"slider"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-slider#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "slider-with-input"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"slider-with-input"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-slider-input#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider-input#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "popover-input"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"popover-input"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-popover-input#field${field._idx} data-field-name=${field.name} label="${field.label}" placeholder=${field.placeholder} ?disabled=${field._disabled}',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-popover-input#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"},' label="',{type:1,path:"field.label"},'" placeholder=',{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "checkbox"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"checkbox"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-checkbox#field${field._idx} data-field-name=${field.name} label="${field._checkboxText}" ?disabled=${field._disabled}',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-checkbox#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"},' label="',{type:1,path:"field._checkboxText"},'" ?disabled=',{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "image" && field._imageSrc',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"image"}},right:{type:1,path:"field._imageSrc"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image#image${field._idx} data-field-name=${field.name} src=${field._imageSrc} w=${field.width} h=${field.height} cur=pointer",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image#image",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," src=",{type:1,path:"field._imageSrc"}," w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," cur=pointer"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "image" && !field._imageSrc',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.type"},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._idx} data-field-name=${field.name} w=${field.width} h=${field.height} bc=ac bw=sm ah=c av=c cur=pointer 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._idx"}," data-field-name=",{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=pointer p=md"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "read-only-text"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"read-only-text"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm",value:{type:1,path:"field.content"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "slot"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"slot"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'slot#fieldSlot${field._idx} name=${field.slot} style="display: contents;"',value:{type:0,value:null},parsedKey:{type:2,parts:["slot#fieldSlot",{type:1,path:"field._idx"}," name=",{type:1,path:"field.slot"},' style="display: contents;"']}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if field._error",value:{type:6,conditions:[{type:1,path:"field._error"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=de",value:{type:1,path:"field._error"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}}],fast:!1}}],fast:!1},{type:8,properties:[{key:"$if actions.buttons.length > 0",value:{type:6,conditions:[{type:4,op:2,left:{type:1,path:"actions.buttons.length"},right:{type:0,value:0}}],bodies:[{type:9,items:[{type:8,properties:[{key:'$if actions._layout == "split"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"actions._layout"},right:{type:0,value:"split"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h w=f g=sm",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h g=sm",value:{type:9,items:[{type:7,itemVar:"button",indexVar:"i",iterable:{type:1,path:"actions._leftButtons"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-button#action${button._globalIdx} data-action-id=${button.id} v=${button.variant} ?disabled=${button._disabled} pre=${button.pre} suf=${button.suf}",value:{type:1,path:"button.label"},parsedKey:{type:2,parts:["rtgl-button#action",{type:1,path:"button._globalIdx"}," data-action-id=",{type:1,path:"button.id"}," v=",{type:1,path:"button.variant"}," ?disabled=",{type:1,path:"button._disabled"}," pre=",{type:1,path:"button.pre"}," suf=",{type:1,path:"button.suf"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1},{type:8,properties:[{key:"rtgl-view d=h g=sm ah=e w=1fg",value:{type:9,items:[{type:7,itemVar:"button",indexVar:"i",iterable:{type:1,path:"actions._rightButtons"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-button#action${button._globalIdx} data-action-id=${button.id} v=${button.variant} ?disabled=${button._disabled} pre=${button.pre} suf=${button.suf}",value:{type:1,path:"button.label"},parsedKey:{type:2,parts:["rtgl-button#action",{type:1,path:"button._globalIdx"}," data-action-id=",{type:1,path:"button.id"}," v=",{type:1,path:"button.variant"}," ?disabled=",{type:1,path:"button._disabled"}," pre=",{type:1,path:"button.pre"}," suf=",{type:1,path:"button.suf"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:'$if actions._layout == "vertical"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"actions._layout"},right:{type:0,value:"vertical"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view g=sm w=f",value:{type:9,items:[{type:7,itemVar:"button",indexVar:"i",iterable:{type:1,path:"actions._allButtons"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-button#action${button._globalIdx} data-action-id=${button.id} v=${button.variant} w=f ?disabled=${button._disabled} pre=${button.pre} suf=${button.suf}",value:{type:1,path:"button.label"},parsedKey:{type:2,parts:["rtgl-button#action",{type:1,path:"button._globalIdx"}," data-action-id=",{type:1,path:"button.id"}," v=",{type:1,path:"button.variant"}," w=f ?disabled=",{type:1,path:"button._disabled"}," pre=",{type:1,path:"button.pre"}," suf=",{type:1,path:"button.suf"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:'$if actions._layout == "stretch"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"actions._layout"},right:{type:0,value:"stretch"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h g=sm w=f",value:{type:9,items:[{type:7,itemVar:"button",indexVar:"i",iterable:{type:1,path:"actions._allButtons"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=1fg",value:{type:9,items:[{type:8,properties:[{key:"rtgl-button#action${button._globalIdx} data-action-id=${button.id} v=${button.variant} w=f ?disabled=${button._disabled} pre=${button.pre} suf=${button.suf}",value:{type:1,path:"button.label"},parsedKey:{type:2,parts:["rtgl-button#action",{type:1,path:"button._globalIdx"}," data-action-id=",{type:1,path:"button.id"}," v=",{type:1,path:"button.variant"}," w=f ?disabled=",{type:1,path:"button._disabled"}," pre=",{type:1,path:"button.pre"}," suf=",{type:1,path:"button.suf"}]}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:'rtgl-tooltip ?open=${tooltipState.open} x=${tooltipState.x} y=${tooltipState.y} place="t" 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"},' place="t" content="',{type:1,path:"tooltipState.content"},'"']}}],fast:!0}],fast:!1},parsedKey:{type:2,parts:["rtgl-view#formContainer w=f p=md g=lg ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var hr={};R(hr,{handleCancel:()=>Ll,handleCloseAll:()=>Bl,handleConfirm:()=>Tl,handleDialogClose:()=>Ol,handleDropdownClose:()=>Rl,handleDropdownItemClick:()=>Nl,handleShowAlert:()=>Vl,handleShowConfirm:()=>Pl,handleShowDropdownMenu:()=>Dl});var Ol=(e,t)=>{let{store:r,render:s}=e;r.closeAll(),s()},Tl=(e,t)=>{let{store:r,render:s,globalUI:i}=e;r.closeAll(),s(),i.emit("event",!0)},Ll=(e,t)=>{let{store:r,render:s,globalUI:i}=e;r.closeAll(),s(),i.emit("event",!1)},Rl=(e,t)=>{let{store:r,render:s,globalUI:i}=e;r.closeAll(),s(),i.emit("event",null)},Nl=(e,t)=>{let{store:r,render:s,globalUI:i}=e,n=t._event,{index:a,item:l}=n.detail;r.closeAll(),s(),i.emit("event",{index:a,item:l})},Vl=(e,t)=>{let{store:r,render:s}=e,i=t;r.selectIsOpen()&&(r.closeAll(),s()),r.setAlertConfig(i),s()},Pl=async(e,t)=>{let{store:r,render:s,globalUI:i}=e,n=t;return r.selectIsOpen()&&(r.closeAll(),s()),r.setConfirmConfig(n),s(),new Promise(a=>{i.once("event",l=>{a(l)})})},Dl=async(e,t)=>{let{store:r,render:s,globalUI:i}=e,n=t;return r.selectIsOpen()&&(r.closeAll(),s()),r.setDropdownConfig(n),s(),new Promise(a=>{i.once("event",l=>{a(l)})})},Bl=e=>{let{store:t,render:r}=e;t.selectIsOpen()&&(t.closeAll(),r())};var ai={componentName:"rtgl-global-ui",propsSchema:{type:"object",properties:{}},events:[],methods:{type:"object",properties:{}}};var mr={};R(mr,{closeAll:()=>zl,createInitialState:()=>jl,selectConfig:()=>Ul,selectDropdownConfig:()=>Kl,selectIsOpen:()=>Gl,selectUiType:()=>Hl,selectViewData:()=>ql,setAlertConfig:()=>Fl,setConfirmConfig:()=>Ml,setDropdownConfig:()=>Wl});var jl=()=>Object.freeze({isOpen:!1,uiType:"dialog",config:{status:void 0,title:"",message:"",confirmText:"OK",cancelText:"Cancel",mode:"alert"},dropdownConfig:{items:[],x:0,y:0,place:"bs"}}),Fl=({state: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.uiType="dialog",e.isOpen=!0},Ml=({state: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.uiType="dialog",e.isOpen=!0},Wl=({state:e},t={})=>{if(!t.items||!Array.isArray(t.items))throw new Error("items array is required for showDropdown");e.dropdownConfig={items:t.items,x:t.x||0,y:t.y||0,place:t.place||"bs"},e.uiType="dropdown",e.isOpen=!0},zl=({state:e})=>{e.isOpen=!1,e.uiType="dialog"},Ul=({state:e})=>e.config,Kl=({state:e})=>e.dropdownConfig,Hl=({state:e})=>e.uiType,Gl=({state:e})=>e.isOpen,ql=({state:e})=>({isOpen:e.isOpen,uiType:e.uiType,config:e.config,dropdownConfig:{items:e.dropdownConfig?.items||[],x:e.dropdownConfig?.x||0,y:e.dropdownConfig?.y||0,place:e.dropdownConfig?.place||"bs"},isDialogOpen:e.isOpen&&e.uiType==="dialog",isDropdownOpen:e.isOpen&&e.uiType==="dropdown"});var oi={refs:{dialog:{eventListeners:{close:{handler:"handleDialogClose"}}},confirmButton:{eventListeners:{click:{handler:"handleConfirm"}}},cancelButton:{eventListeners:{click:{handler:"handleCancel"}}},dropdownMenu:{eventListeners:{close:{handler:"handleDropdownClose"},"item-click":{handler:"handleDropdownItemClick"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-dialog#dialog ?open=${isDialogOpen} 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 g=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h ah=c av=c g=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=md",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:"rtgl-view h=24 av=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"config.title"}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"config.message"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-view d=h g=md mt=lg w=f ah=e",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#cancelButton v=se",value:{type:1,path:"config.cancelText"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-button#confirmButton v=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:"isDialogOpen"}," s=sm"]}}],fast:!1},{type:8,properties:[{key:"rtgl-dropdown-menu#dropdownMenu ?open=${isDropdownOpen} x=${dropdownConfig.x} y=${dropdownConfig.y} place=${dropdownConfig.place} :items=dropdownConfig.items key=dropdown-${isDropdownOpen}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-dropdown-menu#dropdownMenu ?open=",{type:1,path:"isDropdownOpen"}," x=",{type:1,path:"dropdownConfig.x"}," y=",{type:1,path:"dropdownConfig.y"}," place=",{type:1,path:"dropdownConfig.place"}," :items=dropdownConfig.items key=dropdown-",{type:1,path:"isDropdownOpen"}]}}],fast:!0}],fast:!1}};var yr={};R(yr,{handleClickStart:()=>Jl});var Jl=(e,t)=>{let{dispatchEvent:r,store:s}=e,i=t._event;console.log("handle click start",s.selectPath()),r(new CustomEvent("start-click",{detail:{path:s.selectPath()}}))};var li={componentName:"rtgl-navbar",propsSchema:{type:"object",properties:{start:{type:"object",properties:{label:{type:"string"},href:{type:"string"},image:{type:"object",properties:{src:{type:"string"}}}}}}},events:{"start-click":{type:"object",properties:{path:{type:"string"}}}},methods:{type:"object",properties:{}}};var gr={};R(gr,{createInitialState:()=>Yl,selectPath:()=>tp,selectViewData:()=>ep,setState:()=>rp});var Yl=()=>Object.freeze({}),Xl=["id","class","style","slot","start"],Zl=(e={})=>Object.entries(e).filter(([t])=>!Xl.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ql=e=>{if(e!=null){if(typeof e=="object")return e;if(typeof e=="string")try{return JSON.parse(decodeURIComponent(e))}catch{try{return JSON.parse(e)}catch{return}}}},ep=({props:e})=>{let t=Ql(e.start)||e.start;return{containerAttrString:Zl(e),start:t||{label:"",image:{src:"",width:32,height:32,alt:""}}}},tp=({props:e})=>e.start?.path,rp=({state:e})=>{};var pi={refs:{start:{eventListeners:{click:{handler:"handleClickStart"}}}},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=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=md cur=pointer",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=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 w=1fg",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 br={};R(br,{handleBeforeMount:()=>ip});var ci=(e,t,r)=>{let{store:s,render:i}=r,n,a=-1/0;if(e.forEach(l=>{let p=l.getBoundingClientRect();p.top<=t&&p.top>a&&(a=p.top,n=l.id)}),!n){let l=1/0;e.forEach(p=>{let o=p.getBoundingClientRect();o.top>t&&o.top<l&&(l=o.top,n=p.id)})}n&&n!==s.selectCurrentId()&&(s.setCurrentId({id:n}),i())},sp=(e,t,r,s)=>{let{store:i,render:n}=s,a=e.querySelectorAll("h1[id], h2[id], h3[id], h4[id], rtgl-text[id]"),l=Array.from(a),p=l.map(u=>{let c=1,d=u.tagName.toLowerCase();return d==="h1"?c=1:d==="h2"?c=2:d==="h3"?c=3:d==="h4"?c=4:d==="rtgl-text"&&(c=parseInt(u.getAttribute("data-level")||"1",10)),{id:u.id,href:`#${u.id}`,title:u.textContent,level:c}});i.setItems({items:p}),ci(l,r,s),n();let o=ci.bind(void 0,l,r,s);return t.addEventListener("scroll",o,{passive:!0}),()=>{t.removeEventListener("scroll",o)}},ip=e=>{let{props:t}=e,r=()=>{};return requestAnimationFrame(()=>{let s=document.getElementById(t.targetId);if(!s)return;let i=window;t.scrollContainerId&&(i=document.getElementById(t.scrollContainerId)||window);let n=parseInt(t.offsetTop||"100",10);r=sp(s,i,n,e)}),()=>{r()}};var ui={componentName:"rtgl-page-outline",propsSchema:{type:"object",properties:{targetId:{type:"string"},scrollContainerId:{type:"string"},offsetTop:{type:"string"}}},events:{onItemClick:{type:"object"}},methods:{type:"object",properties:{}}};var vr={};R(vr,{createInitialState:()=>np,selectCurrentId:()=>lp,selectState:()=>op,selectViewData:()=>ap,setContentContainer:()=>up,setCurrentId:()=>cp,setItems:()=>pp});var np=()=>Object.freeze({items:[],currentId:null,contentContainer:null}),ap=({state:e})=>{let r=((s,i)=>{let n=new Set,a=s.findIndex(p=>p.id===i);if(a===-1)return n;let l=s[a].level;for(let p=a-1;p>=0;p--)if(s[p].level<l){let o=s[p].level;n.add(s[p].id);for(let u=p-1;u>=0;u--)s[u].level<o&&(n.add(s[u].id),o=s[u].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,a=r.has(s.id),l=n||a;return{...s,c:l?"fg":"mu-fg",ml:i[s.level]||"",bc:l?"fg":"mu-fg"}}),currentId:e.currentId}},op=({state:e})=>e,lp=({state:e})=>e.currentId,pp=({state:e},t={})=>{e.items=Array.isArray(t.items)?t.items:[]},cp=({state:e},t={})=>{e.currentId=t.id},up=({state:e},t={})=>{e.contentContainer=t.container};var di={refs:{},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view h=f w=272 d=v pr=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=1fg sv 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 wr={};R(wr,{handleBeforeMount:()=>dp,handleInputChange:()=>yp,handleInputKeydown:()=>bp,handleOnUpdate:()=>fp,handlePopoverClose:()=>mp,handleSubmitClick:()=>gp,handleTextClick:()=>hp});var Xe=e=>e==null||e===!0?"":String(e),fi=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,n=Xe(t);r.setValue({value:n}),r.closePopover({}),i(new CustomEvent("value-change",{detail:{value:n},bubbles:!0})),s()},dp=e=>{let{store:t,props:r}=e;if(r.value!==void 0){let s=Xe(r.value);t.setValue({value:s}),t.setTempValue({value:s})}},fp=(e,t)=>{let{oldProps:r,newProps:s}=t,{store:i,render:n}=e;if(r?.value!==s?.value){let l=Xe(s?.value);i.setValue({value:l}),i.getState().isOpen||i.setTempValue({value:l})}n()},hp=(e,t)=>{let{store:r,render:s,refs:i,props:n}=e;if(n.disabled)return;let a=t._event,l=Xe(n.value);r.setValue({value:l}),r.setTempValue({value:l}),r.openPopover({position:{x:a.currentTarget.getBoundingClientRect().left,y:a.currentTarget.getBoundingClientRect().bottom}}),s(),setTimeout(()=>{let{input:p}=i;if(!p)return;p.value=l,p.focus();let o=p.shadowRoot?.querySelector("input, textarea");o&&typeof o.focus=="function"&&o.focus()},50)},mp=(e,t)=>{let{store:r,render:s}=e;r.closePopover({}),s()},yp=(e,t)=>{let{store:r}=e,s=t._event,i=Xe(s.detail.value);r.setTempValue({value:i})},gp=e=>{let{store:t,refs:r}=e,{input:s}=r,i=s?s.value:t.getState().tempValue;fi(e,i)},bp=(e,t)=>{let{store:r,refs:s}=e,i=t._event;if(i.key==="Enter"){i.preventDefault(),i.stopPropagation();let{input:n}=s,a=n?n.value:r.getState().tempValue;fi(e,a)}else i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),r.closePopover({}),e.render())};var hi={componentName:"rtgl-popover-input",propsSchema:{type:"object",properties:{value:{type:"string"},placeholder:{type:"string"},label:{type:"string"},autoFocus:{type:"boolean"},disabled:{type:"boolean",default:!1}}},events:{"value-change":{}},methods:{type:"object",properties:{}}};var _r={};R(_r,{closePopover:()=>Ep,createInitialState:()=>vp,openPopover:()=>xp,selectValue:()=>kp,selectViewData:()=>wp,setTempValue:()=>_p,setValue:()=>Ap});var vp=()=>Object.freeze({isOpen:!1,position:{x:0,y:0},value:"",tempValue:""}),wp=({props:e,state:t})=>{let r=typeof t.value=="string"&&t.value.length>0,s=r?t.value:"-",i=typeof e.placeholder=="string"?e.placeholder:"",n=typeof e.label=="string"?e.label:"",a=!!e.disabled;return{isOpen:t.isOpen,position:t.position,value:s,valueColor:r?"fg":"mu-fg",tempValue:t.tempValue,placeholder:i,label:n,disabled:a}},_p=({state:e},t={})=>{e.tempValue=t.value},xp=({state:e},t={})=>{let{position:r}=t;e.position=r,e.isOpen=!0,e.hasUnsavedChanges=!1},Ep=({state:e})=>{e.isOpen=!1,e.tempValue=""},Ap=({state:e},t={})=>{e.value=t.value},kp=({state:e})=>e.value;var mi={refs:{textDisplay:{eventListeners:{click:{handler:"handleTextClick"}}},popover:{eventListeners:{close:{handler:"handlePopoverClose"}}},input:{eventListeners:{"value-input":{handler:"handleInputChange"},keydown:{handler:"handleInputKeydown"}}},submit:{eventListeners:{click:{handler:"handleSubmitClick"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view#textDisplay w=f cur=pointer",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${valueColor}",value:{type:1,path:"value"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"valueColor"}]}}],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=mu 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} ?disabled=${disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#input w=f placeholder=",{type:1,path:"placeholder"}," ?disabled=",{type:1,path:"disabled"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=f ah=e",value:{type:9,items:[{type:8,properties:[{key:"rtgl-button#submit ?disabled=${disabled}",value:{type:0,value:"Submit"},parsedKey:{type:2,parts:["rtgl-button#submit ?disabled=",{type:1,path:"disabled"}]}}],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 xr={};R(xr,{handleAddOptionClick:()=>Np,handleAddOptionMouseEnter:()=>Vp,handleAddOptionMouseLeave:()=>Pp,handleBeforeMount:()=>$p,handleButtonClick:()=>Cp,handleClearClick:()=>Rp,handleClickOptionsPopoverOverlay:()=>Ip,handleOnUpdate:()=>Sp,handleOptionClick:()=>Op,handleOptionMouseEnter:()=>Tp,handleOptionMouseLeave:()=>Lp});var $p=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=>Ee(n.value,r.selectedValue));i&&(t.updateSelectedValue({value:i?.value}),s())}},Sp=(e,t)=>{let{oldProps:r,newProps:s}=t,{store:i,render:n}=e,a=!1;s?.disabled&&!r?.disabled&&(i.closeOptionsPopover({}),a=!0),r.selectedValue!==s.selectedValue&&(i.updateSelectedValue({value:s.selectedValue}),a=!0),a&&n()},Cp=(e,t)=>{let{store:r,render:s,refs:i,props:n}=e;if(n.disabled)return;t._event.stopPropagation();let l=i.selectButton,p=l.firstElementChild,o=p?p.getBoundingClientRect():l.getBoundingClientRect(),u=r.selectSelectedValue(),c=u!==null?u:n.selectedValue,d=null;c!=null&&n.options&&(d=n.options.findIndex(h=>Ee(h.value,c)),d===-1&&(d=null)),r.openOptionsPopover({position:{y:o.bottom+12,x:o.left-24},selectedIndex:d}),s()},Ip=e=>{let{store:t,render:r}=e;t.closeOptionsPopover({}),r()},Op=(e,t)=>{let{render:r,dispatchEvent:s,props:i,store:n}=e;if(i.disabled)return;let a=t._event;a.stopPropagation();let l=a.currentTarget.id.slice(6),p=Number(l),o=i.options[l];n.updateSelectedValue({value:o?.value}),i.onChange&&typeof i.onChange=="function"&&i.onChange(o.value),s(new CustomEvent("value-change",{detail:{value:o.value,label:o.label,index:p,item:o},bubbles:!0})),r()},Tp=(e,t)=>{let{store:r,render:s}=e,i=t._event,n=parseInt(i.currentTarget.id.slice(6),10);r.setHoveredOption({optionId:n}),s()},Lp=(e,t)=>{let{store:r,render:s}=e;r.clearHoveredOption({}),s()},Rp=(e,t)=>{let{store:r,render:s,dispatchEvent:i,props:n}=e;if(n.disabled)return;t._event.stopPropagation(),r.clearSelectedValue({}),n.onChange&&typeof n.onChange=="function"&&n.onChange(void 0),i(new CustomEvent("value-change",{detail:{value:void 0,label:void 0,index:null,item:void 0},bubbles:!0})),s()},Np=(e,t)=>{if(e.props.disabled)return;let{store:r,render:s,dispatchEvent:i}=e,{_event:n}=t;n.stopPropagation(),r.closeOptionsPopover({}),i(new CustomEvent("add-option-click",{bubbles:!0})),s()},Vp=(e,t)=>{let{store:r,render:s}=e;r.setHoveredAddOption({isHovered:!0}),s()},Pp=(e,t)=>{let{store:r,render:s}=e;r.setHoveredAddOption({isHovered:!1}),s()};var yi={componentName:"rtgl-select",propsSchema:{type:"object",properties:{placeholder:{type:"string"},options:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"any"},testId:{type:"string"}}}},selectedValue:{type:"any"},onChange:{type:"function"},noClear:{type:"boolean"},addOption:{type:"object",properties:{label:{type:"string"}}},disabled:{type:"boolean"},w:{type:"string"}}},events:{"value-change":{},"add-option-click":{}},methods:{type:"object",properties:{}}};var Er={};R(Er,{clearHoveredOption:()=>qp,clearSelectedValue:()=>Jp,closeOptionsPopover:()=>Up,createInitialState:()=>jp,openOptionsPopover:()=>zp,resetSelection:()=>Hp,selectSelectedValue:()=>Wp,selectState:()=>Mp,selectViewData:()=>Fp,setHoveredAddOption:()=>Yp,setHoveredOption:()=>Gp,updateSelectedValue:()=>Kp});var Dp=["id","class","style","slot","placeholder","selectedValue","onChange","options","noClear","addOption","disabled"],Bp=(e={})=>Object.entries(e).filter(([t])=>!Dp.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),jp=()=>Object.freeze({isOpen:!1,position:{x:0,y:0},selectedValue:null,hoveredOptionId:null,hoveredAddOption:!1}),Fp=({state:e,props:t})=>{let r=Bp(t),s=!!t.disabled,n=Object.prototype.hasOwnProperty.call(t||{},"selectedValue")?t.selectedValue:e.selectedValue,a=t.placeholder||"Select an option",l=!0,p=t.options||[],o=p.find(c=>Ee(c.value,n));o&&(a=o.label,l=!1);let u=p.map((c,d)=>{let h=Ee(c.value,n),f=e.hoveredOptionId===d;return{...c,isSelected:h,bgc:f?"ac":h?"mu":""}});return{containerAttrString:r,isDisabled:s,isOpen:e.isOpen,position:e.position,options:u,selectedValue:n,selectedLabel:a,selectedLabelColor:l?"mu-fg":"fg",hasValue:n!=null,showClear:!s&&!t.noClear&&n!=null,showAddOption:!s&&!!t.addOption,addOptionLabel:t.addOption?.label?`+ ${t.addOption.label}`:"+ Add",addOptionBgc:e.hoveredAddOption?"ac":""}},Mp=({state:e})=>e,Wp=({state:e})=>e.selectedValue,zp=({state:e},t={})=>{let{position:r,selectedIndex:s}=t;e.position=r,e.isOpen=!0,s!=null&&(e.hoveredOptionId=s)},Up=({state:e})=>{e.isOpen=!1},Kp=({state:e},t={})=>{e.selectedValue=t.value,e.isOpen=!1},Hp=({state:e})=>{e.selectedValue=void 0},Gp=({state:e},t={})=>{e.hoveredOptionId=t.optionId},qp=({state:e})=>{e.hoveredOptionId=null},Jp=({state:e})=>{e.selectedValue=void 0},Yp=({state:e},t={})=>{e.hoveredAddOption=!!t.isHovered};var gi={refs:{selectButton:{eventListeners:{click:{handler:"handleButtonClick"}}},clearButton:{eventListeners:{click:{handler:"handleClearClick"}}},popover:{eventListeners:{close:{handler:"handleClickOptionsPopoverOverlay"}}},"option*":{eventListeners:{click:{handler:"handleOptionClick"},mouseenter:{handler:"handleOptionMouseEnter"},mouseleave:{handler:"handleOptionMouseLeave"}}},optionAdd:{eventListeners:{click:{handler:"handleAddOptionClick"},mouseenter:{handler:"handleAddOptionMouseEnter"},mouseleave:{handler:"handleAddOptionMouseLeave"}}}},template:{type:9,items:[{type:8,properties:[{key:'rtgl-button#selectButton v=ol ${containerAttrString} ?disabled=${isDisabled} data-testid="select-button"',value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c ah=s w=f",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text w=1fg ta=s c=${selectedLabelColor} ellipsis",value:{type:1,path:"selectedLabel"},parsedKey:{type:2,parts:["rtgl-text w=1fg ta=s c=",{type:1,path:"selectedLabelColor"}," ellipsis"]}}],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#clearButton ml=md svg=x wh=16 c=mu-fg cur=pointer data-testid="select-clear-button"',value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-svg ml=md 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#selectButton v=ol ",{type:1,path:"containerAttrString"}," ?disabled=",{type:1,path:"isDisabled"},' data-testid="select-button"']}}],fast:!1},{type:8,properties:[{key:"rtgl-popover#popover ?open=${isOpen} x=${position.x} y=${position.y} place=rs",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view wh=300 g=xs slot=content bgc=mu 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=pointer br=md bgc=${option.bgc} data-testid=${option.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text ta=s",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=pointer br=md bgc=",{type:1,path:"option.bgc"}," data-testid=",{type:1,path:"option.testId"}]}}],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 bwt=sm",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:'rtgl-view#optionAdd w=f ph=lg pv=md cur=pointer br=md bgc=${addOptionBgc} data-testid="select-add-option"',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#optionAdd w=f ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"addOptionBgc"},' data-testid="select-add-option"']}}],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"}," place=rs"]}}],fast:!1}],fast:!1}};var Ar={};R(Ar,{handleHeaderClick:()=>Xp,handleItemClick:()=>Zp});var Xp=(e,t)=>{let{store:r,dispatchEvent:s}=e,i=t._event,n,a=r.selectHeader();i.currentTarget.id==="headerLabel"?n=a.labelPath:i.currentTarget.id==="headerImage"?n=a.image.path:i.currentTarget.id==="header"&&(n=a.path),s(new CustomEvent("header-click",{detail:{path:n},bubbles:!0,composed:!0}))},Zp=(e,t)=>{let{store:r,dispatchEvent:s}=e,i=t._event,n=i.currentTarget.dataset.itemId||i.currentTarget.id.slice(4),a=r.selectItem(n);s(new CustomEvent("item-click",{detail:{item:a},bubbles:!0,composed:!0}))};var bi={componentName:"rtgl-sidebar",propsSchema:{type:"object",properties:{mode:{type:"string"},hideHeader:{type:"boolean",default:!1},w:{type:"string"},bwr:{type:"string"},selectedItemId:{type:"string"},header:{type:"object",properties:{label:{type:"string"},href:{type:"string"},testId:{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"},testId:{type:"string"}}}}}},events:{"header-click":{type:"object",properties:{path:{type:"string"}}},"item-click":{type:"object",properties:{item:{type:"object"}}}},methods:{type:"object",properties:{}}};var $r={};R($r,{createInitialState:()=>Qp,selectActiveItem:()=>ac,selectHeader:()=>nc,selectItem:()=>oc,selectViewData:()=>ic,setState:()=>lc});var Qp=()=>Object.freeze({}),ec=["id","class","style","slot","header","items","selectedItemId","mode","hideHeader","w","bwr"],tc=(e={})=>Object.entries(e).filter(([t])=>!ec.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ze=e=>{if(e!=null){if(typeof e=="object")return e;if(typeof e=="string")try{return JSON.parse(decodeURIComponent(e))}catch{try{return JSON.parse(e)}catch{return}}}},rc=e=>{if(e===!0)return!0;if(e===!1||e===void 0||e===null)return!1;if(typeof e=="string"){let t=e.trim().toLowerCase();return t===""||t==="true"}return!1},sc=(e,t)=>e!=null&&e!==""?e:t==="full"?272:64;function kr(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 a of s.items){let l=a.id||a.href||a.path,p=t===l;r.push({id:l,title:a.title,href:a.href,type:a.type||"item",icon:a.icon,hrefAttr:a.href?`href=${a.href}`:"",isSelected:p,itemBgc:p?"ac":"bg",itemHoverBgc:p?"ac":"mu"})}}return r}var ic=({props:e})=>{let t=Ze(e.header)||e.header,r=Ze(e.items)||e.items,s=e.selectedItemId,i=tc(e),n=e.mode||"full",a=t||{label:"",path:"",image:{src:"",alt:"",width:0,height:0}},l=r?kr(r,s):[],p=!rc(e.hideHeader),o=e.bwr||"xs",u=sc(e.w,n),c=n==="full"?"fs":"c",d=n==="full"?"fs":"c",h=n==="full"?"lg":"sm",f=n==="full"?"md":"sm",m=n==="shrunk-lg"?48:40,g=n==="shrunk-lg"?28:20,y=n==="shrunk-lg"?"md":"sm",w=n==="full",_=n==="full",x=n==="full"?"fs":"c",E=n==="full"?"":`ah=${d}`,A=n==="full"?"f":m;return{containerAttrString:i,mode:n,header:a,items:l,sidebarWidth:u,headerAlign:c,itemAlign:d,headerPadding:h,itemPadding:f,itemHeight:m,iconSize:g,firstLetterSize:y,showLabels:w,showGroupLabels:_,itemContentAlign:x,itemAlignAttr:E,itemWidth:A,headerWidth:A,selectedItemId:s,ah:n==="shrunk-lg"||n==="shrunk-md"?"c":"",showHeader:p,rightBorderWidth:o}},nc=({props:e})=>Ze(e.header)||e.header,ac=({state:e,props:t})=>{let r=Ze(t.items)||t.items;return(r?kr(r):[]).find(i=>i.active)},oc=({props:e},t)=>{let r=Ze(e.items)||e.items;return(r?kr(r):[]).find(i=>i.id===t)},lc=({state:e})=>{};var vi={refs:{headerImage:{eventListeners:{click:{handler:"handleHeaderClick"}}},headerLabel:{eventListeners:{click:{handler:"handleHeaderClick"}}},header:{eventListeners:{click:{handler:"handleHeaderClick"}}},"item*":{eventListeners:{click:{handler:"handleItemClick"}}}},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#headerImage cur=pointer":[{'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#headerLabel cur=pointer":[{"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} d=v bwr=${rightBorderWidth} ah=${ah} ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"$if showHeader",value:{type:6,conditions:[{type:1,path:"showHeader"}],bodies:[{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#headerImage cur=pointer",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#headerLabel cur=pointer",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=pointer data-testid=${header.testId}",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#headerImage cur=pointer",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#headerLabel cur=pointer",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=pointer data-testid=",{type:1,path:"header.testId"}]}}],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}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-view w=f h=1fg sv 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",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${i} data-item-id=${item.id} ${item.hrefAttr} h=${itemHeight} av=c ${itemAlignAttr} ph=${itemPadding} w=${itemWidth} h-bgc=${item.itemHoverBgc} br=lg bgc=${item.itemBgc} cur=pointer data-testid=${item.testId}",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:"i"}," data-item-id=",{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=pointer data-testid=",{type:1,path:"item.testId"}]}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view w=f h=1fg sv 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"}," d=v bwr=",{type:1,path:"rightBorderWidth"}," ah=",{type:1,path:"ah"}," ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var Sr={};R(Sr,{handleBeforeMount:()=>pc,handleOnUpdate:()=>cc,handleValueChange:()=>uc,handleValueInput:()=>dc});var pc=e=>{let{store:t,props:r}=e;t.setValue({value:r.value??0})},cc=(e,t)=>{let{oldProps:r,newProps:s}=t,{store:i,render:n}=e,a=r?.key!==s?.key,l=r?.value!==s?.value;if(a||l){let p=s?.value??0;i.setValue({value:p}),n()}},uc=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,n=t._event,a=Number(n.detail.value),p=(typeof n.composedPath=="function"?n.composedPath():[]).find(o=>o?.tagName==="RTGL-SLIDER-INPUT")||n.currentTarget?.getRootNode?.()?.host;r.setValue({value:a}),p&&typeof p.setAttribute=="function"&&p.setAttribute("value",String(a)),s(),i(new CustomEvent("value-change",{detail:{value:a},bubbles:!0}))},dc=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,n=t._event,a=Number(n.detail.value),p=(typeof n.composedPath=="function"?n.composedPath():[]).find(o=>o?.tagName==="RTGL-SLIDER-INPUT")||n.currentTarget?.getRootNode?.()?.host;r.setValue({value:a}),p&&typeof p.setAttribute=="function"&&p.setAttribute("value",String(a)),s(),i(new CustomEvent("value-input",{detail:{value:a},bubbles:!0}))};var wi={componentName:"rtgl-slider-input",propsSchema:{type:"object",properties:{key:{type:"string"},value:{type:"string",default:"0"},w:{type:"string",default:""},min:{type:"string",default:"0"},max:{type:"string",default:"100"},step:{type:"string",default:"1"},disabled:{type:"boolean",default:!1}}},events:{"value-input":{},"value-change":{}},methods:{type:"object",properties:{}}};var Cr={};R(Cr,{createInitialState:()=>fc,selectViewData:()=>hc,setValue:()=>mc});var fc=()=>Object.freeze({value:0}),hc=({state:e,props:t})=>({key:t.key,value:e.value,w:t.w||"",min:t.min||0,max:t.max||100,step:t.step||1,disabled:!!t.disabled}),mc=({state:e},t={})=>{e.value=t.value};var _i={refs:{input:{eventListeners:{"value-input":{handler:"handleValueInput"},"value-change":{handler:"handleValueChange"}}},slider:{eventListeners:{"value-change":{handler:"handleValueChange"},"value-input":{handler:"handleValueInput"}}}},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} ?disabled=${disabled}",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"}," ?disabled=",{type:1,path:"disabled"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=84",value:{type:9,items:[{type:8,properties:[{key:"rtgl-input-number#input key=${key} w=f min=${min} max=${max} step=${step} value=${value} ?disabled=${disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input-number#input key=",{type:1,path:"key"}," w=f min=",{type:1,path:"min"}," max=",{type:1,path:"max"}," step=",{type:1,path:"step"}," value=",{type:1,path:"value"}," ?disabled=",{type:1,path:"disabled"}]}}],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 Ir={};R(Ir,{handleBeforeMount:()=>yc,handleHeaderClick:()=>bc,handleRowClick:()=>gc});var yc=e=>{},gc=(e,t)=>{let{dispatchEvent:r,props:s}=e,i=t._event,n=parseInt(i.currentTarget.id.slice(3),10),a=s.data?.rows?.[n];a&&r(new CustomEvent("row-click",{detail:{rowIndex:n,rowData:a}}))},bc=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,a=t._event.currentTarget.dataset.columnKey,l=r.selectSortInfo(),p="asc";l.column===a&&(l.direction==="asc"?p="desc":l.direction==="desc"&&(p=null)),p?r.setSortColumn({column:a,direction:p}):r.clearSort(),s(),i(new CustomEvent("header-click",{detail:{column:a,direction:p,sortInfo:p?{column:a,direction:p}:null}}))};var xi={componentName:"rtgl-table",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}}},events:{},methods:{type:"object",properties:{}}};var Or={};R(Or,{clearSort:()=>Sc,createInitialState:()=>vc,selectSortInfo:()=>kc,selectState:()=>Ac,selectViewData:()=>Ec,setSortColumn:()=>$c});var vc=()=>Object.freeze({sortColumn:null,sortDirection:null}),wc=["id","class","style","slot","data"],_c=(e={})=>Object.entries(e).filter(([t])=>!wc.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),xc=(e,t)=>{let r=t.split("."),s=e;for(let i of r){if(s==null)return null;s=s[i]}return s},Ec=({state:e,props:t})=>{let r=_c(t),s=t.data||{columns:[],rows:[]},i=s.rows.map((n,a)=>{let l=s.columns.map(p=>{let o=xc(n,p.key);return{key:p.key,value:o!=null?String(o):""}});return{index:a,cells:l}});return{containerAttrString:r,columns:s.columns||[],rows:i||[]}},Ac=({state:e})=>e,kc=({state:e})=>({column:e.sortColumn,direction:e.sortDirection}),$c=({state:e},{column:t,direction:r}={})=>{e.sortColumn=t,e.sortDirection=r},Sc=({state:e})=>{e.sortColumn=null,e.sortDirection=null};var Ei={refs:{"row*":{eventListeners:{click:{handler:"handleRowClick"}}},"header*":{eventListeners:{click:{handler:"handleHeaderClick"}}}},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${i} data-column-key=${column.key}",value:{type:1,path:"column.label"},parsedKey:{type:2,parts:["th#header",{type:1,path:"i"}," data-column-key=",{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${rowIndex}",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:"rowIndex"}]}}],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 Tr={};R(Tr,{handleClickItem:()=>Cc});var Cc=(e,t)=>{let{dispatchEvent:r}=e,i=t._event.currentTarget.dataset.id;r(new CustomEvent("item-click",{detail:{id:i}}))};var Ai={componentName:"rtgl-tabs",propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"},testId:{type:"string"}}}},selectedTab:{type:"string"}}},events:{"item-click":{type:"object",properties:{id:{type:"string"}}}},methods:{type:"object",properties:{}}};var Lr={};R(Lr,{createInitialState:()=>Ic,selectViewData:()=>Lc});var Ic=()=>Object.freeze({}),Oc=["id","class","style","slot","items","selectedTab"],Tc=(e={})=>Object.entries(e).filter(([t])=>!Oc.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Lc=({props:e})=>{let t=Tc(e),r=e.items||[],s=e.selectedTab,i=r.map(n=>({...n,isSelected:n.id===s,bgColor:n.id===s?"ac":"",borderColor:n.id===s?"":"tr",textColor:n.id===s?"":"mu-fg"}));return{containerAttrString:t,items:i,selectedTab:s}};var ki={refs:{"tab*":{eventListeners:{click:{handler:"handleClickItem"}}}},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:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view#tab${i} data-id=${item.id} cur=pointer bgc=${item.bgColor} bw=xs bc=${item.borderColor} pv=md ph=lg br=lg data-testid=${item.testId}",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:"i"}," data-id=",{type:1,path:"item.id"}," cur=pointer bgc=",{type:1,path:"item.bgColor"}," bw=xs bc=",{type:1,path:"item.borderColor"}," pv=md ph=lg br=lg data-testid=",{type:1,path:"item.testId"}]}}],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 $i={};var Si={componentName:"rtgl-tooltip",propsSchema:{type:"object",properties:{open:{type:"boolean"},x:{type:"string"},y:{type:"string"},place:{type:"string"},content:{type:"string"}}},events:[],methods:{type:"object",properties:{}}};var Rr={};R(Rr,{createInitialState:()=>Rc,selectViewData:()=>Nc});var Rc=()=>Object.freeze({}),Nc=({props:e})=>({open:!!e.open,x:e.x||0,y:e.y||0,place:e.place||"t",content:e.content||""});var Ci={template:{type:9,items:[{type:8,properties:[{key:"rtgl-popover#popover ?open=${open} x=${x} y=${y} place=${place} no-overlay",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view slot=content bgc=bg bc=bo br=md p=sm ah=c av=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text ta=c s=sm c=fg",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"}," place=",{type:1,path:"place"}," no-overlay"]}}],fast:!0}],fast:!0},refs:{}};var Nr={};R(Nr,{handleAfterMount:()=>Vc,handleOnUpdate:()=>Pc});var Vc=async e=>{let{props:t,store:r,render:s,refs:i}=e,{waveformData:n}=t;r.setWaveformData({data:n}),s();let a=i.canvas;a&&Ii(n,a)},Pc=async(e,t)=>{let{store:r,render:s,refs:i,props:n}=e,{waveformData:a}=n;if(!a){console.log("waveform handleOnUpdate: no waveformData provided");return}r.setWaveformData({data:a}),s();let l=i.canvas;l&&Ii(a,l)};async function Ii(e,t){let r=t.getContext("2d"),s=t.getBoundingClientRect(),i=s.width,n=s.height;t.width=i,t.height=n;let a=t.width,l=t.height;if(r.clearRect(0,0,a,l),r.fillStyle="#1a1a1a",r.fillRect(0,0,a,l),!e||!e.amplitudes)return;let p=e.amplitudes,o=l/2,u=r.createLinearGradient(0,0,0,l);u.addColorStop(0,"#404040"),u.addColorStop(.5,"#A1A1A1"),u.addColorStop(1,"#404040");let c=Math.max(1,a/p.length),d=.2;for(let h=0;h<p.length;h++){let m=p[h]/255*(l*.85),g=h*c,y=o-m/2;r.fillStyle=u,r.fillRect(g,y,Math.max(1,c*(1-d)),m)}r.strokeStyle="rgba(255, 255, 255, 0.1)",r.lineWidth=1,r.beginPath(),r.moveTo(0,o),r.lineTo(a,o),r.stroke(),r.shadowBlur=10,r.shadowColor="#2196F3"}var Oi={componentName:"rtgl-waveform",propsSchema:{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"},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"}}},events:[],methods:{type:"object",properties:{}}};var Vr={};R(Vr,{createInitialState:()=>Dc,selectViewData:()=>jc,setWaveformData:()=>Bc});var Dc=()=>Object.freeze({waveformData:null}),Bc=({state:e},t={})=>{e.waveformData=t.data},jc=({state:e,props:t})=>({isLoading:t.isLoading,w:t.w||"250",h:t.h||"150",cur:t.cur,waveformData:t.waveformData});var Ti={refs:{canvas:{selector:"canvas"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view 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 pos=rel w=",{type:1,path:"w"}," h=",{type:1,path:"h"}," cur=",{type:1,path:"cur"}]}}],fast:!1}],fast:!1}};var Pr=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),dt=e=>e.replace(/-([a-z0-9])/g,(t,r)=>r.toUpperCase()),ut=e=>{if(e!=null)return e===""?!0:e},Li=(e,t)=>{let r=e.getAttribute(t);if(r!==null)return ut(r);let s=Pr(t);if(s!==t){let i=e.getAttribute(s);if(i!==null)return ut(i)}},Ri=(e,t)=>{let r=new Set(t);return new Proxy({},{get(s,i){if(typeof i=="string"&&r.has(i)){let n=e[i];return n!==void 0?n:Li(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:()=>{let n=e[i];return n!==void 0?n:Li(e,i)}}}})};var Ni=({schema:e,methodExports:t=[]})=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("componentName is required.");if(typeof e.componentName!="string"||e.componentName.trim()==="")throw new Error("componentName is required.");if(Object.prototype.hasOwnProperty.call(e,"attrsSchema"))throw new Error("attrsSchema is not supported.");if(Object.prototype.hasOwnProperty.call(e,"methods")){let r=e.methods;if(!r||typeof r!="object"||Array.isArray(r))throw new Error("methods must be an object schema with a properties map.");if(Object.prototype.hasOwnProperty.call(r,"type")&&r.type!=="object")throw new Error("methods.type must be 'object'.");if(!r.properties||typeof r.properties!="object"||Array.isArray(r.properties))throw new Error("methods.properties must be an object keyed by method name.");for(let s of Object.keys(r.properties))if(!t.includes(s))throw new Error(`method '${s}' is declared in schema but missing in .methods.js exports.`)}return!0};var b={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},D={EQ:0,NEQ:1,GT:2,LT:3,GTE:4,LTE:5,AND:6,OR:7,IN:8,ADD:10,SUBTRACT:11},Qe={NOT:0};var T=class extends Error{constructor(t){super(`Parse Error: ${t}`),this.name="JemplParseError"}},se=class extends Error{constructor(t){super(`Render Error: ${t}`),this.name="JemplRenderError"}};var Dr=e=>{if(!e||e.trim()==="")throw new T("Missing condition expression after '$if'");if(e.includes("===")||e.includes("!==")){let r=e.includes("===")?"==":"!=";throw new T(`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 T(`Incomplete comparison expression - missing right operand (got: '${e}')`)},Vi=e=>{if(e.trim().endsWith(" in"))throw new T(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(!e.includes(" in "))throw new T(`Invalid loop syntax - missing 'in' keyword (got: '$for ${e}')`);let[t,r]=e.split(" in ");if(!r||r.trim()==="")throw new T(`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 T(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`)}else if(!t.trim())throw new T(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`)};var Pi=(e,t,r=!1)=>{if(t===null)return new se(`Cannot iterate over null value at '$for ${e}'`);if(t===void 0)return new se(`Cannot iterate over undefined value at '$for ${e}'`);let s=typeof t;return r?new se(`Cannot iterate over non-array value in loop '${e}' - got ${s} instead`):new se(`Cannot iterate over non-array value (got: ${s}) at '$for ${e}'`)},Di=(e,t)=>{let r=t&&Object.keys(t).length>0?Object.keys(t).join(", "):"no custom functions provided";return new se(`Unknown function '${e}' (${r})`)};var Fc=(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 a=I(e,{functions:s,partials:i},t,{});return a===void 0?{}:a},I=(e,t,r,s)=>{let i=t.functions||t;if(e.var&&!e.type)return z(e.var,r,s);if(e.type===b.LITERAL)return e.value;if(e.type===b.VARIABLE)return z(e.path,r,s);if(e.type===b.INTERPOLATION)return Wc(e.parts,t,r,s);switch(e.type){case b.FUNCTION:return ji(e,t,r,s);case b.BINARY:return Fi(e,t,r,s);case b.UNARY:return Mi(e,t,r,s);case b.CONDITIONAL:return Uc(e,t,r,s);case b.LOOP:return Jc(e,t,r,s);case b.OBJECT:return Xc(e,t,r,s);case b.ARRAY:return Zc(e,t,r,s);case b.PARTIAL:return Qc(e,t,r,s);case b.PATH_REFERENCE:return eu(e,t,r,s);default:throw new Error(`Unknown node type: ${e.type}`)}},Bi=new Map,Mc=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 a=r.trim();if(/^\d+$/.test(a))t.push({type:"index",value:parseInt(a,10)});else if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'")){let l=a.slice(1,-1);t.push({type:"property",value:l})}else t.push({type:"property",value:a});r=""}s=!1}else r+=n}return r&&t.push({type:"property",value:r}),t},z=(e,t,r)=>{if(!e)return;if(e in r)return r[e];let s=Bi.get(e);if(!s){let n=[],a="",l=0;for(let p=0;p<e.length;p++){let o=e[p];o==="["?(l++,a+=o):o==="]"?(l--,a+=o):o==="."&&l===0?a&&(n.push(a),a=""):a+=o}a&&n.push(a),s=[];for(let p of n){let o=Mc(p.trim());s.push(...o)}Bi.set(e,s)}let i=t;for(let n=0;n<s.length;n++){let a=s[n];if(a.type==="property"&&a.value in r){i=r[a.value];continue}if(i==null)return;(a.type==="property"||a.type==="index")&&(i=i[a.value])}return i},Wc=(e,t,r,s)=>{let i=[];for(let n of e)if(typeof n=="string")i.push(n);else{let a=I(n,t,r,s);i.push(a!=null?String(a):"")}return i.join("")},ji=(e,t,r,s)=>{let i=t.functions||t,n=i[e.name];if(!n)throw Di(e.name,i);let a=e.args.map(l=>I(l,t,r,s));return n(...a)},Ne=(e,t,r,s)=>{if(e.var&&!e.type)return z(e.var,r,s);switch(e.type){case b.VARIABLE:return z(e.path,r,s);case b.LITERAL:return e.value;case b.BINARY:return Fi(e,t,r,s);case b.UNARY:return Mi(e,t,r,s);case b.FUNCTION:return ji(e,t,r,s);default:return I(e,t,r,s)}},Fi=(e,t,r,s)=>{if(e.op===D.AND||e.op===D.OR){let a=Ne(e.left,t,r,s),l=Ne(e.right,t,r,s);switch(e.op){case D.AND:return a&&l;case D.OR:return a||l}}let i=I(e.left,t,r,s),n=I(e.right,t,r,s);switch(e.op){case D.EQ:return i==n;case D.NEQ:return i!=n;case D.GT:return i>n;case D.LT:return i<n;case D.GTE:return i>=n;case D.LTE:return i<=n;case D.IN:return Array.isArray(n)?n.includes(i):!1;case D.ADD:if(typeof i!="number"||typeof n!="number")throw new se(`Arithmetic operations require numbers. Got ${typeof i} + ${typeof n}`);return i+n;case D.SUBTRACT:if(typeof i!="number"||typeof n!="number")throw new se(`Arithmetic operations require numbers. Got ${typeof i} - ${typeof n}`);return i-n;default:throw new Error(`Unknown binary operator: ${e.op}`)}},Mi=(e,t,r,s)=>{let i=e.op===Qe.NOT?Ne(e.operand,t,r,s):I(e.operand,t,r,s);switch(e.op){case Qe.NOT:return!i;default:throw new Error(`Unknown unary operator: ${e.op}`)}},zc=(e,t,r,s)=>{if(e.conditions.length===2&&e.conditions[1]===null){let i=e.conditions[0];if(i.type===b.VARIABLE)if(z(i.path,r,s)){let a=e.bodies[0];if(a.type===b.OBJECT&&a.properties.length<=5){let l={};for(let p of a.properties){let o=p.parsedKey?I(p.parsedKey,t,r,s):p.key,u=p.value;if(u.type===b.LITERAL)l[o]=u.value;else if(u.type===b.VARIABLE)l[o]=z(u.path,r,s);else if(u.type===b.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===b.VARIABLE){let h=z(d.path,r,s);c.push(h!=null?String(h):"")}else{let h=I(d,t,r,s);c.push(h!=null?String(h):"")}l[o]=c.join("")}else l[o]=I(u,t,r,s)}return l}}else{let a=e.bodies[1];if(a.type===b.OBJECT&&a.properties.length<=5){let l={};for(let p of a.properties){let o=p.parsedKey?I(p.parsedKey,t,r,s):p.key,u=p.value;if(u.type===b.LITERAL)l[o]=u.value;else if(u.type===b.VARIABLE)l[o]=z(u.path,r,s);else if(u.type===b.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===b.VARIABLE){let h=z(d.path,r,s);c.push(h!=null?String(h):"")}else{let h=I(d,t,r,s);c.push(h!=null?String(h):"")}l[o]=c.join("")}else l[o]=I(u,t,r,s)}return l}}}return null},Uc=(e,t,r,s)=>{let i=zc(e,t,r,s);if(i!==null)return i;for(let n=0;n<e.conditions.length;n++){let a=e.conditions[n];if(a===null||Ne(a,t,r,s))return I(e.bodies[n],t,r,s)}return Wi},Kc=(e,t)=>{let r=e.body,s=e.itemVar;if(r.type===b.CONDITIONAL&&r.conditions.length===1&&r.conditions[0].type===b.VARIABLE){let i=r.conditions[0].path,n=r.bodies[0];if(i.startsWith(s+".")){let a=i.substring(s.length+1);if(n.type===b.OBJECT&&n.properties.length<=5){for(let p of n.properties)if(p.parsedKey)return null;let l=[];for(let p=0;p<t.length;p++){let o=t[p];if(o[a]){let u={};for(let c of n.properties){let d=c.key,h=c.value;if(h.type===b.LITERAL)u[d]=h.value;else if(h.type===b.VARIABLE){let f=h.path;if(f===s)u[d]=o;else if(f.startsWith(s+".")){let m=f.substring(s.length+1);u[d]=o[m]}else return null}else if(h.type===b.INTERPOLATION){let f=[],m=!0;for(let g of h.parts)if(typeof g=="string")f.push(g);else if(g.type===b.VARIABLE){let y=g.path;if(y===s)f.push(o!=null?String(o):"");else if(y.startsWith(s+".")){let w=y.substring(s.length+1),_=o[w];f.push(_!=null?String(_):"")}else{m=!1;break}}else{m=!1;break}if(!m)return null;u[d]=f.join("")}else return null}l.push(u)}}return l}}}return null},Hc=(e,t)=>{let r=e.body,s=e.itemVar,i=Kc(e,t);if(i!==null)return i;if(r.type===b.OBJECT&&r.properties.length<=5){for(let l of r.properties)if(l.parsedKey)return null;let n=[],a=!0;for(let l of r.properties){let p=l.key,o=l.value;if(o.type===b.LITERAL)n.push({key:p,type:"literal",value:o.value});else if(o.type===b.VARIABLE){let u=o.path;if(u===s)n.push({key:p,type:"item"});else if(u.startsWith(s+".")){let c=u.substring(s.length+1);if(!c.includes(".")&&!c.includes("["))n.push({key:p,type:"prop",prop:c});else{a=!1;break}}else{a=!1;break}}else if(o.type===b.INTERPOLATION&&o.parts.length===1){let u=o.parts[0];if(u.type===b.VARIABLE){let c=u.path;if(c===s)n.push({key:p,type:"item_string"});else if(c.startsWith(s+".")){let d=c.substring(s.length+1);if(!d.includes(".")&&!d.includes("["))n.push({key:p,type:"prop_string",prop:d});else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}if(a){let l=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 p=0;p<t.length;p++){let o=t[p];l[p]={id:o.id,title:o.title!=null?String(o.title):"",completed:o.completed}}else for(let p=0;p<t.length;p++){let o=t[p],u={};for(let c of n)if(c.type==="literal")u[c.key]=c.value;else if(c.type==="item")u[c.key]=o;else if(c.type==="prop")u[c.key]=o[c.prop];else if(c.type==="item_string")u[c.key]=o!=null?String(o):"";else if(c.type==="prop_string"){let d=o[c.prop];u[c.key]=d!=null?String(d):""}l[p]=u}return l}}return null},Gc=(e,t,r,s,i)=>{let n=[],a=e.body;if(a.type===b.OBJECT&&a.fast!==!1){let l=e.itemVar,p=e.indexVar;for(let o=0;o<i.length;o++){let u=i[o],c={},d={...s,[l]:u,...p&&{[p]:o}};d.__paths__||(d.__paths__=s.__paths__||{});let h=e.iterable.path||"";if(s&&s.__paths__&&h){let f=h.split("."),m=f[0];m in s.__paths__&&(h=s.__paths__[m],f.length>1&&(h+="."+f.slice(1).join(".")))}d.__paths__={...d.__paths__,[l]:`${h}[${o}]`,...p&&{[p]:o}};for(let f of a.properties){let m=f.parsedKey?I(f.parsedKey,t,r,d):f.key,g=f.value;if(g.type===b.LITERAL)c[m]=g.value;else if(g.type===b.VARIABLE){let y=g.path;if(y===l)c[m]=u;else if(y===p)c[m]=o;else if(y.startsWith(l+".")){let w=y.substring(l.length+1);!w.includes(".")&&!w.includes("[")?c[m]=u[w]:c[m]=z(y,r,{...s,[l]:u,...p&&{[p]:o}})}else c[m]=z(y,r,{...s,[l]:u,...p&&{[p]:o}})}else if(g.type===b.INTERPOLATION){let y=[];for(let w of g.parts)if(typeof w=="string")y.push(w);else if(w.type===b.VARIABLE){let _=w.path,x;if(_===l)x=u;else if(_===p)x=o;else if(_.startsWith(l+".")){let E=_.substring(l.length+1);!E.includes(".")&&!E.includes("[")?x=u[E]:x=z(_,r,{...s,[l]:u,...p&&{[p]:o}})}else x=z(_,r,{...s,[l]:u,...p&&{[p]:o}});y.push(x!=null?String(x):"")}else{let _={...s,[l]:u,...p&&{[p]:o}},x=I(w,t,r,_);y.push(x!=null?String(x):"")}c[m]=y.join("")}else{let y={...s,[l]:u,...p&&{[p]:o}};c[m]=I(g,t,r,y)}}n.push(c)}return n}return null},qc=(e,t,r)=>{let s=e.body;if(s.type===b.OBJECT&&s.properties.length===1&&s.properties[0].key==="$if item.visible"){let n=s.properties[0].value;if(n.type===b.CONDITIONAL&&n.conditions.length===1&&n.conditions[0].type===b.VARIABLE&&n.conditions[0].path==="item.visible"){let a=n.bodies[0];if(a.type===b.OBJECT&&a.properties.length===2){let l=a.properties[0],p=a.properties[1];if(l.key==="id"&&l.value.type===b.VARIABLE&&l.value.path==="item.id"&&p.key==="$if item.highlighted"&&p.value.type===b.CONDITIONAL){let o=[];for(let u=0;u<t.length;u++){let c=t[u];if(c.visible){let d={id:c.id};c.highlighted?(d.highlight=!0,d.message=`This item is highlighted: ${c.name}`):(d.highlight=!1,d.message=c.name),o.push(d)}}return o}}}}return null},Jc=(e,t,r,s)=>{let i=I(e.iterable,t,r,s);if(!Array.isArray(i)){let o,u=!1;if(e.iterable.type===b.FUNCTION){u=!0;let d=e.iterable.args.map(h=>h.type===b.LITERAL?typeof h.value=="string"?`'${h.value}'`:String(h.value):h.type===b.VARIABLE?h.path:h.type===b.FUNCTION?`${h.name}(...)`:"?").join(", ");o=`${e.iterable.name}(${d})`}else o=e.iterable.path||"undefined";let c=`${e.itemVar}${e.indexVar?`, ${e.indexVar}`:""} in ${o}`;throw Pi(c,i,u)}if(!e.indexVar){let o=qc(e,i,e.itemVar);if(o!==null)return o}if(!e.indexVar){let o=Hc(e,i);if(o!==null)return o}let n=Gc(e,t,r,s,i);if(n!==null)return n;let a=[],l=e.iterable.path||"";if(s&&s.__paths__&&l){let o=l.split("."),u=o[0];u in s.__paths__&&(l=s.__paths__[u],o.length>1&&(l+="."+o.slice(1).join(".")))}let p=!1;e.body.type===b.ARRAY&&(e.body.items.length<=1?p=!1:p=e.body._shouldPreserveArray??=e.body.items.some(o=>o.type===b.OBJECT&&o.properties.some(u=>u.key.startsWith("$if ")||u.key.startsWith("$when "))));for(let o=0;o<i.length;o++){let u=e.indexVar?{...s,[e.itemVar]:i[o],[e.indexVar]:o}:{...s,[e.itemVar]:i[o]};u.__paths__||(u.__paths__=s.__paths__||{}),u.__paths__={...u.__paths__,[e.itemVar]:`${l}[${o}]`},e.indexVar&&(u.__paths__[e.indexVar]=o);let c=I(e.body,t,r,u);Array.isArray(c)&&c.length===1&&!p?a.push(c[0]):a.push(c)}return a},Yc=(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,a=i.value;if(a.type===b.OBJECT&&a.properties.length<=10&&!a.whenCondition){let l={},p={},o=!0;for(let u of a.properties){let c=u.parsedKey?I(u.parsedKey,t,r,s):u.key,d=u.value;if(d.type===b.LITERAL)p[c]=d.value;else if(d.type===b.VARIABLE)p[c]=z(d.path,r,s);else if(d.type===b.INTERPOLATION){let h=[];for(let f of d.parts)if(typeof f=="string")h.push(f);else if(f.type===b.VARIABLE){let m=z(f.path,r,s);h.push(m!=null?String(m):"")}else{o=!1;break}if(!o)break;p[c]=h.join("")}else if(d.type===b.OBJECT&&d.properties.length<=5){let h={};for(let f of d.properties){let m=f.key,g=f.value;if(g.type===b.LITERAL)h[m]=g.value;else if(g.type===b.VARIABLE)h[m]=z(g.path,r,s);else if(g.type===b.INTERPOLATION){let y=[];for(let w of g.parts)if(typeof w=="string")y.push(w);else if(w.type===b.VARIABLE){let _=z(w.path,r,s);y.push(_!=null?String(_):"")}else{o=!1;break}if(!o)break;h[m]=y.join("")}else{o=!1;break}}if(!o)break;p[c]=h}else{o=!1;break}}if(o)return l[n]=p,l}}return null},Xc=(e,t,r,s)=>{let i=t.functions||t;if(e.whenCondition&&!Ne(e.whenCondition,i,r,s))return;let n=Yc(e,t,r,s);if(n!==null)return n;if(e.fast){let o={};for(let u of e.properties){let c=u.parsedKey?I(u.parsedKey,t,r,s):u.key,d=u.value;if(d.type===b.LITERAL)o[c]=d.value;else if(d.type===b.VARIABLE)o[c]=z(d.path,r,s);else if(d.type===b.INTERPOLATION){let h=[];for(let f of d.parts)if(typeof f=="string")h.push(f);else if(f.type===b.VARIABLE){let m=z(f.path,r,s);h.push(m!=null?String(m):"")}else{let m=I(f,t,r,s);h.push(m!=null?String(m):"")}o[c]=h.join("")}else o[c]=I(d,t,r,s)}return o}let a={},l=null,p=!1;for(let o of e.properties)if(!o.key.startsWith("$if ")&&!o.key.match(/^\$if\s+\w+.*:?$/)&&!o.key.startsWith("$elif")&&!o.key.startsWith("$else")&&!o.key.startsWith("$for ")){p=!0;break}for(let o of e.properties)if(o.key.startsWith("$if ")||o.key.match(/^\$if\s+\w+.*:?$/)){let u=I(o.value,t,r,s);if(!p&&u!==null&&u!==void 0)return Array.isArray(u)&&u.length===1?u[0]:u;typeof u=="object"&&u!==null&&!Array.isArray(u)&&Object.assign(a,u)}else if(o.key.startsWith("$for ")){if(e.properties.length===1)return I(o.value,t,r,s)}else{let u=o.value;if(u&&u.type===b.OBJECT&&u.properties){let c=u.properties.find(d=>d.key.startsWith("$for "));if(c){let d=I(c.value,t,r,s);d!==void 0&&(a[o.key]=d)}else{let d=I(o.value,t,r,s);d!==void 0&&(a[o.key]=d)}}else{let c=o.parsedKey?I(o.parsedKey,t,r,s):o.key,d=I(o.value,t,r,s);d!==void 0&&(a[c]=d)}}return a},Wi={},Zc=(e,t,r,s)=>{let i=[];for(let n of e.items)if(n.type===b.LOOP){let a=I(n,t,r,s);i.push(a)}else{let a=I(n,t,r,s);a!==Wi&&a!==void 0&&i.push(a)}return i},Qc=(e,t,r,s)=>{let{name:i,data:n,whenCondition:a}=e,l=t.partials||{},p=t.functions||t;if(a&&!Ne(a,p,r,s))return;if(!l[i])throw new se(`Partial '${i}' is not defined`);let o=s._partialStack||[];if(o.includes(i))throw new se(`Circular partial reference detected: ${i}`);let u=l[i],c=r,d={...s,_partialStack:[...o,i]};if(s){c={...r};for(let h of Object.keys(s))h.startsWith("_")||(c[h]=s[h])}if(n){let h=I(n,t,r,s);c={...c,...h}}return I(u,t,c,d)},eu=(e,t,r,s)=>{let{path:i}=e,n=i.split("."),a=n[0],l=n.slice(1);if(!s||!(a in s))throw new se(`Path reference '#{${i}}' refers to '${a}' which is not a loop variable in the current scope`);if(s.__paths__||(s.__paths__={}),!(a in s.__paths__))throw new se(`Path reference '#{${i}}' cannot be resolved - path tracking may not be initialized properly`);let p=s.__paths__[a];if(typeof p=="number"){if(l.length>0)throw new se(`Path reference '#{${i}}' - cannot access properties on index variable '${a}'`);return String(p)}return l.length>0&&(p+="."+l.join(".")),p},et=Fc;var tu=/\$\{([^}]*)\}/g,ru=/#\{([^}]*)\}/g,Ui=(e,t={})=>{let r=e.match(/^(\w+)\((.*)\)$/);if(!r)return{isFunction:!1};let[,s,i]=r,n=su(i,t);return{isFunction:!0,type:b.FUNCTION,name:s,args:n}},su=(e,t={})=>e.trim()?iu(e).map(s=>nu(s.trim(),t)):[],iu=e=>{let t=[],r="",s=0,i=!1,n="";for(let a=0;a<e.length;a++){let l=e[a],p=a>0?e[a-1]:"";!i&&(l==='"'||l==="'")?(i=!0,n=l,r+=l):i&&l===n&&p!=="\\"?(i=!1,n="",r+=l):!i&&l==="("?(s++,r+=l):!i&&l===")"?(s--,r+=l):!i&&l===","&&s===0?(t.push(r),r=""):r+=l}return r&&t.push(r),t},nu=(e,t={})=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:b.LITERAL,value:e.slice(1,-1)};if(/^-?\d+(\.\d+)?$/.test(e))return{type:b.LITERAL,value:parseFloat(e)};if(e==="true")return{type:b.LITERAL,value:!0};if(e==="false")return{type:b.LITERAL,value:!1};if(e==="null")return{type:b.LITERAL,value:null};let r=Ui(e,t);if(r.isFunction)return{type:r.type,name:r.name,args:r.args};let s=e.trim(),i=[{op:" + ",type:"ADD"},{op:" - ",type:"SUBTRACT"}],n=-1,a=null;for(let{op:l,type:p}of i){let o=0;for(;o<s.length;){let u=ke(s.substring(o),l);if(u===-1)break;let c=o+u;c>n&&(n=c,a={op:l,type:p}),o=c+l.length}}if(n!==-1)try{return ee(s,t)}catch{return{type:b.VARIABLE,path:s}}return{type:b.VARIABLE,path:s}},Ki=/^\w+\(.*\)$/,au=/\s[+\-*/%]\s|\|\||&&|\?\?|.*\?.*:/,ou=e=>{if(!(!e||e.trim()===""||Ki.test(e))&&au.test(e))throw e.includes("?")&&e.includes(":")?new T(`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 T(`Logical operators not supported in variable replacements - consider calculating the value in your data instead (operators like ||, &&, ?? are not supported). Offending expression: "${e}"`):new T(`Arithmetic expressions not supported in variable replacements - consider calculating '${e}' in your data instead (expressions with +, -, *, /, % are not supported). Offending expression: "${e}"`)},zi=e=>{let t=e.trim();if(Ki.test(t))throw new T(`Functions are not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(t.includes("["))throw new T(`Array indices not supported in path references - use simple variable names or properties. Offending expression: "#{${e}}"`);if(/[+\-*/%]/.test(t))throw new T(`Arithmetic expressions not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(/\|\||&&/.test(t))throw new T(`Logical operators not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(t.includes("?")&&t.includes(":"))throw new T(`Complex expressions not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);return{type:b.PATH_REFERENCE,path:t}},tt=(e,t={})=>{let r=e.trim();ou(r);let s=Ui(r,t);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:b.VARIABLE,path:r}},Br=(e,t={})=>{let r=e,s=[];(e.includes("\\${")||e.includes("\\#{"))&&(r=e.replace(/\\\\(\$\{[^}]*\})/g,"\\DOUBLE_ESC_VAR$1"),r=r.replace(/\\\\(#\{[^}]*\})/g,"\\DOUBLE_ESC_PATH$1"),r=r.replace(/\\(\$\{[^}]*\})/g,(o,u)=>{let c=`__ESCAPED_${s.length}__`;return s.push(u),c}),r=r.replace(/\\(#\{[^}]*\})/g,(o,u)=>{let c=`__ESCAPED_${s.length}__`;return s.push(u),c}),r=r.replace(/\\DOUBLE_ESC_VAR/g,"\\"),r=r.replace(/\\DOUBLE_ESC_PATH/g,"\\"));let i=[...r.matchAll(tu)],n=[...r.matchAll(ru)],a=[...i.map(o=>({match:o,type:"variable"})),...n.map(o=>({match:o,type:"pathref"}))].sort((o,u)=>o.match.index-u.match.index);if(a.length===0){let o=r;for(let u=0;u<s.length;u++)o=o.replace(`__ESCAPED_${u}__`,s[u]);return{type:b.LITERAL,value:o}}if(a.length===1&&a[0].match[0]===r&&s.length===0){let{match:o,type:u}=a[0];try{return u==="variable"?tt(o[1],t):zi(o[1])}catch(c){if(c.message==="Invalid array index syntax")return{type:b.LITERAL,value:r};throw c}}let l=[],p=0;for(let{match:o,type:u}of a){let[c,d]=o,h=o.index;if(h>p){let f=r.substring(p,h);for(let m=0;m<s.length;m++)f=f.replace(`__ESCAPED_${m}__`,s[m]);f&&l.push(f)}try{let f;u==="variable"?f=tt(d.trim(),t):f=zi(d.trim()),l.push(f)}catch(f){if(f.message==="Invalid array index syntax")l.push(c);else throw f}p=h+c.length}if(p<r.length){let o=r.substring(p);for(let u=0;u<s.length;u++)o=o.replace(`__ESCAPED_${u}__`,s[u]);o&&l.push(o)}return{type:b.INTERPOLATION,parts:l}};var we=(e,t)=>typeof e=="string"?Br(e,t):typeof e=="object"&&e!==null?Array.isArray(e)?lu(e,t):pu(e,t):{type:b.LITERAL,value:e},lu=(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 l=Object.keys(n);if(l.length===1&&l[0].startsWith("$for ")){let p=Gi(l[0],n[l[0]],t);r.push(p),s=!0;continue}}let a=we(n,t);r.push(a),(a.type===b.FUNCTION||a.type===b.CONDITIONAL||a.type===b.LOOP||a.type===b.PARTIAL||a.type===b.OBJECT&&!a.fast||a.type===b.ARRAY&&!a.fast)&&(s=!0)}return{type:b.ARRAY,items:r,fast:!s}},pu=(e,t)=>{let r=[],s=!1,i=null,n=Object.entries(e),a=0;if(e.$partial!==void 0){if(typeof e.$partial!="string")throw new T("$partial value must be a string");if(e.$partial.trim()==="")throw new T("$partial value cannot be an empty string");let p=["$if","$elif","$else","$for"],o=[];for(let[y]of n)for(let w of p)if(y===w||y.startsWith(w+" ")||y.startsWith(w+"#")){o.push(w);break}if(o.length>0)throw new T(`Cannot use $partial with ${o.join(", ")} at the same level. Wrap $partial in a parent object if you need conditionals.`);let{$partial:u,$when:c,...d}=e,h={},f=!1;for(let[y,w]of Object.entries(d)){let _=y;(y.startsWith("\\$")||y.startsWith("$$"))&&(_=y.slice(1)),h[_]=w,f=!0}let m=null;if(f&&(m=we(h,t),m.type===b.OBJECT)){let y=!1;for(let w of m.properties)if(w.value.type===b.VARIABLE||w.value.type===b.INTERPOLATION||w.value.type===b.FUNCTION||w.value.type===b.CONDITIONAL||w.value.type===b.LOOP||w.value.type===b.OBJECT&&!w.value.fast||w.value.type===b.ARRAY&&!w.value.fast){y=!0;break}y&&(m.fast=!1)}let g={type:b.PARTIAL,name:u,data:m};if(c!==void 0){let y;if(typeof c=="string"){if(c.trim()==="")throw new T("Empty condition expression after '$when'");y=ee(c,t)}else y={type:b.LITERAL,value:c};g.whenCondition=y}return g}for(let[p,o]of n)if(p==="$when"){if(i!==null)throw new T("Multiple '$when' directives on the same object are not allowed");if(o==null)throw new T("Missing condition expression after '$when'");let u=typeof o=="string"?o:JSON.stringify(o);if(u.trim()==="")throw new T("Empty condition expression after '$when'");i=ee(u,t),s=!0}else if(p.startsWith("$when#")||p.startsWith("$when "))throw new T("'$when' does not support ID syntax or inline conditions - use '$when' as a property");for(;a<n.length;){let[p,o]=n[a];if(p==="$when"){a++;continue}if(p.startsWith("$if ")||p.match(/^\$if#\w+\s/)||p.match(/^\$if\s+\w+.*:$/)){let u=cu(n,a,t);r.push({key:p,value:u.node}),s=!0,a=u.nextIndex}else if(p.startsWith("$for ")){let u=Gi(p,o,t);r.push({key:p,value:u}),s=!0,a++}else{if(p.startsWith("$elif ")||p.startsWith("$else"))throw new T(`'${p.split(" ")[0]}' without matching '$if'`);if(p==="$if"||p==="$if:")throw new T("Missing condition expression after '$if'");{let u=we(o,t);(u.type===b.FUNCTION||u.type===b.CONDITIONAL||u.type===b.LOOP||u.type===b.PARTIAL||u.type===b.OBJECT&&!u.fast||u.type===b.ARRAY&&!u.fast)&&(s=!0);let c=Br(p,t),d={key:p,value:u};(c.type!==b.LITERAL||c.value!==p)&&(d.parsedKey=c),r.push(d),a++}}}let l={type:b.OBJECT,properties:r,fast:!s};return i&&(l.whenCondition=i),l},cu=(e,t,r={})=>{let s=[],i=[],n=t,[a,l]=e[n],p=null,o;if(a.startsWith("$if#")){let c=a.match(/^\$if#(\w+)\s+(.+)$/);if(c)p=c[1],o=c[2];else throw new T(`Invalid conditional syntax: ${a}`)}else o=a.substring(4),o.endsWith(":")&&(o=o.slice(0,-1).trim());Dr(o);let u=ee(o,r);for(s.push(u),i.push(we(l,r)),n++;n<e.length;){let[c,d]=e[n],h=!1,f;if(p?c.startsWith(`$elif#${p} `)?(f=c.substring(`$elif#${p} `.length),f.endsWith(":")&&(f=f.slice(0,-1).trim()),h=!0):(c===`$else#${p}`||c===`$else#${p}:`)&&(h=!0,f=null):c.startsWith("$elif ")?(f=c.substring(6),f.endsWith(":")&&(f=f.slice(0,-1).trim()),h=!0):(c==="$else"||c==="$else:")&&(h=!0,f=null),h){if(f===null)s.push(null);else{Dr(f);let m=ee(f,r);s.push(m)}if(i.push(we(d,r)),n++,f===null)break}else break}return{node:{type:b.CONDITIONAL,conditions:s,bodies:i,id:p},nextIndex:n}},ee=(e,t={})=>{if(e=e.trim(),e.startsWith("(")&&e.endsWith(")")){let o=e.slice(1,-1),u=0,c=!0;for(let d=0;d<o.length;d++)if(o[d]==="("?u++:o[d]===")"&&u--,u<0){c=!1;break}if(c&&u===0)return ee(o,t)}let r=ke(e,"||");if(r!==-1)return{type:b.BINARY,op:D.OR,left:ee(e.substring(0,r).trim(),t),right:ee(e.substring(r+2).trim(),t)};let s=ke(e,"&&");if(s!==-1)return{type:b.BINARY,op:D.AND,left:ee(e.substring(0,s).trim(),t),right:ee(e.substring(s+2).trim(),t)};let i=[{op:">=",type:D.GTE},{op:"<=",type:D.LTE},{op:"==",type:D.EQ},{op:"!=",type:D.NEQ},{op:">",type:D.GT},{op:"<",type:D.LT},{op:" in ",type:D.IN}];for(let{op:o,type:u}of i){let c=ke(e,o);if(c!==-1)return{type:b.BINARY,op:u,left:ee(e.substring(0,c).trim(),t),right:ee(e.substring(c+o.length).trim(),t)}}let n=-1,a=null,l=[{op:" + ",type:D.ADD},{op:" - ",type:D.SUBTRACT}];for(let{op:o,type:u}of l){let c=0;for(;c<e.length;){let d=ke(e.substring(c),o);if(d===-1)break;let h=c+d;h>n&&(n=h,a={op:o,type:u}),c=h+o.length}}if(n!==-1&&a)return{type:b.BINARY,op:a.type,left:ee(e.substring(0,n).trim(),t),right:ee(e.substring(n+a.op.length).trim(),t)};let p=[" * "," / "," % "];for(let o of p)if(ke(e,o)!==-1)throw new T(`Arithmetic operations are not allowed in conditionals: "${o}"`);return e.startsWith("!")?{type:b.UNARY,op:Qe.NOT,operand:ee(e.substring(1).trim(),t)}:Hi(e,t)},ke=(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},uu=e=>{if(e=e.trim(),e==="true")return{type:b.LITERAL,value:!0};if(e==="false")return{type:b.LITERAL,value:!1};if(e==="null")return{type:b.LITERAL,value:null};if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:b.LITERAL,value:e.slice(1,-1)};if(e==='""'||e==="''")return{type:b.LITERAL,value:""};if(e==="{}")return{type:b.LITERAL,value:{}};if(e==="[]")return{type:b.LITERAL,value:[]};let t=Number(e);return!isNaN(t)&&isFinite(t)?{type:b.LITERAL,value:t}:{type:b.VARIABLE,path:e}},Hi=(e,t)=>{let r=e.trim();if(r.match(/^(\w+)\((.*)\)$/))return tt(r,t);let i=uu(r);if(i.type===b.LITERAL)return i;if(/^[a-zA-Z_$][\w.$]*$/.test(r))return{type:b.VARIABLE,path:r};try{return tt(r,t)}catch(n){if(n.message&&n.message.includes("not supported"))return i;throw n}},Gi=(e,t,r)=>{let s=e.substring(5).trim();Vi(s);let i=s.match(/^(.+?)\s+in\s+(.+)$/);if(!i)throw new T(`Invalid loop syntax - missing 'in' keyword (got: '$for ${s}')`);let n=i[1].trim(),a=i[2].trim(),l,p=null;if(n.includes(",")){let c=n.split(",").map(d=>d.trim());if(c.length!==2)throw new T(`Invalid loop variables: ${n}. Expected format: "item" or "item, index"`);l=c[0],p=c[1]}else l=n;let o=Hi(a,r),u=we(t,r);return{type:b.LOOP,itemVar:l,indexVar:p,iterable:o,body:u}};var du=(e,t={})=>{let{functions:r={}}=t;return we(e,r)},ft=du;var jr={};R(jr,{now:()=>fu});var fu=()=>Date.now();var hu=(e,t,r={})=>{let{functions:s={},partials:i={}}=r,n={...jr,...s},a=ft(e,{functions:n}),l={};for(let[p,o]of Object.entries(i))l[p]=ft(o,{functions:n});return et(a,t,{functions:n,partials:l})},rt=hu;var _e=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);var qi=(e,t)=>{!t||typeof t!="object"||Object.entries(t).forEach(([r,s])=>{if(r==="default")throw new Error("[Methods] Invalid method name 'default'. Use named exports in .methods.js; default export is not supported.");if(typeof s=="function"){if(r in e)throw new Error(`[Methods] Cannot define method '${r}' because it already exists on the component instance.`);Object.defineProperty(e,r,{configurable:!0,enumerable:!1,writable:!1,value:(i={})=>{let n=i===void 0?{}:i;if(!_e(n))throw new Error(`[Methods] Method '${r}' expects payload to be an object.`);return s.call(e,n)}})}})};var en=Symbol.for("immer-nothing"),Ji=Symbol.for("immer-draftable"),ae=Symbol.for("immer-state");function ce(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ve=Object.getPrototypeOf;function Pe(e){return!!e&&!!e[ae]}function Se(e){return e?tn(e)||Array.isArray(e)||!!e[Ji]||!!e.constructor?.[Ji]||bt(e)||vt(e):!1}var mu=Object.prototype.constructor.toString();function tn(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)===mu}function ht(e,t){gt(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,s)=>t(s,r,e))}function gt(e){let t=e[ae];return t?t.type_:Array.isArray(e)?1:bt(e)?2:vt(e)?3:0}function Wr(e,t){return gt(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function rn(e,t,r){let s=gt(e);s===2?e.set(t,r):s===3?e.add(r):e[t]=r}function yu(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function bt(e){return e instanceof Map}function vt(e){return e instanceof Set}function $e(e){return e.copy_||e.base_}function zr(e,t){if(bt(e))return new Map(e);if(vt(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=tn(e);if(t===!0||t==="class_only"&&!r){let s=Object.getOwnPropertyDescriptors(e);delete s[ae];let i=Reflect.ownKeys(s);for(let n=0;n<i.length;n++){let a=i[n],l=s[a];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(s[a]={configurable:!0,writable:!0,enumerable:l.enumerable,value:e[a]})}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 qr(e,t=!1){return wt(e)||Pe(e)||!Se(e)||(gt(e)>1&&(e.set=e.add=e.clear=e.delete=gu),Object.freeze(e),t&&Object.entries(e).forEach(([r,s])=>qr(s,!0))),e}function gu(){ce(2)}function wt(e){return Object.isFrozen(e)}var bu={};function Ce(e){let t=bu[e];return t||ce(0,e),t}var st;function sn(){return st}function vu(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Yi(e,t){t&&(Ce("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ur(e){Kr(e),e.drafts_.forEach(wu),e.drafts_=null}function Kr(e){e===st&&(st=e.parent_)}function Xi(e){return st=vu(st,e)}function wu(e){let t=e[ae];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Zi(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return e!==void 0&&e!==r?(r[ae].modified_&&(Ur(t),ce(4)),Se(e)&&(e=mt(t,e),t.parent_||yt(t,e)),t.patches_&&Ce("Patches").generateReplacementPatches_(r[ae].base_,e,t.patches_,t.inversePatches_)):e=mt(t,r,[]),Ur(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==en?e:void 0}function mt(e,t,r){if(wt(t))return t;let s=t[ae];if(!s)return ht(t,(i,n)=>Qi(e,s,t,i,n,r)),t;if(s.scope_!==e)return t;if(!s.modified_)return yt(e,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;let i=s.copy_,n=i,a=!1;s.type_===3&&(n=new Set(i),i.clear(),a=!0),ht(n,(l,p)=>Qi(e,s,i,l,p,r,a)),yt(e,i,!1),r&&e.patches_&&Ce("Patches").generatePatches_(s,r,e.patches_,e.inversePatches_)}return s.copy_}function Qi(e,t,r,s,i,n,a){if(Pe(i)){let l=n&&t&&t.type_!==3&&!Wr(t.assigned_,s)?n.concat(s):void 0,p=mt(e,i,l);if(rn(r,s,p),Pe(p))e.canAutoFreeze_=!1;else return}else a&&r.add(i);if(Se(i)&&!wt(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;mt(e,i),(!t||!t.scope_.parent_)&&typeof s!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,s)&&yt(e,i)}}function yt(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&qr(t,r)}function _u(e,t){let r=Array.isArray(e),s={type_:r?1:0,scope_:t?t.scope_:sn(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=s,n=Jr;r&&(i=[s],n=it);let{revoke:a,proxy:l}=Proxy.revocable(i,n);return s.draft_=l,s.revoke_=a,l}var Jr={get(e,t){if(t===ae)return e;let r=$e(e);if(!Wr(r,t))return xu(e,r,t);let s=r[t];return e.finalized_||!Se(s)?s:s===Fr(e.base_,t)?(Mr(e),e.copy_[t]=Gr(s,e)):s},has(e,t){return t in $e(e)},ownKeys(e){return Reflect.ownKeys($e(e))},set(e,t,r){let s=nn($e(e),t);if(s?.set)return s.set.call(e.draft_,r),!0;if(!e.modified_){let i=Fr($e(e),t),n=i?.[ae];if(n&&n.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(yu(r,i)&&(r!==void 0||Wr(e.base_,t)))return!0;Mr(e),Hr(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 Fr(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Mr(e),Hr(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=$e(e),s=Reflect.getOwnPropertyDescriptor(r,t);return s&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:s.enumerable,value:r[t]}},defineProperty(){ce(11)},getPrototypeOf(e){return Ve(e.base_)},setPrototypeOf(){ce(12)}},it={};ht(Jr,(e,t)=>{it[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});it.deleteProperty=function(e,t){return it.set.call(this,e,t,void 0)};it.set=function(e,t,r){return Jr.set.call(this,e[0],t,r,e[0])};function Fr(e,t){let r=e[ae];return(r?$e(r):e)[t]}function xu(e,t,r){let s=nn(t,r);return s?"value"in s?s.value:s.get?.call(e.draft_):void 0}function nn(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 Hr(e){e.modified_||(e.modified_=!0,e.parent_&&Hr(e.parent_))}function Mr(e){e.copy_||(e.copy_=zr(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Eu=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 a=this;return function(p=n,...o){return a.produce(p,u=>r.call(this,u,...o))}}typeof r!="function"&&ce(6),s!==void 0&&typeof s!="function"&&ce(7);let i;if(Se(t)){let n=Xi(this),a=Gr(t,void 0),l=!0;try{i=r(a),l=!1}finally{l?Ur(n):Kr(n)}return Yi(n,s),Zi(i,n)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===en&&(i=void 0),this.autoFreeze_&&qr(i,!0),s){let n=[],a=[];Ce("Patches").generateReplacementPatches_(t,i,n,a),s(n,a)}return i}else ce(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(a,...l)=>this.produceWithPatches(a,p=>t(p,...l));let s,i;return[this.produce(t,r,(a,l)=>{s=a,i=l}),s,i]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Se(e)||ce(8),Pe(e)&&(e=Au(e));let t=Xi(this),r=Gr(e,void 0);return r[ae].isManual_=!0,Kr(t),r}finishDraft(e,t){let r=e&&e[ae];(!r||!r.isManual_)&&ce(9);let{scope_:s}=r;return Yi(s,t),Zi(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=Ce("Patches").applyPatches_;return Pe(e)?s(e,t):this.produce(e,i=>s(i,t))}};function Gr(e,t){let r=bt(e)?Ce("MapSet").proxyMap_(e,t):vt(e)?Ce("MapSet").proxySet_(e,t):_u(e,t);return(t?t.scope_:sn()).drafts_.push(r),r}function Au(e){return Pe(e)||ce(10,e),an(e)}function an(e){if(!Se(e)||wt(e))return e;let t=e[ae],r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=zr(e,t.scope_.immer_.useStrictShallowCopy_)}else r=zr(e,!0);return ht(r,(s,i)=>{rn(r,s,an(i))}),t&&(t.finalized_=!1),r}var oe=new Eu,on=oe.produce,Mm=oe.produceWithPatches.bind(oe),Wm=oe.setAutoFreeze.bind(oe),zm=oe.setUseStrictShallowCopy.bind(oe),Um=oe.applyPatches.bind(oe),Km=oe.createDraft.bind(oe),Hm=oe.finishDraft.bind(oe);var ln=(e,t,r)=>{let{createInitialState:s,...i}=e,n={},a={},l={};return s&&(l=s({props:t,constants:r})),Object.entries(i).forEach(([p,o])=>{if(p.startsWith("select")){n[p]=(...u)=>o({state:l,props:t,constants:r},...u);return}a[p]=(u={})=>{let c=u===void 0?{}:u;if(!_e(c))throw new Error(`[Store] Action '${p}' expects payload to be an object.`);return l=on(l,d=>o({state:d,props:t,constants:r},c)),l}}),{getState:()=>l,...a,...n}};var pn=e=>!_e(e)||Object.isFrozen(e)?e:(Object.values(e).forEach(t=>{pn(t)}),Object.freeze(e)),cn=({setupConstants:e,fileConstants:t})=>{let r=_e(e)?e:{},s=_e(t)?t:{};return pn({...r,...s})};var un=(e,t)=>{if(!t||typeof t!="object")return"";let r="",s=n=>Object.entries(n).map(([a,l])=>` ${a}: ${l};`).join(`
1075
+ `),i=(n,a)=>{if(typeof a!="object"||a===null)return"";if(n.startsWith("@")){let p=Object.entries(a).map(([o,u])=>{let c=s(u);return` ${o} {
1076
+ ${c.split(`
976
1077
  `).map(d=>d?` ${d}`:"").join(`
977
1078
  `)}
978
1079
  }`}).join(`
@@ -982,7 +1083,7 @@ ${p}
982
1083
  ${l}
983
1084
  }`};return Object.entries(t).forEach(([n,a])=>{let l=i(n,a);l&&(r+=(r?`
984
1085
 
985
- `:"")+l)}),r};var at=e=>Array.isArray(e)?e.reduce((t,r)=>{if(Array.isArray(r))t.push(...at(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]:at(n)})}}t.push(r)}return t},[]):e;var Ii=":",hc=new Set(["__proto__","constructor","prototype"]),Oi=(e,t)=>{if(!t)return e;let r=[],s="",i=!1,n=null;for(let a=0;a<t.length;a++){let l=t[a];if(!i&&l===".")s&&(r.push(s),s="");else if(!i&&l==="[")s&&(r.push(s),s=""),i=!0;else if(i&&l==="]"){if(s){if(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))r.push(s.slice(1,-1));else{let p=Number(s);r.push(Number.isNaN(p)?s:p)}s=""}i=!1,n=null}else i&&(l==='"'||l==="'")&&(n?l===n&&(n=null):n=l),s+=l}return s&&r.push(s),r.reduce((a,l)=>{if(a==null)return;let p=typeof l=="number"?l:String(l);if(!(typeof p=="string"&&hc.has(p)))return a[p]},e)},mc=e=>e.replace(/-([a-z0-9])/g,(t,r)=>r.toUpperCase()),Ti=({attrsString:e="",viewData:t={},tagName:r,isWebComponent:s})=>{let i={},n={},a=y=>{if(y==="role"||y.startsWith("aria-")||y.startsWith("data-"))throw new Error(`[Parser] Invalid boolean attribute '?${y}'. Use normal binding for value-carrying attributes such as aria-*, data-*, and role.`)},l=(y,w,_)=>{let x=mc(y);if(!x)throw new Error(`[Parser] Invalid ${_} prop name on '${r}'.`);if(Object.prototype.hasOwnProperty.call(n,x))throw new Error(`[Parser] Duplicate prop binding '${x}' on '${r}'. Use only one of 'name=value' or ':name=value'.`);n[x]=w};if(!e)return{attrs:i,props:n};let p=/(\S+?)=(?:\"([^\"]*)\"|\'([^\']*)\'|([^\s]*))/g,o,c=new Set;for(;(o=p.exec(e))!==null;){let y=o[1],w=o[2]??o[3]??o[4]??"";if(c.add(y),y.startsWith(".")){i[y]=w;continue}if(y.startsWith(Ii)){let _=y.substring(1),x=w;if(o[4]!==void 0&&o[4]!==""){let A=o[4],E=Oi(t,A);E!==void 0&&(x=E)}l(_,x,"property-form");continue}if(y.startsWith("?")){let _=y.substring(1),x=w;a(_);let A;x==="true"?A=!0:x==="false"||x===""?A=!1:A=Oi(t,x),A&&(i[_]=""),s&&_!=="id"&&l(_,!!A,"boolean attribute-form");continue}i[y]=w,s&&y!=="id"&&l(y,w,"attribute-form")}let u=e,d=[],h,f=/(\S+?)=(?:\"([^\"]*)\"|\'([^\']*)\'|([^\s]*))/g;for(;(h=f.exec(e))!==null;)d.push(h[0]);d.forEach(y=>{u=u.replace(y," ")});let m=/\b(\S+?)(?=\s|$)/g,g;for(;(g=m.exec(u))!==null;){let y=g[1];y.startsWith(".")||!c.has(y)&&!y.startsWith(Ii)&&!y.includes("=")&&(i[y]="",s&&y!=="id"&&l(y,!0,"boolean attribute-form"))}return{attrs:i,props:n}};var yc=/^[a-z][a-zA-Z0-9]*\*?$/,gc=/^[a-zA-Z][a-zA-Z0-9_-]*\*?$/,vc=/^[a-z][a-zA-Z0-9]*$/,Li=new Set(["window","document"]),ot=e=>Object.entries(e||{}).map(([t,r])=>{if(Li.has(t))return{refKey:t,refConfig:r,targetType:"global",isWildcard:!1,prefix:t};let s="id",i=t;t.startsWith(".")?(s="class",i=t.slice(1)):t.startsWith("#")&&(s="id",i=t.slice(1));let n=i.endsWith("*")?i.slice(0,-1):i;if(Li.has(n))throw new Error(`[Parser] Invalid ref key '${t}'. Reserved global keys must be exactly 'window' or 'document'.`);if(s==="id"&&!yc.test(i))throw new Error(`[Parser] Invalid ref key '${t}'. Use camelCase IDs (optional '#', optional '*') or class refs with '.' prefix.`);if(s==="class"&&!gc.test(i))throw new Error(`[Parser] Invalid ref key '${t}'. Class refs must start with '.' and use class-compatible names (optional '*').`);let a=i.endsWith("*"),l=a?i.slice(0,-1):i;return{refKey:t,refConfig:r,targetType:s,isWildcard:a,prefix:l}}),Pi=e=>{if(!vc.test(e))throw new Error(`[Parser] Invalid element id '${e}' for refs. Use camelCase ids only. Kebab-case ids are not supported.`)},Ri=({value:e,prefix:t,isWildcard:r})=>typeof e!="string"||e.length===0?!1:r?e.startsWith(t):e===t,lt=({elementIdForRefs:e,classNames:t=[],refMatchers:r})=>{let s=[],i=Array.isArray(t)?t:[];return r.forEach(n=>{if(n.targetType==="global")return;if(n.targetType==="id"){Ri({value:e,prefix:n.prefix,isWildcard:n.isWildcard})&&s.push({...n,matchedValue:e});return}let a=i.find(l=>Ri({value:l,prefix:n.prefix,isWildcard:n.isWildcard}));a&&s.push({...n,matchedValue:a})}),s.length===0?null:(s.sort((n,a)=>{let l=n.targetType==="id"?2:1,p=a.targetType==="id"?2:1;return l!==p?p-l:!n.isWildcard&&a.isWildcard?-1:n.isWildcard&&!a.isWildcard?1:a.prefix.length-n.prefix.length}),s[0])},Ue=({optionName:e,optionValue:t,eventType:r,refKey:s})=>{if(t!==void 0&&typeof t!="boolean")throw new Error(`[Parser] Invalid '${e}' for event '${r}' on ref '${s}'. Expected boolean.`)},Ni=({optionName:e,optionValue:t,eventType:r,refKey:s})=>{if(t!==void 0&&(typeof t!="number"||Number.isNaN(t)||!Number.isFinite(t)||t<0))throw new Error(`[Parser] Invalid '${e}' for event '${r}' on ref '${s}'. Expected non-negative number.`)},Vi=({eventType:e,eventConfig:t,refKey:r})=>{if(typeof t!="object"||t===null)throw new Error(`[Parser] Invalid event config for event '${e}' on ref '${r}'.`);let s=Object.prototype.hasOwnProperty.call(t,"debounce"),i=Object.prototype.hasOwnProperty.call(t,"throttle");if(Ue({optionName:"preventDefault",optionValue:t.preventDefault,eventType:e,refKey:r}),Ue({optionName:"stopPropagation",optionValue:t.stopPropagation,eventType:e,refKey:r}),Ue({optionName:"stopImmediatePropagation",optionValue:t.stopImmediatePropagation,eventType:e,refKey:r}),Ue({optionName:"targetOnly",optionValue:t.targetOnly,eventType:e,refKey:r}),Ue({optionName:"once",optionValue:t.once,eventType:e,refKey:r}),Ni({optionName:"debounce",optionValue:t.debounce,eventType:e,refKey:r}),Ni({optionName:"throttle",optionValue:t.throttle,eventType:e,refKey:r}),s&&i)throw new Error(`[Parser] Event '${e}' on ref '${r}' cannot define both 'debounce' and 'throttle'.`);if(t.handler&&t.action)throw new Error("Each listener can have handler or action but not both");if(!t.handler&&!t.action)throw new Error("Each listener must define either handler or action");return{hasDebounce:s,hasThrottle:i}};var pt=e=>(e.__eventRateLimitState||Object.defineProperty(e,"__eventRateLimitState",{value:new Map,enumerable:!1,configurable:!0}),e.__eventRateLimitState),bc=({eventConfig:e,handlers:t,onMissingHandler:r,parseAndRenderFn:s})=>{let i=n=>{let a=e.payload&&typeof e.payload=="object"&&!Array.isArray(e.payload)?e.payload:{};return typeof s!="function"?a:s(a,{_event:n})};if(e.action){if(typeof t.handleCallStoreAction!="function")throw new Error(`[Runtime] Action listener '${e.action}' requires handlers.handleCallStoreAction.`);return n=>{let a=i(n);t.handleCallStoreAction({...a,_event:n,_action:e.action})}}return e.handler&&t[e.handler]?n=>{let a=i(n);t[e.handler]({...a,_event:n})}:(e.handler&&r?.(e.handler),null)},wc=({eventConfig:e,callback:t,hasDebounce:r,hasThrottle:s,stateKey:i,eventRateLimitState:n,fallbackCurrentTarget:a=null,nowFn:l=Date.now,setTimeoutFn:p=setTimeout,clearTimeoutFn:o=clearTimeout})=>c=>{let u=n.get(i)||{},d=c.currentTarget||a;if(e.once)if(d){if(u.onceTargets||(u.onceTargets=new WeakSet),u.onceTargets.has(d)){n.set(i,u);return}u.onceTargets.add(d)}else if(u.onceTriggered){n.set(i,u);return}else u.onceTriggered=!0;if(e.targetOnly&&c.target!==c.currentTarget){n.set(i,u);return}if(e.preventDefault&&c.preventDefault(),e.stopImmediatePropagation?c.stopImmediatePropagation():e.stopPropagation&&c.stopPropagation(),r){u.debounceTimer&&o(u.debounceTimer),u.debounceTimer=p(()=>{let h=u.debounceTimer;try{t(c)}catch(f){throw o(h),u.debounceTimer=null,f}u.debounceTimer=null},e.debounce),n.set(i,u);return}if(s){Object.prototype.hasOwnProperty.call(u,"lastThrottleAt")||(u.lastThrottleAt=void 0);let h=l();if(u.lastThrottleAt===void 0||h-u.lastThrottleAt>=e.throttle){u.lastThrottleAt=h,n.set(i,u),t(c);return}n.set(i,u);return}n.set(i,u),t(c)},ct=({eventType:e,eventConfig:t,refKey:r,handlers:s,eventRateLimitState:i,stateKey:n,fallbackCurrentTarget:a=null,parseAndRenderFn:l,onMissingHandler:p,nowFn:o=Date.now,setTimeoutFn:c=setTimeout,clearTimeoutFn:u=clearTimeout})=>{let{hasDebounce:d,hasThrottle:h}=Vi({eventType:e,eventConfig:t,refKey:r}),f=bc({eventConfig:t,handlers:s,onMissingHandler:p,parseAndRenderFn:l});return f?wc({eventConfig:t,callback:f,hasDebounce:d,hasThrottle:h,stateKey:n,eventRateLimitState:i,fallbackCurrentTarget:a,nowFn:o,setTimeoutFn:c,clearTimeoutFn:u}):null};var Di=({h:e,template:t,viewData:r,refs:s,handlers:i,createComponentUpdateHook:n})=>{let a=Be(t,r,{}),l=at(a),p=_c({h:e,items:l,refs:s,handlers:i,viewData:r,createComponentUpdateHook:n});return e("div",{style:{display:"contents"}},p)},_c=({h:e,items:t,refs:r={},handlers:s={},viewData:i={},createComponentUpdateHook:n})=>{if(!Array.isArray(t))throw new Error("[Parser] Input to createVirtualDom must be an array, got "+typeof t);let a=ot(r),l=a.some(o=>o.targetType==="id");function p(o,c=""){return o.map((u,d)=>{if(typeof u=="string"||typeof u=="number")return String(u);if(typeof u!="object"||u===null)return console.warn("Skipping invalid item in DOM structure:",u),null;let h=Object.entries(u);if(h.length===0)return null;let[f,m]=h[0];if(!isNaN(Number(f)))return Array.isArray(m)?p(m,`${c}.${f}`):typeof m=="object"&&m!==null&&Object.entries(m).length>0?p([m],`${c}.${f}`):String(m);h.length>1&&console.warn("Item has multiple keys, processing only the first:",f);let g,y,w=f.indexOf(" ");w===-1?(g=f,y=""):(g=f.substring(0,w),y=f.substring(w+1).trim());let _=g.split(/[.#]/)[0],x=_.includes("-"),A,E;try{({attrs:A,props:E}=Ti({attrsString:y,viewData:i,tagName:_,isWebComponent:x}))}catch(B){throw new Error(`[Parser] Failed to parse bindings for selector '${g}' with attrs '${y}': ${B.message}`)}let T=g.match(/#([^.#\s]+)/);T&&!Object.prototype.hasOwnProperty.call(A,"id")&&(A.id=T[1]);let $=null;A.id&&($=A.id);let W=(g.match(/\.([^.#]+)/g)||[]).map(B=>B.substring(1)),j=typeof A.class=="string"?A.class.split(/\s+/).filter(Boolean):[],U=[...new Set([...W,...j])],X=Object.create(null),ce=null;if(!x){W.forEach(le=>{X[le]=!0});let B=g.match(/#([^.#\s]+)/);B&&(ce=B[1])}let ye;typeof m=="string"||typeof m=="number"?ye=String(m):Array.isArray(m)?ye=p(m,`${c}.${f}`):ye=[],ce&&!x&&(A.id=ce);let ft=Object.create(null);if(a.length>0){l&&$&&Pi($);let B=lt({elementIdForRefs:$,classNames:U,refMatchers:a});if(B){let le=B.refKey,Tr=B.matchedValue||$||le;if(B.refConfig&&B.refConfig.eventListeners){let En=B.refConfig.eventListeners,kn=pt(s);Object.entries(En).forEach(([ht,$n])=>{let Sn=`${le}:${Tr}:${ht}`,Lr=ct({eventType:ht,eventConfig:$n,refKey:le,handlers:s,eventRateLimitState:kn,stateKey:Sn,parseAndRenderFn:Me,onMissingHandler:Cn=>{console.warn(`[Parser] Handler '${Cn}' for refKey '${le}' (matching '${Tr}') is referenced but not found in available handlers.`)}});Lr&&(ft[ht]=Lr)})}}}let oe={};if($)oe.key=$;else if(g){let B=c?`${c}.${d}`:String(d);oe.key=`${g}-${B}`;let le=Object.keys(E);le.length>0&&(oe.key+=`-p:${le.join(",")}`)}if(Object.keys(A).length>0&&(oe.attrs=A),Object.keys(X).length>0&&(oe.class=X),Object.keys(ft).length>0&&(oe.on=ft),Object.keys(E).length>0&&(oe.props=E),x&&typeof n=="function"){let B=n({selector:g,tagName:_});B&&(oe.hook=B)}try{return e(_,oe,ye)}catch(B){throw new Error(`[Parser] Error creating virtual node for '${_}': ${B.message}`)}}).filter(Boolean)}return p(t)};var ji=({baseDeps:e,refs:t,dispatchEvent:r,store:s,render:i})=>({...e,refs:t,dispatchEvent:r,store:s,render:i}),xc=({store:e,render:t,parseAndRenderFn:r})=>s=>{let{_event:i,_action:n}=s,a=r(s,{_event:i});if(!e[n])throw new Error(`[Store] Action 'store.${n}' is not defined.`);e[n](a),t()},Bi=({handlers:e,deps:t,parseAndRenderFn:r})=>{let s={handleCallStoreAction:xc({store:t.store,render:t.render,parseAndRenderFn:r})};return Object.keys(e||{}).forEach(i=>{s[i]=n=>e[i](t,n)}),s},Ac=e=>{if(e&&typeof e.then=="function")throw new Error("handleBeforeMount must be synchronous and cannot return a Promise.");return e},Wi=({handlers:e,deps:t})=>{if(!e?.handleBeforeMount)return;let r=e.handleBeforeMount(t);return Ac(r)},Mi=({handlers:e,deps:t})=>{e?.handleAfterMount&&e.handleAfterMount(t)},zi=({attributeName:e,oldValue:t,newValue:r,deps:s,propsSchemaKeys:i,toCamelCase:n,normalizeAttributeValue:a})=>{let l=n(e),p={};i.forEach(d=>{let h=s.props[d];h!==void 0&&(p[d]=h)});let o={...p},c=a(t),u=a(r);return c===void 0?delete o[l]:o[l]=c,u===void 0?delete p[l]:p[l]=u,{changedProp:l,oldProps:o,newProps:p}};var Ec=({refKey:e,targets:t})=>e==="window"?t.window:e==="document"?t.document:null,Fi=({refs:e={},handlers:t={},targets:r={window:globalThis.window,document:globalThis.document},parseAndRenderFn:s,timing:i={nowFn:Date.now,setTimeoutFn:setTimeout,clearTimeoutFn:clearTimeout},warnFn:n=console.warn})=>{let a=[],l=new Set,p=pt(t);return Object.entries(e).forEach(([o,c])=>{if(o!=="window"&&o!=="document")return;let u=Ec({refKey:o,targets:r});!u||!c?.eventListeners||Object.entries(c.eventListeners).forEach(([d,h])=>{let f=`${o}:${d}`;l.add(f);let m=ct({eventType:d,eventConfig:h,refKey:o,handlers:t,eventRateLimitState:p,stateKey:f,fallbackCurrentTarget:u,parseAndRenderFn:s,nowFn:i.nowFn,setTimeoutFn:i.setTimeoutFn,clearTimeoutFn:i.clearTimeoutFn,onMissingHandler:g=>{n(`[Runtime] Handler '${g}' for global ref '${o}' is referenced but not found in available handlers.`)}});m&&(u.addEventListener(d,m),a.push(()=>{u.removeEventListener(d,m)}))})}),()=>{a.forEach(o=>o()),l.forEach(o=>{let c=p.get(o);c&&c.debounceTimer&&i.clearTimeoutFn(c.debounceTimer),p.delete(o)})}};var kc=e=>ot(e),$c=e=>{let t=[],r=e?.data?.class;r&&typeof r=="object"&&Object.entries(r).forEach(([i,n])=>{n&&t.push(i)});let s=e?.data?.attrs?.class;return typeof s=="string"&&s.split(/\s+/).filter(Boolean).forEach(i=>t.push(i)),[...new Set(t)]};var Ui=({rootVNode:e,refs:t})=>{let r={},s=kc(t),i=n=>{if(!n||typeof n!="object")return;let a=n?.data?.attrs?.id,l=$c(n),p=lt({elementIdForRefs:a,classNames:l,refMatchers:s});if(n.elm&&p){let o=a||p.refKey;r[o]=n.elm}Array.isArray(n.children)&&n.children.forEach(i)};return i(e),r};var Ki=({propsSchemaKeys:e=[],toKebabCase:t})=>{let r=new Set(["key"]);return e.forEach(s=>{r.add(s),r.add(t(s))}),[...r]},Hi=({baseDeps:e,refs:t,dispatchEvent:r,store:s,render:i})=>ji({baseDeps:e,refs:t,dispatchEvent:r,store:s,render:i}),Gi=({refIds:e,nextRefIds:t={}})=>(Object.keys(e).forEach(r=>{delete e[r]}),Object.assign(e,t),e),qi=({transformedHandlers:e,clearTimerFn:t=clearTimeout})=>{let r=e?.__eventRateLimitState;if(!(r instanceof Map))return 0;let s=0;return r.forEach(i=>{i&&i.debounceTimer&&(t(i.debounceTimer),s+=1)}),r.clear(),s};var Ji=({instance:e})=>Hi({baseDeps:e.deps,refs:e.refIds,dispatchEvent:e.dispatchEvent.bind(e),store:e.store,render:e.render.bind(e)}),Yi=({instance:e,parseAndRenderFn:t,renderFn:r,createTransformedHandlersFn:s=Bi,runBeforeMountFn:i=Wi,attachGlobalRefListenersFn:n=Fi,runAfterMountFn:a=Mi})=>{let l=Ji({instance:e});return e.transformedHandlers=s({handlers:e.handlers,deps:l,parseAndRenderFn:t}),e._unmountCallback=i({handlers:e.handlers,deps:l}),e._globalListenersCleanup=n({refs:e.refs,handlers:e.transformedHandlers,parseAndRenderFn:t}),r(),a({handlers:e.handlers,deps:l}),l},Xi=({instance:e,clearTimerFn:t=clearTimeout})=>(e._unmountCallback&&e._unmountCallback(),e._globalListenersCleanup&&e._globalListenersCleanup(),qi({transformedHandlers:e.transformedHandlers,clearTimerFn:t})),Zi=({instance:e,attributeName:t,oldValue:r,newValue:s,scheduleFrameFn:i})=>{if(!(r===s||!e.render)){if(e.handlers?.handleOnUpdate){let n=Ji({instance:e}),a=zi({attributeName:t,oldValue:r,newValue:s,deps:n,propsSchemaKeys:e._propsSchemaKeys,toCamelCase:Xe,normalizeAttributeValue:Ye});e.handlers.handleOnUpdate(n,a);return}i(()=>{e.render()})}},Qi=({instance:e,createComponentUpdateHookFn:t,parseViewFn:r=Di,collectRefElementsFn:s=Ui,onError:i=n=>{console.error("Error during render:",n)}})=>{if(!e.patch)return console.error("Patch function is not defined!"),null;if(!e.template)return console.error("Template is not defined!"),null;try{let n=r({h:e._snabbdomH,template:e.template,viewData:e.viewData,refs:e.refs,handlers:e.transformedHandlers,createComponentUpdateHook:t});e._oldVNode?e._oldVNode=e.patch(e._oldVNode,n):e._oldVNode=e.patch(e.renderTarget,n);let a=s({rootVNode:e._oldVNode,refs:e.refs});return Gi({refIds:e.refIds,nextRefIds:a}),e._oldVNode}catch(n){return i(n),e._oldVNode||null}};var Sc=`
1086
+ `:"")+l)}),r};var _t=e=>Array.isArray(e)?e.reduce((t,r)=>{if(Array.isArray(r))t.push(..._t(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]:_t(n)})}}t.push(r)}return t},[]):e;var dn=":",ku=new Set(["__proto__","constructor","prototype"]),fn=(e,t)=>{if(!t)return e;let r=[],s="",i=!1,n=null;for(let a=0;a<t.length;a++){let l=t[a];if(!i&&l===".")s&&(r.push(s),s="");else if(!i&&l==="[")s&&(r.push(s),s=""),i=!0;else if(i&&l==="]"){if(s){if(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))r.push(s.slice(1,-1));else{let p=Number(s);r.push(Number.isNaN(p)?s:p)}s=""}i=!1,n=null}else i&&(l==='"'||l==="'")&&(n?l===n&&(n=null):n=l),s+=l}return s&&r.push(s),r.reduce((a,l)=>{if(a==null)return;let p=typeof l=="number"?l:String(l);if(!(typeof p=="string"&&ku.has(p)))return a[p]},e)},$u=e=>e.replace(/-([a-z0-9])/g,(t,r)=>r.toUpperCase());var hn=({attrsString:e="",viewData:t={},tagName:r,isWebComponent:s})=>{let i={},n={},a=y=>{if(y==="role"||y.startsWith("aria-")||y.startsWith("data-"))throw new Error(`[Parser] Invalid boolean attribute '?${y}'. Use normal binding for value-carrying attributes such as aria-*, data-*, and role.`)},l=(y,w,_)=>{let x=$u(y);if(!x)throw new Error(`[Parser] Invalid ${_} prop name on '${r}'.`);if(Object.prototype.hasOwnProperty.call(n,x))throw new Error(`[Parser] Duplicate prop binding '${x}' on '${r}'. Use only one of 'name=value' or ':name=value'.`);n[x]=w};if(!e)return{attrs:i,props:n};let p=/(\S+?)=(?:\"([^\"]*)\"|\'([^\']*)\'|([^\s]*))/g,o,u=new Set;for(;(o=p.exec(e))!==null;){let y=o[1],w=o[2]??o[3]??o[4]??"";if(u.add(y),y.startsWith(".")){i[y]=w;continue}if(y.startsWith(dn)){let _=y.substring(1),x=w;if(o[4]!==void 0&&o[4]!==""){let E=o[4],A=fn(t,E);A!==void 0&&(x=A)}l(_,x,"property-form");continue}if(y.startsWith("?")){let _=y.substring(1),x=w;a(_);let E;x==="true"?E=!0:x==="false"||x===""?E=!1:E=fn(t,x),E&&(i[_]=""),s&&_!=="id"&&l(_,!!E,"boolean attribute-form");continue}i[y]=w,s&&y!=="id"&&l(y,w,"attribute-form")}let c=e,d=[],h,f=/(\S+?)=(?:\"([^\"]*)\"|\'([^\']*)\'|([^\s]*))/g;for(;(h=f.exec(e))!==null;)d.push(h[0]);d.forEach(y=>{c=c.replace(y," ")});let m=/\b(\S+?)(?=\s|$)/g,g;for(;(g=m.exec(c))!==null;){let y=g[1];y.startsWith(".")||!u.has(y)&&!y.startsWith(dn)&&!y.includes("=")&&(i[y]="",s&&y!=="id"&&l(y,!0,"boolean attribute-form"))}return{attrs:i,props:n}};var Su=/^[a-z][a-zA-Z0-9]*\*?$/,Cu=/^[a-zA-Z][a-zA-Z0-9_-]*\*?$/,Iu=/^[a-z][a-zA-Z0-9]*$/,mn=new Set(["window","document"]),xt=e=>Object.entries(e||{}).map(([t,r])=>{if(mn.has(t))return{refKey:t,refConfig:r,targetType:"global",isWildcard:!1,prefix:t};let s="id",i=t;t.startsWith(".")?(s="class",i=t.slice(1)):t.startsWith("#")&&(s="id",i=t.slice(1));let n=i.endsWith("*")?i.slice(0,-1):i;if(mn.has(n))throw new Error(`[Parser] Invalid ref key '${t}'. Reserved global keys must be exactly 'window' or 'document'.`);if(s==="id"&&!Su.test(i))throw new Error(`[Parser] Invalid ref key '${t}'. Use camelCase IDs (optional '#', optional '*') or class refs with '.' prefix.`);if(s==="class"&&!Cu.test(i))throw new Error(`[Parser] Invalid ref key '${t}'. Class refs must start with '.' and use class-compatible names (optional '*').`);let a=i.endsWith("*"),l=a?i.slice(0,-1):i;return{refKey:t,refConfig:r,targetType:s,isWildcard:a,prefix:l}}),bn=e=>{if(!Iu.test(e))throw new Error(`[Parser] Invalid element id '${e}' for refs. Use camelCase ids only. Kebab-case ids are not supported.`)},yn=({value:e,prefix:t,isWildcard:r})=>typeof e!="string"||e.length===0?!1:r?e.startsWith(t):e===t,Et=({elementIdForRefs:e,classNames:t=[],refMatchers:r})=>{let s=[],i=Array.isArray(t)?t:[];return r.forEach(n=>{if(n.targetType==="global")return;if(n.targetType==="id"){yn({value:e,prefix:n.prefix,isWildcard:n.isWildcard})&&s.push({...n,matchedValue:e});return}let a=i.find(l=>yn({value:l,prefix:n.prefix,isWildcard:n.isWildcard}));a&&s.push({...n,matchedValue:a})}),s.length===0?null:(s.sort((n,a)=>{let l=n.targetType==="id"?2:1,p=a.targetType==="id"?2:1;return l!==p?p-l:!n.isWildcard&&a.isWildcard?-1:n.isWildcard&&!a.isWildcard?1:a.prefix.length-n.prefix.length}),s[0])},nt=({optionName:e,optionValue:t,eventType:r,refKey:s})=>{if(t!==void 0&&typeof t!="boolean")throw new Error(`[Parser] Invalid '${e}' for event '${r}' on ref '${s}'. Expected boolean.`)},gn=({optionName:e,optionValue:t,eventType:r,refKey:s})=>{if(t!==void 0&&(typeof t!="number"||Number.isNaN(t)||!Number.isFinite(t)||t<0))throw new Error(`[Parser] Invalid '${e}' for event '${r}' on ref '${s}'. Expected non-negative number.`)},vn=({eventType:e,eventConfig:t,refKey:r})=>{if(typeof t!="object"||t===null)throw new Error(`[Parser] Invalid event config for event '${e}' on ref '${r}'.`);let s=Object.prototype.hasOwnProperty.call(t,"debounce"),i=Object.prototype.hasOwnProperty.call(t,"throttle");if(nt({optionName:"preventDefault",optionValue:t.preventDefault,eventType:e,refKey:r}),nt({optionName:"stopPropagation",optionValue:t.stopPropagation,eventType:e,refKey:r}),nt({optionName:"stopImmediatePropagation",optionValue:t.stopImmediatePropagation,eventType:e,refKey:r}),nt({optionName:"targetOnly",optionValue:t.targetOnly,eventType:e,refKey:r}),nt({optionName:"once",optionValue:t.once,eventType:e,refKey:r}),gn({optionName:"debounce",optionValue:t.debounce,eventType:e,refKey:r}),gn({optionName:"throttle",optionValue:t.throttle,eventType:e,refKey:r}),s&&i)throw new Error(`[Parser] Event '${e}' on ref '${r}' cannot define both 'debounce' and 'throttle'.`);if(t.handler&&t.action)throw new Error("Each listener can have handler or action but not both");if(!t.handler&&!t.action)throw new Error("Each listener must define either handler or action");return{hasDebounce:s,hasThrottle:i}};var At=e=>(e.__eventRateLimitState||Object.defineProperty(e,"__eventRateLimitState",{value:new Map,enumerable:!1,configurable:!0}),e.__eventRateLimitState),Ou=({eventConfig:e,handlers:t,onMissingHandler:r,parseAndRenderFn:s})=>{let i=n=>{let a=e.payload&&typeof e.payload=="object"&&!Array.isArray(e.payload)?e.payload:{};return typeof s!="function"?a:s(a,{_event:n})};if(e.action){if(typeof t.handleCallStoreAction!="function")throw new Error(`[Runtime] Action listener '${e.action}' requires handlers.handleCallStoreAction.`);return n=>{let a=i(n);t.handleCallStoreAction({...a,_event:n,_action:e.action})}}return e.handler&&t[e.handler]?n=>{let a=i(n);t[e.handler]({...a,_event:n})}:(e.handler&&r?.(e.handler),null)},Tu=({eventConfig:e,callback:t,hasDebounce:r,hasThrottle:s,stateKey:i,eventRateLimitState:n,fallbackCurrentTarget:a=null,nowFn:l=Date.now,setTimeoutFn:p=setTimeout,clearTimeoutFn:o=clearTimeout})=>u=>{let c=n.get(i)||{},d=u.currentTarget||a;if(e.once)if(d){if(c.onceTargets||(c.onceTargets=new WeakSet),c.onceTargets.has(d)){n.set(i,c);return}c.onceTargets.add(d)}else if(c.onceTriggered){n.set(i,c);return}else c.onceTriggered=!0;if(e.targetOnly&&u.target!==u.currentTarget){n.set(i,c);return}if(e.preventDefault&&u.preventDefault(),e.stopImmediatePropagation?u.stopImmediatePropagation():e.stopPropagation&&u.stopPropagation(),r){c.debounceTimer&&o(c.debounceTimer),c.debounceTimer=p(()=>{let h=c.debounceTimer;try{t(u)}catch(f){throw o(h),c.debounceTimer=null,f}c.debounceTimer=null},e.debounce),n.set(i,c);return}if(s){Object.prototype.hasOwnProperty.call(c,"lastThrottleAt")||(c.lastThrottleAt=void 0);let h=l();if(c.lastThrottleAt===void 0||h-c.lastThrottleAt>=e.throttle){c.lastThrottleAt=h,n.set(i,c),t(u);return}n.set(i,c);return}n.set(i,c),t(u)},kt=({eventType:e,eventConfig:t,refKey:r,handlers:s,eventRateLimitState:i,stateKey:n,fallbackCurrentTarget:a=null,parseAndRenderFn:l,onMissingHandler:p,nowFn:o=Date.now,setTimeoutFn:u=setTimeout,clearTimeoutFn:c=clearTimeout})=>{let{hasDebounce:d,hasThrottle:h}=vn({eventType:e,eventConfig:t,refKey:r}),f=Ou({eventConfig:t,handlers:s,onMissingHandler:p,parseAndRenderFn:l});return f?Tu({eventConfig:t,callback:f,hasDebounce:d,hasThrottle:h,stateKey:n,eventRateLimitState:i,fallbackCurrentTarget:a,nowFn:o,setTimeoutFn:u,clearTimeoutFn:c}):null};var wn=({h:e,template:t,viewData:r,refs:s,handlers:i,createComponentUpdateHook:n})=>{let a=et(t,r,{}),l=_t(a),p=Lu({h:e,items:l,refs:s,handlers:i,viewData:r,createComponentUpdateHook:n});return e("div",{style:{display:"contents"}},p)},Lu=({h:e,items:t,refs:r={},handlers:s={},viewData:i={},createComponentUpdateHook:n})=>{if(!Array.isArray(t))throw new Error("[Parser] Input to createVirtualDom must be an array, got "+typeof t);let a=xt(r),l=a.some(o=>o.targetType==="id");function p(o,u=""){return o.map((c,d)=>{if(typeof c=="string"||typeof c=="number")return String(c);if(typeof c!="object"||c===null)return console.warn("Skipping invalid item in DOM structure:",c),null;let h=Object.entries(c);if(h.length===0)return null;let[f,m]=h[0];if(!isNaN(Number(f)))return Array.isArray(m)?p(m,`${u}.${f}`):typeof m=="object"&&m!==null&&Object.entries(m).length>0?p([m],`${u}.${f}`):String(m);h.length>1&&console.warn("Item has multiple keys, processing only the first:",f);let g,y,w=f.indexOf(" ");w===-1?(g=f,y=""):(g=f.substring(0,w),y=f.substring(w+1).trim());let _=g.split(/[.#]/)[0],x=_.includes("-"),E,A;try{({attrs:E,props:A}=hn({attrsString:y,viewData:i,tagName:_,isWebComponent:x}))}catch(j){throw new Error(`[Parser] Failed to parse bindings for selector '${g}' with attrs '${y}': ${j.message}`)}let L=g.match(/#([^.#\s]+)/);L&&!Object.prototype.hasOwnProperty.call(E,"id")&&(E.id=L[1]);let $=null;E.id&&($=E.id);let M=(g.match(/\.([^.#]+)/g)||[]).map(j=>j.substring(1)),B=typeof E.class=="string"?E.class.split(/\s+/).filter(Boolean):[],H=[...new Set([...M,...B])],te=Object.create(null),ge=null;if(!x){M.forEach(he=>{te[he]=!0});let j=g.match(/#([^.#\s]+)/);j&&(ge=j[1])}let xe;typeof m=="string"||typeof m=="number"?xe=String(m):Array.isArray(m)?xe=p(m,`${u}.${f}`):xe=[],ge&&!x&&(E.id=ge);let Ct=Object.create(null);if(a.length>0){l&&$&&bn($);let j=Et({elementIdForRefs:$,classNames:H,refMatchers:a});if(j){let he=j.refKey,ts=j.matchedValue||$||he;if(j.refConfig&&j.refConfig.eventListeners){let aa=j.refConfig.eventListeners,oa=At(s);Object.entries(aa).forEach(([It,la])=>{let pa=`${he}:${ts}:${It}`,rs=kt({eventType:It,eventConfig:la,refKey:he,handlers:s,eventRateLimitState:oa,stateKey:pa,parseAndRenderFn:rt,onMissingHandler:ca=>{console.warn(`[Parser] Handler '${ca}' for refKey '${he}' (matching '${ts}') is referenced but not found in available handlers.`)}});rs&&(Ct[It]=rs)})}}}let fe={};if($)fe.key=$;else if(g){let j=u?`${u}.${d}`:String(d);fe.key=`${g}-${j}`;let he=Object.keys(A);he.length>0&&(fe.key+=`-p:${he.join(",")}`)}if(Object.keys(E).length>0&&(fe.attrs=E),Object.keys(te).length>0&&(fe.class=te),Object.keys(Ct).length>0&&(fe.on=Ct),Object.keys(A).length>0&&(fe.props=A),x&&typeof n=="function"){let j=n({selector:g,tagName:_});j&&(fe.hook=j)}try{return e(_,fe,xe)}catch(j){throw new Error(`[Parser] Error creating virtual node for '${_}': ${j.message}`)}}).filter(Boolean)}return p(t)};var _n=({baseDeps:e,refs:t,dispatchEvent:r,store:s,render:i})=>({...e,refs:t,dispatchEvent:r,store:s,render:i}),Ru=({store:e,render:t,parseAndRenderFn:r})=>s=>{let{_event:i,_action:n}=s,a=r(s,{_event:i});if(!e[n])throw new Error(`[Store] Action 'store.${n}' is not defined.`);e[n](a),t()},xn=({handlers:e,deps:t,parseAndRenderFn:r})=>{let s={handleCallStoreAction:Ru({store:t.store,render:t.render,parseAndRenderFn:r})};return Object.keys(e||{}).forEach(i=>{s[i]=n=>e[i](t,n)}),s},Nu=e=>{if(e&&typeof e.then=="function")throw new Error("handleBeforeMount must be synchronous and cannot return a Promise.");return e},En=({handlers:e,deps:t})=>{if(!e?.handleBeforeMount)return;let r=e.handleBeforeMount(t);return Nu(r)},An=({handlers:e,deps:t})=>{e?.handleAfterMount&&e.handleAfterMount(t)},kn=({attributeName:e,oldValue:t,newValue:r,deps:s,propsSchemaKeys:i,toCamelCase:n,normalizeAttributeValue:a})=>{let l=n(e),p={};i.forEach(d=>{let h=s.props[d];h!==void 0&&(p[d]=h)});let o={...p},u=a(t),c=a(r);return u===void 0?delete o[l]:o[l]=u,c===void 0?delete p[l]:p[l]=c,{changedProp:l,oldProps:o,newProps:p}};var Vu=({refKey:e,targets:t})=>e==="window"?t.window:e==="document"?t.document:null,$n=({refs:e={},handlers:t={},targets:r={window:globalThis.window,document:globalThis.document},parseAndRenderFn:s,timing:i={nowFn:Date.now,setTimeoutFn:setTimeout,clearTimeoutFn:clearTimeout},warnFn:n=console.warn})=>{let a=[],l=new Set,p=At(t);return Object.entries(e).forEach(([o,u])=>{if(o!=="window"&&o!=="document")return;let c=Vu({refKey:o,targets:r});!c||!u?.eventListeners||Object.entries(u.eventListeners).forEach(([d,h])=>{let f=`${o}:${d}`;l.add(f);let m=kt({eventType:d,eventConfig:h,refKey:o,handlers:t,eventRateLimitState:p,stateKey:f,fallbackCurrentTarget:c,parseAndRenderFn:s,nowFn:i.nowFn,setTimeoutFn:i.setTimeoutFn,clearTimeoutFn:i.clearTimeoutFn,onMissingHandler:g=>{n(`[Runtime] Handler '${g}' for global ref '${o}' is referenced but not found in available handlers.`)}});m&&(c.addEventListener(d,m),a.push(()=>{c.removeEventListener(d,m)}))})}),()=>{a.forEach(o=>o()),l.forEach(o=>{let u=p.get(o);u&&u.debounceTimer&&i.clearTimeoutFn(u.debounceTimer),p.delete(o)})}};var Pu=e=>xt(e),Du=e=>{let t=[],r=e?.data?.class;r&&typeof r=="object"&&Object.entries(r).forEach(([i,n])=>{n&&t.push(i)});let s=e?.data?.attrs?.class;return typeof s=="string"&&s.split(/\s+/).filter(Boolean).forEach(i=>t.push(i)),[...new Set(t)]};var Sn=({rootVNode:e,refs:t})=>{let r={},s=Pu(t),i=n=>{if(!n||typeof n!="object")return;let a=n?.data?.attrs?.id,l=Du(n),p=Et({elementIdForRefs:a,classNames:l,refMatchers:s});if(n.elm&&p){let o=a||p.refKey;r[o]=n.elm}Array.isArray(n.children)&&n.children.forEach(i)};return i(e),r};var Cn=({propsSchemaKeys:e=[],toKebabCase:t})=>{let r=new Set(["key"]);return e.forEach(s=>{r.add(s),r.add(t(s))}),[...r]},In=({baseDeps:e,refs:t,dispatchEvent:r,store:s,render:i})=>_n({baseDeps:e,refs:t,dispatchEvent:r,store:s,render:i}),On=({refIds:e,nextRefIds:t={}})=>(Object.keys(e).forEach(r=>{delete e[r]}),Object.assign(e,t),e),Tn=({transformedHandlers:e,clearTimerFn:t=clearTimeout})=>{let r=e?.__eventRateLimitState;if(!(r instanceof Map))return 0;let s=0;return r.forEach(i=>{i&&i.debounceTimer&&(t(i.debounceTimer),s+=1)}),r.clear(),s};var Ln=({instance:e})=>In({baseDeps:e.deps,refs:e.refIds,dispatchEvent:e.dispatchEvent.bind(e),store:e.store,render:e.render.bind(e)}),Rn=({instance:e,parseAndRenderFn:t,renderFn:r,createTransformedHandlersFn:s=xn,runBeforeMountFn:i=En,attachGlobalRefListenersFn:n=$n,runAfterMountFn:a=An})=>{let l=Ln({instance:e});return e.transformedHandlers=s({handlers:e.handlers,deps:l,parseAndRenderFn:t}),e._unmountCallback=i({handlers:e.handlers,deps:l}),e._globalListenersCleanup=n({refs:e.refs,handlers:e.transformedHandlers,parseAndRenderFn:t}),r(),a({handlers:e.handlers,deps:l}),l},Nn=({instance:e,clearTimerFn:t=clearTimeout})=>(e._unmountCallback&&e._unmountCallback(),e._globalListenersCleanup&&e._globalListenersCleanup(),Tn({transformedHandlers:e.transformedHandlers,clearTimerFn:t})),Vn=({instance:e,attributeName:t,oldValue:r,newValue:s,scheduleFrameFn:i})=>{if(!(r===s||!e.render)){if(e.handlers?.handleOnUpdate){let n=Ln({instance:e}),a=kn({attributeName:t,oldValue:r,newValue:s,deps:n,propsSchemaKeys:e._propsSchemaKeys,toCamelCase:dt,normalizeAttributeValue:ut});e.handlers.handleOnUpdate(n,a);return}i(()=>{e.render()})}},Pn=({instance:e,createComponentUpdateHookFn:t,parseViewFn:r=wn,collectRefElementsFn:s=Sn,onError:i=n=>{console.error("Error during render:",n)}})=>{if(!e.patch)return console.error("Patch function is not defined!"),null;if(!e.template)return console.error("Template is not defined!"),null;try{let n=r({h:e._snabbdomH,template:e.template,viewData:e.viewData,refs:e.refs,handlers:e.transformedHandlers,createComponentUpdateHook:t});e._oldVNode?e._oldVNode=e.patch(e._oldVNode,n):e._oldVNode=e.patch(e.renderTarget,n);let a=s({rootVNode:e._oldVNode,refs:e.refs});return On({refIds:e.refIds,nextRefIds:a}),e._oldVNode}catch(n){return i(n),e._oldVNode||null}};var Bu=`
986
1087
  a, a:link, a:visited, a:hover, a:active {
987
1088
  display: contents;
988
1089
  color: inherit;
@@ -994,4 +1095,4 @@ ${l}
994
1095
  font: inherit;
995
1096
  cursor: pointer;
996
1097
  }
997
- `,en=({host:e,cssText:t,createStyleSheet:r=()=>new CSSStyleSheet,createElement:s=i=>document.createElement(i)})=>{let i=e.attachShadow({mode:"open"}),n=r();n.replaceSync(Sc);let a=[n];if(t){let p=r();p.replaceSync(t),a.push(p)}i.adoptedStyleSheets=a;let l=s("div");return l.style.cssText="display: contents;",i.appendChild(l),l.parentNode||e.appendChild(l),e.style.display="contents",{shadow:i,renderTarget:l,adoptedStyleSheets:a}};var ut=(e,t=requestAnimationFrame)=>t(e);var tn=({scheduleFrameFn:e=ut}={})=>({update:(t,r)=>{let s=t.data?.props||{},i=r.data?.props||{};if(!(JSON.stringify(s)!==JSON.stringify(i)))return;let a=r.elm;!a||typeof a.render!="function"||(a.setAttribute("isDirty","true"),e(()=>{if(a.render(),a.removeAttribute("isDirty"),a.handlers&&a.handlers.handleOnUpdate){let l={...a.deps,store:a.store,render:a.render.bind(a),handlers:a.handlers,dispatchEvent:a.dispatchEvent.bind(a),refs:a.refIds||{}};a.handlers.handleOnUpdate(l,{oldProps:s,newProps:i})}}))}});var rn=({elementName:e,propsSchema:t,propsSchemaKeys:r,template:s,refs:i,styles:n,handlers:a,methods:l,constants:p,store:o,patch:c,h:u,deps:d})=>{class h extends HTMLElement{elementName;styles;_snabbdomH;store;props;propsSchema;template;handlers;methods;constants;transformedHandlers={};refs;refIds={};patch;_unmountCallback;_globalListenersCleanup;_oldVNode;deps;_propsSchemaKeys=[];cssText;static get observedAttributes(){return["key"]}get viewData(){let g={};return this.store.selectViewData&&(g=this.store.selectViewData()),g}connectedCallback(){let g=en({host:this,cssText:this.cssText});this.shadow=g.shadow,this.renderTarget=g.renderTarget,Yi({instance:this,parseAndRenderFn:Me,renderFn:this.render})}disconnectedCallback(){Xi({instance:this,clearTimerFn:clearTimeout})}attributeChangedCallback(g,y,w){Zi({instance:this,attributeName:g,oldValue:y,newValue:w,scheduleFrameFn:ut})}render=()=>{Qi({instance:this,createComponentUpdateHookFn:tn})}}class f extends h{static get observedAttributes(){return Ki({propsSchemaKeys:r,toKebabCase:dr})}constructor(){super(),this.constants=Si({setupConstants:d?.constants,fileConstants:p}),this.propsSchema=t,this.props=t?Xs(this,r):{},this._propsSchemaKeys=r,this.elementName=e,this.styles=n,this.store=ki(o,this.props,this.constants),this.template=s,this.handlers=a,this.methods=l,this.refs=i,this.patch=c,this.deps={...d,store:this.store,render:this.render,handlers:a,props:this.props,constants:this.constants},di(this,this.methods),this._snabbdomH=u,this.cssText=Ci(e,n)}}return f};function xe(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 Ce=Array.isArray;function Ie(e){return typeof e=="string"||typeof e=="number"||e instanceof String||e instanceof Number}function Cc(e,t){return document.createElement(e,t)}function Ic(e,t,r){return document.createElementNS(e,t,r)}function Oc(){return Ae(document.createDocumentFragment())}function Tc(e){return document.createTextNode(e)}function Lc(e){return document.createComment(e)}function Rc(e,t,r){if(pe(e)){let s=e;for(;s&&pe(s);)s=Ae(s).parent;e=s??e}pe(t)&&(t=Ae(t,e)),r&&pe(r)&&(r=Ae(r).firstChildNode),e.insertBefore(t,r)}function Nc(e,t){e.removeChild(t)}function Pc(e,t){pe(t)&&(t=Ae(t,e)),e.appendChild(t)}function nn(e){if(pe(e)){for(;e&&pe(e);)e=Ae(e).parent;return e??null}return e.parentNode}function Vc(e){var t;if(pe(e)){let r=Ae(e),s=nn(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 Dc(e){return e.tagName}function jc(e,t){e.textContent=t}function Bc(e){return e.textContent}function Wc(e){return e.nodeType===1}function Mc(e){return e.nodeType===3}function zc(e){return e.nodeType===8}function pe(e){return e.nodeType===11}function Ae(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 an={createElement:Cc,createElementNS:Ic,createTextNode:Tc,createDocumentFragment:Oc,createComment:Lc,insertBefore:Rc,removeChild:Nc,appendChild:Pc,parentNode:nn,nextSibling:Vc,tagName:Dc,setTextContent:jc,getTextContent:Bc,isElement:Wc,isText:Mc,isComment:zc,isDocumentFragment:pe};function dt(e){return e===void 0}function re(e){return e!==void 0}var $r=xe("",{},[],void 0,void 0);function Ke(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),a=e.sel===t.sel,l=!e.sel&&e.sel===t.sel?typeof e.text==typeof t.text:!0;return a&&i&&n&&l}function Fc(){throw new Error("The document fragment is not supported on this platform.")}function Uc(e,t){return e.isElement(t)}function Kc(e,t){return e.isDocumentFragment(t)}function Hc(e,t,r){var s;let i={};for(let n=t;n<=r;++n){let a=(s=e[n])===null||s===void 0?void 0:s.key;a!==void 0&&(i[a]=n)}return i}var Gc=["create","update","remove","destroy","pre","post"];function on(e,t,r){let s={create:[],update:[],remove:[],destroy:[],pre:[],post:[]},i=t!==void 0?t:an;for(let f of Gc)for(let m of e){let g=m[f];g!==void 0&&s[f].push(g)}function n(f){let m=f.id?"#"+f.id:"",g=f.getAttribute("class"),y=g?"."+g.split(" ").join("."):"";return xe(i.tagName(f).toLowerCase()+m+y,{},[],void 0,f)}function a(f){return xe(void 0,{},[],void 0,f)}function l(f,m){return function(){if(--m===0){let y=i.parentNode(f);y!==null&&i.removeChild(y,f)}}}function p(f,m){var g,y,w,_;let x,A=f.data;if(A!==void 0){let $=(g=A.hook)===null||g===void 0?void 0:g.init;re($)&&($(f),A=f.data)}let E=f.children,T=f.sel;if(T==="!")dt(f.text)&&(f.text=""),f.elm=i.createComment(f.text);else if(T==="")f.elm=i.createTextNode(f.text);else if(T!==void 0){let $=T.indexOf("#"),P=T.indexOf(".",$),W=$>0?$:T.length,j=P>0?P:T.length,U=$!==-1||P!==-1?T.slice(0,Math.min(W,j)):T,X=f.elm=re(A)&&re(x=A.ns)?i.createElementNS(x,U,A):i.createElement(U,A);for(W<j&&X.setAttribute("id",T.slice(W+1,j)),P>0&&X.setAttribute("class",T.slice(j+1).replace(/\./g," ")),x=0;x<s.create.length;++x)s.create[x]($r,f);if(Ie(f.text)&&(!Ce(E)||E.length===0)&&i.appendChild(X,i.createTextNode(f.text)),Ce(E))for(x=0;x<E.length;++x){let ye=E[x];ye!=null&&i.appendChild(X,p(ye,m))}let ce=f.data.hook;re(ce)&&((y=ce.create)===null||y===void 0||y.call(ce,$r,f),ce.insert&&m.push(f))}else if(!((w=r?.experimental)===null||w===void 0)&&w.fragments&&f.children){for(f.elm=((_=i.createDocumentFragment)!==null&&_!==void 0?_:Fc)(),x=0;x<s.create.length;++x)s.create[x]($r,f);for(x=0;x<f.children.length;++x){let $=f.children[x];$!=null&&i.appendChild(f.elm,p($,m))}}else f.elm=i.createTextNode(f.text);return f.elm}function o(f,m,g,y,w,_){for(;y<=w;++y){let x=g[y];x!=null&&i.insertBefore(f,p(x,_),m)}}function c(f){var m,g;let y=f.data;if(y!==void 0){(g=(m=y?.hook)===null||m===void 0?void 0:m.destroy)===null||g===void 0||g.call(m,f);for(let w=0;w<s.destroy.length;++w)s.destroy[w](f);if(f.children!==void 0)for(let w=0;w<f.children.length;++w){let _=f.children[w];_!=null&&typeof _!="string"&&c(_)}}}function u(f,m,g,y){for(var w,_;g<=y;++g){let x,A,E=m[g];if(E!=null)if(re(E.sel)){c(E),x=s.remove.length+1,A=l(E.elm,x);for(let $=0;$<s.remove.length;++$)s.remove[$](E,A);let T=(_=(w=E?.data)===null||w===void 0?void 0:w.hook)===null||_===void 0?void 0:_.remove;re(T)?T(E,A):A()}else E.children?(c(E),u(f,E.children,0,E.children.length-1)):i.removeChild(f,E.elm)}}function d(f,m,g,y){let w=0,_=0,x=m.length-1,A=m[0],E=m[x],T=g.length-1,$=g[0],P=g[T],W,j,U,X;for(;w<=x&&_<=T;)A==null?A=m[++w]:E==null?E=m[--x]:$==null?$=g[++_]:P==null?P=g[--T]:Ke(A,$)?(h(A,$,y),A=m[++w],$=g[++_]):Ke(E,P)?(h(E,P,y),E=m[--x],P=g[--T]):Ke(A,P)?(h(A,P,y),i.insertBefore(f,A.elm,i.nextSibling(E.elm)),A=m[++w],P=g[--T]):Ke(E,$)?(h(E,$,y),i.insertBefore(f,E.elm,A.elm),E=m[--x],$=g[++_]):(W===void 0&&(W=Hc(m,w,x)),j=W[$.key],dt(j)?(i.insertBefore(f,p($,y),A.elm),$=g[++_]):dt(W[P.key])?(i.insertBefore(f,p(P,y),i.nextSibling(E.elm)),P=g[--T]):(U=m[j],U.sel!==$.sel?i.insertBefore(f,p($,y),A.elm):(h(U,$,y),m[j]=void 0,i.insertBefore(f,U.elm,A.elm)),$=g[++_]));_<=T&&(X=g[T+1]==null?null:g[T+1].elm,o(f,X,g,_,T,y)),w<=x&&u(f,m,w,x)}function h(f,m,g){var y,w,_,x,A,E,T,$;let P=(y=m.data)===null||y===void 0?void 0:y.hook;(w=P?.prepatch)===null||w===void 0||w.call(P,f,m);let W=m.elm=f.elm;if(f===m)return;if(m.data!==void 0||re(m.text)&&m.text!==f.text){(_=m.data)!==null&&_!==void 0||(m.data={}),(x=f.data)!==null&&x!==void 0||(f.data={});for(let X=0;X<s.update.length;++X)s.update[X](f,m);(T=(E=(A=m.data)===null||A===void 0?void 0:A.hook)===null||E===void 0?void 0:E.update)===null||T===void 0||T.call(E,f,m)}let j=f.children,U=m.children;dt(m.text)?re(j)&&re(U)?j!==U&&d(W,j,U,g):re(U)?(re(f.text)&&i.setTextContent(W,""),o(W,null,U,0,U.length-1,g)):re(j)?u(W,j,0,j.length-1):re(f.text)&&i.setTextContent(W,""):f.text!==m.text&&(re(j)&&u(W,j,0,j.length-1),i.setTextContent(W,m.text)),($=P?.postpatch)===null||$===void 0||$.call(P,f,m)}return function(m,g){let y,w,_,x=[];for(y=0;y<s.pre.length;++y)s.pre[y]();for(Uc(i,m)?m=n(m):Kc(i,m)&&(m=a(m)),Ke(m,g)?h(m,g,x):(w=m.elm,_=i.parentNode(w),p(g,x),_!==null&&(i.insertBefore(_,g.elm,i.nextSibling(w)),u(_,[m],0,0))),y=0;y<x.length;++y)x[y].data.hook.insert(x[y]);for(y=0;y<s.post.length;++y)s.post[y]();return g}}function ln(e,t){let r,s,i=t.elm,n=e.data.class,a=t.data.class;if(!(!n&&!a)&&n!==a){n=n||{},a=a||{};for(s in n)n[s]&&!Object.prototype.hasOwnProperty.call(a,s)&&i.classList.remove(s);for(s in a)r=a[s],r!==n[s]&&i.classList[r?"add":"remove"](s)}}var pn={create:ln,update:ln};function cn(e,t){let r,s,i,n=t.elm,a=e.data.props,l=t.data.props;if(!(!a&&!l)&&a!==l){a=a||{},l=l||{};for(r in l)s=l[r],i=a[r],i!==s&&(r!=="value"||n[r]!==s)&&(n[r]=s)}}var un={create:cn,update:cn};var qc="http://www.w3.org/1999/xlink",Jc="http://www.w3.org/2000/xmlns/",Yc="http://www.w3.org/XML/1998/namespace";function dn(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 a=n[r];i[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(Yc,r,a):r.charCodeAt(5)===58?r.charCodeAt(1)===109?s.setAttributeNS(Jc,r,a):s.setAttributeNS(qc,r,a):s.setAttribute(r,a))}for(r in i)r in n||s.removeAttribute(r)}}var fn={create:dn,update:dn};var hn=typeof window?.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):setTimeout,Xc=function(e){hn(function(){hn(e)})},Sr=!1;function Zc(e,t,r){Xc(function(){e[t]=r})}function mn(e,t){let r,s,i=t.elm,n=e.data.style,a=t.data.style;if(!n&&!a||n===a)return;n=n||{},a=a||{};let l="delayed"in n;for(s in n)s in a||(s[0]==="-"&&s[1]==="-"?i.style.removeProperty(s):i.style[s]="");for(s in a)if(r=a[s],s==="delayed"&&a.delayed)for(let p in a.delayed)r=a.delayed[p],(!l||r!==n.delayed[p])&&Zc(i.style,p,r);else s!=="remove"&&r!==n[s]&&(s[0]==="-"&&s[1]==="-"?i.style.setProperty(s,r):i.style[s]=r)}function Qc(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 eu(e,t){let r=e.data.style;if(!r||!r.remove){t();return}Sr||(e.elm.offsetLeft,Sr=!0);let s,i=e.elm,n=0,a=r.remove,l=0,p=[];for(s in a)p.push(s),i.style[s]=a[s];let c=getComputedStyle(i)["transition-property"].split(", ");for(;n<c.length;++n)p.indexOf(c[n])!==-1&&l++;i.addEventListener("transitionend",function(u){u.target===i&&--l,l===0&&t()})}function tu(){Sr=!1}var yn={pre:tu,create:mn,update:mn,destroy:Qc,remove:eu};function gn(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++)gn(e[s],t,r)}function ru(e,t){let r=e.type,s=t.data.on;s&&s[r]&&gn(s[r],t,e)}function su(){return function e(t){ru(t,e.vnode)}}function Cr(e,t){let r=e.data.on,s=e.listener,i=e.elm,n=t&&t.data.on,a=t&&t.elm,l;if(r!==n){if(r&&s)if(n)for(l in r)n[l]||i.removeEventListener(l,s,!1);else for(l in r)i.removeEventListener(l,s,!1);if(n){let p=t.listener=e.listener||su();if(p.vnode=t,r)for(l in n)r[l]||a.addEventListener(l,p,!1);else for(l in n)a.addEventListener(l,p,!1)}}}var vn={create:Cr,update:Cr,destroy:Cr};var iu=()=>on([pn,un,fn,yn,vn]),bn=iu;function wn(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&&wn(n,i.children,i.sel)}}function _n(e,t,r){let s={},i,n,a;if(r!==void 0?(t!==null&&(s=t),Ce(r)?i=r:Ie(r)?n=r.toString():r&&r.sel&&(i=[r])):t!=null&&(Ce(t)?i=t:Ie(t)?n=t.toString():t&&t.sel?i=[t]:s=t),i!==void 0)for(a=0;a<i.length;++a)Ie(i[a])&&(i[a]=xe(void 0,void 0,void 0,i[a],void 0));return e.startsWith("svg")&&(e.length===3||e[3]==="."||e[3]==="#")&&wn(s,i,e),xe(e,s,i,n,void 0)}var nu=bn(),au=({handlers:e,methods:t,constants:r,schema:s,view:i,store:n},a)=>{if(!i)throw new Error("view is not defined");if(!s||typeof s!="object"||Array.isArray(s))throw new Error("schema is required. Define component metadata in .schema.yaml.");let l=s,{template:p,refs:o,styles:c}=i;Zs({schema:l,methodExports:Object.keys(t||{})});let u=l.componentName,d=l.propsSchema,h=d?.properties?[...new Set(Object.keys(d.properties).map(f=>Xe(f)))]:[];return rn({elementName:u,propsSchema:d,propsSchemaKeys:h,template:p,refs:o,styles:c,handlers:e,methods:t,constants:r,store:n,patch:nu,h:_n,deps:a})},Ir=au;var ou=e=>{let t={};return{once:(r,s)=>{t[r]||(t[r]=[]);let i=(...n)=>{s(...n),t[r]=t[r].filter(a=>a!==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)},showDropdownMenu: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.showDropdownMenu(r)},closeAll:async()=>{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.closeAll()}}},xn=ou;var lu=xn(),pu={globalUI:lu},An={components:pu};var Or={components:{accordionItem:{handlers:Tt,schema:ts,store:Lt,view:rs},breadcrumb:{handlers:Rt,schema:ss,store:Nt,view:is},dropdownMenu:{handlers:Pt,schema:ns,store:Vt,view:as},form:{handlers:Dt,schema:ls,store:Ft,view:Es},globalUi:{handlers:Ut,schema:ks,store:Kt,view:$s},navbar:{handlers:Ht,schema:Ss,store:Gt,view:Cs},pageOutline:{handlers:qt,schema:Os,store:Jt,view:Ts},popoverInput:{handlers:Yt,schema:Ls,store:Xt,view:Rs},select:{handlers:Zt,schema:Ns,store:Qt,view:Ps},sidebar:{handlers:er,schema:Vs,store:rr,view:Ds},sliderInput:{handlers:sr,schema:js,store:ir,view:Bs},table:{handlers:nr,schema:Ws,store:ar,view:Ms},tabs:{handlers:or,schema:zs,store:lr,view:Fs},tooltip:{handlers:Us,schema:Ks,store:pr,view:Hs},waveform:{handlers:cr,schema:qs,store:ur,view:Js}}};Object.keys(Or).forEach(e=>{Object.keys(Or[e]).forEach(t=>{let r=Or[e][t],s=Ir({...r},An[e]),i=r.schema?.componentName;if(!i)throw new Error(`[Build] Missing schema.componentName for ${e}/${t}. Define it in .schema.yaml.`);customElements.define(i,s)})});customElements.define("rtgl-button",Vr({}));customElements.define("rtgl-view",Wr({}));customElements.define("rtgl-text",zr({}));customElements.define("rtgl-image",Kr({}));customElements.define("rtgl-svg",Gr({}));customElements.define("rtgl-input",qr({}));customElements.define("rtgl-input-number",Jr({}));customElements.define("rtgl-textarea",Yr({}));customElements.define("rtgl-color-picker",Xr({}));customElements.define("rtgl-slider",Zr({}));customElements.define("rtgl-dialog",Qr({}));customElements.define("rtgl-popover",es({}));})();
1098
+ `,Dn=({host:e,cssText:t,createStyleSheet:r=()=>new CSSStyleSheet,createElement:s=i=>document.createElement(i)})=>{let i=e.attachShadow({mode:"open"}),n=r();n.replaceSync(Bu);let a=[n];if(t){let p=r();p.replaceSync(t),a.push(p)}i.adoptedStyleSheets=a;let l=s("div");return l.style.cssText="display: contents;",i.appendChild(l),l.parentNode||e.appendChild(l),e.style.display="contents",{shadow:i,renderTarget:l,adoptedStyleSheets:a}};var $t=(e,t=requestAnimationFrame)=>t(e);var Bn=({scheduleFrameFn:e=$t}={})=>({update:(t,r)=>{let s=t.data?.props||{},i=r.data?.props||{};if(!(JSON.stringify(s)!==JSON.stringify(i)))return;let a=r.elm;!a||typeof a.render!="function"||(a.setAttribute("isDirty","true"),e(()=>{if(a.render(),a.removeAttribute("isDirty"),a.handlers&&a.handlers.handleOnUpdate){let l={...a.deps,store:a.store,render:a.render.bind(a),handlers:a.handlers,dispatchEvent:a.dispatchEvent.bind(a),refs:a.refIds||{}};a.handlers.handleOnUpdate(l,{oldProps:s,newProps:i})}}))}});var jn=({elementName:e,propsSchema:t,propsSchemaKeys:r,template:s,refs:i,styles:n,handlers:a,methods:l,constants:p,store:o,patch:u,h:c,deps:d})=>{class h extends HTMLElement{elementName;styles;_snabbdomH;store;props;propsSchema;template;handlers;methods;constants;transformedHandlers={};refs;refIds={};patch;_unmountCallback;_globalListenersCleanup;_oldVNode;deps;_propsSchemaKeys=[];cssText;static get observedAttributes(){return["key"]}get viewData(){let g={};return this.store.selectViewData&&(g=this.store.selectViewData()),g}connectedCallback(){let g=Dn({host:this,cssText:this.cssText});this.shadow=g.shadow,this.renderTarget=g.renderTarget,Rn({instance:this,parseAndRenderFn:rt,renderFn:this.render})}disconnectedCallback(){Nn({instance:this,clearTimerFn:clearTimeout})}attributeChangedCallback(g,y,w){Vn({instance:this,attributeName:g,oldValue:y,newValue:w,scheduleFrameFn:$t})}render=()=>{Pn({instance:this,createComponentUpdateHookFn:Bn})}}class f extends h{static get observedAttributes(){return Cn({propsSchemaKeys:r,toKebabCase:Pr})}constructor(){super(),this.constants=cn({setupConstants:d?.constants,fileConstants:p}),this.propsSchema=t,this.props=t?Ri(this,r):{},this._propsSchemaKeys=r,this.elementName=e,this.styles=n,this.store=ln(o,this.props,this.constants),this.template=s,this.handlers=a,this.methods=l,this.refs=i,this.patch=u,this.deps={...d,store:this.store,render:this.render,handlers:a,props:this.props,constants:this.constants},qi(this,this.methods),this._snabbdomH=c,this.cssText=un(e,n)}}return f};function Ie(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 De=Array.isArray;function Be(e){return typeof e=="string"||typeof e=="number"||e instanceof String||e instanceof Number}function ju(e,t){return document.createElement(e,t)}function Fu(e,t,r){return document.createElementNS(e,t,r)}function Mu(){return Oe(document.createDocumentFragment())}function Wu(e){return document.createTextNode(e)}function zu(e){return document.createComment(e)}function Uu(e,t,r){if(ye(e)){let s=e;for(;s&&ye(s);)s=Oe(s).parent;e=s??e}ye(t)&&(t=Oe(t,e)),r&&ye(r)&&(r=Oe(r).firstChildNode),e.insertBefore(t,r)}function Ku(e,t){e.removeChild(t)}function Hu(e,t){ye(t)&&(t=Oe(t,e)),e.appendChild(t)}function Mn(e){if(ye(e)){for(;e&&ye(e);)e=Oe(e).parent;return e??null}return e.parentNode}function Gu(e){var t;if(ye(e)){let r=Oe(e),s=Mn(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 qu(e){return e.tagName}function Ju(e,t){e.textContent=t}function Yu(e){return e.textContent}function Xu(e){return e.nodeType===1}function Zu(e){return e.nodeType===3}function Qu(e){return e.nodeType===8}function ye(e){return e.nodeType===11}function Oe(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 Wn={createElement:ju,createElementNS:Fu,createTextNode:Wu,createDocumentFragment:Mu,createComment:zu,insertBefore:Uu,removeChild:Ku,appendChild:Hu,parentNode:Mn,nextSibling:Gu,tagName:qu,setTextContent:Ju,getTextContent:Yu,isElement:Xu,isText:Zu,isComment:Qu,isDocumentFragment:ye};function St(e){return e===void 0}function ne(e){return e!==void 0}var Yr=Ie("",{},[],void 0,void 0);function at(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),a=e.sel===t.sel,l=!e.sel&&e.sel===t.sel?typeof e.text==typeof t.text:!0;return a&&i&&n&&l}function ed(){throw new Error("The document fragment is not supported on this platform.")}function td(e,t){return e.isElement(t)}function rd(e,t){return e.isDocumentFragment(t)}function sd(e,t,r){var s;let i={};for(let n=t;n<=r;++n){let a=(s=e[n])===null||s===void 0?void 0:s.key;a!==void 0&&(i[a]=n)}return i}var id=["create","update","remove","destroy","pre","post"];function zn(e,t,r){let s={create:[],update:[],remove:[],destroy:[],pre:[],post:[]},i=t!==void 0?t:Wn;for(let f of id)for(let m of e){let g=m[f];g!==void 0&&s[f].push(g)}function n(f){let m=f.id?"#"+f.id:"",g=f.getAttribute("class"),y=g?"."+g.split(" ").join("."):"";return Ie(i.tagName(f).toLowerCase()+m+y,{},[],void 0,f)}function a(f){return Ie(void 0,{},[],void 0,f)}function l(f,m){return function(){if(--m===0){let y=i.parentNode(f);y!==null&&i.removeChild(y,f)}}}function p(f,m){var g,y,w,_;let x,E=f.data;if(E!==void 0){let $=(g=E.hook)===null||g===void 0?void 0:g.init;ne($)&&($(f),E=f.data)}let A=f.children,L=f.sel;if(L==="!")St(f.text)&&(f.text=""),f.elm=i.createComment(f.text);else if(L==="")f.elm=i.createTextNode(f.text);else if(L!==void 0){let $=L.indexOf("#"),V=L.indexOf(".",$),M=$>0?$:L.length,B=V>0?V:L.length,H=$!==-1||V!==-1?L.slice(0,Math.min(M,B)):L,te=f.elm=ne(E)&&ne(x=E.ns)?i.createElementNS(x,H,E):i.createElement(H,E);for(M<B&&te.setAttribute("id",L.slice(M+1,B)),V>0&&te.setAttribute("class",L.slice(B+1).replace(/\./g," ")),x=0;x<s.create.length;++x)s.create[x](Yr,f);if(Be(f.text)&&(!De(A)||A.length===0)&&i.appendChild(te,i.createTextNode(f.text)),De(A))for(x=0;x<A.length;++x){let xe=A[x];xe!=null&&i.appendChild(te,p(xe,m))}let ge=f.data.hook;ne(ge)&&((y=ge.create)===null||y===void 0||y.call(ge,Yr,f),ge.insert&&m.push(f))}else if(!((w=r?.experimental)===null||w===void 0)&&w.fragments&&f.children){for(f.elm=((_=i.createDocumentFragment)!==null&&_!==void 0?_:ed)(),x=0;x<s.create.length;++x)s.create[x](Yr,f);for(x=0;x<f.children.length;++x){let $=f.children[x];$!=null&&i.appendChild(f.elm,p($,m))}}else f.elm=i.createTextNode(f.text);return f.elm}function o(f,m,g,y,w,_){for(;y<=w;++y){let x=g[y];x!=null&&i.insertBefore(f,p(x,_),m)}}function u(f){var m,g;let y=f.data;if(y!==void 0){(g=(m=y?.hook)===null||m===void 0?void 0:m.destroy)===null||g===void 0||g.call(m,f);for(let w=0;w<s.destroy.length;++w)s.destroy[w](f);if(f.children!==void 0)for(let w=0;w<f.children.length;++w){let _=f.children[w];_!=null&&typeof _!="string"&&u(_)}}}function c(f,m,g,y){for(var w,_;g<=y;++g){let x,E,A=m[g];if(A!=null)if(ne(A.sel)){u(A),x=s.remove.length+1,E=l(A.elm,x);for(let $=0;$<s.remove.length;++$)s.remove[$](A,E);let L=(_=(w=A?.data)===null||w===void 0?void 0:w.hook)===null||_===void 0?void 0:_.remove;ne(L)?L(A,E):E()}else A.children?(u(A),c(f,A.children,0,A.children.length-1)):i.removeChild(f,A.elm)}}function d(f,m,g,y){let w=0,_=0,x=m.length-1,E=m[0],A=m[x],L=g.length-1,$=g[0],V=g[L],M,B,H,te;for(;w<=x&&_<=L;)E==null?E=m[++w]:A==null?A=m[--x]:$==null?$=g[++_]:V==null?V=g[--L]:at(E,$)?(h(E,$,y),E=m[++w],$=g[++_]):at(A,V)?(h(A,V,y),A=m[--x],V=g[--L]):at(E,V)?(h(E,V,y),i.insertBefore(f,E.elm,i.nextSibling(A.elm)),E=m[++w],V=g[--L]):at(A,$)?(h(A,$,y),i.insertBefore(f,A.elm,E.elm),A=m[--x],$=g[++_]):(M===void 0&&(M=sd(m,w,x)),B=M[$.key],St(B)?(i.insertBefore(f,p($,y),E.elm),$=g[++_]):St(M[V.key])?(i.insertBefore(f,p(V,y),i.nextSibling(A.elm)),V=g[--L]):(H=m[B],H.sel!==$.sel?i.insertBefore(f,p($,y),E.elm):(h(H,$,y),m[B]=void 0,i.insertBefore(f,H.elm,E.elm)),$=g[++_]));_<=L&&(te=g[L+1]==null?null:g[L+1].elm,o(f,te,g,_,L,y)),w<=x&&c(f,m,w,x)}function h(f,m,g){var y,w,_,x,E,A,L,$;let V=(y=m.data)===null||y===void 0?void 0:y.hook;(w=V?.prepatch)===null||w===void 0||w.call(V,f,m);let M=m.elm=f.elm;if(f===m)return;if(m.data!==void 0||ne(m.text)&&m.text!==f.text){(_=m.data)!==null&&_!==void 0||(m.data={}),(x=f.data)!==null&&x!==void 0||(f.data={});for(let te=0;te<s.update.length;++te)s.update[te](f,m);(L=(A=(E=m.data)===null||E===void 0?void 0:E.hook)===null||A===void 0?void 0:A.update)===null||L===void 0||L.call(A,f,m)}let B=f.children,H=m.children;St(m.text)?ne(B)&&ne(H)?B!==H&&d(M,B,H,g):ne(H)?(ne(f.text)&&i.setTextContent(M,""),o(M,null,H,0,H.length-1,g)):ne(B)?c(M,B,0,B.length-1):ne(f.text)&&i.setTextContent(M,""):f.text!==m.text&&(ne(B)&&c(M,B,0,B.length-1),i.setTextContent(M,m.text)),($=V?.postpatch)===null||$===void 0||$.call(V,f,m)}return function(m,g){let y,w,_,x=[];for(y=0;y<s.pre.length;++y)s.pre[y]();for(td(i,m)?m=n(m):rd(i,m)&&(m=a(m)),at(m,g)?h(m,g,x):(w=m.elm,_=i.parentNode(w),p(g,x),_!==null&&(i.insertBefore(_,g.elm,i.nextSibling(w)),c(_,[m],0,0))),y=0;y<x.length;++y)x[y].data.hook.insert(x[y]);for(y=0;y<s.post.length;++y)s.post[y]();return g}}function Un(e,t){let r,s,i=t.elm,n=e.data.class,a=t.data.class;if(!(!n&&!a)&&n!==a){n=n||{},a=a||{};for(s in n)n[s]&&!Object.prototype.hasOwnProperty.call(a,s)&&i.classList.remove(s);for(s in a)r=a[s],r!==n[s]&&i.classList[r?"add":"remove"](s)}}var Kn={create:Un,update:Un};function Hn(e,t){let r,s,i,n=t.elm,a=e.data.props,l=t.data.props;if(!(!a&&!l)&&a!==l){a=a||{},l=l||{};for(r in l)s=l[r],i=a[r],i!==s&&(r!=="value"||n[r]!==s)&&(n[r]=s)}}var Gn={create:Hn,update:Hn};var nd="http://www.w3.org/1999/xlink",ad="http://www.w3.org/2000/xmlns/",od="http://www.w3.org/XML/1998/namespace";function qn(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 a=n[r];i[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(od,r,a):r.charCodeAt(5)===58?r.charCodeAt(1)===109?s.setAttributeNS(ad,r,a):s.setAttributeNS(nd,r,a):s.setAttribute(r,a))}for(r in i)r in n||s.removeAttribute(r)}}var Jn={create:qn,update:qn};var Yn=typeof window?.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):setTimeout,ld=function(e){Yn(function(){Yn(e)})},Xr=!1;function pd(e,t,r){ld(function(){e[t]=r})}function Xn(e,t){let r,s,i=t.elm,n=e.data.style,a=t.data.style;if(!n&&!a||n===a)return;n=n||{},a=a||{};let l="delayed"in n;for(s in n)s in a||(s[0]==="-"&&s[1]==="-"?i.style.removeProperty(s):i.style[s]="");for(s in a)if(r=a[s],s==="delayed"&&a.delayed)for(let p in a.delayed)r=a.delayed[p],(!l||r!==n.delayed[p])&&pd(i.style,p,r);else s!=="remove"&&r!==n[s]&&(s[0]==="-"&&s[1]==="-"?i.style.setProperty(s,r):i.style[s]=r)}function cd(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 ud(e,t){let r=e.data.style;if(!r||!r.remove){t();return}Xr||(e.elm.offsetLeft,Xr=!0);let s,i=e.elm,n=0,a=r.remove,l=0,p=[];for(s in a)p.push(s),i.style[s]=a[s];let u=getComputedStyle(i)["transition-property"].split(", ");for(;n<u.length;++n)p.indexOf(u[n])!==-1&&l++;i.addEventListener("transitionend",function(c){c.target===i&&--l,l===0&&t()})}function dd(){Xr=!1}var Zn={pre:dd,create:Xn,update:Xn,destroy:cd,remove:ud};function Qn(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++)Qn(e[s],t,r)}function fd(e,t){let r=e.type,s=t.data.on;s&&s[r]&&Qn(s[r],t,e)}function hd(){return function e(t){fd(t,e.vnode)}}function Zr(e,t){let r=e.data.on,s=e.listener,i=e.elm,n=t&&t.data.on,a=t&&t.elm,l;if(r!==n){if(r&&s)if(n)for(l in r)n[l]||i.removeEventListener(l,s,!1);else for(l in r)i.removeEventListener(l,s,!1);if(n){let p=t.listener=e.listener||hd();if(p.vnode=t,r)for(l in n)r[l]||a.addEventListener(l,p,!1);else for(l in n)a.addEventListener(l,p,!1)}}}var ea={create:Zr,update:Zr,destroy:Zr};var md=()=>zn([Kn,Gn,Jn,Zn,ea]),ta=md;function ra(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&&ra(n,i.children,i.sel)}}function sa(e,t,r){let s={},i,n,a;if(r!==void 0?(t!==null&&(s=t),De(r)?i=r:Be(r)?n=r.toString():r&&r.sel&&(i=[r])):t!=null&&(De(t)?i=t:Be(t)?n=t.toString():t&&t.sel?i=[t]:s=t),i!==void 0)for(a=0;a<i.length;++a)Be(i[a])&&(i[a]=Ie(void 0,void 0,void 0,i[a],void 0));return e.startsWith("svg")&&(e.length===3||e[3]==="."||e[3]==="#")&&ra(s,i,e),Ie(e,s,i,n,void 0)}var yd=ta(),gd=({handlers:e,methods:t,constants:r,schema:s,view:i,store:n},a)=>{if(!i)throw new Error("view is not defined");if(!s||typeof s!="object"||Array.isArray(s))throw new Error("schema is required. Define component metadata in .schema.yaml.");let l=s,{template:p,refs:o,styles:u}=i;Ni({schema:l,methodExports:Object.keys(t||{})});let c=l.componentName,d=l.propsSchema,h=d?.properties?[...new Set(Object.keys(d.properties).map(f=>dt(f)))]:[];return jn({elementName:c,propsSchema:d,propsSchemaKeys:h,template:p,refs:o,styles:u,handlers:e,methods:t,constants:r,store:n,patch:yd,h:sa,deps:a})},Qr=gd;var bd=e=>{let t={};return{once:(r,s)=>{t[r]||(t[r]=[]);let i=(...n)=>{s(...n),t[r]=t[r].filter(a=>a!==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.handleShowAlert(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.handleShowConfirm(r)},showDropdownMenu: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.handleShowDropdownMenu(r)},closeAll:async()=>{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.handleCloseAll()}}},ia=bd;var vd=ia(),wd={globalUI:vd},na={components:wd};var es={components:{accordionItem:{handlers:Xt,schema:Ts,store:Zt,view:Ls},breadcrumb:{handlers:Qt,schema:Rs,store:er,view:Ns},dropdownMenu:{handlers:tr,schema:Vs,store:rr,view:Ps},form:{handlers:dr,methods:fr,schema:ii,store:ur,view:ni},globalUi:{handlers:hr,schema:ai,store:mr,view:oi},navbar:{handlers:yr,schema:li,store:gr,view:pi},pageOutline:{handlers:br,schema:ui,store:vr,view:di},popoverInput:{handlers:wr,schema:hi,store:_r,view:mi},select:{handlers:xr,schema:yi,store:Er,view:gi},sidebar:{handlers:Ar,schema:bi,store:$r,view:vi},sliderInput:{handlers:Sr,schema:wi,store:Cr,view:_i},table:{handlers:Ir,schema:xi,store:Or,view:Ei},tabs:{handlers:Tr,schema:Ai,store:Lr,view:ki},tooltip:{handlers:$i,schema:Si,store:Rr,view:Ci},waveform:{handlers:Nr,schema:Oi,store:Vr,view:Ti}}};Object.keys(es).forEach(e=>{Object.keys(es[e]).forEach(t=>{let r=es[e][t],s=Qr({...r},na[e]),i=r.schema?.componentName;if(!i)throw new Error(`[Build] Missing schema.componentName for ${e}/${t}. Define it in .schema.yaml.`);customElements.define(i,s)})});customElements.define("rtgl-button",ps({}));customElements.define("rtgl-view",fs({}));customElements.define("rtgl-text",ms({}));customElements.define("rtgl-image",bs({}));customElements.define("rtgl-svg",ws({}));customElements.define("rtgl-input",be({}));customElements.define("rtgl-input-date",_s({}));customElements.define("rtgl-input-time",xs({}));customElements.define("rtgl-input-datetime",Es({}));customElements.define("rtgl-input-number",As({}));customElements.define("rtgl-textarea",ks({}));customElements.define("rtgl-color-picker",$s({}));customElements.define("rtgl-slider",Ss({}));customElements.define("rtgl-checkbox",Cs({}));customElements.define("rtgl-dialog",Is({}));customElements.define("rtgl-popover",Os({}));})();