@granularjs/ui 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,31 +1,31 @@
1
- var jt="granular-ui-styles",na=new URL("./fonts/Poppins-400.ttf",import.meta.url).href,sa=new URL("./fonts/Poppins-500.ttf",import.meta.url).href,ua=new URL("./fonts/Poppins-600.ttf",import.meta.url).href,ga=new URL("./fonts/Poppins-700.ttf",import.meta.url).href,la=new URL("./fonts/Arimo-400.ttf",import.meta.url).href,ca=new URL("./fonts/Arimo-500.ttf",import.meta.url).href,pa=new URL("./fonts/Arimo-600.ttf",import.meta.url).href,da=new URL("./fonts/Arimo-700.ttf",import.meta.url).href,ma=new URL("./fonts/Inter-400.woff2",import.meta.url).href,fa=new URL("./fonts/Inter-500.woff2",import.meta.url).href,va=new URL("./fonts/Inter-600.woff2",import.meta.url).href,ha=new URL("./fonts/Inter-700.woff2",import.meta.url).href,ba=`
1
+ var jt="granular-ui-styles",sa=new URL("./fonts/Poppins-400.ttf",import.meta.url).href,ua=new URL("./fonts/Poppins-500.ttf",import.meta.url).href,ga=new URL("./fonts/Poppins-600.ttf",import.meta.url).href,la=new URL("./fonts/Poppins-700.ttf",import.meta.url).href,ca=new URL("./fonts/Arimo-400.ttf",import.meta.url).href,pa=new URL("./fonts/Arimo-500.ttf",import.meta.url).href,da=new URL("./fonts/Arimo-600.ttf",import.meta.url).href,ma=new URL("./fonts/Arimo-700.ttf",import.meta.url).href,fa=new URL("./fonts/Inter-400.woff2",import.meta.url).href,ha=new URL("./fonts/Inter-500.woff2",import.meta.url).href,va=new URL("./fonts/Inter-600.woff2",import.meta.url).href,ba=new URL("./fonts/Inter-700.woff2",import.meta.url).href,xa=`
2
2
  @font-face {
3
3
  font-family: 'Poppins';
4
4
  font-style: normal;
5
5
  font-weight: 400;
6
6
  font-display: swap;
7
- src: url('${na}') format('truetype');
7
+ src: url('${sa}') format('truetype');
8
8
  }
9
9
  @font-face {
10
10
  font-family: 'Poppins';
11
11
  font-style: normal;
12
12
  font-weight: 500;
13
13
  font-display: swap;
14
- src: url('${sa}') format('truetype');
14
+ src: url('${ua}') format('truetype');
15
15
  }
16
16
  @font-face {
17
17
  font-family: 'Poppins';
18
18
  font-style: normal;
19
19
  font-weight: 600;
20
20
  font-display: swap;
21
- src: url('${ua}') format('truetype');
21
+ src: url('${ga}') format('truetype');
22
22
  }
23
23
  @font-face {
24
24
  font-family: 'Poppins';
25
25
  font-style: normal;
26
26
  font-weight: 700;
27
27
  font-display: swap;
28
- src: url('${ga}') format('truetype');
28
+ src: url('${la}') format('truetype');
29
29
  }
30
30
 
31
31
  @font-face {
@@ -33,28 +33,28 @@ var jt="granular-ui-styles",na=new URL("./fonts/Poppins-400.ttf",import.meta.url
33
33
  font-style: normal;
34
34
  font-weight: 400;
35
35
  font-display: swap;
36
- src: url('${la}') format('truetype');
36
+ src: url('${ca}') format('truetype');
37
37
  }
38
38
  @font-face {
39
39
  font-family: 'Arimo';
40
40
  font-style: normal;
41
41
  font-weight: 500;
42
42
  font-display: swap;
43
- src: url('${ca}') format('truetype');
43
+ src: url('${pa}') format('truetype');
44
44
  }
45
45
  @font-face {
46
46
  font-family: 'Arimo';
47
47
  font-style: normal;
48
48
  font-weight: 600;
49
49
  font-display: swap;
50
- src: url('${pa}') format('truetype');
50
+ src: url('${da}') format('truetype');
51
51
  }
52
52
  @font-face {
53
53
  font-family: 'Arimo';
54
54
  font-style: normal;
55
55
  font-weight: 700;
56
56
  font-display: swap;
57
- src: url('${da}') format('truetype');
57
+ src: url('${ma}') format('truetype');
58
58
  }
59
59
 
60
60
  @font-face {
@@ -62,14 +62,14 @@ var jt="granular-ui-styles",na=new URL("./fonts/Poppins-400.ttf",import.meta.url
62
62
  font-style: normal;
63
63
  font-weight: 400;
64
64
  font-display: swap;
65
- src: url('${ma}') format('woff2');
65
+ src: url('${fa}') format('woff2');
66
66
  }
67
67
  @font-face {
68
68
  font-family: 'Inter';
69
69
  font-style: normal;
70
70
  font-weight: 500;
71
71
  font-display: swap;
72
- src: url('${fa}') format('woff2');
72
+ src: url('${ha}') format('woff2');
73
73
  }
74
74
  @font-face {
75
75
  font-family: 'Inter';
@@ -83,7 +83,7 @@ var jt="granular-ui-styles",na=new URL("./fonts/Poppins-400.ttf",import.meta.url
83
83
  font-style: normal;
84
84
  font-weight: 700;
85
85
  font-display: swap;
86
- src: url('${ha}') format('woff2');
86
+ src: url('${ba}') format('woff2');
87
87
  }
88
88
 
89
89
  :root {
@@ -1795,6 +1795,8 @@ body .g-ui-card-shadow-lg { box-shadow: var(--g-ui-shadow-lg); }
1795
1795
  align-self: flex-start;
1796
1796
  justify-self: end;
1797
1797
  color: currentColor;
1798
+ position: relative;
1799
+ left: 3px;
1798
1800
  }
1799
1801
  .g-ui-list-unordered > li:not(.g-ui-list-nested-item)::before {
1800
1802
  content: '\u2022';
@@ -2117,10 +2119,16 @@ body .g-ui-card-shadow-lg { box-shadow: var(--g-ui-shadow-lg); }
2117
2119
  gap: 0;
2118
2120
  position: relative;
2119
2121
  }
2122
+ .g-ui-timeline[data-active-color="primary"] { --g-ui-timeline-active-color: var(--g-ui-primary); }
2123
+ .g-ui-timeline[data-active-color="success"] { --g-ui-timeline-active-color: var(--g-ui-success); }
2124
+ .g-ui-timeline[data-active-color="danger"] { --g-ui-timeline-active-color: var(--g-ui-danger); }
2125
+ .g-ui-timeline[data-active-color="error"] { --g-ui-timeline-active-color: var(--g-ui-danger); }
2126
+ .g-ui-timeline[data-active-color="warning"] { --g-ui-timeline-active-color: var(--g-ui-warning); }
2127
+ .g-ui-timeline[data-active-color="info"] { --g-ui-timeline-active-color: var(--g-ui-info); }
2120
2128
  .g-ui-timeline-track-segment {
2121
2129
  position: absolute;
2122
- left: 8px;
2123
- width: 4px;
2130
+ left: var(--g-ui-timeline-track-offset, 12px);
2131
+ width: var(--g-ui-timeline-line-width, 4px);
2124
2132
  background: var(--g-ui-border-muted);
2125
2133
  border-radius: 2px;
2126
2134
  z-index: 0;
@@ -2134,11 +2142,19 @@ body .g-ui-card-shadow-lg { box-shadow: var(--g-ui-shadow-lg); }
2134
2142
  width: 100%;
2135
2143
  height: 0%;
2136
2144
  min-height: 0;
2137
- background: var(--g-ui-primary);
2138
- border-radius: 2px;
2145
+ background: var(--g-ui-timeline-active-color, var(--g-ui-primary));
2146
+ border-radius: inherit;
2139
2147
  transition: height 0.25s ease;
2140
2148
  z-index: 1;
2141
2149
  }
2150
+ .g-ui-timeline-reverse .g-ui-timeline-track-fill {
2151
+ top: auto;
2152
+ bottom: 0;
2153
+ }
2154
+ .g-ui-timeline-align-right .g-ui-timeline-track-segment {
2155
+ left: auto;
2156
+ right: var(--g-ui-timeline-track-offset, 12px);
2157
+ }
2142
2158
  .g-ui-timeline-has-track .g-ui-timeline-item::before {
2143
2159
  display: none;
2144
2160
  }
@@ -2151,20 +2167,48 @@ body .g-ui-card-shadow-lg { box-shadow: var(--g-ui-shadow-lg); }
2151
2167
  padding-bottom: var(--g-ui-space-24);
2152
2168
  z-index: 1;
2153
2169
  }
2170
+ .g-ui-timeline-item .g-ui-timeline-dot {
2171
+ justify-self: center;
2172
+ }
2173
+ .g-ui-timeline-align-right {
2174
+ width: max-content;
2175
+ max-width: 100%;
2176
+ }
2177
+ .g-ui-timeline-align-right .g-ui-timeline-item {
2178
+ grid-template-columns: auto 28px;
2179
+ max-width: 100%;
2180
+ }
2181
+ .g-ui-timeline-align-right .g-ui-timeline-item .g-ui-timeline-dot {
2182
+ order: 2;
2183
+ justify-self: center;
2184
+ }
2185
+ .g-ui-timeline-align-right .g-ui-timeline-item .g-ui-timeline-content {
2186
+ order: 1;
2187
+ justify-self: end;
2188
+ text-align: right;
2189
+ min-width: 0;
2190
+ }
2191
+ .g-ui-timeline-align-right .g-ui-timeline-item::before {
2192
+ left: auto;
2193
+ right: var(--g-ui-timeline-track-offset, 12px);
2194
+ }
2154
2195
  .g-ui-timeline-item:last-child {
2155
2196
  padding-bottom: 0;
2156
2197
  }
2157
2198
  .g-ui-timeline-item::before {
2158
2199
  content: '';
2159
2200
  position: absolute;
2160
- left: 8px;
2161
- top: 20px;
2201
+ left: var(--g-ui-timeline-track-offset, 12px);
2202
+ top: var(--g-ui-timeline-pin-half, 10px);
2162
2203
  bottom: 0;
2163
- width: 4px;
2204
+ width: var(--g-ui-timeline-line-width, 4px);
2164
2205
  background: var(--g-ui-border-muted);
2165
2206
  }
2166
2207
  .g-ui-timeline-item:last-child::before {
2167
2208
  display: none;
2209
+ }
2210
+ .g-ui-dot-wrapper {
2211
+
2168
2212
  }
2169
2213
  .g-ui-timeline-dot {
2170
2214
  width: 20px;
@@ -2176,15 +2220,68 @@ body .g-ui-card-shadow-lg { box-shadow: var(--g-ui-shadow-lg); }
2176
2220
  position: relative;
2177
2221
  z-index: 1;
2178
2222
  transition: border-color 0.2s ease, background 0.2s ease;
2223
+ display: flex;
2224
+ align-items: center;
2225
+ justify-content: center;
2226
+ }
2227
+ .g-ui-timeline-pin-size-xs .g-ui-timeline-dot { width: 12px; height: 12px; border-width: 2px; }
2228
+ .g-ui-timeline-pin-size-sm .g-ui-timeline-dot { width: 16px; height: 16px; border-width: 3px; }
2229
+ .g-ui-timeline-pin-size-md .g-ui-timeline-dot { width: 20px; height: 20px; border-width: 4px; }
2230
+ .g-ui-timeline-pin-size-lg .g-ui-timeline-dot { width: 24px; height: 24px; border-width: 4px; }
2231
+ .g-ui-timeline-pin-size-xl .g-ui-timeline-dot { width: 28px; height: 28px; border-width: 4px; }
2232
+ .g-ui-timeline-pin-radius-xs .g-ui-timeline-dot { border-radius: 2px; }
2233
+ .g-ui-timeline-pin-radius-sm .g-ui-timeline-dot { border-radius: 4px; }
2234
+ .g-ui-timeline-pin-radius-md .g-ui-timeline-dot { border-radius: 50%; }
2235
+ .g-ui-timeline-pin-radius-lg .g-ui-timeline-dot { border-radius: 50%; }
2236
+ .g-ui-timeline-pin-radius-xl .g-ui-timeline-dot { border-radius: 50%; }
2237
+ .g-ui-timeline-dot-inner {
2238
+ width: 100%;
2239
+ height: 100%;
2240
+ border-radius: inherit;
2241
+ background: inherit;
2242
+ position: absolute;
2243
+ inset: 0;
2244
+ }
2245
+ .g-ui-timeline-pin-mode-icon .g-ui-timeline-dot,
2246
+ .g-ui-timeline-pin-mode-image .g-ui-timeline-dot,
2247
+ .g-ui-timeline-pin-mode-custom .g-ui-timeline-dot {
2248
+ display: flex;
2249
+ align-items: center;
2250
+ justify-content: center;
2251
+ }
2252
+ .g-ui-timeline-pin-mode-icon .g-ui-timeline-dot .g-ui-timeline-pin-icon,
2253
+ .g-ui-timeline-pin-mode-image .g-ui-timeline-dot .g-ui-timeline-pin-image,
2254
+ .g-ui-timeline-pin-mode-custom .g-ui-timeline-dot > *:not(.g-ui-timeline-dot-inner) {
2255
+ position: relative;
2256
+ z-index: 1;
2257
+ }
2258
+ .g-ui-timeline-pin-mode-icon .g-ui-timeline-dot .g-ui-timeline-pin-icon {
2259
+ font-size: 12px;
2260
+ line-height: 1;
2261
+ color: inherit;
2262
+ }
2263
+ .g-ui-timeline-pin-size-sm .g-ui-timeline-pin-mode-icon .g-ui-timeline-dot .g-ui-timeline-pin-icon { font-size: 10px; }
2264
+ .g-ui-timeline-pin-size-lg .g-ui-timeline-dot .g-ui-timeline-pin-icon { font-size: 14px; }
2265
+ .g-ui-timeline-pin-size-xl .g-ui-timeline-dot .g-ui-timeline-pin-icon { font-size: 16px; }
2266
+ .g-ui-timeline-pin-mode-icon .g-ui-timeline-dot .g-ui-timeline-dot-inner,
2267
+ .g-ui-timeline-pin-mode-image .g-ui-timeline-dot .g-ui-timeline-dot-inner,
2268
+ .g-ui-timeline-pin-mode-custom .g-ui-timeline-dot .g-ui-timeline-dot-inner {
2269
+ display: none;
2270
+ }
2271
+ .g-ui-timeline-pin-mode-image .g-ui-timeline-dot .g-ui-timeline-pin-image {
2272
+ width: 100%;
2273
+ height: 100%;
2274
+ object-fit: cover;
2275
+ border-radius: inherit;
2179
2276
  }
2180
2277
  .g-ui-timeline-item-completed .g-ui-timeline-dot {
2181
- border-color: var(--g-ui-primary);
2182
- background: var(--g-ui-primary);
2278
+ border-color: var(--g-ui-timeline-active-color, var(--g-ui-primary));
2279
+ background: var(--g-ui-timeline-active-color, var(--g-ui-primary));
2183
2280
  }
2184
2281
  .g-ui-timeline-item-active .g-ui-timeline-dot {
2185
- border-color: var(--g-ui-primary);
2282
+ border-color: var(--g-ui-timeline-active-color, var(--g-ui-primary));
2186
2283
  background: var(--g-ui-bg);
2187
- box-shadow: 0 0 0 2px var(--g-ui-bg), 0 0 0 4px var(--g-ui-primary);
2284
+ box-shadow: 0 0 0 2px var(--g-ui-bg), 0 0 0 4px var(--g-ui-timeline-active-color, var(--g-ui-primary));
2188
2285
  }
2189
2286
  .g-ui-timeline-item-future .g-ui-timeline-dot {
2190
2287
  border-color: var(--g-ui-border-muted);
@@ -2194,7 +2291,7 @@ body .g-ui-card-shadow-lg { box-shadow: var(--g-ui-shadow-lg); }
2194
2291
  cursor: pointer;
2195
2292
  }
2196
2293
  .g-ui-timeline-clickable .g-ui-timeline-item:hover .g-ui-timeline-dot {
2197
- border-color: var(--g-ui-primary-muted, var(--g-ui-primary));
2294
+ border-color: var(--g-ui-primary-muted, var(--g-ui-timeline-active-color));
2198
2295
  }
2199
2296
  .g-ui-timeline-content {
2200
2297
  display: flex;
@@ -4022,5 +4119,5 @@ body .g-ui-card-shadow-lg { box-shadow: var(--g-ui-shadow-lg); }
4022
4119
  @keyframes g-ui-spin { to { transform: rotate(360deg); } }
4023
4120
  @keyframes g-ui-bounce { 0%, 100% { transform: translateY(0); opacity: .6; } 50% { transform: translateY(-5px); opacity: 1; } }
4024
4121
  @keyframes g-ui-bars { 0%, 100% { transform: scaleY(.6); } 50% { transform: scaleY(1.2); } }
4025
- `;function Rt(){if(typeof document>"u"||document.getElementById(jt))return;let e=document.createElement("style");e.id=jt,e.textContent=ba,document.head.appendChild(e)}var xa=new Set(["--g-ui-bg","--g-ui-bg-subtle","--g-ui-bg-muted","--g-ui-bg-emphasized","--g-ui-bg-inverted","--g-ui-bg-panel","--g-ui-fg","--g-ui-fg-muted","--g-ui-fg-subtle","--g-ui-fg-inverted","--g-ui-border","--g-ui-border-subtle","--g-ui-border-emphasized","--g-ui-border-inverted","--g-ui-primary","--g-ui-primary-hover","--g-ui-primary-active","--g-ui-primary-subtle","--g-ui-primary-muted","--g-ui-primary-emphasized","--g-ui-success","--g-ui-success-hover","--g-ui-success-active","--g-ui-success-subtle","--g-ui-success-muted","--g-ui-danger","--g-ui-danger-hover","--g-ui-danger-active","--g-ui-danger-subtle","--g-ui-danger-muted","--g-ui-warning","--g-ui-warning-hover","--g-ui-warning-active","--g-ui-warning-subtle","--g-ui-warning-muted","--g-ui-info","--g-ui-info-hover","--g-ui-info-active","--g-ui-info-subtle","--g-ui-info-muted","--g-ui-shadow-xs","--g-ui-shadow-sm","--g-ui-shadow-md","--g-ui-shadow-lg","--g-ui-shadow-xl","--g-ui-shadow-2xl","--g-ui-radius","--g-ui-font","--g-ui-surface","--g-ui-text","--g-ui-muted","--g-ui-primary-strong","--g-ui-shadow"]);function wa(e={},i=document?.documentElement){if(i)for(let[t,r]of Object.entries(e)){let a=t.startsWith("--")?t:`--g-ui-${t}`;xa.has(a)&&i.style.setProperty(a,String(r))}}function ya(e="dark",i=document?.documentElement){i&&(i.classList.remove("g-ui-theme-dark","g-ui-theme-light"),i.classList.add(e==="light"?"g-ui-theme-light":"g-ui-theme-dark"))}function ka(e=document?.documentElement){return e.classList.contains("g-ui-theme-light")?"light":"dark"}import{Renderer as Ht,isSignal as Ot,isState as Wt,isStatePath as qt,isComputed as Yt,resolve as Ee,computed as za,after as Wi,concat as Na}from"@granularjs/core";function qi(e){return Ot(e)||Wt(e)||qt(e)||Yt(e)}function s(...e){return Na(...e,{separator:" ",filterFalsy:!0})}function Gt(e){if(!(e==null||e===""))return typeof e=="number"?`${e}px`:e}function g(e,i){let t={},r=[],a=o=>!!o&&typeof o=="object"&&!Array.isArray(o)&&!Ht.isRenderable(o)&&!Ht.isDomNode(o)&&!Ot(o)&&!Wt(o)&&!qt(o)&&!Yt(o);for(let o of e)a(o)?Object.assign(t,o):r.push(o);if(i&&typeof i=="object")for(let o of Object.keys(i))t[o]===void 0&&(t[o]=i[o]);return{props:za(t),rawProps:t,children:r}}function m(e){return Ee(e)}function ye(e){return!!Ee(e)}function D(e,i,t){let r=a=>{let o=Ee(a),n=o==null||o===""?t:o;return n==null||n===""?"":`${e}${n}`};return qi(i)?Wi(i).compute(a=>r(a)):r(i)}function Y(e,i){return qi(i)?Wi(i).compute(t=>Ee(t)?e:""):Ee(i)?e:""}function me(e,i,t){let r=a=>i[a]||null;return qi(e)?Wi(e).compute(a=>r(Ee(a??t))):r(Ee(e??t))}import{Button as Ca,Span as Yi,when as Gi,after as Sa}from"@granularjs/core";function Zi(...e){let{props:i,children:t}=g(e,{variant:"filled",size:"md",justify:"center"}),{variant:r,color:a,size:o,fullWidth:n,loading:u,leftSection:c,rightSection:d,className:p,disabled:x,justify:f,...l}=i,w=Sa(x,u).compute(([z,I])=>z||I);return Ca({...l,disabled:w,className:s("g-ui-button",D("g-ui-button-variant-",r,"filled"),D("g-ui-button-color-",a,"primary"),D("g-ui-justify-",f,"center"),D("g-ui-button-size-",o,"md"),Y("g-ui-button-full",n),Y("g-ui-button-loading",u),p)},Gi(c,()=>Yi({className:"g-ui-button-section-left"},c)),Gi(u,()=>Yi("Loading..."),()=>t),Gi(d,()=>Yi({className:"g-ui-button-section-right"},d)))}import{Span as Da}from"@granularjs/core";function Ui(...e){let{props:i,children:t}=g(e,{size:"md"}),{size:r,weight:a,color:o,dimmed:n,align:u,ellipsis:c,decoration:d,className:p,style:x,...f}=i,l=me(a,{bold:"g-ui-text-weight-700",semibold:"g-ui-text-weight-600",medium:"g-ui-text-weight-500",700:"g-ui-text-weight-700",600:"g-ui-text-weight-600",500:"g-ui-text-weight-500",400:"g-ui-text-weight-400"}),w=me(o,{primary:"g-ui-text-primary",success:"g-ui-text-success",danger:"g-ui-text-danger",muted:"g-ui-text-dimmed"}),z=me(u,{center:"g-ui-text-align-center",right:"g-ui-text-align-right",left:"g-ui-text-align-left"}),I=me(d,{underline:"g-ui-text-decoration-underline","line-through":"g-ui-text-decoration-line-through",overline:"g-ui-text-decoration-overline",none:"g-ui-text-decoration-none"});return Da({...f,style:x,className:s("g-ui-text",D("g-ui-text-size-",r,"md"),Y("g-ui-text-dimmed",n),Y("g-ui-text-ellipsis",c),l,w,z,I,p)},t)}import{H1 as Pa,H2 as Zt,H3 as Ma,H4 as Ta,H5 as Va,H6 as La}from"@granularjs/core";var $a={1:Pa,2:Zt,3:Ma,4:Ta,5:Va,6:La};function Ia(...e){let{props:i,children:t}=g(e,{order:2}),{order:r,className:a,style:o,...n}=i,u=m(r)||2;return($a[u]||Zt)({...n,className:s("g-ui-title",D("g-ui-title-order-",r,2),a)},t)}import{Div as Aa}from"@granularjs/core";function Ba(...e){let{props:i,children:t}=g(e,{size:"md"}),{size:r,fluid:a,className:o,style:n,...u}=i;return Aa({...u,style:n,className:s("g-ui-container",Y("g-ui-container-fluid",a),D("g-ui-container-size-",r,"md"),o)},t)}import{Div as Fa}from"@granularjs/core";function Ea(...e){let{props:i,children:t}=g(e,{gap:"md"}),{gap:r,align:a,justify:o,className:n,style:u,...c}=i,d=me(o,{between:"g-ui-justify-between",center:"g-ui-justify-center",end:"g-ui-justify-end",start:"g-ui-justify-start"});return Fa({...c,style:u,className:s("g-ui-stack",D("g-ui-gap-",r,"md"),D("g-ui-align-",a),d,n)},t)}import{Div as ja}from"@granularjs/core";function Ra(...e){let{props:i,children:t}=g(e,{gap:"md",align:"center"}),{gap:r,align:a,justify:o,position:n,noWrap:u,className:c,style:d,...p}=i,x=me(n,{apart:"g-ui-justify-between",center:"g-ui-justify-center",right:"g-ui-justify-end",left:"g-ui-justify-start"});return ja({...p,style:d,className:s("g-ui-group",D("g-ui-gap-",r,"md"),D("g-ui-align-",a,"center"),D("g-ui-justify-",o,"none"),x,Y("g-ui-no-wrap",u),c)},t)}import{Div as hi,list as Ha,when as _i,after as Ut}from"@granularjs/core";function Oa(...e){let{props:i,children:t}=g(e,{padding:"md",radius:"md",shadow:"none",border:"default"}),{title:r,content:a,actions:o,border:n,padding:u,radius:c,shadow:d,className:p,style:x,...f}=i;return hi({style:x},_i(r,()=>hi({className:"g-ui-card-title"},r)),_i(a,()=>hi({className:"g-ui-card-content"},a)),{className:s("g-ui-card",D("g-ui-card-border-",n,"md"),D("g-ui-card-padding-",u,"md"),D("g-ui-card-radius-",c,"md"),D("g-ui-card-shadow-",d,"md"),p),...f},t,_i(o,()=>hi({className:"g-ui-card-actions"},Ha(o,l=>Zi({className:"g-ui-card-action",onClick:w=>l.get().onClick?.(w),leftSection:l.leftSection,rightSection:l.rightSection,size:Ut(l.size).compute(w=>w||"sm"),variant:Ut(l.variant).compute(w=>w||"outline"),...l.get().props||{}},l.label)))))}import{Span as Wa}from"@granularjs/core";function qa(...e){let{props:i,children:t}=g(e,{variant:"filled",size:"md"}),{variant:r,size:a,className:o,dot:n,style:u,...c}=i,d=me(r,{dot:"g-ui-badge-dot"});return Wa({...c,className:s("g-ui-badge",D("g-ui-badge-variant-",r,"filled"),D("g-ui-badge-size-",a,"md"),Y("g-ui-badge-dot",n),d,o)},t)}import{Div as Je,Input as Ya,Textarea as Ga,Label as Za,Span as Ua,when as ei,state as _a,after as Xa,isState as Ka}from"@granularjs/core";function fe(...e){let{props:i,rawProps:t}=g(e,{size:"md"}),{label:r,description:a,error:o,size:n,leftSection:u,rightSection:c,className:d,inputClassName:p,multiline:x,value:f,...l}=i,{value:w,node:z,onChange:I,onInput:M,onFocus:C,onBlur:T,onKeyDown:S,onKeyUp:h,onClick:y}=t,v=Ka(w)&&!I&&!M,P=v?w:_a(m(f)??"");Xa(f).change(ne=>{v||P.set(m(ne)??"")});let N=ne=>{let ee=ne?.target?.value??"";ee!==f.get()&&(P.set(ee),I?.(ne),M?.(ne))},L=ye(x),G=L?Ga:Ya,Q=s(p,L&&"g-ui-textarea"),J=G({...l,node:z,value:P,onInput:N,onChange:N,onFocus:C,onBlur:T,onKeyDown:S,onKeyUp:h,onClick:y,className:s("g-ui-input",Q)});return Je({className:s("g-ui-text-input",d)},ei(r,()=>Za({className:"g-ui-text-input-label"},r)),ei(a,()=>Ua({className:"g-ui-text-input-description"},a)),Je({className:s("g-ui-input-wrapper",Y("g-ui-input-multiline",x),D("g-ui-input-size-",n,"md"),Y("g-ui-input-error",o))},ei(u,()=>Je({className:"g-ui-input-section"},u)),J,ei(c,()=>Je({className:"g-ui-input-section"},c))),ei(o,()=>Je({className:"g-ui-text-input-error-text"},o)))}function Xi(...e){let{props:i}=g(e,{size:"md"}),{size:t,leftSection:r,rightSection:a,className:o,...n}=i;return fe({...n,size:t,className:o,leftSection:r,rightSection:a,multiline:!0})}import{Div as _t,Span as Xt,after as je,state as Qa}from"@granularjs/core";function Ki(...e){let{props:i,rawProps:t}=g(e,{size:"md",step:1,allowDecimal:!0,allowNegative:!0,clampBehavior:"blur",hideControls:!1,decimalSeparator:".",thousandSeparator:"",format:null,prefix:"",suffix:""}),{value:r,min:a,max:o,step:n,size:u,allowDecimal:c,allowNegative:d,decimalSeparator:p,thousandSeparator:x,decimalScale:f,clampBehavior:l,hideControls:w,format:z,locale:I,currency:M,formatOptions:C,prefix:T,suffix:S,leftSection:h,rightSection:y,className:v,onChange:P,onInput:N,...L}=i,{onChange:G,onInput:Q,onBlur:J,onFocus:ne,onKeyDown:ee}=t,se=A=>{G?.(A.target?.value??""),Q?.(A.target?.value??"")},ge=se,re=Qa(""),$=A=>String(A??"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),O=()=>{if(!!!m(c))return 0;let V=m(f);if(V!=null&&V!==""&&Number.isFinite(Number(V)))return Math.max(0,Number(V));let H=m(z);return H==="currency"||H==="percent"?2:0},k=A=>{let V=m(p)??".",H=m(x)??"",W=String(A??"");if(H&&(W=W.split(H).join("")),!W||W==="-"||W===V||W.endsWith(V))return null;let ie=W.replace(V,"."),_=Number(ie);return Number.isFinite(_)?_:null},F=A=>{let V=m(x)??"";return V?A.replace(/\B(?=(\d{3})+(?!\d))/g,V):A},j=A=>{let V=m(p)??".",H=O(),W=Number(A);if(!Number.isFinite(W))return"";let ie=W<0?"-":"",_=Math.abs(W),[Z,X=""]=String(_).split("."),oe=F(Z);if(H>0){let he=X.slice(0,H).padEnd(H,"0");return`${ie}${oe}${V}${he}`}return`${ie}${oe}`},U=(A,V)=>{try{let H=m(I),W=m(M)??"USD",ie=m(C)??{},_=O(),Z=V==="currency"?"currency":"decimal";return new Intl.NumberFormat(H,{style:Z,currency:W,..._>0?{minimumFractionDigits:_,maximumFractionDigits:_}:{maximumFractionDigits:0},...ie}).format(A)}catch{return j(A)}},K=A=>{let V=A,H=m(a),W=m(o);return H!=null&&Number.isFinite(Number(H))&&(V=Math.max(V,Number(H))),W!=null&&Number.isFinite(Number(W))&&(V=Math.min(V,Number(W))),!m(d)&&V<0&&(V=0),V},le=()=>{let A=m(S)??"",V=m(z);return!A&&V==="percent"?"%":A},ve=(A,V,H)=>{let W=m(T)??"",ie=le(),_=String(A??"").replace(/\u00A0/g," "),Z=String(W??"").replace(/\u00A0/g," "),X=String(ie??"").replace(/\u00A0/g," "),oe=Z&&_.startsWith(Z),he=X&&_.endsWith(X);return`${V??""}${oe?"":W}${A}${he?"":ie}`},De=(A,V)=>{let H=O(),W=m(p)??".",_=String(A??"").replace(/\D/g,"")||"0",Z=H>0?_.padStart(H+1,"0"):_,oe=(H>0?Z.slice(0,-H):Z).replace(/^0+(?=\d)/,"")||"0",he=H>0?Z.slice(-H):"",Le=H>0?`${oe}${W}${he}`:oe;return`${V??""}${Le}`},Fe=A=>{let V=m(T)??"",H=le(),W=String(A??""),ie=String(V??"").replace(/\u00A0/g," "),_=String(H??"").replace(/\u00A0/g," ");return ie&&W.replace(/\u00A0/g," ").startsWith(ie)&&(W=W.slice(V.length)),_&&W.replace(/\u00A0/g," ").endsWith(_)&&(W=W.slice(0,-H.length)),W},fi=A=>{let V=!!m(d),H=Fe(A),W=V&&H.includes("-")?"-":"",ie=H.replace(/\D/g,""),_=De(ie,W);if(m(l)==="strict"){let Z=k(_);if(Z!=null){let X=K(Z);_=`${X<0?"-":""}${j(Math.abs(X))}`}}return _},Ei=A=>{if(A==null||A==="")return De("","");if(typeof A=="number"&&Number.isFinite(A)){let X=m(l)==="strict"?K(A):A;return`${X<0?"-":""}${j(Math.abs(X))}`}let V=Fe(A),H=m(p)??".",ie=!!m(d)&&String(V).includes("-")?"-":"",_=String(V??"").replace(new RegExp(`[^0-9${$(H)}]`,"g"),""),Z=k(`${ie}${_}`);if(Z!=null){let X=m(l)==="strict"?K(Z):Z;return`${X<0?"-":""}${j(Math.abs(X))}`}return fi(A)},Ce,Qe=A=>{let V=m(A);if(V===void 0)return;let H=Ei(V);H!==re.get()&&(Ce=H,re.set(H))};Qe(r),je(r).change(A=>{Qe(A)}),je(re).change(A=>{if(A===Ce){Ce=void 0;return}Ce=void 0;let V=k(A);if(V==null){se?.(A??"");return}se?.(V)});let ji=je(y).compute(A=>A!=null&&A!==!1),Ri=je(w,ji).compute(([A,V])=>!m(A)&&!V),vi=je(c).compute(A=>m(A)?"decimal":"numeric"),Hi=je(z,T,S,c,d,p,x,f,l,a,o,I,M,C).compute(()=>({mode:"both",format:A=>{let V=fi(A),H=m(z),ie=!!m(d)&&V.startsWith("-")?"-":"",_=k(V),Z=V.replace(ie,"");if(_!=null){let X=Math.abs(_);if(typeof H=="function")try{Z=H(X)}catch{Z=j(X)}else if(H==="currency")Z=U(X,"currency");else if(H==="decimal"){let oe=m(I),he=m(C);Z=oe||he?U(X,"decimal"):j(X)}else Z=j(X)}return{value:V,raw:V,visual:ve(Z,ie,H)}}})),b=A=>{let V=k(re.get()),H=Number(m(n)??1),ie=K((V??0)+H*A);re.set(j(ie))},E=A=>{if(!A||typeof A.setSelectionRange!="function")return;let V=()=>{try{let H=String(A.value??"").length;A.setSelectionRange(H,H)}catch{}};typeof requestAnimationFrame=="function"?requestAnimationFrame(V):V()},ue=A=>{ge?.(A);let V=A?.target;V&&E(V)},q=A=>{if(J?.(A),m(l)!=="blur")return;let V=k(re.get());if(V==null)return;let H=K(V);re.set(j(H))},ae=A=>{ne?.(A),E(A?.target)},de=A=>{ee?.(A);let V=A?.target;if(!V)return;let H=m(T)??"",W=le();W&&typeof V.selectionEnd=="number"&&(V.selectionEnd=Math.min(V.selectionEnd,String(V.value??"").length-W.length)),H&&typeof V.selectionStart=="number"&&(V.selectionStart=Math.max(V.selectionStart,H.length))},te=_t({className:"g-ui-number-field-controls"},Xt({className:"g-ui-number-field-control",onClick:()=>b(1)},"+"),Xt({className:"g-ui-number-field-control",onClick:()=>b(-1)},"\u2212")),Se=_t({className:"g-ui-number-field-controls-wrapper"},te),Pe=je(Ri,y).compute(([A,V])=>A?Se:V);return fe({...L,size:u,className:s("g-ui-number-field",v),leftSection:h,rightSection:Pe,type:"text",inputMode:vi,inputClassName:s("g-ui-input-number"),value:re,format:Hi,onInput:ue,onBlur:q,onFocus:ae,onKeyDown:de})}function Ja(...e){return Ki(...e)}import{Div as yi,Button as eo,portal as io,when as Qi,after as to}from"@granularjs/core";var bi='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1f1f1f"><path d="M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"/></svg>',xi='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1f1f1f"><path d="M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"/></svg>',wi='<svg xmlns="http://www.w3.org/2000/svg" height="40px" viewBox="0 -960 960 960" width="40px" fill="#1f1f1f"><path d="M379.33-244 154-469.33 201.67-517l177.66 177.67 378.34-378.34L805.33-670l-426 426Z"/></svg>',Kt='<svg xmlns="http://www.w3.org/2000/svg" height="40px" viewBox="0 -960 960 960" width="40px" fill="#1f1f1f"><path d="M240-446.67v-66.66h480v66.66H240Z"/></svg>',$e='<svg xmlns="http://www.w3.org/2000/svg" height="40px" viewBox="0 -960 960 960" width="40px" fill="#1f1f1f"><path d="M312-265.33 265.33-312l168-168-168-167L312-693.67l168 168 167-168L693.67-647l-168 167 168 168L647-265.33l-167-168-168 168Z"/></svg>',Qt='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1f1f1f"><path d="M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"/></svg>',Jt='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"/></svg>',er='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h357l-80 80H200v560h560v-278l80-80v358q0 33-23.5 56.5T760-120H200Zm280-360v-80h240v80H480Zm0 160v-80h320v80H480Zm0 160v-80h320v80H480ZM360-360v-80h80v80h-80Zm0 160v-80h80v80h-80Zm0 160v-80h80v80h-80Zm160-320h280l-36-37 37-37v74H520Zm-160 0h80v-80h-80v80ZM120-600v-160l160-160h160l-80 80H200v240h-80Zm80-240v-80 80Z"/></svg>',ir='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"/></svg>',tr='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M200-80q-33 0-56.5-23.5T120-160v-560q0-33 23.5-56.5T200-800h40v-80h80v80h320v-80h80v80h40q33 0 56.5 23.5T840-720v560q0 33-23.5 56.5T760-80H200Zm0-80h560v-400H200v400Z"/></svg>',rr='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1f1f1f"><path d="M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"/></svg>';function ii(...e){let{props:i,rawProps:t,children:r}=g(e,{size:"md",centered:!0,overlay:"normal"}),{opened:a,title:o,size:n,centered:u,overlay:c,position:d,className:p,style:x}=i,{onClose:f}=t,l=to(d,u).compute(([w,z])=>`g-ui-modal-position-${w??(z===!1?"top-center":"center")}`);return Qi(a,()=>io(yi({className:s("g-ui-modal-overlay",D("g-ui-modal-overlay-",c,"normal"),l),onClick:w=>{w.target===w.currentTarget&&f?.()}},yi({className:s("g-ui-modal",D("g-ui-modal-size-",n,"md"),p)},yi({className:"g-ui-modal-header"},Qi(o,()=>yi({className:"g-ui-modal-title"},o)),Qi(f,()=>eo({type:"button",className:"g-ui-button g-ui-button-variant-subtle g-ui-button-size-xs g-ui-modal-close",onClick:f,innerHTML:$e}))),r))))}import{Div as ki,Span as Ji,after as ar,when as or}from"@granularjs/core";function ti(...e){let{props:i}=g(e,{variant:"spinner",size:"md"}),{variant:t,size:r,className:a}=i,o=ar(t).compute(u=>u==="dots"),n=ar(t).compute(u=>u==="bars");return or(o,()=>ki({className:s("g-ui-loading g-ui-dots",D("g-ui-loading-size-",r,"md"),a)}),()=>or(n,()=>ki({className:s("g-ui-loading g-ui-bars",D("g-ui-loading-size-",r,"md"),a)},Ji(""),Ji(""),Ji("")),()=>ki({className:s("g-ui-loading",D("g-ui-loading-size-",r,"md"),a)},ki({className:"g-ui-spinner"}))))}import{Div as et,Input as ro,Label as ao,Span as nr,when as it,state as oo,after as no}from"@granularjs/core";function tt(...e){let{props:i,rawProps:t}=g(e,{size:"md"}),{checked:r,label:a,description:o,size:n,indeterminate:u,className:c,style:d,inputProps:p,...x}=i,{onChange:f}=t,l=oo(ye(r));no(r).change(z=>{z!=null&&(l.set(!!z),f?.(z))});let w=ao({className:"g-ui-checkbox-control"},ro({type:"checkbox",indeterminate:u,checked:l,className:s("g-ui-checkbox-input",D("g-ui-checkbox-size-",n,"md"),p?.className),...x}),it(l,()=>et({className:"g-ui-checkbox-checked",innerHTML:wi}),()=>{if(!l.get()&&u.get())return et({className:"g-ui-checkbox-indeterminate",innerHTML:Kt})}),it(a,()=>nr({className:"g-ui-checkbox-label"},a)));return et({className:s("g-ui-checkbox",D("g-ui-checkbox-size-",n,"md"),c)},w,it(o,()=>nr({className:"g-ui-checkbox-description"},o)))}import{Input as lo,Label as co,Span as po,when as mo,after as at,state as fo}from"@granularjs/core";import{Div as so,context as uo,after as sr}from"@granularjs/core";var rt=uo({name:null,selected:null});function go(...e){let{props:i,rawProps:t,children:r}=g(e),{className:a,name:o,selected:n,onChange:u,...c}=i,{onChange:d}=t,p=rt.scope({name:o?.get(),selected:n?.get()});return sr(p.selected).change(x=>{d?.(x)}),sr(n).change(x=>{x!==p.selected.get()&&(p.set().selected=x)}),p.serve(so({...c,className:s("g-ui-switch-group",a)},r))}function vo(...e){let{props:i,rawProps:t}=g(e,{size:"md"}),{label:r,size:a,className:o,style:n,inputProps:u,checked:c,value:d,...p}=i,{onChange:x}=t,f=fo(c),l=rt.state(),w=at(l).compute(z=>({name:z.name,type:z.name?"radio":"checkbox"}));return at(l.selected).change(z=>{f.set(z===d.get())}),at(f).change(z=>{if(x?.(z),!z)return;let I=l.get().selected;l.set().selected=d.get()}),co({className:s("g-ui-switch",D("g-ui-switch-size-",a,"md"),o)},lo({type:w.type,name:w.name,value:d,checked:f,className:s("g-ui-switch-input",D("g-ui-switch-size-",a,"md"),u?.className),...p}),mo(r,()=>po({className:"g-ui-switch-label"},r)))}import{Div as Re,Span as ur,when as ot,state as gr,after as zi}from"@granularjs/core";import{Span as ho}from"@granularjs/core";function xe(...e){let{props:i,children:t}=g(e,{size:"md"});return ho({...i,className:s("g-ui-icon",D("g-ui-icon-size-",i.size,"md"),D("g-ui-icon-color-",i.color),i.className)},...t)}function bo(...e){let{props:i,rawProps:t}=g(e,{data:[],size:"md"}),{data:r,value:a,size:o,leftSection:n,rightSection:u,placeholder:c,className:d,...p}=i,{onChange:x}=t,f=gr(!1),l=gr(m(a)??"");zi(a).change(M=>{let C=m(M);C!==void 0&&l.set(C??"")});let w=M=>{l.set(M),x?.(M),f.set(!1)},z=zi(l).compute(M=>M?"":"g-ui-select-placeholder"),I=zi(l).compute(M=>{let T=(m(r)??[]).find(S=>S.value===M);return M?T?.label??"":c??""});return Re({...p,className:s("g-ui-select-root",d)},Re({className:s("g-ui-input-wrapper",D("g-ui-input-size-",o,"md"))},ot(n,()=>Re({className:"g-ui-input-section"},n)),Re({className:s("g-ui-select",z),onClick:()=>f.set(!f.get())},ur({className:"g-ui-select-value"},I)),ot(u,()=>Re({className:"g-ui-input-section"},u),()=>ur({className:"g-ui-select-caret"},xe({innerHTML:rr})))),ot(f,()=>Re({className:"g-ui-select-dropdown"},(m(r)??[]).map(M=>Re({className:s("g-ui-select-item",zi(l).compute(C=>C===M.value?"g-ui-select-item-active":"")),onClick:()=>w(M.value)},M.label)))))}import{Button as xo,Div as Ze,state as Me,after as ri,list as wo,when as yo}from"@granularjs/core";function ko(...e){let{props:i,rawProps:t}=g(e,{tabs:[],orientation:"horizontal",variant:"default",sticky:!0}),{value:r,tabs:a,orientation:o,variant:n,sticky:u,className:c,style:d}=i,{onChange:p}=t,x=Me(m(r)??m(a)?.[0]?.value??""),f=Me(),l=Me(),w=Me(0),z=Me(0),I=Me(0),M=Me(0),C=Me(!1),T=Me(0),S=!1,h=null,y=!1,v=new Set;ri(r).change(k=>{let F=m(k);F!=null&&x.set(F)});let P=k=>{x.set(k),p?.(k)},N=k=>{let F=[],j=k?.parentElement;for(;j;){let U=getComputedStyle(j),K=`${U.overflow}${U.overflowY}${U.overflowX}`;/(auto|scroll)/.test(K)&&F.push(j),j=j.parentElement}return F},L=k=>N(k)[0]??null,G=k=>k?k.getBoundingClientRect().top:0,Q=k=>k?k.scrollTop:window.scrollY||window.pageYOffset||0,J=(k,F)=>k>F?"down":k<F?"up":"none",ne=(k,F,j,U)=>k==="down"&&F<j?!0:k==="up"&&F>=j?!1:U,ee=()=>{let k=f.get(),F=l.get();if(!k||!F)return;if(!ye(u)){C.set(!1),w.set(0);return}if(typeof window>"u")return;let j=k.getBoundingClientRect(),U=F.getBoundingClientRect(),K=L(k),le=G(K),ve=Q(K),De=J(ve,T.get());T.set(ve);let Fe=ne(De,j.top,le,C.get());w.set(U.height),z.set(j.left),I.set(j.width),M.set(le),Fe!==C.get()&&C.set(Fe)},se=()=>{h==null&&(h=requestAnimationFrame(()=>{h=null,ee()}))},ge=k=>{!k||v.has(k)||(v.add(k),k.addEventListener("scroll",se,{passive:!0}))},re=()=>{if(S)return;let k=f.get(),F=l.get();!k||!F||typeof window>"u"||(S=!0,ee(),ge(window),window.addEventListener("resize",se),N(k).forEach(ge))};ri(l,f,u).change(re),!y&&typeof window<"u"&&(y=!0,setTimeout(()=>re(),0));let $=ri(C,z,I,M).compute(k=>{let[F,j,U,K]=k;return F?{position:"fixed",top:`${K}px`,left:`${j}px`,width:`${U}px`,background:"var(--g-ui-surface)",zIndex:100}:{position:"static",top:"auto",left:"auto",width:"auto",zIndex:"auto",background:"transparent"}}),O=ri(C,w).compute(k=>{let[F,j]=k;return{height:F?`${j}px`:"0px"}});return Ze(Ze({className:s("g-ui-tabs",me(o,{vertical:"g-ui-tabs-vertical"}),D("g-ui-tabs-variant-",n,"default"),i.className??c)},Ze({node:f}),Ze({style:O}),Ze({node:l,className:"g-ui-tabs-list",style:$},wo(a,k=>xo({className:ri(x,k.value).compute(([F,j])=>s("g-ui-tabs-tab",j===F&&"g-ui-tabs-tab-active")),onClick:()=>P(k.get().value)},k.label))),Ze({className:"g-ui-tabs-panel"},yo(x,()=>a.get()?.find(k=>k.value===x.get())?.content??null))))}import{Table as zo,Thead as No,Tbody as Co,Tr as So,Th as Do,Td as Po,list as cr,when as pr,after as nt}from"@granularjs/core";function Mo(...e){let{props:i}=g(e,{headers:[],rows:[]}),{headers:t,rows:r,striped:a,highlightOnHover:o,withBorder:n,withColumnBorders:u,withRowBorders:c,className:d,style:p,...x}=i,f=nt(t).compute(l=>l.length>0);return zo({...x,className:s("g-ui-table",Y("g-ui-table-striped",a),Y("g-ui-table-hover",o),Y("g-ui-table-with-border",n),Y("g-ui-table-column-borders",u),Y("g-ui-table-row-borders",c),d)},pr(f,()=>No(lr(t,!0))),Co(cr(r,l=>lr(l,!1))))}var lr=(e,i)=>{let t=nt(e).compute(o=>Array.isArray(o)),r=o=>{let n=nt(o).compute(u=>Object.values(u));return a(n)},a=o=>cr(o,n=>(console.log("INFO ABOUT NEXT",i),i?Vo(n):To(n)));return So(pr(t,()=>a(e),()=>r(e)))},To=e=>Po(e),Vo=e=>Do(e);import{Div as st}from"@granularjs/core";import{state as Lo,when as $o,after as Io}from"@granularjs/core";function Ao(...e){let{props:i,children:t}=g(e,{opened:!1}),{opened:r,className:a,...o}=i,n=Lo(ye(r));Io(r).change(p=>{n.set(ye(p))});let u=()=>{n.set(!n.get())},c=t[0],d=t[1];return st({...o,className:s("g-ui-accordion",a)},st({className:"g-ui-accordion-header",onClick:u},c),$o(n,()=>st({className:"g-ui-accordion-content"},d)))}import{Span as dr}from"@granularjs/core";function Bo(...e){let{props:i,children:t}=g(e),{label:r,className:a,style:o}=i;return dr({className:s("g-ui-tooltip",a)},t,dr({className:"g-ui-tooltip-content"},r))}import{Div as ai,when as Fo,after as Eo,state as oi,portal as jo}from"@granularjs/core";var ut=oi({currentOpenState:null});function Ro(...e){let i=oi(),t=oi(),r=oi({}),{props:a,rawProps:o,children:n}=g(e,{position:"right"}),{opened:u,content:c,position:d,className:p,...x}=a,{onChange:f}=o,l=oi(m(u)??!1);Eo(u).change(S=>{let h=m(S);h!=null&&(l.set(!!h),h&&w())});let w=()=>{ut.get().currentOpenState!==l&&(ut.get().currentOpenState?.set(!1),ut.set().currentOpenState=l)};u.get()&&w();let z=S=>{let y=String(S??"right").toLowerCase().split("-").filter(Boolean);if(y.length===1){let N=y[0];return N==="top"||N==="bottom"?{placement:N,align:"center"}:N==="left"||N==="right"?{placement:"bottom",align:N}:N==="center"?{placement:"bottom",align:"center"}:{placement:"bottom",align:"right"}}let[v,P]=y;return v==="top"||v==="bottom"?{placement:v,align:P||"center"}:v==="left"||v==="right"?{placement:v,align:P||"center"}:{placement:"bottom",align:"right"}},I=()=>{let S=i.get(),h=t.get();if(!S||!h||typeof window>"u")return;let y=S.getBoundingClientRect(),v=h.getBoundingClientRect(),P=m(d)??"right",N=getComputedStyle(document.documentElement).getPropertyValue("--g-ui-space-20"),L=Number.parseFloat(N)||20,G=window.innerWidth||0,Q=window.innerHeight||0,J=Math.max(L,G-v.width-L),ne=Math.max(L,Q-v.height-L),{placement:ee,align:se}=z(P),ge=8,re=y.bottom+ge,$=y.left;ee==="top"||ee==="bottom"?(re=ee==="top"?y.top-v.height-ge:y.bottom+ge,se==="center"?$=y.left+y.width/2-v.width/2:se==="right"?$=y.right-v.width:$=y.left):(ee==="left"||ee==="right")&&($=ee==="left"?y.left-v.width-ge:y.right+ge,se==="center"?re=y.top+y.height/2-v.height/2:se==="bottom"?re=y.bottom-v.height:re=y.top),$=Math.max(L,Math.min($,J)),re=Math.max(L,Math.min(re,ne)),r.set({top:`${re}px`,left:`${$}px`})},M=S=>{l.set(S),f?.(S),S&&(w(),typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>I()):setTimeout(()=>I(),0))},C=()=>M(!l.get()),T=()=>M(!1);return ai({...x,node:i,className:s("g-ui-menu",p)},ai({onClick:C},n),Fo(l,()=>jo(ai(ai({className:"g-ui-menu-overlay",onClick:T}),ai({className:"g-ui-menu-dropdown",node:t,style:r},c)))))}import{Div as mr,portal as Ho,when as Oo}from"@granularjs/core";function Wo(...e){let{props:i,children:t}=g(e,{position:"right",size:"md",overlay:"normal",shadowed:!0}),{opened:r,onClose:a,position:o,size:n,overlay:u,shadowed:c,className:d,style:p}=i;return Oo(r,()=>Ho(mr({className:s("g-ui-drawer-overlay",D("g-ui-drawer-overlay-",u,"normal")),onClick:a},mr({className:s("g-ui-drawer",me(c,{true:"g-ui-drawer-shadowed"},!0),D("g-ui-drawer-",o,"right"),D("g-ui-drawer-size-",n,"md"),d),onClick:x=>x.stopPropagation()},t))))}import{Button as qo,Div as gt,Span as fr,when as Ni,after as vr}from"@granularjs/core";function lt(...e){let{props:i,rawProps:t,children:r}=g(e,{color:"blue",withCloseButton:!0}),{title:a,color:o,icon:n,loading:u,withCloseButton:c,withBorder:d,className:p,style:x}=i,{onClose:f}=t,l=vr(n,u).compute(([z,I])=>!z&&!!I),w=vr(n,u).compute(([z,I])=>!!z||!!I);return gt({className:s("g-ui-notification",[d,"g-ui-notification-bordered"],[o,z=>`g-ui-notification-${z}`],[w,"g-ui-notification-with-icon"],p)},Ni(n,()=>fr({className:"g-ui-notification-icon"},n)),Ni(l,()=>ti({size:"sm",className:"g-ui-notification-loader"})),gt({className:"g-ui-notification-body"},Ni(a,()=>gt({className:"g-ui-notification-title"},a)),r),Ni(c,()=>qo({type:"button",className:"g-ui-notification-close",onClick:()=>f?.()},fr({innerHTML:$e}))))}import{Div as Yo,when as Go}from"@granularjs/core";function Zo(...e){let{props:i}=g(e,{labelPosition:"center"}),{label:t,labelPosition:r,vertical:a,className:o,...n}=i;return Yo({...n,className:s("g-ui-divider",Y("label",t),D("g-ui-divider-label-",r,"center"),Y("g-ui-divider-vertical",a),o)},Go(t,()=>Ui({className:"g-ui-divider-label-text",size:"sm"},t)))}import{Div as Uo}from"@granularjs/core";function _o(...e){let{props:i,children:t}=g(e,{padding:"md",radius:"md",shadow:"none"}),{padding:r,radius:a,shadow:o,className:n,...u}=i;return Uo({...u,className:s("g-ui-paper",[r,c=>`g-ui-card-padding-${c}`],[a,c=>`g-ui-card-radius-${c}`],[o,c=>`g-ui-card-shadow-${c}`],n)},t)}import{Button as Xo,Div as ct,Span as Ko,after as hr,when as pt}from"@granularjs/core";function Qo(...e){let{props:i,rawProps:t,children:r}=g(e,{color:"blue"}),{title:a,color:o,icon:n,withCloseButton:u,className:c,...d}=i,{onClose:p}=t,x=hr(a,u).compute(([l,w])=>l||w),f=hr(n).compute(l=>l!==void 0);return ct({...d,className:s("g-ui-alert",[o,l=>`g-ui-alert-${l}`],c)},ct({className:"g-ui-alert-header"},pt(n,()=>Ko({className:"g-ui-alert-icon"},n)),pt(a,()=>ct({className:"g-ui-alert-title"},a)),pt(u,()=>Xo({type:"button",className:"g-ui-alert-close",onClick:()=>p?.()},"\xD7"))),r)}import{Div as Jo,Img as en,when as tn}from"@granularjs/core";function rn(...e){let{props:i,children:t}=g(e,{size:"md",alt:""}),{src:r,size:a,alt:o,className:n,...u}=i;return Jo({...u,className:s("g-ui-avatar",[a,c=>`g-ui-avatar-size-${c}`],n)},tn(r,()=>en({className:"g-ui-avatar-img",src:r,alt:o}),()=>t))}import{Span as an}from"@granularjs/core";function on(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return an({...a,className:s("g-ui-kbd",r)},t)}import{Code as nn}from"@granularjs/core";function sn(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return nn({...a,className:s("g-ui-code",r)},t)}import{Blockquote as un}from"@granularjs/core";function gn(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return un({...a,className:s("g-ui-blockquote",r)},t)}import{Div as ln}from"@granularjs/core";function cn(...e){let{props:i,children:t}=g(e,{cols:3,gap:"md"}),{cols:r,gap:a,className:o,...n}=i;return ln({...n,className:s("g-ui-grid",[a,u=>`g-ui-gap-${u}`],[r,u=>`g-ui-grid-cols-${u}`],o)},t)}import{Ul as pn,Ol as dn,Li as dt,Div as Ci,Span as mt,after as ft,when as He,isSignal as mn,isState as fn,isStatePath as vn,isComputed as hn}from"@granularjs/core";function br(...e){let{props:i,children:t}=g(e,{type:"none",size:"md"}),{type:r,size:a,withPadding:o,className:n,...u}=i,c=me(r,{ordered:"g-ui-list-ordered",unordered:"g-ui-list-unordered",none:"g-ui-list-none"}),d=ft(r).compute(z=>z==="ordered"),p=z=>z&&typeof z=="object"&&typeof z.tagName=="string"&&(z.tagName.toLowerCase()==="ul"||z.tagName.toLowerCase()==="ol"),x=z=>z&&typeof z=="object"&&typeof z.tagName=="string"&&z.tagName.toLowerCase()==="li",f=z=>{console.log("INFO ABOUT ITEM",z,typeof z,typeof z?.tagName,z?.tagName?.toLowerCase());let I=M=>M?.nodeType==="granular-list-node"?M:M==null||M===!1?null:Array.isArray(M)?M.map(C=>I(C)):x(M)?M:p(M)?dt({className:"g-ui-list-nested-item"},M):dt(mt({className:"g-ui-list-item-shell"},M));return mn(z)||fn(z)||vn(z)||hn(z)?ft(z).compute(M=>I(M)):I(z)},l=He(t,()=>t.map(z=>f(z))),w={...u,className:s("g-ui-list",D("g-ui-list-size-",a,"md"),Y("g-ui-list-with-padding",o),c,n)};return He(d,()=>dn(w,l),()=>pn(w,l))}function bn(...e){let{props:i,children:t}=g(e,{withBorder:!1}),{leftSection:r,rightSection:a,title:o,body:n,withBorder:u,className:c,...d}=i,p=ft(o,n).compute(([x,f])=>!!x||!!f);return dt({...d,className:s("g-ui-list-item",Y("g-ui-list-item-border",u),c)},Ci({className:"g-ui-list-item-shell"},He(r,()=>mt({className:"g-ui-list-item-section g-ui-list-item-section-left"},r)),He(p,()=>Ci({className:"g-ui-list-item-content"},He(o,()=>Ci({className:"g-ui-list-item-title"},o)),He(n,()=>Ci({className:"g-ui-list-item-body"},n))),()=>t),He(a,()=>mt({className:"g-ui-list-item-section g-ui-list-item-section-right"},a))))}br.Item=bn;import{A as xn}from"@granularjs/core";function wn(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return xn({...a,className:s("g-ui-anchor",r)},t)}import{Img as yn}from"@granularjs/core";function kn(...e){let{props:i}=g(e),{className:t,...r}=i;return yn({...r,className:s("g-ui-image",t)})}import{Div as xr}from"@granularjs/core";function zn(...e){let{props:i}=g(e,{value:0,color:"primary",size:"md"}),{value:t,color:r,size:a,className:o,...n}=i;return xr({...n,className:s("g-ui-progress",D("g-ui-progress-size-",a,"md"),[t,u=>{let c=Math.max(0,Math.min(100,Number(u)||0));return`g-ui-progress-${Math.round(c/5)*5}`}],[r,u=>u?`g-ui-progress-${u}`:""],o)},xr({className:"g-ui-progress-bar"}))}import{Div as Ie,after as Oe,state as Nn,when as wr,list as Cn}from"@granularjs/core";function Sn(...e){let{props:i,rawProps:t}=g(e,{size:"md",min:0,max:100,step:1}),{onChange:r}=t,{value:a,marks:o,size:n,min:u,max:c,step:d,disabled:p,className:x,...f}=i,l=Nn(m(a??u)),w=Oe(o).compute(h=>h&&h.length>0);Oe(a).change(h=>{h!=null&&l.set(m(h))});let z=()=>{let h=Number(m(u)),y=Number(m(c));return!Number.isFinite(h)||!Number.isFinite(y)?{minValue:0,maxValue:100}:{minValue:Math.min(h,y),maxValue:Math.max(h,y)}},I=()=>{let h=Number(m(d));return Number.isFinite(h)&&h>0?h:1},M=h=>{let{minValue:y,maxValue:v}=z(),P=I(),N=Math.max(y,Math.min(v,Number(h))),L=Math.round((N-y)/P)*P+y;L!==l.get()&&(l.set(L),r?.(L))},C=Oe(l).compute(h=>{let{minValue:y,maxValue:v}=z(),P=v-y;if(P<=0)return 0;let N=(Number(h??y)-y)/P*100;return Math.max(0,Math.min(100,N))}),T=(h,y)=>{let v=y?.();if(!v||v.width===0)return;let N=Math.min(Math.max(h.clientX-v.left,0),v.width)/v.width,{minValue:L,maxValue:G}=z();M(L+N*(G-L))},S=h=>{if(ye(p))return;h.preventDefault?.();let y=h.currentTarget,v=()=>y.getBoundingClientRect();y.setPointerCapture?.(h.pointerId),T(h,v);let P=L=>T(L,v),N=()=>{y.releasePointerCapture?.(h.pointerId),window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",N)};window.addEventListener("pointermove",P),window.addEventListener("pointerup",N)};return Ie({...f,className:s("g-ui-slider",D("g-ui-slider-size-",n,"md"),Y("g-ui-slider-disabled",p),x)},Ie({className:"g-ui-slider-track",onPointerDown:S},Ie({className:"g-ui-slider-bar",style:Oe(C).compute(h=>({width:`${h}%`}))}),Ie({className:"g-ui-slider-thumb",style:Oe(C).compute(h=>({left:`${h}%`}))})),wr(w,()=>Ie({className:"g-ui-slider-marks-placeholder"})),wr(o,()=>Ie({className:"g-ui-slider-marks"},Cn(o,h=>vt({mark:h,getBounds:z})))))}var vt=({mark:e,getBounds:i})=>{let{minValue:t,maxValue:r}=i(),a=r-t,o=Oe(e).compute(d=>d.value??d),n=Oe(e).compute(d=>d.label??String(d.value)??o),u=Number(o),c=0;return a>0&&(c=(u-t)/a*100),Ie({className:"g-ui-slider-mark",style:{left:`${Math.max(0,Math.min(100,c))}%`}},Ie({className:"g-ui-slider-mark-label"},n))};import{Div as Dn,after as Pn}from"@granularjs/core";function Mn(...e){let{props:i}=g(e,{height:"md",width:"full"}),{height:t,width:r,className:a,...o}=i,n=Pn(t,r).compute(([u,c])=>{let d={};return isNaN(u)||(d.height=`${u}px`),isNaN(c)||(d.width=`${c}px`),d});return Dn({...o,style:{width:n.width,height:n.height,...o.style||{}},className:s("g-ui-skeleton",[t,u=>`g-ui-skeleton-h-${u}`],[r,u=>`g-ui-skeleton-w-${u}`],a)})}import{Button as Tn,after as yr,state as Vn}from"@granularjs/core";function Ln(...e){let{props:i,rawProps:t,children:r}=g(e,{size:"md",variant:"filled",color:"primary"}),{checked:a,size:o,variant:n,color:u,className:c,...d}=i,{onChange:p}=t,x=Vn(!!a);yr(a).change(l=>{l!=null&&x.set(!!l)});let f=l=>{x.set(l),p?.(l)};return Tn({...d,type:"button",className:s("g-ui-chip",D("g-ui-chip-size-",o,"md"),D("g-ui-chip-variant-",n,"filled"),D("g-ui-chip-color-",u,"primary"),yr(x).compute(l=>l?"g-ui-chip-active":""),c),onClick:()=>f(!x.get())},r)}import{Div as ht,after as kr,state as $n,list as In}from"@granularjs/core";function An(...e){let{props:i,rawProps:t}=g(e,{data:[],size:"sm"}),{value:r,data:a,size:o,scroll:n,className:u,...c}=i,{onChange:d}=t,p=$n(m(r));kr(r).change(f=>{let l=m(f);l!=null&&p.set(l)});let x=f=>{p.set(f),d?.(f)};return ht({...c,className:s(n&&"g-ui-segmented-scroll")},ht({className:s("g-ui-segmented",D("g-ui-segmented-size-",o,"sm"),u)},In(a,(f=>ht({className:s("g-ui-segmented-item",kr(p).compute(l=>f.get().value===l?"g-ui-segmented-active":"")),onClick:()=>x(f.get().value)},f.label)))))}import{Button as bt,Div as Bn,state as Fn,after as Si}from"@granularjs/core";function En(...e){let{props:i,rawProps:t}=g(e,{total:1,size:"md"}),{page:r,total:a,size:o,className:n,...u}=i,{onChange:c}=t,d=Fn(m(r)??1);Si(r).change(l=>{let w=m(l);w!=null&&d.set(w)});let p=l=>{let w=Number(m(a))||1,z=Math.max(1,Math.min(w,l));d.set(z),c?.(z)},x=[],f=Number(m(a))||1;for(let l=1;l<=f;l+=1)x.push(l);return Bn({...u,className:s("g-ui-pagination",D("g-ui-pagination-size-",o,"md"),i.className??n)},bt({className:"g-ui-pagination-item",onClick:()=>p((d.get?.()??d)-1),disabled:Si(d).compute(l=>l<=1)},"<"),x.map(l=>bt({className:Si(d).compute(w=>s("g-ui-pagination-item",l===w&&"g-ui-pagination-item-active")),onClick:()=>p(l)},String(l))),bt({className:"g-ui-pagination-item",onClick:()=>p((d.get?.()??d)+1),disabled:Si(d).compute(l=>l>=a)},">"))}import{Div as On,Input as Wn,Label as qn,Span as zr,when as Nr,after as yt,state as Yn}from"@granularjs/core";import{Div as jn,context as Rn,after as xt}from"@granularjs/core";var wt=Rn({name:"",selected:null});function Hn(...e){let{props:i,children:t,rawProps:r}=g(e),{className:a,name:o,selected:n,onChange:u,...c}=i,{onChange:d}=r,p=wt.scope({name:o?.get(),selected:n?.get()});return console.log("selected?.get()",n?.get()),xt(o).change(x=>{p.set().name=x}),xt(n).change(x=>{x!==p.selected.get()&&(p.set().selected=x)}),xt(p.selected).change(x=>{d?.(x)}),p.serve(jn({...c,className:s("g-ui-stack g-ui-gap-sm",a)},t))}function Gn(...e){let{props:i,rawProps:t}=g(e,{size:"md"}),{label:r,name:a,value:o,checked:n,description:u,size:c,className:d,inputProps:p,...x}=i,{onChange:f}=t,l=Yn(n?.get()??!1),w=wt.state(),z=yt(w.name,a).compute(([M,C])=>M||C);yt(n,w.selected).change(M=>{let[C,T]=M;w.get().name?l.set(T===o.get()):l.set(C)}),yt(l).change(M=>{f?.(M),M&&w.get().name&&(w.set().selected=o.get())});let I=qn({className:"g-ui-radio-control"},Wn({type:"radio",name:z,value:o,checked:l,className:s("g-ui-radio-input",D("g-ui-radio-size-",c,"md"),p?.className),...x}),Nr(r,()=>zr({className:"g-ui-radio-label"},r)));return On({className:s("g-ui-radio",D("g-ui-radio-size-",c,"md"),d)},I,Nr(u,()=>zr({className:"g-ui-radio-description"},u)))}import{Nav as Zn,Span as Un}from"@granularjs/core";function _n(...e){let{props:i,children:t}=g(e,{separator:"/"}),{separator:r,className:a,...o}=i,n=[];Array.isArray(t)?n.push(...t):n.push(t);let u=n.filter(Boolean),c=[];return u.forEach((d,p)=>{c.push(d),p<u.length-1&&c.push(Un({className:"g-ui-breadcrumbs-separator"},r))}),Zn({...o,className:s("g-ui-breadcrumbs",a)},c)}import{Div as Xn}from"@granularjs/core";function Kn(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return Xn({...a,className:s("g-ui-center",r)},t)}import{Div as Qn}from"@granularjs/core";function Jn(...e){let{props:i}=g(e,{size:"md"}),{size:t,className:r,...a}=i;return Qn({...a,className:s("g-ui-space",[t,o=>`g-ui-space-${o}`],r)})}import{Div as es,when as is}from"@granularjs/core";function ts(...e){let{props:i,children:t}=g(e),{opened:r,className:a,...o}=i;return is(r,()=>es({...o,className:s("g-ui-collapse",a)},t))}import{Button as rs}from"@granularjs/core";function We(...e){let{props:i,children:t}=g(e,{size:"md",variant:"filled"}),{size:r,variant:a,color:o,className:n,...u}=i;return rs({...u,type:"button",className:s("g-ui-action-icon",D("g-ui-action-icon-size-",r,"md"),D("g-ui-action-icon-color-",o,"primary"),D("g-ui-action-icon-",a,"filled"),n)},t)}import{Div as kt,when as as,after as os,state as ns}from"@granularjs/core";function zt(...e){let{props:i,rawProps:t,children:r}=g(e,{position:"left"}),{opened:a,position:o,content:n,className:u,...c}=i,{onChange:d}=t,p=ns(m(a)??!1);os(a).change(f=>{let l=m(f);l!=null&&p.set(!!l)});let x=f=>{p.set(f),d?.(f)};return kt({...c,className:s("g-ui-popover",i.className??u)},kt({onClick:()=>x(!p.get())},r),as(p,()=>kt({className:s("g-ui-popover-dropdown",o==="right"&&"g-ui-popover-right",o==="center"&&"g-ui-popover-center")},n)))}import{Div as Cr}from"@granularjs/core";function ss(...e){let{props:i,children:t}=g(e,{position:"left"}),{position:r,content:a,className:o,...n}=i;return Cr({...n,className:s("g-ui-hover-card",o)},t,Cr({className:s("g-ui-hover-card-dropdown",[r,u=>u==="right"?"g-ui-hover-card-right":""],[r,u=>u==="center"?"g-ui-hover-card-center":""])},a))}import{Div as us}from"@granularjs/core";function gs(...e){let{props:i,children:t}=g(e,{position:"bottom-right"}),{position:r,className:a,...o}=i;return us({...o,className:s("g-ui-affix",[r,n=>`g-ui-affix-${n}`],a)},t)}import{Fieldset as ls,Legend as cs,when as ps}from"@granularjs/core";function ds(...e){let{props:i,children:t}=g(e),{legend:r,className:a,...o}=i;return ls({...o,className:s("g-ui-fieldset",a)},ps(r,()=>cs({className:"g-ui-legend"},r)),t)}import{Div as ms}from"@granularjs/core";function fs(...e){let{props:i,children:t}=g(e,{position:"sticky"}),{position:r,className:a,...o}=i;return ms({...o,className:s("g-ui-appbar",D("g-ui-appbar-",r,"sticky"),a)},t)}import{Div as Nt,portal as vs,after as Di,state as Sr,when as Dr}from"@granularjs/core";function hs(...e){let{props:i,children:t}=g(e,{position:"left",size:"md",blur:!0,fixed:!1,minWidth:"button"});return Dr(i.fixed,()=>xs(i,t),()=>bs(i,t))}var bs=(e,i)=>{let{open:t,onClose:r,position:a,size:o,blur:n,fixed:u,minWidth:c,className:d,...p}=e,x=Sr(!1),f=Sr(!1),l=220,w=M=>{if(M){x.set(!0),typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>f.set(!0)):setTimeout(()=>f.set(!0),0);return}f.set(!1),setTimeout(()=>x.set(!1),l)};w(!!t.get()),Di(t).change(M=>w(!!M));let z=Di(f,n).compute(M=>{let[C,T]=M;return s("g-ui-sidebar-overlay",C&&"g-ui-sidebar-overlay-open",!T&&"g-ui-sidebar-overlay-noblur")}),I=Di(o,a,f,d).compute(M=>{let[C,T,S,h]=M,y=T==="right"?"g-ui-sidebar-drawer-right g-ui-sidebar-position-right":"g-ui-sidebar-drawer-left";return s("g-ui-sidebar","g-ui-sidebar-drawer",`g-ui-sidebar-size-${C}`,y,S&&"g-ui-sidebar-drawer-open",m(h))});return Dr(x,()=>vs(Nt({className:z,onClick:r},Nt({className:I,onClick:M=>M.stopPropagation()},i))))},xs=(e,i)=>{let{open:t,position:r,size:a,minWidth:o,className:n,...u}=e,c=Di(a,r,t,o,n).compute(d=>{let[p,x,f,l,w]=d,z=l||"button",I=null;return z==="button"?I="g-ui-sidebar-min-button":z==="xs"?I="g-ui-sidebar-min-xs":z==="sm"?I="g-ui-sidebar-min-sm":z==="md"&&(I="g-ui-sidebar-min-md"),s("g-ui-sidebar g-ui-sidebar-fixed",`g-ui-sidebar-size-${p||"md"}`,I,f&&"g-ui-sidebar-fixed-open",w)});return Nt({...u,className:c},i)};import{Div as Ae,when as Ct,list as Pr,after as we,resolve as Be,state as ws}from"@granularjs/core";var ys=10;function ks(e){return(e??[]).map(t=>{if(t==null)return 1;let r=Number(t.weight);return Number.isFinite(r)&&r>=0?r:1})}function Pi(e){let i=(e??[]).length;if(i<2)return{totalWeight:0,cumulativeWeights:[0]};let r=ks(e).slice(0,i-1),a=r.reduce((n,u)=>n+u,0),o=[0];for(let n=0;n<r.length;n++)o.push(o[n]+r[n]);return{totalWeight:a,cumulativeWeights:o}}function Mr(e,i,t,r){if(r<1||t<=0)return 0;let a=Math.max(0,Math.min(100,e));for(let o=r-1;o>=0;o--){let n=i[o]/t*100;if(a>=n)return o}return 0}function zs(e,i,t,r,a,o,n){let u=e,c=(n??[]).length;if(c===0)return{activeStep:0,progressPct:0};if(u==="step")return{activeStep:Math.max(0,Math.min(c-1,Math.floor(i??0))),progressPct:0};if(u==="percent"){let d=Math.max(0,Math.min(100,Number(t)||0)),p=Pi(n);return{activeStep:Mr(d,p.cumulativeWeights,p.totalWeight,c),progressPct:d}}if(u==="time"){let d=Number(r)||0,p=a,x=o,f=0;if(Array.isArray(p)&&p.length>=c?f=p.slice(0,c).reduce((C,T)=>C+(Number(T)||0),0):typeof x=="number"&&x>0&&(f=x),f<=0)return{activeStep:0,progressPct:0};let l=f/c,w=0;if(Array.isArray(p)&&p.length>=c){let C=0;for(let T=0;T<c;T++){if(C+=Number(p[T])||0,d<C){w=T;break}w=T}}else w=Math.min(c-1,Math.floor(d/l));let z=Math.min(100,d/f*100),I=Pi(n);return{activeStep:Mr(z,I.cumulativeWeights,I.totalWeight,c),progressPct:z}}return{activeStep:0,progressPct:0}}function Ns(e,i,t,r,a,o){if(a<2||r<0||r>=a-1)return 0;if(e==="step")return i>r?100:0;let{totalWeight:n,cumulativeWeights:u}=o??Pi([]);if(n<=0)return 0;let c=u[r]/n*100,d=u[r+1]/n*100;if(t<=c)return 0;if(t>=d)return 100;let p=d-c;return p<=0?0:(t-c)/p*100}var Cs=0;function Ss(e){let i=document.getElementById(e);if(!i)return;let t=i.querySelectorAll(".g-ui-timeline-item");if(t.length<2)return[];let r=[];for(let a=0;a<t.length-1;a++){let o=t[a].offsetTop+ys,n=t[a+1].offsetTop-t[a].offsetTop;r.push({top:o,height:n})}return r}function Ds(...e){let{props:i,rawProps:t}=g(e,{items:[],mode:"step",active:0,progress:0,elapsedMs:0,stepDurationsMs:null,totalDurationMs:null,clickable:!1}),{items:r,mode:a,active:o,progress:n,elapsedMs:u,stepDurationsMs:c,totalDurationMs:d,clickable:p,className:x,...f}=i,{onChange:l}=t,w=`g-ui-timeline-${++Cs}`,z=ws([]),I=we(a,o,n,u,c,d,r).compute(S=>{let[h,y,v,P,N,L,G]=S;return zs(h,y,v,P,N,L,G)}),M=we(a).compute(S=>{let h=Be(S);return h==="time"||h==="percent"||h==="step"}),C=we(a).compute(S=>Be(S));function T(){setTimeout(()=>{let S=Ss(w);S.length&&z.set(S)},0)}return we(r).change(()=>T()),T(),Ae({...f,id:w,className:s("g-ui-timeline",we(a).compute(S=>S?`g-ui-timeline-mode-${Be(S)}`:""),we(M).compute(S=>S?"g-ui-timeline-has-track":""),we(p).compute(S=>Be(S)?"g-ui-timeline-clickable":""),x)},Ct(M,()=>Pr(z,(S,h)=>{let y=we(S).compute(N=>N?{top:`${N.top}px`,height:`${N.height}px`}:{}),v=we(I,h,r,C).compute(([N,L,G,Q])=>{let J=G??[],ne=J.length,ee=Pi(J);return Ns(Q,N?.activeStep??0,N?.progressPct??0,Be(L)??0,ne,ee)}),P=we(v).compute(N=>`${Math.max(0,Math.min(100,N))}%`);return Ae({className:"g-ui-timeline-track-segment",style:we(y).compute(N=>N)},Ae({className:"g-ui-timeline-track-fill",style:we(P).compute(N=>N?{height:N}:{height:"0%"})}))})),Pr(r,(S,h)=>{let y=we(I,h).compute(([N,L])=>{let G=N?.activeStep??0,Q=Be(L)??0;return Q<G?"completed":Q===G?"active":"future"}),v=we(y).compute(N=>N?`g-ui-timeline-item-${N}`:""),P=Be(p)&&typeof l=="function"?()=>{let N=Be(h);typeof N=="number"&&l(N)}:void 0;return Ae({className:s("g-ui-timeline-item",v),onClick:P,role:P?"button":void 0,tabIndex:P?0:void 0},Ae({className:"g-ui-timeline-dot"}),Ae({className:"g-ui-timeline-content"},Ct(S.title,()=>Ae({className:"g-ui-timeline-title"},S.title)),Ct(S.description,()=>Ae({className:"g-ui-timeline-desc"},S.description)),S.content))}))}import{Div as Mi,list as Ps}from"@granularjs/core";function Ms(...e){let{props:i}=g(e,{active:0,items:[]}),{active:t,items:r,className:a,...o}=i;return Mi({...o,className:s("g-ui-stepper",a)},Ps(r,(n,u)=>Mi({className:s("g-ui-stepper-item",[t,c=>(console.log("value",c,"idx",u),u.get()===c?"g-ui-stepper-active":"")])},Mi({className:"g-ui-stepper-index"},String(u+1)),Mi({className:"g-ui-stepper-label"},n.label))))}import{Span as Tr,after as Vr,state as Ts}from"@granularjs/core";function Vs(...e){let{props:i,rawProps:t}=g(e,{value:0,max:5,size:"md"}),{value:r,max:a,size:o,className:n,...u}=i,{onChange:c}=t,d=Ts(m(r));Vr(r).change(l=>{let w=m(l);w!=null&&d.set(w)});let p=l=>{d.set(l),c?.(l)},x=[],f=Number(m(a))||0;for(let l=1;l<=f;l+=1)x.push(l);return Tr({...u,className:s("g-ui-rating",D("g-ui-rating-size-",o,"md"),i.className??n)},x.map(l=>Tr({className:s("g-ui-rating-item",Vr(d).compute(w=>l<=w?"g-ui-rating-item-active":"")),onClick:()=>p(l)},"\u2605")))}import{Span as Ls}from"@granularjs/core";function $s(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return Ls({...a,className:s("g-ui-tag",r)},t)}import{Button as Lr,Div as Ue,state as $r,after as Ti}from"@granularjs/core";var Is=["S","M","T","W","T","F","S"];function ni(...e){let{props:i,rawProps:t}=g(e,{size:"md"}),{value:r,className:a,size:o,...n}=i,{onChange:u}=t,c=C=>{let T=m(C);if(T instanceof Date)return T;if(T==null)return null;let S=new Date(T);return Number.isNaN(S.getTime())?null:S},d=$r(c(r)??new Date),p=$r(new Date(d.get()));Ti(r).change(C=>{let T=c(C);T!=null&&(d.set(T),p.set(new Date(T)))});let x=(C,T,S)=>{let h=new Date(C,T+1,0).getDate();return new Date(C,T,Math.min(S,h))},f=C=>{let T=p.get(),S=x(T.getFullYear(),T.getMonth(),C);d.set(S),p.set(S),u?.(S)},l=C=>{let T=p.get(),S=x(T.getFullYear(),T.getMonth()+C,T.getDate());p.set(S)},w=C=>{let T=p.get(),S=x(T.getFullYear()+C,T.getMonth(),T.getDate());p.set(S)},z=Ti(p).compute(C=>C.toLocaleString("default",{month:"long"})),I=Ti(p).compute(C=>String(C.getFullYear())),M=Ti(p,d).compute(([C,T])=>{let S=C.getFullYear(),h=C.getMonth(),v=new Date(S,h,1).getDay(),P=new Date(S,h+1,0).getDate(),N=[];for(let L=0;L<v;L+=1)N.push({muted:!0,label:""});for(let L=1;L<=P;L+=1)N.push({label:L});return[...Is.map(L=>Ue({className:"g-ui-calendar-cell g-ui-calendar-cell-muted"},L)),...N.map(L=>Ue({className:s("g-ui-calendar-cell",L.muted&&"g-ui-calendar-cell-muted",L.label&&T.getFullYear()===S&&T.getMonth()===h&&L.label===T.getDate()&&"g-ui-calendar-cell-active"),onClick:()=>L.label&&f(L.label)},L.label))]});return Ue({...n,className:s("g-ui-calendar",a,D("g-ui-calendar-size-",o,"md"))},Ue({className:"g-ui-calendar-header"},We({size:"xs",variant:"subtle",className:"g-ui-calendar-nav",onClick:()=>l(-1)},xe({size:"sm",className:"g-ui-calendar-nav-icon",innerHTML:xi})),Ue({className:"g-ui-calendar-title-group"},Lr({type:"button",className:"g-ui-calendar-title-button",onClick:()=>l(1)},z),Lr({type:"button",className:"g-ui-calendar-title-button",onClick:()=>w(1)},I)),We({size:"xs",variant:"subtle",className:"g-ui-calendar-nav",onClick:()=>l(1)},xe({size:"sm",className:"g-ui-calendar-nav-icon",innerHTML:bi}))),Ue({className:"g-ui-calendar-grid"},M))}import{Div as si,Span as _e,Input as As,when as St,after as Ne,state as Vi}from"@granularjs/core";function Bs(...e){let{props:i,rawProps:t}=g(e,{data:[],size:"md",searchable:!0}),{value:r,data:a,size:o,className:n,placeholder:u,searchable:c,...d}=i,{onChange:p,onSearchChange:x}=t,f=Vi(m(r)??[]),l=Vi(""),w=Vi(!1),z=Vi(null),I=v=>(m(v)??[]).map(N=>typeof N=="string"?{value:N,label:N}:N&&typeof N=="object"?N:{value:String(N),label:String(N)});Ne(r).change(v=>{let P=m(v);P!=null&&f.set(P)});let M=null;Ne(w).change(v=>{if(M&&(M(),M=null),!v)return;let P=N=>{let L=z.get();L&&(L.contains(N.target)||w.set(!1))};document.addEventListener("mousedown",P),M=()=>document.removeEventListener("mousedown",P)}),Ne(l).change(v=>{x?.(v)});let C=v=>{let P=f.get()??[],N=P.includes(v)?P.filter(L=>L!==v):P.concat(v);f.set(N),p?.(N)},T=Ne(a).compute(v=>I(v)),S=Ne(T,l).compute(([v,P])=>{let N=String(m(P)??"").toLowerCase().trim();return N?v.filter(L=>String(L.label??"").toLowerCase().includes(N)):v}),h=Ne(f,l).compute(([v,P])=>{let N=m(v)??[],L=String(m(P)??"");return!N.length&&!L}),y=Ne(c).compute(v=>!!v);return si({...d,node:z,className:s("g-ui-select-multi-root",n)},si({className:s("g-ui-select-multi",D("g-ui-select-multi-size-",o,"md")),onClick:()=>w.set(!0)},Ne(T,f).compute(([v,P])=>(m(P)??[]).map(L=>{let Q=(v??[]).find(J=>J.value===L)?.label??L;return _e({className:"g-ui-select-tag"},_e({className:"g-ui-select-tag-label",onClick:J=>{J?.stopPropagation?.()}},Q),_e({className:"g-ui-select-tag-remove",innerHTML:$e,onClick:J=>{J?.stopPropagation?.(),C(L)}}))})),St(h,()=>_e({className:"g-ui-select-multi-placeholder"},u??"Select...")),St(y,()=>As({className:"g-ui-select-multi-input",value:l,onInput:v=>l.set(v.target?.value??""),onFocus:()=>w.set(!0)}))),St(w,()=>si({className:"g-ui-select-dropdown"},Ne(S).compute(v=>v.length?v.map(P=>si({className:s("g-ui-select-item",P.disabled&&"g-ui-select-item-disabled",Ne(f).compute(N=>(m(N)??[]).includes(P.value)?"g-ui-select-item-active":"")),onClick:()=>{P.disabled||C(P.value)}},_e({className:"g-ui-select-item-check",innerHTML:Ne(f).compute(N=>(m(N)??[]).includes(P.value)?wi:"")}),_e({className:"g-ui-select-item-label"},P.label))):si({className:"g-ui-select-item"},"Nothing found")))))}import{Div as js,list as Rs,portal as Hs}from"@granularjs/core";import{Div as Dt,Button as Fs,when as Ir,state as Es}from"@granularjs/core";function Pt(...e){let{props:i,rawProps:t,children:r}=g(e),{title:a,className:o,...n}=i,{onClose:u}=t,c=Es(!0),d=()=>{c.set(!1),u?.(),console.log("close")};return Ir(c,()=>Dt({...n,className:s("g-ui-toast",o)},Dt({className:"g-ui-toast-row"},Ir(a,()=>Dt({className:"g-ui-toast-title"},a)),Fs({className:"g-ui-toast-close",onClick:d},xe({innerHTML:$e}))),r))}function Os(...e){let{props:i,rawProps:t}=g(e,{items:[]}),{items:r,className:a,timeout:o,...n}=i,{onClose:u}=t;return Hs(js({...n,className:s("g-ui-toast-stack",a)},Rs(r,c=>Pt({title:c.title,onClose:()=>u?.(c)},c.message))))}function Ws(...e){let{props:i}=g(e);return ni(i)}import{Div as qs,after as Ys}from"@granularjs/core";function Gs(...e){let{props:i,rawProps:t}=g(e,{items:[],position:"top-right"}),{items:r,position:a,className:o,...n}=i,{onRemove:u}=t,c=new Map,d=(x,f)=>x?.id??x?.key??f,p=Ys(r).compute(x=>{let f=m(x)??[],l=new Set;f.forEach((w,z)=>{let I=d(w,z);if(l.add(I),w?.autoClose&&!c.has(I)){let M=setTimeout(()=>{c.delete(I),u?.(w)},w.autoClose);c.set(I,M)}});for(let[w,z]of c.entries())l.has(w)||(clearTimeout(z),c.delete(w));return f.map((w,z)=>lt({key:d(w,z),title:w.title,color:w.color,icon:w.icon,loading:w.loading,withCloseButton:w.withCloseButton,withBorder:w.withBorder,onClose:()=>{w.onClose?.(),u?.(w)}},w.message??w.body??w.content??w.text))});return qs({...n,className:s("g-ui-notifications",D("g-ui-notifications-position-",a,"top-right"),o)},p)}import{Div as Xe,after as ui,state as Zs,when as Us}from"@granularjs/core";function _s(...e){let{props:i,rawProps:t}=g(e,{min:0,max:100,step:1,size:"md"}),{value:r,marks:a,min:o,max:n,step:u,size:c,disabled:d,className:p,...x}=i,{onChange:f}=t,l=Zs(m(r??[o,n])),w=()=>{let h=Number(m(o)),y=Number(m(n));return!Number.isFinite(h)||!Number.isFinite(y)?{minValue:0,maxValue:100}:{minValue:Math.min(h,y),maxValue:Math.max(h,y)}},z=()=>{let h=Number(m(u));return Number.isFinite(h)&&h>0?h:1},I=h=>{let{minValue:y,maxValue:v}=w(),P=z(),N=[y,v];Array.isArray(h)&&(N=h);let L=Math.max(y,Math.min(v,Number(N[0]))),G=Math.max(y,Math.min(v,Number(N[1]))),Q=Math.round(Math.min(L,G)/P)*P,J=Math.round(Math.max(L,G)/P)*P;return[Q,J]};ui(r).change(h=>{h!=null&&l.set(I(h))});let M=h=>{let y=I(h);y?.[0]===l.get()?.[0]&&y?.[1]===l.get()?.[1]||(l.set(y),f?.(y))},C=ui(l).compute(h=>{let{minValue:y,maxValue:v}=w(),P=v-y,[N,L]=I(h);if(P<=0)return{lowPct:0,highPct:0};let G=(N-y)/P*100,Q=(L-y)/P*100;return{lowPct:Math.max(0,Math.min(100,G)),highPct:Math.max(0,Math.min(100,Q))}}),T=(h,y,v)=>{let P=y?.();if(!P||P.width===0)return;let L=Math.min(Math.max(h.clientX-P.left,0),P.width)/P.width,{minValue:G,maxValue:Q}=w(),J=G+L*(Q-G),ne=l;typeof l.get=="function"&&(ne=l.get());let[ee,se]=I(ne);M(v==="low"?[J,se]:[ee,J])},S=(h,y,v)=>{if(ye(d))return;h.preventDefault?.();let P=v||h.currentTarget,N=()=>P.getBoundingClientRect(),L=N(),G=C;typeof C.get=="function"&&(G=C.get());let{lowPct:Q,highPct:J}=G,ne=(h.clientX-L.left)/L.width*100,ee=y;if(!ee){let re=Math.abs(ne-Q)<=Math.abs(ne-J);ee="high",re&&(ee="low")}P.setPointerCapture?.(h.pointerId),T(h,N,ee);let se=re=>T(re,N,ee),ge=()=>{P.releasePointerCapture?.(h.pointerId),window.removeEventListener("pointermove",se),window.removeEventListener("pointerup",ge)};window.addEventListener("pointermove",se),window.addEventListener("pointerup",ge)};return Xe({...x,className:s("g-ui-range-slider",D("g-ui-slider-size-",c,"md"),Y("g-ui-slider-disabled",d),i.className??p)},Xe({className:"g-ui-slider-track",onPointerDown:h=>S(h)},Xe({className:"g-ui-slider-bar",style:ui(C).compute(({lowPct:h,highPct:y})=>({left:`${h}%`,width:`${Math.max(0,y-h)}%`}))}),Xe({className:"g-ui-slider-thumb",style:ui(C).compute(({lowPct:h})=>({left:`${h}%`})),onPointerDown:h=>{h.stopPropagation?.(),S(h,"low",h.currentTarget.parentElement)}}),Xe({className:"g-ui-slider-thumb",style:ui(C).compute(({highPct:h})=>({left:`${h}%`})),onPointerDown:h=>{h.stopPropagation?.(),S(h,"high",h.currentTarget.parentElement)}})),Us(a,()=>Xe({className:"g-ui-slider-marks"},a.map(h=>vt({mark:h,getBounds:w})))))}import{state as Mt,after as Ar}from"@granularjs/core";function Li(...e){let{props:i,rawProps:t}=g(e,{size:"md",format:{pattern:"dddd-dd-dd"}}),{value:r,size:a,calendarSize:o,leftSection:n,rightSection:u,className:c,format:d,minDate:p,maxDate:x,...f}=i,{onChange:l}=t,w=y=>{let v=m(y);if(v instanceof Date)return v;if(v==null||v==="")return null;let P=new Date(v);return Number.isNaN(P.getTime())?null:P},z=(y,v)=>y&&v&&y.getFullYear()===v.getFullYear()&&y.getMonth()===v.getMonth()&&y.getDate()===v.getDate(),I=y=>{if(!y)return"";let v=String(y.getFullYear()).padStart(4,"0"),P=String(y.getMonth()+1).padStart(2,"0"),N=String(y.getDate()).padStart(2,"0");return`${v}-${P}-${N}`},M=y=>{let v=String(y??"").replace(/\D/g,"");if(v.length<8)return null;let P=Number(v.slice(0,4)),N=Number(v.slice(4,6)),L=Number(v.slice(6,8));if(!P||!N||!L)return null;let G=new Date(P,N-1,L);if(G.getFullYear()!==P||G.getMonth()!==N-1||G.getDate()!==L)return null;let Q=w(p);if(Q&&G<Q)return null;let J=w(x);return J&&G>J?null:G},C=Mt(w(r)),T=Mt(I(C.get())),S=Mt(!1);Ar(r).change(y=>{let v=w(y);if(!z(v,C.get())){if(v==null){C.set(null),T.set("");return}C.set(v),T.set(I(v))}}),Ar(T).change(y=>{let v=M(y);v&&(z(v,C.get())||(C.set(v),l?.(v)))});let h=y=>{y&&(z(y,C.get())||(C.set(y),T.set(I(y)),l?.(y),S.set(!1)))};return zt({opened:S,onChange:y=>S.set(!!y),content:ni({size:D("",o,"xs"),value:C,onChange:h}),className:"g-ui-date-input-popover"},fe({...f,size:a,className:s("g-ui-dateinput",c),leftSection:n,rightSection:u,type:"text",inputMode:"numeric",format:d,value:T,onChange:y=>T.set(y)}))}import{Div as Tt,when as Xs,after as Ks,state as Qs}from"@granularjs/core";function Js(...e){let{props:i,rawProps:t,children:r}=g(e),{opened:a,content:o,className:n,...u}=i,{onChange:c}=t,d=Qs(m(a)??!1);Ks(a).change(x=>{let f=m(x);f!=null&&d.set(!!f)});let p=x=>{d.set(x),c?.(x)};return Tt({...u,className:s("g-ui-popper",n)},Tt({onClick:()=>p(!d.get())},r),Xs(d,()=>Tt({className:"g-ui-popper-dropdown"},o)))}import{Button as eu,after as Br,when as iu,state as tu}from"@granularjs/core";function ru(...e){let{props:i,rawProps:t}=g(e,{size:"md"}),{size:r,className:a,rightSection:o,...n}=i,{onChange:u}=t,c=tu(!1),d=Br(c).compute(x=>x?"text":"password"),p=Br(o).compute(x=>x??eu({className:"g-ui-password-toggle",onClick:()=>c.set(!c.get())},iu(c,()=>"Hide",()=>"Show")));return fe({...n,size:r,className:a,onChange:u,rightSection:p,type:d})}import{Div as au}from"@granularjs/core";function ou(...e){let{props:i}=g(e,{size:"md"}),{size:t,className:r,...a}=i;return fe({...a,size:t,className:r,leftSection:au({className:"g-ui-search-input-left-section",innerHTML:Qt}),type:"text",inputMode:"search"})}import{Button as nu,after as su,when as Fr}from"@granularjs/core";import{state as uu}from"@granularjs/core";function gu(...e){let{props:i,children:t}=g(e,{value:"",timeout:1500}),{value:r,timeout:a,className:o,...n}=i,u=uu(!1),c=su(u).compute(p=>s("g-ui-copy-button",p&&"g-ui-copy-button-done",o));return nu({...n,className:c,onClick:async()=>{try{await navigator.clipboard.writeText(String(r)),u.set(!0),setTimeout(()=>u.set(!1),a)}catch{}},type:"button"},Fr(t?.length,()=>t,()=>Fr(u,()=>"Copied",()=>"Copy")))}import{Div as Er,after as gi,resolve as lu}from"@granularjs/core";function jr(e){let i=Number(e);return Number.isNaN(i)?0:Math.max(0,Math.min(100,i))}function cu(...e){let{props:i}=g(e,{size:"md",value:null,color:"primary"}),{size:t,value:r,color:a,className:o,...n}=i,u=gi(r).compute(f=>f!=null&&f!==""),c=gi(r).compute(f=>jr(f)),d=gi(c,u).compute(([f,l])=>{if(!l)return{};let w=Number(f),z=Number.isNaN(w)?0:Math.max(0,Math.min(360,w*3.6));return{background:`conic-gradient(var(--g-ui-progress-ring-fill, var(--g-ui-primary)) 0deg ${z}deg, var(--g-ui-border-muted) ${z}deg 360deg)`}}),p=gi(u).compute(f=>f?"":"g-ui-progress-ring-indeterminate"),x=gi(u,r).compute(([f,l])=>f?jr(l):void 0);return Er({...n,className:s("g-ui-progress-ring",D("g-ui-progress-ring-",a,"primary"),[t,f=>`g-ui-progress-ring-size-${lu(f)??"md"}`],p,o),style:d,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":x},Er({className:"g-ui-progress-ring-hole"}))}import{Div as $i,state as Lt,after as qe,list as du,when as mu}from"@granularjs/core";import{Div as pu}from"@granularjs/core";function Vt(...e){let{props:i,children:t}=g(e,{size:"md"}),{size:r,className:a,...o}=i;return pu({...o,className:s("g-ui-scroll-area",[r,n=>`g-ui-scroll-area-${n}`],a)},t)}function Te(e,i){if(i==null||i==="")return e;let t=String(i).trim().split("."),r=e;for(let a of t)r=r?.[a];return r}function fu(e,i,t){let r=t(i);return String(r??"").toLowerCase().includes(String(e??"").toLowerCase())}function $t(...e){let{props:i,rawProps:t}=g(e,{data:[],size:"md",valuePath:"value",labelPath:"label"}),{data:r,value:a,size:o,valuePath:n,labelPath:u,filter:c,placeholder:d,label:p,description:x,error:f,leftSection:l,rightSection:w,className:z,inputClassName:I,disabled:M,...C}=i,{onChange:T,renderItem:S}=t,h=Lt(!1),y=Lt(""),v=Lt(m(a));qe(a).change(k=>{let F=m(k);F!==v.get()&&v.set(F)});let P=qe(r).compute(k=>Array.isArray(k)?k:[]),N=qe(P,v,n).compute(([k,F,j])=>{if(F==null)return null;let U=K=>j==null||j===""?K:Te(K,j);return k.find(K=>U(K)===F)??null}),L=qe(N,h,y,u).compute(([k,F,j,U])=>{let K=le=>U==null||U===""?String(le??""):String(Te(le,U)??"");return F?j??"":k?K(k):""}),G=qe(P,y,c,u).compute(([k,F,j,U])=>{let K=ve=>U==null||U===""?String(ve??""):String(Te(ve,U)??""),le=m(j)??fu;return k.filter(ve=>le(F,ve,K))}),Q=k=>{let F=m(n),j=F==null||F===""?k:Te(k,F);v.set(j),y.set(""),h.set(!1),T?.(j)},J=()=>{if(m(M))return;h.set(!0);let k=N.get(),F=m(u),j=U=>F==null||F===""?String(U??""):String(Te(U,F)??"");y.set(k?j(k):"")},ne=()=>{h.set(!1);let k=N.get(),F=m(u),j=U=>F==null||F===""?String(U??""):String(Te(U,F)??"");y.set(k?j(k):"")},{onChange:ee,...se}=C,ge={...se,size:o,label:p,description:x,error:f,leftSection:l,rightSection:w,placeholder:m(d)??void 0,disabled:M,value:L,onInput:k=>y.set(k?.target?.value??""),onFocus:J,onClick:J,onBlur:()=>setTimeout(()=>ne(),150)},re=k=>{let F=m(n);return F==null||F===""?k:Te(k,F)},$=k=>qe(v,n).compute(([F,j])=>(K=>j==null||j===""?K:Te(K,j))(k)===F?"g-ui-autocomplete-item-active":""),O=k=>{if(S&&typeof S=="function"){let F=S(k);if(F!=null)return $i({className:s("g-ui-autocomplete-item",$(k)),onClick:()=>Q(k),role:"option"},F)}return $i({className:s("g-ui-autocomplete-item",$(k)),onClick:()=>Q(k),role:"option"},qe(u).compute(F=>F==null||F===""?String(k??""):String(Te(k,F)??"")))};return $i({className:s("g-ui-autocomplete",z,Y("g-ui-autocomplete-disabled",M))},fe({...ge,className:s("g-ui-autocomplete-input-wrapper",ge.className),inputClassName:s("g-ui-autocomplete-input",I)}),mu(h,()=>$i({className:"g-ui-autocomplete-dropdown",role:"listbox"},Vt({className:"g-ui-autocomplete-list",style:{maxHeight:"240px"}},du(G,k=>O(k))))))}function vu(...e){return $t(...e)}import{Div as hu,Span as bu,state as Rr,after as xu}from"@granularjs/core";function Hr(e){let i=m(e);if(i instanceof Date)return i;if(i==null||i==="")return null;let t=new Date(i);return Number.isNaN(t.getTime())?null:t}function Or(e){let i=m(e);if(i==null)return[null,null];let t=Array.isArray(i)?i:[i];return[Hr(t[0]),Hr(t[1])]}function Wr(e,i){return!e||!i?e===i:e.getFullYear()===i.getFullYear()&&e.getMonth()===i.getMonth()&&e.getDate()===i.getDate()}function wu(...e){let{props:i,rawProps:t}=g(e,{size:"md"}),{value:r,size:a,minDate:o,maxDate:n,className:u,placeholderMin:c,placeholderMax:d,...p}=i,{onChange:x}=t,[f,l]=Or(r),w=Rr(f),z=Rr(l);xu(r).change(T=>{let[S,h]=Or(T);Wr(S,w.get())&&Wr(h,z.get())||(w.set(S),z.set(h))});let I=()=>{let T=w.get(),S=z.get();x?.([T??null,S??null])},M=T=>{let S=z.get();T&&S&&T>S&&z.set(T),w.set(T),I()},C=T=>{let S=w.get();T&&S&&T<S&&w.set(T),z.set(T),I()};return hu({...p,className:s("g-ui-range-picker",i.className??u)},Li({...p,size:a,value:w,onChange:M,maxDate:z,placeholder:m(c)??void 0}),bu({className:"g-ui-range-picker-separator"},"\u2013"),Li({...p,size:a,value:z,onChange:C,minDate:w,placeholder:m(d)??void 0}))}import{Div as yu}from"@granularjs/core";function ku(...e){let{props:i,children:t}=g(e,{align:"center",direction:"row"}),{direction:r,wrap:a,align:o,justify:n,gap:u,className:c,...d}=i;return yu({...d,className:s("g-ui-flex",[r,p=>p==="column"?"g-ui-flex-column":"g-ui-flex-row"],[a,"g-ui-flex-wrap"],[o,p=>p&&`g-ui-align-${p}`],[n,p=>p&&`g-ui-justify-${p}`],[u,p=>p&&`g-ui-gap-${p}`],c)},t)}import{A as zu,Div as li,Span as qr,when as ci,after as Yr,state as Nu}from"@granularjs/core";function Cu(...e){let{props:i,rawProps:t,children:r}=g(e,{variant:"subtle",childrenOffset:24}),{label:a,description:o,leftSection:n,rightSection:u,active:c,disabled:d,variant:p,childrenOffset:x,opened:f,defaultOpened:l,className:w,padding:z,...I}=i,{onClick:M,onChange:C}=t,T=r.length>0,S=Nu(m(f)??m(l)??!1);Yr(f).change(v=>{let P=m(v);P!=null&&S.set(!!P)});let h=Yr(x).compute(v=>({paddingLeft:Gt(m(v??24))??"24px"})),y=v=>{if(m(d)){v?.preventDefault?.();return}if(T){let P=!S.get();S.set(P),C?.(P)}M?.(v)};return li({className:s("g-ui-navlink-root",w)},zu({...I,className:s("g-ui-navlink",D("g-ui-navlink-variant-",p,"subtle"),Y("g-ui-navlink-active",c),Y("g-ui-navlink-disabled",d),D("g-ui-navlink-padding-",z,"md")),onClick:y},ci(n,()=>qr({className:"g-ui-navlink-section g-ui-navlink-left"},n)),li({className:"g-ui-navlink-body"},ci(a,()=>li({className:"g-ui-navlink-label"},a)),ci(o,()=>li({className:"g-ui-navlink-description"},o))),ci(u,()=>qr({className:"g-ui-navlink-section g-ui-navlink-right"},u))),T?ci(S,()=>li({className:"g-ui-navlink-children",style:h},r)):null)}import{Div as Gr,when as Su}from"@granularjs/core";function Du(...e){let{props:i,children:t}=g(e,{show:!0,position:"top-right",color:"danger",size:"md"}),{show:r,position:a,color:o,size:n,className:u,...c}=i;return Gr({...c,className:s("g-ui-indicator",D("g-ui-indicator-position-",a,"top-right"),D("g-ui-indicator-color-",o,"danger"),D("g-ui-indicator-size-",n,"md"),u)},t,Su(r,()=>Gr({className:"g-ui-indicator-badge"})))}import{Span as Ii}from"@granularjs/core";function Pu(...e){let{props:i}=g(e),{opened:t,className:r,...a}=i;return Ii({...a,className:s("g-ui-burger",[t,"g-ui-burger-open"],r)},Ii(""),Ii(""),Ii(""))}import{Div as Mu,when as Tu}from"@granularjs/core";function Vu(...e){let{props:i}=g(e),{visible:t,...r}=i;return Tu(t,()=>Mu({...r,className:"g-ui-loading-overlay"},ti({})))}import{Div as Lu}from"@granularjs/core";function $u(...e){let{props:i,children:t}=g(e,{gap:"md"}),{className:r,gap:a,...o}=i;return Lu({...o,className:s("g-ui-grid-system",[a,n=>`g-ui-gap-${n}`],r)},t)}import{Div as Iu}from"@granularjs/core";function Au(...e){let{props:i,children:t}=g(e,{span:12}),{span:r,className:a,...o}=i;return Iu({...o,className:s([r,n=>`g-ui-col-span-${n}`],a)},t)}import{Div as Zr,Input as Bu,after as Ve,state as It,when as Ur,list as Fu}from"@granularjs/core";function Eu(...e){let{props:i,rawProps:t}=g(e,{length:4,size:"md",type:"alphanumeric",mask:!1,placeholder:"\u25CB",disabled:!1,error:!1,oneTimeCode:!1}),{length:r,value:a,size:o,type:n,mask:u,placeholder:c,disabled:d,error:p,oneTimeCode:x,className:f}=i,{onChange:l,onComplete:w}=t,z=It(m(r)??4),I=()=>z.get();Ve(r).change($=>{let O=m($)??4,k=z.get();if(O===k)return;z.set(O);let F=C.get(),j=M.get();C.set(Array.from({length:O},(U,K)=>F[K]??"")),M.set(Array.from({length:O},(U,K)=>j[K]??null))});let M=It(Array.from({length:I()},()=>null)),C=It(Array.from({length:I()},($,O)=>{let k=m(a);return typeof k=="string"||Array.isArray(k)?k[O]??"":""}));Ve(a).change($=>{if($==null)return;let O=I();typeof $=="string"?C.set(Array.from({length:O},(k,F)=>$[F]??"")):Array.isArray($)&&C.set(Array.from({length:O},(k,F)=>$[F]??""))});let T=()=>C.get().join(""),S=$=>{C.set($);let O=$.join("");l?.(O),$.every(k=>k!=="")&&$.length===I()&&w?.(O)},h=$=>{let O=I(),k=M.get();$>=0&&$<O&&k[$]&&(k[$].focus(),k[$].select())},y=()=>{let $=m(n);return $==="number"?/^[0-9]$/:$ instanceof RegExp?$:/^[a-zA-Z0-9]$/},v=($,O)=>{let k=O.target.value,F=y();if(k.length>1){P($,k);return}if(k&&!F.test(k)){O.target.value=C.get()[$]??"";return}let j=C.get().slice();j[$]=k,S(j),k&&$<I()-1&&h($+1)},P=($,O)=>{let k=y(),F=O.split("").filter(le=>k.test(le)),j=C.get().slice(),U=I();F.forEach((le,ve)=>{let De=$+ve;De<U&&(j[De]=le)}),S(j);let K=j.findIndex((le,ve)=>ve>=$&&le==="");K>=0?h(K):h(Math.min($+F.length,U-1))},N=($,O)=>{if(O.key==="Backspace"){let k=C.get().slice();k[$]===""&&$>0?(O.preventDefault(),k[$-1]="",S(k),h($-1)):k[$]!==""&&(k[$]="",S(k))}else O.key==="ArrowLeft"&&$>0?(O.preventDefault(),h($-1)):O.key==="ArrowRight"&&$<I()-1&&(O.preventDefault(),h($+1))},L=($,O)=>{O.target.select()},G=()=>{let $=C.get(),O=$.findIndex(k=>k==="");O>=0?h(O):h($.length-1)},Q=Ve(u).compute($=>m($)?"password":"text"),J=Ve(n).compute($=>m($)==="number"?"numeric":"text"),ne=Ve(x).compute($=>m($)?"one-time-code":"off"),ee=Ve(d).compute($=>!!m($)),se=Ve(p).compute($=>!!m($)),ge=Ve(z).compute($=>Array.from({length:$},(O,k)=>k)),re=$=>Bu({className:s("g-ui-pin-input-field",Ur(se,()=>"g-ui-pin-input-error")),type:Q,inputMode:J,autocomplete:ne,maxLength:2,placeholder:Ur(ee,()=>"",()=>c),disabled:ee,value:Ve(C,$).compute(([O,k])=>O[k]??""),node:M[$.get()],onInput:O=>v($.get(),O),onChange:O=>v($.get(),O),onKeyDown:O=>N($.get(),O),onFocus:O=>L($.get(),O)});return Zr({className:s("g-ui-pin-input",D("g-ui-input-size-",o,"md"),f),onClick:G},Zr({className:"g-ui-pin-input-wrapper"},Fu(ge,re)))}import{Div as ju}from"@granularjs/core";function Ru(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return ju({...a,className:s("g-ui-checkbox-group",r)},t)}import{Div as Hu}from"@granularjs/core";function Ou(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return Hu({...a,className:s("g-ui-avatar-group",r)},t)}import{Div as Wu}from"@granularjs/core";function qu(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return Wu({...a,className:s("g-ui-badge-group",r)},t)}import{Div as Ai,Span as Yu,after as pi,context as _r}from"@granularjs/core";var Gu=_r([]),Xr=_r({sort:null,onSort:null});function At(...e){let{props:i,rawProps:t,children:r}=g(e,{sizes:[],sort:null,stickyHeader:!1}),{className:a,sizes:o,sort:n,stickyHeader:u,...c}=i,{onSort:d}=t,p=Gu.scope(o.get());pi(o).change(f=>p.set(f));let x=Xr.scope({sort:n.get(),onSort:d||null});return pi(n).change(f=>x.set().sort=f),p.serve(x.serve(Ai({className:s("g-ui-grid-table",Y("g-ui-grid-table-sticky",u),a),style:{gridTemplateColumns:pi(p).compute(f=>Array.isArray(f)?f.join(" "):"")},...c},r)))}At.GridRow=(...e)=>{let{props:i,children:t}=g(e,{}),{className:r,header:a,...o}=i;return Ai({className:s("g-ui-grid-table-row",Y("g-ui-grid-table-row-header",a),r),...o},...t)};At.GridCell=function(...e){let{props:i,rawProps:t,children:r}=g(e,{}),{className:a,sort:o,...n}=i,u=t.sort;if(u){let c=Xr.state(),d=pi(c.sort).compute(x=>x?.key===u?x.direction:null),p=()=>{let x=c.get().sort,f;x?.key===u?f=x.direction==="asc"?{key:u,direction:"desc"}:null:f={key:u,direction:"asc"},c.set().sort=f;let{onSort:l}=c.get();l&&l(f)};return Ai({className:s("g-ui-grid-table-cell","g-ui-grid-table-cell-sortable",a),onClick:p,...n},r,Yu({className:"g-ui-grid-table-sort-icon"},pi(d).compute(x=>x==="asc"?" \u2191":x==="desc"?" \u2193":"")))}return Ai({className:s("g-ui-grid-table-cell",a),...n},r)};import{Button as Zu,Div as Uu,Span as Kr,when as Qr}from"@granularjs/core";function Jr(...e){let{props:i,children:t}=g(e,{grow:!0}),{grow:r,className:a,...o}=i;return Uu({...o,className:s("g-ui-bottombar",Y("g-ui-bottombar-grow",r),a)},t)}Jr.Action=function(...i){let{props:t,rawProps:r,children:a}=g(i,{variant:"subtle"}),{icon:o,label:n,active:u,disabled:c,variant:d,className:p,...x}=t,{onClick:f}=r;return Zu({...x,className:s("g-ui-bottombar-action",D("g-ui-bottombar-action-variant-",d,"subtle"),Y("g-ui-bottombar-action-active",u),Y("g-ui-bottombar-action-disabled",c),p),onClick:f,disabled:c},Qr(o,()=>Kr({className:"g-ui-bottombar-action-icon"},o)),Qr(n,()=>Kr({className:"g-ui-bottombar-action-label"},n)),a)};import{Div as R,Button as Ye,state as ce,after as ke,when as pe,Input as Bi,Label as di,Span as Ge}from"@granularjs/core";var _u=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Xu=[{value:"day",label:"Day"},{value:"week",label:"Week"},{value:"month",label:"Month"}];function Fi(e){if(e instanceof Date)return e;if(e==null)return null;let i=new Date(e);return Number.isNaN(i.getTime())?null:i}function ta(e){let i=Fi(e.start),t=Fi(e.end);return!i||!t?null:{...e,id:e.id??`${i.getTime()}-${e.title??"event"}`,title:e.title??"",start:i,end:t,allDay:!!e.allDay,description:e.description??"",location:e.location??"",attendees:Array.isArray(e.attendees)?e.attendees:[],color:e.color??null}}function ra(e,i,t){let r=Fi(i).getTime(),a=Fi(t).getTime();return e.map(ta).filter(Boolean).filter(o=>o.end.getTime()>r&&o.start.getTime()<a)}function ea(e,i){let t=new Date(i);t.setHours(0,0,0,0);let r=t.getTime();t.setHours(23,59,59,999);let a=t.getTime();return ra(e,r,a)}function Bt(e,i){let t=new Date(e),a=(t.getDay()-i+7)%7;return t.setDate(t.getDate()-a),t.setHours(0,0,0,0),t}function Ke(e,i="default"){return e.toLocaleTimeString(i,{hour:"numeric",minute:"2-digit",hour12:!0})}function mi(e,i="default"){return e.toLocaleDateString(i,{weekday:"short",month:"short",day:"numeric"})}function Ku(e,i="default"){return e.toLocaleDateString(i,{month:"long",year:"numeric"})}function Qu(e,i="default"){let t=new Date(e);return t.setDate(t.getDate()+6),`${e.toLocaleDateString(i,{month:"short",day:"numeric"})} \u2013 ${t.toLocaleDateString(i,{month:"short",day:"numeric",year:"numeric"})}`}function ia(e,i,t,r){let a=new Date(e).setHours(t,0,0,0),o=new Date(e).setHours(r,0,0,0),n=(r-t)*60,u=Math.max(e.getTime(),a),d=(Math.min(i.getTime(),o)-u)/6e4,p=(u-a)/6e4/n*100,x=d/n*100;return{top:p,height:x}}function Ju(...e){let{props:i,rawProps:t}=g(e,{defaultView:"month",firstDayOfWeek:0,locale:"default",hourSlotDuration:30,minTime:6,maxTime:22,eventCreationColorOptions:[]}),{events:r=[],defaultView:a,firstDayOfWeek:o,locale:n,hourSlotDuration:u,minTime:c,maxTime:d,eventCreationColorOptions:p,className:x,...f}=i,{onCreateEventRequest:l,onViewEventRequest:w,onUpdateEventRequest:z,onRemoveEventRequest:I,eventCreationEmailLookup:M,eventCreationLocationsCallback:C,eventCreationCalendarsCallback:T,onSlotClick:S,onDateRangeChange:h}=t,y=ce(m(a)??"month"),v=ce(new Date),P=ce(null),N=ce(null),L=ce({title:"",start:null,end:null,allDay:!1,description:"",location:"",attendees:[],color:null}),G=ke(r).compute(b=>Array.isArray(b)?b:[]),Q=v.get(),J=Bt(Q,m(o)??0),ne=m(c)??6,ee=m(d)??22,se=m(u)??30,ge=()=>{let b=new Date(v.get());y.get()==="month"?b.setMonth(b.getMonth()-1):y.get()==="week"?b.setDate(b.getDate()-7):b.setDate(b.getDate()-1),v.set(b),h?.({start:b,end:b,view:y.get()})},re=()=>{let b=new Date(v.get());y.get()==="month"?b.setMonth(b.getMonth()+1):y.get()==="week"?b.setDate(b.getDate()+7):b.setDate(b.getDate()+1),v.set(b),h?.({start:b,end:b,view:y.get()})},$=()=>{let b=new Date;v.set(b),h?.({start:b,end:b,view:y.get()})},O=(b,E,ue=!1)=>{let q=b?new Date(b):new Date(v.get()),ae=E?new Date(E):new Date(q.getTime()+3600*1e3);ue&&(q.setHours(0,0,0,0),ae.setHours(23,59,59,999)),L.set({title:"",start:q,end:ae,allDay:ue,description:"",location:"",attendees:[],color:null}),P.set("create")},k=b=>{N.set(ta(b)),P.set("view"),w?.(b)},F=()=>{let b=N.get();b&&(L.set({title:b.title,start:new Date(b.start),end:new Date(b.end),allDay:b.allDay,description:b.description??"",location:b.location??"",attendees:[...b.attendees||[]],color:b.color??null}),P.set("edit"))},j=()=>{P.set(null),N.set(null)},U=(b,E,ue)=>{if(S){S({date:b,hour:E,allDay:ue});return}let q=new Date(b);if(ue){q.setHours(0,0,0,0);let ae=new Date(q);ae.setHours(23,59,59,999),O(q,ae,!0)}else{q.setHours(E,0,0,0);let ae=new Date(q.getTime()+se*60*1e3);O(q,ae,!1)}},K=()=>{let b=L.get();!b.start||!b.end||l?.({title:b.title,start:b.start,end:b.end,allDay:b.allDay,description:b.description,location:b.location,attendees:b.attendees,color:b.color},()=>{j()})},le=()=>{let b=N.get(),E=L.get();!b||!E.start||!E.end||z?.(b,{title:E.title,start:E.start,end:E.end,allDay:E.allDay,description:E.description,location:E.location,attendees:E.attendees,color:E.color},()=>j())},ve=()=>{let b=N.get();b&&I?.(b,()=>j())},De=ke(y,v).compute(([b,E])=>b==="month"?Ku(E,m(n)):b==="week"?Qu(Bt(E,m(o)??0),m(n)):mi(E,m(n))),Fe=R({className:"g-ui-event-calendar-header"},R({className:"g-ui-event-calendar-nav-group"},We({size:"sm",variant:"subtle",onClick:ge,className:"g-ui-event-calendar-nav"},xe({size:"sm",innerHTML:xi})),We({size:"sm",variant:"subtle",onClick:re,className:"g-ui-event-calendar-nav"},xe({size:"sm",innerHTML:bi})),Ye({type:"button",variant:"subtle",size:"sm",className:"g-ui-event-calendar-today",onClick:$},xe({size:"sm",className:"g-ui-event-calendar-today-icon",innerHTML:tr}),"Today")),R({className:"g-ui-event-calendar-title"},De),R({className:"g-ui-event-calendar-actions"},Xu.map(b=>R({className:s("g-ui-event-calendar-view-option",ke(y).compute(E=>E===b.value?"g-ui-event-calendar-view-option-active":"")),onClick:()=>{y.set(b.value),h?.({start:v.get(),end:v.get(),view:b.value})}},b.label)),Ye({type:"button",variant:"filled",size:"sm",className:"g-ui-event-calendar-create-btn",onClick:()=>O(v.get(),null,!1)},xe({size:"sm",innerHTML:Jt}),"Create"))),fi=ke(v,G,o).compute(([b,E,ue])=>{let q=b.getFullYear(),ae=b.getMonth(),te=(new Date(q,ae,1).getDay()-(ue??0)+7)%7,Se=new Date(q,ae+1,0).getDate(),Pe=new Date(q,ae,0).getDate(),A=[],V=1,H=1,W=Math.ceil((te+Se)/7)*7,ie=[];for(let _=0;_<W;_+=1){let Z,X,oe;_<te?(Z=Pe-te+_+1,oe=new Date(q,ae-1,Z),X=!1):V<=Se?(Z=V,oe=new Date(q,ae,Z),X=!0,V+=1):(Z=H,oe=new Date(q,ae+1,Z),X=!1,H+=1);let he=ea(E,oe),Le=oe.getDate()===new Date().getDate()&&oe.getMonth()===new Date().getMonth()&&oe.getFullYear()===new Date().getFullYear();ie.push(R({key:oe.getTime(),className:s("g-ui-event-calendar-month-cell",!X&&"g-ui-event-calendar-month-cell-outside",Le&&"g-ui-event-calendar-month-cell-today")},R({className:"g-ui-event-calendar-month-cell-header",onClick:()=>U(oe,0,!0)},Ge({className:"g-ui-event-calendar-month-cell-day"},oe.getDate())),R({className:"g-ui-event-calendar-month-cell-events"},he.slice(0,3).map(ze=>R({key:ze.id,className:"g-ui-event-calendar-month-event",style:ze.color?{borderLeftColor:ze.color,backgroundColor:`${ze.color}20`}:{},onClick:Oi=>{Oi.stopPropagation(),k(ze)}},ze.title||"(No title)")),pe(he.length>3,()=>R({className:"g-ui-event-calendar-month-more",onClick:ze=>{ze.stopPropagation(),k(he[3])}},`+${he.length-3} more`)))))}return ie}),Ei=R({className:"g-ui-event-calendar-month"},R({className:"g-ui-event-calendar-weekdays"},_u.map(b=>R({key:b,className:"g-ui-event-calendar-weekday"},b))),R({className:"g-ui-event-calendar-month-grid"},fi)),Ce=[];for(let b=ne;b<ee;b+=1)for(let E=0;E<60;E+=se)Ce.push(b+E/60);let Qe=ke(v,o).compute(([b,E])=>{let ue=Bt(b,E??0),q=[];for(let ae=0;ae<7;ae+=1){let de=new Date(ue);de.setDate(de.getDate()+ae),q.push(de)}return q}),ji=R({className:"g-ui-event-calendar-week"},ke(Qe).compute(b=>R({className:"g-ui-event-calendar-week-days"},R({className:"g-ui-event-calendar-week-time-col"},""),(b||[]).map(E=>R({key:E.getTime(),className:"g-ui-event-calendar-week-day-col"},R({className:"g-ui-event-calendar-week-day-header"},mi(E,m(n))))))),R({className:"g-ui-event-calendar-week-body"},R({className:"g-ui-event-calendar-week-time-col"},Ce.map(b=>{let E=Math.floor(b),ue=(b-E)*60,q=`${E<=12?E:E-12}:${ue===0?"00":ue} ${E<12?"AM":"PM"}`;return R({key:b,className:"g-ui-event-calendar-week-slot-label"},q)})),ke(Qe,G).compute(([b,E])=>{if(!b||!b.length)return null;let ue=b[0],q=new Date(b[6]);q.setHours(23,59,59,999);let ae=ra(E,ue,q);return R({className:"g-ui-event-calendar-week-grid-cols"},b.map(de=>R({key:de.getTime(),className:"g-ui-event-calendar-week-day-col g-ui-event-calendar-week-day-col-body"},Ce.map(te=>R({key:te,className:"g-ui-event-calendar-week-slot",onClick:()=>U(de,te,!1)})),ae.filter(te=>!te.allDay&&te.start.getDate()===de.getDate()&&te.start.getMonth()===de.getMonth()&&te.start.getFullYear()===de.getFullYear()).map(te=>{let{top:Se,height:Pe}=ia(te.start,te.end,ne,ee);return R({key:te.id,className:"g-ui-event-calendar-week-event",style:{top:`${Se}%`,height:`${Pe}%`,borderLeftColor:te.color||"var(--g-ui-primary)"},onClick:A=>{A.stopPropagation(),k(te)}},R({className:"g-ui-event-calendar-week-event-title"},te.title||"(No title)"),pe(!te.allDay,()=>Ge({className:"g-ui-event-calendar-week-event-time"},`${Ke(te.start,m(n))} \u2013 ${Ke(te.end,m(n))}`)))}))))}))),Ri=R({className:"g-ui-event-calendar-day"},R({className:"g-ui-event-calendar-day-body"},R({className:"g-ui-event-calendar-day-time-col"},Ce.map(b=>{let E=Math.floor(b),ue=(b-E)*60,q=`${E<=12?E:E-12}:${ue===0?"00":ue} ${E<12?"AM":"PM"}`;return R({key:b,className:"g-ui-event-calendar-day-slot-label"},q)})),R({className:"g-ui-event-calendar-day-slots"},Ce.map(b=>R({key:b,className:"g-ui-event-calendar-day-slot",onClick:()=>U(v.get(),b,!1)})),ke(G,v).compute(([b,E])=>E?ea(b,E).filter(q=>!q.allDay).map(q=>{let{top:ae,height:de}=ia(q.start,q.end,ne,ee);return R({key:q.id,className:"g-ui-event-calendar-day-event",style:{top:`${ae}%`,height:`${de}%`,borderLeftColor:q.color||"var(--g-ui-primary)"},onClick:te=>{te.stopPropagation(),k(q)}},R({className:"g-ui-event-calendar-day-event-title"},q.title||"(No title)"),Ge({className:"g-ui-event-calendar-day-event-time"},`${Ke(q.start,m(n))} \u2013 ${Ke(q.end,m(n))}`))}):[])))),vi=b=>{let E=L.get(),ue=new Date,q=E.start||ue,ae=E.end||new Date(ue.getTime()+3600*1e3),de=ce(E.title),te=ce(q.toISOString().slice(0,10)),Se=ce(!E.allDay&&q?q.toTimeString().slice(0,5):"09:00"),Pe=ce(ae.toISOString().slice(0,10)),A=ce(!E.allDay&&ae?ae.toTimeString().slice(0,5):"10:00"),V=ce(E.allDay),H=ce(E.description),W=ce(E.location),ie=ce(E.attendees||[]),_=ce(""),Z=ce([]),X=ce([]),oe=ce(""),he=Array.isArray(p)?p:[],Le=ce(E.color),ze=()=>{let B=new Date(te.get()+"T"+(V.get()?"00:00:00":Se.get()+":00")),be=new Date(Pe.get()+"T"+(V.get()?"23:59:59":A.get()+":00"));L.set({title:de.get(),start:B,end:be,allDay:V.get(),description:H.get(),location:W.get(),attendees:ie.get(),color:Le.get()})},Oi=B=>{if(_.set(B),!M||!B.trim()){Z.set([]);return}Promise.resolve(M(B.trim())).then(be=>Z.set(Array.isArray(be)?be:[])).catch(()=>Z.set([]))},aa=B=>{let be=ie.get();be.some(Et=>(Et.email||Et.id)===(B.email||B.id))||(ie.set([...be,{id:B.id,email:B.email??B.label,label:B.label}]),_.set(""),Z.set([]))},oa=B=>{let be=[...ie.get()];be.splice(B,1),ie.set(be)},Ft=()=>{C&&Promise.resolve(C(oe.get())).then(B=>X.set(Array.isArray(B)?B:[])).catch(()=>X.set([]))};return R({className:"g-ui-event-calendar-form"},R({className:"g-ui-event-calendar-form-row"},fe({label:"Title",placeholder:"Event title",value:de,onInput:B=>de.set(B?.target?.value??"")})),R({className:"g-ui-event-calendar-form-row g-ui-event-calendar-form-row-inline"},tt({label:"All day",checked:V,onChange:B=>V.set(B)})),R({className:"g-ui-event-calendar-form-row g-ui-event-calendar-form-row-inline"},R({className:"g-ui-event-calendar-form-field"},di({className:"g-ui-event-calendar-form-label"},"Start"),Bi({type:"date",className:"g-ui-input g-ui-input-size-md",value:te,onInput:B=>te.set(B?.target?.value??"")}),pe(!V,()=>Bi({type:"time",className:"g-ui-input g-ui-input-size-md",value:Se,onInput:B=>Se.set(B?.target?.value??"")}))),R({className:"g-ui-event-calendar-form-field"},di({className:"g-ui-event-calendar-form-label"},"End"),Bi({type:"date",className:"g-ui-input g-ui-input-size-md",value:Pe,onInput:B=>Pe.set(B?.target?.value??"")}),pe(!V,()=>Bi({type:"time",className:"g-ui-input g-ui-input-size-md",value:A,onInput:B=>A.set(B?.target?.value??"")})))),pe(C,()=>R({className:"g-ui-event-calendar-form-row"},di({className:"g-ui-event-calendar-form-label"},"Location"),fe({placeholder:"Search or type location",value:oe,onInput:B=>{oe.set(B?.target?.value??""),Ft()},onFocus:Ft}),pe(ke(X).compute(B=>B&&B.length>0),()=>R({className:"g-ui-event-calendar-form-suggestions"},X.get().map(B=>R({key:B.id??B.label,className:"g-ui-event-calendar-form-suggestion-item",onClick:()=>{W.set(B.label??B.id),oe.set(""),X.set([])}},B.label??B.id)))),pe(ke(W).compute(B=>!!B),()=>Ge({className:"g-ui-event-calendar-form-chip"},W)))),pe(M,()=>R({className:"g-ui-event-calendar-form-row"},di({className:"g-ui-event-calendar-form-label"},"Add guests"),fe({placeholder:"Type email to search",value:_,onInput:B=>Oi(B?.target?.value??"")}),R({className:"g-ui-event-calendar-form-chips"},ie.get().map((B,be)=>Ge({key:(B.email||B.id)+be,className:"g-ui-event-calendar-form-chip g-ui-event-calendar-form-chip-removable",onClick:()=>oa(be)},B.label||B.email||B.id," \xD7"))),pe(ke(Z).compute(B=>B&&B.length>0),()=>R({className:"g-ui-event-calendar-form-suggestions"},Z.get().map(B=>R({key:B.id??B.email,className:"g-ui-event-calendar-form-suggestion-item",onClick:()=>aa(B)},B.label??B.email??B.id)))))),R({className:"g-ui-event-calendar-form-row"},Xi({label:"Description",placeholder:"Add description",value:H,onInput:B=>H.set(B?.target?.value??"")})),pe(he.length>0,()=>R({className:"g-ui-event-calendar-form-row"},di({className:"g-ui-event-calendar-form-label"},"Color"),R({className:"g-ui-event-calendar-form-colors"},he.map(B=>R({key:B.value??B.id??B,className:s("g-ui-event-calendar-form-color-swatch",ke(Le).compute(be=>be===(B.value??B.id??B)?"g-ui-event-calendar-form-color-swatch-active":"")),style:{backgroundColor:B.color??B.value??B},onClick:()=>Le.set(B.value??B.id??B)}))))),R({className:"g-ui-event-calendar-form-actions"},Ye({variant:"subtle",onClick:j},"Cancel"),Ye({variant:"filled",onClick:()=>{ze(),b?le():K()}},b?"Save":"Create")))},Hi=()=>{let b=N.get();return b?R({className:"g-ui-event-calendar-view-modal"},R({className:"g-ui-event-calendar-view-modal-title"},b.title||"(No title)"),R({className:"g-ui-event-calendar-view-modal-meta"},b.allDay?Ge({className:"g-ui-event-calendar-view-modal-date"},mi(b.start,m(n))+(b.start.getTime()!==b.end.getTime()?` \u2013 ${mi(b.end,m(n))}`:"")):Ge({className:"g-ui-event-calendar-view-modal-date"},`${mi(b.start,m(n))} \xB7 ${Ke(b.start,m(n))} \u2013 ${Ke(b.end,m(n))}`)),pe(b.location,()=>R({className:"g-ui-event-calendar-view-modal-field"},"Location: ",b.location)),pe(b.description,()=>R({className:"g-ui-event-calendar-view-modal-field"},b.description)),pe(b.attendees?.length,()=>R({className:"g-ui-event-calendar-view-modal-field"},"Guests: ",b.attendees.map(E=>E.label||E.email||E.id).join(", "))),R({className:"g-ui-event-calendar-view-modal-actions"},Ye({variant:"subtle",size:"sm",onClick:F},xe({size:"sm",innerHTML:er})," Edit"),Ye({variant:"subtle",size:"sm",onClick:ve,className:"g-ui-event-calendar-view-modal-delete"},xe({size:"sm",innerHTML:ir})," Delete"),Ye({variant:"filled",size:"sm",onClick:j},"Close"))):null};return R({...f,className:s("g-ui-event-calendar",x)},Fe,pe(y,b=>b==="month",()=>Ei),pe(y,b=>b==="week",()=>ji),pe(y,b=>b==="day",()=>Ri),pe(P,b=>b==="create",()=>ii({opened:!0,title:"New event",size:"lg",onClose:j},vi(!1))),pe(P,b=>b==="view",()=>ii({opened:!0,title:"Event",size:"md",onClose:j},Hi())),pe(P,b=>b==="edit",()=>ii({opened:!0,title:"Edit event",size:"lg",onClose:j},vi(!0))))}import{state as eg}from"@granularjs/core";function ig(e=!1){let i=eg(!!e);return[i,{open:()=>i.set(!0),close:()=>i.set(!1),toggle:()=>i.set(!i.get())}]}Rt();export{Ao as Accordion,We as ActionIcon,gs as Affix,Qo as Alert,wn as Anchor,fs as AppBar,$t as Autocomplete,rn as Avatar,Ou as AvatarGroup,qa as Badge,qu as BadgeGroup,gn as Blockquote,Jr as BottomBar,_n as Breadcrumbs,Pu as Burger,Zi as Button,ni as Calendar,Oa as Card,Kn as Center,tt as Checkbox,Ru as CheckboxGroup,Ln as Chip,sn as Code,Au as Col,ts as Collapse,Ba as Container,gu as CopyButton,Li as DateInput,Ws as DatePicker,Zo as Divider,Wo as Drawer,Ju as EventCalendar,ds as Fieldset,ku as Flex,$u as Grid,At as GridTable,Ra as Group,ss as HoverCard,xe as Icon,kn as Image,Du as Indicator,on as Kbd,br as List,ti as Loading,Vu as LoadingOverlay,Ro as Menu,ii as Modal,Bs as MultiSelect,Cu as NavLink,lt as Notification,Gs as Notifications,Ki as NumberField,Ja as NumberInput,En as Pagination,_o as Paper,ru as PasswordInput,Eu as PinInput,zt as Popover,Js as Popper,zn as Progress,cu as ProgressRing,Gn as Radio,Hn as RadioGroup,wu as RangePicker,_s as RangeSlider,Vs as Rating,Vt as ScrollArea,ou as SearchInput,An as SegmentedControl,bo as Select,vu as SelectSearch,hs as Sidebar,cn as SimpleGrid,Mn as Skeleton,Sn as Slider,Jn as Space,Ea as Stack,Ms as Stepper,vo as Switch,go as SwitchGroup,Mo as Table,ko as Tabs,$s as Tag,Ui as Text,fe as TextInput,Xi as Textarea,Ds as Timeline,Ia as Title,Pt as Toast,Os as ToastStack,Bo as Tooltip,Y as classFlag,me as classMap,D as classVar,s as cx,ka as getThemeMode,ya as setThemeMode,wa as setThemeVars,g as splitPropsChildren,ig as useDisclosure};
4122
+ `;function Rt(){if(typeof document>"u"||document.getElementById(jt))return;let e=document.createElement("style");e.id=jt,e.textContent=xa,document.head.appendChild(e)}var wa=new Set(["--g-ui-bg","--g-ui-bg-subtle","--g-ui-bg-muted","--g-ui-bg-emphasized","--g-ui-bg-inverted","--g-ui-bg-panel","--g-ui-fg","--g-ui-fg-muted","--g-ui-fg-subtle","--g-ui-fg-inverted","--g-ui-border","--g-ui-border-subtle","--g-ui-border-emphasized","--g-ui-border-inverted","--g-ui-primary","--g-ui-primary-hover","--g-ui-primary-active","--g-ui-primary-subtle","--g-ui-primary-muted","--g-ui-primary-emphasized","--g-ui-success","--g-ui-success-hover","--g-ui-success-active","--g-ui-success-subtle","--g-ui-success-muted","--g-ui-danger","--g-ui-danger-hover","--g-ui-danger-active","--g-ui-danger-subtle","--g-ui-danger-muted","--g-ui-warning","--g-ui-warning-hover","--g-ui-warning-active","--g-ui-warning-subtle","--g-ui-warning-muted","--g-ui-info","--g-ui-info-hover","--g-ui-info-active","--g-ui-info-subtle","--g-ui-info-muted","--g-ui-shadow-xs","--g-ui-shadow-sm","--g-ui-shadow-md","--g-ui-shadow-lg","--g-ui-shadow-xl","--g-ui-shadow-2xl","--g-ui-radius","--g-ui-font","--g-ui-surface","--g-ui-text","--g-ui-muted","--g-ui-primary-strong","--g-ui-shadow"]);function ya(e={},i=document?.documentElement){if(i)for(let[t,r]of Object.entries(e)){let a=t.startsWith("--")?t:`--g-ui-${t}`;wa.has(a)&&i.style.setProperty(a,String(r))}}function ka(e="dark",i=document?.documentElement){i&&(i.classList.remove("g-ui-theme-dark","g-ui-theme-light"),i.classList.add(e==="light"?"g-ui-theme-light":"g-ui-theme-dark"))}function za(e=document?.documentElement){return e.classList.contains("g-ui-theme-light")?"light":"dark"}import{Renderer as Ht,isSignal as Wt,isState as Ot,isStatePath as qt,isComputed as Yt,resolve as Ee,computed as Na,after as qi,concat as Ca}from"@granularjs/core";function Yi(e){return Wt(e)||Ot(e)||qt(e)||Yt(e)}function s(...e){return Ca(...e,{separator:" ",filterFalsy:!0})}function Gt(e){if(!(e==null||e===""))return typeof e=="number"?`${e}px`:e}function g(e,i){let t={},r=[],a=o=>!!o&&typeof o=="object"&&!Array.isArray(o)&&!Ht.isRenderable(o)&&!Ht.isDomNode(o)&&!Wt(o)&&!Ot(o)&&!qt(o)&&!Yt(o);for(let o of e)a(o)?Object.assign(t,o):r.push(o);if(i&&typeof i=="object")for(let o of Object.keys(i))t[o]===void 0&&(t[o]=i[o]);return{props:Na(t),rawProps:t,children:r}}function m(e){return Ee(e)}function ke(e){return!!Ee(e)}function N(e,i,t){let r=a=>{let o=Ee(a),n=o==null||o===""?t:o;return n==null||n===""?"":`${e}${n}`};return Yi(i)?qi(i).compute(a=>r(a)):r(i)}function U(e,i){return Yi(i)?qi(i).compute(t=>Ee(t)?e:""):Ee(i)?e:""}function he(e,i,t){let r=a=>i[a]||null;return Yi(e)?qi(e).compute(a=>r(Ee(a??t))):r(Ee(e??t))}import{Button as Sa,Span as Gi,when as _i,after as Da}from"@granularjs/core";function Zi(...e){let{props:i,children:t}=g(e,{variant:"filled",size:"md",justify:"center"}),{variant:r,color:a,size:o,fullWidth:n,loading:u,leftSection:c,rightSection:d,className:p,disabled:w,justify:f,...l}=i,b=Da(w,u).compute(([z,$])=>z||$);return Sa({...l,disabled:b,className:s("g-ui-button",N("g-ui-button-variant-",r,"filled"),N("g-ui-button-color-",a,"primary"),N("g-ui-justify-",f,"center"),N("g-ui-button-size-",o,"md"),U("g-ui-button-full",n),U("g-ui-button-loading",u),p)},_i(c,()=>Gi({className:"g-ui-button-section-left"},c)),_i(u,()=>Gi("Loading..."),()=>t),_i(d,()=>Gi({className:"g-ui-button-section-right"},d)))}import{Span as Pa}from"@granularjs/core";function Ui(...e){let{props:i,children:t}=g(e,{size:"md"}),{size:r,weight:a,color:o,dimmed:n,align:u,ellipsis:c,decoration:d,className:p,style:w,...f}=i,l=he(a,{bold:"g-ui-text-weight-700",semibold:"g-ui-text-weight-600",medium:"g-ui-text-weight-500",700:"g-ui-text-weight-700",600:"g-ui-text-weight-600",500:"g-ui-text-weight-500",400:"g-ui-text-weight-400"}),b=he(o,{primary:"g-ui-text-primary",success:"g-ui-text-success",danger:"g-ui-text-danger",muted:"g-ui-text-dimmed"}),z=he(u,{center:"g-ui-text-align-center",right:"g-ui-text-align-right",left:"g-ui-text-align-left"}),$=he(d,{underline:"g-ui-text-decoration-underline","line-through":"g-ui-text-decoration-line-through",overline:"g-ui-text-decoration-overline",none:"g-ui-text-decoration-none"});return Pa({...f,style:w,className:s("g-ui-text",N("g-ui-text-size-",r,"md"),U("g-ui-text-dimmed",n),U("g-ui-text-ellipsis",c),l,b,z,$,p)},t)}import{H1 as Ma,H2 as _t,H3 as Ta,H4 as Va,H5 as La,H6 as Ia}from"@granularjs/core";var $a={1:Ma,2:_t,3:Ta,4:Va,5:La,6:Ia};function Aa(...e){let{props:i,children:t}=g(e,{order:2}),{order:r,className:a,style:o,...n}=i,u=m(r)||2;return($a[u]||_t)({...n,className:s("g-ui-title",N("g-ui-title-order-",r,2),a)},t)}import{Div as Ba}from"@granularjs/core";function Fa(...e){let{props:i,children:t}=g(e,{size:"md"}),{size:r,fluid:a,className:o,style:n,...u}=i;return Ba({...u,style:n,className:s("g-ui-container",U("g-ui-container-fluid",a),N("g-ui-container-size-",r,"md"),o)},t)}import{Div as Ea}from"@granularjs/core";function ja(...e){let{props:i,children:t}=g(e,{gap:"md"}),{gap:r,align:a,justify:o,className:n,style:u,...c}=i,d=he(o,{between:"g-ui-justify-between",center:"g-ui-justify-center",end:"g-ui-justify-end",start:"g-ui-justify-start"});return Ea({...c,style:u,className:s("g-ui-stack",N("g-ui-gap-",r,"md"),N("g-ui-align-",a),d,n)},t)}import{Div as Ra}from"@granularjs/core";function Ha(...e){let{props:i,children:t}=g(e,{gap:"md",align:"center"}),{gap:r,align:a,justify:o,position:n,noWrap:u,className:c,style:d,...p}=i,w=he(n,{apart:"g-ui-justify-between",center:"g-ui-justify-center",right:"g-ui-justify-end",left:"g-ui-justify-start"});return Ra({...p,style:d,className:s("g-ui-group",N("g-ui-gap-",r,"md"),N("g-ui-align-",a,"center"),N("g-ui-justify-",o,"none"),w,U("g-ui-no-wrap",u),c)},t)}import{Div as bi,list as Wa,when as Xi,after as Zt}from"@granularjs/core";function Oa(...e){let{props:i,children:t}=g(e,{padding:"md",radius:"md",shadow:"none",border:"default"}),{title:r,content:a,actions:o,border:n,padding:u,radius:c,shadow:d,className:p,style:w,...f}=i;return bi({style:w},Xi(r,()=>bi({className:"g-ui-card-title"},r)),Xi(a,()=>bi({className:"g-ui-card-content"},a)),{className:s("g-ui-card",N("g-ui-card-border-",n,"md"),N("g-ui-card-padding-",u,"md"),N("g-ui-card-radius-",c,"md"),N("g-ui-card-shadow-",d,"md"),p),...f},t,Xi(o,()=>bi({className:"g-ui-card-actions"},Wa(o,l=>Zi({className:"g-ui-card-action",onClick:b=>l.get().onClick?.(b),leftSection:l.leftSection,rightSection:l.rightSection,size:Zt(l.size).compute(b=>b||"sm"),variant:Zt(l.variant).compute(b=>b||"outline"),...l.get().props||{}},l.label)))))}import{Span as qa}from"@granularjs/core";function Ya(...e){let{props:i,children:t}=g(e,{variant:"filled",size:"md"}),{variant:r,size:a,className:o,dot:n,style:u,...c}=i,d=he(r,{dot:"g-ui-badge-dot"});return qa({...c,className:s("g-ui-badge",N("g-ui-badge-variant-",r,"filled"),N("g-ui-badge-size-",a,"md"),U("g-ui-badge-dot",n),d,o)},t)}import{Div as ii,Input as Ga,Textarea as _a,Label as Za,Span as Ua,when as ti,state as Xa,after as Ka,isState as Qa}from"@granularjs/core";function be(...e){let{props:i,rawProps:t}=g(e,{size:"md"}),{label:r,description:a,error:o,size:n,leftSection:u,rightSection:c,className:d,inputClassName:p,multiline:w,value:f,...l}=i,{value:b,node:z,onChange:$,onInput:D,onFocus:C,onBlur:P,onKeyDown:L,onKeyUp:y,onClick:k}=t,h=Qa(b)&&!$&&!D,S=h?b:Xa(m(f)??"");Ka(f).change(E=>{h||S.set(m(E)??"")});let V=E=>{let G=E?.target?.value??"";G!==f.get()&&(S.set(G),$?.(E),D?.(E))},A=ke(w),Q=A?_a:Ga,se=s(p,A&&"g-ui-textarea"),te=Q({...l,node:z,value:S,onInput:V,onChange:V,onFocus:C,onBlur:P,onKeyDown:L,onKeyUp:y,onClick:k,className:s("g-ui-input",se)});return ii({className:s("g-ui-text-input",d)},ti(r,()=>Za({className:"g-ui-text-input-label"},r)),ti(a,()=>Ua({className:"g-ui-text-input-description"},a)),ii({className:s("g-ui-input-wrapper",U("g-ui-input-multiline",w),N("g-ui-input-size-",n,"md"),U("g-ui-input-error",o))},ti(u,()=>ii({className:"g-ui-input-section"},u)),te,ti(c,()=>ii({className:"g-ui-input-section"},c))),ti(o,()=>ii({className:"g-ui-text-input-error-text"},o)))}function Ki(...e){let{props:i}=g(e,{size:"md"}),{size:t,leftSection:r,rightSection:a,className:o,...n}=i;return be({...n,size:t,className:o,leftSection:r,rightSection:a,multiline:!0})}import{Div as Ut,Span as Xt,after as je,state as Ja}from"@granularjs/core";function Qi(...e){let{props:i,rawProps:t}=g(e,{size:"md",step:1,allowDecimal:!0,allowNegative:!0,clampBehavior:"blur",hideControls:!1,decimalSeparator:".",thousandSeparator:"",format:null,prefix:"",suffix:""}),{value:r,min:a,max:o,step:n,size:u,allowDecimal:c,allowNegative:d,decimalSeparator:p,thousandSeparator:w,decimalScale:f,clampBehavior:l,hideControls:b,format:z,locale:$,currency:D,formatOptions:C,prefix:P,suffix:L,leftSection:y,rightSection:k,className:h,onChange:S,onInput:V,...A}=i,{onChange:Q,onInput:se,onBlur:te,onFocus:E,onKeyDown:G}=t,J=I=>{Q?.(I.target?.value??""),se?.(I.target?.value??"")},re=J,X=Ja(""),M=I=>String(I??"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=()=>{if(!!!m(c))return 0;let T=m(f);if(T!=null&&T!==""&&Number.isFinite(Number(T)))return Math.max(0,Number(T));let O=m(z);return O==="currency"||O==="percent"?2:0},x=I=>{let T=m(p)??".",O=m(w)??"",_=String(I??"");if(O&&(_=_.split(O).join("")),!_||_==="-"||_===T||_.endsWith(T))return null;let ae=_.replace(T,"."),ee=Number(ae);return Number.isFinite(ee)?ee:null},B=I=>{let T=m(w)??"";return T?I.replace(/\B(?=(\d{3})+(?!\d))/g,T):I},R=I=>{let T=m(p)??".",O=j(),_=Number(I);if(!Number.isFinite(_))return"";let ae=_<0?"-":"",ee=Math.abs(_),[K,ie=""]=String(ee).split("."),le=B(K);if(O>0){let xe=ie.slice(0,O).padEnd(O,"0");return`${ae}${le}${T}${xe}`}return`${ae}${le}`},q=(I,T)=>{try{let O=m($),_=m(D)??"USD",ae=m(C)??{},ee=j(),K=T==="currency"?"currency":"decimal";return new Intl.NumberFormat(O,{style:K,currency:_,...ee>0?{minimumFractionDigits:ee,maximumFractionDigits:ee}:{maximumFractionDigits:0},...ae}).format(I)}catch{return R(I)}},Y=I=>{let T=I,O=m(a),_=m(o);return O!=null&&Number.isFinite(Number(O))&&(T=Math.max(T,Number(O))),_!=null&&Number.isFinite(Number(_))&&(T=Math.min(T,Number(_))),!m(d)&&T<0&&(T=0),T},oe=()=>{let I=m(L)??"",T=m(z);return!I&&T==="percent"?"%":I},ve=(I,T,O)=>{let _=m(P)??"",ae=oe(),ee=String(I??"").replace(/\u00A0/g," "),K=String(_??"").replace(/\u00A0/g," "),ie=String(ae??"").replace(/\u00A0/g," "),le=K&&ee.startsWith(K),xe=ie&&ee.endsWith(ie);return`${T??""}${le?"":_}${I}${xe?"":ae}`},ze=(I,T)=>{let O=j(),_=m(p)??".",ee=String(I??"").replace(/\D/g,"")||"0",K=O>0?ee.padStart(O+1,"0"):ee,le=(O>0?K.slice(0,-O):K).replace(/^0+(?=\d)/,"")||"0",xe=O>0?K.slice(-O):"",Ae=O>0?`${le}${_}${xe}`:le;return`${T??""}${Ae}`},Pe=I=>{let T=m(P)??"",O=oe(),_=String(I??""),ae=String(T??"").replace(/\u00A0/g," "),ee=String(O??"").replace(/\u00A0/g," ");return ae&&_.replace(/\u00A0/g," ").startsWith(ae)&&(_=_.slice(T.length)),ee&&_.replace(/\u00A0/g," ").endsWith(ee)&&(_=_.slice(0,-O.length)),_},_e=I=>{let T=!!m(d),O=Pe(I),_=T&&O.includes("-")?"-":"",ae=O.replace(/\D/g,""),ee=ze(ae,_);if(m(l)==="strict"){let K=x(ee);if(K!=null){let ie=Y(K);ee=`${ie<0?"-":""}${R(Math.abs(ie))}`}}return ee},Ze=I=>{if(I==null||I==="")return ze("","");if(typeof I=="number"&&Number.isFinite(I)){let ie=m(l)==="strict"?Y(I):I;return`${ie<0?"-":""}${R(Math.abs(ie))}`}let T=Pe(I),O=m(p)??".",ae=!!m(d)&&String(T).includes("-")?"-":"",ee=String(T??"").replace(new RegExp(`[^0-9${M(O)}]`,"g"),""),K=x(`${ae}${ee}`);if(K!=null){let ie=m(l)==="strict"?Y(K):K;return`${ie<0?"-":""}${R(Math.abs(ie))}`}return _e(I)},Me,ei=I=>{let T=m(I);if(T===void 0)return;let O=Ze(T);O!==X.get()&&(Me=O,X.set(O))};ei(r),je(r).change(I=>{ei(I)}),je(X).change(I=>{if(I===Me){Me=void 0;return}Me=void 0;let T=x(I);if(T==null){J?.(I??"");return}J?.(T)});let Ri=je(k).compute(I=>I!=null&&I!==!1),Hi=je(b,Ri).compute(([I,T])=>!m(I)&&!T),vi=je(c).compute(I=>m(I)?"decimal":"numeric"),Wi=je(z,P,L,c,d,p,w,f,l,a,o,$,D,C).compute(()=>({mode:"both",format:I=>{let T=_e(I),O=m(z),ae=!!m(d)&&T.startsWith("-")?"-":"",ee=x(T),K=T.replace(ae,"");if(ee!=null){let ie=Math.abs(ee);if(typeof O=="function")try{K=O(ie)}catch{K=R(ie)}else if(O==="currency")K=q(ie,"currency");else if(O==="decimal"){let le=m($),xe=m(C);K=le||xe?q(ie,"decimal"):R(ie)}else K=R(ie)}return{value:T,raw:T,visual:ve(K,ae,O)}}})),v=I=>{let T=x(X.get()),O=Number(m(n)??1),ae=Y((T??0)+O*I);X.set(R(ae))},H=I=>{if(!I||typeof I.setSelectionRange!="function")return;let T=()=>{try{let O=String(I.value??"").length;I.setSelectionRange(O,O)}catch{}};typeof requestAnimationFrame=="function"?requestAnimationFrame(T):T()},ce=I=>{re?.(I);let T=I?.target;T&&H(T)},Z=I=>{if(te?.(I),m(l)!=="blur")return;let T=x(X.get());if(T==null)return;let O=Y(T);X.set(R(O))},ge=I=>{E?.(I),H(I?.target)},fe=I=>{G?.(I);let T=I?.target;if(!T)return;let O=m(P)??"",_=oe();_&&typeof T.selectionEnd=="number"&&(T.selectionEnd=Math.min(T.selectionEnd,String(T.value??"").length-_.length)),O&&typeof T.selectionStart=="number"&&(T.selectionStart=Math.max(T.selectionStart,O.length))},ue=Ut({className:"g-ui-number-field-controls"},Xt({className:"g-ui-number-field-control",onClick:()=>v(1)},"+"),Xt({className:"g-ui-number-field-control",onClick:()=>v(-1)},"\u2212")),Te=Ut({className:"g-ui-number-field-controls-wrapper"},ue),Ve=je(Hi,k).compute(([I,T])=>I?Te:T);return be({...A,size:u,className:s("g-ui-number-field",h),leftSection:y,rightSection:Ve,type:"text",inputMode:vi,inputClassName:s("g-ui-input-number"),value:X,format:Wi,onInput:ce,onBlur:Z,onFocus:ge,onKeyDown:fe})}function eo(...e){return Qi(...e)}import{Div as ki,Button as io,portal as to,when as Ji,after as ro}from"@granularjs/core";var xi='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1f1f1f"><path d="M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"/></svg>',wi='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1f1f1f"><path d="M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"/></svg>',yi='<svg xmlns="http://www.w3.org/2000/svg" height="40px" viewBox="0 -960 960 960" width="40px" fill="#1f1f1f"><path d="M379.33-244 154-469.33 201.67-517l177.66 177.67 378.34-378.34L805.33-670l-426 426Z"/></svg>',Kt='<svg xmlns="http://www.w3.org/2000/svg" height="40px" viewBox="0 -960 960 960" width="40px" fill="#1f1f1f"><path d="M240-446.67v-66.66h480v66.66H240Z"/></svg>',Be='<svg xmlns="http://www.w3.org/2000/svg" height="40px" viewBox="0 -960 960 960" width="40px" fill="#1f1f1f"><path d="M312-265.33 265.33-312l168-168-168-167L312-693.67l168 168 167-168L693.67-647l-168 167 168 168L647-265.33l-167-168-168 168Z"/></svg>',Qt='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1f1f1f"><path d="M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"/></svg>',Jt='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"/></svg>',er='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h357l-80 80H200v560h560v-278l80-80v358q0 33-23.5 56.5T760-120H200Zm280-360v-80h240v80H480Zm0 160v-80h320v80H480Zm0 160v-80h320v80H480ZM360-360v-80h80v80h-80Zm0 160v-80h80v80h-80Zm0 160v-80h80v80h-80Zm160-320h280l-36-37 37-37v74H520Zm-160 0h80v-80h-80v80ZM120-600v-160l160-160h160l-80 80H200v240h-80Zm80-240v-80 80Z"/></svg>',ir='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"/></svg>',tr='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M200-80q-33 0-56.5-23.5T120-160v-560q0-33 23.5-56.5T200-800h40v-80h80v80h320v-80h80v80h40q33 0 56.5 23.5T840-720v560q0 33-23.5 56.5T760-80H200Zm0-80h560v-400H200v400Z"/></svg>',rr='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1f1f1f"><path d="M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"/></svg>';function ri(...e){let{props:i,rawProps:t,children:r}=g(e,{size:"md",centered:!0,overlay:"normal"}),{opened:a,title:o,size:n,centered:u,overlay:c,position:d,className:p,style:w}=i,{onClose:f}=t,l=ro(d,u).compute(([b,z])=>`g-ui-modal-position-${b??(z===!1?"top-center":"center")}`);return Ji(a,()=>to(ki({className:s("g-ui-modal-overlay",N("g-ui-modal-overlay-",c,"normal"),l),onClick:b=>{b.target===b.currentTarget&&f?.()}},ki({className:s("g-ui-modal",N("g-ui-modal-size-",n,"md"),p)},ki({className:"g-ui-modal-header"},Ji(o,()=>ki({className:"g-ui-modal-title"},o)),Ji(f,()=>io({type:"button",className:"g-ui-button g-ui-button-variant-subtle g-ui-button-size-xs g-ui-modal-close",onClick:f,innerHTML:Be}))),r))))}import{Div as zi,Span as et,after as ar,when as or}from"@granularjs/core";function ai(...e){let{props:i}=g(e,{variant:"spinner",size:"md"}),{variant:t,size:r,className:a}=i,o=ar(t).compute(u=>u==="dots"),n=ar(t).compute(u=>u==="bars");return or(o,()=>zi({className:s("g-ui-loading g-ui-dots",N("g-ui-loading-size-",r,"md"),a)}),()=>or(n,()=>zi({className:s("g-ui-loading g-ui-bars",N("g-ui-loading-size-",r,"md"),a)},et(""),et(""),et("")),()=>zi({className:s("g-ui-loading",N("g-ui-loading-size-",r,"md"),a)},zi({className:"g-ui-spinner"}))))}import{Div as it,Input as ao,Label as oo,Span as nr,when as tt,state as no,after as so}from"@granularjs/core";function rt(...e){let{props:i,rawProps:t}=g(e,{size:"md"}),{checked:r,label:a,description:o,size:n,indeterminate:u,className:c,style:d,inputProps:p,...w}=i,{onChange:f}=t,l=no(ke(r));so(r).change(z=>{z!=null&&(l.set(!!z),f?.(z))});let b=oo({className:"g-ui-checkbox-control"},ao({type:"checkbox",indeterminate:u,checked:l,className:s("g-ui-checkbox-input",N("g-ui-checkbox-size-",n,"md"),p?.className),...w}),tt(l,()=>it({className:"g-ui-checkbox-checked",innerHTML:yi}),()=>{if(!l.get()&&u.get())return it({className:"g-ui-checkbox-indeterminate",innerHTML:Kt})}),tt(a,()=>nr({className:"g-ui-checkbox-label"},a)));return it({className:s("g-ui-checkbox",N("g-ui-checkbox-size-",n,"md"),c)},b,tt(o,()=>nr({className:"g-ui-checkbox-description"},o)))}import{Input as co,Label as po,Span as mo,when as fo,after as ot,state as ho}from"@granularjs/core";import{Div as uo,context as go,after as sr}from"@granularjs/core";var at=go({name:null,selected:null});function lo(...e){let{props:i,rawProps:t,children:r}=g(e),{className:a,name:o,selected:n,onChange:u,...c}=i,{onChange:d}=t,p=at.scope({name:o?.get(),selected:n?.get()});return sr(p.selected).change(w=>{d?.(w)}),sr(n).change(w=>{w!==p.selected.get()&&(p.set().selected=w)}),p.serve(uo({...c,className:s("g-ui-switch-group",a)},r))}function vo(...e){let{props:i,rawProps:t}=g(e,{size:"md"}),{label:r,size:a,className:o,style:n,inputProps:u,checked:c,value:d,...p}=i,{onChange:w}=t,f=ho(c),l=at.state(),b=ot(l).compute(z=>({name:z.name,type:z.name?"radio":"checkbox"}));return ot(l.selected).change(z=>{f.set(z===d.get())}),ot(f).change(z=>{if(w?.(z),!z)return;let $=l.get().selected;l.set().selected=d.get()}),po({className:s("g-ui-switch",N("g-ui-switch-size-",a,"md"),o)},co({type:b.type,name:b.name,value:d,checked:f,className:s("g-ui-switch-input",N("g-ui-switch-size-",a,"md"),u?.className),...p}),fo(r,()=>mo({className:"g-ui-switch-label"},r)))}import{Div as Re,Span as ur,when as nt,state as gr,after as Ni}from"@granularjs/core";import{Span as bo}from"@granularjs/core";function ye(...e){let{props:i,children:t}=g(e,{size:"md"});return bo({...i,className:s("g-ui-icon",N("g-ui-icon-size-",i.size,"md"),N("g-ui-icon-color-",i.color),i.className)},...t)}function xo(...e){let{props:i,rawProps:t}=g(e,{data:[],size:"md"}),{data:r,value:a,size:o,leftSection:n,rightSection:u,placeholder:c,className:d,...p}=i,{onChange:w}=t,f=gr(!1),l=gr(m(a)??"");Ni(a).change(D=>{let C=m(D);C!==void 0&&l.set(C??"")});let b=D=>{l.set(D),w?.(D),f.set(!1)},z=Ni(l).compute(D=>D?"":"g-ui-select-placeholder"),$=Ni(l).compute(D=>{let P=(m(r)??[]).find(L=>L.value===D);return D?P?.label??"":c??""});return Re({...p,className:s("g-ui-select-root",d)},Re({className:s("g-ui-input-wrapper",N("g-ui-input-size-",o,"md"))},nt(n,()=>Re({className:"g-ui-input-section"},n)),Re({className:s("g-ui-select",z),onClick:()=>f.set(!f.get())},ur({className:"g-ui-select-value"},$)),nt(u,()=>Re({className:"g-ui-input-section"},u),()=>ur({className:"g-ui-select-caret"},ye({innerHTML:rr})))),nt(f,()=>Re({className:"g-ui-select-dropdown"},(m(r)??[]).map(D=>Re({className:s("g-ui-select-item",Ni(l).compute(C=>C===D.value?"g-ui-select-item-active":"")),onClick:()=>b(D.value)},D.label)))))}import{Button as wo,Div as Ue,state as Le,after as oi,list as yo,when as ko}from"@granularjs/core";function zo(...e){let{props:i,rawProps:t}=g(e,{tabs:[],orientation:"horizontal",variant:"default",sticky:!0}),{value:r,tabs:a,orientation:o,variant:n,sticky:u,className:c,style:d}=i,{onChange:p}=t,w=Le(m(r)??m(a)?.[0]?.value??""),f=Le(),l=Le(),b=Le(0),z=Le(0),$=Le(0),D=Le(0),C=Le(!1),P=Le(0),L=!1,y=null,k=!1,h=new Set;oi(r).change(x=>{let B=m(x);B!=null&&w.set(B)});let S=x=>{w.set(x),p?.(x)},V=x=>{let B=[],R=x?.parentElement;for(;R;){let q=getComputedStyle(R),Y=`${q.overflow}${q.overflowY}${q.overflowX}`;/(auto|scroll)/.test(Y)&&B.push(R),R=R.parentElement}return B},A=x=>V(x)[0]??null,Q=x=>x?x.getBoundingClientRect().top:0,se=x=>x?x.scrollTop:window.scrollY||window.pageYOffset||0,te=(x,B)=>x>B?"down":x<B?"up":"none",E=(x,B,R,q)=>x==="down"&&B<R?!0:x==="up"&&B>=R?!1:q,G=()=>{let x=f.get(),B=l.get();if(!x||!B)return;if(!ke(u)){C.set(!1),b.set(0);return}if(typeof window>"u")return;let R=x.getBoundingClientRect(),q=B.getBoundingClientRect(),Y=A(x),oe=Q(Y),ve=se(Y),ze=te(ve,P.get());P.set(ve);let Pe=E(ze,R.top,oe,C.get());b.set(q.height),z.set(R.left),$.set(R.width),D.set(oe),Pe!==C.get()&&C.set(Pe)},J=()=>{y==null&&(y=requestAnimationFrame(()=>{y=null,G()}))},re=x=>{!x||h.has(x)||(h.add(x),x.addEventListener("scroll",J,{passive:!0}))},X=()=>{if(L)return;let x=f.get(),B=l.get();!x||!B||typeof window>"u"||(L=!0,G(),re(window),window.addEventListener("resize",J),V(x).forEach(re))};oi(l,f,u).change(X),!k&&typeof window<"u"&&(k=!0,setTimeout(()=>X(),0));let M=oi(C,z,$,D).compute(x=>{let[B,R,q,Y]=x;return B?{position:"fixed",top:`${Y}px`,left:`${R}px`,width:`${q}px`,background:"var(--g-ui-surface)",zIndex:100}:{position:"static",top:"auto",left:"auto",width:"auto",zIndex:"auto",background:"transparent"}}),j=oi(C,b).compute(x=>{let[B,R]=x;return{height:B?`${R}px`:"0px"}});return Ue(Ue({className:s("g-ui-tabs",he(o,{vertical:"g-ui-tabs-vertical"}),N("g-ui-tabs-variant-",n,"default"),i.className??c)},Ue({node:f}),Ue({style:j}),Ue({node:l,className:"g-ui-tabs-list",style:M},yo(a,x=>wo({className:oi(w,x.value).compute(([B,R])=>s("g-ui-tabs-tab",R===B&&"g-ui-tabs-tab-active")),onClick:()=>S(x.get().value)},x.label))),Ue({className:"g-ui-tabs-panel"},ko(w,()=>a.get()?.find(x=>x.value===w.get())?.content??null))))}import{Table as No,Thead as Co,Tbody as So,Tr as Do,Th as Po,Td as Mo,list as cr,when as pr,after as st}from"@granularjs/core";function To(...e){let{props:i}=g(e,{headers:[],rows:[]}),{headers:t,rows:r,striped:a,highlightOnHover:o,withBorder:n,withColumnBorders:u,withRowBorders:c,className:d,style:p,...w}=i,f=st(t).compute(l=>l.length>0);return No({...w,className:s("g-ui-table",U("g-ui-table-striped",a),U("g-ui-table-hover",o),U("g-ui-table-with-border",n),U("g-ui-table-column-borders",u),U("g-ui-table-row-borders",c),d)},pr(f,()=>Co(lr(t,!0))),So(cr(r,l=>lr(l,!1))))}var lr=(e,i)=>{let t=st(e).compute(o=>Array.isArray(o)),r=o=>{let n=st(o).compute(u=>Object.values(u));return a(n)},a=o=>cr(o,n=>i?Lo(n):Vo(n));return Do(pr(t,()=>a(e),()=>r(e)))},Vo=e=>Mo(e),Lo=e=>Po(e);import{Div as ut}from"@granularjs/core";import{state as Io,when as $o,after as Ao}from"@granularjs/core";function Bo(...e){let{props:i,children:t}=g(e,{opened:!1}),{opened:r,className:a,...o}=i,n=Io(ke(r));Ao(r).change(p=>{n.set(ke(p))});let u=()=>{n.set(!n.get())},c=t[0],d=t[1];return ut({...o,className:s("g-ui-accordion",a)},ut({className:"g-ui-accordion-header",onClick:u},c),$o(n,()=>ut({className:"g-ui-accordion-content"},d)))}import{Span as dr}from"@granularjs/core";function Fo(...e){let{props:i,children:t}=g(e),{label:r,className:a,style:o}=i;return dr({className:s("g-ui-tooltip",a)},t,dr({className:"g-ui-tooltip-content"},r))}import{Div as ni,when as Eo,after as jo,state as si,portal as Ro}from"@granularjs/core";var gt=si({currentOpenState:null});function Ho(...e){let i=si(),t=si(),r=si({}),{props:a,rawProps:o,children:n}=g(e,{position:"right"}),{opened:u,content:c,position:d,className:p,...w}=a,{onChange:f}=o,l=si(m(u)??!1);jo(u).change(L=>{let y=m(L);y!=null&&(l.set(!!y),y&&b())});let b=()=>{gt.get().currentOpenState!==l&&(gt.get().currentOpenState?.set(!1),gt.set().currentOpenState=l)};u.get()&&b();let z=L=>{let k=String(L??"right").toLowerCase().split("-").filter(Boolean);if(k.length===1){let V=k[0];return V==="top"||V==="bottom"?{placement:V,align:"center"}:V==="left"||V==="right"?{placement:"bottom",align:V}:V==="center"?{placement:"bottom",align:"center"}:{placement:"bottom",align:"right"}}let[h,S]=k;return h==="top"||h==="bottom"?{placement:h,align:S||"center"}:h==="left"||h==="right"?{placement:h,align:S||"center"}:{placement:"bottom",align:"right"}},$=()=>{let L=i.get(),y=t.get();if(!L||!y||typeof window>"u")return;let k=L.getBoundingClientRect(),h=y.getBoundingClientRect(),S=m(d)??"right",V=getComputedStyle(document.documentElement).getPropertyValue("--g-ui-space-20"),A=Number.parseFloat(V)||20,Q=window.innerWidth||0,se=window.innerHeight||0,te=Math.max(A,Q-h.width-A),E=Math.max(A,se-h.height-A),{placement:G,align:J}=z(S),re=8,X=k.bottom+re,M=k.left;G==="top"||G==="bottom"?(X=G==="top"?k.top-h.height-re:k.bottom+re,J==="center"?M=k.left+k.width/2-h.width/2:J==="right"?M=k.right-h.width:M=k.left):(G==="left"||G==="right")&&(M=G==="left"?k.left-h.width-re:k.right+re,J==="center"?X=k.top+k.height/2-h.height/2:J==="bottom"?X=k.bottom-h.height:X=k.top),M=Math.max(A,Math.min(M,te)),X=Math.max(A,Math.min(X,E)),r.set({top:`${X}px`,left:`${M}px`})},D=L=>{l.set(L),f?.(L),L&&(b(),typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>$()):setTimeout(()=>$(),0))},C=()=>D(!l.get()),P=()=>D(!1);return ni({...w,node:i,className:s("g-ui-menu",p)},ni({onClick:C},n),Eo(l,()=>Ro(ni(ni({className:"g-ui-menu-overlay",onClick:P}),ni({className:"g-ui-menu-dropdown",node:t,style:r},c)))))}import{Div as mr,portal as Wo,when as Oo}from"@granularjs/core";function qo(...e){let{props:i,children:t}=g(e,{position:"right",size:"md",overlay:"normal",shadowed:!0}),{opened:r,onClose:a,position:o,size:n,overlay:u,shadowed:c,className:d,style:p}=i;return Oo(r,()=>Wo(mr({className:s("g-ui-drawer-overlay",N("g-ui-drawer-overlay-",u,"normal")),onClick:a},mr({className:s("g-ui-drawer",he(c,{true:"g-ui-drawer-shadowed"},!0),N("g-ui-drawer-",o,"right"),N("g-ui-drawer-size-",n,"md"),d),onClick:w=>w.stopPropagation()},t))))}import{Button as Yo,Div as lt,Span as fr,when as Ci,after as hr}from"@granularjs/core";function ct(...e){let{props:i,rawProps:t,children:r}=g(e,{color:"blue",withCloseButton:!0}),{title:a,color:o,icon:n,loading:u,withCloseButton:c,withBorder:d,className:p,style:w}=i,{onClose:f}=t,l=hr(n,u).compute(([z,$])=>!z&&!!$),b=hr(n,u).compute(([z,$])=>!!z||!!$);return lt({className:s("g-ui-notification",[d,"g-ui-notification-bordered"],[o,z=>`g-ui-notification-${z}`],[b,"g-ui-notification-with-icon"],p)},Ci(n,()=>fr({className:"g-ui-notification-icon"},n)),Ci(l,()=>ai({size:"sm",className:"g-ui-notification-loader"})),lt({className:"g-ui-notification-body"},Ci(a,()=>lt({className:"g-ui-notification-title"},a)),r),Ci(c,()=>Yo({type:"button",className:"g-ui-notification-close",onClick:()=>f?.()},fr({innerHTML:Be}))))}import{Div as Go,when as _o}from"@granularjs/core";function Zo(...e){let{props:i}=g(e,{labelPosition:"center"}),{label:t,labelPosition:r,vertical:a,className:o,...n}=i;return Go({...n,className:s("g-ui-divider",U("label",t),N("g-ui-divider-label-",r,"center"),U("g-ui-divider-vertical",a),o)},_o(t,()=>Ui({className:"g-ui-divider-label-text",size:"sm"},t)))}import{Div as Uo}from"@granularjs/core";function Xo(...e){let{props:i,children:t}=g(e,{padding:"md",radius:"md",shadow:"none"}),{padding:r,radius:a,shadow:o,className:n,...u}=i;return Uo({...u,className:s("g-ui-paper",[r,c=>`g-ui-card-padding-${c}`],[a,c=>`g-ui-card-radius-${c}`],[o,c=>`g-ui-card-shadow-${c}`],n)},t)}import{Button as Ko,Div as pt,Span as Qo,after as vr,when as dt}from"@granularjs/core";function Jo(...e){let{props:i,rawProps:t,children:r}=g(e,{color:"blue"}),{title:a,color:o,icon:n,withCloseButton:u,className:c,...d}=i,{onClose:p}=t,w=vr(a,u).compute(([l,b])=>l||b),f=vr(n).compute(l=>l!==void 0);return pt({...d,className:s("g-ui-alert",[o,l=>`g-ui-alert-${l}`],c)},pt({className:"g-ui-alert-header"},dt(n,()=>Qo({className:"g-ui-alert-icon"},n)),dt(a,()=>pt({className:"g-ui-alert-title"},a)),dt(u,()=>Ko({type:"button",className:"g-ui-alert-close",onClick:()=>p?.()},"\xD7"))),r)}import{Div as en,Img as tn,when as rn}from"@granularjs/core";function an(...e){let{props:i,children:t}=g(e,{size:"md",alt:""}),{src:r,size:a,alt:o,className:n,...u}=i;return en({...u,className:s("g-ui-avatar",[a,c=>`g-ui-avatar-size-${c}`],n)},rn(r,()=>tn({className:"g-ui-avatar-img",src:r,alt:o}),()=>t))}import{Span as on}from"@granularjs/core";function nn(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return on({...a,className:s("g-ui-kbd",r)},t)}import{Code as sn}from"@granularjs/core";function un(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return sn({...a,className:s("g-ui-code",r)},t)}import{Blockquote as gn}from"@granularjs/core";function ln(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return gn({...a,className:s("g-ui-blockquote",r)},t)}import{Div as cn}from"@granularjs/core";function pn(...e){let{props:i,children:t}=g(e,{cols:3,gap:"md"}),{cols:r,gap:a,className:o,...n}=i;return cn({...n,className:s("g-ui-grid",[a,u=>`g-ui-gap-${u}`],[r,u=>`g-ui-grid-cols-${u}`],o)},t)}import{Ul as dn,Ol as mn,Li as mt,Div as Si,Span as ft,after as ht,when as He,isSignal as fn,isState as hn,isStatePath as vn,isComputed as bn}from"@granularjs/core";function br(...e){let{props:i,children:t}=g(e,{type:"none",size:"md"}),{type:r,size:a,withPadding:o,className:n,...u}=i,c=he(r,{ordered:"g-ui-list-ordered",unordered:"g-ui-list-unordered",none:"g-ui-list-none"}),d=ht(r).compute(z=>z==="ordered"),p=z=>z&&typeof z=="object"&&typeof z.tagName=="string"&&(z.tagName.toLowerCase()==="ul"||z.tagName.toLowerCase()==="ol"),w=z=>z&&typeof z=="object"&&typeof z.tagName=="string"&&z.tagName.toLowerCase()==="li",f=z=>{let $=D=>D?.nodeType==="granular-list-node"?D:D==null||D===!1?null:Array.isArray(D)?D.map(C=>$(C)):w(D)?D:p(D)?mt({className:"g-ui-list-nested-item"},D):mt(ft({className:"g-ui-list-item-shell"},D));return fn(z)||hn(z)||vn(z)||bn(z)?ht(z).compute(D=>$(D)):$(z)},l=He(t,()=>t.map(z=>f(z))),b={...u,className:s("g-ui-list",N("g-ui-list-size-",a,"md"),U("g-ui-list-with-padding",o),c,n)};return He(d,()=>mn(b,l),()=>dn(b,l))}function xn(...e){let{props:i,children:t}=g(e,{withBorder:!1}),{leftSection:r,rightSection:a,title:o,body:n,withBorder:u,className:c,verticalPadding:d,horizontalPadding:p,...w}=i,f=ht(o,n).compute(([l,b])=>!!l||!!b);return mt({...w,className:s("g-ui-list-item",U("g-ui-list-item-border",u),N("g-ui-list-item-vertical-padding-",d,"md"),N("g-ui-list-item-horizontal-padding-",p,"md"),c)},Si({className:"g-ui-list-item-shell"},He(r,()=>ft({className:"g-ui-list-item-section g-ui-list-item-section-left"},r)),He(f,()=>Si({className:"g-ui-list-item-content"},He(o,()=>Si({className:"g-ui-list-item-title"},o)),He(n,()=>Si({className:"g-ui-list-item-body"},n))),()=>t),He(a,()=>ft({className:"g-ui-list-item-section g-ui-list-item-section-right"},a))))}br.Item=xn;import{A as wn}from"@granularjs/core";function yn(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return wn({...a,className:s("g-ui-anchor",r)},t)}import{Img as kn}from"@granularjs/core";function zn(...e){let{props:i}=g(e),{className:t,...r}=i;return kn({...r,className:s("g-ui-image",t)})}import{Div as xr}from"@granularjs/core";function Nn(...e){let{props:i}=g(e,{value:0,color:"primary",size:"md"}),{value:t,color:r,size:a,className:o,...n}=i;return xr({...n,className:s("g-ui-progress",N("g-ui-progress-size-",a,"md"),[t,u=>{let c=Math.max(0,Math.min(100,Number(u)||0));return`g-ui-progress-${Math.round(c/5)*5}`}],[r,u=>u?`g-ui-progress-${u}`:""],o)},xr({className:"g-ui-progress-bar"}))}import{Div as Fe,after as We,state as Cn,when as wr,list as Sn}from"@granularjs/core";function Dn(...e){let{props:i,rawProps:t}=g(e,{size:"md",min:0,max:100,step:1}),{onChange:r}=t,{value:a,marks:o,size:n,min:u,max:c,step:d,disabled:p,className:w,...f}=i,l=Cn(m(a??u)),b=We(o).compute(y=>y&&y.length>0);We(a).change(y=>{y!=null&&l.set(m(y))});let z=()=>{let y=Number(m(u)),k=Number(m(c));return!Number.isFinite(y)||!Number.isFinite(k)?{minValue:0,maxValue:100}:{minValue:Math.min(y,k),maxValue:Math.max(y,k)}},$=()=>{let y=Number(m(d));return Number.isFinite(y)&&y>0?y:1},D=y=>{let{minValue:k,maxValue:h}=z(),S=$(),V=Math.max(k,Math.min(h,Number(y))),A=Math.round((V-k)/S)*S+k;A!==l.get()&&(l.set(A),r?.(A))},C=We(l).compute(y=>{let{minValue:k,maxValue:h}=z(),S=h-k;if(S<=0)return 0;let V=(Number(y??k)-k)/S*100;return Math.max(0,Math.min(100,V))}),P=(y,k)=>{let h=k?.();if(!h||h.width===0)return;let V=Math.min(Math.max(y.clientX-h.left,0),h.width)/h.width,{minValue:A,maxValue:Q}=z();D(A+V*(Q-A))},L=y=>{if(ke(p))return;y.preventDefault?.();let k=y.currentTarget,h=()=>k.getBoundingClientRect();k.setPointerCapture?.(y.pointerId),P(y,h);let S=A=>P(A,h),V=()=>{k.releasePointerCapture?.(y.pointerId),window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",V)};window.addEventListener("pointermove",S),window.addEventListener("pointerup",V)};return Fe({...f,className:s("g-ui-slider",N("g-ui-slider-size-",n,"md"),U("g-ui-slider-disabled",p),w)},Fe({className:"g-ui-slider-track",onPointerDown:L},Fe({className:"g-ui-slider-bar",style:We(C).compute(y=>({width:`${y}%`}))}),Fe({className:"g-ui-slider-thumb",style:We(C).compute(y=>({left:`${y}%`}))})),wr(b,()=>Fe({className:"g-ui-slider-marks-placeholder"})),wr(o,()=>Fe({className:"g-ui-slider-marks"},Sn(o,y=>vt({mark:y,getBounds:z})))))}var vt=({mark:e,getBounds:i})=>{let{minValue:t,maxValue:r}=i(),a=r-t,o=We(e).compute(d=>d.value??d),n=We(e).compute(d=>d.label??String(d.value)??o),u=Number(o),c=0;return a>0&&(c=(u-t)/a*100),Fe({className:"g-ui-slider-mark",style:{left:`${Math.max(0,Math.min(100,c))}%`}},Fe({className:"g-ui-slider-mark-label"},n))};import{Div as Pn,after as Mn}from"@granularjs/core";function Tn(...e){let{props:i}=g(e,{height:"md",width:"full"}),{height:t,width:r,className:a,...o}=i,n=Mn(t,r).compute(([u,c])=>{let d={};return isNaN(u)||(d.height=`${u}px`),isNaN(c)||(d.width=`${c}px`),d});return Pn({...o,style:{width:n.width,height:n.height,...o.style||{}},className:s("g-ui-skeleton",[t,u=>`g-ui-skeleton-h-${u}`],[r,u=>`g-ui-skeleton-w-${u}`],a)})}import{Button as Vn,after as yr,state as Ln}from"@granularjs/core";function In(...e){let{props:i,rawProps:t,children:r}=g(e,{size:"md",variant:"filled",color:"primary"}),{checked:a,size:o,variant:n,color:u,className:c,...d}=i,{onChange:p}=t,w=Ln(!!a);yr(a).change(l=>{l!=null&&w.set(!!l)});let f=l=>{w.set(l),p?.(l)};return Vn({...d,type:"button",className:s("g-ui-chip",N("g-ui-chip-size-",o,"md"),N("g-ui-chip-variant-",n,"filled"),N("g-ui-chip-color-",u,"primary"),yr(w).compute(l=>l?"g-ui-chip-active":""),c),onClick:()=>f(!w.get())},r)}import{Div as bt,after as kr,state as $n,list as An}from"@granularjs/core";function Bn(...e){let{props:i,rawProps:t}=g(e,{data:[],size:"sm"}),{value:r,data:a,size:o,scroll:n,className:u,...c}=i,{onChange:d}=t,p=$n(m(r));kr(r).change(f=>{let l=m(f);l!=null&&p.set(l)});let w=f=>{p.set(f),d?.(f)};return bt({...c,className:s(n&&"g-ui-segmented-scroll")},bt({className:s("g-ui-segmented",N("g-ui-segmented-size-",o,"sm"),u)},An(a,(f=>bt({className:s("g-ui-segmented-item",kr(p).compute(l=>f.get().value===l?"g-ui-segmented-active":"")),onClick:()=>w(f.get().value)},f.label)))))}import{Button as xt,Div as Fn,state as En,after as Di}from"@granularjs/core";function jn(...e){let{props:i,rawProps:t}=g(e,{total:1,size:"md"}),{page:r,total:a,size:o,className:n,...u}=i,{onChange:c}=t,d=En(m(r)??1);Di(r).change(l=>{let b=m(l);b!=null&&d.set(b)});let p=l=>{let b=Number(m(a))||1,z=Math.max(1,Math.min(b,l));d.set(z),c?.(z)},w=[],f=Number(m(a))||1;for(let l=1;l<=f;l+=1)w.push(l);return Fn({...u,className:s("g-ui-pagination",N("g-ui-pagination-size-",o,"md"),i.className??n)},xt({className:"g-ui-pagination-item",onClick:()=>p((d.get?.()??d)-1),disabled:Di(d).compute(l=>l<=1)},"<"),w.map(l=>xt({className:Di(d).compute(b=>s("g-ui-pagination-item",l===b&&"g-ui-pagination-item-active")),onClick:()=>p(l)},String(l))),xt({className:"g-ui-pagination-item",onClick:()=>p((d.get?.()??d)+1),disabled:Di(d).compute(l=>l>=a)},">"))}import{Div as On,Input as qn,Label as Yn,Span as zr,when as Nr,after as kt,state as Gn}from"@granularjs/core";import{Div as Rn,context as Hn,after as wt}from"@granularjs/core";var yt=Hn({name:"",selected:null});function Wn(...e){let{props:i,children:t,rawProps:r}=g(e),{className:a,name:o,selected:n,onChange:u,...c}=i,{onChange:d}=r,p=yt.scope({name:o?.get(),selected:n?.get()});return console.log("selected?.get()",n?.get()),wt(o).change(w=>{p.set().name=w}),wt(n).change(w=>{w!==p.selected.get()&&(p.set().selected=w)}),wt(p.selected).change(w=>{d?.(w)}),p.serve(Rn({...c,className:s("g-ui-stack g-ui-gap-sm",a)},t))}function _n(...e){let{props:i,rawProps:t}=g(e,{size:"md"}),{label:r,name:a,value:o,checked:n,description:u,size:c,className:d,inputProps:p,...w}=i,{onChange:f}=t,l=Gn(n?.get()??!1),b=yt.state(),z=kt(b.name,a).compute(([D,C])=>D||C);kt(n,b.selected).change(D=>{let[C,P]=D;b.get().name?l.set(P===o.get()):l.set(C)}),kt(l).change(D=>{f?.(D),D&&b.get().name&&(b.set().selected=o.get())});let $=Yn({className:"g-ui-radio-control"},qn({type:"radio",name:z,value:o,checked:l,className:s("g-ui-radio-input",N("g-ui-radio-size-",c,"md"),p?.className),...w}),Nr(r,()=>zr({className:"g-ui-radio-label"},r)));return On({className:s("g-ui-radio",N("g-ui-radio-size-",c,"md"),d)},$,Nr(u,()=>zr({className:"g-ui-radio-description"},u)))}import{Nav as Zn,Span as Un}from"@granularjs/core";function Xn(...e){let{props:i,children:t}=g(e,{separator:"/"}),{separator:r,className:a,...o}=i,n=[];Array.isArray(t)?n.push(...t):n.push(t);let u=n.filter(Boolean),c=[];return u.forEach((d,p)=>{c.push(d),p<u.length-1&&c.push(Un({className:"g-ui-breadcrumbs-separator"},r))}),Zn({...o,className:s("g-ui-breadcrumbs",a)},c)}import{Div as Kn}from"@granularjs/core";function Qn(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return Kn({...a,className:s("g-ui-center",r)},t)}import{Div as Jn}from"@granularjs/core";function es(...e){let{props:i}=g(e,{size:"md"}),{size:t,className:r,...a}=i;return Jn({...a,className:s("g-ui-space",[t,o=>`g-ui-space-${o}`],r)})}import{Div as is,when as ts}from"@granularjs/core";function rs(...e){let{props:i,children:t}=g(e),{opened:r,className:a,...o}=i;return ts(r,()=>is({...o,className:s("g-ui-collapse",a)},t))}import{Button as as}from"@granularjs/core";function Oe(...e){let{props:i,children:t}=g(e,{size:"md",variant:"filled"}),{size:r,variant:a,color:o,className:n,...u}=i;return as({...u,type:"button",className:s("g-ui-action-icon",N("g-ui-action-icon-size-",r,"md"),N("g-ui-action-icon-color-",o,"primary"),N("g-ui-action-icon-",a,"filled"),n)},t)}import{Div as zt,when as os,after as ns,state as ss}from"@granularjs/core";function Nt(...e){let{props:i,rawProps:t,children:r}=g(e,{position:"left"}),{opened:a,position:o,content:n,className:u,...c}=i,{onChange:d}=t,p=ss(m(a)??!1);ns(a).change(f=>{let l=m(f);l!=null&&p.set(!!l)});let w=f=>{p.set(f),d?.(f)};return zt({...c,className:s("g-ui-popover",i.className??u)},zt({onClick:()=>w(!p.get())},r),os(p,()=>zt({className:s("g-ui-popover-dropdown",o==="right"&&"g-ui-popover-right",o==="center"&&"g-ui-popover-center")},n)))}import{Div as Cr}from"@granularjs/core";function us(...e){let{props:i,children:t}=g(e,{position:"left"}),{position:r,content:a,className:o,...n}=i;return Cr({...n,className:s("g-ui-hover-card",o)},t,Cr({className:s("g-ui-hover-card-dropdown",[r,u=>u==="right"?"g-ui-hover-card-right":""],[r,u=>u==="center"?"g-ui-hover-card-center":""])},a))}import{Div as gs}from"@granularjs/core";function ls(...e){let{props:i,children:t}=g(e,{position:"bottom-right"}),{position:r,className:a,...o}=i;return gs({...o,className:s("g-ui-affix",[r,n=>`g-ui-affix-${n}`],a)},t)}import{Fieldset as cs,Legend as ps,when as ds}from"@granularjs/core";function ms(...e){let{props:i,children:t}=g(e),{legend:r,className:a,...o}=i;return cs({...o,className:s("g-ui-fieldset",a)},ds(r,()=>ps({className:"g-ui-legend"},r)),t)}import{Div as fs}from"@granularjs/core";function hs(...e){let{props:i,children:t}=g(e,{position:"sticky"}),{position:r,className:a,...o}=i;return fs({...o,className:s("g-ui-appbar",N("g-ui-appbar-",r,"sticky"),a)},t)}import{Div as Ct,portal as vs,after as Pi,state as Sr,when as Dr}from"@granularjs/core";function bs(...e){let{props:i,children:t}=g(e,{position:"left",size:"md",blur:!0,fixed:!1,minWidth:"button"});return Dr(i.fixed,()=>ws(i,t),()=>xs(i,t))}var xs=(e,i)=>{let{open:t,onClose:r,position:a,size:o,blur:n,fixed:u,minWidth:c,className:d,...p}=e,w=Sr(!1),f=Sr(!1),l=220,b=D=>{if(D){w.set(!0),typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>f.set(!0)):setTimeout(()=>f.set(!0),0);return}f.set(!1),setTimeout(()=>w.set(!1),l)};b(!!t.get()),Pi(t).change(D=>b(!!D));let z=Pi(f,n).compute(D=>{let[C,P]=D;return s("g-ui-sidebar-overlay",C&&"g-ui-sidebar-overlay-open",!P&&"g-ui-sidebar-overlay-noblur")}),$=Pi(o,a,f,d).compute(D=>{let[C,P,L,y]=D,k=P==="right"?"g-ui-sidebar-drawer-right g-ui-sidebar-position-right":"g-ui-sidebar-drawer-left";return s("g-ui-sidebar","g-ui-sidebar-drawer",`g-ui-sidebar-size-${C}`,k,L&&"g-ui-sidebar-drawer-open",m(y))});return Dr(w,()=>vs(Ct({className:z,onClick:r},Ct({className:$,onClick:D=>D.stopPropagation()},i))))},ws=(e,i)=>{let{open:t,position:r,size:a,minWidth:o,className:n,...u}=e,c=Pi(a,r,t,o,n).compute(d=>{let[p,w,f,l,b]=d,z=l||"button",$=null;return z==="button"?$="g-ui-sidebar-min-button":z==="xs"?$="g-ui-sidebar-min-xs":z==="sm"?$="g-ui-sidebar-min-sm":z==="md"&&($="g-ui-sidebar-min-md"),s("g-ui-sidebar g-ui-sidebar-fixed",`g-ui-sidebar-size-${p||"md"}`,$,f&&"g-ui-sidebar-fixed-open",b)});return Ct({...u,className:c},i)};import{Div as Ne,when as Mi,list as Pr,after as ne,resolve as pe,state as ys,Img as ks,Span as zs}from"@granularjs/core";var Mr={xs:6,sm:8,md:10,lg:12,xl:14},Ns={xs:"2px",sm:"3px",md:"4px",lg:"6px",xl:"8px"},Cs={xs:"6px",sm:"8px",md:"10px",lg:"12px",xl:"14px"},Ss=14;function Ds(e){if(e==null||e==="")return"var(--g-ui-primary)";let i=String(e).trim();return i.startsWith("#")?i:`var(--g-ui-${i})`}function Ps(e){return(e??[]).map(t=>{if(t==null)return 1;let r=Number(t.weight);return Number.isFinite(r)&&r>=0?r:1})}function Ti(e){let i=(e??[]).length;if(i<2)return{totalWeight:0,cumulativeWeights:[0]};let r=Ps(e).slice(0,i-1),a=r.reduce((n,u)=>n+u,0),o=[0];for(let n=0;n<r.length;n++)o.push(o[n]+r[n]);return{totalWeight:a,cumulativeWeights:o}}function Tr(e,i,t,r){if(r<1||t<=0)return 0;let a=Math.max(0,Math.min(100,e));for(let o=r-1;o>=0;o--){let n=i[o]/t*100;if(a>=n)return o}return 0}function Ms(e,i,t,r,a,o,n){let u=e,c=(n??[]).length;if(c===0)return{activeStep:0,progressPct:0};if(u==="step")return{activeStep:Math.max(0,Math.min(c-1,Math.floor(i??0))),progressPct:0};if(u==="percent"){let d=Math.max(0,Math.min(100,Number(t)||0)),p=Ti(n);return{activeStep:Tr(d,p.cumulativeWeights,p.totalWeight,c),progressPct:d}}if(u==="time"){let d=Number(r)||0,p=a,w=o,f=0;if(Array.isArray(p)&&p.length>=c?f=p.slice(0,c).reduce((C,P)=>C+(Number(P)||0),0):typeof w=="number"&&w>0&&(f=w),f<=0)return{activeStep:0,progressPct:0};let l=f/c,b=0;if(Array.isArray(p)&&p.length>=c){let C=0;for(let P=0;P<c;P++){if(C+=Number(p[P])||0,d<C){b=P;break}b=P}}else b=Math.min(c-1,Math.floor(d/l));let z=Math.min(100,d/f*100),$=Ti(n);return{activeStep:Tr(z,$.cumulativeWeights,$.totalWeight,c),progressPct:z}}return{activeStep:0,progressPct:0}}function Ts(e,i,t,r,a,o){if(a<2||r<0||r>=a-1)return 0;if(e==="step")return i>r?100:0;let{totalWeight:n,cumulativeWeights:u}=o??Ti([]);if(n<=0)return 0;let c=u[r]/n*100,d=u[r+1]/n*100;if(t<=c)return 0;if(t>=d)return 100;let p=d-c;return p<=0?0:(t-c)/p*100}var Vs=0;function Ls(e){let i=document.getElementById(e);if(!i)return[];let t=i.querySelectorAll(".g-ui-timeline-item");if(t.length<2)return[];let r=i.dataset.pinSize||"md",a=Mr[r]??Mr.md,o=[];for(let n=0;n<t.length-1;n++){let u=t[n].offsetTop+a,c=t[n+1].offsetTop-t[n].offsetTop;o.push({top:u,height:c})}return o}function Is(...e){let{props:i,rawProps:t}=g(e,{items:[],mode:"step",active:0,progress:0,elapsedMs:0,stepDurationsMs:null,totalDurationMs:null,clickable:!1,pinRadius:"md",reverseActive:!1,lineWidth:"md",pinSize:"md",activeColor:"primary",align:"left",pinMode:"default"}),{items:r,mode:a,active:o,progress:n,elapsedMs:u,stepDurationsMs:c,totalDurationMs:d,clickable:p,pinRadius:w,reverseActive:f,lineWidth:l,pinSize:b,activeColor:z,align:$,pinMode:D,className:C,...P}=i,{onChange:L}=t,y=ne(z).compute(E=>Ds(pe(E))),k=`g-ui-timeline-${++Vs}`,h=ys([]),S=ne(a,o,n,u,c,d,r).compute(E=>{let[G,J,re,X,M,j,x]=E;return Ms(G,J,re,X,M,j,x)}),V=ne(h,f).compute(([E,G])=>{if(!pe(G)||!E?.length)return null;let J=E[0],re=0;for(let X of E)re+=X.height;return{top:J.top,height:re}}),A=ne(S).compute(E=>E?.progressPct!=null?`${Math.max(0,Math.min(100,E.progressPct))}%`:"0%"),Q=ne(a).compute(E=>{let G=pe(E);return G==="time"||G==="percent"||G==="step"}),se=ne(a).compute(E=>pe(E));function te(){setTimeout(()=>{let E=Ls(k);E.length&&h.set(E)},0)}return ne(r).change(()=>te()),ne(b).change(()=>te()),te(),Ne({...P,id:k,"data-pin-size":ne(b).compute(E=>pe(E)??"md"),"data-active-color":ne(z).compute(E=>{let G=pe(E);if(G==null||typeof G!="string")return"primary";let J=String(G).trim();return J.startsWith("#")?"custom":J||"primary"}),style:ne(z,l,b).compute(([E,G,J])=>{let re={"--g-ui-timeline-line-width":Ns[pe(G)]??"4px","--g-ui-timeline-track-offset":`calc(${Ss}px - var(--g-ui-timeline-line-width) / 2)`,"--g-ui-timeline-pin-half":Cs[pe(J)]??"10px"},X=pe(E);return X&&String(X).trim().startsWith("#")&&(re["--g-ui-timeline-active-color"]=String(X).trim()),re}),className:s("g-ui-timeline",ne(a).compute(E=>E?`g-ui-timeline-mode-${pe(E)}`:""),ne(Q).compute(E=>E?"g-ui-timeline-has-track":""),ne(p).compute(E=>pe(E)?"g-ui-timeline-clickable":""),ne(f).compute(E=>pe(E)?"g-ui-timeline-reverse":""),ne($).compute(E=>pe(E)==="right"?"g-ui-timeline-align-right":""),N("g-ui-timeline-pin-radius-",w,"md"),N("g-ui-timeline-line-width-",l,"md"),N("g-ui-timeline-pin-size-",b,"md"),ne(D).compute(E=>E?`g-ui-timeline-pin-mode-${pe(E)}`:""),C)},Mi(Q,()=>ne(f).compute(E=>pe(E)?Ne({className:"g-ui-timeline-track-segment g-ui-timeline-track-reverse",style:ne(V).compute(G=>G?{top:`${G.top}px`,height:`${G.height}px`}:{})},Ne({className:"g-ui-timeline-track-fill",style:ne(A).compute(G=>G?{height:G}:{height:"0%"})})):Pr(h,(G,J)=>{let re=ne(G).compute(j=>j?{top:`${j.top}px`,height:`${j.height}px`}:{}),X=ne(S,J,r,se).compute(([j,x,B,R])=>{let q=B??[],Y=q.length,oe=Ti(q);return Ts(R,j?.activeStep??0,j?.progressPct??0,pe(x)??0,Y,oe)}),M=ne(X).compute(j=>`${Math.max(0,Math.min(100,j))}%`);return Ne({className:"g-ui-timeline-track-segment",style:ne(re).compute(j=>j)},Ne({className:"g-ui-timeline-track-fill",style:ne(M).compute(j=>j?{height:j}:{height:"0%"})}))}))),Pr(r,(E,G)=>{let J=ne(S,G,r,f).compute(([q,Y,oe,ve])=>{let ze=q?.activeStep??0,Pe=pe(Y)??0,_e=(oe??[]).length,Ze=pe(ve)?_e-1-Pe:Pe;return Ze<ze?"completed":Ze===ze?"active":"future"}),re=ne(J).compute(q=>q?`g-ui-timeline-item-${q}`:""),X=pe(p)&&typeof L=="function"?()=>{let q=pe(G);typeof q=="number"&&L(q)}:void 0,M=ne(D).compute(q=>pe(q)??"default"),j=ne(M,E).compute(([q,Y])=>{let oe=q??"default";return oe==="icon"&&(Y?.icon!=null||Y?.pinIcon!=null)?zs({className:"g-ui-timeline-pin-icon material-symbols-outlined"},Y.icon??Y.pinIcon??""):oe==="image"&&(Y?.image!=null||Y?.pinImage!=null||Y?.src!=null)?ks({className:"g-ui-timeline-pin-image",src:Y.image??Y.pinImage??Y.src,alt:Y.pinImageAlt??""}):oe==="custom"&&Y?.pinContent!=null?Y.pinContent:null}),x=ne(M,E).compute(([q,Y])=>{let oe=q??"default";return oe==="icon"?Y?.icon!=null||Y?.pinIcon!=null:oe==="image"?Y?.image!=null||Y?.pinImage!=null||Y?.src!=null:oe==="custom"?Y?.pinContent!=null:!1}),B=Ne({className:"g-ui-timeline-dot"},Ne({className:"g-ui-timeline-dot-inner"}),Mi(x,()=>j)),R=Ne({className:"g-ui-timeline-content"},Mi(E.title,()=>Ne({className:"g-ui-timeline-title"},E.title)),Mi(E.description,()=>Ne({className:"g-ui-timeline-desc"},E.description)),E.content);return Ne({className:s("g-ui-timeline-item",re),style:ne(y).compute(q=>q?{"--g-ui-timeline-active-color":q}:void 0),onClick:X,role:X?"button":void 0,tabIndex:X?0:void 0},Ne({className:"g-ui-dot-wrapper"},B),R)}))}import{Div as Vi,list as $s}from"@granularjs/core";function As(...e){let{props:i}=g(e,{active:0,items:[]}),{active:t,items:r,className:a,...o}=i;return Vi({...o,className:s("g-ui-stepper",a)},$s(r,(n,u)=>Vi({className:s("g-ui-stepper-item",[t,c=>(console.log("value",c,"idx",u),u.get()===c?"g-ui-stepper-active":"")])},Vi({className:"g-ui-stepper-index"},String(u+1)),Vi({className:"g-ui-stepper-label"},n.label))))}import{Span as Vr,after as Lr,state as Bs}from"@granularjs/core";function Fs(...e){let{props:i,rawProps:t}=g(e,{value:0,max:5,size:"md"}),{value:r,max:a,size:o,className:n,...u}=i,{onChange:c}=t,d=Bs(m(r));Lr(r).change(l=>{let b=m(l);b!=null&&d.set(b)});let p=l=>{d.set(l),c?.(l)},w=[],f=Number(m(a))||0;for(let l=1;l<=f;l+=1)w.push(l);return Vr({...u,className:s("g-ui-rating",N("g-ui-rating-size-",o,"md"),i.className??n)},w.map(l=>Vr({className:s("g-ui-rating-item",Lr(d).compute(b=>l<=b?"g-ui-rating-item-active":"")),onClick:()=>p(l)},"\u2605")))}import{Span as Es}from"@granularjs/core";function js(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return Es({...a,className:s("g-ui-tag",r)},t)}import{Button as Ir,Div as Xe,state as $r,after as Li}from"@granularjs/core";var Rs=["S","M","T","W","T","F","S"];function ui(...e){let{props:i,rawProps:t}=g(e,{size:"md"}),{value:r,className:a,size:o,...n}=i,{onChange:u}=t,c=C=>{let P=m(C);if(P instanceof Date)return P;if(P==null)return null;let L=new Date(P);return Number.isNaN(L.getTime())?null:L},d=$r(c(r)??new Date),p=$r(new Date(d.get()));Li(r).change(C=>{let P=c(C);P!=null&&(d.set(P),p.set(new Date(P)))});let w=(C,P,L)=>{let y=new Date(C,P+1,0).getDate();return new Date(C,P,Math.min(L,y))},f=C=>{let P=p.get(),L=w(P.getFullYear(),P.getMonth(),C);d.set(L),p.set(L),u?.(L)},l=C=>{let P=p.get(),L=w(P.getFullYear(),P.getMonth()+C,P.getDate());p.set(L)},b=C=>{let P=p.get(),L=w(P.getFullYear()+C,P.getMonth(),P.getDate());p.set(L)},z=Li(p).compute(C=>C.toLocaleString("default",{month:"long"})),$=Li(p).compute(C=>String(C.getFullYear())),D=Li(p,d).compute(([C,P])=>{let L=C.getFullYear(),y=C.getMonth(),h=new Date(L,y,1).getDay(),S=new Date(L,y+1,0).getDate(),V=[];for(let A=0;A<h;A+=1)V.push({muted:!0,label:""});for(let A=1;A<=S;A+=1)V.push({label:A});return[...Rs.map(A=>Xe({className:"g-ui-calendar-cell g-ui-calendar-cell-muted"},A)),...V.map(A=>Xe({className:s("g-ui-calendar-cell",A.muted&&"g-ui-calendar-cell-muted",A.label&&P.getFullYear()===L&&P.getMonth()===y&&A.label===P.getDate()&&"g-ui-calendar-cell-active"),onClick:()=>A.label&&f(A.label)},A.label))]});return Xe({...n,className:s("g-ui-calendar",a,N("g-ui-calendar-size-",o,"md"))},Xe({className:"g-ui-calendar-header"},Oe({size:"xs",variant:"subtle",className:"g-ui-calendar-nav",onClick:()=>l(-1)},ye({size:"sm",className:"g-ui-calendar-nav-icon",innerHTML:wi})),Xe({className:"g-ui-calendar-title-group"},Ir({type:"button",className:"g-ui-calendar-title-button",onClick:()=>l(1)},z),Ir({type:"button",className:"g-ui-calendar-title-button",onClick:()=>b(1)},$)),Oe({size:"xs",variant:"subtle",className:"g-ui-calendar-nav",onClick:()=>l(1)},ye({size:"sm",className:"g-ui-calendar-nav-icon",innerHTML:xi}))),Xe({className:"g-ui-calendar-grid"},D))}import{Div as gi,Span as Ke,Input as Hs,when as St,after as De,state as Ii}from"@granularjs/core";function Ws(...e){let{props:i,rawProps:t}=g(e,{data:[],size:"md",searchable:!0}),{value:r,data:a,size:o,className:n,placeholder:u,searchable:c,...d}=i,{onChange:p,onSearchChange:w}=t,f=Ii(m(r)??[]),l=Ii(""),b=Ii(!1),z=Ii(null),$=h=>(m(h)??[]).map(V=>typeof V=="string"?{value:V,label:V}:V&&typeof V=="object"?V:{value:String(V),label:String(V)});De(r).change(h=>{let S=m(h);S!=null&&f.set(S)});let D=null;De(b).change(h=>{if(D&&(D(),D=null),!h)return;let S=V=>{let A=z.get();A&&(A.contains(V.target)||b.set(!1))};document.addEventListener("mousedown",S),D=()=>document.removeEventListener("mousedown",S)}),De(l).change(h=>{w?.(h)});let C=h=>{let S=f.get()??[],V=S.includes(h)?S.filter(A=>A!==h):S.concat(h);f.set(V),p?.(V)},P=De(a).compute(h=>$(h)),L=De(P,l).compute(([h,S])=>{let V=String(m(S)??"").toLowerCase().trim();return V?h.filter(A=>String(A.label??"").toLowerCase().includes(V)):h}),y=De(f,l).compute(([h,S])=>{let V=m(h)??[],A=String(m(S)??"");return!V.length&&!A}),k=De(c).compute(h=>!!h);return gi({...d,node:z,className:s("g-ui-select-multi-root",n)},gi({className:s("g-ui-select-multi",N("g-ui-select-multi-size-",o,"md")),onClick:()=>b.set(!0)},De(P,f).compute(([h,S])=>(m(S)??[]).map(A=>{let se=(h??[]).find(te=>te.value===A)?.label??A;return Ke({className:"g-ui-select-tag"},Ke({className:"g-ui-select-tag-label",onClick:te=>{te?.stopPropagation?.()}},se),Ke({className:"g-ui-select-tag-remove",innerHTML:Be,onClick:te=>{te?.stopPropagation?.(),C(A)}}))})),St(y,()=>Ke({className:"g-ui-select-multi-placeholder"},u??"Select...")),St(k,()=>Hs({className:"g-ui-select-multi-input",value:l,onInput:h=>l.set(h.target?.value??""),onFocus:()=>b.set(!0)}))),St(b,()=>gi({className:"g-ui-select-dropdown"},De(L).compute(h=>h.length?h.map(S=>gi({className:s("g-ui-select-item",S.disabled&&"g-ui-select-item-disabled",De(f).compute(V=>(m(V)??[]).includes(S.value)?"g-ui-select-item-active":"")),onClick:()=>{S.disabled||C(S.value)}},Ke({className:"g-ui-select-item-check",innerHTML:De(f).compute(V=>(m(V)??[]).includes(S.value)?yi:"")}),Ke({className:"g-ui-select-item-label"},S.label))):gi({className:"g-ui-select-item"},"Nothing found")))))}import{Div as Ys,list as Gs,portal as _s}from"@granularjs/core";import{Div as Dt,Button as Os,when as Ar,state as qs}from"@granularjs/core";function Pt(...e){let{props:i,rawProps:t,children:r}=g(e),{title:a,className:o,...n}=i,{onClose:u}=t,c=qs(!0),d=()=>{c.set(!1),u?.(),console.log("close")};return Ar(c,()=>Dt({...n,className:s("g-ui-toast",o)},Dt({className:"g-ui-toast-row"},Ar(a,()=>Dt({className:"g-ui-toast-title"},a)),Os({className:"g-ui-toast-close",onClick:d},ye({innerHTML:Be}))),r))}function Zs(...e){let{props:i,rawProps:t}=g(e,{items:[]}),{items:r,className:a,timeout:o,...n}=i,{onClose:u}=t;return _s(Ys({...n,className:s("g-ui-toast-stack",a)},Gs(r,c=>Pt({title:c.title,onClose:()=>u?.(c)},c.message))))}function Us(...e){let{props:i}=g(e);return ui(i)}import{Div as Xs,after as Ks}from"@granularjs/core";function Qs(...e){let{props:i,rawProps:t}=g(e,{items:[],position:"top-right"}),{items:r,position:a,className:o,...n}=i,{onRemove:u}=t,c=new Map,d=(w,f)=>w?.id??w?.key??f,p=Ks(r).compute(w=>{let f=m(w)??[],l=new Set;f.forEach((b,z)=>{let $=d(b,z);if(l.add($),b?.autoClose&&!c.has($)){let D=setTimeout(()=>{c.delete($),u?.(b)},b.autoClose);c.set($,D)}});for(let[b,z]of c.entries())l.has(b)||(clearTimeout(z),c.delete(b));return f.map((b,z)=>ct({key:d(b,z),title:b.title,color:b.color,icon:b.icon,loading:b.loading,withCloseButton:b.withCloseButton,withBorder:b.withBorder,onClose:()=>{b.onClose?.(),u?.(b)}},b.message??b.body??b.content??b.text))});return Xs({...n,className:s("g-ui-notifications",N("g-ui-notifications-position-",a,"top-right"),o)},p)}import{Div as Qe,after as li,state as Js,when as eu}from"@granularjs/core";function iu(...e){let{props:i,rawProps:t}=g(e,{min:0,max:100,step:1,size:"md"}),{value:r,marks:a,min:o,max:n,step:u,size:c,disabled:d,className:p,...w}=i,{onChange:f}=t,l=Js(m(r??[o,n])),b=()=>{let y=Number(m(o)),k=Number(m(n));return!Number.isFinite(y)||!Number.isFinite(k)?{minValue:0,maxValue:100}:{minValue:Math.min(y,k),maxValue:Math.max(y,k)}},z=()=>{let y=Number(m(u));return Number.isFinite(y)&&y>0?y:1},$=y=>{let{minValue:k,maxValue:h}=b(),S=z(),V=[k,h];Array.isArray(y)&&(V=y);let A=Math.max(k,Math.min(h,Number(V[0]))),Q=Math.max(k,Math.min(h,Number(V[1]))),se=Math.round(Math.min(A,Q)/S)*S,te=Math.round(Math.max(A,Q)/S)*S;return[se,te]};li(r).change(y=>{y!=null&&l.set($(y))});let D=y=>{let k=$(y);k?.[0]===l.get()?.[0]&&k?.[1]===l.get()?.[1]||(l.set(k),f?.(k))},C=li(l).compute(y=>{let{minValue:k,maxValue:h}=b(),S=h-k,[V,A]=$(y);if(S<=0)return{lowPct:0,highPct:0};let Q=(V-k)/S*100,se=(A-k)/S*100;return{lowPct:Math.max(0,Math.min(100,Q)),highPct:Math.max(0,Math.min(100,se))}}),P=(y,k,h)=>{let S=k?.();if(!S||S.width===0)return;let A=Math.min(Math.max(y.clientX-S.left,0),S.width)/S.width,{minValue:Q,maxValue:se}=b(),te=Q+A*(se-Q),E=l;typeof l.get=="function"&&(E=l.get());let[G,J]=$(E);D(h==="low"?[te,J]:[G,te])},L=(y,k,h)=>{if(ke(d))return;y.preventDefault?.();let S=h||y.currentTarget,V=()=>S.getBoundingClientRect(),A=V(),Q=C;typeof C.get=="function"&&(Q=C.get());let{lowPct:se,highPct:te}=Q,E=(y.clientX-A.left)/A.width*100,G=k;if(!G){let X=Math.abs(E-se)<=Math.abs(E-te);G="high",X&&(G="low")}S.setPointerCapture?.(y.pointerId),P(y,V,G);let J=X=>P(X,V,G),re=()=>{S.releasePointerCapture?.(y.pointerId),window.removeEventListener("pointermove",J),window.removeEventListener("pointerup",re)};window.addEventListener("pointermove",J),window.addEventListener("pointerup",re)};return Qe({...w,className:s("g-ui-range-slider",N("g-ui-slider-size-",c,"md"),U("g-ui-slider-disabled",d),i.className??p)},Qe({className:"g-ui-slider-track",onPointerDown:y=>L(y)},Qe({className:"g-ui-slider-bar",style:li(C).compute(({lowPct:y,highPct:k})=>({left:`${y}%`,width:`${Math.max(0,k-y)}%`}))}),Qe({className:"g-ui-slider-thumb",style:li(C).compute(({lowPct:y})=>({left:`${y}%`})),onPointerDown:y=>{y.stopPropagation?.(),L(y,"low",y.currentTarget.parentElement)}}),Qe({className:"g-ui-slider-thumb",style:li(C).compute(({highPct:y})=>({left:`${y}%`})),onPointerDown:y=>{y.stopPropagation?.(),L(y,"high",y.currentTarget.parentElement)}})),eu(a,()=>Qe({className:"g-ui-slider-marks"},a.map(y=>vt({mark:y,getBounds:b})))))}import{state as Mt,after as Br}from"@granularjs/core";function $i(...e){let{props:i,rawProps:t}=g(e,{size:"md",format:{pattern:"dddd-dd-dd"}}),{value:r,size:a,calendarSize:o,leftSection:n,rightSection:u,className:c,format:d,minDate:p,maxDate:w,...f}=i,{onChange:l}=t,b=k=>{let h=m(k);if(h instanceof Date)return h;if(h==null||h==="")return null;let S=new Date(h);return Number.isNaN(S.getTime())?null:S},z=(k,h)=>k&&h&&k.getFullYear()===h.getFullYear()&&k.getMonth()===h.getMonth()&&k.getDate()===h.getDate(),$=k=>{if(!k)return"";let h=String(k.getFullYear()).padStart(4,"0"),S=String(k.getMonth()+1).padStart(2,"0"),V=String(k.getDate()).padStart(2,"0");return`${h}-${S}-${V}`},D=k=>{let h=String(k??"").replace(/\D/g,"");if(h.length<8)return null;let S=Number(h.slice(0,4)),V=Number(h.slice(4,6)),A=Number(h.slice(6,8));if(!S||!V||!A)return null;let Q=new Date(S,V-1,A);if(Q.getFullYear()!==S||Q.getMonth()!==V-1||Q.getDate()!==A)return null;let se=b(p);if(se&&Q<se)return null;let te=b(w);return te&&Q>te?null:Q},C=Mt(b(r)),P=Mt($(C.get())),L=Mt(!1);Br(r).change(k=>{let h=b(k);if(!z(h,C.get())){if(h==null){C.set(null),P.set("");return}C.set(h),P.set($(h))}}),Br(P).change(k=>{let h=D(k);h&&(z(h,C.get())||(C.set(h),l?.(h)))});let y=k=>{k&&(z(k,C.get())||(C.set(k),P.set($(k)),l?.(k),L.set(!1)))};return Nt({opened:L,onChange:k=>L.set(!!k),content:ui({size:N("",o,"xs"),value:C,onChange:y}),className:"g-ui-date-input-popover"},be({...f,size:a,className:s("g-ui-dateinput",c),leftSection:n,rightSection:u,type:"text",inputMode:"numeric",format:d,value:P,onChange:k=>P.set(k)}))}import{Div as Tt,when as tu,after as ru,state as au}from"@granularjs/core";function ou(...e){let{props:i,rawProps:t,children:r}=g(e),{opened:a,content:o,className:n,...u}=i,{onChange:c}=t,d=au(m(a)??!1);ru(a).change(w=>{let f=m(w);f!=null&&d.set(!!f)});let p=w=>{d.set(w),c?.(w)};return Tt({...u,className:s("g-ui-popper",n)},Tt({onClick:()=>p(!d.get())},r),tu(d,()=>Tt({className:"g-ui-popper-dropdown"},o)))}import{Button as nu,after as Fr,when as su,state as uu}from"@granularjs/core";function gu(...e){let{props:i,rawProps:t}=g(e,{size:"md"}),{size:r,className:a,rightSection:o,...n}=i,{onChange:u}=t,c=uu(!1),d=Fr(c).compute(w=>w?"text":"password"),p=Fr(o).compute(w=>w??nu({className:"g-ui-password-toggle",onClick:()=>c.set(!c.get())},su(c,()=>"Hide",()=>"Show")));return be({...n,size:r,className:a,onChange:u,rightSection:p,type:d})}import{Div as lu}from"@granularjs/core";function cu(...e){let{props:i}=g(e,{size:"md"}),{size:t,className:r,...a}=i;return be({...a,size:t,className:r,leftSection:lu({className:"g-ui-search-input-left-section",innerHTML:Qt}),type:"text",inputMode:"search"})}import{Button as pu,after as du,when as Er}from"@granularjs/core";import{state as mu}from"@granularjs/core";function fu(...e){let{props:i,children:t}=g(e,{value:"",timeout:1500}),{value:r,timeout:a,className:o,...n}=i,u=mu(!1),c=du(u).compute(p=>s("g-ui-copy-button",p&&"g-ui-copy-button-done",o));return pu({...n,className:c,onClick:async()=>{try{await navigator.clipboard.writeText(String(r)),u.set(!0),setTimeout(()=>u.set(!1),a)}catch{}},type:"button"},Er(t?.length,()=>t,()=>Er(u,()=>"Copied",()=>"Copy")))}import{Div as jr,after as ci,resolve as hu}from"@granularjs/core";function Rr(e){let i=Number(e);return Number.isNaN(i)?0:Math.max(0,Math.min(100,i))}function vu(...e){let{props:i}=g(e,{size:"md",value:null,color:"primary"}),{size:t,value:r,color:a,className:o,...n}=i,u=ci(r).compute(f=>f!=null&&f!==""),c=ci(r).compute(f=>Rr(f)),d=ci(c,u).compute(([f,l])=>{if(!l)return{};let b=Number(f),z=Number.isNaN(b)?0:Math.max(0,Math.min(360,b*3.6));return{background:`conic-gradient(var(--g-ui-progress-ring-fill, var(--g-ui-primary)) 0deg ${z}deg, var(--g-ui-border-muted) ${z}deg 360deg)`}}),p=ci(u).compute(f=>f?"":"g-ui-progress-ring-indeterminate"),w=ci(u,r).compute(([f,l])=>f?Rr(l):void 0);return jr({...n,className:s("g-ui-progress-ring",N("g-ui-progress-ring-",a,"primary"),[t,f=>`g-ui-progress-ring-size-${hu(f)??"md"}`],p,o),style:d,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":w},jr({className:"g-ui-progress-ring-hole"}))}import{Div as Ai,state as Lt,after as qe,list as xu,when as wu}from"@granularjs/core";import{Div as bu}from"@granularjs/core";function Vt(...e){let{props:i,children:t}=g(e,{size:"md"}),{size:r,className:a,...o}=i;return bu({...o,className:s("g-ui-scroll-area",[r,n=>`g-ui-scroll-area-${n}`],a)},t)}function Ie(e,i){if(i==null||i==="")return e;let t=String(i).trim().split("."),r=e;for(let a of t)r=r?.[a];return r}function yu(e,i,t){let r=t(i);return String(r??"").toLowerCase().includes(String(e??"").toLowerCase())}function It(...e){let{props:i,rawProps:t}=g(e,{data:[],size:"md",valuePath:"value",labelPath:"label"}),{data:r,value:a,size:o,valuePath:n,labelPath:u,filter:c,placeholder:d,label:p,description:w,error:f,leftSection:l,rightSection:b,className:z,inputClassName:$,disabled:D,...C}=i,{onChange:P,renderItem:L}=t,y=Lt(!1),k=Lt(""),h=Lt(m(a));qe(a).change(x=>{let B=m(x);B!==h.get()&&h.set(B)});let S=qe(r).compute(x=>Array.isArray(x)?x:[]),V=qe(S,h,n).compute(([x,B,R])=>{if(B==null)return null;let q=Y=>R==null||R===""?Y:Ie(Y,R);return x.find(Y=>q(Y)===B)??null}),A=qe(V,y,k,u).compute(([x,B,R,q])=>{let Y=oe=>q==null||q===""?String(oe??""):String(Ie(oe,q)??"");return B?R??"":x?Y(x):""}),Q=qe(S,k,c,u).compute(([x,B,R,q])=>{let Y=ve=>q==null||q===""?String(ve??""):String(Ie(ve,q)??""),oe=m(R)??yu;return x.filter(ve=>oe(B,ve,Y))}),se=x=>{let B=m(n),R=B==null||B===""?x:Ie(x,B);h.set(R),k.set(""),y.set(!1),P?.(R)},te=()=>{if(m(D))return;y.set(!0);let x=V.get(),B=m(u),R=q=>B==null||B===""?String(q??""):String(Ie(q,B)??"");k.set(x?R(x):"")},E=()=>{y.set(!1);let x=V.get(),B=m(u),R=q=>B==null||B===""?String(q??""):String(Ie(q,B)??"");k.set(x?R(x):"")},{onChange:G,...J}=C,re={...J,size:o,label:p,description:w,error:f,leftSection:l,rightSection:b,placeholder:m(d)??void 0,disabled:D,value:A,onInput:x=>k.set(x?.target?.value??""),onFocus:te,onClick:te,onBlur:()=>setTimeout(()=>E(),150)},X=x=>{let B=m(n);return B==null||B===""?x:Ie(x,B)},M=x=>qe(h,n).compute(([B,R])=>(Y=>R==null||R===""?Y:Ie(Y,R))(x)===B?"g-ui-autocomplete-item-active":""),j=x=>{if(L&&typeof L=="function"){let B=L(x);if(B!=null)return Ai({className:s("g-ui-autocomplete-item",M(x)),onClick:()=>se(x),role:"option"},B)}return Ai({className:s("g-ui-autocomplete-item",M(x)),onClick:()=>se(x),role:"option"},qe(u).compute(B=>B==null||B===""?String(x??""):String(Ie(x,B)??"")))};return Ai({className:s("g-ui-autocomplete",z,U("g-ui-autocomplete-disabled",D))},be({...re,className:s("g-ui-autocomplete-input-wrapper",re.className),inputClassName:s("g-ui-autocomplete-input",$)}),wu(y,()=>Ai({className:"g-ui-autocomplete-dropdown",role:"listbox"},Vt({className:"g-ui-autocomplete-list",style:{maxHeight:"240px"}},xu(Q,x=>j(x))))))}function ku(...e){return It(...e)}import{Div as zu,Span as Nu,state as Hr,after as Cu}from"@granularjs/core";function Wr(e){let i=m(e);if(i instanceof Date)return i;if(i==null||i==="")return null;let t=new Date(i);return Number.isNaN(t.getTime())?null:t}function Or(e){let i=m(e);if(i==null)return[null,null];let t=Array.isArray(i)?i:[i];return[Wr(t[0]),Wr(t[1])]}function qr(e,i){return!e||!i?e===i:e.getFullYear()===i.getFullYear()&&e.getMonth()===i.getMonth()&&e.getDate()===i.getDate()}function Su(...e){let{props:i,rawProps:t}=g(e,{size:"md"}),{value:r,size:a,minDate:o,maxDate:n,className:u,placeholderMin:c,placeholderMax:d,...p}=i,{onChange:w}=t,[f,l]=Or(r),b=Hr(f),z=Hr(l);Cu(r).change(P=>{let[L,y]=Or(P);qr(L,b.get())&&qr(y,z.get())||(b.set(L),z.set(y))});let $=()=>{let P=b.get(),L=z.get();w?.([P??null,L??null])},D=P=>{let L=z.get();P&&L&&P>L&&z.set(P),b.set(P),$()},C=P=>{let L=b.get();P&&L&&P<L&&b.set(P),z.set(P),$()};return zu({...p,className:s("g-ui-range-picker",i.className??u)},$i({...p,size:a,value:b,onChange:D,maxDate:z,placeholder:m(c)??void 0}),Nu({className:"g-ui-range-picker-separator"},"\u2013"),$i({...p,size:a,value:z,onChange:C,minDate:b,placeholder:m(d)??void 0}))}import{Div as Du}from"@granularjs/core";function Pu(...e){let{props:i,children:t}=g(e,{align:"center",direction:"row"}),{direction:r,wrap:a,align:o,justify:n,gap:u,className:c,...d}=i;return Du({...d,className:s("g-ui-flex",[r,p=>p==="column"?"g-ui-flex-column":"g-ui-flex-row"],[a,"g-ui-flex-wrap"],[o,p=>p&&`g-ui-align-${p}`],[n,p=>p&&`g-ui-justify-${p}`],[u,p=>p&&`g-ui-gap-${p}`],c)},t)}import{A as Mu,Div as pi,Span as Yr,when as di,after as Gr,state as Tu}from"@granularjs/core";function Vu(...e){let{props:i,rawProps:t,children:r}=g(e,{variant:"subtle",childrenOffset:24}),{label:a,description:o,leftSection:n,rightSection:u,active:c,disabled:d,variant:p,childrenOffset:w,opened:f,defaultOpened:l,className:b,padding:z,...$}=i,{onClick:D,onChange:C}=t,P=r.length>0,L=Tu(m(f)??m(l)??!1);Gr(f).change(h=>{let S=m(h);S!=null&&L.set(!!S)});let y=Gr(w).compute(h=>({paddingLeft:Gt(m(h??24))??"24px"})),k=h=>{if(m(d)){h?.preventDefault?.();return}if(P){let S=!L.get();L.set(S),C?.(S)}D?.(h)};return pi({className:s("g-ui-navlink-root",b)},Mu({...$,className:s("g-ui-navlink",N("g-ui-navlink-variant-",p,"subtle"),U("g-ui-navlink-active",c),U("g-ui-navlink-disabled",d),N("g-ui-navlink-padding-",z,"md")),onClick:k},di(n,()=>Yr({className:"g-ui-navlink-section g-ui-navlink-left"},n)),pi({className:"g-ui-navlink-body"},di(a,()=>pi({className:"g-ui-navlink-label"},a)),di(o,()=>pi({className:"g-ui-navlink-description"},o))),di(u,()=>Yr({className:"g-ui-navlink-section g-ui-navlink-right"},u))),P?di(L,()=>pi({className:"g-ui-navlink-children",style:y},r)):null)}import{Div as _r,when as Lu}from"@granularjs/core";function Iu(...e){let{props:i,children:t}=g(e,{show:!0,position:"top-right",color:"danger",size:"md"}),{show:r,position:a,color:o,size:n,className:u,...c}=i;return _r({...c,className:s("g-ui-indicator",N("g-ui-indicator-position-",a,"top-right"),N("g-ui-indicator-color-",o,"danger"),N("g-ui-indicator-size-",n,"md"),u)},t,Lu(r,()=>_r({className:"g-ui-indicator-badge"})))}import{Span as Bi}from"@granularjs/core";function $u(...e){let{props:i}=g(e),{opened:t,className:r,...a}=i;return Bi({...a,className:s("g-ui-burger",[t,"g-ui-burger-open"],r)},Bi(""),Bi(""),Bi(""))}import{Div as Au,when as Bu}from"@granularjs/core";function Fu(...e){let{props:i}=g(e),{visible:t,...r}=i;return Bu(t,()=>Au({...r,className:"g-ui-loading-overlay"},ai({})))}import{Div as Eu}from"@granularjs/core";function ju(...e){let{props:i,children:t}=g(e,{gap:"md"}),{className:r,gap:a,...o}=i;return Eu({...o,className:s("g-ui-grid-system",[a,n=>`g-ui-gap-${n}`],r)},t)}import{Div as Ru}from"@granularjs/core";function Hu(...e){let{props:i,children:t}=g(e,{span:12}),{span:r,className:a,...o}=i;return Ru({...o,className:s([r,n=>`g-ui-col-span-${n}`],a)},t)}import{Div as Zr,Input as Wu,after as $e,state as $t,when as Ur,list as Ou}from"@granularjs/core";function qu(...e){let{props:i,rawProps:t}=g(e,{length:4,size:"md",type:"alphanumeric",mask:!1,placeholder:"\u25CB",disabled:!1,error:!1,oneTimeCode:!1}),{length:r,value:a,size:o,type:n,mask:u,placeholder:c,disabled:d,error:p,oneTimeCode:w,className:f}=i,{onChange:l,onComplete:b}=t,z=$t(m(r)??4),$=()=>z.get();$e(r).change(M=>{let j=m(M)??4,x=z.get();if(j===x)return;z.set(j);let B=C.get(),R=D.get();C.set(Array.from({length:j},(q,Y)=>B[Y]??"")),D.set(Array.from({length:j},(q,Y)=>R[Y]??null))});let D=$t(Array.from({length:$()},()=>null)),C=$t(Array.from({length:$()},(M,j)=>{let x=m(a);return typeof x=="string"||Array.isArray(x)?x[j]??"":""}));$e(a).change(M=>{if(M==null)return;let j=$();typeof M=="string"?C.set(Array.from({length:j},(x,B)=>M[B]??"")):Array.isArray(M)&&C.set(Array.from({length:j},(x,B)=>M[B]??""))});let P=()=>C.get().join(""),L=M=>{C.set(M);let j=M.join("");l?.(j),M.every(x=>x!=="")&&M.length===$()&&b?.(j)},y=M=>{let j=$(),x=D.get();M>=0&&M<j&&x[M]&&(x[M].focus(),x[M].select())},k=()=>{let M=m(n);return M==="number"?/^[0-9]$/:M instanceof RegExp?M:/^[a-zA-Z0-9]$/},h=(M,j)=>{let x=j.target.value,B=k();if(x.length>1){S(M,x);return}if(x&&!B.test(x)){j.target.value=C.get()[M]??"";return}let R=C.get().slice();R[M]=x,L(R),x&&M<$()-1&&y(M+1)},S=(M,j)=>{let x=k(),B=j.split("").filter(oe=>x.test(oe)),R=C.get().slice(),q=$();B.forEach((oe,ve)=>{let ze=M+ve;ze<q&&(R[ze]=oe)}),L(R);let Y=R.findIndex((oe,ve)=>ve>=M&&oe==="");Y>=0?y(Y):y(Math.min(M+B.length,q-1))},V=(M,j)=>{if(j.key==="Backspace"){let x=C.get().slice();x[M]===""&&M>0?(j.preventDefault(),x[M-1]="",L(x),y(M-1)):x[M]!==""&&(x[M]="",L(x))}else j.key==="ArrowLeft"&&M>0?(j.preventDefault(),y(M-1)):j.key==="ArrowRight"&&M<$()-1&&(j.preventDefault(),y(M+1))},A=(M,j)=>{j.target.select()},Q=()=>{let M=C.get(),j=M.findIndex(x=>x==="");j>=0?y(j):y(M.length-1)},se=$e(u).compute(M=>m(M)?"password":"text"),te=$e(n).compute(M=>m(M)==="number"?"numeric":"text"),E=$e(w).compute(M=>m(M)?"one-time-code":"off"),G=$e(d).compute(M=>!!m(M)),J=$e(p).compute(M=>!!m(M)),re=$e(z).compute(M=>Array.from({length:M},(j,x)=>x)),X=M=>Wu({className:s("g-ui-pin-input-field",Ur(J,()=>"g-ui-pin-input-error")),type:se,inputMode:te,autocomplete:E,maxLength:2,placeholder:Ur(G,()=>"",()=>c),disabled:G,value:$e(C,M).compute(([j,x])=>j[x]??""),node:D[M.get()],onInput:j=>h(M.get(),j),onChange:j=>h(M.get(),j),onKeyDown:j=>V(M.get(),j),onFocus:j=>A(M.get(),j)});return Zr({className:s("g-ui-pin-input",N("g-ui-input-size-",o,"md"),f),onClick:Q},Zr({className:"g-ui-pin-input-wrapper"},Ou(re,X)))}import{Div as Yu}from"@granularjs/core";function Gu(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return Yu({...a,className:s("g-ui-checkbox-group",r)},t)}import{Div as _u}from"@granularjs/core";function Zu(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return _u({...a,className:s("g-ui-avatar-group",r)},t)}import{Div as Uu}from"@granularjs/core";function Xu(...e){let{props:i,children:t}=g(e),{className:r,...a}=i;return Uu({...a,className:s("g-ui-badge-group",r)},t)}import{Div as Fi,Span as Ku,after as mi,context as Xr}from"@granularjs/core";var Qu=Xr([]),Kr=Xr({sort:null,onSort:null});function At(...e){let{props:i,rawProps:t,children:r}=g(e,{sizes:[],sort:null,stickyHeader:!1}),{className:a,sizes:o,sort:n,stickyHeader:u,...c}=i,{onSort:d}=t,p=Qu.scope(o.get());mi(o).change(f=>p.set(f));let w=Kr.scope({sort:n.get(),onSort:d||null});return mi(n).change(f=>w.set().sort=f),p.serve(w.serve(Fi({className:s("g-ui-grid-table",U("g-ui-grid-table-sticky",u),a),style:{gridTemplateColumns:mi(p).compute(f=>Array.isArray(f)?f.join(" "):"")},...c},r)))}At.GridRow=(...e)=>{let{props:i,children:t}=g(e,{}),{className:r,header:a,...o}=i;return Fi({className:s("g-ui-grid-table-row",U("g-ui-grid-table-row-header",a),r),...o},...t)};At.GridCell=function(...e){let{props:i,rawProps:t,children:r}=g(e,{}),{className:a,sort:o,...n}=i,u=t.sort;if(u){let c=Kr.state(),d=mi(c.sort).compute(w=>w?.key===u?w.direction:null),p=()=>{let w=c.get().sort,f;w?.key===u?f=w.direction==="asc"?{key:u,direction:"desc"}:null:f={key:u,direction:"asc"},c.set().sort=f;let{onSort:l}=c.get();l&&l(f)};return Fi({className:s("g-ui-grid-table-cell","g-ui-grid-table-cell-sortable",a),onClick:p,...n},r,Ku({className:"g-ui-grid-table-sort-icon"},mi(d).compute(w=>w==="asc"?" \u2191":w==="desc"?" \u2193":"")))}return Fi({className:s("g-ui-grid-table-cell",a),...n},r)};import{Button as Ju,Div as eg,Span as Qr,when as Jr}from"@granularjs/core";function ea(...e){let{props:i,children:t}=g(e,{grow:!0}),{grow:r,className:a,...o}=i;return eg({...o,className:s("g-ui-bottombar",U("g-ui-bottombar-grow",r),a)},t)}ea.Action=function(...i){let{props:t,rawProps:r,children:a}=g(i,{variant:"subtle"}),{icon:o,label:n,active:u,disabled:c,variant:d,className:p,...w}=t,{onClick:f}=r;return Ju({...w,className:s("g-ui-bottombar-action",N("g-ui-bottombar-action-variant-",d,"subtle"),U("g-ui-bottombar-action-active",u),U("g-ui-bottombar-action-disabled",c),p),onClick:f,disabled:c},Jr(o,()=>Qr({className:"g-ui-bottombar-action-icon"},o)),Jr(n,()=>Qr({className:"g-ui-bottombar-action-label"},n)),a)};import{Div as W,Button as Ye,state as de,after as Ce,when as me,Input as Ei,Label as fi,Span as Ge}from"@granularjs/core";var ig=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],tg=[{value:"day",label:"Day"},{value:"week",label:"Week"},{value:"month",label:"Month"}];function ji(e){if(e instanceof Date)return e;if(e==null)return null;let i=new Date(e);return Number.isNaN(i.getTime())?null:i}function ra(e){let i=ji(e.start),t=ji(e.end);return!i||!t?null:{...e,id:e.id??`${i.getTime()}-${e.title??"event"}`,title:e.title??"",start:i,end:t,allDay:!!e.allDay,description:e.description??"",location:e.location??"",attendees:Array.isArray(e.attendees)?e.attendees:[],color:e.color??null}}function aa(e,i,t){let r=ji(i).getTime(),a=ji(t).getTime();return e.map(ra).filter(Boolean).filter(o=>o.end.getTime()>r&&o.start.getTime()<a)}function ia(e,i){let t=new Date(i);t.setHours(0,0,0,0);let r=t.getTime();t.setHours(23,59,59,999);let a=t.getTime();return aa(e,r,a)}function Bt(e,i){let t=new Date(e),a=(t.getDay()-i+7)%7;return t.setDate(t.getDate()-a),t.setHours(0,0,0,0),t}function Je(e,i="default"){return e.toLocaleTimeString(i,{hour:"numeric",minute:"2-digit",hour12:!0})}function hi(e,i="default"){return e.toLocaleDateString(i,{weekday:"short",month:"short",day:"numeric"})}function rg(e,i="default"){return e.toLocaleDateString(i,{month:"long",year:"numeric"})}function ag(e,i="default"){let t=new Date(e);return t.setDate(t.getDate()+6),`${e.toLocaleDateString(i,{month:"short",day:"numeric"})} \u2013 ${t.toLocaleDateString(i,{month:"short",day:"numeric",year:"numeric"})}`}function ta(e,i,t,r){let a=new Date(e).setHours(t,0,0,0),o=new Date(e).setHours(r,0,0,0),n=(r-t)*60,u=Math.max(e.getTime(),a),d=(Math.min(i.getTime(),o)-u)/6e4,p=(u-a)/6e4/n*100,w=d/n*100;return{top:p,height:w}}function og(...e){let{props:i,rawProps:t}=g(e,{defaultView:"month",firstDayOfWeek:0,locale:"default",hourSlotDuration:30,minTime:6,maxTime:22,eventCreationColorOptions:[]}),{events:r=[],defaultView:a,firstDayOfWeek:o,locale:n,hourSlotDuration:u,minTime:c,maxTime:d,eventCreationColorOptions:p,className:w,...f}=i,{onCreateEventRequest:l,onViewEventRequest:b,onUpdateEventRequest:z,onRemoveEventRequest:$,eventCreationEmailLookup:D,eventCreationLocationsCallback:C,eventCreationCalendarsCallback:P,onSlotClick:L,onDateRangeChange:y}=t,k=de(m(a)??"month"),h=de(new Date),S=de(null),V=de(null),A=de({title:"",start:null,end:null,allDay:!1,description:"",location:"",attendees:[],color:null}),Q=Ce(r).compute(v=>Array.isArray(v)?v:[]),se=h.get(),te=Bt(se,m(o)??0),E=m(c)??6,G=m(d)??22,J=m(u)??30,re=()=>{let v=new Date(h.get());k.get()==="month"?v.setMonth(v.getMonth()-1):k.get()==="week"?v.setDate(v.getDate()-7):v.setDate(v.getDate()-1),h.set(v),y?.({start:v,end:v,view:k.get()})},X=()=>{let v=new Date(h.get());k.get()==="month"?v.setMonth(v.getMonth()+1):k.get()==="week"?v.setDate(v.getDate()+7):v.setDate(v.getDate()+1),h.set(v),y?.({start:v,end:v,view:k.get()})},M=()=>{let v=new Date;h.set(v),y?.({start:v,end:v,view:k.get()})},j=(v,H,ce=!1)=>{let Z=v?new Date(v):new Date(h.get()),ge=H?new Date(H):new Date(Z.getTime()+3600*1e3);ce&&(Z.setHours(0,0,0,0),ge.setHours(23,59,59,999)),A.set({title:"",start:Z,end:ge,allDay:ce,description:"",location:"",attendees:[],color:null}),S.set("create")},x=v=>{V.set(ra(v)),S.set("view"),b?.(v)},B=()=>{let v=V.get();v&&(A.set({title:v.title,start:new Date(v.start),end:new Date(v.end),allDay:v.allDay,description:v.description??"",location:v.location??"",attendees:[...v.attendees||[]],color:v.color??null}),S.set("edit"))},R=()=>{S.set(null),V.set(null)},q=(v,H,ce)=>{if(L){L({date:v,hour:H,allDay:ce});return}let Z=new Date(v);if(ce){Z.setHours(0,0,0,0);let ge=new Date(Z);ge.setHours(23,59,59,999),j(Z,ge,!0)}else{Z.setHours(H,0,0,0);let ge=new Date(Z.getTime()+J*60*1e3);j(Z,ge,!1)}},Y=()=>{let v=A.get();!v.start||!v.end||l?.({title:v.title,start:v.start,end:v.end,allDay:v.allDay,description:v.description,location:v.location,attendees:v.attendees,color:v.color},()=>{R()})},oe=()=>{let v=V.get(),H=A.get();!v||!H.start||!H.end||z?.(v,{title:H.title,start:H.start,end:H.end,allDay:H.allDay,description:H.description,location:H.location,attendees:H.attendees,color:H.color},()=>R())},ve=()=>{let v=V.get();v&&$?.(v,()=>R())},ze=Ce(k,h).compute(([v,H])=>v==="month"?rg(H,m(n)):v==="week"?ag(Bt(H,m(o)??0),m(n)):hi(H,m(n))),Pe=W({className:"g-ui-event-calendar-header"},W({className:"g-ui-event-calendar-nav-group"},Oe({size:"sm",variant:"subtle",onClick:re,className:"g-ui-event-calendar-nav"},ye({size:"sm",innerHTML:wi})),Oe({size:"sm",variant:"subtle",onClick:X,className:"g-ui-event-calendar-nav"},ye({size:"sm",innerHTML:xi})),Ye({type:"button",variant:"subtle",size:"sm",className:"g-ui-event-calendar-today",onClick:M},ye({size:"sm",className:"g-ui-event-calendar-today-icon",innerHTML:tr}),"Today")),W({className:"g-ui-event-calendar-title"},ze),W({className:"g-ui-event-calendar-actions"},tg.map(v=>W({className:s("g-ui-event-calendar-view-option",Ce(k).compute(H=>H===v.value?"g-ui-event-calendar-view-option-active":"")),onClick:()=>{k.set(v.value),y?.({start:h.get(),end:h.get(),view:v.value})}},v.label)),Ye({type:"button",variant:"filled",size:"sm",className:"g-ui-event-calendar-create-btn",onClick:()=>j(h.get(),null,!1)},ye({size:"sm",innerHTML:Jt}),"Create"))),_e=Ce(h,Q,o).compute(([v,H,ce])=>{let Z=v.getFullYear(),ge=v.getMonth(),ue=(new Date(Z,ge,1).getDay()-(ce??0)+7)%7,Te=new Date(Z,ge+1,0).getDate(),Ve=new Date(Z,ge,0).getDate(),I=[],T=1,O=1,_=Math.ceil((ue+Te)/7)*7,ae=[];for(let ee=0;ee<_;ee+=1){let K,ie,le;ee<ue?(K=Ve-ue+ee+1,le=new Date(Z,ge-1,K),ie=!1):T<=Te?(K=T,le=new Date(Z,ge,K),ie=!0,T+=1):(K=O,le=new Date(Z,ge+1,K),ie=!1,O+=1);let xe=ia(H,le),Ae=le.getDate()===new Date().getDate()&&le.getMonth()===new Date().getMonth()&&le.getFullYear()===new Date().getFullYear();ae.push(W({key:le.getTime(),className:s("g-ui-event-calendar-month-cell",!ie&&"g-ui-event-calendar-month-cell-outside",Ae&&"g-ui-event-calendar-month-cell-today")},W({className:"g-ui-event-calendar-month-cell-header",onClick:()=>q(le,0,!0)},Ge({className:"g-ui-event-calendar-month-cell-day"},le.getDate())),W({className:"g-ui-event-calendar-month-cell-events"},xe.slice(0,3).map(Se=>W({key:Se.id,className:"g-ui-event-calendar-month-event",style:Se.color?{borderLeftColor:Se.color,backgroundColor:`${Se.color}20`}:{},onClick:Oi=>{Oi.stopPropagation(),x(Se)}},Se.title||"(No title)")),me(xe.length>3,()=>W({className:"g-ui-event-calendar-month-more",onClick:Se=>{Se.stopPropagation(),x(xe[3])}},`+${xe.length-3} more`)))))}return ae}),Ze=W({className:"g-ui-event-calendar-month"},W({className:"g-ui-event-calendar-weekdays"},ig.map(v=>W({key:v,className:"g-ui-event-calendar-weekday"},v))),W({className:"g-ui-event-calendar-month-grid"},_e)),Me=[];for(let v=E;v<G;v+=1)for(let H=0;H<60;H+=J)Me.push(v+H/60);let ei=Ce(h,o).compute(([v,H])=>{let ce=Bt(v,H??0),Z=[];for(let ge=0;ge<7;ge+=1){let fe=new Date(ce);fe.setDate(fe.getDate()+ge),Z.push(fe)}return Z}),Ri=W({className:"g-ui-event-calendar-week"},Ce(ei).compute(v=>W({className:"g-ui-event-calendar-week-days"},W({className:"g-ui-event-calendar-week-time-col"},""),(v||[]).map(H=>W({key:H.getTime(),className:"g-ui-event-calendar-week-day-col"},W({className:"g-ui-event-calendar-week-day-header"},hi(H,m(n))))))),W({className:"g-ui-event-calendar-week-body"},W({className:"g-ui-event-calendar-week-time-col"},Me.map(v=>{let H=Math.floor(v),ce=(v-H)*60,Z=`${H<=12?H:H-12}:${ce===0?"00":ce} ${H<12?"AM":"PM"}`;return W({key:v,className:"g-ui-event-calendar-week-slot-label"},Z)})),Ce(ei,Q).compute(([v,H])=>{if(!v||!v.length)return null;let ce=v[0],Z=new Date(v[6]);Z.setHours(23,59,59,999);let ge=aa(H,ce,Z);return W({className:"g-ui-event-calendar-week-grid-cols"},v.map(fe=>W({key:fe.getTime(),className:"g-ui-event-calendar-week-day-col g-ui-event-calendar-week-day-col-body"},Me.map(ue=>W({key:ue,className:"g-ui-event-calendar-week-slot",onClick:()=>q(fe,ue,!1)})),ge.filter(ue=>!ue.allDay&&ue.start.getDate()===fe.getDate()&&ue.start.getMonth()===fe.getMonth()&&ue.start.getFullYear()===fe.getFullYear()).map(ue=>{let{top:Te,height:Ve}=ta(ue.start,ue.end,E,G);return W({key:ue.id,className:"g-ui-event-calendar-week-event",style:{top:`${Te}%`,height:`${Ve}%`,borderLeftColor:ue.color||"var(--g-ui-primary)"},onClick:I=>{I.stopPropagation(),x(ue)}},W({className:"g-ui-event-calendar-week-event-title"},ue.title||"(No title)"),me(!ue.allDay,()=>Ge({className:"g-ui-event-calendar-week-event-time"},`${Je(ue.start,m(n))} \u2013 ${Je(ue.end,m(n))}`)))}))))}))),Hi=W({className:"g-ui-event-calendar-day"},W({className:"g-ui-event-calendar-day-body"},W({className:"g-ui-event-calendar-day-time-col"},Me.map(v=>{let H=Math.floor(v),ce=(v-H)*60,Z=`${H<=12?H:H-12}:${ce===0?"00":ce} ${H<12?"AM":"PM"}`;return W({key:v,className:"g-ui-event-calendar-day-slot-label"},Z)})),W({className:"g-ui-event-calendar-day-slots"},Me.map(v=>W({key:v,className:"g-ui-event-calendar-day-slot",onClick:()=>q(h.get(),v,!1)})),Ce(Q,h).compute(([v,H])=>H?ia(v,H).filter(Z=>!Z.allDay).map(Z=>{let{top:ge,height:fe}=ta(Z.start,Z.end,E,G);return W({key:Z.id,className:"g-ui-event-calendar-day-event",style:{top:`${ge}%`,height:`${fe}%`,borderLeftColor:Z.color||"var(--g-ui-primary)"},onClick:ue=>{ue.stopPropagation(),x(Z)}},W({className:"g-ui-event-calendar-day-event-title"},Z.title||"(No title)"),Ge({className:"g-ui-event-calendar-day-event-time"},`${Je(Z.start,m(n))} \u2013 ${Je(Z.end,m(n))}`))}):[])))),vi=v=>{let H=A.get(),ce=new Date,Z=H.start||ce,ge=H.end||new Date(ce.getTime()+3600*1e3),fe=de(H.title),ue=de(Z.toISOString().slice(0,10)),Te=de(!H.allDay&&Z?Z.toTimeString().slice(0,5):"09:00"),Ve=de(ge.toISOString().slice(0,10)),I=de(!H.allDay&&ge?ge.toTimeString().slice(0,5):"10:00"),T=de(H.allDay),O=de(H.description),_=de(H.location),ae=de(H.attendees||[]),ee=de(""),K=de([]),ie=de([]),le=de(""),xe=Array.isArray(p)?p:[],Ae=de(H.color),Se=()=>{let F=new Date(ue.get()+"T"+(T.get()?"00:00:00":Te.get()+":00")),we=new Date(Ve.get()+"T"+(T.get()?"23:59:59":I.get()+":00"));A.set({title:fe.get(),start:F,end:we,allDay:T.get(),description:O.get(),location:_.get(),attendees:ae.get(),color:Ae.get()})},Oi=F=>{if(ee.set(F),!D||!F.trim()){K.set([]);return}Promise.resolve(D(F.trim())).then(we=>K.set(Array.isArray(we)?we:[])).catch(()=>K.set([]))},oa=F=>{let we=ae.get();we.some(Et=>(Et.email||Et.id)===(F.email||F.id))||(ae.set([...we,{id:F.id,email:F.email??F.label,label:F.label}]),ee.set(""),K.set([]))},na=F=>{let we=[...ae.get()];we.splice(F,1),ae.set(we)},Ft=()=>{C&&Promise.resolve(C(le.get())).then(F=>ie.set(Array.isArray(F)?F:[])).catch(()=>ie.set([]))};return W({className:"g-ui-event-calendar-form"},W({className:"g-ui-event-calendar-form-row"},be({label:"Title",placeholder:"Event title",value:fe,onInput:F=>fe.set(F?.target?.value??"")})),W({className:"g-ui-event-calendar-form-row g-ui-event-calendar-form-row-inline"},rt({label:"All day",checked:T,onChange:F=>T.set(F)})),W({className:"g-ui-event-calendar-form-row g-ui-event-calendar-form-row-inline"},W({className:"g-ui-event-calendar-form-field"},fi({className:"g-ui-event-calendar-form-label"},"Start"),Ei({type:"date",className:"g-ui-input g-ui-input-size-md",value:ue,onInput:F=>ue.set(F?.target?.value??"")}),me(!T,()=>Ei({type:"time",className:"g-ui-input g-ui-input-size-md",value:Te,onInput:F=>Te.set(F?.target?.value??"")}))),W({className:"g-ui-event-calendar-form-field"},fi({className:"g-ui-event-calendar-form-label"},"End"),Ei({type:"date",className:"g-ui-input g-ui-input-size-md",value:Ve,onInput:F=>Ve.set(F?.target?.value??"")}),me(!T,()=>Ei({type:"time",className:"g-ui-input g-ui-input-size-md",value:I,onInput:F=>I.set(F?.target?.value??"")})))),me(C,()=>W({className:"g-ui-event-calendar-form-row"},fi({className:"g-ui-event-calendar-form-label"},"Location"),be({placeholder:"Search or type location",value:le,onInput:F=>{le.set(F?.target?.value??""),Ft()},onFocus:Ft}),me(Ce(ie).compute(F=>F&&F.length>0),()=>W({className:"g-ui-event-calendar-form-suggestions"},ie.get().map(F=>W({key:F.id??F.label,className:"g-ui-event-calendar-form-suggestion-item",onClick:()=>{_.set(F.label??F.id),le.set(""),ie.set([])}},F.label??F.id)))),me(Ce(_).compute(F=>!!F),()=>Ge({className:"g-ui-event-calendar-form-chip"},_)))),me(D,()=>W({className:"g-ui-event-calendar-form-row"},fi({className:"g-ui-event-calendar-form-label"},"Add guests"),be({placeholder:"Type email to search",value:ee,onInput:F=>Oi(F?.target?.value??"")}),W({className:"g-ui-event-calendar-form-chips"},ae.get().map((F,we)=>Ge({key:(F.email||F.id)+we,className:"g-ui-event-calendar-form-chip g-ui-event-calendar-form-chip-removable",onClick:()=>na(we)},F.label||F.email||F.id," \xD7"))),me(Ce(K).compute(F=>F&&F.length>0),()=>W({className:"g-ui-event-calendar-form-suggestions"},K.get().map(F=>W({key:F.id??F.email,className:"g-ui-event-calendar-form-suggestion-item",onClick:()=>oa(F)},F.label??F.email??F.id)))))),W({className:"g-ui-event-calendar-form-row"},Ki({label:"Description",placeholder:"Add description",value:O,onInput:F=>O.set(F?.target?.value??"")})),me(xe.length>0,()=>W({className:"g-ui-event-calendar-form-row"},fi({className:"g-ui-event-calendar-form-label"},"Color"),W({className:"g-ui-event-calendar-form-colors"},xe.map(F=>W({key:F.value??F.id??F,className:s("g-ui-event-calendar-form-color-swatch",Ce(Ae).compute(we=>we===(F.value??F.id??F)?"g-ui-event-calendar-form-color-swatch-active":"")),style:{backgroundColor:F.color??F.value??F},onClick:()=>Ae.set(F.value??F.id??F)}))))),W({className:"g-ui-event-calendar-form-actions"},Ye({variant:"subtle",onClick:R},"Cancel"),Ye({variant:"filled",onClick:()=>{Se(),v?oe():Y()}},v?"Save":"Create")))},Wi=()=>{let v=V.get();return v?W({className:"g-ui-event-calendar-view-modal"},W({className:"g-ui-event-calendar-view-modal-title"},v.title||"(No title)"),W({className:"g-ui-event-calendar-view-modal-meta"},v.allDay?Ge({className:"g-ui-event-calendar-view-modal-date"},hi(v.start,m(n))+(v.start.getTime()!==v.end.getTime()?` \u2013 ${hi(v.end,m(n))}`:"")):Ge({className:"g-ui-event-calendar-view-modal-date"},`${hi(v.start,m(n))} \xB7 ${Je(v.start,m(n))} \u2013 ${Je(v.end,m(n))}`)),me(v.location,()=>W({className:"g-ui-event-calendar-view-modal-field"},"Location: ",v.location)),me(v.description,()=>W({className:"g-ui-event-calendar-view-modal-field"},v.description)),me(v.attendees?.length,()=>W({className:"g-ui-event-calendar-view-modal-field"},"Guests: ",v.attendees.map(H=>H.label||H.email||H.id).join(", "))),W({className:"g-ui-event-calendar-view-modal-actions"},Ye({variant:"subtle",size:"sm",onClick:B},ye({size:"sm",innerHTML:er})," Edit"),Ye({variant:"subtle",size:"sm",onClick:ve,className:"g-ui-event-calendar-view-modal-delete"},ye({size:"sm",innerHTML:ir})," Delete"),Ye({variant:"filled",size:"sm",onClick:R},"Close"))):null};return W({...f,className:s("g-ui-event-calendar",w)},Pe,me(k,v=>v==="month",()=>Ze),me(k,v=>v==="week",()=>Ri),me(k,v=>v==="day",()=>Hi),me(S,v=>v==="create",()=>ri({opened:!0,title:"New event",size:"lg",onClose:R},vi(!1))),me(S,v=>v==="view",()=>ri({opened:!0,title:"Event",size:"md",onClose:R},Wi())),me(S,v=>v==="edit",()=>ri({opened:!0,title:"Edit event",size:"lg",onClose:R},vi(!0))))}import{state as ng}from"@granularjs/core";function sg(e=!1){let i=ng(!!e);return[i,{open:()=>i.set(!0),close:()=>i.set(!1),toggle:()=>i.set(!i.get())}]}Rt();export{Bo as Accordion,Oe as ActionIcon,ls as Affix,Jo as Alert,yn as Anchor,hs as AppBar,It as Autocomplete,an as Avatar,Zu as AvatarGroup,Ya as Badge,Xu as BadgeGroup,ln as Blockquote,ea as BottomBar,Xn as Breadcrumbs,$u as Burger,Zi as Button,ui as Calendar,Oa as Card,Qn as Center,rt as Checkbox,Gu as CheckboxGroup,In as Chip,un as Code,Hu as Col,rs as Collapse,Fa as Container,fu as CopyButton,$i as DateInput,Us as DatePicker,Zo as Divider,qo as Drawer,og as EventCalendar,ms as Fieldset,Pu as Flex,ju as Grid,At as GridTable,Ha as Group,us as HoverCard,ye as Icon,zn as Image,Iu as Indicator,nn as Kbd,br as List,ai as Loading,Fu as LoadingOverlay,Ho as Menu,ri as Modal,Ws as MultiSelect,Vu as NavLink,ct as Notification,Qs as Notifications,Qi as NumberField,eo as NumberInput,jn as Pagination,Xo as Paper,gu as PasswordInput,qu as PinInput,Nt as Popover,ou as Popper,Nn as Progress,vu as ProgressRing,_n as Radio,Wn as RadioGroup,Su as RangePicker,iu as RangeSlider,Fs as Rating,Vt as ScrollArea,cu as SearchInput,Bn as SegmentedControl,xo as Select,ku as SelectSearch,bs as Sidebar,pn as SimpleGrid,Tn as Skeleton,Dn as Slider,es as Space,ja as Stack,As as Stepper,vo as Switch,lo as SwitchGroup,To as Table,zo as Tabs,js as Tag,Ui as Text,be as TextInput,Ki as Textarea,Is as Timeline,Aa as Title,Pt as Toast,Zs as ToastStack,Fo as Tooltip,U as classFlag,he as classMap,N as classVar,s as cx,za as getThemeMode,ka as setThemeMode,ya as setThemeVars,g as splitPropsChildren,sg as useDisclosure};
4026
4123
  //# sourceMappingURL=granular-ui.min.js.map