semaphor 0.0.17 → 0.0.18

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.
@@ -24,7 +24,7 @@ Check the top-level render call using <`+se+">.")}return G}}function ja(D,G){{if
24
24
  *
25
25
  * This source code is licensed under the MIT license found in the
26
26
  * LICENSE file in the root directory of this source tree.
27
- */var K1;function s3(){if(K1)return Mc;K1=1;var e=m,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(a,l,c){var d,f={},g=null,p=null;c!==void 0&&(g=""+c),l.key!==void 0&&(g=""+l.key),l.ref!==void 0&&(p=l.ref);for(d in l)r.call(l,d)&&!o.hasOwnProperty(d)&&(f[d]=l[d]);if(a&&a.defaultProps)for(d in l=a.defaultProps,l)f[d]===void 0&&(f[d]=l[d]);return{$$typeof:t,type:a,key:g,ref:p,props:f,_owner:i.current}}return Mc.Fragment=n,Mc.jsx=s,Mc.jsxs=s,Mc}process.env.NODE_ENV==="production"?Xg.exports=s3():Xg.exports=o3();var _=Xg.exports;function X1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=X1(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Gd(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=X1(e))&&(r&&(r+=" "),r+=t);return r}const a3=Object.freeze(Object.defineProperty({__proto__:null,clsx:Gd,default:Gd},Symbol.toStringTag,{value:"Module"})),Qg="-";function l3(e){const t=u3(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;function i(s){const a=s.split(Qg);return a[0]===""&&a.length!==1&&a.shift(),Q1(a,t)||c3(s)}function o(s,a){const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function Q1(e,t){var s;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?Q1(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const o=e.join(Qg);return(s=t.validators.find(({validator:a})=>a(o)))==null?void 0:s.classGroupId}const J1=/^\[(.+)\]$/;function c3(e){if(J1.test(e)){const t=J1.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function u3(e){const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return f3(Object.entries(e.classGroups),n).forEach(([o,s])=>{Jg(s,r,o,t)}),r}function Jg(e,t,n,r){e.forEach(i=>{if(typeof i=="string"){const o=i===""?t:Z1(t,i);o.classGroupId=n;return}if(typeof i=="function"){if(d3(i)){Jg(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{Jg(s,Z1(t,o),n,r)})})}function Z1(e,t){let n=e;return t.split(Qg).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function d3(e){return e.isThemeGetter}function f3(e,t){return t?e.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,a])=>[t+s,a])):o);return[n,i]}):e}function h3(e){if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;function i(o,s){n.set(o,s),t++,t>e&&(t=0,r=n,n=new Map)}return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}}const ew="!";function p3(e){const t=e.separator,n=t.length===1,r=t[0],i=t.length;return function(s){const a=[];let l=0,c=0,d;for(let y=0;y<s.length;y++){let x=s[y];if(l===0){if(x===r&&(n||s.slice(y,y+i)===t)){a.push(s.slice(c,y)),c=y+i;continue}if(x==="/"){d=y;continue}}x==="["?l++:x==="]"&&l--}const f=a.length===0?s:s.substring(c),g=f.startsWith(ew),p=g?f.substring(1):f,v=d&&d>c?d-c:void 0;return{modifiers:a,hasImportantModifier:g,baseClassName:p,maybePostfixModifierPosition:v}}}function g3(e){if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t}function m3(e){return{cache:h3(e.cacheSize),splitModifiers:p3(e),...l3(e)}}const v3=/\s+/;function b3(e,t){const{splitModifiers:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,o=new Set;return e.trim().split(v3).map(s=>{const{modifiers:a,hasImportantModifier:l,baseClassName:c,maybePostfixModifierPosition:d}=n(s);let f=r(d?c.substring(0,d):c),g=!!d;if(!f){if(!d)return{isTailwindClass:!1,originalClassName:s};if(f=r(c),!f)return{isTailwindClass:!1,originalClassName:s};g=!1}const p=g3(a).join(":");return{isTailwindClass:!0,modifierId:l?p+ew:p,classGroupId:f,originalClassName:s,hasPostfixModifier:g}}).reverse().filter(s=>{if(!s.isTailwindClass)return!0;const{modifierId:a,classGroupId:l,hasPostfixModifier:c}=s,d=a+l;return o.has(d)?!1:(o.add(d),i(l,c).forEach(f=>o.add(a+f)),!0)}).reverse().map(s=>s.originalClassName).join(" ")}function y3(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=tw(t))&&(r&&(r+=" "),r+=n);return r}function tw(e){if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=tw(e[r]))&&(n&&(n+=" "),n+=t);return n}function x3(e,...t){let n,r,i,o=s;function s(l){const c=t.reduce((d,f)=>f(d),e());return n=m3(c),r=n.cache.get,i=n.cache.set,o=a,a(l)}function a(l){const c=r(l);if(c)return c;const d=b3(l,n);return i(l,d),d}return function(){return o(y3.apply(null,arguments))}}function Yt(e){const t=n=>n[e]||[];return t.isThemeGetter=!0,t}const nw=/^\[(?:([a-z-]+):)?(.+)\]$/i,w3=/^\d+\/\d+$/,_3=new Set(["px","full","screen"]),S3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,C3=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,E3=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,O3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function gi(e){return Is(e)||_3.has(e)||w3.test(e)}function $o(e){return el(e,"length",N3)}function Is(e){return!!e&&!Number.isNaN(Number(e))}function Yd(e){return el(e,"number",Is)}function Dc(e){return!!e&&Number.isInteger(Number(e))}function P3(e){return e.endsWith("%")&&Is(e.slice(0,-1))}function dt(e){return nw.test(e)}function Fo(e){return S3.test(e)}const k3=new Set(["length","size","percentage"]);function M3(e){return el(e,k3,rw)}function D3(e){return el(e,"position",rw)}const T3=new Set(["image","url"]);function A3(e){return el(e,T3,L3)}function I3(e){return el(e,"",R3)}function Tc(){return!0}function el(e,t,n){const r=nw.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1}function N3(e){return C3.test(e)}function rw(){return!1}function R3(e){return E3.test(e)}function L3(e){return O3.test(e)}function $3(){const e=Yt("colors"),t=Yt("spacing"),n=Yt("blur"),r=Yt("brightness"),i=Yt("borderColor"),o=Yt("borderRadius"),s=Yt("borderSpacing"),a=Yt("borderWidth"),l=Yt("contrast"),c=Yt("grayscale"),d=Yt("hueRotate"),f=Yt("invert"),g=Yt("gap"),p=Yt("gradientColorStops"),v=Yt("gradientColorStopPositions"),y=Yt("inset"),x=Yt("margin"),w=Yt("opacity"),S=Yt("padding"),C=Yt("saturate"),P=Yt("scale"),O=Yt("sepia"),k=Yt("skew"),A=Yt("space"),L=Yt("translate"),F=()=>["auto","contain","none"],j=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto",dt,t],H=()=>[dt,t],K=()=>["",gi,$o],Y=()=>["auto",Is,dt],$=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Z=()=>["solid","dashed","dotted","double","none"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],ie=()=>["start","end","center","between","around","evenly","stretch"],le=()=>["","0",dt],M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>[Is,Yd],ne=()=>[Is,dt];return{cacheSize:500,separator:":",theme:{colors:[Tc],spacing:[gi,$o],blur:["none","",Fo,dt],brightness:W(),borderColor:[e],borderRadius:["none","","full",Fo,dt],borderSpacing:H(),borderWidth:K(),contrast:W(),grayscale:le(),hueRotate:ne(),invert:le(),gap:H(),gradientColorStops:[e],gradientColorStopPositions:[P3,$o],inset:B(),margin:B(),opacity:W(),padding:H(),saturate:W(),scale:W(),sepia:le(),skew:ne(),space:H(),translate:H()},classGroups:{aspect:[{aspect:["auto","square","video",dt]}],container:["container"],columns:[{columns:[Fo]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...$(),dt]}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Dc,dt]}],basis:[{basis:B()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",dt]}],grow:[{grow:le()}],shrink:[{shrink:le()}],order:[{order:["first","last","none",Dc,dt]}],"grid-cols":[{"grid-cols":[Tc]}],"col-start-end":[{col:["auto",{span:["full",Dc,dt]},dt]}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":[Tc]}],"row-start-end":[{row:["auto",{span:[Dc,dt]},dt]}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",dt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",dt]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...ie()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ie(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ie(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[S]}],px:[{px:[S]}],py:[{py:[S]}],ps:[{ps:[S]}],pe:[{pe:[S]}],pt:[{pt:[S]}],pr:[{pr:[S]}],pb:[{pb:[S]}],pl:[{pl:[S]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",dt,t]}],"min-w":[{"min-w":["min","max","fit",dt,gi]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[Fo]},Fo,dt]}],h:[{h:[dt,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",gi,dt]}],"max-h":[{"max-h":[dt,t,"min","max","fit"]}],"font-size":[{text:["base",Fo,$o]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Yd]}],"font-family":[{font:[Tc]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",dt]}],"line-clamp":[{"line-clamp":["none",Is,Yd]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",gi,dt]}],"list-image":[{"list-image":["none",dt]}],"list-style-type":[{list:["none","disc","decimal",dt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",gi,$o]}],"underline-offset":[{"underline-offset":["auto",gi,dt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",dt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",dt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...$(),D3]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",M3]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},A3]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[...Z(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:Z()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...Z()]}],"outline-offset":[{"outline-offset":[gi,dt]}],"outline-w":[{outline:[gi,$o]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[gi,$o]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Fo,I3]}],"shadow-color":[{shadow:[Tc]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":U()}],"bg-blend":[{"bg-blend":U()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Fo,dt]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[C]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[C]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",dt]}],duration:[{duration:ne()}],ease:[{ease:["linear","in","out","in-out",dt]}],delay:[{delay:ne()}],animate:[{animate:["none","spin","ping","pulse","bounce",dt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[P]}],"scale-x":[{"scale-x":[P]}],"scale-y":[{"scale-y":[P]}],rotate:[{rotate:[Dc,dt]}],"translate-x":[{"translate-x":[L]}],"translate-y":[{"translate-y":[L]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",dt]}],accent:[{accent:["auto",e]}],appearance:["appearance-none"],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",dt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",dt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[gi,$o,Yd]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const F3=x3($3);class j3 extends Error{}j3.prototype.name="InvalidTokenError";function Pe(...e){return F3(Gd(e))}async function tl(e,t,n={}){try{const r=new URLSearchParams(n).toString(),i=`${e}?${r}`,o=await fetch(i,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!o.ok){const a=await o.json();throw new Error((a==null?void 0:a.error)||`HTTP error! status: ${o.status}`)}return await o.json()}catch(r){throw console.error("Error during fetch:",r),r}}async function Ns(e,t,n={}){try{const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(n)});return r.ok?await r.json():r.json().then(o=>{throw console.log(o.detail||"Unknown error occurred"),new Error((o==null?void 0:o.error)||`HTTP error! status: ${r.status}`)})}catch(r){throw console.error("Error during fetch:",r),r}}function z3(e){var t;if(navigator.clipboard&&e.current)navigator.clipboard.writeText(e.current.innerText).then(()=>console.log("Content copied to clipboard")).catch(n=>console.error("Failed to copy: ",n));else{const n=document.createElement("textarea");n.value=((t=e==null?void 0:e.current)==null?void 0:t.innerText)??"",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),console.log("Content copied to clipboard")}}var B3={VITE_SEMAPHOR_API:"http://localhost:3000/api/v1",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const iw=e=>{let t;const n=new Set,r=(l,c)=>{const d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){const f=t;t=c??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(g=>g(t,f))}},i=()=>t,a={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{(B3?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};return t=e(r,i,a),a},V3=e=>e?iw(e):iw;var Zg={exports:{}},em={},Kd={exports:{}},tm={};/**
27
+ */var K1;function s3(){if(K1)return Mc;K1=1;var e=m,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(a,l,c){var d,f={},g=null,p=null;c!==void 0&&(g=""+c),l.key!==void 0&&(g=""+l.key),l.ref!==void 0&&(p=l.ref);for(d in l)r.call(l,d)&&!o.hasOwnProperty(d)&&(f[d]=l[d]);if(a&&a.defaultProps)for(d in l=a.defaultProps,l)f[d]===void 0&&(f[d]=l[d]);return{$$typeof:t,type:a,key:g,ref:p,props:f,_owner:i.current}}return Mc.Fragment=n,Mc.jsx=s,Mc.jsxs=s,Mc}process.env.NODE_ENV==="production"?Xg.exports=s3():Xg.exports=o3();var _=Xg.exports;function X1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=X1(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Gd(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=X1(e))&&(r&&(r+=" "),r+=t);return r}const a3=Object.freeze(Object.defineProperty({__proto__:null,clsx:Gd,default:Gd},Symbol.toStringTag,{value:"Module"})),Qg="-";function l3(e){const t=u3(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;function i(s){const a=s.split(Qg);return a[0]===""&&a.length!==1&&a.shift(),Q1(a,t)||c3(s)}function o(s,a){const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function Q1(e,t){var s;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?Q1(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const o=e.join(Qg);return(s=t.validators.find(({validator:a})=>a(o)))==null?void 0:s.classGroupId}const J1=/^\[(.+)\]$/;function c3(e){if(J1.test(e)){const t=J1.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function u3(e){const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return f3(Object.entries(e.classGroups),n).forEach(([o,s])=>{Jg(s,r,o,t)}),r}function Jg(e,t,n,r){e.forEach(i=>{if(typeof i=="string"){const o=i===""?t:Z1(t,i);o.classGroupId=n;return}if(typeof i=="function"){if(d3(i)){Jg(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{Jg(s,Z1(t,o),n,r)})})}function Z1(e,t){let n=e;return t.split(Qg).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function d3(e){return e.isThemeGetter}function f3(e,t){return t?e.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,a])=>[t+s,a])):o);return[n,i]}):e}function h3(e){if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;function i(o,s){n.set(o,s),t++,t>e&&(t=0,r=n,n=new Map)}return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}}const ew="!";function p3(e){const t=e.separator,n=t.length===1,r=t[0],i=t.length;return function(s){const a=[];let l=0,c=0,d;for(let y=0;y<s.length;y++){let x=s[y];if(l===0){if(x===r&&(n||s.slice(y,y+i)===t)){a.push(s.slice(c,y)),c=y+i;continue}if(x==="/"){d=y;continue}}x==="["?l++:x==="]"&&l--}const f=a.length===0?s:s.substring(c),g=f.startsWith(ew),p=g?f.substring(1):f,v=d&&d>c?d-c:void 0;return{modifiers:a,hasImportantModifier:g,baseClassName:p,maybePostfixModifierPosition:v}}}function g3(e){if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t}function m3(e){return{cache:h3(e.cacheSize),splitModifiers:p3(e),...l3(e)}}const v3=/\s+/;function b3(e,t){const{splitModifiers:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,o=new Set;return e.trim().split(v3).map(s=>{const{modifiers:a,hasImportantModifier:l,baseClassName:c,maybePostfixModifierPosition:d}=n(s);let f=r(d?c.substring(0,d):c),g=!!d;if(!f){if(!d)return{isTailwindClass:!1,originalClassName:s};if(f=r(c),!f)return{isTailwindClass:!1,originalClassName:s};g=!1}const p=g3(a).join(":");return{isTailwindClass:!0,modifierId:l?p+ew:p,classGroupId:f,originalClassName:s,hasPostfixModifier:g}}).reverse().filter(s=>{if(!s.isTailwindClass)return!0;const{modifierId:a,classGroupId:l,hasPostfixModifier:c}=s,d=a+l;return o.has(d)?!1:(o.add(d),i(l,c).forEach(f=>o.add(a+f)),!0)}).reverse().map(s=>s.originalClassName).join(" ")}function y3(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=tw(t))&&(r&&(r+=" "),r+=n);return r}function tw(e){if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=tw(e[r]))&&(n&&(n+=" "),n+=t);return n}function x3(e,...t){let n,r,i,o=s;function s(l){const c=t.reduce((d,f)=>f(d),e());return n=m3(c),r=n.cache.get,i=n.cache.set,o=a,a(l)}function a(l){const c=r(l);if(c)return c;const d=b3(l,n);return i(l,d),d}return function(){return o(y3.apply(null,arguments))}}function Yt(e){const t=n=>n[e]||[];return t.isThemeGetter=!0,t}const nw=/^\[(?:([a-z-]+):)?(.+)\]$/i,w3=/^\d+\/\d+$/,_3=new Set(["px","full","screen"]),S3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,C3=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,E3=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,O3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function gi(e){return Is(e)||_3.has(e)||w3.test(e)}function $o(e){return el(e,"length",N3)}function Is(e){return!!e&&!Number.isNaN(Number(e))}function Yd(e){return el(e,"number",Is)}function Dc(e){return!!e&&Number.isInteger(Number(e))}function P3(e){return e.endsWith("%")&&Is(e.slice(0,-1))}function dt(e){return nw.test(e)}function Fo(e){return S3.test(e)}const k3=new Set(["length","size","percentage"]);function M3(e){return el(e,k3,rw)}function D3(e){return el(e,"position",rw)}const T3=new Set(["image","url"]);function A3(e){return el(e,T3,L3)}function I3(e){return el(e,"",R3)}function Tc(){return!0}function el(e,t,n){const r=nw.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1}function N3(e){return C3.test(e)}function rw(){return!1}function R3(e){return E3.test(e)}function L3(e){return O3.test(e)}function $3(){const e=Yt("colors"),t=Yt("spacing"),n=Yt("blur"),r=Yt("brightness"),i=Yt("borderColor"),o=Yt("borderRadius"),s=Yt("borderSpacing"),a=Yt("borderWidth"),l=Yt("contrast"),c=Yt("grayscale"),d=Yt("hueRotate"),f=Yt("invert"),g=Yt("gap"),p=Yt("gradientColorStops"),v=Yt("gradientColorStopPositions"),y=Yt("inset"),x=Yt("margin"),w=Yt("opacity"),S=Yt("padding"),C=Yt("saturate"),P=Yt("scale"),O=Yt("sepia"),k=Yt("skew"),A=Yt("space"),L=Yt("translate"),F=()=>["auto","contain","none"],j=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto",dt,t],H=()=>[dt,t],K=()=>["",gi,$o],Y=()=>["auto",Is,dt],$=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Z=()=>["solid","dashed","dotted","double","none"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],ie=()=>["start","end","center","between","around","evenly","stretch"],le=()=>["","0",dt],M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>[Is,Yd],ne=()=>[Is,dt];return{cacheSize:500,separator:":",theme:{colors:[Tc],spacing:[gi,$o],blur:["none","",Fo,dt],brightness:W(),borderColor:[e],borderRadius:["none","","full",Fo,dt],borderSpacing:H(),borderWidth:K(),contrast:W(),grayscale:le(),hueRotate:ne(),invert:le(),gap:H(),gradientColorStops:[e],gradientColorStopPositions:[P3,$o],inset:B(),margin:B(),opacity:W(),padding:H(),saturate:W(),scale:W(),sepia:le(),skew:ne(),space:H(),translate:H()},classGroups:{aspect:[{aspect:["auto","square","video",dt]}],container:["container"],columns:[{columns:[Fo]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...$(),dt]}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Dc,dt]}],basis:[{basis:B()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",dt]}],grow:[{grow:le()}],shrink:[{shrink:le()}],order:[{order:["first","last","none",Dc,dt]}],"grid-cols":[{"grid-cols":[Tc]}],"col-start-end":[{col:["auto",{span:["full",Dc,dt]},dt]}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":[Tc]}],"row-start-end":[{row:["auto",{span:[Dc,dt]},dt]}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",dt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",dt]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...ie()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ie(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ie(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[S]}],px:[{px:[S]}],py:[{py:[S]}],ps:[{ps:[S]}],pe:[{pe:[S]}],pt:[{pt:[S]}],pr:[{pr:[S]}],pb:[{pb:[S]}],pl:[{pl:[S]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",dt,t]}],"min-w":[{"min-w":["min","max","fit",dt,gi]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[Fo]},Fo,dt]}],h:[{h:[dt,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",gi,dt]}],"max-h":[{"max-h":[dt,t,"min","max","fit"]}],"font-size":[{text:["base",Fo,$o]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Yd]}],"font-family":[{font:[Tc]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",dt]}],"line-clamp":[{"line-clamp":["none",Is,Yd]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",gi,dt]}],"list-image":[{"list-image":["none",dt]}],"list-style-type":[{list:["none","disc","decimal",dt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",gi,$o]}],"underline-offset":[{"underline-offset":["auto",gi,dt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",dt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",dt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...$(),D3]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",M3]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},A3]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[...Z(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:Z()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...Z()]}],"outline-offset":[{"outline-offset":[gi,dt]}],"outline-w":[{outline:[gi,$o]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[gi,$o]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Fo,I3]}],"shadow-color":[{shadow:[Tc]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":U()}],"bg-blend":[{"bg-blend":U()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Fo,dt]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[C]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[C]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",dt]}],duration:[{duration:ne()}],ease:[{ease:["linear","in","out","in-out",dt]}],delay:[{delay:ne()}],animate:[{animate:["none","spin","ping","pulse","bounce",dt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[P]}],"scale-x":[{"scale-x":[P]}],"scale-y":[{"scale-y":[P]}],rotate:[{rotate:[Dc,dt]}],"translate-x":[{"translate-x":[L]}],"translate-y":[{"translate-y":[L]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",dt]}],accent:[{accent:["auto",e]}],appearance:["appearance-none"],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",dt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",dt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[gi,$o,Yd]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const F3=x3($3);class j3 extends Error{}j3.prototype.name="InvalidTokenError";function Pe(...e){return F3(Gd(e))}async function tl(e,t,n={}){try{const r=new URLSearchParams(n).toString(),i=`${e}?${r}`,o=await fetch(i,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!o.ok){const a=await o.json();throw new Error((a==null?void 0:a.error)||`HTTP error! status: ${o.status}`)}return await o.json()}catch(r){throw console.error("Error during fetch:",r),r}}async function Ns(e,t,n={}){try{const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(n)});return r.ok?await r.json():r.json().then(o=>{throw console.log(o.detail||"Unknown error occurred"),new Error((o==null?void 0:o.error)||`HTTP error! status: ${r.status}`)})}catch(r){throw console.error("Error during fetch:",r),r}}function z3(e){var t;if(navigator.clipboard&&e.current)navigator.clipboard.writeText(e.current.innerText).then(()=>console.log("Content copied to clipboard")).catch(n=>console.error("Failed to copy: ",n));else{const n=document.createElement("textarea");n.value=((t=e==null?void 0:e.current)==null?void 0:t.innerText)??"",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),console.log("Content copied to clipboard")}}var B3={VITE_SEMAPHOR_API:"https://semaphor.cloud/api/v1",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const iw=e=>{let t;const n=new Set,r=(l,c)=>{const d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){const f=t;t=c??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(g=>g(t,f))}},i=()=>t,a={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{(B3?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};return t=e(r,i,a),a},V3=e=>e?iw(e):iw;var Zg={exports:{}},em={},Kd={exports:{}},tm={};/**
28
28
  * @license React
29
29
  * use-sync-external-store-shim.development.js
30
30
  *
@@ -56,7 +56,7 @@ Check the top-level render call using <`+se+">.")}return G}}function ja(D,G){{if
56
56
  *
57
57
  * This source code is licensed under the MIT license found in the
58
58
  * LICENSE file in the root directory of this source tree.
59
- */var uw;function U3(){if(uw)return rm;uw=1;var e=m,t=lw();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return rm.useSyncExternalStoreWithSelector=function(c,d,f,g,p){var v=o(null);if(v.current===null){var y={hasValue:!1,value:null};v.current=y}else y=v.current;v=a(function(){function w(k){if(!S){if(S=!0,C=k,k=g(k),p!==void 0&&y.hasValue){var A=y.value;if(p(A,k))return P=A}return P=k}if(A=P,r(C,k))return A;var L=g(k);return p!==void 0&&p(A,L)?A:(C=k,P=L)}var S=!1,C,P,O=f===void 0?null:f;return[function(){return w(d())},O===null?void 0:function(){return w(O())}]},[d,f,g,p]);var x=i(c,v[0],v[1]);return s(function(){y.hasValue=!0,y.value=x},[x]),l(x),x},rm}process.env.NODE_ENV==="production"?Zg.exports=U3():Zg.exports=q3();var G3=Zg.exports;const Y3=Pc(G3);var dw={VITE_SEMAPHOR_API:"http://localhost:3000/api/v1",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useDebugValue:K3}=m,{useSyncExternalStoreWithSelector:X3}=Y3;let fw=!1;function Q3(e,t=e.getState,n){(dw?"production":void 0)!=="production"&&n&&!fw&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),fw=!0);const r=X3(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return K3(r),r}const hw=e=>{(dw?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?V3(e):e,n=(r,i)=>Q3(t,r,i);return Object.assign(n,t),n},pw=e=>e?hw(e):hw;var gw=Symbol.for("immer-nothing"),mw=Symbol.for("immer-draftable"),_r=Symbol.for("immer-state"),J3=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function or(e,...t){if(process.env.NODE_ENV!=="production"){const n=J3[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var nl=Object.getPrototypeOf;function rl(e){return!!e&&!!e[_r]}function Rs(e){var t;return e?vw(e)||Array.isArray(e)||!!e[mw]||!!((t=e.constructor)!=null&&t[mw])||Qd(e)||Jd(e):!1}var Z3=Object.prototype.constructor.toString();function vw(e){if(!e||typeof e!="object")return!1;const t=nl(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Z3}function Ac(e,t){Xd(e)===0?Object.entries(e).forEach(([n,r])=>{t(n,r,e)}):e.forEach((n,r)=>t(r,n,e))}function Xd(e){const t=e[_r];return t?t.type_:Array.isArray(e)?1:Qd(e)?2:Jd(e)?3:0}function im(e,t){return Xd(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function bw(e,t,n){const r=Xd(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function eN(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Qd(e){return e instanceof Map}function Jd(e){return e instanceof Set}function Ls(e){return e.copy_||e.base_}function om(e,t){if(Qd(e))return new Map(e);if(Jd(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&vw(e))return nl(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[_r];let r=Reflect.ownKeys(n);for(let i=0;i<r.length;i++){const o=r[i],s=n[o];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[o]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[o]})}return Object.create(nl(e),n)}function sm(e,t=!1){return Zd(e)||rl(e)||!Rs(e)||(Xd(e)>1&&(e.set=e.add=e.clear=e.delete=tN),Object.freeze(e),t&&Ac(e,(n,r)=>sm(r,!0))),e}function tN(){or(2)}function Zd(e){return Object.isFrozen(e)}var nN={};function $s(e){const t=nN[e];return t||or(0,e),t}var Ic;function yw(){return Ic}function rN(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function xw(e,t){t&&($s("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function am(e){lm(e),e.drafts_.forEach(iN),e.drafts_=null}function lm(e){e===Ic&&(Ic=e.parent_)}function ww(e){return Ic=rN(Ic,e)}function iN(e){const t=e[_r];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function _w(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[_r].modified_&&(am(t),or(4)),Rs(e)&&(e=ef(t,e),t.parent_||tf(t,e)),t.patches_&&$s("Patches").generateReplacementPatches_(n[_r].base_,e,t.patches_,t.inversePatches_)):e=ef(t,n,[]),am(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==gw?e:void 0}function ef(e,t,n){if(Zd(t))return t;const r=t[_r];if(!r)return Ac(t,(i,o)=>Sw(e,r,t,i,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return tf(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let o=i,s=!1;r.type_===3&&(o=new Set(i),i.clear(),s=!0),Ac(o,(a,l)=>Sw(e,r,i,a,l,n,s)),tf(e,i,!1),n&&e.patches_&&$s("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Sw(e,t,n,r,i,o,s){if(process.env.NODE_ENV!=="production"&&i===n&&or(5),rl(i)){const a=o&&t&&t.type_!==3&&!im(t.assigned_,r)?o.concat(r):void 0,l=ef(e,i,a);if(bw(n,r,l),rl(l))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(Rs(i)&&!Zd(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ef(e,i),(!t||!t.scope_.parent_)&&tf(e,i)}}function tf(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&sm(t,n)}function oN(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:yw(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=cm;n&&(i=[r],o=Nc);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var cm={get(e,t){if(t===_r)return e;const n=Ls(e);if(!im(n,t))return sN(e,n,t);const r=n[t];return e.finalized_||!Rs(r)?r:r===um(e.base_,t)?(fm(e),e.copy_[t]=hm(r,e)):r},has(e,t){return t in Ls(e)},ownKeys(e){return Reflect.ownKeys(Ls(e))},set(e,t,n){const r=Cw(Ls(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=um(Ls(e),t),o=i==null?void 0:i[_r];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(eN(n,i)&&(n!==void 0||im(e.base_,t)))return!0;fm(e),dm(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return um(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,fm(e),dm(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Ls(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){or(11)},getPrototypeOf(e){return nl(e.base_)},setPrototypeOf(){or(12)}},Nc={};Ac(cm,(e,t)=>{Nc[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Nc.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&or(13),Nc.set.call(this,e,t,void 0)},Nc.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&or(14),cm.set.call(this,e[0],t,n,e[0])};function um(e,t){const n=e[_r];return(n?Ls(n):e)[t]}function sN(e,t,n){var i;const r=Cw(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Cw(e,t){if(!(t in e))return;let n=nl(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=nl(n)}}function dm(e){e.modified_||(e.modified_=!0,e.parent_&&dm(e.parent_))}function fm(e){e.copy_||(e.copy_=om(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var aN=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const o=n;n=t;const s=this;return function(l=o,...c){return s.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&or(6),r!==void 0&&typeof r!="function"&&or(7);let i;if(Rs(t)){const o=ww(this),s=hm(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?am(o):lm(o)}return xw(o,r),_w(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===gw&&(i=void 0),this.autoFreeze_&&sm(i,!0),r){const o=[],s=[];$s("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}else or(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,l=>t(l,...a));let r,i;return[this.produce(t,n,(s,a)=>{r=s,i=a}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Rs(e)||or(8),rl(e)&&(e=lN(e));const t=ww(this),n=hm(e,void 0);return n[_r].isManual_=!0,lm(t),n}finishDraft(e,t){const n=e&&e[_r];(!n||!n.isManual_)&&or(9);const{scope_:r}=n;return xw(r,t),_w(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=$s("Patches").applyPatches_;return rl(e)?r(e,t):this.produce(e,i=>r(i,t))}};function hm(e,t){const n=Qd(e)?$s("MapSet").proxyMap_(e,t):Jd(e)?$s("MapSet").proxySet_(e,t):oN(e,t);return(t?t.scope_:yw()).drafts_.push(n),n}function lN(e){return rl(e)||or(10,e),Ew(e)}function Ew(e){if(!Rs(e)||Zd(e))return e;const t=e[_r];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=om(e,t.scope_.immer_.useStrictShallowCopy_)}else n=om(e,!0);return Ac(n,(r,i)=>{bw(n,r,Ew(i))}),t&&(t.finalized_=!1),n}var Sr=new aN,cN=Sr.produce;Sr.produceWithPatches.bind(Sr),Sr.setAutoFreeze.bind(Sr),Sr.setUseStrictShallowCopy.bind(Sr),Sr.applyPatches.bind(Sr),Sr.createDraft.bind(Sr),Sr.finishDraft.bind(Sr);const Ow=e=>(t,n,r)=>(r.setState=(i,o,...s)=>{const a=typeof i=="function"?cN(i):i;return t(a,o,...s)},e(r.setState,n,r));var nf,rf=Mt;if(process.env.NODE_ENV==="production")nf=rf.createRoot,rf.hydrateRoot;else{var Pw=rf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;nf=function(e,t){Pw.usingClientEntryPoint=!0;try{return rf.createRoot(e,t)}finally{Pw.usingClientEntryPoint=!1}}}function kw(e,t,n){const r={count:0},i=a=>{const l=m.useRef(r.count);return m.useEffect(()=>{l.current+=1,l.current===r.count+1&&(l.current-=1,t.setState(a))}),null};if(i.displayName=`((${e})) devtool`,typeof document>"u")return;if(!n){let a=document.getElementById(`simple-zustand-devtools-${e}`);a||(a=document.createElement("div"),a.id=`simple-zustand-devtools-${e}`),document.body.appendChild(a),n=a}const o=nf(n),s=a=>{a&&(o.render(m.createElement(i,Object.assign({},a))),r.count+=1)};s(t.getState()),t.subscribe(s)}var Mw={},Dw={},pm={exports:{}},Kt=String,Tw=function(){return{isColorSupported:!1,reset:Kt,bold:Kt,dim:Kt,italic:Kt,underline:Kt,inverse:Kt,hidden:Kt,strikethrough:Kt,black:Kt,red:Kt,green:Kt,yellow:Kt,blue:Kt,magenta:Kt,cyan:Kt,white:Kt,gray:Kt,bgBlack:Kt,bgRed:Kt,bgGreen:Kt,bgYellow:Kt,bgBlue:Kt,bgMagenta:Kt,bgCyan:Kt,bgWhite:Kt}};pm.exports=Tw(),pm.exports.createColors=Tw;var uN=pm.exports;(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(l,c){for(var d in c)Object.defineProperty(l,d,{enumerable:!0,get:c[d]})}t(e,{dim:function(){return s},default:function(){return a}});const n=r(uN);function r(l){return l&&l.__esModule?l:{default:l}}let i=new Set;function o(l,c,d){typeof process<"u"&&process.env.JEST_WORKER_ID||d&&i.has(d)||(d&&i.add(d),console.warn(""),c.forEach(f=>console.warn(l,"-",f)))}function s(l){return n.default.dim(l)}const a={info(l,c){o(n.default.bold(n.default.cyan("info")),...Array.isArray(l)?[l]:[c,l])},warn(l,c){o(n.default.bold(n.default.yellow("warn")),...Array.isArray(l)?[l]:[c,l])},risk(l,c){o(n.default.bold(n.default.magenta("risk")),...Array.isArray(l)?[l]:[c,l])}}})(Dw),function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return i}});const t=n(Dw);function n(o){return o&&o.__esModule?o:{default:o}}function r({version:o,from:s,to:a}){t.default.warn(`${s}-color-renamed`,[`As of Tailwind CSS ${o}, \`${s}\` has been renamed to \`${a}\`.`,"Update your configuration file to silence this warning."])}const i={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"},get lightBlue(){return r({version:"v2.2",from:"lightBlue",to:"sky"}),this.sky},get warmGray(){return r({version:"v3.0",from:"warmGray",to:"stone"}),this.stone},get trueGray(){return r({version:"v3.0",from:"trueGray",to:"neutral"}),this.neutral},get coolGray(){return r({version:"v3.0",from:"coolGray",to:"gray"}),this.gray},get blueGray(){return r({version:"v3.0",from:"blueGray",to:"slate"}),this.slate}}}(Mw);let gm=Mw;var dN=(gm.__esModule?gm:{default:gm}).default;const fn=Pc(dN),mm={default:{dashboardPanel:"",dashboardTabsContainer:"",gridLayout:{className:""},chart:{font:{family:"Open Sans, sans-serif"},dataset:{backgroundColor:["#8a8ed1",fn.red[400],fn.amber[400],fn.orange[400],fn.rose[400]],borderColor:[fn.indigo[400],fn.red[400],fn.amber[400],fn.orange[400],fn.rose[400]]},options:{plugins:{datalabels:{display:!1,color:fN},title:{display:!0},tooltip:{backgroundColor:"#fff",bodyColor:"#000",borderWidth:.25,titleColor:"#000",borderColor:"rgb(128,131,139)",cornerRadius:2,boxPadding:4},legend:{position:"top",align:"center",maxHeight:0}},scales:{y:{grid:{display:!0},title:{display:!0,text:""},beginAtZero:!0,ticks:{precision:0}},x:{grid:{display:!0},title:{display:!0}}},layout:{padding:{top:-40}},borderRadius:1,responsive:!0,maintainAspectRatio:!1}}},dark:{chart:{dataset:{backgroundColor:[fn.teal[100],fn.purple[100],fn.amber[100],fn.orange[100],fn.rose[100]],borderColor:[fn.teal[400],fn.purple[400],fn.amber[400],fn.orange[300],fn.rose[400]]},options:{plugins:{tooltip:{backgroundColor:"#000",bodyColor:"#fff",borderWidth:.25,titleColor:"#fff",borderColor:"rgb(128,131,139)",cornerRadius:2,boxPadding:4}},datalabels:{display:!1},scales:{x:{grid:{display:!0,color:fn.slate[800]}},y:{grid:{display:!0,color:fn.slate[800]}}}}}}};function fN(e){var r,i,o,s,a,l;const t=(a=(s=(o=(i=(r=e==null?void 0:e.chart)==null?void 0:r.config)==null?void 0:i._config)==null?void 0:o.options)==null?void 0:s.plugins)==null?void 0:a.datalabels;let n=(l=e==null?void 0:e.dataset)==null?void 0:l.backgroundColor;return(t==null?void 0:t.align)==="end"&&(t==null?void 0:t.anchor)==="end"&&(n=Aw()),(t==null?void 0:t.align)==="start"&&(t==null?void 0:t.anchor)==="start"&&(n=Aw()),hN(n)}function Aw(){return ge.getState().theme==="dark"?"#000000":"#FFFFFF"}function hN(e){let t=0,n=0,r=0,i=0;const o=d=>{const f=d.replace("#",""),g=parseInt(f.substring(0,2),16),p=parseInt(f.substring(2,4),16),v=parseInt(f.substring(4,6),16);t+=g,n+=p,r+=v,i++};Array.isArray(e)?e.forEach(d=>{o(d)}):o(e);const s=t/i,a=n/i,l=r/i;return(s*299+a*587+l*114)/1e3>=180?"black":"white"}const ge=pw()(Ow((e,t)=>({dashboard:{id:"",style:mm},showContext:!1,selectedSheetId:null,selectedCardId:null,selectedCard:null,showFilters:!1,isDashboardEditing:!1,isVisualEditing:!1,showDashboardJSON:!1,isEditorSaveEvent:!1,actions:{setAuthToken:n=>{e(()=>({authToken:n}))},setThemeStyle:n=>{e(()=>({themeStyle:n}))},setIsEditorSaveEvent:n=>{e(()=>({isEditorSaveEvent:n}))},setDashboard:n=>e({dashboard:n}),setBookmarkKey:n=>{e(()=>({bookmarkKey:n}))},setDashboardTheme:n=>{e(r=>{r.theme=n})},setDashboardTitle:n=>{e(r=>{r.dashboard&&(r.dashboard.title=n)})},setDashboardDescription:n=>{e(r=>{r.dashboard&&(r.dashboard.description=n)})},setSheets:n=>{e(r=>{r.dashboard&&(r.dashboard.sheets=n)})},setSheetTitle:(n,r)=>{e(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);o&&(o.title=r)})},setSheetDescription:(n,r)=>{e(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);o&&(o.description=r)})},setCards:(n,r)=>{e(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);o&&(o.cards=r)})},setCardTitle:(n,r,i)=>{e(o=>{var a,l,c,d;const s=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n);if(s){const f=(c=s.cards)==null?void 0:c.find(g=>g.id===r);f&&(f.title=i,(d=o.onUpdateCard)==null||d.call(o,f,n))}})},setCardSql:(n,r,i)=>{e(o=>{var a,l,c,d;const s=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n);if(s){const f=(c=s.cards)==null?void 0:c.find(g=>g.id===r);f&&(f.sql=i,(d=o.onUpdateCard)==null||d.call(o,f,n))}})},setCardData:(n,r,i)=>{e(o=>{var a,l,c;const s=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(d=>d.id===n);if(s){const d=(c=s.cards)==null?void 0:c.find(f=>f.id===r);d&&(d.data=i)}})},setCardDescription:(n,r,i)=>{e(o=>{var a,l,c,d;const s=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n);if(s){const f=(c=s.cards)==null?void 0:c.find(g=>g.id===r);f&&(f.description=i,(d=o.onUpdateCard)==null||d.call(o,f,n))}})},setSheetLayout:(n,r)=>{e(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);o&&(o.layout=r)})},setShowContext:n=>{e(()=>({showContext:n}))},setShowFilters:n=>{e(()=>({showFilters:n}))},setFilterValues:n=>{e(()=>({filterValues:n}))},addOrUpdateFilterValue:n=>{e(r=>{if(r.filterValues){const i=r.filterValues.findIndex(o=>o.filterId===n.filterId);i>-1?r.filterValues.splice(i,1,n):r.filterValues.push(n)}else r.filterValues=[n]})},removeFilterValue:n=>{e(r=>{if(r.filterValues){const i=r.filterValues.findIndex(o=>o.filterId===n);i>-1&&r.filterValues.splice(i,1)}})},addFilter:n=>{e(r=>{var i;r.dashboard.filters?(i=r.dashboard.filters)==null||i.push(n):r.dashboard.filters=[n]})},removeFilter:n=>{e(r=>{var i,o;if(r.dashboard.filters){const s=(i=r.dashboard.filters)==null?void 0:i.findIndex(a=>a.id===n);console.log("index",s),s>-1&&((o=r.dashboard.filters)==null||o.splice(s,1))}})},updateFilter:n=>{e(r=>{var i,o;if(r.dashboard.filters){const s=(i=r.dashboard.filters)==null?void 0:i.findIndex(a=>a.id===n.id);s>-1&&((o=r.dashboard.filters)==null||o.splice(s,1,n))}})},setIsDashboardEditing:n=>{e(()=>({isDashboardEditing:n}))},setShowDashboardJSON:n=>{e(()=>({showDashboardJSON:n}))},setIsVisualEditing:n=>{e(()=>({isVisualEditing:n}))},addCard:(n,r)=>{e(i=>{var s,a,l,c,d;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(f=>f.id===n);if(o){(l=o.cards)==null||l.push(r);const f={i:r.id,x:0,y:1/0,w:20,h:7,minW:10};(c=o.layout)==null||c.push(f),(d=i.onAddCard)==null||d.call(i,r,n)}})},updateCard:(n,r)=>{e(i=>{var a,l,c,d,f;const o=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(g=>g.id===n),s=(c=o==null?void 0:o.cards)==null?void 0:c.findIndex(g=>g.id===r.id);o&&((d=o.cards)==null||d.splice(s,1,r),(f=i.onUpdateCard)==null||f.call(i,r,n))})},removeCard:(n,r)=>{e(i=>{var a,l,c,d,f,g;const o=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(p=>p.id===n),s=(c=o==null?void 0:o.cards)==null?void 0:c.findIndex(p=>p.id===r.id);o&&((d=o.cards)==null||d.splice(s,1),(f=o.layout)==null||f.splice(s,1),(g=i.onRemoveCard)==null||g.call(i,r,n))})},setStyle:n=>{e(r=>{r.dashboard&&(r.dashboard.style=n)})},setSelectedCardId:(n,r)=>{e(i=>{var s,a,l;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===n);o&&(((l=o.cards)==null?void 0:l.find(d=>d.id===r))?i.selectedCardId=r:i.selectedCardId=null)})},setSelectedCard:n=>{e(r=>{r.selectedCard=n})},setSelectedSheetId:n=>{e(r=>{var o,s;((s=(o=r.dashboard)==null?void 0:o.sheets)==null?void 0:s.find(a=>a.id===n))&&(r.selectedSheetId=n)})},setOnSaveFunction:n=>{e(()=>({onSaveFunction:n}))},setOnAddCard:n=>{e(()=>({onAddCard:n}))},setOnUpdateCard:n=>{e(()=>({onUpdateCard:n}))},setOnRemoveCard:n=>{e(()=>({onRemoveCard:n}))},setOnEvent:n=>{e(()=>({onEvent:n}))},getDashboard:()=>t().dashboard,getSelectedSheet:()=>{var n,r;return(r=(n=t().dashboard)==null?void 0:n.sheets)==null?void 0:r.find(i=>i.id===t().selectedSheetId)},getSelectedCard:()=>{var r,i,o;const n=(i=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:i.find(s=>s.id===t().selectedSheetId);return(o=n==null?void 0:n.cards)==null?void 0:o.find(s=>s.id===t().selectedCardId)},getSelectedSheetCards:()=>{var r,i;const n=(i=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:i.find(o=>o.id===t().selectedSheetId);return n==null?void 0:n.cards},getSelectedSheetLayout:()=>{var r,i;const n=(i=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:i.find(o=>o.id===t().selectedSheetId);return n==null?void 0:n.layout},getStyle:()=>{var n;return(n=t().dashboard)==null?void 0:n.style}}})));process.env.NODE_ENV==="development"&&kw("DashboardStore",ge);var Rc=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},il=typeof window>"u"||"Deno"in window;function Xr(){}function pN(e,t){return typeof e=="function"?e(t):e}function vm(e){return typeof e=="number"&&e>=0&&e!==1/0}function Iw(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Nw(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==bm(s,t.options))return!1}else if(!$c(t.queryKey,s))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||typeof i<"u"&&i!==t.state.fetchStatus||o&&!o(t))}function Rw(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Lc(t.options.mutationKey)!==Lc(o))return!1}else if(!$c(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function bm(e,t){return((t==null?void 0:t.queryKeyHashFn)||Lc)(e)}function Lc(e){return JSON.stringify(e,(t,n)=>xm(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function $c(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!$c(e[n],t[n])):!1}function Lw(e,t){if(e===t)return e;const n=$w(e)&&$w(t);if(n||xm(e)&&xm(t)){const r=n?e:Object.keys(e),i=r.length,o=n?t:Object.keys(t),s=o.length,a=n?[]:{};let l=0;for(let c=0;c<s;c++){const d=n?c:o[c];!n&&e[d]===void 0&&t[d]===void 0&&r.includes(d)?(a[d]=void 0,l++):(a[d]=Lw(e[d],t[d]),a[d]===e[d]&&e[d]!==void 0&&l++)}return i===s&&l===i?e:a}return t}function ym(e,t){if(e&&!t||t&&!e)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function $w(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function xm(e){if(!Fw(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!Fw(n)||!n.hasOwnProperty("isPrototypeOf"))}function Fw(e){return Object.prototype.toString.call(e)==="[object Object]"}function gN(e){return new Promise(t=>{setTimeout(t,e)})}function wm(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Lw(e,t):t}function mN(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function vN(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var bN=(SA=class extends Rc{constructor(){super();Be(this,ka,void 0);Be(this,gs,void 0);Be(this,Ql,void 0);Ie(this,Ql,t=>{if(!il&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){J(this,gs)||this.setEventListener(J(this,Ql))}onUnsubscribe(){var t;this.hasListeners()||((t=J(this,gs))==null||t.call(this),Ie(this,gs,void 0))}setEventListener(t){var n;Ie(this,Ql,t),(n=J(this,gs))==null||n.call(this),Ie(this,gs,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){J(this,ka)!==t&&(Ie(this,ka,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof J(this,ka)=="boolean"?J(this,ka):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ka=new WeakMap,gs=new WeakMap,Ql=new WeakMap,SA),of=new bN,yN=(CA=class extends Rc{constructor(){super();Be(this,Jl,!0);Be(this,ms,void 0);Be(this,Zl,void 0);Ie(this,Zl,t=>{if(!il&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){J(this,ms)||this.setEventListener(J(this,Zl))}onUnsubscribe(){var t;this.hasListeners()||((t=J(this,ms))==null||t.call(this),Ie(this,ms,void 0))}setEventListener(t){var n;Ie(this,Zl,t),(n=J(this,ms))==null||n.call(this),Ie(this,ms,t(this.setOnline.bind(this)))}setOnline(t){J(this,Jl)!==t&&(Ie(this,Jl,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return J(this,Jl)}},Jl=new WeakMap,ms=new WeakMap,Zl=new WeakMap,CA),sf=new yN;function xN(e){return Math.min(1e3*2**e,3e4)}function af(e){return(e??"online")==="online"?sf.isOnline():!0}var jw=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function _m(e){return e instanceof jw}function zw(e){let t=!1,n=0,r=!1,i,o,s;const a=new Promise((x,w)=>{o=x,s=w}),l=x=>{var w;r||(p(new jw(x)),(w=e.abort)==null||w.call(e))},c=()=>{t=!0},d=()=>{t=!1},f=()=>!of.isFocused()||e.networkMode!=="always"&&!sf.isOnline(),g=x=>{var w;r||(r=!0,(w=e.onSuccess)==null||w.call(e,x),i==null||i(),o(x))},p=x=>{var w;r||(r=!0,(w=e.onError)==null||w.call(e,x),i==null||i(),s(x))},v=()=>new Promise(x=>{var w;i=S=>{const C=r||!f();return C&&x(S),C},(w=e.onPause)==null||w.call(e)}).then(()=>{var x;i=void 0,r||(x=e.onContinue)==null||x.call(e)}),y=()=>{if(r)return;let x;try{x=e.fn()}catch(w){x=Promise.reject(w)}Promise.resolve(x).then(g).catch(w=>{var k;if(r)return;const S=e.retry??(il?0:3),C=e.retryDelay??xN,P=typeof C=="function"?C(n,w):C,O=S===!0||typeof S=="number"&&n<S||typeof S=="function"&&S(n,w);if(t||!O){p(w);return}n++,(k=e.onFail)==null||k.call(e,n,w),gN(P).then(()=>{if(f())return v()}).then(()=>{t?p(w):y()})})};return af(e.networkMode)?y():v().then(y),{promise:a,cancel:l,continue:()=>(i==null?void 0:i())?a:Promise.resolve(),cancelRetry:c,continueRetry:d}}function wN(){let e=[],t=0,n=g=>{g()},r=g=>{g()},i=g=>setTimeout(g,0);const o=g=>{i=g},s=g=>{let p;t++;try{p=g()}finally{t--,t||c()}return p},a=g=>{t?e.push(g):i(()=>{n(g)})},l=g=>(...p)=>{a(()=>{g(...p)})},c=()=>{const g=e;e=[],g.length&&i(()=>{r(()=>{g.forEach(p=>{n(p)})})})};return{batch:s,batchCalls:l,schedule:a,setNotifyFunction:g=>{n=g},setBatchNotifyFunction:g=>{r=g},setScheduler:o}}var In=wN(),Bw=(EA=class{constructor(){Be(this,Ma,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),vm(this.gcTime)&&Ie(this,Ma,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(il?1/0:5*60*1e3))}clearGcTimeout(){J(this,Ma)&&(clearTimeout(J(this,Ma)),Ie(this,Ma,void 0))}},Ma=new WeakMap,EA),_N=(OA=class extends Bw{constructor(t){super();Be(this,nc);Be(this,Ci);Be(this,ec,void 0);Be(this,tc,void 0);Be(this,ii,void 0);Be(this,vs,void 0);Be(this,oi,void 0);Be(this,Dn,void 0);Be(this,hd,void 0);Be(this,Da,void 0);Ie(this,Da,!1),Ie(this,hd,t.defaultOptions),wt(this,nc,Yg).call(this,t.options),Ie(this,Dn,[]),Ie(this,ii,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Ie(this,ec,t.state||SN(this.options)),this.state=J(this,ec),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!J(this,Dn).length&&this.state.fetchStatus==="idle"&&J(this,ii).remove(this)}setData(t,n){const r=wm(this.state.data,t,this.options);return wt(this,Ci,Ro).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){wt(this,Ci,Ro).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r;const n=J(this,vs);return(r=J(this,oi))==null||r.cancel(t),n?n.then(Xr).catch(Xr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(J(this,ec))}isActive(){return J(this,Dn).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||J(this,Dn).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!Iw(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=J(this,Dn).find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=J(this,oi))==null||n.continue()}onOnline(){var n;const t=J(this,Dn).find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=J(this,oi))==null||n.continue()}addObserver(t){J(this,Dn).includes(t)||(J(this,Dn).push(t),this.clearGcTimeout(),J(this,ii).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){J(this,Dn).includes(t)&&(Ie(this,Dn,J(this,Dn).filter(n=>n!==t)),J(this,Dn).length||(J(this,oi)&&(J(this,Da)?J(this,oi).cancel({revert:!0}):J(this,oi).cancelRetry()),this.scheduleGc()),J(this,ii).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return J(this,Dn).length}invalidate(){this.state.isInvalidated||wt(this,Ci,Ro).call(this,{type:"invalidate"})}fetch(t,n){var c,d,f,g;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(J(this,vs))return(c=J(this,oi))==null||c.continueRetry(),J(this,vs)}if(t&&wt(this,nc,Yg).call(this,t),!this.options.queryFn){const p=J(this,Dn).find(v=>v.options.queryFn);p&&wt(this,nc,Yg).call(this,p.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,i={queryKey:this.queryKey,meta:this.meta},o=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(Ie(this,Da,!0),r.signal)})};o(i);const s=()=>this.options.queryFn?(Ie(this,Da,!1),this.options.persister?this.options.persister(this.options.queryFn,i,this):this.options.queryFn(i)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),a={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:s};o(a),(d=this.options.behavior)==null||d.onFetch(a,this),Ie(this,tc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&wt(this,Ci,Ro).call(this,{type:"fetch",meta:(g=a.fetchOptions)==null?void 0:g.meta});const l=p=>{var v,y,x,w;_m(p)&&p.silent||wt(this,Ci,Ro).call(this,{type:"error",error:p}),_m(p)||((y=(v=J(this,ii).config).onError)==null||y.call(v,p,this),(w=(x=J(this,ii).config).onSettled)==null||w.call(x,this.state.data,p,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return Ie(this,oi,zw({fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:p=>{var v,y,x,w;if(typeof p>"u"){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),l(new Error(`${this.queryHash} data is undefined`));return}this.setData(p),(y=(v=J(this,ii).config).onSuccess)==null||y.call(v,p,this),(w=(x=J(this,ii).config).onSettled)==null||w.call(x,p,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:l,onFail:(p,v)=>{wt(this,Ci,Ro).call(this,{type:"failed",failureCount:p,error:v})},onPause:()=>{wt(this,Ci,Ro).call(this,{type:"pause"})},onContinue:()=>{wt(this,Ci,Ro).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode})),Ie(this,vs,J(this,oi).promise),J(this,vs)}},ec=new WeakMap,tc=new WeakMap,ii=new WeakMap,vs=new WeakMap,oi=new WeakMap,Dn=new WeakMap,hd=new WeakMap,Da=new WeakMap,nc=new WeakSet,Yg=function(t){this.options={...J(this,hd),...t},this.updateGcTime(this.options.gcTime)},Ci=new WeakSet,Ro=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:t.meta??null,fetchStatus:af(this.options.networkMode)?"fetching":"paused",...!r.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=t.error;return _m(i)&&i.revert&&J(this,tc)?{...J(this,tc),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),In.batch(()=>{J(this,Dn).forEach(r=>{r.onQueryUpdate()}),J(this,ii).notify({query:this,type:"updated",action:t})})},OA);function SN(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=typeof t<"u",r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var CN=(PA=class extends Rc{constructor(t={}){super();Be(this,Ki,void 0);this.config=t,Ie(this,Ki,new Map)}build(t,n,r){const i=n.queryKey,o=n.queryHash??bm(i,n);let s=this.get(o);return s||(s=new _N({cache:this,queryKey:i,queryHash:o,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(s)),s}add(t){J(this,Ki).has(t.queryHash)||(J(this,Ki).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=J(this,Ki).get(t.queryHash);n&&(t.destroy(),n===t&&J(this,Ki).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){In.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return J(this,Ki).get(t)}getAll(){return[...J(this,Ki).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Nw(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Nw(t,r)):n}notify(t){In.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){In.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){In.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ki=new WeakMap,PA),EN=(kA=class extends Bw{constructor(t){super();Be(this,Qi);Be(this,Xi,void 0);Be(this,pd,void 0);Be(this,Br,void 0);Be(this,rc,void 0);this.mutationId=t.mutationId,Ie(this,pd,t.defaultOptions),Ie(this,Br,t.mutationCache),Ie(this,Xi,[]),this.state=t.state||ON(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...J(this,pd),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){J(this,Xi).includes(t)||(J(this,Xi).push(t),this.clearGcTimeout(),J(this,Br).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Ie(this,Xi,J(this,Xi).filter(n=>n!==t)),this.scheduleGc(),J(this,Br).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){J(this,Xi).length||(this.state.status==="pending"?this.scheduleGc():J(this,Br).remove(this))}continue(){var t;return((t=J(this,rc))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,o,s,a,l,c,d,f,g,p,v,y,x,w,S,C,P,O,k,A;const n=()=>(Ie(this,rc,zw({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(L,F)=>{wt(this,Qi,Ts).call(this,{type:"failed",failureCount:L,error:F})},onPause:()=>{wt(this,Qi,Ts).call(this,{type:"pause"})},onContinue:()=>{wt(this,Qi,Ts).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),J(this,rc).promise),r=this.state.status==="pending";try{if(!r){wt(this,Qi,Ts).call(this,{type:"pending",variables:t}),await((o=(i=J(this,Br).config).onMutate)==null?void 0:o.call(i,t,this));const F=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));F!==this.state.context&&wt(this,Qi,Ts).call(this,{type:"pending",context:F,variables:t})}const L=await n();return await((c=(l=J(this,Br).config).onSuccess)==null?void 0:c.call(l,L,t,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,L,t,this.state.context)),await((p=(g=J(this,Br).config).onSettled)==null?void 0:p.call(g,L,null,this.state.variables,this.state.context,this)),await((y=(v=this.options).onSettled)==null?void 0:y.call(v,L,null,t,this.state.context)),wt(this,Qi,Ts).call(this,{type:"success",data:L}),L}catch(L){try{throw await((w=(x=J(this,Br).config).onError)==null?void 0:w.call(x,L,t,this.state.context,this)),await((C=(S=this.options).onError)==null?void 0:C.call(S,L,t,this.state.context)),await((O=(P=J(this,Br).config).onSettled)==null?void 0:O.call(P,void 0,L,this.state.variables,this.state.context,this)),await((A=(k=this.options).onSettled)==null?void 0:A.call(k,void 0,L,t,this.state.context)),L}finally{wt(this,Qi,Ts).call(this,{type:"error",error:L})}}}},Xi=new WeakMap,pd=new WeakMap,Br=new WeakMap,rc=new WeakMap,Qi=new WeakSet,Ts=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!af(this.options.networkMode),status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),In.batch(()=>{J(this,Xi).forEach(r=>{r.onMutationUpdate(t)}),J(this,Br).notify({mutation:this,type:"updated",action:t})})},kA);function ON(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var PN=(MA=class extends Rc{constructor(t={}){super();Be(this,si,void 0);Be(this,gd,void 0);Be(this,Ta,void 0);this.config=t,Ie(this,si,[]),Ie(this,gd,0)}build(t,n,r){const i=new EN({mutationCache:this,mutationId:++Gg(this,gd)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){J(this,si).push(t),this.notify({type:"added",mutation:t})}remove(t){Ie(this,si,J(this,si).filter(n=>n!==t)),this.notify({type:"removed",mutation:t})}clear(){In.batch(()=>{J(this,si).forEach(t=>{this.remove(t)})})}getAll(){return J(this,si)}find(t){const n={exact:!0,...t};return J(this,si).find(r=>Rw(n,r))}findAll(t={}){return J(this,si).filter(n=>Rw(t,n))}notify(t){In.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){return Ie(this,Ta,(J(this,Ta)??Promise.resolve()).then(()=>{const t=J(this,si).filter(n=>n.state.isPaused);return In.batch(()=>t.reduce((n,r)=>n.then(()=>r.continue().catch(Xr)),Promise.resolve()))}).then(()=>{Ie(this,Ta,void 0)})),J(this,Ta)}},si=new WeakMap,gd=new WeakMap,Ta=new WeakMap,MA);function kN(e){return{onFetch:(t,n)=>{const r=async()=>{var v,y,x,w,S;const i=t.options,o=(x=(y=(v=t.fetchOptions)==null?void 0:v.meta)==null?void 0:y.fetchMore)==null?void 0:x.direction,s=((w=t.state.data)==null?void 0:w.pages)||[],a=((S=t.state.data)==null?void 0:S.pageParams)||[],l={pages:[],pageParams:[]};let c=!1;const d=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(t.signal.aborted?c=!0:t.signal.addEventListener("abort",()=>{c=!0}),t.signal)})},f=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),g=async(C,P,O)=>{if(c)return Promise.reject();if(P==null&&C.pages.length)return Promise.resolve(C);const k={queryKey:t.queryKey,pageParam:P,direction:O?"backward":"forward",meta:t.options.meta};d(k);const A=await f(k),{maxPages:L}=t.options,F=O?vN:mN;return{pages:F(C.pages,A,L),pageParams:F(C.pageParams,P,L)}};let p;if(o&&s.length){const C=o==="backward",P=C?MN:Vw,O={pages:s,pageParams:a},k=P(i,O);p=await g(O,k,C)}else{p=await g(l,a[0]??i.initialPageParam);const C=e??s.length;for(let P=1;P<C;P++){const O=Vw(i,p);p=await g(p,O)}}return p};t.options.persister?t.fetchFn=()=>{var i,o;return(o=(i=t.options).persister)==null?void 0:o.call(i,r,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=r}}}function Vw(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function MN(e,{pages:t,pageParams:n}){var r;return(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n)}var DN=(DA=class{constructor(e={}){Be(this,Cn,void 0);Be(this,bs,void 0);Be(this,ys,void 0);Be(this,ic,void 0);Be(this,oc,void 0);Be(this,xs,void 0);Be(this,sc,void 0);Be(this,ac,void 0);Ie(this,Cn,e.queryCache||new CN),Ie(this,bs,e.mutationCache||new PN),Ie(this,ys,e.defaultOptions||{}),Ie(this,ic,new Map),Ie(this,oc,new Map),Ie(this,xs,0)}mount(){Gg(this,xs)._++,J(this,xs)===1&&(Ie(this,sc,of.subscribe(()=>{of.isFocused()&&(this.resumePausedMutations(),J(this,Cn).onFocus())})),Ie(this,ac,sf.subscribe(()=>{sf.isOnline()&&(this.resumePausedMutations(),J(this,Cn).onOnline())})))}unmount(){var e,t;Gg(this,xs)._--,J(this,xs)===0&&((e=J(this,sc))==null||e.call(this),Ie(this,sc,void 0),(t=J(this,ac))==null||t.call(this),Ie(this,ac,void 0))}isFetching(e){return J(this,Cn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return J(this,bs).findAll({...e,status:"pending"}).length}getQueryData(e){var t;return(t=J(this,Cn).find({queryKey:e}))==null?void 0:t.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);return t!==void 0?Promise.resolve(t):this.fetchQuery(e)}getQueriesData(e){return this.getQueryCache().findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=J(this,Cn).find({queryKey:e}),i=r==null?void 0:r.state.data,o=pN(t,i);if(typeof o>"u")return;const s=this.defaultQueryOptions({queryKey:e});return J(this,Cn).build(this,s).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return In.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var t;return(t=J(this,Cn).find({queryKey:e}))==null?void 0:t.state}removeQueries(e){const t=J(this,Cn);In.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=J(this,Cn),r={type:"active",...e};return In.batch(()=>(n.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=In.batch(()=>J(this,Cn).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(Xr).catch(Xr)}invalidateQueries(e={},t={}){return In.batch(()=>{if(J(this,Cn).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=In.batch(()=>J(this,Cn).findAll(e).filter(i=>!i.isDisabled()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(Xr)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(Xr)}fetchQuery(e){const t=this.defaultQueryOptions(e);typeof t.retry>"u"&&(t.retry=!1);const n=J(this,Cn).build(this,t);return n.isStaleByTime(t.staleTime)?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Xr).catch(Xr)}fetchInfiniteQuery(e){return e.behavior=kN(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Xr).catch(Xr)}resumePausedMutations(){return J(this,bs).resumePausedMutations()}getQueryCache(){return J(this,Cn)}getMutationCache(){return J(this,bs)}getDefaultOptions(){return J(this,ys)}setDefaultOptions(e){Ie(this,ys,e)}setQueryDefaults(e,t){J(this,ic).set(Lc(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...J(this,ic).values()];let n={};return t.forEach(r=>{$c(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){J(this,oc).set(Lc(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...J(this,oc).values()];let n={};return t.forEach(r=>{$c(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const t={...J(this,ys).queries,...(e==null?void 0:e.queryKey)&&this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=bm(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.throwOnError>"u"&&(t.throwOnError=!!t.suspense),typeof t.networkMode>"u"&&t.persister&&(t.networkMode="offlineFirst"),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...J(this,ys).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){J(this,Cn).clear(),J(this,bs).clear()}},Cn=new WeakMap,bs=new WeakMap,ys=new WeakMap,ic=new WeakMap,oc=new WeakMap,xs=new WeakMap,sc=new WeakMap,ac=new WeakMap,DA),TN=(TA=class extends Rc{constructor(t,n){super();Be(this,Ra);Be(this,bd);Be(this,yd);Be(this,xd);Be(this,wd);Be(this,_d);Be(this,Sd);Be(this,Cd);Be(this,og);Be(this,mr,void 0);Be(this,en,void 0);Be(this,md,void 0);Be(this,tr,void 0);Be(this,Aa,void 0);Be(this,lc,void 0);Be(this,Ji,void 0);Be(this,vd,void 0);Be(this,cc,void 0);Be(this,uc,void 0);Be(this,Ia,void 0);Be(this,Na,void 0);Be(this,ws,void 0);Be(this,dc,new Set);this.options=n,Ie(this,mr,t),Ie(this,Ji,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(J(this,en).addObserver(this),Hw(J(this,en),this.options)?wt(this,Ra,Ud).call(this):this.updateResult(),wt(this,wd,W1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Sm(J(this,en),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Sm(J(this,en),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,wt(this,_d,q1).call(this),wt(this,Sd,U1).call(this),J(this,en).removeObserver(this)}setOptions(t,n){const r=this.options,i=J(this,en);if(this.options=J(this,mr).defaultQueryOptions(t),ym(r,this.options)||J(this,mr).getQueryCache().notify({type:"observerOptionsUpdated",query:J(this,en),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=r.queryKey),wt(this,Cd,G1).call(this);const o=this.hasListeners();o&&Ww(J(this,en),i,this.options,r)&&wt(this,Ra,Ud).call(this),this.updateResult(n),o&&(J(this,en)!==i||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&wt(this,bd,B1).call(this);const s=wt(this,yd,V1).call(this);o&&(J(this,en)!==i||this.options.enabled!==r.enabled||s!==J(this,ws))&&wt(this,xd,H1).call(this,s)}getOptimisticResult(t){const n=J(this,mr).getQueryCache().build(J(this,mr),t),r=this.createResult(n,t);return IN(this,r)&&(Ie(this,tr,r),Ie(this,lc,this.options),Ie(this,Aa,J(this,en).state)),r}getCurrentResult(){return J(this,tr)}trackResult(t){const n={};return Object.keys(t).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(J(this,dc).add(r),t[r])})}),n}getCurrentQuery(){return J(this,en)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=J(this,mr).defaultQueryOptions(t),r=J(this,mr).getQueryCache().build(J(this,mr),n);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,n))}fetch(t){return wt(this,Ra,Ud).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),J(this,tr)))}createResult(t,n){var k;const r=J(this,en),i=this.options,o=J(this,tr),s=J(this,Aa),a=J(this,lc),c=t!==r?t.state:J(this,md),{state:d}=t;let{error:f,errorUpdatedAt:g,fetchStatus:p,status:v}=d,y=!1,x;if(n._optimisticResults){const A=this.hasListeners(),L=!A&&Hw(t,n),F=A&&Ww(t,r,n,i);(L||F)&&(p=af(t.options.networkMode)?"fetching":"paused",d.dataUpdatedAt||(v="pending")),n._optimisticResults==="isRestoring"&&(p="idle")}if(n.select&&typeof d.data<"u")if(o&&d.data===(s==null?void 0:s.data)&&n.select===J(this,vd))x=J(this,cc);else try{Ie(this,vd,n.select),x=n.select(d.data),x=wm(o==null?void 0:o.data,x,n),Ie(this,cc,x),Ie(this,Ji,null)}catch(A){Ie(this,Ji,A)}else x=d.data;if(typeof n.placeholderData<"u"&&typeof x>"u"&&v==="pending"){let A;if(o!=null&&o.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))A=o.data;else if(A=typeof n.placeholderData=="function"?n.placeholderData((k=J(this,uc))==null?void 0:k.state.data,J(this,uc)):n.placeholderData,n.select&&typeof A<"u")try{A=n.select(A),Ie(this,Ji,null)}catch(L){Ie(this,Ji,L)}typeof A<"u"&&(v="success",x=wm(o==null?void 0:o.data,A,n),y=!0)}J(this,Ji)&&(f=J(this,Ji),x=J(this,cc),g=Date.now(),v="error");const w=p==="fetching",S=v==="pending",C=v==="error",P=S&&w;return{status:v,fetchStatus:p,isPending:S,isSuccess:v==="success",isError:C,isInitialLoading:P,isLoading:P,data:x,dataUpdatedAt:d.dataUpdatedAt,error:f,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:w,isRefetching:w&&!S,isLoadingError:C&&d.dataUpdatedAt===0,isPaused:p==="paused",isPlaceholderData:y,isRefetchError:C&&d.dataUpdatedAt!==0,isStale:Cm(t,n),refetch:this.refetch}}updateResult(t){const n=J(this,tr),r=this.createResult(J(this,en),this.options);if(Ie(this,Aa,J(this,en).state),Ie(this,lc,this.options),J(this,Aa).data!==void 0&&Ie(this,uc,J(this,en)),ym(r,n))return;Ie(this,tr,r);const i={},o=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!J(this,dc).size)return!0;const l=new Set(a??J(this,dc));return this.options.throwOnError&&l.add("error"),Object.keys(J(this,tr)).some(c=>{const d=c;return J(this,tr)[d]!==n[d]&&l.has(d)})};(t==null?void 0:t.listeners)!==!1&&o()&&(i.listeners=!0),wt(this,og,r3).call(this,{...i,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&wt(this,wd,W1).call(this)}},mr=new WeakMap,en=new WeakMap,md=new WeakMap,tr=new WeakMap,Aa=new WeakMap,lc=new WeakMap,Ji=new WeakMap,vd=new WeakMap,cc=new WeakMap,uc=new WeakMap,Ia=new WeakMap,Na=new WeakMap,ws=new WeakMap,dc=new WeakMap,Ra=new WeakSet,Ud=function(t){wt(this,Cd,G1).call(this);let n=J(this,en).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Xr)),n},bd=new WeakSet,B1=function(){if(wt(this,_d,q1).call(this),il||J(this,tr).isStale||!vm(this.options.staleTime))return;const n=Iw(J(this,tr).dataUpdatedAt,this.options.staleTime)+1;Ie(this,Ia,setTimeout(()=>{J(this,tr).isStale||this.updateResult()},n))},yd=new WeakSet,V1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(J(this,en)):this.options.refetchInterval)??!1},xd=new WeakSet,H1=function(t){wt(this,Sd,U1).call(this),Ie(this,ws,t),!(il||this.options.enabled===!1||!vm(J(this,ws))||J(this,ws)===0)&&Ie(this,Na,setInterval(()=>{(this.options.refetchIntervalInBackground||of.isFocused())&&wt(this,Ra,Ud).call(this)},J(this,ws)))},wd=new WeakSet,W1=function(){wt(this,bd,B1).call(this),wt(this,xd,H1).call(this,wt(this,yd,V1).call(this))},_d=new WeakSet,q1=function(){J(this,Ia)&&(clearTimeout(J(this,Ia)),Ie(this,Ia,void 0))},Sd=new WeakSet,U1=function(){J(this,Na)&&(clearInterval(J(this,Na)),Ie(this,Na,void 0))},Cd=new WeakSet,G1=function(){const t=J(this,mr).getQueryCache().build(J(this,mr),this.options);if(t===J(this,en))return;const n=J(this,en);Ie(this,en,t),Ie(this,md,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},og=new WeakSet,r3=function(t){In.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(J(this,tr))}),J(this,mr).getQueryCache().notify({query:J(this,en),type:"observerResultsUpdated"})})},TA);function AN(e,t){return t.enabled!==!1&&!e.state.dataUpdatedAt&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Hw(e,t){return AN(e,t)||e.state.dataUpdatedAt>0&&Sm(e,t,t.refetchOnMount)}function Sm(e,t,n){if(t.enabled!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Cm(e,t)}return!1}function Ww(e,t,n,r){return n.enabled!==!1&&(e!==t||r.enabled===!1)&&(!n.suspense||e.state.status!=="error")&&Cm(e,n)}function Cm(e,t){return e.isStaleByTime(t.staleTime)}function IN(e,t){return!ym(e.getCurrentResult(),t)}var qw=de.createContext(void 0),NN=e=>{const t=de.useContext(qw);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},RN=({client:e,children:t})=>(de.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),de.createElement(qw.Provider,{value:e},t)),Uw=de.createContext(!1),LN=()=>de.useContext(Uw);Uw.Provider;function $N(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var FN=de.createContext($N()),jN=()=>de.useContext(FN);function zN(e,t){return typeof e=="function"?e(...t):!!e}var BN=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},VN=e=>{de.useEffect(()=>{e.clearReset()},[e])},HN=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&zN(n,[e.error,r]),WN=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},qN=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,UN=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function GN(e,t,n){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=NN(n),i=LN(),o=jN(),s=r.defaultQueryOptions(e);s._optimisticResults=i?"isRestoring":"optimistic",WN(s),BN(s,o),VN(o);const[a]=de.useState(()=>new t(r,s)),l=a.getOptimisticResult(s);if(de.useSyncExternalStore(de.useCallback(c=>{const d=i?()=>{}:a.subscribe(In.batchCalls(c));return a.updateResult(),d},[a,i]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),de.useEffect(()=>{a.setOptions(s,{listeners:!1})},[s,a]),qN(s,l))throw UN(s,a,o);if(HN({result:l,errorResetBoundary:o,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw l.error;return s.notifyOnChangeProps?l:a.trackResult(l)}function Cr(e,t){return GN(e,TN,t)}var lf={exports:{}};/**
59
+ */var uw;function U3(){if(uw)return rm;uw=1;var e=m,t=lw();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return rm.useSyncExternalStoreWithSelector=function(c,d,f,g,p){var v=o(null);if(v.current===null){var y={hasValue:!1,value:null};v.current=y}else y=v.current;v=a(function(){function w(k){if(!S){if(S=!0,C=k,k=g(k),p!==void 0&&y.hasValue){var A=y.value;if(p(A,k))return P=A}return P=k}if(A=P,r(C,k))return A;var L=g(k);return p!==void 0&&p(A,L)?A:(C=k,P=L)}var S=!1,C,P,O=f===void 0?null:f;return[function(){return w(d())},O===null?void 0:function(){return w(O())}]},[d,f,g,p]);var x=i(c,v[0],v[1]);return s(function(){y.hasValue=!0,y.value=x},[x]),l(x),x},rm}process.env.NODE_ENV==="production"?Zg.exports=U3():Zg.exports=q3();var G3=Zg.exports;const Y3=Pc(G3);var dw={VITE_SEMAPHOR_API:"https://semaphor.cloud/api/v1",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useDebugValue:K3}=m,{useSyncExternalStoreWithSelector:X3}=Y3;let fw=!1;function Q3(e,t=e.getState,n){(dw?"production":void 0)!=="production"&&n&&!fw&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),fw=!0);const r=X3(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return K3(r),r}const hw=e=>{(dw?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?V3(e):e,n=(r,i)=>Q3(t,r,i);return Object.assign(n,t),n},pw=e=>e?hw(e):hw;var gw=Symbol.for("immer-nothing"),mw=Symbol.for("immer-draftable"),_r=Symbol.for("immer-state"),J3=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function or(e,...t){if(process.env.NODE_ENV!=="production"){const n=J3[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var nl=Object.getPrototypeOf;function rl(e){return!!e&&!!e[_r]}function Rs(e){var t;return e?vw(e)||Array.isArray(e)||!!e[mw]||!!((t=e.constructor)!=null&&t[mw])||Qd(e)||Jd(e):!1}var Z3=Object.prototype.constructor.toString();function vw(e){if(!e||typeof e!="object")return!1;const t=nl(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Z3}function Ac(e,t){Xd(e)===0?Object.entries(e).forEach(([n,r])=>{t(n,r,e)}):e.forEach((n,r)=>t(r,n,e))}function Xd(e){const t=e[_r];return t?t.type_:Array.isArray(e)?1:Qd(e)?2:Jd(e)?3:0}function im(e,t){return Xd(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function bw(e,t,n){const r=Xd(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function eN(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Qd(e){return e instanceof Map}function Jd(e){return e instanceof Set}function Ls(e){return e.copy_||e.base_}function om(e,t){if(Qd(e))return new Map(e);if(Jd(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&vw(e))return nl(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[_r];let r=Reflect.ownKeys(n);for(let i=0;i<r.length;i++){const o=r[i],s=n[o];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[o]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[o]})}return Object.create(nl(e),n)}function sm(e,t=!1){return Zd(e)||rl(e)||!Rs(e)||(Xd(e)>1&&(e.set=e.add=e.clear=e.delete=tN),Object.freeze(e),t&&Ac(e,(n,r)=>sm(r,!0))),e}function tN(){or(2)}function Zd(e){return Object.isFrozen(e)}var nN={};function $s(e){const t=nN[e];return t||or(0,e),t}var Ic;function yw(){return Ic}function rN(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function xw(e,t){t&&($s("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function am(e){lm(e),e.drafts_.forEach(iN),e.drafts_=null}function lm(e){e===Ic&&(Ic=e.parent_)}function ww(e){return Ic=rN(Ic,e)}function iN(e){const t=e[_r];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function _w(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[_r].modified_&&(am(t),or(4)),Rs(e)&&(e=ef(t,e),t.parent_||tf(t,e)),t.patches_&&$s("Patches").generateReplacementPatches_(n[_r].base_,e,t.patches_,t.inversePatches_)):e=ef(t,n,[]),am(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==gw?e:void 0}function ef(e,t,n){if(Zd(t))return t;const r=t[_r];if(!r)return Ac(t,(i,o)=>Sw(e,r,t,i,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return tf(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let o=i,s=!1;r.type_===3&&(o=new Set(i),i.clear(),s=!0),Ac(o,(a,l)=>Sw(e,r,i,a,l,n,s)),tf(e,i,!1),n&&e.patches_&&$s("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Sw(e,t,n,r,i,o,s){if(process.env.NODE_ENV!=="production"&&i===n&&or(5),rl(i)){const a=o&&t&&t.type_!==3&&!im(t.assigned_,r)?o.concat(r):void 0,l=ef(e,i,a);if(bw(n,r,l),rl(l))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(Rs(i)&&!Zd(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ef(e,i),(!t||!t.scope_.parent_)&&tf(e,i)}}function tf(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&sm(t,n)}function oN(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:yw(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=cm;n&&(i=[r],o=Nc);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var cm={get(e,t){if(t===_r)return e;const n=Ls(e);if(!im(n,t))return sN(e,n,t);const r=n[t];return e.finalized_||!Rs(r)?r:r===um(e.base_,t)?(fm(e),e.copy_[t]=hm(r,e)):r},has(e,t){return t in Ls(e)},ownKeys(e){return Reflect.ownKeys(Ls(e))},set(e,t,n){const r=Cw(Ls(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=um(Ls(e),t),o=i==null?void 0:i[_r];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(eN(n,i)&&(n!==void 0||im(e.base_,t)))return!0;fm(e),dm(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return um(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,fm(e),dm(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Ls(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){or(11)},getPrototypeOf(e){return nl(e.base_)},setPrototypeOf(){or(12)}},Nc={};Ac(cm,(e,t)=>{Nc[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Nc.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&or(13),Nc.set.call(this,e,t,void 0)},Nc.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&or(14),cm.set.call(this,e[0],t,n,e[0])};function um(e,t){const n=e[_r];return(n?Ls(n):e)[t]}function sN(e,t,n){var i;const r=Cw(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Cw(e,t){if(!(t in e))return;let n=nl(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=nl(n)}}function dm(e){e.modified_||(e.modified_=!0,e.parent_&&dm(e.parent_))}function fm(e){e.copy_||(e.copy_=om(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var aN=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const o=n;n=t;const s=this;return function(l=o,...c){return s.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&or(6),r!==void 0&&typeof r!="function"&&or(7);let i;if(Rs(t)){const o=ww(this),s=hm(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?am(o):lm(o)}return xw(o,r),_w(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===gw&&(i=void 0),this.autoFreeze_&&sm(i,!0),r){const o=[],s=[];$s("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}else or(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,l=>t(l,...a));let r,i;return[this.produce(t,n,(s,a)=>{r=s,i=a}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Rs(e)||or(8),rl(e)&&(e=lN(e));const t=ww(this),n=hm(e,void 0);return n[_r].isManual_=!0,lm(t),n}finishDraft(e,t){const n=e&&e[_r];(!n||!n.isManual_)&&or(9);const{scope_:r}=n;return xw(r,t),_w(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=$s("Patches").applyPatches_;return rl(e)?r(e,t):this.produce(e,i=>r(i,t))}};function hm(e,t){const n=Qd(e)?$s("MapSet").proxyMap_(e,t):Jd(e)?$s("MapSet").proxySet_(e,t):oN(e,t);return(t?t.scope_:yw()).drafts_.push(n),n}function lN(e){return rl(e)||or(10,e),Ew(e)}function Ew(e){if(!Rs(e)||Zd(e))return e;const t=e[_r];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=om(e,t.scope_.immer_.useStrictShallowCopy_)}else n=om(e,!0);return Ac(n,(r,i)=>{bw(n,r,Ew(i))}),t&&(t.finalized_=!1),n}var Sr=new aN,cN=Sr.produce;Sr.produceWithPatches.bind(Sr),Sr.setAutoFreeze.bind(Sr),Sr.setUseStrictShallowCopy.bind(Sr),Sr.applyPatches.bind(Sr),Sr.createDraft.bind(Sr),Sr.finishDraft.bind(Sr);const Ow=e=>(t,n,r)=>(r.setState=(i,o,...s)=>{const a=typeof i=="function"?cN(i):i;return t(a,o,...s)},e(r.setState,n,r));var nf,rf=Mt;if(process.env.NODE_ENV==="production")nf=rf.createRoot,rf.hydrateRoot;else{var Pw=rf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;nf=function(e,t){Pw.usingClientEntryPoint=!0;try{return rf.createRoot(e,t)}finally{Pw.usingClientEntryPoint=!1}}}function kw(e,t,n){const r={count:0},i=a=>{const l=m.useRef(r.count);return m.useEffect(()=>{l.current+=1,l.current===r.count+1&&(l.current-=1,t.setState(a))}),null};if(i.displayName=`((${e})) devtool`,typeof document>"u")return;if(!n){let a=document.getElementById(`simple-zustand-devtools-${e}`);a||(a=document.createElement("div"),a.id=`simple-zustand-devtools-${e}`),document.body.appendChild(a),n=a}const o=nf(n),s=a=>{a&&(o.render(m.createElement(i,Object.assign({},a))),r.count+=1)};s(t.getState()),t.subscribe(s)}var Mw={},Dw={},pm={exports:{}},Kt=String,Tw=function(){return{isColorSupported:!1,reset:Kt,bold:Kt,dim:Kt,italic:Kt,underline:Kt,inverse:Kt,hidden:Kt,strikethrough:Kt,black:Kt,red:Kt,green:Kt,yellow:Kt,blue:Kt,magenta:Kt,cyan:Kt,white:Kt,gray:Kt,bgBlack:Kt,bgRed:Kt,bgGreen:Kt,bgYellow:Kt,bgBlue:Kt,bgMagenta:Kt,bgCyan:Kt,bgWhite:Kt}};pm.exports=Tw(),pm.exports.createColors=Tw;var uN=pm.exports;(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(l,c){for(var d in c)Object.defineProperty(l,d,{enumerable:!0,get:c[d]})}t(e,{dim:function(){return s},default:function(){return a}});const n=r(uN);function r(l){return l&&l.__esModule?l:{default:l}}let i=new Set;function o(l,c,d){typeof process<"u"&&process.env.JEST_WORKER_ID||d&&i.has(d)||(d&&i.add(d),console.warn(""),c.forEach(f=>console.warn(l,"-",f)))}function s(l){return n.default.dim(l)}const a={info(l,c){o(n.default.bold(n.default.cyan("info")),...Array.isArray(l)?[l]:[c,l])},warn(l,c){o(n.default.bold(n.default.yellow("warn")),...Array.isArray(l)?[l]:[c,l])},risk(l,c){o(n.default.bold(n.default.magenta("risk")),...Array.isArray(l)?[l]:[c,l])}}})(Dw),function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return i}});const t=n(Dw);function n(o){return o&&o.__esModule?o:{default:o}}function r({version:o,from:s,to:a}){t.default.warn(`${s}-color-renamed`,[`As of Tailwind CSS ${o}, \`${s}\` has been renamed to \`${a}\`.`,"Update your configuration file to silence this warning."])}const i={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"},get lightBlue(){return r({version:"v2.2",from:"lightBlue",to:"sky"}),this.sky},get warmGray(){return r({version:"v3.0",from:"warmGray",to:"stone"}),this.stone},get trueGray(){return r({version:"v3.0",from:"trueGray",to:"neutral"}),this.neutral},get coolGray(){return r({version:"v3.0",from:"coolGray",to:"gray"}),this.gray},get blueGray(){return r({version:"v3.0",from:"blueGray",to:"slate"}),this.slate}}}(Mw);let gm=Mw;var dN=(gm.__esModule?gm:{default:gm}).default;const fn=Pc(dN),mm={default:{dashboardPanel:"",dashboardTabsContainer:"",gridLayout:{className:""},chart:{font:{family:"Open Sans, sans-serif"},dataset:{backgroundColor:["#8a8ed1",fn.red[400],fn.amber[400],fn.orange[400],fn.rose[400]],borderColor:[fn.indigo[400],fn.red[400],fn.amber[400],fn.orange[400],fn.rose[400]]},options:{plugins:{datalabels:{display:!1,color:fN},title:{display:!0},tooltip:{backgroundColor:"#fff",bodyColor:"#000",borderWidth:.25,titleColor:"#000",borderColor:"rgb(128,131,139)",cornerRadius:2,boxPadding:4},legend:{position:"top",align:"center",maxHeight:0}},scales:{y:{grid:{display:!0},title:{display:!0,text:""},beginAtZero:!0,ticks:{precision:0}},x:{grid:{display:!0},title:{display:!0}}},layout:{padding:{top:-40}},borderRadius:1,responsive:!0,maintainAspectRatio:!1}}},dark:{chart:{dataset:{backgroundColor:[fn.teal[100],fn.purple[100],fn.amber[100],fn.orange[100],fn.rose[100]],borderColor:[fn.teal[400],fn.purple[400],fn.amber[400],fn.orange[300],fn.rose[400]]},options:{plugins:{tooltip:{backgroundColor:"#000",bodyColor:"#fff",borderWidth:.25,titleColor:"#fff",borderColor:"rgb(128,131,139)",cornerRadius:2,boxPadding:4}},datalabels:{display:!1},scales:{x:{grid:{display:!0,color:fn.slate[800]}},y:{grid:{display:!0,color:fn.slate[800]}}}}}}};function fN(e){var r,i,o,s,a,l;const t=(a=(s=(o=(i=(r=e==null?void 0:e.chart)==null?void 0:r.config)==null?void 0:i._config)==null?void 0:o.options)==null?void 0:s.plugins)==null?void 0:a.datalabels;let n=(l=e==null?void 0:e.dataset)==null?void 0:l.backgroundColor;return(t==null?void 0:t.align)==="end"&&(t==null?void 0:t.anchor)==="end"&&(n=Aw()),(t==null?void 0:t.align)==="start"&&(t==null?void 0:t.anchor)==="start"&&(n=Aw()),hN(n)}function Aw(){return ge.getState().theme==="dark"?"#000000":"#FFFFFF"}function hN(e){let t=0,n=0,r=0,i=0;const o=d=>{const f=d.replace("#",""),g=parseInt(f.substring(0,2),16),p=parseInt(f.substring(2,4),16),v=parseInt(f.substring(4,6),16);t+=g,n+=p,r+=v,i++};Array.isArray(e)?e.forEach(d=>{o(d)}):o(e);const s=t/i,a=n/i,l=r/i;return(s*299+a*587+l*114)/1e3>=180?"black":"white"}const ge=pw()(Ow((e,t)=>({dashboard:{id:"",style:mm},showContext:!1,selectedSheetId:null,selectedCardId:null,selectedCard:null,showFilters:!1,isDashboardEditing:!1,isVisualEditing:!1,showDashboardJSON:!1,isEditorSaveEvent:!1,actions:{setAuthToken:n=>{e(()=>({authToken:n}))},setThemeStyle:n=>{e(()=>({themeStyle:n}))},setIsEditorSaveEvent:n=>{e(()=>({isEditorSaveEvent:n}))},setDashboard:n=>e({dashboard:n}),setBookmarkKey:n=>{e(()=>({bookmarkKey:n}))},setDashboardTheme:n=>{e(r=>{r.theme=n})},setDashboardTitle:n=>{e(r=>{r.dashboard&&(r.dashboard.title=n)})},setDashboardDescription:n=>{e(r=>{r.dashboard&&(r.dashboard.description=n)})},setSheets:n=>{e(r=>{r.dashboard&&(r.dashboard.sheets=n)})},setSheetTitle:(n,r)=>{e(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);o&&(o.title=r)})},setSheetDescription:(n,r)=>{e(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);o&&(o.description=r)})},setCards:(n,r)=>{e(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);o&&(o.cards=r)})},setCardTitle:(n,r,i)=>{e(o=>{var a,l,c,d;const s=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n);if(s){const f=(c=s.cards)==null?void 0:c.find(g=>g.id===r);f&&(f.title=i,(d=o.onUpdateCard)==null||d.call(o,f,n))}})},setCardSql:(n,r,i)=>{e(o=>{var a,l,c,d;const s=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n);if(s){const f=(c=s.cards)==null?void 0:c.find(g=>g.id===r);f&&(f.sql=i,(d=o.onUpdateCard)==null||d.call(o,f,n))}})},setCardData:(n,r,i)=>{e(o=>{var a,l,c;const s=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(d=>d.id===n);if(s){const d=(c=s.cards)==null?void 0:c.find(f=>f.id===r);d&&(d.data=i)}})},setCardDescription:(n,r,i)=>{e(o=>{var a,l,c,d;const s=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n);if(s){const f=(c=s.cards)==null?void 0:c.find(g=>g.id===r);f&&(f.description=i,(d=o.onUpdateCard)==null||d.call(o,f,n))}})},setSheetLayout:(n,r)=>{e(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);o&&(o.layout=r)})},setShowContext:n=>{e(()=>({showContext:n}))},setShowFilters:n=>{e(()=>({showFilters:n}))},setFilterValues:n=>{e(()=>({filterValues:n}))},addOrUpdateFilterValue:n=>{e(r=>{if(r.filterValues){const i=r.filterValues.findIndex(o=>o.filterId===n.filterId);i>-1?r.filterValues.splice(i,1,n):r.filterValues.push(n)}else r.filterValues=[n]})},removeFilterValue:n=>{e(r=>{if(r.filterValues){const i=r.filterValues.findIndex(o=>o.filterId===n);i>-1&&r.filterValues.splice(i,1)}})},addFilter:n=>{e(r=>{var i;r.dashboard.filters?(i=r.dashboard.filters)==null||i.push(n):r.dashboard.filters=[n]})},removeFilter:n=>{e(r=>{var i,o;if(r.dashboard.filters){const s=(i=r.dashboard.filters)==null?void 0:i.findIndex(a=>a.id===n);console.log("index",s),s>-1&&((o=r.dashboard.filters)==null||o.splice(s,1))}})},updateFilter:n=>{e(r=>{var i,o;if(r.dashboard.filters){const s=(i=r.dashboard.filters)==null?void 0:i.findIndex(a=>a.id===n.id);s>-1&&((o=r.dashboard.filters)==null||o.splice(s,1,n))}})},setIsDashboardEditing:n=>{e(()=>({isDashboardEditing:n}))},setShowDashboardJSON:n=>{e(()=>({showDashboardJSON:n}))},setIsVisualEditing:n=>{e(()=>({isVisualEditing:n}))},addCard:(n,r)=>{e(i=>{var s,a,l,c,d;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(f=>f.id===n);if(o){(l=o.cards)==null||l.push(r);const f={i:r.id,x:0,y:1/0,w:20,h:7,minW:10};(c=o.layout)==null||c.push(f),(d=i.onAddCard)==null||d.call(i,r,n)}})},updateCard:(n,r)=>{e(i=>{var a,l,c,d,f;const o=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(g=>g.id===n),s=(c=o==null?void 0:o.cards)==null?void 0:c.findIndex(g=>g.id===r.id);o&&((d=o.cards)==null||d.splice(s,1,r),(f=i.onUpdateCard)==null||f.call(i,r,n))})},removeCard:(n,r)=>{e(i=>{var a,l,c,d,f,g;const o=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(p=>p.id===n),s=(c=o==null?void 0:o.cards)==null?void 0:c.findIndex(p=>p.id===r.id);o&&((d=o.cards)==null||d.splice(s,1),(f=o.layout)==null||f.splice(s,1),(g=i.onRemoveCard)==null||g.call(i,r,n))})},setStyle:n=>{e(r=>{r.dashboard&&(r.dashboard.style=n)})},setSelectedCardId:(n,r)=>{e(i=>{var s,a,l;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===n);o&&(((l=o.cards)==null?void 0:l.find(d=>d.id===r))?i.selectedCardId=r:i.selectedCardId=null)})},setSelectedCard:n=>{e(r=>{r.selectedCard=n})},setSelectedSheetId:n=>{e(r=>{var o,s;((s=(o=r.dashboard)==null?void 0:o.sheets)==null?void 0:s.find(a=>a.id===n))&&(r.selectedSheetId=n)})},setOnSaveFunction:n=>{e(()=>({onSaveFunction:n}))},setOnAddCard:n=>{e(()=>({onAddCard:n}))},setOnUpdateCard:n=>{e(()=>({onUpdateCard:n}))},setOnRemoveCard:n=>{e(()=>({onRemoveCard:n}))},setOnEvent:n=>{e(()=>({onEvent:n}))},getDashboard:()=>t().dashboard,getSelectedSheet:()=>{var n,r;return(r=(n=t().dashboard)==null?void 0:n.sheets)==null?void 0:r.find(i=>i.id===t().selectedSheetId)},getSelectedCard:()=>{var r,i,o;const n=(i=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:i.find(s=>s.id===t().selectedSheetId);return(o=n==null?void 0:n.cards)==null?void 0:o.find(s=>s.id===t().selectedCardId)},getSelectedSheetCards:()=>{var r,i;const n=(i=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:i.find(o=>o.id===t().selectedSheetId);return n==null?void 0:n.cards},getSelectedSheetLayout:()=>{var r,i;const n=(i=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:i.find(o=>o.id===t().selectedSheetId);return n==null?void 0:n.layout},getStyle:()=>{var n;return(n=t().dashboard)==null?void 0:n.style}}})));process.env.NODE_ENV==="development"&&kw("DashboardStore",ge);var Rc=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},il=typeof window>"u"||"Deno"in window;function Xr(){}function pN(e,t){return typeof e=="function"?e(t):e}function vm(e){return typeof e=="number"&&e>=0&&e!==1/0}function Iw(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Nw(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==bm(s,t.options))return!1}else if(!$c(t.queryKey,s))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||typeof i<"u"&&i!==t.state.fetchStatus||o&&!o(t))}function Rw(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Lc(t.options.mutationKey)!==Lc(o))return!1}else if(!$c(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function bm(e,t){return((t==null?void 0:t.queryKeyHashFn)||Lc)(e)}function Lc(e){return JSON.stringify(e,(t,n)=>xm(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function $c(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!$c(e[n],t[n])):!1}function Lw(e,t){if(e===t)return e;const n=$w(e)&&$w(t);if(n||xm(e)&&xm(t)){const r=n?e:Object.keys(e),i=r.length,o=n?t:Object.keys(t),s=o.length,a=n?[]:{};let l=0;for(let c=0;c<s;c++){const d=n?c:o[c];!n&&e[d]===void 0&&t[d]===void 0&&r.includes(d)?(a[d]=void 0,l++):(a[d]=Lw(e[d],t[d]),a[d]===e[d]&&e[d]!==void 0&&l++)}return i===s&&l===i?e:a}return t}function ym(e,t){if(e&&!t||t&&!e)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function $w(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function xm(e){if(!Fw(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!Fw(n)||!n.hasOwnProperty("isPrototypeOf"))}function Fw(e){return Object.prototype.toString.call(e)==="[object Object]"}function gN(e){return new Promise(t=>{setTimeout(t,e)})}function wm(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Lw(e,t):t}function mN(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function vN(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var bN=(SA=class extends Rc{constructor(){super();Be(this,ka,void 0);Be(this,gs,void 0);Be(this,Ql,void 0);Ie(this,Ql,t=>{if(!il&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){J(this,gs)||this.setEventListener(J(this,Ql))}onUnsubscribe(){var t;this.hasListeners()||((t=J(this,gs))==null||t.call(this),Ie(this,gs,void 0))}setEventListener(t){var n;Ie(this,Ql,t),(n=J(this,gs))==null||n.call(this),Ie(this,gs,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){J(this,ka)!==t&&(Ie(this,ka,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof J(this,ka)=="boolean"?J(this,ka):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ka=new WeakMap,gs=new WeakMap,Ql=new WeakMap,SA),of=new bN,yN=(CA=class extends Rc{constructor(){super();Be(this,Jl,!0);Be(this,ms,void 0);Be(this,Zl,void 0);Ie(this,Zl,t=>{if(!il&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){J(this,ms)||this.setEventListener(J(this,Zl))}onUnsubscribe(){var t;this.hasListeners()||((t=J(this,ms))==null||t.call(this),Ie(this,ms,void 0))}setEventListener(t){var n;Ie(this,Zl,t),(n=J(this,ms))==null||n.call(this),Ie(this,ms,t(this.setOnline.bind(this)))}setOnline(t){J(this,Jl)!==t&&(Ie(this,Jl,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return J(this,Jl)}},Jl=new WeakMap,ms=new WeakMap,Zl=new WeakMap,CA),sf=new yN;function xN(e){return Math.min(1e3*2**e,3e4)}function af(e){return(e??"online")==="online"?sf.isOnline():!0}var jw=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function _m(e){return e instanceof jw}function zw(e){let t=!1,n=0,r=!1,i,o,s;const a=new Promise((x,w)=>{o=x,s=w}),l=x=>{var w;r||(p(new jw(x)),(w=e.abort)==null||w.call(e))},c=()=>{t=!0},d=()=>{t=!1},f=()=>!of.isFocused()||e.networkMode!=="always"&&!sf.isOnline(),g=x=>{var w;r||(r=!0,(w=e.onSuccess)==null||w.call(e,x),i==null||i(),o(x))},p=x=>{var w;r||(r=!0,(w=e.onError)==null||w.call(e,x),i==null||i(),s(x))},v=()=>new Promise(x=>{var w;i=S=>{const C=r||!f();return C&&x(S),C},(w=e.onPause)==null||w.call(e)}).then(()=>{var x;i=void 0,r||(x=e.onContinue)==null||x.call(e)}),y=()=>{if(r)return;let x;try{x=e.fn()}catch(w){x=Promise.reject(w)}Promise.resolve(x).then(g).catch(w=>{var k;if(r)return;const S=e.retry??(il?0:3),C=e.retryDelay??xN,P=typeof C=="function"?C(n,w):C,O=S===!0||typeof S=="number"&&n<S||typeof S=="function"&&S(n,w);if(t||!O){p(w);return}n++,(k=e.onFail)==null||k.call(e,n,w),gN(P).then(()=>{if(f())return v()}).then(()=>{t?p(w):y()})})};return af(e.networkMode)?y():v().then(y),{promise:a,cancel:l,continue:()=>(i==null?void 0:i())?a:Promise.resolve(),cancelRetry:c,continueRetry:d}}function wN(){let e=[],t=0,n=g=>{g()},r=g=>{g()},i=g=>setTimeout(g,0);const o=g=>{i=g},s=g=>{let p;t++;try{p=g()}finally{t--,t||c()}return p},a=g=>{t?e.push(g):i(()=>{n(g)})},l=g=>(...p)=>{a(()=>{g(...p)})},c=()=>{const g=e;e=[],g.length&&i(()=>{r(()=>{g.forEach(p=>{n(p)})})})};return{batch:s,batchCalls:l,schedule:a,setNotifyFunction:g=>{n=g},setBatchNotifyFunction:g=>{r=g},setScheduler:o}}var In=wN(),Bw=(EA=class{constructor(){Be(this,Ma,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),vm(this.gcTime)&&Ie(this,Ma,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(il?1/0:5*60*1e3))}clearGcTimeout(){J(this,Ma)&&(clearTimeout(J(this,Ma)),Ie(this,Ma,void 0))}},Ma=new WeakMap,EA),_N=(OA=class extends Bw{constructor(t){super();Be(this,nc);Be(this,Ci);Be(this,ec,void 0);Be(this,tc,void 0);Be(this,ii,void 0);Be(this,vs,void 0);Be(this,oi,void 0);Be(this,Dn,void 0);Be(this,hd,void 0);Be(this,Da,void 0);Ie(this,Da,!1),Ie(this,hd,t.defaultOptions),wt(this,nc,Yg).call(this,t.options),Ie(this,Dn,[]),Ie(this,ii,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Ie(this,ec,t.state||SN(this.options)),this.state=J(this,ec),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!J(this,Dn).length&&this.state.fetchStatus==="idle"&&J(this,ii).remove(this)}setData(t,n){const r=wm(this.state.data,t,this.options);return wt(this,Ci,Ro).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){wt(this,Ci,Ro).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r;const n=J(this,vs);return(r=J(this,oi))==null||r.cancel(t),n?n.then(Xr).catch(Xr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(J(this,ec))}isActive(){return J(this,Dn).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||J(this,Dn).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!Iw(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=J(this,Dn).find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=J(this,oi))==null||n.continue()}onOnline(){var n;const t=J(this,Dn).find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=J(this,oi))==null||n.continue()}addObserver(t){J(this,Dn).includes(t)||(J(this,Dn).push(t),this.clearGcTimeout(),J(this,ii).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){J(this,Dn).includes(t)&&(Ie(this,Dn,J(this,Dn).filter(n=>n!==t)),J(this,Dn).length||(J(this,oi)&&(J(this,Da)?J(this,oi).cancel({revert:!0}):J(this,oi).cancelRetry()),this.scheduleGc()),J(this,ii).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return J(this,Dn).length}invalidate(){this.state.isInvalidated||wt(this,Ci,Ro).call(this,{type:"invalidate"})}fetch(t,n){var c,d,f,g;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(J(this,vs))return(c=J(this,oi))==null||c.continueRetry(),J(this,vs)}if(t&&wt(this,nc,Yg).call(this,t),!this.options.queryFn){const p=J(this,Dn).find(v=>v.options.queryFn);p&&wt(this,nc,Yg).call(this,p.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,i={queryKey:this.queryKey,meta:this.meta},o=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(Ie(this,Da,!0),r.signal)})};o(i);const s=()=>this.options.queryFn?(Ie(this,Da,!1),this.options.persister?this.options.persister(this.options.queryFn,i,this):this.options.queryFn(i)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),a={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:s};o(a),(d=this.options.behavior)==null||d.onFetch(a,this),Ie(this,tc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&wt(this,Ci,Ro).call(this,{type:"fetch",meta:(g=a.fetchOptions)==null?void 0:g.meta});const l=p=>{var v,y,x,w;_m(p)&&p.silent||wt(this,Ci,Ro).call(this,{type:"error",error:p}),_m(p)||((y=(v=J(this,ii).config).onError)==null||y.call(v,p,this),(w=(x=J(this,ii).config).onSettled)==null||w.call(x,this.state.data,p,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return Ie(this,oi,zw({fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:p=>{var v,y,x,w;if(typeof p>"u"){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),l(new Error(`${this.queryHash} data is undefined`));return}this.setData(p),(y=(v=J(this,ii).config).onSuccess)==null||y.call(v,p,this),(w=(x=J(this,ii).config).onSettled)==null||w.call(x,p,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:l,onFail:(p,v)=>{wt(this,Ci,Ro).call(this,{type:"failed",failureCount:p,error:v})},onPause:()=>{wt(this,Ci,Ro).call(this,{type:"pause"})},onContinue:()=>{wt(this,Ci,Ro).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode})),Ie(this,vs,J(this,oi).promise),J(this,vs)}},ec=new WeakMap,tc=new WeakMap,ii=new WeakMap,vs=new WeakMap,oi=new WeakMap,Dn=new WeakMap,hd=new WeakMap,Da=new WeakMap,nc=new WeakSet,Yg=function(t){this.options={...J(this,hd),...t},this.updateGcTime(this.options.gcTime)},Ci=new WeakSet,Ro=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:t.meta??null,fetchStatus:af(this.options.networkMode)?"fetching":"paused",...!r.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=t.error;return _m(i)&&i.revert&&J(this,tc)?{...J(this,tc),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),In.batch(()=>{J(this,Dn).forEach(r=>{r.onQueryUpdate()}),J(this,ii).notify({query:this,type:"updated",action:t})})},OA);function SN(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=typeof t<"u",r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var CN=(PA=class extends Rc{constructor(t={}){super();Be(this,Ki,void 0);this.config=t,Ie(this,Ki,new Map)}build(t,n,r){const i=n.queryKey,o=n.queryHash??bm(i,n);let s=this.get(o);return s||(s=new _N({cache:this,queryKey:i,queryHash:o,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(s)),s}add(t){J(this,Ki).has(t.queryHash)||(J(this,Ki).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=J(this,Ki).get(t.queryHash);n&&(t.destroy(),n===t&&J(this,Ki).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){In.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return J(this,Ki).get(t)}getAll(){return[...J(this,Ki).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Nw(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Nw(t,r)):n}notify(t){In.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){In.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){In.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ki=new WeakMap,PA),EN=(kA=class extends Bw{constructor(t){super();Be(this,Qi);Be(this,Xi,void 0);Be(this,pd,void 0);Be(this,Br,void 0);Be(this,rc,void 0);this.mutationId=t.mutationId,Ie(this,pd,t.defaultOptions),Ie(this,Br,t.mutationCache),Ie(this,Xi,[]),this.state=t.state||ON(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...J(this,pd),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){J(this,Xi).includes(t)||(J(this,Xi).push(t),this.clearGcTimeout(),J(this,Br).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Ie(this,Xi,J(this,Xi).filter(n=>n!==t)),this.scheduleGc(),J(this,Br).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){J(this,Xi).length||(this.state.status==="pending"?this.scheduleGc():J(this,Br).remove(this))}continue(){var t;return((t=J(this,rc))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,o,s,a,l,c,d,f,g,p,v,y,x,w,S,C,P,O,k,A;const n=()=>(Ie(this,rc,zw({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(L,F)=>{wt(this,Qi,Ts).call(this,{type:"failed",failureCount:L,error:F})},onPause:()=>{wt(this,Qi,Ts).call(this,{type:"pause"})},onContinue:()=>{wt(this,Qi,Ts).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),J(this,rc).promise),r=this.state.status==="pending";try{if(!r){wt(this,Qi,Ts).call(this,{type:"pending",variables:t}),await((o=(i=J(this,Br).config).onMutate)==null?void 0:o.call(i,t,this));const F=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));F!==this.state.context&&wt(this,Qi,Ts).call(this,{type:"pending",context:F,variables:t})}const L=await n();return await((c=(l=J(this,Br).config).onSuccess)==null?void 0:c.call(l,L,t,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,L,t,this.state.context)),await((p=(g=J(this,Br).config).onSettled)==null?void 0:p.call(g,L,null,this.state.variables,this.state.context,this)),await((y=(v=this.options).onSettled)==null?void 0:y.call(v,L,null,t,this.state.context)),wt(this,Qi,Ts).call(this,{type:"success",data:L}),L}catch(L){try{throw await((w=(x=J(this,Br).config).onError)==null?void 0:w.call(x,L,t,this.state.context,this)),await((C=(S=this.options).onError)==null?void 0:C.call(S,L,t,this.state.context)),await((O=(P=J(this,Br).config).onSettled)==null?void 0:O.call(P,void 0,L,this.state.variables,this.state.context,this)),await((A=(k=this.options).onSettled)==null?void 0:A.call(k,void 0,L,t,this.state.context)),L}finally{wt(this,Qi,Ts).call(this,{type:"error",error:L})}}}},Xi=new WeakMap,pd=new WeakMap,Br=new WeakMap,rc=new WeakMap,Qi=new WeakSet,Ts=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!af(this.options.networkMode),status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),In.batch(()=>{J(this,Xi).forEach(r=>{r.onMutationUpdate(t)}),J(this,Br).notify({mutation:this,type:"updated",action:t})})},kA);function ON(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var PN=(MA=class extends Rc{constructor(t={}){super();Be(this,si,void 0);Be(this,gd,void 0);Be(this,Ta,void 0);this.config=t,Ie(this,si,[]),Ie(this,gd,0)}build(t,n,r){const i=new EN({mutationCache:this,mutationId:++Gg(this,gd)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){J(this,si).push(t),this.notify({type:"added",mutation:t})}remove(t){Ie(this,si,J(this,si).filter(n=>n!==t)),this.notify({type:"removed",mutation:t})}clear(){In.batch(()=>{J(this,si).forEach(t=>{this.remove(t)})})}getAll(){return J(this,si)}find(t){const n={exact:!0,...t};return J(this,si).find(r=>Rw(n,r))}findAll(t={}){return J(this,si).filter(n=>Rw(t,n))}notify(t){In.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){return Ie(this,Ta,(J(this,Ta)??Promise.resolve()).then(()=>{const t=J(this,si).filter(n=>n.state.isPaused);return In.batch(()=>t.reduce((n,r)=>n.then(()=>r.continue().catch(Xr)),Promise.resolve()))}).then(()=>{Ie(this,Ta,void 0)})),J(this,Ta)}},si=new WeakMap,gd=new WeakMap,Ta=new WeakMap,MA);function kN(e){return{onFetch:(t,n)=>{const r=async()=>{var v,y,x,w,S;const i=t.options,o=(x=(y=(v=t.fetchOptions)==null?void 0:v.meta)==null?void 0:y.fetchMore)==null?void 0:x.direction,s=((w=t.state.data)==null?void 0:w.pages)||[],a=((S=t.state.data)==null?void 0:S.pageParams)||[],l={pages:[],pageParams:[]};let c=!1;const d=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(t.signal.aborted?c=!0:t.signal.addEventListener("abort",()=>{c=!0}),t.signal)})},f=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),g=async(C,P,O)=>{if(c)return Promise.reject();if(P==null&&C.pages.length)return Promise.resolve(C);const k={queryKey:t.queryKey,pageParam:P,direction:O?"backward":"forward",meta:t.options.meta};d(k);const A=await f(k),{maxPages:L}=t.options,F=O?vN:mN;return{pages:F(C.pages,A,L),pageParams:F(C.pageParams,P,L)}};let p;if(o&&s.length){const C=o==="backward",P=C?MN:Vw,O={pages:s,pageParams:a},k=P(i,O);p=await g(O,k,C)}else{p=await g(l,a[0]??i.initialPageParam);const C=e??s.length;for(let P=1;P<C;P++){const O=Vw(i,p);p=await g(p,O)}}return p};t.options.persister?t.fetchFn=()=>{var i,o;return(o=(i=t.options).persister)==null?void 0:o.call(i,r,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=r}}}function Vw(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function MN(e,{pages:t,pageParams:n}){var r;return(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n)}var DN=(DA=class{constructor(e={}){Be(this,Cn,void 0);Be(this,bs,void 0);Be(this,ys,void 0);Be(this,ic,void 0);Be(this,oc,void 0);Be(this,xs,void 0);Be(this,sc,void 0);Be(this,ac,void 0);Ie(this,Cn,e.queryCache||new CN),Ie(this,bs,e.mutationCache||new PN),Ie(this,ys,e.defaultOptions||{}),Ie(this,ic,new Map),Ie(this,oc,new Map),Ie(this,xs,0)}mount(){Gg(this,xs)._++,J(this,xs)===1&&(Ie(this,sc,of.subscribe(()=>{of.isFocused()&&(this.resumePausedMutations(),J(this,Cn).onFocus())})),Ie(this,ac,sf.subscribe(()=>{sf.isOnline()&&(this.resumePausedMutations(),J(this,Cn).onOnline())})))}unmount(){var e,t;Gg(this,xs)._--,J(this,xs)===0&&((e=J(this,sc))==null||e.call(this),Ie(this,sc,void 0),(t=J(this,ac))==null||t.call(this),Ie(this,ac,void 0))}isFetching(e){return J(this,Cn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return J(this,bs).findAll({...e,status:"pending"}).length}getQueryData(e){var t;return(t=J(this,Cn).find({queryKey:e}))==null?void 0:t.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);return t!==void 0?Promise.resolve(t):this.fetchQuery(e)}getQueriesData(e){return this.getQueryCache().findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=J(this,Cn).find({queryKey:e}),i=r==null?void 0:r.state.data,o=pN(t,i);if(typeof o>"u")return;const s=this.defaultQueryOptions({queryKey:e});return J(this,Cn).build(this,s).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return In.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var t;return(t=J(this,Cn).find({queryKey:e}))==null?void 0:t.state}removeQueries(e){const t=J(this,Cn);In.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=J(this,Cn),r={type:"active",...e};return In.batch(()=>(n.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=In.batch(()=>J(this,Cn).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(Xr).catch(Xr)}invalidateQueries(e={},t={}){return In.batch(()=>{if(J(this,Cn).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=In.batch(()=>J(this,Cn).findAll(e).filter(i=>!i.isDisabled()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(Xr)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(Xr)}fetchQuery(e){const t=this.defaultQueryOptions(e);typeof t.retry>"u"&&(t.retry=!1);const n=J(this,Cn).build(this,t);return n.isStaleByTime(t.staleTime)?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Xr).catch(Xr)}fetchInfiniteQuery(e){return e.behavior=kN(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Xr).catch(Xr)}resumePausedMutations(){return J(this,bs).resumePausedMutations()}getQueryCache(){return J(this,Cn)}getMutationCache(){return J(this,bs)}getDefaultOptions(){return J(this,ys)}setDefaultOptions(e){Ie(this,ys,e)}setQueryDefaults(e,t){J(this,ic).set(Lc(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...J(this,ic).values()];let n={};return t.forEach(r=>{$c(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){J(this,oc).set(Lc(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...J(this,oc).values()];let n={};return t.forEach(r=>{$c(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const t={...J(this,ys).queries,...(e==null?void 0:e.queryKey)&&this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=bm(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.throwOnError>"u"&&(t.throwOnError=!!t.suspense),typeof t.networkMode>"u"&&t.persister&&(t.networkMode="offlineFirst"),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...J(this,ys).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){J(this,Cn).clear(),J(this,bs).clear()}},Cn=new WeakMap,bs=new WeakMap,ys=new WeakMap,ic=new WeakMap,oc=new WeakMap,xs=new WeakMap,sc=new WeakMap,ac=new WeakMap,DA),TN=(TA=class extends Rc{constructor(t,n){super();Be(this,Ra);Be(this,bd);Be(this,yd);Be(this,xd);Be(this,wd);Be(this,_d);Be(this,Sd);Be(this,Cd);Be(this,og);Be(this,mr,void 0);Be(this,en,void 0);Be(this,md,void 0);Be(this,tr,void 0);Be(this,Aa,void 0);Be(this,lc,void 0);Be(this,Ji,void 0);Be(this,vd,void 0);Be(this,cc,void 0);Be(this,uc,void 0);Be(this,Ia,void 0);Be(this,Na,void 0);Be(this,ws,void 0);Be(this,dc,new Set);this.options=n,Ie(this,mr,t),Ie(this,Ji,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(J(this,en).addObserver(this),Hw(J(this,en),this.options)?wt(this,Ra,Ud).call(this):this.updateResult(),wt(this,wd,W1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Sm(J(this,en),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Sm(J(this,en),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,wt(this,_d,q1).call(this),wt(this,Sd,U1).call(this),J(this,en).removeObserver(this)}setOptions(t,n){const r=this.options,i=J(this,en);if(this.options=J(this,mr).defaultQueryOptions(t),ym(r,this.options)||J(this,mr).getQueryCache().notify({type:"observerOptionsUpdated",query:J(this,en),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=r.queryKey),wt(this,Cd,G1).call(this);const o=this.hasListeners();o&&Ww(J(this,en),i,this.options,r)&&wt(this,Ra,Ud).call(this),this.updateResult(n),o&&(J(this,en)!==i||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&wt(this,bd,B1).call(this);const s=wt(this,yd,V1).call(this);o&&(J(this,en)!==i||this.options.enabled!==r.enabled||s!==J(this,ws))&&wt(this,xd,H1).call(this,s)}getOptimisticResult(t){const n=J(this,mr).getQueryCache().build(J(this,mr),t),r=this.createResult(n,t);return IN(this,r)&&(Ie(this,tr,r),Ie(this,lc,this.options),Ie(this,Aa,J(this,en).state)),r}getCurrentResult(){return J(this,tr)}trackResult(t){const n={};return Object.keys(t).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(J(this,dc).add(r),t[r])})}),n}getCurrentQuery(){return J(this,en)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=J(this,mr).defaultQueryOptions(t),r=J(this,mr).getQueryCache().build(J(this,mr),n);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,n))}fetch(t){return wt(this,Ra,Ud).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),J(this,tr)))}createResult(t,n){var k;const r=J(this,en),i=this.options,o=J(this,tr),s=J(this,Aa),a=J(this,lc),c=t!==r?t.state:J(this,md),{state:d}=t;let{error:f,errorUpdatedAt:g,fetchStatus:p,status:v}=d,y=!1,x;if(n._optimisticResults){const A=this.hasListeners(),L=!A&&Hw(t,n),F=A&&Ww(t,r,n,i);(L||F)&&(p=af(t.options.networkMode)?"fetching":"paused",d.dataUpdatedAt||(v="pending")),n._optimisticResults==="isRestoring"&&(p="idle")}if(n.select&&typeof d.data<"u")if(o&&d.data===(s==null?void 0:s.data)&&n.select===J(this,vd))x=J(this,cc);else try{Ie(this,vd,n.select),x=n.select(d.data),x=wm(o==null?void 0:o.data,x,n),Ie(this,cc,x),Ie(this,Ji,null)}catch(A){Ie(this,Ji,A)}else x=d.data;if(typeof n.placeholderData<"u"&&typeof x>"u"&&v==="pending"){let A;if(o!=null&&o.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))A=o.data;else if(A=typeof n.placeholderData=="function"?n.placeholderData((k=J(this,uc))==null?void 0:k.state.data,J(this,uc)):n.placeholderData,n.select&&typeof A<"u")try{A=n.select(A),Ie(this,Ji,null)}catch(L){Ie(this,Ji,L)}typeof A<"u"&&(v="success",x=wm(o==null?void 0:o.data,A,n),y=!0)}J(this,Ji)&&(f=J(this,Ji),x=J(this,cc),g=Date.now(),v="error");const w=p==="fetching",S=v==="pending",C=v==="error",P=S&&w;return{status:v,fetchStatus:p,isPending:S,isSuccess:v==="success",isError:C,isInitialLoading:P,isLoading:P,data:x,dataUpdatedAt:d.dataUpdatedAt,error:f,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:w,isRefetching:w&&!S,isLoadingError:C&&d.dataUpdatedAt===0,isPaused:p==="paused",isPlaceholderData:y,isRefetchError:C&&d.dataUpdatedAt!==0,isStale:Cm(t,n),refetch:this.refetch}}updateResult(t){const n=J(this,tr),r=this.createResult(J(this,en),this.options);if(Ie(this,Aa,J(this,en).state),Ie(this,lc,this.options),J(this,Aa).data!==void 0&&Ie(this,uc,J(this,en)),ym(r,n))return;Ie(this,tr,r);const i={},o=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!J(this,dc).size)return!0;const l=new Set(a??J(this,dc));return this.options.throwOnError&&l.add("error"),Object.keys(J(this,tr)).some(c=>{const d=c;return J(this,tr)[d]!==n[d]&&l.has(d)})};(t==null?void 0:t.listeners)!==!1&&o()&&(i.listeners=!0),wt(this,og,r3).call(this,{...i,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&wt(this,wd,W1).call(this)}},mr=new WeakMap,en=new WeakMap,md=new WeakMap,tr=new WeakMap,Aa=new WeakMap,lc=new WeakMap,Ji=new WeakMap,vd=new WeakMap,cc=new WeakMap,uc=new WeakMap,Ia=new WeakMap,Na=new WeakMap,ws=new WeakMap,dc=new WeakMap,Ra=new WeakSet,Ud=function(t){wt(this,Cd,G1).call(this);let n=J(this,en).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Xr)),n},bd=new WeakSet,B1=function(){if(wt(this,_d,q1).call(this),il||J(this,tr).isStale||!vm(this.options.staleTime))return;const n=Iw(J(this,tr).dataUpdatedAt,this.options.staleTime)+1;Ie(this,Ia,setTimeout(()=>{J(this,tr).isStale||this.updateResult()},n))},yd=new WeakSet,V1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(J(this,en)):this.options.refetchInterval)??!1},xd=new WeakSet,H1=function(t){wt(this,Sd,U1).call(this),Ie(this,ws,t),!(il||this.options.enabled===!1||!vm(J(this,ws))||J(this,ws)===0)&&Ie(this,Na,setInterval(()=>{(this.options.refetchIntervalInBackground||of.isFocused())&&wt(this,Ra,Ud).call(this)},J(this,ws)))},wd=new WeakSet,W1=function(){wt(this,bd,B1).call(this),wt(this,xd,H1).call(this,wt(this,yd,V1).call(this))},_d=new WeakSet,q1=function(){J(this,Ia)&&(clearTimeout(J(this,Ia)),Ie(this,Ia,void 0))},Sd=new WeakSet,U1=function(){J(this,Na)&&(clearInterval(J(this,Na)),Ie(this,Na,void 0))},Cd=new WeakSet,G1=function(){const t=J(this,mr).getQueryCache().build(J(this,mr),this.options);if(t===J(this,en))return;const n=J(this,en);Ie(this,en,t),Ie(this,md,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},og=new WeakSet,r3=function(t){In.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(J(this,tr))}),J(this,mr).getQueryCache().notify({query:J(this,en),type:"observerResultsUpdated"})})},TA);function AN(e,t){return t.enabled!==!1&&!e.state.dataUpdatedAt&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Hw(e,t){return AN(e,t)||e.state.dataUpdatedAt>0&&Sm(e,t,t.refetchOnMount)}function Sm(e,t,n){if(t.enabled!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Cm(e,t)}return!1}function Ww(e,t,n,r){return n.enabled!==!1&&(e!==t||r.enabled===!1)&&(!n.suspense||e.state.status!=="error")&&Cm(e,n)}function Cm(e,t){return e.isStaleByTime(t.staleTime)}function IN(e,t){return!ym(e.getCurrentResult(),t)}var qw=de.createContext(void 0),NN=e=>{const t=de.useContext(qw);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},RN=({client:e,children:t})=>(de.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),de.createElement(qw.Provider,{value:e},t)),Uw=de.createContext(!1),LN=()=>de.useContext(Uw);Uw.Provider;function $N(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var FN=de.createContext($N()),jN=()=>de.useContext(FN);function zN(e,t){return typeof e=="function"?e(...t):!!e}var BN=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},VN=e=>{de.useEffect(()=>{e.clearReset()},[e])},HN=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&zN(n,[e.error,r]),WN=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},qN=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,UN=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function GN(e,t,n){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=NN(n),i=LN(),o=jN(),s=r.defaultQueryOptions(e);s._optimisticResults=i?"isRestoring":"optimistic",WN(s),BN(s,o),VN(o);const[a]=de.useState(()=>new t(r,s)),l=a.getOptimisticResult(s);if(de.useSyncExternalStore(de.useCallback(c=>{const d=i?()=>{}:a.subscribe(In.batchCalls(c));return a.updateResult(),d},[a,i]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),de.useEffect(()=>{a.setOptions(s,{listeners:!1})},[s,a]),qN(s,l))throw UN(s,a,o);if(HN({result:l,errorResetBoundary:o,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw l.error;return s.notifyOnChangeProps?l:a.trackResult(l)}function Cr(e,t){return GN(e,TN,t)}var lf={exports:{}};/**
60
60
  * @license
61
61
  * Lodash <https://lodash.com/>
62
62
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
@@ -82,7 +82,7 @@ __p += '`),Et&&(we+=`' +
82
82
  function print() { __p += __j.call(arguments, '') }
83
83
  `:`;
84
84
  `)+we+`return __p
85
- }`;var gt=e3(function(){return At(R,je+"return "+we).apply(n,z)});if(gt.source=we,M1(gt))throw gt;return gt}function Due(u){return $t(u).toLowerCase()}function Tue(u){return $t(u).toUpperCase()}function Aue(u,h,b){if(u=$t(u),u&&(b||h===n))return c5(u);if(!u||!(h=Ur(h)))return u;var E=Ei(u),T=Ei(h),R=u5(E,T),z=d5(E,T)+1;return Ms(E,R,z).join("")}function Iue(u,h,b){if(u=$t(u),u&&(b||h===n))return u.slice(0,h5(u)+1);if(!u||!(h=Ur(h)))return u;var E=Ei(u),T=d5(E,Ei(h))+1;return Ms(E,0,T).join("")}function Nue(u,h,b){if(u=$t(u),u&&(b||h===n))return u.replace(Ha,"");if(!u||!(h=Ur(h)))return u;var E=Ei(u),T=u5(E,Ei(h));return Ms(E,T).join("")}function Rue(u,h){var b=j,E=B;if(ln(h)){var T="separator"in h?h.separator:T;b="length"in h?ut(h.length):b,E="omission"in h?Ur(h.omission):E}u=$t(u);var R=u.length;if(gc(u)){var z=Ei(u);R=z.length}if(b>=R)return u;var q=b-mc(E);if(q<1)return E;var te=z?Ms(z,0,q).join(""):u.slice(0,q);if(T===n)return te+E;if(z&&(q+=te.length-q),D1(T)){if(u.slice(q).search(T)){var ve,be=te;for(T.global||(T=Ux(T.source,$t(ze.exec(T))+"g")),T.lastIndex=0;ve=T.exec(be);)var we=ve.index;te=te.slice(0,we===n?q:we)}}else if(u.indexOf(Ur(T),q)!=q){var Te=te.lastIndexOf(T);Te>-1&&(te=te.slice(0,Te))}return te+E}function Lue(u){return u=$t(u),u&&Eo.test(u)?u.replace(Kn,doe):u}var $ue=Sc(function(u,h,b){return u+(b?" ":"")+h.toUpperCase()}),I1=tI("toUpperCase");function ZI(u,h,b){return u=$t(u),h=b?n:h,h===n?soe(u)?poe(u):Qie(u):u.match(h)||[]}var e3=mt(function(u,h){try{return Wr(u,n,h)}catch(b){return M1(b)?b:new Ze(b)}}),Fue=Do(function(u,h){return li(h,function(b){b=no(b),ko(u,b,P1(u[b],u))}),u});function jue(u){var h=u==null?0:u.length,b=We();return u=h?sn(u,function(E){if(typeof E[1]!="function")throw new ci(s);return[b(E[0]),E[1]]}):[],mt(function(E){for(var T=-1;++T<h;){var R=u[T];if(Wr(R[0],this,E))return Wr(R[1],this,E)}})}function zue(u){return dse(di(u,f))}function N1(u){return function(){return u}}function Bue(u,h){return u==null||u!==u?h:u}var Vue=rI(),Hue=rI(!0);function wr(u){return u}function R1(u){return I5(typeof u=="function"?u:di(u,f))}function Wue(u){return R5(di(u,f))}function que(u,h){return L5(u,di(h,f))}var Uue=mt(function(u,h){return function(b){return jd(b,u,h)}}),Gue=mt(function(u,h){return function(b){return jd(u,b,h)}});function L1(u,h,b){var E=An(h),T=Pg(h,E);b==null&&!(ln(h)&&(T.length||!E.length))&&(b=h,h=u,u=this,T=Pg(h,An(h)));var R=!(ln(b)&&"chain"in b)||!!b.chain,z=Ao(u);return li(T,function(q){var te=h[q];u[q]=te,z&&(u.prototype[q]=function(){var ve=this.__chain__;if(R||ve){var be=u(this.__wrapped__),we=be.__actions__=br(this.__actions__);return we.push({func:te,args:arguments,thisArg:u}),be.__chain__=ve,be}return te.apply(u,Ss([this.value()],arguments))})}),u}function Yue(){return Bn._===this&&(Bn._=xoe),this}function $1(){}function Kue(u){return u=ut(u),mt(function(h){return $5(h,u)})}var Xue=p1(sn),Que=p1(i5),Jue=p1(jx);function t3(u){return w1(u)?zx(no(u)):kse(u)}function Zue(u){return function(h){return u==null?n:Xa(u,h)}}var ede=oI(),tde=oI(!0);function F1(){return[]}function j1(){return!1}function nde(){return{}}function rde(){return""}function ide(){return!0}function ode(u,h){if(u=ut(u),u<1||u>ie)return[];var b=W,E=Xn(u,W);h=We(h),u-=W;for(var T=Hx(E,h);++b<u;)h(b);return T}function sde(u){return rt(u)?sn(u,no):Gr(u)?[u]:br(wI($t(u)))}function ade(u){var h=++boe;return $t(u)+h}var lde=Ig(function(u,h){return u+h},0),cde=g1("ceil"),ude=Ig(function(u,h){return u/h},1),dde=g1("floor");function fde(u){return u&&u.length?Og(u,wr,e1):n}function hde(u,h){return u&&u.length?Og(u,We(h,2),e1):n}function pde(u){return a5(u,wr)}function gde(u,h){return a5(u,We(h,2))}function mde(u){return u&&u.length?Og(u,wr,i1):n}function vde(u,h){return u&&u.length?Og(u,We(h,2),i1):n}var bde=Ig(function(u,h){return u*h},1),yde=g1("round"),xde=Ig(function(u,h){return u-h},0);function wde(u){return u&&u.length?Vx(u,wr):0}function _de(u,h){return u&&u.length?Vx(u,We(h,2)):0}return I.after=Wle,I.ary=AI,I.assign=Tce,I.assignIn=UI,I.assignInWith=Ug,I.assignWith=Ace,I.at=Ice,I.before=II,I.bind=P1,I.bindAll=Fue,I.bindKey=NI,I.castArray=nce,I.chain=MI,I.chunk=dae,I.compact=fae,I.concat=hae,I.cond=jue,I.conforms=zue,I.constant=N1,I.countBy=wle,I.create=Nce,I.curry=RI,I.curryRight=LI,I.debounce=$I,I.defaults=Rce,I.defaultsDeep=Lce,I.defer=qle,I.delay=Ule,I.difference=pae,I.differenceBy=gae,I.differenceWith=mae,I.drop=vae,I.dropRight=bae,I.dropRightWhile=yae,I.dropWhile=xae,I.fill=wae,I.filter=Sle,I.flatMap=Ole,I.flatMapDeep=Ple,I.flatMapDepth=kle,I.flatten=EI,I.flattenDeep=_ae,I.flattenDepth=Sae,I.flip=Gle,I.flow=Vue,I.flowRight=Hue,I.fromPairs=Cae,I.functions=Hce,I.functionsIn=Wce,I.groupBy=Mle,I.initial=Oae,I.intersection=Pae,I.intersectionBy=kae,I.intersectionWith=Mae,I.invert=Uce,I.invertBy=Gce,I.invokeMap=Tle,I.iteratee=R1,I.keyBy=Ale,I.keys=An,I.keysIn=xr,I.map=zg,I.mapKeys=Kce,I.mapValues=Xce,I.matches=Wue,I.matchesProperty=que,I.memoize=Vg,I.merge=Qce,I.mergeWith=GI,I.method=Uue,I.methodOf=Gue,I.mixin=L1,I.negate=Hg,I.nthArg=Kue,I.omit=Jce,I.omitBy=Zce,I.once=Yle,I.orderBy=Ile,I.over=Xue,I.overArgs=Kle,I.overEvery=Que,I.overSome=Jue,I.partial=k1,I.partialRight=FI,I.partition=Nle,I.pick=eue,I.pickBy=YI,I.property=t3,I.propertyOf=Zue,I.pull=Iae,I.pullAll=PI,I.pullAllBy=Nae,I.pullAllWith=Rae,I.pullAt=Lae,I.range=ede,I.rangeRight=tde,I.rearg=Xle,I.reject=$le,I.remove=$ae,I.rest=Qle,I.reverse=E1,I.sampleSize=jle,I.set=nue,I.setWith=rue,I.shuffle=zle,I.slice=Fae,I.sortBy=Hle,I.sortedUniq=qae,I.sortedUniqBy=Uae,I.split=Oue,I.spread=Jle,I.tail=Gae,I.take=Yae,I.takeRight=Kae,I.takeRightWhile=Xae,I.takeWhile=Qae,I.tap=fle,I.throttle=Zle,I.thru=jg,I.toArray=HI,I.toPairs=KI,I.toPairsIn=XI,I.toPath=sde,I.toPlainObject=qI,I.transform=iue,I.unary=ece,I.union=Jae,I.unionBy=Zae,I.unionWith=ele,I.uniq=tle,I.uniqBy=nle,I.uniqWith=rle,I.unset=oue,I.unzip=O1,I.unzipWith=kI,I.update=sue,I.updateWith=aue,I.values=Oc,I.valuesIn=lue,I.without=ile,I.words=ZI,I.wrap=tce,I.xor=ole,I.xorBy=sle,I.xorWith=ale,I.zip=lle,I.zipObject=cle,I.zipObjectDeep=ule,I.zipWith=dle,I.entries=KI,I.entriesIn=XI,I.extend=UI,I.extendWith=Ug,L1(I,I),I.add=lde,I.attempt=e3,I.camelCase=fue,I.capitalize=QI,I.ceil=cde,I.clamp=cue,I.clone=rce,I.cloneDeep=oce,I.cloneDeepWith=sce,I.cloneWith=ice,I.conformsTo=ace,I.deburr=JI,I.defaultTo=Bue,I.divide=ude,I.endsWith=hue,I.eq=Pi,I.escape=pue,I.escapeRegExp=gue,I.every=_le,I.find=Cle,I.findIndex=SI,I.findKey=$ce,I.findLast=Ele,I.findLastIndex=CI,I.findLastKey=Fce,I.floor=dde,I.forEach=DI,I.forEachRight=TI,I.forIn=jce,I.forInRight=zce,I.forOwn=Bce,I.forOwnRight=Vce,I.get=T1,I.gt=lce,I.gte=cce,I.has=qce,I.hasIn=A1,I.head=OI,I.identity=wr,I.includes=Dle,I.indexOf=Eae,I.inRange=uue,I.invoke=Yce,I.isArguments=Za,I.isArray=rt,I.isArrayBuffer=uce,I.isArrayLike=yr,I.isArrayLikeObject=mn,I.isBoolean=dce,I.isBuffer=Ds,I.isDate=fce,I.isElement=hce,I.isEmpty=pce,I.isEqual=gce,I.isEqualWith=mce,I.isError=M1,I.isFinite=vce,I.isFunction=Ao,I.isInteger=jI,I.isLength=Wg,I.isMap=zI,I.isMatch=bce,I.isMatchWith=yce,I.isNaN=xce,I.isNative=wce,I.isNil=Sce,I.isNull=_ce,I.isNumber=BI,I.isObject=ln,I.isObjectLike=dn,I.isPlainObject=qd,I.isRegExp=D1,I.isSafeInteger=Cce,I.isSet=VI,I.isString=qg,I.isSymbol=Gr,I.isTypedArray=Ec,I.isUndefined=Ece,I.isWeakMap=Oce,I.isWeakSet=Pce,I.join=Dae,I.kebabCase=mue,I.last=hi,I.lastIndexOf=Tae,I.lowerCase=vue,I.lowerFirst=bue,I.lt=kce,I.lte=Mce,I.max=fde,I.maxBy=hde,I.mean=pde,I.meanBy=gde,I.min=mde,I.minBy=vde,I.stubArray=F1,I.stubFalse=j1,I.stubObject=nde,I.stubString=rde,I.stubTrue=ide,I.multiply=bde,I.nth=Aae,I.noConflict=Yue,I.noop=$1,I.now=Bg,I.pad=yue,I.padEnd=xue,I.padStart=wue,I.parseInt=_ue,I.random=due,I.reduce=Rle,I.reduceRight=Lle,I.repeat=Sue,I.replace=Cue,I.result=tue,I.round=yde,I.runInContext=Q,I.sample=Fle,I.size=Ble,I.snakeCase=Eue,I.some=Vle,I.sortedIndex=jae,I.sortedIndexBy=zae,I.sortedIndexOf=Bae,I.sortedLastIndex=Vae,I.sortedLastIndexBy=Hae,I.sortedLastIndexOf=Wae,I.startCase=Pue,I.startsWith=kue,I.subtract=xde,I.sum=wde,I.sumBy=_de,I.template=Mue,I.times=ode,I.toFinite=Io,I.toInteger=ut,I.toLength=WI,I.toLower=Due,I.toNumber=pi,I.toSafeInteger=Dce,I.toString=$t,I.toUpper=Tue,I.trim=Aue,I.trimEnd=Iue,I.trimStart=Nue,I.truncate=Rue,I.unescape=Lue,I.uniqueId=ade,I.upperCase=$ue,I.upperFirst=I1,I.each=DI,I.eachRight=TI,I.first=OI,L1(I,function(){var u={};return eo(I,function(h,b){jt.call(I.prototype,b)||(u[b]=h)}),u}(),{chain:!1}),I.VERSION=r,li(["bind","bindKey","curry","curryRight","partial","partialRight"],function(u){I[u].placeholder=I}),li(["drop","take"],function(u,h){Ct.prototype[u]=function(b){b=b===n?1:Pn(ut(b),0);var E=this.__filtered__&&!h?new Ct(this):this.clone();return E.__filtered__?E.__takeCount__=Xn(b,E.__takeCount__):E.__views__.push({size:Xn(b,W),type:u+(E.__dir__<0?"Right":"")}),E},Ct.prototype[u+"Right"]=function(b){return this.reverse()[u](b).reverse()}}),li(["filter","map","takeWhile"],function(u,h){var b=h+1,E=b==Y||b==Z;Ct.prototype[u]=function(T){var R=this.clone();return R.__iteratees__.push({iteratee:We(T,3),type:b}),R.__filtered__=R.__filtered__||E,R}}),li(["head","last"],function(u,h){var b="take"+(h?"Right":"");Ct.prototype[u]=function(){return this[b](1).value()[0]}}),li(["initial","tail"],function(u,h){var b="drop"+(h?"":"Right");Ct.prototype[u]=function(){return this.__filtered__?new Ct(this):this[b](1)}}),Ct.prototype.compact=function(){return this.filter(wr)},Ct.prototype.find=function(u){return this.filter(u).head()},Ct.prototype.findLast=function(u){return this.reverse().find(u)},Ct.prototype.invokeMap=mt(function(u,h){return typeof u=="function"?new Ct(this):this.map(function(b){return jd(b,u,h)})}),Ct.prototype.reject=function(u){return this.filter(Hg(We(u)))},Ct.prototype.slice=function(u,h){u=ut(u);var b=this;return b.__filtered__&&(u>0||h<0)?new Ct(b):(u<0?b=b.takeRight(-u):u&&(b=b.drop(u)),h!==n&&(h=ut(h),b=h<0?b.dropRight(-h):b.take(h-u)),b)},Ct.prototype.takeRightWhile=function(u){return this.reverse().takeWhile(u).reverse()},Ct.prototype.toArray=function(){return this.take(W)},eo(Ct.prototype,function(u,h){var b=/^(?:filter|find|map|reject)|While$/.test(h),E=/^(?:head|last)$/.test(h),T=I[E?"take"+(h=="last"?"Right":""):h],R=E||/^find/.test(h);T&&(I.prototype[h]=function(){var z=this.__wrapped__,q=E?[1]:arguments,te=z instanceof Ct,ve=q[0],be=te||rt(z),we=function(St){var Et=T.apply(I,Ss([St],q));return E&&Te?Et[0]:Et};be&&b&&typeof ve=="function"&&ve.length!=1&&(te=be=!1);var Te=this.__chain__,je=!!this.__actions__.length,qe=R&&!Te,gt=te&&!je;if(!R&&be){z=gt?z:new Ct(this);var Ue=u.apply(z,q);return Ue.__actions__.push({func:jg,args:[we],thisArg:n}),new ui(Ue,Te)}return qe&&gt?u.apply(this,q):(Ue=this.thru(we),qe?E?Ue.value()[0]:Ue.value():Ue)})}),li(["pop","push","shift","sort","splice","unshift"],function(u){var h=dg[u],b=/^(?:push|sort|unshift)$/.test(u)?"tap":"thru",E=/^(?:pop|shift)$/.test(u);I.prototype[u]=function(){var T=arguments;if(E&&!this.__chain__){var R=this.value();return h.apply(rt(R)?R:[],T)}return this[b](function(z){return h.apply(rt(z)?z:[],T)})}}),eo(Ct.prototype,function(u,h){var b=I[h];if(b){var E=b.name+"";jt.call(xc,E)||(xc[E]=[]),xc[E].push({name:h,func:b})}}),xc[Ag(n,w).name]=[{name:"wrapper",func:n}],Ct.prototype.clone=Loe,Ct.prototype.reverse=$oe,Ct.prototype.value=Foe,I.prototype.at=hle,I.prototype.chain=ple,I.prototype.commit=gle,I.prototype.next=mle,I.prototype.plant=ble,I.prototype.reverse=yle,I.prototype.toJSON=I.prototype.valueOf=I.prototype.value=xle,I.prototype.first=I.prototype.head,Ad&&(I.prototype[Ad]=vle),I},vc=goe();qa?((qa.exports=vc)._=vc,Rx._=vc):Bn._=vc}).call(Lo)}(lf,lf.exports);var YN=lf.exports;const Fs=Pc(YN),KN={theme:"system",setTheme:()=>null},Gw=m.createContext(KN);function XN({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[i,o]=m.useState(()=>localStorage.getItem(n)||t);m.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),i==="system"){const l=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(l);return}a.classList.add(i)},[i]);const s={theme:i,setTheme:a=>{localStorage.setItem(n,a),o(a)}};return _.jsx(Gw.Provider,{...r,value:s,children:e})}const Em=()=>{const e=m.useContext(Gw);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};async function QN(e,t){return await(await fetch(`http://localhost:3000/api/v1/dashboard?id=${e}`,{headers:{Authorization:`Bearer ${t}`}})).json()}function Yw(e,t){return e==="dark"?Fs.merge({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function JN(e,t,n,r,i,o){const{data:s,refetch:a,isLoading:l,isError:c}=Cr({queryKey:[e],queryFn:()=>QN(e,t==null?void 0:t.accessToken),enabled:!1}),{theme:d,setTheme:f}=Em(),{setDashboard:g,setSelectedSheetId:p,setStyle:v,setOnSaveFunction:y}=ge(k=>k.actions),x=ge(k=>k.actions.setFilterValues),w=ge(k=>k.actions.setBookmarkKey),S=ge(k=>k.actions.setAuthToken),C=ge(k=>k.actions.setThemeStyle),P=ge(k=>k.actions.setDashboardTheme),O=ge(k=>k.actions.setOnEvent);return m.useEffect(()=>{d&&P(d)},[d,P]),m.useEffect(()=>{r&&f(r)},[r,f]),m.useEffect(()=>{const k=Fs.cloneDeep(mm);if(n){const A=Fs.merge(k,n),L=Yw(d,A);C(L),v(A)}else{const A=Yw(d,k);C(A),v(mm)}},[d,n,v]),m.useEffect(()=>{var j;if(!s||!s.dashboard)return;const k=s.dashboard,A=as(k.id),L=JSON.parse(localStorage.getItem(A)||"[]"),F=L.find(B=>B.default===!0);if(F)g(F.template),w(F.name),F.filterValues&&x(F.filterValues);else{g(k);const B=L.find(H=>(H==null?void 0:H.name)==="Original");B?B.template=k:L.push({name:"Original",template:k,default:!1}),localStorage.setItem(A,JSON.stringify(L))}p((j=k.sheets)==null?void 0:j[0].id)},[s,g,p]),m.useEffect(()=>{i&&y(i),o&&O(o)},[i,y,o,O]),m.useEffect(()=>{t&&t.accessToken&&(S(t),a())},[t,a,S]),{isLoading:l,isError:c}}function cf({className:e,...t}){return _.jsx("div",{className:Pe("animate-pulse rounded-md bg-muted",e),...t})}function Kw({className:e,style:t,onSave:n,onEvent:r,LoadingComponent:i,ErrorComponent:o,id:s,authToken:a,currentTheme:l,...c}){ge(v=>v.selectedSheetId);const d=ge(v=>v.themeStyle),f=ge(v=>v.onEvent),{isLoading:g,isError:p}=JN(s,a,t,l,n,r);return g||!a?(f==null||f({type:"info",message:`isLoading: ${g}, accessToken: ${a==null?void 0:a.accessToken}`}),i?_.jsx(i,{message:"loading"}):_.jsx("div",{className:" flex items-center gap-3",children:_.jsx(cf,{className:"dark:h-[2px] h-1 w-full"})})):p?(f==null||f({type:"error",message:"Error fetching dashboard"}),o?(console.log("Error fetching dashboard"),_.jsx(o,{})):_.jsx("div",{children:"Error"})):_.jsx("div",{className:Pe(" h-full flex flex-col justify-between",d==null?void 0:d.dashboardPanel,e),role:"dashboard-panel",...c})}function ae(){return ae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ae.apply(this,arguments)}function Ee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function kn(e,t=[]){let n=[];function r(o,s){const a=m.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:g,children:p,...v}=f,y=(g==null?void 0:g[e][l])||a,x=m.useMemo(()=>v,Object.values(v));return m.createElement(y.Provider,{value:x},p)}function d(f,g){const p=(g==null?void 0:g[e][l])||a,v=m.useContext(p);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return c.displayName=o+"Provider",[c,d]}const i=()=>{const o=n.map(s=>m.createContext(s));return function(a){const l=(a==null?void 0:a[e])||o;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,ZN(i,...t)]}function ZN(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function eR(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function uf(...e){return t=>e.forEach(n=>eR(n,t))}function et(...e){return m.useCallback(uf(...e),e)}const ro=m.forwardRef((e,t)=>{const{children:n,...r}=e,i=m.Children.toArray(n),o=i.find(tR);if(o){const s=o.props.children,a=i.map(l=>l===o?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(Om,ae({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(Om,ae({},r,{ref:t}),n)});ro.displayName="Slot";const Om=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...nR(r,n.props),ref:t?uf(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});Om.displayName="SlotClone";const Xw=({children:e})=>m.createElement(m.Fragment,null,e);function tR(e){return m.isValidElement(e)&&e.type===Xw}function nR(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{o(...a),i(...a)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function df(e){const t=e+"CollectionProvider",[n,r]=kn(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:v,children:y}=p,x=m.useRef(null),w=m.useRef(new Map).current;return m.createElement(i,{scope:v,itemMap:w,collectionRef:x},y)},a=e+"CollectionSlot",l=m.forwardRef((p,v)=>{const{scope:y,children:x}=p,w=o(a,y),S=et(v,w.collectionRef);return m.createElement(ro,{ref:S},x)}),c=e+"CollectionItemSlot",d="data-radix-collection-item",f=m.forwardRef((p,v)=>{const{scope:y,children:x,...w}=p,S=m.useRef(null),C=et(v,S),P=o(c,y);return m.useEffect(()=>(P.itemMap.set(S,{ref:S,...w}),()=>void P.itemMap.delete(S))),m.createElement(ro,{[d]:"",ref:C},x)});function g(p){const v=o(e+"CollectionConsumer",p);return m.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((P,O)=>w.indexOf(P.ref.current)-w.indexOf(O.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},g,r]}const Hn=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},rR=de.useId||(()=>{});let iR=0;function sr(e){const[t,n]=de.useState(rR());return Hn(()=>{e||n(r=>r??String(iR++))},[e]),e||(t?`radix-${t}`:"")}const Ve=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce((e,t)=>{const n=m.forwardRef((r,i)=>{const{asChild:o,...s}=r,a=o?ro:t;return m.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),m.createElement(a,ae({},s,{ref:i}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Qw(e,t){e&&Mt.flushSync(()=>e.dispatchEvent(t))}function wn(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function Jn({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=oR({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=wn(n),l=m.useCallback(c=>{if(o){const f=typeof c=="function"?c(e):c;f!==e&&a(f)}else i(c)},[o,e,i,a]);return[s,l]}function oR({defaultProp:e,onChange:t}){const n=m.useState(e),[r]=n,i=m.useRef(r),o=wn(t);return m.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}const sR=m.createContext(void 0);function js(e){const t=m.useContext(sR);return e||t||"ltr"}const Pm="rovingFocusGroup.onEntryFocus",aR={bubbles:!1,cancelable:!0},km="RovingFocusGroup",[Mm,Jw,lR]=df(km),[cR,ol]=kn(km,[lR]),[uR,dR]=cR(km),fR=m.forwardRef((e,t)=>m.createElement(Mm.Provider,{scope:e.__scopeRovingFocusGroup},m.createElement(Mm.Slot,{scope:e.__scopeRovingFocusGroup},m.createElement(hR,ae({},e,{ref:t}))))),hR=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,...d}=e,f=m.useRef(null),g=et(t,f),p=js(o),[v=null,y]=Jn({prop:s,defaultProp:a,onChange:l}),[x,w]=m.useState(!1),S=wn(c),C=Jw(n),P=m.useRef(!1),[O,k]=m.useState(0);return m.useEffect(()=>{const A=f.current;if(A)return A.addEventListener(Pm,S),()=>A.removeEventListener(Pm,S)},[S]),m.createElement(uR,{scope:n,orientation:r,dir:p,loop:i,currentTabStopId:v,onItemFocus:m.useCallback(A=>y(A),[y]),onItemShiftTab:m.useCallback(()=>w(!0),[]),onFocusableItemAdd:m.useCallback(()=>k(A=>A+1),[]),onFocusableItemRemove:m.useCallback(()=>k(A=>A-1),[])},m.createElement(Ve.div,ae({tabIndex:x||O===0?-1:0,"data-orientation":r},d,{ref:g,style:{outline:"none",...e.style},onMouseDown:Ee(e.onMouseDown,()=>{P.current=!0}),onFocus:Ee(e.onFocus,A=>{const L=!P.current;if(A.target===A.currentTarget&&L&&!x){const F=new CustomEvent(Pm,aR);if(A.currentTarget.dispatchEvent(F),!F.defaultPrevented){const j=C().filter($=>$.focusable),B=j.find($=>$.active),H=j.find($=>$.id===v),Y=[B,H,...j].filter(Boolean).map($=>$.ref.current);Zw(Y)}}P.current=!1}),onBlur:Ee(e.onBlur,()=>w(!1))})))}),pR="RovingFocusGroupItem",gR=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=e,a=sr(),l=o||a,c=dR(pR,n),d=c.currentTabStopId===l,f=Jw(n),{onFocusableItemAdd:g,onFocusableItemRemove:p}=c;return m.useEffect(()=>{if(r)return g(),()=>p()},[r,g,p]),m.createElement(Mm.ItemSlot,{scope:n,id:l,focusable:r,active:i},m.createElement(Ve.span,ae({tabIndex:d?0:-1,"data-orientation":c.orientation},s,{ref:t,onMouseDown:Ee(e.onMouseDown,v=>{r?c.onItemFocus(l):v.preventDefault()}),onFocus:Ee(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:Ee(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){c.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=bR(v,c.orientation,c.dir);if(y!==void 0){v.preventDefault();let w=f().filter(S=>S.focusable).map(S=>S.ref.current);if(y==="last")w.reverse();else if(y==="prev"||y==="next"){y==="prev"&&w.reverse();const S=w.indexOf(v.currentTarget);w=c.loop?yR(w,S+1):w.slice(S+1)}setTimeout(()=>Zw(w))}})})))}),mR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function vR(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function bR(e,t,n){const r=vR(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return mR[r]}function Zw(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function yR(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const Dm=fR,Tm=gR;function xR(e,t){return m.useReducer((n,r)=>{const i=t[n][r];return i??n},e)}const bn=e=>{const{present:t,children:n}=e,r=wR(t),i=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),o=et(r.ref,i.ref);return typeof n=="function"||r.isPresent?m.cloneElement(i,{ref:o}):null};bn.displayName="Presence";function wR(e){const[t,n]=m.useState(),r=m.useRef({}),i=m.useRef(e),o=m.useRef("none"),s=e?"mounted":"unmounted",[a,l]=xR(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=ff(r.current);o.current=a==="mounted"?c:"none"},[a]),Hn(()=>{const c=r.current,d=i.current;if(d!==e){const g=o.current,p=ff(c);e?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&g!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Hn(()=>{if(t){const c=f=>{const p=ff(r.current).includes(f.animationName);f.target===t&&p&&Mt.flushSync(()=>l("ANIMATION_END"))},d=f=>{f.target===t&&(o.current=ff(r.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function ff(e){return(e==null?void 0:e.animationName)||"none"}const e_="Tabs",[_R,Pde]=kn(e_,[ol]),t_=ol(),[SR,Am]=_R(e_),CR=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,d=js(a),[f,g]=Jn({prop:r,onChange:i,defaultProp:o});return m.createElement(SR,{scope:n,baseId:sr(),value:f,onValueChange:g,orientation:s,dir:d,activationMode:l},m.createElement(Ve.div,ae({dir:d,"data-orientation":s},c,{ref:t})))}),ER="TabsList",OR=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=Am(ER,n),s=t_(n);return m.createElement(Dm,ae({asChild:!0},s,{orientation:o.orientation,dir:o.dir,loop:r}),m.createElement(Ve.div,ae({role:"tablist","aria-orientation":o.orientation},i,{ref:t})))}),PR="TabsTrigger",kR=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=Am(PR,n),a=t_(n),l=n_(s.baseId,r),c=r_(s.baseId,r),d=r===s.value;return m.createElement(Tm,ae({asChild:!0},a,{focusable:!i,active:d}),m.createElement(Ve.button,ae({type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l},o,{ref:t,onMouseDown:Ee(e.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Ee(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Ee(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!i&&f&&s.onValueChange(r)})})))}),MR="TabsContent",DR=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=Am(MR,n),l=n_(a.baseId,r),c=r_(a.baseId,r),d=r===a.value,f=m.useRef(d);return m.useEffect(()=>{const g=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(g)},[]),m.createElement(bn,{present:i||d},({present:g})=>m.createElement(Ve.div,ae({"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!g,id:c,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0}}),g&&o))});function n_(e,t){return`${e}-trigger-${t}`}function r_(e,t){return`${e}-content-${t}`}const TR=CR,i_=OR,o_=kR,s_=DR,a_=TR,l_=de.forwardRef(({className:e,...t},n)=>_.jsx(i_,{ref:n,className:Pe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));l_.displayName=i_.displayName;const Im=de.forwardRef(({className:e,...t},n)=>_.jsx(o_,{ref:n,className:Pe("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Im.displayName=o_.displayName;const hf=de.forwardRef(({className:e,...t},n)=>_.jsx(s_,{ref:n,className:Pe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));hf.displayName=s_.displayName;var c_={exports:{}},Fc={},Nm={exports:{}};(function(e,t){(function(n,r){r(t)})(Lo,function(n){function r(re){return function(oe,xe,V,Me,$e,He,Fe){return re(oe,xe,Fe)}}function i(re){return function(oe,xe,V,Me){if(!oe||!xe||typeof oe!="object"||typeof xe!="object")return re(oe,xe,V,Me);var $e=Me.get(oe),He=Me.get(xe);if($e&&He)return $e===xe&&He===oe;Me.set(oe,xe),Me.set(xe,oe);var Fe=re(oe,xe,V,Me);return Me.delete(oe),Me.delete(xe),Fe}}function o(re,ee){var oe={};for(var xe in re)oe[xe]=re[xe];for(var xe in ee)oe[xe]=ee[xe];return oe}function s(re){return re.constructor===Object||re.constructor==null}function a(re){return typeof re.then=="function"}function l(re,ee){return re===ee||re!==re&&ee!==ee}var c="[object Arguments]",d="[object Boolean]",f="[object Date]",g="[object RegExp]",p="[object Map]",v="[object Number]",y="[object Object]",x="[object Set]",w="[object String]",S=Object.prototype.toString;function C(re){var ee=re.areArraysEqual,oe=re.areDatesEqual,xe=re.areMapsEqual,V=re.areObjectsEqual,Me=re.areRegExpsEqual,$e=re.areSetsEqual,He=re.createIsNestedEqual,Fe=He(xt);function xt(ht,pt,Bt){if(ht===pt)return!0;if(!ht||!pt||typeof ht!="object"||typeof pt!="object")return ht!==ht&&pt!==pt;if(s(ht)&&s(pt))return V(ht,pt,Fe,Bt);var Ot=Array.isArray(ht),tn=Array.isArray(pt);if(Ot||tn)return Ot===tn&&ee(ht,pt,Fe,Bt);var nn=S.call(ht);return nn!==S.call(pt)?!1:nn===f?oe(ht,pt,Fe,Bt):nn===g?Me(ht,pt,Fe,Bt):nn===p?xe(ht,pt,Fe,Bt):nn===x?$e(ht,pt,Fe,Bt):nn===y||nn===c?a(ht)||a(pt)?!1:V(ht,pt,Fe,Bt):nn===d||nn===v||nn===w?l(ht.valueOf(),pt.valueOf()):!1}return xt}function P(re,ee,oe,xe){var V=re.length;if(ee.length!==V)return!1;for(;V-- >0;)if(!oe(re[V],ee[V],V,V,re,ee,xe))return!1;return!0}var O=i(P);function k(re,ee){return l(re.valueOf(),ee.valueOf())}function A(re,ee,oe,xe){var V=re.size===ee.size;if(!V)return!1;if(!re.size)return!0;var Me={},$e=0;return re.forEach(function(He,Fe){if(V){var xt=!1,ht=0;ee.forEach(function(pt,Bt){!xt&&!Me[ht]&&(xt=oe(Fe,Bt,$e,ht,re,ee,xe)&&oe(He,pt,Fe,Bt,re,ee,xe))&&(Me[ht]=!0),ht++}),$e++,V=xt}}),V}var L=i(A),F="_owner",j=Object.prototype.hasOwnProperty;function B(re,ee,oe,xe){var V=Object.keys(re),Me=V.length;if(Object.keys(ee).length!==Me)return!1;for(var $e;Me-- >0;){if($e=V[Me],$e===F){var He=!!re.$$typeof,Fe=!!ee.$$typeof;if((He||Fe)&&He!==Fe)return!1}if(!j.call(ee,$e)||!oe(re[$e],ee[$e],$e,$e,re,ee,xe))return!1}return!0}var H=i(B);function K(re,ee){return re.source===ee.source&&re.flags===ee.flags}function Y(re,ee,oe,xe){var V=re.size===ee.size;if(!V)return!1;if(!re.size)return!0;var Me={};return re.forEach(function($e,He){if(V){var Fe=!1,xt=0;ee.forEach(function(ht,pt){!Fe&&!Me[xt]&&(Fe=oe($e,ht,He,pt,re,ee,xe))&&(Me[xt]=!0),xt++}),V=Fe}}),V}var $=i(Y),Z=Object.freeze({areArraysEqual:P,areDatesEqual:k,areMapsEqual:A,areObjectsEqual:B,areRegExpsEqual:K,areSetsEqual:Y,createIsNestedEqual:r}),U=Object.freeze({areArraysEqual:O,areDatesEqual:k,areMapsEqual:L,areObjectsEqual:H,areRegExpsEqual:K,areSetsEqual:$,createIsNestedEqual:r}),ie=C(Z);function le(re,ee){return ie(re,ee,void 0)}var M=C(o(Z,{createIsNestedEqual:function(){return l}}));function W(re,ee){return M(re,ee,void 0)}var ne=C(U);function N(re,ee){return ne(re,ee,new WeakMap)}var X=C(o(U,{createIsNestedEqual:function(){return l}}));function me(re,ee){return X(re,ee,new WeakMap)}function he(re){return C(o(Z,re(Z)))}function fe(re){var ee=C(o(U,re(U)));return function(oe,xe,V){return V===void 0&&(V=new WeakMap),ee(oe,xe,V)}}n.circularDeepEqual=N,n.circularShallowEqual=me,n.createCustomCircularEqual=fe,n.createCustomEqual=he,n.deepEqual=le,n.sameValueZeroEqual=l,n.shallowEqual=W,Object.defineProperty(n,"__esModule",{value:!0})})})(Nm,Nm.exports);var Rm=Nm.exports;const Lm=Kg(a3);var vt={},AR=function(t,n,r){return t===n?!0:t.className===n.className&&r(t.style,n.style)&&t.width===n.width&&t.autoSize===n.autoSize&&t.cols===n.cols&&t.draggableCancel===n.draggableCancel&&t.draggableHandle===n.draggableHandle&&r(t.verticalCompact,n.verticalCompact)&&r(t.compactType,n.compactType)&&r(t.layout,n.layout)&&r(t.margin,n.margin)&&r(t.containerPadding,n.containerPadding)&&t.rowHeight===n.rowHeight&&t.maxRows===n.maxRows&&t.isBounded===n.isBounded&&t.isDraggable===n.isDraggable&&t.isResizable===n.isResizable&&t.allowOverlap===n.allowOverlap&&t.preventCollision===n.preventCollision&&t.useCSSTransforms===n.useCSSTransforms&&t.transformScale===n.transformScale&&t.isDroppable===n.isDroppable&&r(t.resizeHandles,n.resizeHandles)&&r(t.resizeHandle,n.resizeHandle)&&t.onLayoutChange===n.onLayoutChange&&t.onDragStart===n.onDragStart&&t.onDrag===n.onDrag&&t.onDragStop===n.onDragStop&&t.onResizeStart===n.onResizeStart&&t.onResize===n.onResize&&t.onResizeStop===n.onResizeStop&&t.onDrop===n.onDrop&&r(t.droppingItem,n.droppingItem)&&r(t.innerRef,n.innerRef)};Object.defineProperty(vt,"__esModule",{value:!0}),vt.bottom=$m,vt.childrenEqual=LR,vt.cloneLayout=d_,vt.cloneLayoutItem=zs,vt.collides=pf,vt.compact=h_,vt.compactItem=p_,vt.compactType=UR,vt.correctBounds=g_,vt.fastPositionEqual=FR,vt.fastRGLPropsEqual=void 0,vt.getAllCollisions=m_,vt.getFirstCollision=Bs,vt.getLayoutItem=jm,vt.getStatics=zm,vt.modifyLayout=f_,vt.moveElement=zc,vt.moveElementAwayFromCollision=Bm,vt.noop=void 0,vt.perc=zR,vt.resizeItemInDirection=VR,vt.setTopLeft=WR,vt.setTransform=HR,vt.sortLayoutItems=Gm,vt.sortLayoutItemsByColRow=w_,vt.sortLayoutItemsByRowCol=x_,vt.synchronizeLayoutWithChildren=qR,vt.validateLayout=__,vt.withLayoutItem=RR;var u_=Rm,jc=IR(m);function IR(e){return e&&e.__esModule?e:{default:e}}const NR=process.env.NODE_ENV==="production";function $m(e){let t=0,n;for(let r=0,i=e.length;r<i;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function d_(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=zs(e[n]);return t}function f_(e,t){const n=Array(e.length);for(let r=0,i=e.length;r<i;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function RR(e,t,n){let r=jm(e,t);return r?(r=n(zs(r)),e=f_(e,r),[e,r]):[e,null]}function zs(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function LR(e,t){return(0,u_.deepEqual)(jc.default.Children.map(e,n=>n==null?void 0:n.key),jc.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,u_.deepEqual)(jc.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),jc.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}const $R=AR;vt.fastRGLPropsEqual=$R;function FR(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function pf(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function h_(e,t,n,r){const i=zm(e),o=Gm(e,t),s=Array(e.length);for(let a=0,l=o.length;a<l;a++){let c=zs(o[a]);c.static||(c=p_(i,c,t,n,o,r),i.push(c)),s[e.indexOf(o[a])]=c,c.moved=!1}return s}const jR={x:"w",y:"h"};function Fm(e,t,n,r){const i=jR[r];t[r]+=1;const o=e.map(s=>s.i).indexOf(t.i);for(let s=o+1;s<e.length;s++){const a=e[s];if(!a.static){if(a.y>t.y+t.h)break;pf(t,a)&&Fm(e,a,n+t[i],r)}}t[r]=n}function p_(e,t,n,r,i,o){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min($m(e),t.y);t.y>0&&!Bs(e,t);)t.y--;else if(a)for(;t.x>0&&!Bs(e,t);)t.x--;let l;for(;(l=Bs(e,t))&&!(n===null&&o);)if(a?Fm(i,t,l.x+l.w,"x"):Fm(i,t,l.y+l.h,"y"),a&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!Bs(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function g_(e,t){const n=zm(e);for(let r=0,i=e.length;r<i;r++){const o=e[r];if(o.x+o.w>t.cols&&(o.x=t.cols-o.w),o.x<0&&(o.x=0,o.w=t.cols),!o.static)n.push(o);else for(;Bs(n,o);)o.y++}return e}function jm(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function Bs(e,t){for(let n=0,r=e.length;n<r;n++)if(pf(e[n],t))return e[n]}function m_(e,t){return e.filter(n=>pf(n,t))}function zm(e){return e.filter(t=>t.static)}function zc(e,t,n,r,i,o,s,a,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;"Moving element ".concat(t.i," to [").concat(String(n),",").concat(String(r),"] from [").concat(t.x,",").concat(t.y,"]");const c=t.x,d=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let f=Gm(e,s);(s==="vertical"&&typeof r=="number"?d>=r:s==="horizontal"&&typeof n=="number"?c>=n:!1)&&(f=f.reverse());const p=m_(f,t),v=p.length>0;if(v&&l)return d_(e);if(v&&o)return"Collision prevented on ".concat(t.i,", reverting."),t.x=c,t.y=d,t.moved=!1,e;for(let y=0,x=p.length;y<x;y++){const w=p[y];"Resolving collision between ".concat(t.i," at [").concat(t.x,",").concat(t.y,"] and ").concat(w.i," at [").concat(w.x,",").concat(w.y,"]"),!w.moved&&(w.static?e=Bm(e,w,t,i,s):e=Bm(e,t,w,i,s))}return e}function Bm(e,t,n,r,i,o){const s=i==="horizontal",a=i==="vertical",l=t.static;if(r){r=!1;const f={x:s?Math.max(t.x-n.w,0):n.x,y:a?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},g=Bs(e,f),p=g&&g.y+g.h>t.y,v=g&&t.x+t.w>g.x;if(g){if(p&&a)return zc(e,n,void 0,t.y+1,r,l,i);if(p&&i==null)return t.y=n.y,n.y=n.y+n.h,e;if(v&&s)return zc(e,t,n.x,void 0,r,l,i)}else return"Doing reverse collision on ".concat(n.i," up to [").concat(f.x,",").concat(f.y,"]."),zc(e,n,s?f.x:void 0,a?f.y:void 0,r,l,i)}const c=s?n.x+1:void 0,d=a?n.y+1:void 0;return c==null&&d==null?e:zc(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,i)}function zR(e){return e*100+"%"}const v_=(e,t,n,r)=>e+n>r?t:n,b_=(e,t,n)=>e<0?t:n,y_=e=>Math.max(0,e),Vm=e=>Math.max(0,e),Hm=(e,t,n)=>{let{left:r,height:i,width:o}=t;const s=e.top-(i-e.height);return{left:r,width:o,height:b_(s,e.height,i),top:Vm(s)}},Wm=(e,t,n)=>{let{top:r,left:i,height:o,width:s}=t;return{top:r,height:o,width:v_(e.left,e.width,s,n),left:y_(i)}},qm=(e,t,n)=>{let{top:r,height:i,width:o}=t;const s=e.left-(o-e.width);return{height:i,width:s<0?e.width:v_(e.left,e.width,o,n),top:Vm(r),left:y_(s)}},Um=(e,t,n)=>{let{top:r,left:i,height:o,width:s}=t;return{width:s,left:i,height:b_(r,e.height,o),top:Vm(r)}},BR={n:Hm,ne:function(){return Hm(arguments.length<=0?void 0:arguments[0],Wm(...arguments))},e:Wm,se:function(){return Um(arguments.length<=0?void 0:arguments[0],Wm(...arguments))},s:Um,sw:function(){return Um(arguments.length<=0?void 0:arguments[0],qm(...arguments))},w:qm,nw:function(){return Hm(arguments.length<=0?void 0:arguments[0],qm(...arguments))}};function VR(e,t,n,r){const i=BR[e];return i?i(t,{...t,...n},r):n}function HR(e){let{top:t,left:n,width:r,height:i}=e;const o="translate(".concat(n,"px,").concat(t,"px)");return{transform:o,WebkitTransform:o,MozTransform:o,msTransform:o,OTransform:o,width:"".concat(r,"px"),height:"".concat(i,"px"),position:"absolute"}}function WR(e){let{top:t,left:n,width:r,height:i}=e;return{top:"".concat(t,"px"),left:"".concat(n,"px"),width:"".concat(r,"px"),height:"".concat(i,"px"),position:"absolute"}}function Gm(e,t){return t==="horizontal"?w_(e):t==="vertical"?x_(e):e}function x_(e){return e.slice(0).sort(function(t,n){return t.y>n.y||t.y===n.y&&t.x>n.x?1:t.y===n.y&&t.x===n.x?0:-1})}function w_(e){return e.slice(0).sort(function(t,n){return t.x>n.x||t.x===n.x&&t.y>n.y?1:-1})}function qR(e,t,n,r,i){e=e||[];const o=[];jc.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=jm(e,String(a.key)),c=a.props["data-grid"];l&&c==null?o.push(zs(l)):c?(NR||__([c],"ReactGridLayout.children"),o.push(zs({...c,i:a.key}))):o.push(zs({w:1,h:1,x:0,y:$m(o),i:String(a.key)}))});const s=g_(o,{cols:n});return i?s:h_(s,r,n)}function __(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,i=e.length;r<i;r++){const o=e[r];for(let s=0;s<n.length;s++)if(typeof o[n[s]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[s]+" must be a number!")}}function UR(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}function Ade(){}const GR=()=>{};vt.noop=GR;var Mi={};Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.calcGridColWidth=gf,Mi.calcGridItemPosition=YR,Mi.calcGridItemWHPx=Ym,Mi.calcWH=XR,Mi.calcXY=KR,Mi.clamp=Vs;function gf(e){const{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function Ym(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function YR(e,t,n,r,i,o){const{margin:s,containerPadding:a,rowHeight:l}=e,c=gf(e),d={};return o&&o.resizing?(d.width=Math.round(o.resizing.width),d.height=Math.round(o.resizing.height)):(d.width=Ym(r,c,s[0]),d.height=Ym(i,l,s[1])),o&&o.dragging?(d.top=Math.round(o.dragging.top),d.left=Math.round(o.dragging.left)):o&&o.resizing&&typeof o.resizing.top=="number"&&typeof o.resizing.left=="number"?(d.top=Math.round(o.resizing.top),d.left=Math.round(o.resizing.left)):(d.top=Math.round((l+s[1])*n+a[1]),d.left=Math.round((c+s[0])*t+a[0])),d}function KR(e,t,n,r,i){const{margin:o,cols:s,rowHeight:a,maxRows:l}=e,c=gf(e);let d=Math.round((n-o[0])/(c+o[0])),f=Math.round((t-o[1])/(a+o[1]));return d=Vs(d,0,s-r),f=Vs(f,0,l-i),{x:d,y:f}}function XR(e,t,n,r,i,o){const{margin:s,maxRows:a,cols:l,rowHeight:c}=e,d=gf(e);let f=Math.round((t+s[0])/(d+s[0])),g=Math.round((n+s[1])/(c+s[1])),p=Vs(f,0,l-r),v=Vs(g,0,a-i);return["sw","w","nw"].indexOf(o)!==-1&&(p=Vs(f,0,l)),["nw","n","ne"].indexOf(o)!==-1&&(v=Vs(g,0,a)),{w:p,h:v}}function Vs(e,t,n){return Math.max(Math.min(e,n),t)}var mf={},Km={exports:{}},Xm,S_;function Qm(){if(S_)return Xm;S_=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Xm=e,Xm}var Jm,C_;function QR(){if(C_)return Jm;C_=1;var e=Qm();function t(){}function n(){}return n.resetWarningCache=t,Jm=function(){function r(s,a,l,c,d,f){if(f!==e){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},Jm}var vf={exports:{}},It={};/** @license React v16.13.1
85
+ }`;var gt=e3(function(){return At(R,je+"return "+we).apply(n,z)});if(gt.source=we,M1(gt))throw gt;return gt}function Due(u){return $t(u).toLowerCase()}function Tue(u){return $t(u).toUpperCase()}function Aue(u,h,b){if(u=$t(u),u&&(b||h===n))return c5(u);if(!u||!(h=Ur(h)))return u;var E=Ei(u),T=Ei(h),R=u5(E,T),z=d5(E,T)+1;return Ms(E,R,z).join("")}function Iue(u,h,b){if(u=$t(u),u&&(b||h===n))return u.slice(0,h5(u)+1);if(!u||!(h=Ur(h)))return u;var E=Ei(u),T=d5(E,Ei(h))+1;return Ms(E,0,T).join("")}function Nue(u,h,b){if(u=$t(u),u&&(b||h===n))return u.replace(Ha,"");if(!u||!(h=Ur(h)))return u;var E=Ei(u),T=u5(E,Ei(h));return Ms(E,T).join("")}function Rue(u,h){var b=j,E=B;if(ln(h)){var T="separator"in h?h.separator:T;b="length"in h?ut(h.length):b,E="omission"in h?Ur(h.omission):E}u=$t(u);var R=u.length;if(gc(u)){var z=Ei(u);R=z.length}if(b>=R)return u;var q=b-mc(E);if(q<1)return E;var te=z?Ms(z,0,q).join(""):u.slice(0,q);if(T===n)return te+E;if(z&&(q+=te.length-q),D1(T)){if(u.slice(q).search(T)){var ve,be=te;for(T.global||(T=Ux(T.source,$t(ze.exec(T))+"g")),T.lastIndex=0;ve=T.exec(be);)var we=ve.index;te=te.slice(0,we===n?q:we)}}else if(u.indexOf(Ur(T),q)!=q){var Te=te.lastIndexOf(T);Te>-1&&(te=te.slice(0,Te))}return te+E}function Lue(u){return u=$t(u),u&&Eo.test(u)?u.replace(Kn,doe):u}var $ue=Sc(function(u,h,b){return u+(b?" ":"")+h.toUpperCase()}),I1=tI("toUpperCase");function ZI(u,h,b){return u=$t(u),h=b?n:h,h===n?soe(u)?poe(u):Qie(u):u.match(h)||[]}var e3=mt(function(u,h){try{return Wr(u,n,h)}catch(b){return M1(b)?b:new Ze(b)}}),Fue=Do(function(u,h){return li(h,function(b){b=no(b),ko(u,b,P1(u[b],u))}),u});function jue(u){var h=u==null?0:u.length,b=We();return u=h?sn(u,function(E){if(typeof E[1]!="function")throw new ci(s);return[b(E[0]),E[1]]}):[],mt(function(E){for(var T=-1;++T<h;){var R=u[T];if(Wr(R[0],this,E))return Wr(R[1],this,E)}})}function zue(u){return dse(di(u,f))}function N1(u){return function(){return u}}function Bue(u,h){return u==null||u!==u?h:u}var Vue=rI(),Hue=rI(!0);function wr(u){return u}function R1(u){return I5(typeof u=="function"?u:di(u,f))}function Wue(u){return R5(di(u,f))}function que(u,h){return L5(u,di(h,f))}var Uue=mt(function(u,h){return function(b){return jd(b,u,h)}}),Gue=mt(function(u,h){return function(b){return jd(u,b,h)}});function L1(u,h,b){var E=An(h),T=Pg(h,E);b==null&&!(ln(h)&&(T.length||!E.length))&&(b=h,h=u,u=this,T=Pg(h,An(h)));var R=!(ln(b)&&"chain"in b)||!!b.chain,z=Ao(u);return li(T,function(q){var te=h[q];u[q]=te,z&&(u.prototype[q]=function(){var ve=this.__chain__;if(R||ve){var be=u(this.__wrapped__),we=be.__actions__=br(this.__actions__);return we.push({func:te,args:arguments,thisArg:u}),be.__chain__=ve,be}return te.apply(u,Ss([this.value()],arguments))})}),u}function Yue(){return Bn._===this&&(Bn._=xoe),this}function $1(){}function Kue(u){return u=ut(u),mt(function(h){return $5(h,u)})}var Xue=p1(sn),Que=p1(i5),Jue=p1(jx);function t3(u){return w1(u)?zx(no(u)):kse(u)}function Zue(u){return function(h){return u==null?n:Xa(u,h)}}var ede=oI(),tde=oI(!0);function F1(){return[]}function j1(){return!1}function nde(){return{}}function rde(){return""}function ide(){return!0}function ode(u,h){if(u=ut(u),u<1||u>ie)return[];var b=W,E=Xn(u,W);h=We(h),u-=W;for(var T=Hx(E,h);++b<u;)h(b);return T}function sde(u){return rt(u)?sn(u,no):Gr(u)?[u]:br(wI($t(u)))}function ade(u){var h=++boe;return $t(u)+h}var lde=Ig(function(u,h){return u+h},0),cde=g1("ceil"),ude=Ig(function(u,h){return u/h},1),dde=g1("floor");function fde(u){return u&&u.length?Og(u,wr,e1):n}function hde(u,h){return u&&u.length?Og(u,We(h,2),e1):n}function pde(u){return a5(u,wr)}function gde(u,h){return a5(u,We(h,2))}function mde(u){return u&&u.length?Og(u,wr,i1):n}function vde(u,h){return u&&u.length?Og(u,We(h,2),i1):n}var bde=Ig(function(u,h){return u*h},1),yde=g1("round"),xde=Ig(function(u,h){return u-h},0);function wde(u){return u&&u.length?Vx(u,wr):0}function _de(u,h){return u&&u.length?Vx(u,We(h,2)):0}return I.after=Wle,I.ary=AI,I.assign=Tce,I.assignIn=UI,I.assignInWith=Ug,I.assignWith=Ace,I.at=Ice,I.before=II,I.bind=P1,I.bindAll=Fue,I.bindKey=NI,I.castArray=nce,I.chain=MI,I.chunk=dae,I.compact=fae,I.concat=hae,I.cond=jue,I.conforms=zue,I.constant=N1,I.countBy=wle,I.create=Nce,I.curry=RI,I.curryRight=LI,I.debounce=$I,I.defaults=Rce,I.defaultsDeep=Lce,I.defer=qle,I.delay=Ule,I.difference=pae,I.differenceBy=gae,I.differenceWith=mae,I.drop=vae,I.dropRight=bae,I.dropRightWhile=yae,I.dropWhile=xae,I.fill=wae,I.filter=Sle,I.flatMap=Ole,I.flatMapDeep=Ple,I.flatMapDepth=kle,I.flatten=EI,I.flattenDeep=_ae,I.flattenDepth=Sae,I.flip=Gle,I.flow=Vue,I.flowRight=Hue,I.fromPairs=Cae,I.functions=Hce,I.functionsIn=Wce,I.groupBy=Mle,I.initial=Oae,I.intersection=Pae,I.intersectionBy=kae,I.intersectionWith=Mae,I.invert=Uce,I.invertBy=Gce,I.invokeMap=Tle,I.iteratee=R1,I.keyBy=Ale,I.keys=An,I.keysIn=xr,I.map=zg,I.mapKeys=Kce,I.mapValues=Xce,I.matches=Wue,I.matchesProperty=que,I.memoize=Vg,I.merge=Qce,I.mergeWith=GI,I.method=Uue,I.methodOf=Gue,I.mixin=L1,I.negate=Hg,I.nthArg=Kue,I.omit=Jce,I.omitBy=Zce,I.once=Yle,I.orderBy=Ile,I.over=Xue,I.overArgs=Kle,I.overEvery=Que,I.overSome=Jue,I.partial=k1,I.partialRight=FI,I.partition=Nle,I.pick=eue,I.pickBy=YI,I.property=t3,I.propertyOf=Zue,I.pull=Iae,I.pullAll=PI,I.pullAllBy=Nae,I.pullAllWith=Rae,I.pullAt=Lae,I.range=ede,I.rangeRight=tde,I.rearg=Xle,I.reject=$le,I.remove=$ae,I.rest=Qle,I.reverse=E1,I.sampleSize=jle,I.set=nue,I.setWith=rue,I.shuffle=zle,I.slice=Fae,I.sortBy=Hle,I.sortedUniq=qae,I.sortedUniqBy=Uae,I.split=Oue,I.spread=Jle,I.tail=Gae,I.take=Yae,I.takeRight=Kae,I.takeRightWhile=Xae,I.takeWhile=Qae,I.tap=fle,I.throttle=Zle,I.thru=jg,I.toArray=HI,I.toPairs=KI,I.toPairsIn=XI,I.toPath=sde,I.toPlainObject=qI,I.transform=iue,I.unary=ece,I.union=Jae,I.unionBy=Zae,I.unionWith=ele,I.uniq=tle,I.uniqBy=nle,I.uniqWith=rle,I.unset=oue,I.unzip=O1,I.unzipWith=kI,I.update=sue,I.updateWith=aue,I.values=Oc,I.valuesIn=lue,I.without=ile,I.words=ZI,I.wrap=tce,I.xor=ole,I.xorBy=sle,I.xorWith=ale,I.zip=lle,I.zipObject=cle,I.zipObjectDeep=ule,I.zipWith=dle,I.entries=KI,I.entriesIn=XI,I.extend=UI,I.extendWith=Ug,L1(I,I),I.add=lde,I.attempt=e3,I.camelCase=fue,I.capitalize=QI,I.ceil=cde,I.clamp=cue,I.clone=rce,I.cloneDeep=oce,I.cloneDeepWith=sce,I.cloneWith=ice,I.conformsTo=ace,I.deburr=JI,I.defaultTo=Bue,I.divide=ude,I.endsWith=hue,I.eq=Pi,I.escape=pue,I.escapeRegExp=gue,I.every=_le,I.find=Cle,I.findIndex=SI,I.findKey=$ce,I.findLast=Ele,I.findLastIndex=CI,I.findLastKey=Fce,I.floor=dde,I.forEach=DI,I.forEachRight=TI,I.forIn=jce,I.forInRight=zce,I.forOwn=Bce,I.forOwnRight=Vce,I.get=T1,I.gt=lce,I.gte=cce,I.has=qce,I.hasIn=A1,I.head=OI,I.identity=wr,I.includes=Dle,I.indexOf=Eae,I.inRange=uue,I.invoke=Yce,I.isArguments=Za,I.isArray=rt,I.isArrayBuffer=uce,I.isArrayLike=yr,I.isArrayLikeObject=mn,I.isBoolean=dce,I.isBuffer=Ds,I.isDate=fce,I.isElement=hce,I.isEmpty=pce,I.isEqual=gce,I.isEqualWith=mce,I.isError=M1,I.isFinite=vce,I.isFunction=Ao,I.isInteger=jI,I.isLength=Wg,I.isMap=zI,I.isMatch=bce,I.isMatchWith=yce,I.isNaN=xce,I.isNative=wce,I.isNil=Sce,I.isNull=_ce,I.isNumber=BI,I.isObject=ln,I.isObjectLike=dn,I.isPlainObject=qd,I.isRegExp=D1,I.isSafeInteger=Cce,I.isSet=VI,I.isString=qg,I.isSymbol=Gr,I.isTypedArray=Ec,I.isUndefined=Ece,I.isWeakMap=Oce,I.isWeakSet=Pce,I.join=Dae,I.kebabCase=mue,I.last=hi,I.lastIndexOf=Tae,I.lowerCase=vue,I.lowerFirst=bue,I.lt=kce,I.lte=Mce,I.max=fde,I.maxBy=hde,I.mean=pde,I.meanBy=gde,I.min=mde,I.minBy=vde,I.stubArray=F1,I.stubFalse=j1,I.stubObject=nde,I.stubString=rde,I.stubTrue=ide,I.multiply=bde,I.nth=Aae,I.noConflict=Yue,I.noop=$1,I.now=Bg,I.pad=yue,I.padEnd=xue,I.padStart=wue,I.parseInt=_ue,I.random=due,I.reduce=Rle,I.reduceRight=Lle,I.repeat=Sue,I.replace=Cue,I.result=tue,I.round=yde,I.runInContext=Q,I.sample=Fle,I.size=Ble,I.snakeCase=Eue,I.some=Vle,I.sortedIndex=jae,I.sortedIndexBy=zae,I.sortedIndexOf=Bae,I.sortedLastIndex=Vae,I.sortedLastIndexBy=Hae,I.sortedLastIndexOf=Wae,I.startCase=Pue,I.startsWith=kue,I.subtract=xde,I.sum=wde,I.sumBy=_de,I.template=Mue,I.times=ode,I.toFinite=Io,I.toInteger=ut,I.toLength=WI,I.toLower=Due,I.toNumber=pi,I.toSafeInteger=Dce,I.toString=$t,I.toUpper=Tue,I.trim=Aue,I.trimEnd=Iue,I.trimStart=Nue,I.truncate=Rue,I.unescape=Lue,I.uniqueId=ade,I.upperCase=$ue,I.upperFirst=I1,I.each=DI,I.eachRight=TI,I.first=OI,L1(I,function(){var u={};return eo(I,function(h,b){jt.call(I.prototype,b)||(u[b]=h)}),u}(),{chain:!1}),I.VERSION=r,li(["bind","bindKey","curry","curryRight","partial","partialRight"],function(u){I[u].placeholder=I}),li(["drop","take"],function(u,h){Ct.prototype[u]=function(b){b=b===n?1:Pn(ut(b),0);var E=this.__filtered__&&!h?new Ct(this):this.clone();return E.__filtered__?E.__takeCount__=Xn(b,E.__takeCount__):E.__views__.push({size:Xn(b,W),type:u+(E.__dir__<0?"Right":"")}),E},Ct.prototype[u+"Right"]=function(b){return this.reverse()[u](b).reverse()}}),li(["filter","map","takeWhile"],function(u,h){var b=h+1,E=b==Y||b==Z;Ct.prototype[u]=function(T){var R=this.clone();return R.__iteratees__.push({iteratee:We(T,3),type:b}),R.__filtered__=R.__filtered__||E,R}}),li(["head","last"],function(u,h){var b="take"+(h?"Right":"");Ct.prototype[u]=function(){return this[b](1).value()[0]}}),li(["initial","tail"],function(u,h){var b="drop"+(h?"":"Right");Ct.prototype[u]=function(){return this.__filtered__?new Ct(this):this[b](1)}}),Ct.prototype.compact=function(){return this.filter(wr)},Ct.prototype.find=function(u){return this.filter(u).head()},Ct.prototype.findLast=function(u){return this.reverse().find(u)},Ct.prototype.invokeMap=mt(function(u,h){return typeof u=="function"?new Ct(this):this.map(function(b){return jd(b,u,h)})}),Ct.prototype.reject=function(u){return this.filter(Hg(We(u)))},Ct.prototype.slice=function(u,h){u=ut(u);var b=this;return b.__filtered__&&(u>0||h<0)?new Ct(b):(u<0?b=b.takeRight(-u):u&&(b=b.drop(u)),h!==n&&(h=ut(h),b=h<0?b.dropRight(-h):b.take(h-u)),b)},Ct.prototype.takeRightWhile=function(u){return this.reverse().takeWhile(u).reverse()},Ct.prototype.toArray=function(){return this.take(W)},eo(Ct.prototype,function(u,h){var b=/^(?:filter|find|map|reject)|While$/.test(h),E=/^(?:head|last)$/.test(h),T=I[E?"take"+(h=="last"?"Right":""):h],R=E||/^find/.test(h);T&&(I.prototype[h]=function(){var z=this.__wrapped__,q=E?[1]:arguments,te=z instanceof Ct,ve=q[0],be=te||rt(z),we=function(St){var Et=T.apply(I,Ss([St],q));return E&&Te?Et[0]:Et};be&&b&&typeof ve=="function"&&ve.length!=1&&(te=be=!1);var Te=this.__chain__,je=!!this.__actions__.length,qe=R&&!Te,gt=te&&!je;if(!R&&be){z=gt?z:new Ct(this);var Ue=u.apply(z,q);return Ue.__actions__.push({func:jg,args:[we],thisArg:n}),new ui(Ue,Te)}return qe&&gt?u.apply(this,q):(Ue=this.thru(we),qe?E?Ue.value()[0]:Ue.value():Ue)})}),li(["pop","push","shift","sort","splice","unshift"],function(u){var h=dg[u],b=/^(?:push|sort|unshift)$/.test(u)?"tap":"thru",E=/^(?:pop|shift)$/.test(u);I.prototype[u]=function(){var T=arguments;if(E&&!this.__chain__){var R=this.value();return h.apply(rt(R)?R:[],T)}return this[b](function(z){return h.apply(rt(z)?z:[],T)})}}),eo(Ct.prototype,function(u,h){var b=I[h];if(b){var E=b.name+"";jt.call(xc,E)||(xc[E]=[]),xc[E].push({name:h,func:b})}}),xc[Ag(n,w).name]=[{name:"wrapper",func:n}],Ct.prototype.clone=Loe,Ct.prototype.reverse=$oe,Ct.prototype.value=Foe,I.prototype.at=hle,I.prototype.chain=ple,I.prototype.commit=gle,I.prototype.next=mle,I.prototype.plant=ble,I.prototype.reverse=yle,I.prototype.toJSON=I.prototype.valueOf=I.prototype.value=xle,I.prototype.first=I.prototype.head,Ad&&(I.prototype[Ad]=vle),I},vc=goe();qa?((qa.exports=vc)._=vc,Rx._=vc):Bn._=vc}).call(Lo)}(lf,lf.exports);var YN=lf.exports;const Fs=Pc(YN),KN={theme:"system",setTheme:()=>null},Gw=m.createContext(KN);function XN({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[i,o]=m.useState(()=>localStorage.getItem(n)||t);m.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),i==="system"){const l=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(l);return}a.classList.add(i)},[i]);const s={theme:i,setTheme:a=>{localStorage.setItem(n,a),o(a)}};return _.jsx(Gw.Provider,{...r,value:s,children:e})}const Em=()=>{const e=m.useContext(Gw);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};async function QN(e,t){return await(await fetch(`https://semaphor.cloud/api/v1/dashboard?id=${e}`,{headers:{Authorization:`Bearer ${t}`}})).json()}function Yw(e,t){return e==="dark"?Fs.merge({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function JN(e,t,n,r,i,o){const{data:s,refetch:a,isLoading:l,isError:c}=Cr({queryKey:[e],queryFn:()=>QN(e,t==null?void 0:t.accessToken),enabled:!1}),{theme:d,setTheme:f}=Em(),{setDashboard:g,setSelectedSheetId:p,setStyle:v,setOnSaveFunction:y}=ge(k=>k.actions),x=ge(k=>k.actions.setFilterValues),w=ge(k=>k.actions.setBookmarkKey),S=ge(k=>k.actions.setAuthToken),C=ge(k=>k.actions.setThemeStyle),P=ge(k=>k.actions.setDashboardTheme),O=ge(k=>k.actions.setOnEvent);return m.useEffect(()=>{d&&P(d)},[d,P]),m.useEffect(()=>{r&&f(r)},[r,f]),m.useEffect(()=>{const k=Fs.cloneDeep(mm);if(n){const A=Fs.merge(k,n),L=Yw(d,A);C(L),v(A)}else{const A=Yw(d,k);C(A),v(mm)}},[d,n,v]),m.useEffect(()=>{var j;if(!s||!s.dashboard)return;const k=s.dashboard,A=as(k.id),L=JSON.parse(localStorage.getItem(A)||"[]"),F=L.find(B=>B.default===!0);if(F)g(F.template),w(F.name),F.filterValues&&x(F.filterValues);else{g(k);const B=L.find(H=>(H==null?void 0:H.name)==="Original");B?B.template=k:L.push({name:"Original",template:k,default:!1}),localStorage.setItem(A,JSON.stringify(L))}p((j=k.sheets)==null?void 0:j[0].id)},[s,g,p]),m.useEffect(()=>{i&&y(i),o&&O(o)},[i,y,o,O]),m.useEffect(()=>{t&&t.accessToken&&(S(t),a())},[t,a,S]),{isLoading:l,isError:c}}function cf({className:e,...t}){return _.jsx("div",{className:Pe("animate-pulse rounded-md bg-muted",e),...t})}function Kw({className:e,style:t,onSave:n,onEvent:r,LoadingComponent:i,ErrorComponent:o,id:s,authToken:a,currentTheme:l,...c}){ge(v=>v.selectedSheetId);const d=ge(v=>v.themeStyle),f=ge(v=>v.onEvent),{isLoading:g,isError:p}=JN(s,a,t,l,n,r);return g||!a?(f==null||f({type:"info",message:`isLoading: ${g}, accessToken: ${a==null?void 0:a.accessToken}`}),i?_.jsx(i,{message:"loading"}):_.jsx("div",{className:" flex items-center gap-3",children:_.jsx(cf,{className:"dark:h-[2px] h-1 w-full"})})):p?(f==null||f({type:"error",message:"Error fetching dashboard"}),o?(console.log("Error fetching dashboard"),_.jsx(o,{})):_.jsx("div",{children:"Error"})):_.jsx("div",{className:Pe(" h-full flex flex-col justify-between",d==null?void 0:d.dashboardPanel,e),role:"dashboard-panel",...c})}function ae(){return ae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ae.apply(this,arguments)}function Ee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function kn(e,t=[]){let n=[];function r(o,s){const a=m.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:g,children:p,...v}=f,y=(g==null?void 0:g[e][l])||a,x=m.useMemo(()=>v,Object.values(v));return m.createElement(y.Provider,{value:x},p)}function d(f,g){const p=(g==null?void 0:g[e][l])||a,v=m.useContext(p);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return c.displayName=o+"Provider",[c,d]}const i=()=>{const o=n.map(s=>m.createContext(s));return function(a){const l=(a==null?void 0:a[e])||o;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,ZN(i,...t)]}function ZN(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(o)[`__scope${c}`];return{...a,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function eR(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function uf(...e){return t=>e.forEach(n=>eR(n,t))}function et(...e){return m.useCallback(uf(...e),e)}const ro=m.forwardRef((e,t)=>{const{children:n,...r}=e,i=m.Children.toArray(n),o=i.find(tR);if(o){const s=o.props.children,a=i.map(l=>l===o?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(Om,ae({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(Om,ae({},r,{ref:t}),n)});ro.displayName="Slot";const Om=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...nR(r,n.props),ref:t?uf(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});Om.displayName="SlotClone";const Xw=({children:e})=>m.createElement(m.Fragment,null,e);function tR(e){return m.isValidElement(e)&&e.type===Xw}function nR(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{o(...a),i(...a)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function df(e){const t=e+"CollectionProvider",[n,r]=kn(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:v,children:y}=p,x=m.useRef(null),w=m.useRef(new Map).current;return m.createElement(i,{scope:v,itemMap:w,collectionRef:x},y)},a=e+"CollectionSlot",l=m.forwardRef((p,v)=>{const{scope:y,children:x}=p,w=o(a,y),S=et(v,w.collectionRef);return m.createElement(ro,{ref:S},x)}),c=e+"CollectionItemSlot",d="data-radix-collection-item",f=m.forwardRef((p,v)=>{const{scope:y,children:x,...w}=p,S=m.useRef(null),C=et(v,S),P=o(c,y);return m.useEffect(()=>(P.itemMap.set(S,{ref:S,...w}),()=>void P.itemMap.delete(S))),m.createElement(ro,{[d]:"",ref:C},x)});function g(p){const v=o(e+"CollectionConsumer",p);return m.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((P,O)=>w.indexOf(P.ref.current)-w.indexOf(O.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},g,r]}const Hn=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},rR=de.useId||(()=>{});let iR=0;function sr(e){const[t,n]=de.useState(rR());return Hn(()=>{e||n(r=>r??String(iR++))},[e]),e||(t?`radix-${t}`:"")}const Ve=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce((e,t)=>{const n=m.forwardRef((r,i)=>{const{asChild:o,...s}=r,a=o?ro:t;return m.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),m.createElement(a,ae({},s,{ref:i}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Qw(e,t){e&&Mt.flushSync(()=>e.dispatchEvent(t))}function wn(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function Jn({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=oR({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=wn(n),l=m.useCallback(c=>{if(o){const f=typeof c=="function"?c(e):c;f!==e&&a(f)}else i(c)},[o,e,i,a]);return[s,l]}function oR({defaultProp:e,onChange:t}){const n=m.useState(e),[r]=n,i=m.useRef(r),o=wn(t);return m.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}const sR=m.createContext(void 0);function js(e){const t=m.useContext(sR);return e||t||"ltr"}const Pm="rovingFocusGroup.onEntryFocus",aR={bubbles:!1,cancelable:!0},km="RovingFocusGroup",[Mm,Jw,lR]=df(km),[cR,ol]=kn(km,[lR]),[uR,dR]=cR(km),fR=m.forwardRef((e,t)=>m.createElement(Mm.Provider,{scope:e.__scopeRovingFocusGroup},m.createElement(Mm.Slot,{scope:e.__scopeRovingFocusGroup},m.createElement(hR,ae({},e,{ref:t}))))),hR=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,...d}=e,f=m.useRef(null),g=et(t,f),p=js(o),[v=null,y]=Jn({prop:s,defaultProp:a,onChange:l}),[x,w]=m.useState(!1),S=wn(c),C=Jw(n),P=m.useRef(!1),[O,k]=m.useState(0);return m.useEffect(()=>{const A=f.current;if(A)return A.addEventListener(Pm,S),()=>A.removeEventListener(Pm,S)},[S]),m.createElement(uR,{scope:n,orientation:r,dir:p,loop:i,currentTabStopId:v,onItemFocus:m.useCallback(A=>y(A),[y]),onItemShiftTab:m.useCallback(()=>w(!0),[]),onFocusableItemAdd:m.useCallback(()=>k(A=>A+1),[]),onFocusableItemRemove:m.useCallback(()=>k(A=>A-1),[])},m.createElement(Ve.div,ae({tabIndex:x||O===0?-1:0,"data-orientation":r},d,{ref:g,style:{outline:"none",...e.style},onMouseDown:Ee(e.onMouseDown,()=>{P.current=!0}),onFocus:Ee(e.onFocus,A=>{const L=!P.current;if(A.target===A.currentTarget&&L&&!x){const F=new CustomEvent(Pm,aR);if(A.currentTarget.dispatchEvent(F),!F.defaultPrevented){const j=C().filter($=>$.focusable),B=j.find($=>$.active),H=j.find($=>$.id===v),Y=[B,H,...j].filter(Boolean).map($=>$.ref.current);Zw(Y)}}P.current=!1}),onBlur:Ee(e.onBlur,()=>w(!1))})))}),pR="RovingFocusGroupItem",gR=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=e,a=sr(),l=o||a,c=dR(pR,n),d=c.currentTabStopId===l,f=Jw(n),{onFocusableItemAdd:g,onFocusableItemRemove:p}=c;return m.useEffect(()=>{if(r)return g(),()=>p()},[r,g,p]),m.createElement(Mm.ItemSlot,{scope:n,id:l,focusable:r,active:i},m.createElement(Ve.span,ae({tabIndex:d?0:-1,"data-orientation":c.orientation},s,{ref:t,onMouseDown:Ee(e.onMouseDown,v=>{r?c.onItemFocus(l):v.preventDefault()}),onFocus:Ee(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:Ee(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){c.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=bR(v,c.orientation,c.dir);if(y!==void 0){v.preventDefault();let w=f().filter(S=>S.focusable).map(S=>S.ref.current);if(y==="last")w.reverse();else if(y==="prev"||y==="next"){y==="prev"&&w.reverse();const S=w.indexOf(v.currentTarget);w=c.loop?yR(w,S+1):w.slice(S+1)}setTimeout(()=>Zw(w))}})})))}),mR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function vR(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function bR(e,t,n){const r=vR(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return mR[r]}function Zw(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function yR(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const Dm=fR,Tm=gR;function xR(e,t){return m.useReducer((n,r)=>{const i=t[n][r];return i??n},e)}const bn=e=>{const{present:t,children:n}=e,r=wR(t),i=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),o=et(r.ref,i.ref);return typeof n=="function"||r.isPresent?m.cloneElement(i,{ref:o}):null};bn.displayName="Presence";function wR(e){const[t,n]=m.useState(),r=m.useRef({}),i=m.useRef(e),o=m.useRef("none"),s=e?"mounted":"unmounted",[a,l]=xR(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=ff(r.current);o.current=a==="mounted"?c:"none"},[a]),Hn(()=>{const c=r.current,d=i.current;if(d!==e){const g=o.current,p=ff(c);e?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&g!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Hn(()=>{if(t){const c=f=>{const p=ff(r.current).includes(f.animationName);f.target===t&&p&&Mt.flushSync(()=>l("ANIMATION_END"))},d=f=>{f.target===t&&(o.current=ff(r.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function ff(e){return(e==null?void 0:e.animationName)||"none"}const e_="Tabs",[_R,Pde]=kn(e_,[ol]),t_=ol(),[SR,Am]=_R(e_),CR=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,d=js(a),[f,g]=Jn({prop:r,onChange:i,defaultProp:o});return m.createElement(SR,{scope:n,baseId:sr(),value:f,onValueChange:g,orientation:s,dir:d,activationMode:l},m.createElement(Ve.div,ae({dir:d,"data-orientation":s},c,{ref:t})))}),ER="TabsList",OR=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=Am(ER,n),s=t_(n);return m.createElement(Dm,ae({asChild:!0},s,{orientation:o.orientation,dir:o.dir,loop:r}),m.createElement(Ve.div,ae({role:"tablist","aria-orientation":o.orientation},i,{ref:t})))}),PR="TabsTrigger",kR=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=Am(PR,n),a=t_(n),l=n_(s.baseId,r),c=r_(s.baseId,r),d=r===s.value;return m.createElement(Tm,ae({asChild:!0},a,{focusable:!i,active:d}),m.createElement(Ve.button,ae({type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l},o,{ref:t,onMouseDown:Ee(e.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Ee(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Ee(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!i&&f&&s.onValueChange(r)})})))}),MR="TabsContent",DR=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=Am(MR,n),l=n_(a.baseId,r),c=r_(a.baseId,r),d=r===a.value,f=m.useRef(d);return m.useEffect(()=>{const g=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(g)},[]),m.createElement(bn,{present:i||d},({present:g})=>m.createElement(Ve.div,ae({"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!g,id:c,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0}}),g&&o))});function n_(e,t){return`${e}-trigger-${t}`}function r_(e,t){return`${e}-content-${t}`}const TR=CR,i_=OR,o_=kR,s_=DR,a_=TR,l_=de.forwardRef(({className:e,...t},n)=>_.jsx(i_,{ref:n,className:Pe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));l_.displayName=i_.displayName;const Im=de.forwardRef(({className:e,...t},n)=>_.jsx(o_,{ref:n,className:Pe("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Im.displayName=o_.displayName;const hf=de.forwardRef(({className:e,...t},n)=>_.jsx(s_,{ref:n,className:Pe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));hf.displayName=s_.displayName;var c_={exports:{}},Fc={},Nm={exports:{}};(function(e,t){(function(n,r){r(t)})(Lo,function(n){function r(re){return function(oe,xe,V,Me,$e,He,Fe){return re(oe,xe,Fe)}}function i(re){return function(oe,xe,V,Me){if(!oe||!xe||typeof oe!="object"||typeof xe!="object")return re(oe,xe,V,Me);var $e=Me.get(oe),He=Me.get(xe);if($e&&He)return $e===xe&&He===oe;Me.set(oe,xe),Me.set(xe,oe);var Fe=re(oe,xe,V,Me);return Me.delete(oe),Me.delete(xe),Fe}}function o(re,ee){var oe={};for(var xe in re)oe[xe]=re[xe];for(var xe in ee)oe[xe]=ee[xe];return oe}function s(re){return re.constructor===Object||re.constructor==null}function a(re){return typeof re.then=="function"}function l(re,ee){return re===ee||re!==re&&ee!==ee}var c="[object Arguments]",d="[object Boolean]",f="[object Date]",g="[object RegExp]",p="[object Map]",v="[object Number]",y="[object Object]",x="[object Set]",w="[object String]",S=Object.prototype.toString;function C(re){var ee=re.areArraysEqual,oe=re.areDatesEqual,xe=re.areMapsEqual,V=re.areObjectsEqual,Me=re.areRegExpsEqual,$e=re.areSetsEqual,He=re.createIsNestedEqual,Fe=He(xt);function xt(ht,pt,Bt){if(ht===pt)return!0;if(!ht||!pt||typeof ht!="object"||typeof pt!="object")return ht!==ht&&pt!==pt;if(s(ht)&&s(pt))return V(ht,pt,Fe,Bt);var Ot=Array.isArray(ht),tn=Array.isArray(pt);if(Ot||tn)return Ot===tn&&ee(ht,pt,Fe,Bt);var nn=S.call(ht);return nn!==S.call(pt)?!1:nn===f?oe(ht,pt,Fe,Bt):nn===g?Me(ht,pt,Fe,Bt):nn===p?xe(ht,pt,Fe,Bt):nn===x?$e(ht,pt,Fe,Bt):nn===y||nn===c?a(ht)||a(pt)?!1:V(ht,pt,Fe,Bt):nn===d||nn===v||nn===w?l(ht.valueOf(),pt.valueOf()):!1}return xt}function P(re,ee,oe,xe){var V=re.length;if(ee.length!==V)return!1;for(;V-- >0;)if(!oe(re[V],ee[V],V,V,re,ee,xe))return!1;return!0}var O=i(P);function k(re,ee){return l(re.valueOf(),ee.valueOf())}function A(re,ee,oe,xe){var V=re.size===ee.size;if(!V)return!1;if(!re.size)return!0;var Me={},$e=0;return re.forEach(function(He,Fe){if(V){var xt=!1,ht=0;ee.forEach(function(pt,Bt){!xt&&!Me[ht]&&(xt=oe(Fe,Bt,$e,ht,re,ee,xe)&&oe(He,pt,Fe,Bt,re,ee,xe))&&(Me[ht]=!0),ht++}),$e++,V=xt}}),V}var L=i(A),F="_owner",j=Object.prototype.hasOwnProperty;function B(re,ee,oe,xe){var V=Object.keys(re),Me=V.length;if(Object.keys(ee).length!==Me)return!1;for(var $e;Me-- >0;){if($e=V[Me],$e===F){var He=!!re.$$typeof,Fe=!!ee.$$typeof;if((He||Fe)&&He!==Fe)return!1}if(!j.call(ee,$e)||!oe(re[$e],ee[$e],$e,$e,re,ee,xe))return!1}return!0}var H=i(B);function K(re,ee){return re.source===ee.source&&re.flags===ee.flags}function Y(re,ee,oe,xe){var V=re.size===ee.size;if(!V)return!1;if(!re.size)return!0;var Me={};return re.forEach(function($e,He){if(V){var Fe=!1,xt=0;ee.forEach(function(ht,pt){!Fe&&!Me[xt]&&(Fe=oe($e,ht,He,pt,re,ee,xe))&&(Me[xt]=!0),xt++}),V=Fe}}),V}var $=i(Y),Z=Object.freeze({areArraysEqual:P,areDatesEqual:k,areMapsEqual:A,areObjectsEqual:B,areRegExpsEqual:K,areSetsEqual:Y,createIsNestedEqual:r}),U=Object.freeze({areArraysEqual:O,areDatesEqual:k,areMapsEqual:L,areObjectsEqual:H,areRegExpsEqual:K,areSetsEqual:$,createIsNestedEqual:r}),ie=C(Z);function le(re,ee){return ie(re,ee,void 0)}var M=C(o(Z,{createIsNestedEqual:function(){return l}}));function W(re,ee){return M(re,ee,void 0)}var ne=C(U);function N(re,ee){return ne(re,ee,new WeakMap)}var X=C(o(U,{createIsNestedEqual:function(){return l}}));function me(re,ee){return X(re,ee,new WeakMap)}function he(re){return C(o(Z,re(Z)))}function fe(re){var ee=C(o(U,re(U)));return function(oe,xe,V){return V===void 0&&(V=new WeakMap),ee(oe,xe,V)}}n.circularDeepEqual=N,n.circularShallowEqual=me,n.createCustomCircularEqual=fe,n.createCustomEqual=he,n.deepEqual=le,n.sameValueZeroEqual=l,n.shallowEqual=W,Object.defineProperty(n,"__esModule",{value:!0})})})(Nm,Nm.exports);var Rm=Nm.exports;const Lm=Kg(a3);var vt={},AR=function(t,n,r){return t===n?!0:t.className===n.className&&r(t.style,n.style)&&t.width===n.width&&t.autoSize===n.autoSize&&t.cols===n.cols&&t.draggableCancel===n.draggableCancel&&t.draggableHandle===n.draggableHandle&&r(t.verticalCompact,n.verticalCompact)&&r(t.compactType,n.compactType)&&r(t.layout,n.layout)&&r(t.margin,n.margin)&&r(t.containerPadding,n.containerPadding)&&t.rowHeight===n.rowHeight&&t.maxRows===n.maxRows&&t.isBounded===n.isBounded&&t.isDraggable===n.isDraggable&&t.isResizable===n.isResizable&&t.allowOverlap===n.allowOverlap&&t.preventCollision===n.preventCollision&&t.useCSSTransforms===n.useCSSTransforms&&t.transformScale===n.transformScale&&t.isDroppable===n.isDroppable&&r(t.resizeHandles,n.resizeHandles)&&r(t.resizeHandle,n.resizeHandle)&&t.onLayoutChange===n.onLayoutChange&&t.onDragStart===n.onDragStart&&t.onDrag===n.onDrag&&t.onDragStop===n.onDragStop&&t.onResizeStart===n.onResizeStart&&t.onResize===n.onResize&&t.onResizeStop===n.onResizeStop&&t.onDrop===n.onDrop&&r(t.droppingItem,n.droppingItem)&&r(t.innerRef,n.innerRef)};Object.defineProperty(vt,"__esModule",{value:!0}),vt.bottom=$m,vt.childrenEqual=LR,vt.cloneLayout=d_,vt.cloneLayoutItem=zs,vt.collides=pf,vt.compact=h_,vt.compactItem=p_,vt.compactType=UR,vt.correctBounds=g_,vt.fastPositionEqual=FR,vt.fastRGLPropsEqual=void 0,vt.getAllCollisions=m_,vt.getFirstCollision=Bs,vt.getLayoutItem=jm,vt.getStatics=zm,vt.modifyLayout=f_,vt.moveElement=zc,vt.moveElementAwayFromCollision=Bm,vt.noop=void 0,vt.perc=zR,vt.resizeItemInDirection=VR,vt.setTopLeft=WR,vt.setTransform=HR,vt.sortLayoutItems=Gm,vt.sortLayoutItemsByColRow=w_,vt.sortLayoutItemsByRowCol=x_,vt.synchronizeLayoutWithChildren=qR,vt.validateLayout=__,vt.withLayoutItem=RR;var u_=Rm,jc=IR(m);function IR(e){return e&&e.__esModule?e:{default:e}}const NR=process.env.NODE_ENV==="production";function $m(e){let t=0,n;for(let r=0,i=e.length;r<i;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function d_(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=zs(e[n]);return t}function f_(e,t){const n=Array(e.length);for(let r=0,i=e.length;r<i;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function RR(e,t,n){let r=jm(e,t);return r?(r=n(zs(r)),e=f_(e,r),[e,r]):[e,null]}function zs(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function LR(e,t){return(0,u_.deepEqual)(jc.default.Children.map(e,n=>n==null?void 0:n.key),jc.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,u_.deepEqual)(jc.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),jc.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}const $R=AR;vt.fastRGLPropsEqual=$R;function FR(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function pf(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function h_(e,t,n,r){const i=zm(e),o=Gm(e,t),s=Array(e.length);for(let a=0,l=o.length;a<l;a++){let c=zs(o[a]);c.static||(c=p_(i,c,t,n,o,r),i.push(c)),s[e.indexOf(o[a])]=c,c.moved=!1}return s}const jR={x:"w",y:"h"};function Fm(e,t,n,r){const i=jR[r];t[r]+=1;const o=e.map(s=>s.i).indexOf(t.i);for(let s=o+1;s<e.length;s++){const a=e[s];if(!a.static){if(a.y>t.y+t.h)break;pf(t,a)&&Fm(e,a,n+t[i],r)}}t[r]=n}function p_(e,t,n,r,i,o){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min($m(e),t.y);t.y>0&&!Bs(e,t);)t.y--;else if(a)for(;t.x>0&&!Bs(e,t);)t.x--;let l;for(;(l=Bs(e,t))&&!(n===null&&o);)if(a?Fm(i,t,l.x+l.w,"x"):Fm(i,t,l.y+l.h,"y"),a&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!Bs(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function g_(e,t){const n=zm(e);for(let r=0,i=e.length;r<i;r++){const o=e[r];if(o.x+o.w>t.cols&&(o.x=t.cols-o.w),o.x<0&&(o.x=0,o.w=t.cols),!o.static)n.push(o);else for(;Bs(n,o);)o.y++}return e}function jm(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function Bs(e,t){for(let n=0,r=e.length;n<r;n++)if(pf(e[n],t))return e[n]}function m_(e,t){return e.filter(n=>pf(n,t))}function zm(e){return e.filter(t=>t.static)}function zc(e,t,n,r,i,o,s,a,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;"Moving element ".concat(t.i," to [").concat(String(n),",").concat(String(r),"] from [").concat(t.x,",").concat(t.y,"]");const c=t.x,d=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let f=Gm(e,s);(s==="vertical"&&typeof r=="number"?d>=r:s==="horizontal"&&typeof n=="number"?c>=n:!1)&&(f=f.reverse());const p=m_(f,t),v=p.length>0;if(v&&l)return d_(e);if(v&&o)return"Collision prevented on ".concat(t.i,", reverting."),t.x=c,t.y=d,t.moved=!1,e;for(let y=0,x=p.length;y<x;y++){const w=p[y];"Resolving collision between ".concat(t.i," at [").concat(t.x,",").concat(t.y,"] and ").concat(w.i," at [").concat(w.x,",").concat(w.y,"]"),!w.moved&&(w.static?e=Bm(e,w,t,i,s):e=Bm(e,t,w,i,s))}return e}function Bm(e,t,n,r,i,o){const s=i==="horizontal",a=i==="vertical",l=t.static;if(r){r=!1;const f={x:s?Math.max(t.x-n.w,0):n.x,y:a?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},g=Bs(e,f),p=g&&g.y+g.h>t.y,v=g&&t.x+t.w>g.x;if(g){if(p&&a)return zc(e,n,void 0,t.y+1,r,l,i);if(p&&i==null)return t.y=n.y,n.y=n.y+n.h,e;if(v&&s)return zc(e,t,n.x,void 0,r,l,i)}else return"Doing reverse collision on ".concat(n.i," up to [").concat(f.x,",").concat(f.y,"]."),zc(e,n,s?f.x:void 0,a?f.y:void 0,r,l,i)}const c=s?n.x+1:void 0,d=a?n.y+1:void 0;return c==null&&d==null?e:zc(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,i)}function zR(e){return e*100+"%"}const v_=(e,t,n,r)=>e+n>r?t:n,b_=(e,t,n)=>e<0?t:n,y_=e=>Math.max(0,e),Vm=e=>Math.max(0,e),Hm=(e,t,n)=>{let{left:r,height:i,width:o}=t;const s=e.top-(i-e.height);return{left:r,width:o,height:b_(s,e.height,i),top:Vm(s)}},Wm=(e,t,n)=>{let{top:r,left:i,height:o,width:s}=t;return{top:r,height:o,width:v_(e.left,e.width,s,n),left:y_(i)}},qm=(e,t,n)=>{let{top:r,height:i,width:o}=t;const s=e.left-(o-e.width);return{height:i,width:s<0?e.width:v_(e.left,e.width,o,n),top:Vm(r),left:y_(s)}},Um=(e,t,n)=>{let{top:r,left:i,height:o,width:s}=t;return{width:s,left:i,height:b_(r,e.height,o),top:Vm(r)}},BR={n:Hm,ne:function(){return Hm(arguments.length<=0?void 0:arguments[0],Wm(...arguments))},e:Wm,se:function(){return Um(arguments.length<=0?void 0:arguments[0],Wm(...arguments))},s:Um,sw:function(){return Um(arguments.length<=0?void 0:arguments[0],qm(...arguments))},w:qm,nw:function(){return Hm(arguments.length<=0?void 0:arguments[0],qm(...arguments))}};function VR(e,t,n,r){const i=BR[e];return i?i(t,{...t,...n},r):n}function HR(e){let{top:t,left:n,width:r,height:i}=e;const o="translate(".concat(n,"px,").concat(t,"px)");return{transform:o,WebkitTransform:o,MozTransform:o,msTransform:o,OTransform:o,width:"".concat(r,"px"),height:"".concat(i,"px"),position:"absolute"}}function WR(e){let{top:t,left:n,width:r,height:i}=e;return{top:"".concat(t,"px"),left:"".concat(n,"px"),width:"".concat(r,"px"),height:"".concat(i,"px"),position:"absolute"}}function Gm(e,t){return t==="horizontal"?w_(e):t==="vertical"?x_(e):e}function x_(e){return e.slice(0).sort(function(t,n){return t.y>n.y||t.y===n.y&&t.x>n.x?1:t.y===n.y&&t.x===n.x?0:-1})}function w_(e){return e.slice(0).sort(function(t,n){return t.x>n.x||t.x===n.x&&t.y>n.y?1:-1})}function qR(e,t,n,r,i){e=e||[];const o=[];jc.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=jm(e,String(a.key)),c=a.props["data-grid"];l&&c==null?o.push(zs(l)):c?(NR||__([c],"ReactGridLayout.children"),o.push(zs({...c,i:a.key}))):o.push(zs({w:1,h:1,x:0,y:$m(o),i:String(a.key)}))});const s=g_(o,{cols:n});return i?s:h_(s,r,n)}function __(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,i=e.length;r<i;r++){const o=e[r];for(let s=0;s<n.length;s++)if(typeof o[n[s]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[s]+" must be a number!")}}function UR(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}function Ade(){}const GR=()=>{};vt.noop=GR;var Mi={};Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.calcGridColWidth=gf,Mi.calcGridItemPosition=YR,Mi.calcGridItemWHPx=Ym,Mi.calcWH=XR,Mi.calcXY=KR,Mi.clamp=Vs;function gf(e){const{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function Ym(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function YR(e,t,n,r,i,o){const{margin:s,containerPadding:a,rowHeight:l}=e,c=gf(e),d={};return o&&o.resizing?(d.width=Math.round(o.resizing.width),d.height=Math.round(o.resizing.height)):(d.width=Ym(r,c,s[0]),d.height=Ym(i,l,s[1])),o&&o.dragging?(d.top=Math.round(o.dragging.top),d.left=Math.round(o.dragging.left)):o&&o.resizing&&typeof o.resizing.top=="number"&&typeof o.resizing.left=="number"?(d.top=Math.round(o.resizing.top),d.left=Math.round(o.resizing.left)):(d.top=Math.round((l+s[1])*n+a[1]),d.left=Math.round((c+s[0])*t+a[0])),d}function KR(e,t,n,r,i){const{margin:o,cols:s,rowHeight:a,maxRows:l}=e,c=gf(e);let d=Math.round((n-o[0])/(c+o[0])),f=Math.round((t-o[1])/(a+o[1]));return d=Vs(d,0,s-r),f=Vs(f,0,l-i),{x:d,y:f}}function XR(e,t,n,r,i,o){const{margin:s,maxRows:a,cols:l,rowHeight:c}=e,d=gf(e);let f=Math.round((t+s[0])/(d+s[0])),g=Math.round((n+s[1])/(c+s[1])),p=Vs(f,0,l-r),v=Vs(g,0,a-i);return["sw","w","nw"].indexOf(o)!==-1&&(p=Vs(f,0,l)),["nw","n","ne"].indexOf(o)!==-1&&(v=Vs(g,0,a)),{w:p,h:v}}function Vs(e,t,n){return Math.max(Math.min(e,n),t)}var mf={},Km={exports:{}},Xm,S_;function Qm(){if(S_)return Xm;S_=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Xm=e,Xm}var Jm,C_;function QR(){if(C_)return Jm;C_=1;var e=Qm();function t(){}function n(){}return n.resetWarningCache=t,Jm=function(){function r(s,a,l,c,d,f){if(f!==e){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},Jm}var vf={exports:{}},It={};/** @license React v16.13.1
86
86
  * react-is.development.js
87
87
  *
88
88
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -126,7 +126,7 @@ Valid keys: `+JSON.stringify(Object.keys(M),null," "));var V=xe(fe,oe,X,me,he+"
126
126
  * (c) 2017-2022 chartjs-plugin-datalabels contributors
127
127
  * Released under the MIT license
128
128
  */var BE=function(){if(typeof window<"u"){if(window.devicePixelRatio)return window.devicePixelRatio;var e=window.screen;if(e)return(e.deviceXDPI||1)/(e.logicalXDPI||1)}return 1}(),bu={toTextLines:function(e){var t=[],n;for(e=[].concat(e);e.length;)n=e.pop(),typeof n=="string"?t.unshift.apply(t,n.split(`
129
- `)):Array.isArray(n)?e.push.apply(e,n):bt(e)||t.unshift(""+n);return t},textSize:function(e,t,n){var r=[].concat(t),i=r.length,o=e.font,s=0,a;for(e.font=n.string,a=0;a<i;++a)s=Math.max(e.measureText(r[a]).width,s);return e.font=o,{height:i*n.lineHeight,width:s}},bound:function(e,t,n){return Math.max(e,Math.min(t,n))},arrayDiff:function(e,t){var n=e.slice(),r=[],i,o,s,a;for(i=0,s=t.length;i<s;++i)a=t[i],o=n.indexOf(a),o===-1?r.push([a,1]):n.splice(o,1);for(i=0,s=n.length;i<s;++i)r.push([n[i],-1]);return r},rasterize:function(e){return Math.round(e*BE)/BE}};function Cb(e,t){var n=t.x,r=t.y;if(n===null)return{x:0,y:-1};if(r===null)return{x:1,y:0};var i=e.x-n,o=e.y-r,s=Math.sqrt(i*i+o*o);return{x:s?i/s:0,y:s?o/s:-1}}function mj(e,t,n,r,i){switch(i){case"center":n=r=0;break;case"bottom":n=0,r=1;break;case"right":n=1,r=0;break;case"left":n=-1,r=0;break;case"top":n=0,r=-1;break;case"start":n=-n,r=-r;break;case"end":break;default:i*=Math.PI/180,n=Math.cos(i),r=Math.sin(i);break}return{x:e,y:t,vx:n,vy:r}}var vj=0,VE=1,HE=2,WE=4,qE=8;function gh(e,t,n){var r=vj;return e<n.left?r|=VE:e>n.right&&(r|=HE),t<n.top?r|=qE:t>n.bottom&&(r|=WE),r}function bj(e,t){for(var n=e.x0,r=e.y0,i=e.x1,o=e.y1,s=gh(n,r,t),a=gh(i,o,t),l,c,d;!(!(s|a)||s&a);)l=s||a,l&qE?(c=n+(i-n)*(t.top-r)/(o-r),d=t.top):l&WE?(c=n+(i-n)*(t.bottom-r)/(o-r),d=t.bottom):l&HE?(d=r+(o-r)*(t.right-n)/(i-n),c=t.right):l&VE&&(d=r+(o-r)*(t.left-n)/(i-n),c=t.left),l===s?(n=c,r=d,s=gh(n,r,t)):(i=c,o=d,a=gh(i,o,t));return{x0:n,x1:i,y0:r,y1:o}}function mh(e,t){var n=t.anchor,r=e,i,o;return t.clamp&&(r=bj(r,t.area)),n==="start"?(i=r.x0,o=r.y0):n==="end"?(i=r.x1,o=r.y1):(i=(r.x0+r.x1)/2,o=(r.y0+r.y1)/2),mj(i,o,e.vx,e.vy,t.align)}var vh={arc:function(e,t){var n=(e.startAngle+e.endAngle)/2,r=Math.cos(n),i=Math.sin(n),o=e.innerRadius,s=e.outerRadius;return mh({x0:e.x+r*o,y0:e.y+i*o,x1:e.x+r*s,y1:e.y+i*s,vx:r,vy:i},t)},point:function(e,t){var n=Cb(e,t.origin),r=n.x*e.options.radius,i=n.y*e.options.radius;return mh({x0:e.x-r,y0:e.y-i,x1:e.x+r,y1:e.y+i,vx:n.x,vy:n.y},t)},bar:function(e,t){var n=Cb(e,t.origin),r=e.x,i=e.y,o=0,s=0;return e.horizontal?(r=Math.min(e.x,e.base),o=Math.abs(e.base-e.x)):(i=Math.min(e.y,e.base),s=Math.abs(e.base-e.y)),mh({x0:r,y0:i+s,x1:r+o,y1:i,vx:n.x,vy:n.y},t)},fallback:function(e,t){var n=Cb(e,t.origin);return mh({x0:e.x,y0:e.y,x1:e.x+(e.width||0),y1:e.y+(e.height||0),vx:n.x,vy:n.y},t)}},po=bu.rasterize;function yj(e){var t=e.borderWidth||0,n=e.padding,r=e.size.height,i=e.size.width,o=-i/2,s=-r/2;return{frame:{x:o-n.left-t,y:s-n.top-t,w:i+n.width+t*2,h:r+n.height+t*2},text:{x:o,y:s,w:i,h:r}}}function xj(e,t){var n=t.chart.getDatasetMeta(t.datasetIndex).vScale;if(!n)return null;if(n.xCenter!==void 0&&n.yCenter!==void 0)return{x:n.xCenter,y:n.yCenter};var r=n.getBasePixel();return e.horizontal?{x:r,y:null}:{x:null,y:r}}function wj(e){return e instanceof bl?vh.arc:e instanceof fu?vh.point:e instanceof hu?vh.bar:vh.fallback}function _j(e,t,n,r,i,o){var s=Math.PI/2;if(o){var a=Math.min(o,i/2,r/2),l=t+a,c=n+a,d=t+r-a,f=n+i-a;e.moveTo(t,c),l<d&&c<f?(e.arc(l,c,a,-Math.PI,-s),e.arc(d,c,a,-s,0),e.arc(d,f,a,0,s),e.arc(l,f,a,s,Math.PI)):l<d?(e.moveTo(l,n),e.arc(d,c,a,-s,s),e.arc(l,c,a,s,Math.PI+s)):c<f?(e.arc(l,c,a,-Math.PI,0),e.arc(l,f,a,0,Math.PI)):e.arc(l,c,a,-Math.PI,Math.PI),e.closePath(),e.moveTo(t,n)}else e.rect(t,n,r,i)}function Sj(e,t,n){var r=n.backgroundColor,i=n.borderColor,o=n.borderWidth;!r&&(!i||!o)||(e.beginPath(),_j(e,po(t.x)+o/2,po(t.y)+o/2,po(t.w)-o,po(t.h)-o,n.borderRadius),e.closePath(),r&&(e.fillStyle=r,e.fill()),i&&o&&(e.strokeStyle=i,e.lineWidth=o,e.lineJoin="miter",e.stroke()))}function Cj(e,t,n){var r=n.lineHeight,i=e.w,o=e.x,s=e.y+r/2;return t==="center"?o+=i/2:(t==="end"||t==="right")&&(o+=i),{h:r,w:i,x:o,y:s}}function Ej(e,t,n){var r=e.shadowBlur,i=n.stroked,o=po(n.x),s=po(n.y),a=po(n.w);i&&e.strokeText(t,o,s,a),n.filled&&(r&&i&&(e.shadowBlur=0),e.fillText(t,o,s,a),r&&i&&(e.shadowBlur=r))}function Oj(e,t,n,r){var i=r.textAlign,o=r.color,s=!!o,a=r.font,l=t.length,c=r.textStrokeColor,d=r.textStrokeWidth,f=c&&d,g;if(!(!l||!s&&!f))for(n=Cj(n,i,a),e.font=a.string,e.textAlign=i,e.textBaseline="middle",e.shadowBlur=r.textShadowBlur,e.shadowColor=r.textShadowColor,s&&(e.fillStyle=o),f&&(e.lineJoin="round",e.lineWidth=d,e.strokeStyle=c),g=0,l=t.length;g<l;++g)Ej(e,t[g],{stroked:f,filled:s,w:n.w,x:n.x,y:n.y+n.h*g})}var UE=function(e,t,n,r){var i=this;i._config=e,i._index=r,i._model=null,i._rects=null,i._ctx=t,i._el=n};Ii(UE.prototype,{_modelize:function(e,t,n,r){var i=this,o=i._index,s=yn(Zt([n.font,{}],r,o)),a=Zt([n.color,an.color],r,o);return{align:Zt([n.align,"center"],r,o),anchor:Zt([n.anchor,"center"],r,o),area:r.chart.chartArea,backgroundColor:Zt([n.backgroundColor,null],r,o),borderColor:Zt([n.borderColor,null],r,o),borderRadius:Zt([n.borderRadius,0],r,o),borderWidth:Zt([n.borderWidth,0],r,o),clamp:Zt([n.clamp,!1],r,o),clip:Zt([n.clip,!1],r,o),color:a,display:e,font:s,lines:t,offset:Zt([n.offset,4],r,o),opacity:Zt([n.opacity,1],r,o),origin:xj(i._el,r),padding:Rn(Zt([n.padding,4],r,o)),positioner:wj(i._el),rotation:Zt([n.rotation,0],r,o)*(Math.PI/180),size:bu.textSize(i._ctx,t,s),textAlign:Zt([n.textAlign,"start"],r,o),textShadowBlur:Zt([n.textShadowBlur,0],r,o),textShadowColor:Zt([n.textShadowColor,a],r,o),textStrokeColor:Zt([n.textStrokeColor,a],r,o),textStrokeWidth:Zt([n.textStrokeWidth,0],r,o)}},update:function(e){var t=this,n=null,r=null,i=t._index,o=t._config,s,a,l,c=Zt([o.display,!0],e,i);c&&(s=e.dataset.data[i],a=tt(zt(o.formatter,[s,e]),s),l=bt(a)?[]:bu.toTextLines(a),l.length&&(n=t._modelize(c,l,o,e),r=yj(n))),t._model=n,t._rects=r},geometry:function(){return this._rects?this._rects.frame:{}},rotation:function(){return this._model?this._model.rotation:0},visible:function(){return this._model&&this._model.opacity},model:function(){return this._model},draw:function(e,t){var n=this,r=e.ctx,i=n._model,o=n._rects,s;this.visible()&&(r.save(),i.clip&&(s=i.area,r.beginPath(),r.rect(s.left,s.top,s.right-s.left,s.bottom-s.top),r.clip()),r.globalAlpha=bu.bound(0,i.opacity,1),r.translate(po(t.x),po(t.y)),r.rotate(i.rotation),Sj(r,o.frame,i),Oj(r,i.lines,o.text,i),r.restore())}});var Pj=Number.MIN_SAFE_INTEGER||-9007199254740991,kj=Number.MAX_SAFE_INTEGER||9007199254740991;function yu(e,t,n){var r=Math.cos(n),i=Math.sin(n),o=t.x,s=t.y;return{x:o+r*(e.x-o)-i*(e.y-s),y:s+i*(e.x-o)+r*(e.y-s)}}function GE(e,t){var n=kj,r=Pj,i=t.origin,o,s,a,l,c;for(o=0;o<e.length;++o)s=e[o],a=s.x-i.x,l=s.y-i.y,c=t.vx*a+t.vy*l,n=Math.min(n,c),r=Math.max(r,c);return{min:n,max:r}}function bh(e,t){var n=t.x-e.x,r=t.y-e.y,i=Math.sqrt(n*n+r*r);return{vx:(t.x-e.x)/i,vy:(t.y-e.y)/i,origin:e,ln:i}}var YE=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};Ii(YE.prototype,{center:function(){var e=this._rect;return{x:e.x+e.w/2,y:e.y+e.h/2}},update:function(e,t,n){this._rotation=n,this._rect={x:t.x+e.x,y:t.y+e.y,w:t.w,h:t.h}},contains:function(e){var t=this,n=1,r=t._rect;return e=yu(e,t.center(),-t._rotation),!(e.x<r.x-n||e.y<r.y-n||e.x>r.x+r.w+n*2||e.y>r.y+r.h+n*2)},intersects:function(e){var t=this._points(),n=e._points(),r=[bh(t[0],t[1]),bh(t[0],t[3])],i,o,s;for(this._rotation!==e._rotation&&r.push(bh(n[0],n[1]),bh(n[0],n[3])),i=0;i<r.length;++i)if(o=GE(t,r[i]),s=GE(n,r[i]),o.max<s.min||s.max<o.min)return!1;return!0},_points:function(){var e=this,t=e._rect,n=e._rotation,r=e.center();return[yu({x:t.x,y:t.y},r,n),yu({x:t.x+t.w,y:t.y},r,n),yu({x:t.x+t.w,y:t.y+t.h},r,n),yu({x:t.x,y:t.y+t.h},r,n)]}});function KE(e,t,n){var r=t.positioner(e,t),i=r.vx,o=r.vy;if(!i&&!o)return{x:r.x,y:r.y};var s=n.w,a=n.h,l=t.rotation,c=Math.abs(s/2*Math.cos(l))+Math.abs(a/2*Math.sin(l)),d=Math.abs(s/2*Math.sin(l))+Math.abs(a/2*Math.cos(l)),f=1/Math.max(Math.abs(i),Math.abs(o));return c*=i*f,d*=o*f,c+=t.offset*i,d+=t.offset*o,{x:r.x+c,y:r.y+d}}function Mj(e,t){var n,r,i,o;for(n=e.length-1;n>=0;--n)for(i=e[n].$layout,r=n-1;r>=0&&i._visible;--r)o=e[r].$layout,o._visible&&i._box.intersects(o._box)&&t(i,o);return e}function Dj(e){var t,n,r,i,o,s,a;for(t=0,n=e.length;t<n;++t)r=e[t],i=r.$layout,i._visible&&(a=new Proxy(r._el,{get:(l,c)=>l.getProps([c],!0)[c]}),o=r.geometry(),s=KE(a,r.model(),o),i._box.update(s,o,r.rotation()));return Mj(e,function(l,c){var d=l._hidable,f=c._hidable;d&&f||f?c._visible=!1:d&&(l._visible=!1)})}var xu={prepare:function(e){var t=[],n,r,i,o,s;for(n=0,i=e.length;n<i;++n)for(r=0,o=e[n].length;r<o;++r)s=e[n][r],t.push(s),s.$layout={_box:new YE,_hidable:!1,_visible:!0,_set:n,_idx:s._index};return t.sort(function(a,l){var c=a.$layout,d=l.$layout;return c._idx===d._idx?d._set-c._set:d._idx-c._idx}),this.update(t),t},update:function(e){var t=!1,n,r,i,o,s;for(n=0,r=e.length;n<r;++n)i=e[n],o=i.model(),s=i.$layout,s._hidable=o&&o.display==="auto",s._visible=i.visible(),t|=s._hidable;t&&Dj(e)},lookup:function(e,t){var n,r;for(n=e.length-1;n>=0;--n)if(r=e[n].$layout,r&&r._visible&&r._box.contains(t))return e[n];return null},draw:function(e,t){var n,r,i,o,s,a;for(n=0,r=t.length;n<r;++n)i=t[n],o=i.$layout,o._visible&&(s=i.geometry(),a=KE(i._el,i.model(),s),o._box.update(a,s,i.rotation()),i.draw(e,a))}},Tj=function(e){if(bt(e))return null;var t=e,n,r,i;if(_t(e))if(!bt(e.label))t=e.label;else if(!bt(e.r))t=e.r;else for(t="",n=Object.keys(e),i=0,r=n.length;i<r;++i)t+=(i!==0?", ":"")+n[i]+": "+e[n[i]];return""+t},Aj={align:"center",anchor:"center",backgroundColor:null,borderColor:null,borderRadius:0,borderWidth:0,clamp:!1,clip:!1,color:void 0,display:!0,font:{family:void 0,lineHeight:1.2,size:void 0,style:void 0,weight:null},formatter:Tj,labels:void 0,listeners:{},offset:4,opacity:1,padding:{top:4,right:4,bottom:4,left:4},rotation:0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,textShadowBlur:0,textShadowColor:void 0},dr="$datalabels",XE="$default";function Ij(e,t){var n=e.datalabels,r={},i=[],o,s;return n===!1?null:(n===!0&&(n={}),t=Ii({},[t,n]),o=t.labels||{},s=Object.keys(o),delete t.labels,s.length?s.forEach(function(a){o[a]&&i.push(Ii({},[t,o[a],{_key:a}]))}):i.push(t),r=i.reduce(function(a,l){return Rt(l.listeners||{},function(c,d){a[d]=a[d]||{},a[d][l._key||XE]=c}),delete l.listeners,a},{}),{labels:i,listeners:r})}function Eb(e,t,n,r){if(t){var i=n.$context,o=n.$groups,s;t[o._set]&&(s=t[o._set][o._key],s&&zt(s,[i,r])===!0&&(e[dr]._dirty=!0,n.update(i)))}}function Nj(e,t,n,r,i){var o,s;!n&&!r||(n?r?n!==r&&(s=o=!0):s=!0:o=!0,s&&Eb(e,t.leave,n,i),o&&Eb(e,t.enter,r,i))}function Rj(e,t){var n=e[dr],r=n._listeners,i,o;if(!(!r.enter&&!r.leave)){if(t.type==="mousemove")o=xu.lookup(n._labels,t);else if(t.type!=="mouseout")return;i=n._hovered,n._hovered=o,Nj(e,r,i,o,t)}}function Lj(e,t){var n=e[dr],r=n._listeners.click,i=r&&xu.lookup(n._labels,t);i&&Eb(e,r,i,t)}var $j={id:"datalabels",defaults:Aj,beforeInit:function(e){e[dr]={_actives:[]}},beforeUpdate:function(e){var t=e[dr];t._listened=!1,t._listeners={},t._datasets=[],t._labels=[]},afterDatasetUpdate:function(e,t,n){var r=t.index,i=e[dr],o=i._datasets[r]=[],s=e.isDatasetVisible(r),a=e.data.datasets[r],l=Ij(a,n),c=t.meta.data||[],d=e.ctx,f,g,p,v,y,x,w,S;for(d.save(),f=0,p=c.length;f<p;++f)if(w=c[f],w[dr]=[],s&&w&&e.getDataVisibility(f)&&!w.skip)for(g=0,v=l.labels.length;g<v;++g)y=l.labels[g],x=y._key,S=new UE(y,d,w,f),S.$groups={_set:r,_key:x||XE},S.$context={active:!1,chart:e,dataIndex:f,dataset:a,datasetIndex:r},S.update(S.$context),w[dr].push(S),o.push(S);d.restore(),Ii(i._listeners,l.listeners,{merger:function(C,P,O){P[C]=P[C]||{},P[C][t.index]=O[C],i._listened=!0}})},afterUpdate:function(e){e[dr]._labels=xu.prepare(e[dr]._datasets)},afterDatasetsDraw:function(e){xu.draw(e,e[dr]._labels)},beforeEvent:function(e,t){if(e[dr]._listened){var n=t.event;switch(n.type){case"mousemove":case"mouseout":Rj(e,n);break;case"click":Lj(e,n);break}}},afterEvent:function(e){var t=e[dr],n=t._actives,r=t._actives=e.getActiveElements(),i=bu.arrayDiff(n,r),o,s,a,l,c,d,f;for(o=0,s=i.length;o<s;++o)if(c=i[o],c[1])for(f=c[0].element[dr]||[],a=0,l=f.length;a<l;++a)d=f[a],d.$context.active=c[1]===1,d.update(d.$context);(t._dirty||i.length)&&(xu.update(t._labels),e.render()),delete t._dirty}};Jr.register(...gj),Jr.register($j);function QE({cfg:e,onDatapointClick:t}){var a;const n=m.useRef(null),[r,i]=m.useState(),o=ge(l=>l.themeStyle);m.useEffect(()=>{var d,f,g,p;(f=(d=o==null?void 0:o.chart)==null?void 0:d.font)!=null&&f.family&&(Jr.defaults.font={...Jr.defaults.font,...(g=o==null?void 0:o.chart)==null?void 0:g.font}),e.options&&(e.options.responsive=!0,e.options.maintainAspectRatio=!1);const l=(p=n==null?void 0:n.current)==null?void 0:p.getContext("2d");if(!l)return;let c;try{c=new Jr(l,e),i(c)}catch(v){console.log("error creating chart",v)}return()=>{c&&c.destroy()}},[(a=o==null?void 0:o.chart)==null?void 0:a.font]);function s(l){var d,f;if(!r)return;const c=r==null?void 0:r.getElementsAtEventForMode(l,"nearest",{intersect:!0},!0);if(c&&c.length>0){const g=c[0].datasetIndex,p=c[0].index,v=(f=(d=c[0].element)==null?void 0:d.$context)==null?void 0:f.raw;t==null||t(r,g,p,v)}}return _.jsx("div",{onClick:s,className:" relative h-[99%] xbg-red-100",children:_.jsx("canvas",{ref:n})})}function $i(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Fj=["color"],JE=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,Fj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),jj=["color"],zj=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,jj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Bj=["color"],ZE=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,Bj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M5 2V1H10V2H5ZM4.75 0C4.33579 0 4 0.335786 4 0.75V1H3.5C2.67157 1 2 1.67157 2 2.5V12.5C2 13.3284 2.67157 14 3.5 14H7V13H3.5C3.22386 13 3 12.7761 3 12.5V2.5C3 2.22386 3.22386 2 3.5 2H4V2.25C4 2.66421 4.33579 3 4.75 3H10.25C10.6642 3 11 2.66421 11 2.25V2H11.5C11.7761 2 12 2.22386 12 2.5V7H13V2.5C13 1.67157 12.3284 1 11.5 1H11V0.75C11 0.335786 10.6642 0 10.25 0H4.75ZM9 8.5C9 8.77614 8.77614 9 8.5 9C8.22386 9 8 8.77614 8 8.5C8 8.22386 8.22386 8 8.5 8C8.77614 8 9 8.22386 9 8.5ZM10.5 9C10.7761 9 11 8.77614 11 8.5C11 8.22386 10.7761 8 10.5 8C10.2239 8 10 8.22386 10 8.5C10 8.77614 10.2239 9 10.5 9ZM13 8.5C13 8.77614 12.7761 9 12.5 9C12.2239 9 12 8.77614 12 8.5C12 8.22386 12.2239 8 12.5 8C12.7761 8 13 8.22386 13 8.5ZM14.5 9C14.7761 9 15 8.77614 15 8.5C15 8.22386 14.7761 8 14.5 8C14.2239 8 14 8.22386 14 8.5C14 8.77614 14.2239 9 14.5 9ZM15 10.5C15 10.7761 14.7761 11 14.5 11C14.2239 11 14 10.7761 14 10.5C14 10.2239 14.2239 10 14.5 10C14.7761 10 15 10.2239 15 10.5ZM14.5 13C14.7761 13 15 12.7761 15 12.5C15 12.2239 14.7761 12 14.5 12C14.2239 12 14 12.2239 14 12.5C14 12.7761 14.2239 13 14.5 13ZM14.5 15C14.7761 15 15 14.7761 15 14.5C15 14.2239 14.7761 14 14.5 14C14.2239 14 14 14.2239 14 14.5C14 14.7761 14.2239 15 14.5 15ZM8.5 11C8.77614 11 9 10.7761 9 10.5C9 10.2239 8.77614 10 8.5 10C8.22386 10 8 10.2239 8 10.5C8 10.7761 8.22386 11 8.5 11ZM9 12.5C9 12.7761 8.77614 13 8.5 13C8.22386 13 8 12.7761 8 12.5C8 12.2239 8.22386 12 8.5 12C8.77614 12 9 12.2239 9 12.5ZM8.5 15C8.77614 15 9 14.7761 9 14.5C9 14.2239 8.77614 14 8.5 14C8.22386 14 8 14.2239 8 14.5C8 14.7761 8.22386 15 8.5 15ZM11 14.5C11 14.7761 10.7761 15 10.5 15C10.2239 15 10 14.7761 10 14.5C10 14.2239 10.2239 14 10.5 14C10.7761 14 11 14.2239 11 14.5ZM12.5 15C12.7761 15 13 14.7761 13 14.5C13 14.2239 12.7761 14 12.5 14C12.2239 14 12 14.2239 12 14.5C12 14.7761 12.2239 15 12.5 15Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Vj=["color"],oa=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,Vj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Hj=["color"],Wj=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,Hj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),qj=["color"],Uj=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,qj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M14.7649 6.07596C14.9991 6.22231 15.0703 6.53079 14.9239 6.76495C14.4849 7.46743 13.9632 8.10645 13.3702 8.66305L14.5712 9.86406C14.7664 10.0593 14.7664 10.3759 14.5712 10.5712C14.3759 10.7664 14.0593 10.7664 13.8641 10.5712L12.6011 9.30817C11.805 9.90283 10.9089 10.3621 9.93375 10.651L10.383 12.3277C10.4544 12.5944 10.2961 12.8685 10.0294 12.94C9.76267 13.0115 9.4885 12.8532 9.41704 12.5865L8.95917 10.8775C8.48743 10.958 8.00036 10.9999 7.50001 10.9999C6.99965 10.9999 6.51257 10.958 6.04082 10.8775L5.58299 12.5864C5.51153 12.8532 5.23737 13.0115 4.97064 12.94C4.7039 12.8686 4.5456 12.5944 4.61706 12.3277L5.06625 10.651C4.09111 10.3621 3.19503 9.90282 2.3989 9.30815L1.1359 10.5712C0.940638 10.7664 0.624058 10.7664 0.428798 10.5712C0.233537 10.3759 0.233537 10.0593 0.428798 9.86405L1.62982 8.66303C1.03682 8.10643 0.515113 7.46742 0.0760677 6.76495C-0.0702867 6.53079 0.000898544 6.22231 0.235065 6.07596C0.469231 5.9296 0.777703 6.00079 0.924058 6.23496C1.40354 7.00213 1.989 7.68057 2.66233 8.2427C2.67315 8.25096 2.6837 8.25972 2.69397 8.26898C4.00897 9.35527 5.65537 9.99991 7.50001 9.99991C10.3078 9.99991 12.6564 8.5063 14.076 6.23495C14.2223 6.00079 14.5308 5.9296 14.7649 6.07596Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Gj=["color"],Yj=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,Gj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M7.5 11C4.80285 11 2.52952 9.62184 1.09622 7.50001C2.52952 5.37816 4.80285 4 7.5 4C10.1971 4 12.4705 5.37816 13.9038 7.50001C12.4705 9.62183 10.1971 11 7.5 11ZM7.5 3C4.30786 3 1.65639 4.70638 0.0760002 7.23501C-0.0253338 7.39715 -0.0253334 7.60288 0.0760014 7.76501C1.65639 10.2936 4.30786 12 7.5 12C10.6921 12 13.3436 10.2936 14.924 7.76501C15.0253 7.60288 15.0253 7.39715 14.924 7.23501C13.3436 4.70638 10.6921 3 7.5 3ZM7.5 9.5C8.60457 9.5 9.5 8.60457 9.5 7.5C9.5 6.39543 8.60457 5.5 7.5 5.5C6.39543 5.5 5.5 6.39543 5.5 7.5C5.5 8.60457 6.39543 9.5 7.5 9.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Kj=["color"],e2=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,Kj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM8.24992 4.49999C8.24992 4.9142 7.91413 5.24999 7.49992 5.24999C7.08571 5.24999 6.74992 4.9142 6.74992 4.49999C6.74992 4.08577 7.08571 3.74999 7.49992 3.74999C7.91413 3.74999 8.24992 4.08577 8.24992 4.49999ZM6.00003 5.99999H6.50003H7.50003C7.77618 5.99999 8.00003 6.22384 8.00003 6.49999V9.99999H8.50003H9.00003V11H8.50003H7.50003H6.50003H6.00003V9.99999H6.50003H7.00003V6.99999H6.50003H6.00003V5.99999Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Xj=["color"],Qj=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,Xj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M1.20308 1.04312C1.00481 0.954998 0.772341 1.0048 0.627577 1.16641C0.482813 1.32802 0.458794 1.56455 0.568117 1.75196L3.92115 7.50002L0.568117 13.2481C0.458794 13.4355 0.482813 13.672 0.627577 13.8336C0.772341 13.9952 1.00481 14.045 1.20308 13.9569L14.7031 7.95693C14.8836 7.87668 15 7.69762 15 7.50002C15 7.30243 14.8836 7.12337 14.7031 7.04312L1.20308 1.04312ZM4.84553 7.10002L2.21234 2.586L13.2689 7.50002L2.21234 12.414L4.84552 7.90002H9C9.22092 7.90002 9.4 7.72094 9.4 7.50002C9.4 7.27911 9.22092 7.10002 9 7.10002H4.84553Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Jj=["color"],Zj=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,Jj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M3.24182 2.32181C3.3919 2.23132 3.5784 2.22601 3.73338 2.30781L12.7334 7.05781C12.8974 7.14436 13 7.31457 13 7.5C13 7.68543 12.8974 7.85564 12.7334 7.94219L3.73338 12.6922C3.5784 12.774 3.3919 12.7687 3.24182 12.6782C3.09175 12.5877 3 12.4252 3 12.25V2.75C3 2.57476 3.09175 2.4123 3.24182 2.32181ZM4 3.57925V11.4207L11.4288 7.5L4 3.57925Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});let yh;const ez=new Uint8Array(16);function tz(){if(!yh&&(yh=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!yh))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return yh(ez)}const Ln=[];for(let e=0;e<256;++e)Ln.push((e+256).toString(16).slice(1));function nz(e,t=0){return Ln[e[t+0]]+Ln[e[t+1]]+Ln[e[t+2]]+Ln[e[t+3]]+"-"+Ln[e[t+4]]+Ln[e[t+5]]+"-"+Ln[e[t+6]]+Ln[e[t+7]]+"-"+Ln[e[t+8]]+Ln[e[t+9]]+"-"+Ln[e[t+10]]+Ln[e[t+11]]+Ln[e[t+12]]+Ln[e[t+13]]+Ln[e[t+14]]+Ln[e[t+15]]}const t2={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function wu(e,t,n){if(t2.randomUUID&&!t&&!e)return t2.randomUUID();e=e||{};const r=e.random||(e.rng||tz)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return nz(r)}const _e=pw()(Ow((e,t)=>({isShowingVisual:!0,runSql:!1,sqlGen:{},sql:"",isSqlRunning:!1,showFilters:!1,applyFilters:!1,filterValues:[{filterId:"sample-filter-id",valueType:"string",name:"",operation:"in",values:[""]}],card:{id:wu(),title:"Editor Card",description:"Desdcription",type:"bar",data:[]},actions:{setCardPreferences:n=>{e(r=>{r.card.preferences=n})},setFilterOnClickField:n=>{e(r=>{r.card.preferences={...r.card.preferences,filterOnClick:!0,filterOnClickField:n}})},setCardRefreshInterval:n=>{e(r=>{r.card.refreshInterval=n})},setIsShowingVisual:n=>{e({isShowingVisual:n})},setRunSql:n=>{e({runSql:n})},setIsSqlRunning:n=>{e({isSqlRunning:n})},setCard:n=>{e({card:n})},setCardType:n=>{e(r=>{r.card.type=n})},setCardSql:n=>{e(r=>{r.card.sql=n})},setCardCustomCfg:n=>{e(r=>{r.card.customCfg=n})},setCardCfg:n=>{e(r=>{r.card.cfg=n})},setShowFilters:n=>{e(r=>{r.showFilters=n})},setApplyFilters:n=>{e(r=>{r.applyFilters=n})},setFilterValues:n=>{e(r=>{r.filterValues=n})},setSqlGen:n=>{e(r=>{r.sqlGen=n})},setSqlGenMeasure:(n,r)=>{e(i=>{i.sqlGen.measures=[...i.sqlGen.measures||[],{name:n,calc:r}]})},setSqlGenDimension:n=>{e(r=>{r.sqlGen.dimensions=[...r.sqlGen.dimensions||[],n]})},setCardData:n=>{e(r=>{r.card.data=n})},setSelectedConnectionId:n=>{var r,i;e(o=>{o.selectedConnectionId=n,o.card.connectionId=n}),(i=(r=t()).onConnectionChange)==null||i.call(r,n)},setSelectedDatabaseName:n=>{var r,i;e(o=>{o.selectedDatabaseName=n,o.card.lastSelectedDatabase=n}),(i=(r=t()).onDatabaseChange)==null||i.call(r,n)},setSelectedSchemaName:n=>{var r,i;e(o=>{o.selectedSchemaName=n,o.card.lastSelectedSchema=n}),(i=(r=t()).onSchemaChange)==null||i.call(r,n)},setSelectedTableName:n=>{var r,i;e(o=>{o.selectedTableName=n,o.card.lastSelectedTable=n}),(i=(r=t()).onTableChange)==null||i.call(r,n)},setCurrentColumns:n=>{e(r=>{r.currentColumns=n})},setOnConnectionChange:n=>{e({onConnectionChange:n})},setOnDatabaseChange:n=>{e({onDatabaseChange:n})},setOnSchemaChange:n=>{e({onSchemaChange:n})},setOnTableChange:n=>{e({onTableChange:n})},setOnSave:n=>{e({onSave:n})},setOnClose:n=>{e({onClose:n})}}})));process.env.NODE_ENV==="development"&&kw("EditorStore",_e);function rz({card:e}){const t=ge(y=>y.isDashboardEditing),n=ge(y=>y.filterValues),r=ge(y=>y.isVisualEditing),i=ge(y=>y.selectedSheetId),o=ge(y=>y.actions.removeCard),s=ge(y=>y.actions.setIsVisualEditing),a=_e(y=>y.actions.setFilterValues),l=_e(y=>y.actions.setApplyFilters),c=_e(y=>y.actions.setCard),d=_e(y=>y.actions.setSelectedConnectionId),f=_e(y=>y.actions.setSelectedDatabaseName),g=_e(y=>y.actions.setSelectedSchemaName),p=_e(y=>y.actions.setSelectedTableName);function v(){s(!r),c(e),e!=null&&e.connectionId&&d(e==null?void 0:e.connectionId),e!=null&&e.lastSelectedDatabase&&f(e==null?void 0:e.lastSelectedDatabase),e!=null&&e.lastSelectedSchema&&g(e==null?void 0:e.lastSelectedSchema),e!=null&&e.lastSelectedTable&&p(e==null?void 0:e.lastSelectedTable),n&&(a(n),l(!0))}return _.jsx("section",{className:"absolute right-2 top-2",children:t&&_.jsxs("div",{className:"flex items-center gap-2",children:[r?_.jsx(Uj,{onClick:()=>{s(!r)},className:"h-[14px] w-[14px] hover:cursor-pointer hover:text-foreground/50 text-foreground/30"}):_.jsx(Yj,{role:"edit-visual",onClick:v,className:"h-[14px] w-[14px] hover:cursor-pointer hover:text-foreground/50 text-foreground/30"}),_.jsx(oa,{onClick:()=>o(i,e),className:"h-[14px] w-[14px] hover:cursor-pointer hover:text-foreground/50 text-foreground/30"})]})})}function iz(e,t){var s,a,l,c;const n=ge.getState().themeStyle,r=(a=(s=n==null?void 0:n.chart)==null?void 0:s.dataset)==null?void 0:a.backgroundColor,i=(c=(l=n==null?void 0:n.chart)==null?void 0:l.dataset)==null?void 0:c.borderColor;return e.map((d,f)=>({label:d.charAt(0).toUpperCase()+d.slice(1),data:t.map(g=>g[d]),backgroundColor:r==null?void 0:r[f%r.length],borderColor:i==null?void 0:i[f%i.length]}))}function oz(e){var a,l,c,d;const{metricKeys:t,dimensionKeys:n}=sa(e);let r=[];const i=ge.getState().themeStyle,o=(l=(a=i==null?void 0:i.chart)==null?void 0:a.dataset)==null?void 0:l.backgroundColor,s=(d=(c=i==null?void 0:i.chart)==null?void 0:c.dataset)==null?void 0:d.borderColor;if((n==null?void 0:n.length)===1){const f=e.map(g=>({x:g[t[0]],y:g[t[1]],r:g[t[2]],label:g[n==null?void 0:n[0]]}));r=[{label:n==null?void 0:n[0],data:f}]}return(n==null?void 0:n.length)>1&&(r=[...new Set(e.map(g=>g[n==null?void 0:n[1]]))].map((g,p)=>{const v=e.filter(y=>y[n==null?void 0:n[1]]===g);return{label:g,data:v.map(y=>({x:y[t[0]],y:y[t[1]],r:y[t[2]],label:y[n==null?void 0:n[0]]})),backgroundColor:o==null?void 0:o[p%o.length],borderColor:s==null?void 0:s[p%s.length]}})),r}function sz(e,t){var s,a,l,c;const n=ge.getState().themeStyle,r=(a=(s=n==null?void 0:n.chart)==null?void 0:s.dataset)==null?void 0:a.backgroundColor,i=(c=(l=n==null?void 0:n.chart)==null?void 0:l.dataset)==null?void 0:c.borderColor;return e.map(d=>({label:d.charAt(0).toUpperCase()+d.slice(1),data:t.map(f=>f[d]),backgroundColor:t.map((f,g)=>r==null?void 0:r[g%r.length]),borderColor:t.map((f,g)=>i==null?void 0:i[g%i.length])}))}function sa(e){const t=Object.keys(e[0]),n=t.filter(i=>{var o,s,a,l;return!!(typeof e[0][i]&&typeof e[0][i]=="string"||typeof((o=e==null?void 0:e[1])==null?void 0:o[i])&&typeof((s=e==null?void 0:e[1])==null?void 0:s[i])=="string"||typeof((a=e==null?void 0:e[2])==null?void 0:a[i])&&typeof((l=e==null?void 0:e[2])==null?void 0:l[i])=="string")});n.length===0&&n.push(t[0]);const r=t.filter(i=>e[0][i]===+e[0][i]);return{dimensionKeys:n,metricKeys:r}}function Ob(e,t){var r;const n=(r=t==null?void 0:t.data)==null?void 0:r.datasets;return n&&n.length>0?e.map((o,s)=>({...o,...n[s],data:o.data,label:o.label})):e}function n2({dataArray:e,groupKey:t,pivotKey:n,valueKey:r}){const i=e.reduce((o,s)=>{const a=s[t],l=s[n],c=s[r];return o[a]||(o[a]={[t]:a}),o[a][l]=c,o},{});return Object.values(i)}function Pb(e,t){var s;const n=ge.getState().themeStyle,r=(s=n==null?void 0:n.chart)==null?void 0:s.options,i=Fs.cloneDeep(r);return Fs.merge(i,e,t)}function r2(e,t){return e.map(n=>n[t]?n[t]:"BLANK")}function aa({data:e,cfg:t,customCfg:n}){const{dimensionKeys:r,metricKeys:i}=sa(e),o=iz(i,e),s=Ob(o,n),a=r[0],l=r2(e,a),c=Pb((t==null?void 0:t.options)||{},(n==null?void 0:n.options)||{});return{type:(n==null?void 0:n.type)||(t==null?void 0:t.type)||"bar",data:{labels:l,datasets:s},options:c}}function az(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0},y:{display:!0}}}}}function lz(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function cz(e){var n,r,i,o;return{...e,type:"bar",options:{...e==null?void 0:e.options,scales:{x:{...(r=(n=e==null?void 0:e.options)==null?void 0:n.scales)==null?void 0:r.x,display:!0,stacked:!0},y:{...(o=(i=e==null?void 0:e.options)==null?void 0:i.scales)==null?void 0:o.y,display:!0,stacked:!0}}}}}function uz(e){return{...e,type:"line",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function i2(e,t){return{...t,type:e,options:{...t==null?void 0:t.options,scales:{x:{display:!1},y:{display:!1}}}}}function dz(e){return{...e,type:"radar",options:{...e==null?void 0:e.options,scales:{x:{display:!1},y:{display:!1}}}}}function kb({data:e,cardType:t="bar",cfg:n,customCfg:r,provider:i="chartjs",userSettings:o}){if(t==="bar"){const s=lz(n);return aa({data:e,cfg:s,customCfg:r,cardType:t,userSettings:o,provider:i})}if(t==="horizontalBar"){const s=az(n);return aa({data:e,cfg:s,customCfg:r,cardType:t,userSettings:o,provider:i})}if(t==="stackedBar"){const s=cz(n),{dimensionKeys:a,metricKeys:l}=sa(e),c=n2({dataArray:e,groupKey:a[0],pivotKey:a[1],valueKey:l[0]});return aa({data:c,cfg:s,customCfg:r,cardType:t,userSettings:o,provider:i})}if(t==="line"){const s=uz(n);return aa({data:e,cfg:s,customCfg:r,cardType:t,userSettings:o,provider:i})}if(t==="pie"||t==="doughnut"){const s=i2(t,n),{dimensionKeys:a,metricKeys:l}=sa(e),c=sz(l,e),d=Ob(c,r),f=a[0],g=r2(e,f),p=Pb((s==null?void 0:s.options)||{},(r==null?void 0:r.options)||{});return{type:t,data:{labels:g,datasets:d},options:p}}if(t==="radar"){const s=dz(n);return aa({data:e,cfg:s,customCfg:r,cardType:t,userSettings:o,provider:i})}if(t==="bubble"||t==="scatter"){const{metricKeys:s}=sa(e);if(s.length<3){console.log("Bubble charts require 3 numeric columns");return}const a=oz(e),l=Ob(a,r),c={plugins:{datalabels:{display:!0}},scales:{x:{title:{display:!0,text:s[0]},beginAtZero:!0,ticks:{precision:0}},y:{title:{display:!0,text:s[1]},beginAtZero:!0,ticks:{precision:0}}}},d=Pb(c,(r==null?void 0:r.options)||{});return{type:t,data:{datasets:l},options:d}}if(t==="polarArea"){const s=i2(t,n);return aa({data:e,cfg:s,customCfg:r,cardType:t,userSettings:o,provider:i})}return aa({data:e,cfg:n,customCfg:r,cardType:t,userSettings:o,provider:i})}var yl=1e3,xl=yl*60,wl=xl*60,la=wl*24,fz=la*7,hz=la*365.25,pz=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return gz(e);if(n==="number"&&isFinite(e))return t.long?vz(e):mz(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function gz(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*hz;case"weeks":case"week":case"w":return n*fz;case"days":case"day":case"d":return n*la;case"hours":case"hour":case"hrs":case"hr":case"h":return n*wl;case"minutes":case"minute":case"mins":case"min":case"m":return n*xl;case"seconds":case"second":case"secs":case"sec":case"s":return n*yl;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function mz(e){var t=Math.abs(e);return t>=la?Math.round(e/la)+"d":t>=wl?Math.round(e/wl)+"h":t>=xl?Math.round(e/xl)+"m":t>=yl?Math.round(e/yl)+"s":e+"ms"}function vz(e){var t=Math.abs(e);return t>=la?xh(e,t,la,"day"):t>=wl?xh(e,t,wl,"hour"):t>=xl?xh(e,t,xl,"minute"):t>=yl?xh(e,t,yl,"second"):e+" ms"}function xh(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+" "+r+(i?"s":"")}const bz=Pc(pz);function yz(e){const t=ge(l=>l.bookmarkKey),n=ge(l=>l.authToken),r=ge(l=>l.filterValues),i=ge(l=>l.isDashboardEditing),o=bz((e==null?void 0:e.refreshInterval)||"0"),s=Cr({queryKey:[e.id,e.sql],queryFn:()=>Ns("http://localhost:3000/api/v1/data",(n==null?void 0:n.accessToken)||"",{visual_id:e.id,active_filters:r}),refetchInterval:o,enabled:!!o&&!i}),a=Cr({queryKey:[e.id,e.sql],queryFn:()=>Ns("http://localhost:3000/api/v1/query",(n==null?void 0:n.accessToken)||"",{connection_id:e.connectionId,sql:e.sql,active_filters:r}),refetchInterval:o,enabled:!!o&&i});return i||t!==""?a:s}function xz(e,t=globalThis==null?void 0:globalThis.document){const n=wn(e);m.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const Mb="dismissableLayer.update",wz="dismissableLayer.pointerDownOutside",_z="dismissableLayer.focusOutside";let o2;const Sz=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_l=m.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=e,d=m.useContext(Sz),[f,g]=m.useState(null),p=(n=f==null?void 0:f.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,v]=m.useState({}),y=et(t,L=>g(L)),x=Array.from(d.layers),[w]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),S=x.indexOf(w),C=f?x.indexOf(f):-1,P=d.layersWithOutsidePointerEventsDisabled.size>0,O=C>=S,k=Cz(L=>{const F=L.target,j=[...d.branches].some(B=>B.contains(F));!O||j||(o==null||o(L),a==null||a(L),L.defaultPrevented||l==null||l())},p),A=Ez(L=>{const F=L.target;[...d.branches].some(B=>B.contains(F))||(s==null||s(L),a==null||a(L),L.defaultPrevented||l==null||l())},p);return xz(L=>{C===d.layers.size-1&&(i==null||i(L),!L.defaultPrevented&&l&&(L.preventDefault(),l()))},p),m.useEffect(()=>{if(f)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(o2=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),s2(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=o2)}},[f,p,r,d]),m.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),s2())},[f,d]),m.useEffect(()=>{const L=()=>v({});return document.addEventListener(Mb,L),()=>document.removeEventListener(Mb,L)},[]),m.createElement(Ve.div,ae({},c,{ref:y,style:{pointerEvents:P?O?"auto":"none":void 0,...e.style},onFocusCapture:Ee(e.onFocusCapture,A.onFocusCapture),onBlurCapture:Ee(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Ee(e.onPointerDownCapture,k.onPointerDownCapture)}))});function Cz(e,t=globalThis==null?void 0:globalThis.document){const n=wn(e),r=m.useRef(!1),i=m.useRef(()=>{});return m.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let c=function(){a2(wz,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=c,t.addEventListener("click",i.current,{once:!0})):c()}else t.removeEventListener("click",i.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Ez(e,t=globalThis==null?void 0:globalThis.document){const n=wn(e),r=m.useRef(!1);return m.useEffect(()=>{const i=o=>{o.target&&!r.current&&a2(_z,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function s2(){const e=new CustomEvent(Mb);document.dispatchEvent(e)}function a2(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Qw(i,o):i.dispatchEvent(o)}const Oz=["top","right","bottom","left"],Xo=Math.min,Mr=Math.max,wh=Math.round,_h=Math.floor,Qo=e=>({x:e,y:e}),Pz={left:"right",right:"left",bottom:"top",top:"bottom"},kz={start:"end",end:"start"};function Db(e,t,n){return Mr(e,Xo(t,n))}function go(e,t){return typeof e=="function"?e(t):e}function mo(e){return e.split("-")[0]}function Sl(e){return e.split("-")[1]}function Tb(e){return e==="x"?"y":"x"}function Ab(e){return e==="y"?"height":"width"}function Cl(e){return["top","bottom"].includes(mo(e))?"y":"x"}function Ib(e){return Tb(Cl(e))}function Mz(e,t,n){n===void 0&&(n=!1);const r=Sl(e),i=Ib(e),o=Ab(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Sh(s)),[s,Sh(s)]}function Dz(e){const t=Sh(e);return[Nb(e),t,Nb(t)]}function Nb(e){return e.replace(/start|end/g,t=>kz[t])}function Tz(e,t,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?o:s;default:return[]}}function Az(e,t,n,r){const i=Sl(e);let o=Tz(mo(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(Nb)))),o}function Sh(e){return e.replace(/left|right|bottom|top/g,t=>Pz[t])}function Iz(e){return{top:0,right:0,bottom:0,left:0,...e}}function l2(e){return typeof e!="number"?Iz(e):{top:e,right:e,bottom:e,left:e}}function Ch(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function c2(e,t,n){let{reference:r,floating:i}=e;const o=Cl(t),s=Ib(t),a=Ab(s),l=mo(t),c=o==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,g=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Sl(t)){case"start":p[s]-=g*(n&&c?-1:1);break;case"end":p[s]+=g*(n&&c?-1:1);break}return p}const Nz=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:f}=c2(c,r,l),g=r,p={},v=0;for(let y=0;y<a.length;y++){const{name:x,fn:w}=a[y],{x:S,y:C,data:P,reset:O}=await w({x:d,y:f,initialPlacement:r,placement:g,strategy:i,middlewareData:p,rects:c,platform:s,elements:{reference:e,floating:t}});if(d=S??d,f=C??f,p={...p,[x]:{...p[x],...P}},O&&v<=50){v++,typeof O=="object"&&(O.placement&&(g=O.placement),O.rects&&(c=O.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):O.rects),{x:d,y:f}=c2(c,g,l)),y=-1;continue}}return{x:d,y:f,placement:g,strategy:i,middlewareData:p}};async function _u(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:g=!1,padding:p=0}=go(t,e),v=l2(p),x=a[g?f==="floating"?"reference":"floating":f],w=Ch(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(x)))==null||n?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),S=f==="floating"?{...s.floating,x:r,y:i}:s.reference,C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),P=await(o.isElement==null?void 0:o.isElement(C))?await(o.getScale==null?void 0:o.getScale(C))||{x:1,y:1}:{x:1,y:1},O=Ch(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({rect:S,offsetParent:C,strategy:l}):S);return{top:(w.top-O.top+v.top)/P.y,bottom:(O.bottom-w.bottom+v.bottom)/P.y,left:(w.left-O.left+v.left)/P.x,right:(O.right-w.right+v.right)/P.x}}const u2=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:d=0}=go(e,t)||{};if(c==null)return{};const f=l2(d),g={x:n,y:r},p=Ib(i),v=Ab(p),y=await s.getDimensions(c),x=p==="y",w=x?"top":"left",S=x?"bottom":"right",C=x?"clientHeight":"clientWidth",P=o.reference[v]+o.reference[p]-g[p]-o.floating[v],O=g[p]-o.reference[p],k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let A=k?k[C]:0;(!A||!await(s.isElement==null?void 0:s.isElement(k)))&&(A=a.floating[C]||o.floating[v]);const L=P/2-O/2,F=A/2-y[v]/2-1,j=Xo(f[w],F),B=Xo(f[S],F),H=j,K=A-y[v]-B,Y=A/2-y[v]/2+L,$=Db(H,Y,K),Z=!l.arrow&&Sl(i)!=null&&Y!=$&&o.reference[v]/2-(Y<H?j:B)-y[v]/2<0,U=Z?Y<H?Y-H:Y-K:0;return{[p]:g[p]+U,data:{[p]:$,centerOffset:Y-$-U,...Z&&{alignmentOffset:U}},reset:Z}}}),Rz=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:y=!0,...x}=go(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const w=mo(i),S=mo(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(c.floating)),P=g||(S||!y?[Sh(a)]:Dz(a));!g&&v!=="none"&&P.push(...Az(a,y,v,C));const O=[a,...P],k=await _u(t,x),A=[];let L=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&A.push(k[w]),f){const H=Mz(i,s,C);A.push(k[H[0]],k[H[1]])}if(L=[...L,{placement:i,overflows:A}],!A.every(H=>H<=0)){var F,j;const H=(((F=o.flip)==null?void 0:F.index)||0)+1,K=O[H];if(K)return{data:{index:H,overflows:L},reset:{placement:K}};let Y=(j=L.filter($=>$.overflows[0]<=0).sort(($,Z)=>$.overflows[1]-Z.overflows[1])[0])==null?void 0:j.placement;if(!Y)switch(p){case"bestFit":{var B;const $=(B=L.map(Z=>[Z.placement,Z.overflows.filter(U=>U>0).reduce((U,ie)=>U+ie,0)]).sort((Z,U)=>Z[1]-U[1])[0])==null?void 0:B[0];$&&(Y=$);break}case"initialPlacement":Y=a;break}if(i!==Y)return{reset:{placement:Y}}}return{}}}};function d2(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function f2(e){return Oz.some(t=>e[t]>=0)}const Lz=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=go(e,t);switch(r){case"referenceHidden":{const o=await _u(t,{...i,elementContext:"reference"}),s=d2(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:f2(s)}}}case"escaped":{const o=await _u(t,{...i,altBoundary:!0}),s=d2(o,n.floating);return{data:{escapedOffsets:s,escaped:f2(s)}}}default:return{}}}}};async function $z(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=mo(n),a=Sl(n),l=Cl(n)==="y",c=["left","top"].includes(s)?-1:1,d=o&&l?-1:1,f=go(t,e);let{mainAxis:g,crossAxis:p,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof v=="number"&&(p=a==="end"?v*-1:v),l?{x:p*d,y:g*c}:{x:g*c,y:p*d}}const Fz=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await $z(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},jz=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:w,y:S}=x;return{x:w,y:S}}},...l}=go(e,t),c={x:n,y:r},d=await _u(t,l),f=Cl(mo(i)),g=Tb(f);let p=c[g],v=c[f];if(o){const x=g==="y"?"top":"left",w=g==="y"?"bottom":"right",S=p+d[x],C=p-d[w];p=Db(S,p,C)}if(s){const x=f==="y"?"top":"left",w=f==="y"?"bottom":"right",S=v+d[x],C=v-d[w];v=Db(S,v,C)}const y=a.fn({...t,[g]:p,[f]:v});return{...y,data:{x:y.x-n,y:y.y-r}}}}},zz=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=go(e,t),d={x:n,y:r},f=Cl(i),g=Tb(f);let p=d[g],v=d[f];const y=go(a,t),x=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(l){const C=g==="y"?"height":"width",P=o.reference[g]-o.floating[C]+x.mainAxis,O=o.reference[g]+o.reference[C]-x.mainAxis;p<P?p=P:p>O&&(p=O)}if(c){var w,S;const C=g==="y"?"width":"height",P=["top","left"].includes(mo(i)),O=o.reference[f]-o.floating[C]+(P&&((w=s.offset)==null?void 0:w[f])||0)+(P?0:x.crossAxis),k=o.reference[f]+o.reference[C]+(P?0:((S=s.offset)==null?void 0:S[f])||0)-(P?x.crossAxis:0);v<O?v=O:v>k&&(v=k)}return{[g]:p,[f]:v}}}},Bz=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:i,elements:o}=t,{apply:s=()=>{},...a}=go(e,t),l=await _u(t,a),c=mo(n),d=Sl(n),f=Cl(n)==="y",{width:g,height:p}=r.floating;let v,y;c==="top"||c==="bottom"?(v=c,y=d===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(y=c,v=d==="end"?"top":"bottom");const x=p-l[v],w=g-l[y],S=!t.middlewareData.shift;let C=x,P=w;if(f){const k=g-l.left-l.right;P=d||S?Xo(w,k):k}else{const k=p-l.top-l.bottom;C=d||S?Xo(x,k):k}if(S&&!d){const k=Mr(l.left,0),A=Mr(l.right,0),L=Mr(l.top,0),F=Mr(l.bottom,0);f?P=g-2*(k!==0||A!==0?k+A:Mr(l.left,l.right)):C=p-2*(L!==0||F!==0?L+F:Mr(l.top,l.bottom))}await s({...t,availableWidth:P,availableHeight:C});const O=await i.getDimensions(o.floating);return g!==O.width||p!==O.height?{reset:{rects:!0}}:{}}}};function Jo(e){return h2(e)?(e.nodeName||"").toLowerCase():"#document"}function Dr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function vo(e){var t;return(t=(h2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function h2(e){return e instanceof Node||e instanceof Dr(e).Node}function bo(e){return e instanceof Element||e instanceof Dr(e).Element}function Fi(e){return e instanceof HTMLElement||e instanceof Dr(e).HTMLElement}function p2(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Dr(e).ShadowRoot}function Su(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Zr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function Vz(e){return["table","td","th"].includes(Jo(e))}function Rb(e){const t=Lb(),n=Zr(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Hz(e){let t=El(e);for(;Fi(t)&&!Eh(t);){if(Rb(t))return t;t=El(t)}return null}function Lb(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Eh(e){return["html","body","#document"].includes(Jo(e))}function Zr(e){return Dr(e).getComputedStyle(e)}function Oh(e){return bo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function El(e){if(Jo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||p2(e)&&e.host||vo(e);return p2(t)?t.host:t}function g2(e){const t=El(e);return Eh(t)?e.ownerDocument?e.ownerDocument.body:e.body:Fi(t)&&Su(t)?t:g2(t)}function Cu(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=g2(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=Dr(i);return o?t.concat(s,s.visualViewport||[],Su(i)?i:[],s.frameElement&&n?Cu(s.frameElement):[]):t.concat(i,Cu(i,[],n))}function m2(e){const t=Zr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Fi(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=wh(n)!==o||wh(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function $b(e){return bo(e)?e:e.contextElement}function Ol(e){const t=$b(e);if(!Fi(t))return Qo(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=m2(t);let s=(o?wh(n.width):n.width)/r,a=(o?wh(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Wz=Qo(0);function v2(e){const t=Dr(e);return!Lb()||!t.visualViewport?Wz:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qz(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Dr(e)?!1:t}function ca(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=$b(e);let s=Qo(1);t&&(r?bo(r)&&(s=Ol(r)):s=Ol(e));const a=qz(o,n,r)?v2(o):Qo(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){const g=Dr(o),p=r&&bo(r)?Dr(r):r;let v=g.frameElement;for(;v&&r&&p!==g;){const y=Ol(v),x=v.getBoundingClientRect(),w=Zr(v),S=x.left+(v.clientLeft+parseFloat(w.paddingLeft))*y.x,C=x.top+(v.clientTop+parseFloat(w.paddingTop))*y.y;l*=y.x,c*=y.y,d*=y.x,f*=y.y,l+=S,c+=C,v=Dr(v).frameElement}}return Ch({width:d,height:f,x:l,y:c})}function Uz(e){let{rect:t,offsetParent:n,strategy:r}=e;const i=Fi(n),o=vo(n);if(n===o)return t;let s={scrollLeft:0,scrollTop:0},a=Qo(1);const l=Qo(0);if((i||!i&&r!=="fixed")&&((Jo(n)!=="body"||Su(o))&&(s=Oh(n)),Fi(n))){const c=ca(n);a=Ol(n),l.x=c.x+n.clientLeft,l.y=c.y+n.clientTop}return{width:t.width*a.x,height:t.height*a.y,x:t.x*a.x-s.scrollLeft*a.x+l.x,y:t.y*a.y-s.scrollTop*a.y+l.y}}function Gz(e){return Array.from(e.getClientRects())}function b2(e){return ca(vo(e)).left+Oh(e).scrollLeft}function Yz(e){const t=vo(e),n=Oh(e),r=e.ownerDocument.body,i=Mr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Mr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+b2(e);const a=-n.scrollTop;return Zr(r).direction==="rtl"&&(s+=Mr(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function Kz(e,t){const n=Dr(e),r=vo(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const c=Lb();(!c||c&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}function Xz(e,t){const n=ca(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Fi(e)?Ol(e):Qo(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:s,height:a,x:l,y:c}}function y2(e,t,n){let r;if(t==="viewport")r=Kz(e,n);else if(t==="document")r=Yz(vo(e));else if(bo(t))r=Xz(t,n);else{const i=v2(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Ch(r)}function x2(e,t){const n=El(e);return n===t||!bo(n)||Eh(n)?!1:Zr(n).position==="fixed"||x2(n,t)}function Qz(e,t){const n=t.get(e);if(n)return n;let r=Cu(e,[],!1).filter(a=>bo(a)&&Jo(a)!=="body"),i=null;const o=Zr(e).position==="fixed";let s=o?El(e):e;for(;bo(s)&&!Eh(s);){const a=Zr(s),l=Rb(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Su(s)&&!l&&x2(e,s))?r=r.filter(d=>d!==s):i=a,s=El(s)}return t.set(e,r),r}function Jz(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Qz(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,d)=>{const f=y2(t,d,i);return c.top=Mr(f.top,c.top),c.right=Xo(f.right,c.right),c.bottom=Xo(f.bottom,c.bottom),c.left=Mr(f.left,c.left),c},y2(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Zz(e){return m2(e)}function eB(e,t,n){const r=Fi(t),i=vo(t),o=n==="fixed",s=ca(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Qo(0);if(r||!r&&!o)if((Jo(t)!=="body"||Su(i))&&(a=Oh(t)),r){const c=ca(t,!0,o,t);l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}else i&&(l.x=b2(i));return{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function w2(e,t){return!Fi(e)||Zr(e).position==="fixed"?null:t?t(e):e.offsetParent}function _2(e,t){const n=Dr(e);if(!Fi(e))return n;let r=w2(e,t);for(;r&&Vz(r)&&Zr(r).position==="static";)r=w2(r,t);return r&&(Jo(r)==="html"||Jo(r)==="body"&&Zr(r).position==="static"&&!Rb(r))?n:r||Hz(e)||n}const tB=async function(e){let{reference:t,floating:n,strategy:r}=e;const i=this.getOffsetParent||_2,o=this.getDimensions;return{reference:eB(t,await i(n),r),floating:{x:0,y:0,...await o(n)}}};function nB(e){return Zr(e).direction==="rtl"}const rB={convertOffsetParentRelativeRectToViewportRelativeRect:Uz,getDocumentElement:vo,getClippingRect:Jz,getOffsetParent:_2,getElementRects:tB,getClientRects:Gz,getDimensions:Zz,getScale:Ol,isElement:bo,isRTL:nB};function iB(e,t){let n=null,r;const i=vo(e);function o(){clearTimeout(r),n&&n.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const{left:c,top:d,width:f,height:g}=e.getBoundingClientRect();if(a||t(),!f||!g)return;const p=_h(d),v=_h(i.clientWidth-(c+f)),y=_h(i.clientHeight-(d+g)),x=_h(c),S={rootMargin:-p+"px "+-v+"px "+-y+"px "+-x+"px",threshold:Mr(0,Xo(1,l))||1};let C=!0;function P(O){const k=O[0].intersectionRatio;if(k!==l){if(!C)return s();k?s(!1,k):r=setTimeout(()=>{s(!1,1e-7)},100)}C=!1}try{n=new IntersectionObserver(P,{...S,root:i.ownerDocument})}catch{n=new IntersectionObserver(P,S)}n.observe(e)}return s(!0),o}function oB(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=$b(e),d=i||o?[...c?Cu(c):[],...Cu(t)]:[];d.forEach(w=>{i&&w.addEventListener("scroll",n,{passive:!0}),o&&w.addEventListener("resize",n)});const f=c&&a?iB(c,n):null;let g=-1,p=null;s&&(p=new ResizeObserver(w=>{let[S]=w;S&&S.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{p&&p.observe(t)})),n()}),c&&!l&&p.observe(c),p.observe(t));let v,y=l?ca(e):null;l&&x();function x(){const w=ca(e);y&&(w.x!==y.x||w.y!==y.y||w.width!==y.width||w.height!==y.height)&&n(),y=w,v=requestAnimationFrame(x)}return n(),()=>{d.forEach(w=>{i&&w.removeEventListener("scroll",n),o&&w.removeEventListener("resize",n)}),f&&f(),p&&p.disconnect(),p=null,l&&cancelAnimationFrame(v)}}const sB=(e,t,n)=>{const r=new Map,i={platform:rB,...n},o={...i.platform,_c:r};return Nz(e,t,{...i,platform:o})},aB=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?u2({element:r.current,padding:i}).fn(n):{}:r?u2({element:r,padding:i}).fn(n):{}}}};var Ph=typeof document<"u"?m.useLayoutEffect:m.useEffect;function kh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!kh(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!kh(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function S2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function C2(e,t){const n=S2(e);return Math.round(t*n)/n}function E2(e){const t=de.useRef(e);return Ph(()=>{t.current=e}),t}function lB(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[d,f]=de.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,p]=de.useState(r);kh(g,r)||p(r);const[v,y]=de.useState(null),[x,w]=de.useState(null),S=de.useCallback(Z=>{Z!=k.current&&(k.current=Z,y(Z))},[y]),C=de.useCallback(Z=>{Z!==A.current&&(A.current=Z,w(Z))},[w]),P=o||v,O=s||x,k=de.useRef(null),A=de.useRef(null),L=de.useRef(d),F=E2(l),j=E2(i),B=de.useCallback(()=>{if(!k.current||!A.current)return;const Z={placement:t,strategy:n,middleware:g};j.current&&(Z.platform=j.current),sB(k.current,A.current,Z).then(U=>{const ie={...U,isPositioned:!0};H.current&&!kh(L.current,ie)&&(L.current=ie,i3.flushSync(()=>{f(ie)}))})},[g,t,n,j]);Ph(()=>{c===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,f(Z=>({...Z,isPositioned:!1})))},[c]);const H=de.useRef(!1);Ph(()=>(H.current=!0,()=>{H.current=!1}),[]),Ph(()=>{if(P&&(k.current=P),O&&(A.current=O),P&&O){if(F.current)return F.current(P,O,B);B()}},[P,O,B,F]);const K=de.useMemo(()=>({reference:k,floating:A,setReference:S,setFloating:C}),[S,C]),Y=de.useMemo(()=>({reference:P,floating:O}),[P,O]),$=de.useMemo(()=>{const Z={position:n,left:0,top:0};if(!Y.floating)return Z;const U=C2(Y.floating,d.x),ie=C2(Y.floating,d.y);return a?{...Z,transform:"translate("+U+"px, "+ie+"px)",...S2(Y.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:ie}},[n,a,Y.floating,d.x,d.y]);return de.useMemo(()=>({...d,update:B,refs:K,elements:Y,floatingStyles:$}),[d,B,K,Y,$])}function Mh(e){const[t,n]=m.useState(void 0);return Hn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const l=o.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const O2="Popper",[P2,ji]=kn(O2),[cB,k2]=P2(O2),uB=e=>{const{__scopePopper:t,children:n}=e,[r,i]=m.useState(null);return m.createElement(cB,{scope:t,anchor:r,onAnchorChange:i},n)},dB="PopperAnchor",fB=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,o=k2(dB,n),s=m.useRef(null),a=et(t,s);return m.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:m.createElement(Ve.div,ae({},i,{ref:a}))}),M2="PopperContent",[hB,Lde]=P2(M2),pB=m.forwardRef((e,t)=>{var n,r,i,o,s,a,l,c;const{__scopePopper:d,side:f="bottom",sideOffset:g=0,align:p="center",alignOffset:v=0,arrowPadding:y=0,avoidCollisions:x=!0,collisionBoundary:w=[],collisionPadding:S=0,sticky:C="partial",hideWhenDetached:P=!1,updatePositionStrategy:O="optimized",onPlaced:k,...A}=e,L=k2(M2,d),[F,j]=m.useState(null),B=et(t,He=>j(He)),[H,K]=m.useState(null),Y=Mh(H),$=(n=Y==null?void 0:Y.width)!==null&&n!==void 0?n:0,Z=(r=Y==null?void 0:Y.height)!==null&&r!==void 0?r:0,U=f+(p!=="center"?"-"+p:""),ie=typeof S=="number"?S:{top:0,right:0,bottom:0,left:0,...S},le=Array.isArray(w)?w:[w],M=le.length>0,W={padding:ie,boundary:le.filter(gB),altBoundary:M},{refs:ne,floatingStyles:N,placement:X,isPositioned:me,middlewareData:he}=lB({strategy:"fixed",placement:U,whileElementsMounted:(...He)=>oB(...He,{animationFrame:O==="always"}),elements:{reference:L.anchor},middleware:[Fz({mainAxis:g+Z,alignmentAxis:v}),x&&jz({mainAxis:!0,crossAxis:!1,limiter:C==="partial"?zz():void 0,...W}),x&&Rz({...W}),Bz({...W,apply:({elements:He,rects:Fe,availableWidth:xt,availableHeight:ht})=>{const{width:pt,height:Bt}=Fe.reference,Ot=He.floating.style;Ot.setProperty("--radix-popper-available-width",`${xt}px`),Ot.setProperty("--radix-popper-available-height",`${ht}px`),Ot.setProperty("--radix-popper-anchor-width",`${pt}px`),Ot.setProperty("--radix-popper-anchor-height",`${Bt}px`)}}),H&&aB({element:H,padding:y}),mB({arrowWidth:$,arrowHeight:Z}),P&&Lz({strategy:"referenceHidden",...W})]}),[fe,re]=D2(X),ee=wn(k);Hn(()=>{me&&(ee==null||ee())},[me,ee]);const oe=(i=he.arrow)===null||i===void 0?void 0:i.x,xe=(o=he.arrow)===null||o===void 0?void 0:o.y,V=((s=he.arrow)===null||s===void 0?void 0:s.centerOffset)!==0,[Me,$e]=m.useState();return Hn(()=>{F&&$e(window.getComputedStyle(F).zIndex)},[F]),m.createElement("div",{ref:ne.setFloating,"data-radix-popper-content-wrapper":"",style:{...N,transform:me?N.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Me,"--radix-popper-transform-origin":[(a=he.transformOrigin)===null||a===void 0?void 0:a.x,(l=he.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:e.dir},m.createElement(hB,{scope:d,placedSide:fe,onArrowChange:K,arrowX:oe,arrowY:xe,shouldHideArrow:V},m.createElement(Ve.div,ae({"data-side":fe,"data-align":re},A,{ref:B,style:{...A.style,animation:me?void 0:"none",opacity:(c=he.hide)!==null&&c!==void 0&&c.referenceHidden?0:void 0}}))))});function gB(e){return e!==null}const mB=e=>({name:"transformOrigin",options:e,fn(t){var n,r,i,o,s;const{placement:a,rects:l,middlewareData:c}=t,f=((n=c.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,g=f?0:e.arrowWidth,p=f?0:e.arrowHeight,[v,y]=D2(a),x={start:"0%",center:"50%",end:"100%"}[y],w=((r=(i=c.arrow)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)+g/2,S=((o=(s=c.arrow)===null||s===void 0?void 0:s.y)!==null&&o!==void 0?o:0)+p/2;let C="",P="";return v==="bottom"?(C=f?x:`${w}px`,P=`${-p}px`):v==="top"?(C=f?x:`${w}px`,P=`${l.floating.height+p}px`):v==="right"?(C=`${-p}px`,P=f?x:`${S}px`):v==="left"&&(C=`${l.floating.width+p}px`,P=f?x:`${S}px`),{data:{x:C,y:P}}}});function D2(e){const[t,n="center"]=e.split("-");return[t,n]}const Eu=uB,Ou=fB,Pu=pB,Dh=m.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...i}=e;return r?Mt.createPortal(m.createElement(Ve.div,ae({},i,{ref:t})),r):null}),T2=m.forwardRef((e,t)=>m.createElement(Ve.span,ae({},e,{ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}))),vB=T2,[Th,$de]=kn("Tooltip",[ji]),Fb=ji(),bB="TooltipProvider",yB=700,jb="tooltip.open",[xB,zb]=Th(bB),wB=e=>{const{__scopeTooltip:t,delayDuration:n=yB,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:o}=e,[s,a]=m.useState(!0),l=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),m.createElement(xB,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:m.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(d=>{l.current=d},[]),disableHoverableContent:i},o)},Bb="Tooltip",[_B,Ah]=Th(Bb),SB=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i=!1,onOpenChange:o,disableHoverableContent:s,delayDuration:a}=e,l=zb(Bb,e.__scopeTooltip),c=Fb(t),[d,f]=m.useState(null),g=sr(),p=m.useRef(0),v=s??l.disableHoverableContent,y=a??l.delayDuration,x=m.useRef(!1),[w=!1,S]=Jn({prop:r,defaultProp:i,onChange:A=>{A?(l.onOpen(),document.dispatchEvent(new CustomEvent(jb))):l.onClose(),o==null||o(A)}}),C=m.useMemo(()=>w?x.current?"delayed-open":"instant-open":"closed",[w]),P=m.useCallback(()=>{window.clearTimeout(p.current),x.current=!1,S(!0)},[S]),O=m.useCallback(()=>{window.clearTimeout(p.current),S(!1)},[S]),k=m.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{x.current=!0,S(!0)},y)},[y,S]);return m.useEffect(()=>()=>window.clearTimeout(p.current),[]),m.createElement(Eu,c,m.createElement(_B,{scope:t,contentId:g,open:w,stateAttribute:C,trigger:d,onTriggerChange:f,onTriggerEnter:m.useCallback(()=>{l.isOpenDelayed?k():P()},[l.isOpenDelayed,k,P]),onTriggerLeave:m.useCallback(()=>{v?O():window.clearTimeout(p.current)},[O,v]),onOpen:P,onClose:O,disableHoverableContent:v},n))},A2="TooltipTrigger",I2=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Ah(A2,n),o=zb(A2,n),s=Fb(n),a=m.useRef(null),l=et(t,a,i.onTriggerChange),c=m.useRef(!1),d=m.useRef(!1),f=m.useCallback(()=>c.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),m.createElement(Ou,ae({asChild:!0},s),m.createElement(Ve.button,ae({"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute},r,{ref:l,onPointerMove:Ee(e.onPointerMove,g=>{g.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:Ee(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:Ee(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Ee(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Ee(e.onBlur,i.onClose),onClick:Ee(e.onClick,i.onClose)})))}),CB="TooltipPortal",[Fde,EB]=Th(CB,{forceMount:void 0}),ku="TooltipContent",OB=m.forwardRef((e,t)=>{const n=EB(ku,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=e,s=Ah(ku,e.__scopeTooltip);return m.createElement(bn,{present:r||s.open},s.disableHoverableContent?m.createElement(N2,ae({side:i},o,{ref:t})):m.createElement(PB,ae({side:i},o,{ref:t})))}),PB=m.forwardRef((e,t)=>{const n=Ah(ku,e.__scopeTooltip),r=zb(ku,e.__scopeTooltip),i=m.useRef(null),o=et(t,i),[s,a]=m.useState(null),{trigger:l,onClose:c}=n,d=i.current,{onPointerInTransitChange:f}=r,g=m.useCallback(()=>{a(null),f(!1)},[f]),p=m.useCallback((v,y)=>{const x=v.currentTarget,w={x:v.clientX,y:v.clientY},S=MB(w,x.getBoundingClientRect()),C=DB(w,S),P=TB(y.getBoundingClientRect()),O=IB([...C,...P]);a(O),f(!0)},[f]);return m.useEffect(()=>()=>g(),[g]),m.useEffect(()=>{if(l&&d){const v=x=>p(x,d),y=x=>p(x,l);return l.addEventListener("pointerleave",v),d.addEventListener("pointerleave",y),()=>{l.removeEventListener("pointerleave",v),d.removeEventListener("pointerleave",y)}}},[l,d,p,g]),m.useEffect(()=>{if(s){const v=y=>{const x=y.target,w={x:y.clientX,y:y.clientY},S=(l==null?void 0:l.contains(x))||(d==null?void 0:d.contains(x)),C=!AB(w,s);S?g():C&&(g(),c())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[l,d,s,c,g]),m.createElement(N2,ae({},e,{ref:o}))}),[kB,jde]=Th(Bb,{isInside:!1}),N2=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...a}=e,l=Ah(ku,n),c=Fb(n),{onClose:d}=l;return m.useEffect(()=>(document.addEventListener(jb,d),()=>document.removeEventListener(jb,d)),[d]),m.useEffect(()=>{if(l.trigger){const f=g=>{const p=g.target;p!=null&&p.contains(l.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,d]),m.createElement(_l,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:d},m.createElement(Pu,ae({"data-state":l.stateAttribute},c,a,{ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}}),m.createElement(Xw,null,r),m.createElement(kB,{scope:n,isInside:!0},m.createElement(vB,{id:l.contentId,role:"tooltip"},i||r))))});function MB(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function DB(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function TB(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function AB(e,t){const{x:n,y:r}=e;let i=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){const a=t[o].x,l=t[o].y,c=t[s].x,d=t[s].y;l>r!=d>r&&n<(c-a)*(r-l)/(d-l)+a&&(i=!i)}return i}function IB(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),NB(t)}function NB(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const o=t[t.length-1],s=t[t.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const o=n[n.length-1],s=n[n.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}const RB=wB,LB=SB,$B=I2,R2=OB,FB=RB,Vb=LB,L2=$B,Ih=de.forwardRef(({className:e,sideOffset:t=4,...n},r)=>_.jsx(R2,{ref:r,sideOffset:t,className:Pe("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));Ih.displayName=R2.displayName;const $2=de.forwardRef(({className:e,...t},n)=>_.jsx("div",{className:"relative w-full overflow-auto",children:_.jsx("table",{ref:n,className:Pe("w-full caption-bottom text-sm",e),...t})}));$2.displayName="Table";const F2=de.forwardRef(({className:e,...t},n)=>_.jsx("thead",{ref:n,className:Pe("[&_tr]:border-b",e),...t}));F2.displayName="TableHeader";const j2=de.forwardRef(({className:e,...t},n)=>_.jsx("tbody",{ref:n,className:Pe("[&_tr:last-child]:border-0",e),...t}));j2.displayName="TableBody";const jB=de.forwardRef(({className:e,...t},n)=>_.jsx("tfoot",{ref:n,className:Pe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));jB.displayName="TableFooter";const Nh=de.forwardRef(({className:e,...t},n)=>_.jsx("tr",{ref:n,className:Pe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Nh.displayName="TableRow";const z2=de.forwardRef(({className:e,...t},n)=>_.jsx("th",{ref:n,className:Pe("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));z2.displayName="TableHead";const Hb=de.forwardRef(({className:e,...t},n)=>_.jsx("td",{ref:n,className:Pe("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Hb.displayName="TableCell";const zB=de.forwardRef(({className:e,...t},n)=>_.jsx("caption",{ref:n,className:Pe("mt-4 text-sm text-muted-foreground",e),...t}));zB.displayName="TableCaption";/**
129
+ `)):Array.isArray(n)?e.push.apply(e,n):bt(e)||t.unshift(""+n);return t},textSize:function(e,t,n){var r=[].concat(t),i=r.length,o=e.font,s=0,a;for(e.font=n.string,a=0;a<i;++a)s=Math.max(e.measureText(r[a]).width,s);return e.font=o,{height:i*n.lineHeight,width:s}},bound:function(e,t,n){return Math.max(e,Math.min(t,n))},arrayDiff:function(e,t){var n=e.slice(),r=[],i,o,s,a;for(i=0,s=t.length;i<s;++i)a=t[i],o=n.indexOf(a),o===-1?r.push([a,1]):n.splice(o,1);for(i=0,s=n.length;i<s;++i)r.push([n[i],-1]);return r},rasterize:function(e){return Math.round(e*BE)/BE}};function Cb(e,t){var n=t.x,r=t.y;if(n===null)return{x:0,y:-1};if(r===null)return{x:1,y:0};var i=e.x-n,o=e.y-r,s=Math.sqrt(i*i+o*o);return{x:s?i/s:0,y:s?o/s:-1}}function mj(e,t,n,r,i){switch(i){case"center":n=r=0;break;case"bottom":n=0,r=1;break;case"right":n=1,r=0;break;case"left":n=-1,r=0;break;case"top":n=0,r=-1;break;case"start":n=-n,r=-r;break;case"end":break;default:i*=Math.PI/180,n=Math.cos(i),r=Math.sin(i);break}return{x:e,y:t,vx:n,vy:r}}var vj=0,VE=1,HE=2,WE=4,qE=8;function gh(e,t,n){var r=vj;return e<n.left?r|=VE:e>n.right&&(r|=HE),t<n.top?r|=qE:t>n.bottom&&(r|=WE),r}function bj(e,t){for(var n=e.x0,r=e.y0,i=e.x1,o=e.y1,s=gh(n,r,t),a=gh(i,o,t),l,c,d;!(!(s|a)||s&a);)l=s||a,l&qE?(c=n+(i-n)*(t.top-r)/(o-r),d=t.top):l&WE?(c=n+(i-n)*(t.bottom-r)/(o-r),d=t.bottom):l&HE?(d=r+(o-r)*(t.right-n)/(i-n),c=t.right):l&VE&&(d=r+(o-r)*(t.left-n)/(i-n),c=t.left),l===s?(n=c,r=d,s=gh(n,r,t)):(i=c,o=d,a=gh(i,o,t));return{x0:n,x1:i,y0:r,y1:o}}function mh(e,t){var n=t.anchor,r=e,i,o;return t.clamp&&(r=bj(r,t.area)),n==="start"?(i=r.x0,o=r.y0):n==="end"?(i=r.x1,o=r.y1):(i=(r.x0+r.x1)/2,o=(r.y0+r.y1)/2),mj(i,o,e.vx,e.vy,t.align)}var vh={arc:function(e,t){var n=(e.startAngle+e.endAngle)/2,r=Math.cos(n),i=Math.sin(n),o=e.innerRadius,s=e.outerRadius;return mh({x0:e.x+r*o,y0:e.y+i*o,x1:e.x+r*s,y1:e.y+i*s,vx:r,vy:i},t)},point:function(e,t){var n=Cb(e,t.origin),r=n.x*e.options.radius,i=n.y*e.options.radius;return mh({x0:e.x-r,y0:e.y-i,x1:e.x+r,y1:e.y+i,vx:n.x,vy:n.y},t)},bar:function(e,t){var n=Cb(e,t.origin),r=e.x,i=e.y,o=0,s=0;return e.horizontal?(r=Math.min(e.x,e.base),o=Math.abs(e.base-e.x)):(i=Math.min(e.y,e.base),s=Math.abs(e.base-e.y)),mh({x0:r,y0:i+s,x1:r+o,y1:i,vx:n.x,vy:n.y},t)},fallback:function(e,t){var n=Cb(e,t.origin);return mh({x0:e.x,y0:e.y,x1:e.x+(e.width||0),y1:e.y+(e.height||0),vx:n.x,vy:n.y},t)}},po=bu.rasterize;function yj(e){var t=e.borderWidth||0,n=e.padding,r=e.size.height,i=e.size.width,o=-i/2,s=-r/2;return{frame:{x:o-n.left-t,y:s-n.top-t,w:i+n.width+t*2,h:r+n.height+t*2},text:{x:o,y:s,w:i,h:r}}}function xj(e,t){var n=t.chart.getDatasetMeta(t.datasetIndex).vScale;if(!n)return null;if(n.xCenter!==void 0&&n.yCenter!==void 0)return{x:n.xCenter,y:n.yCenter};var r=n.getBasePixel();return e.horizontal?{x:r,y:null}:{x:null,y:r}}function wj(e){return e instanceof bl?vh.arc:e instanceof fu?vh.point:e instanceof hu?vh.bar:vh.fallback}function _j(e,t,n,r,i,o){var s=Math.PI/2;if(o){var a=Math.min(o,i/2,r/2),l=t+a,c=n+a,d=t+r-a,f=n+i-a;e.moveTo(t,c),l<d&&c<f?(e.arc(l,c,a,-Math.PI,-s),e.arc(d,c,a,-s,0),e.arc(d,f,a,0,s),e.arc(l,f,a,s,Math.PI)):l<d?(e.moveTo(l,n),e.arc(d,c,a,-s,s),e.arc(l,c,a,s,Math.PI+s)):c<f?(e.arc(l,c,a,-Math.PI,0),e.arc(l,f,a,0,Math.PI)):e.arc(l,c,a,-Math.PI,Math.PI),e.closePath(),e.moveTo(t,n)}else e.rect(t,n,r,i)}function Sj(e,t,n){var r=n.backgroundColor,i=n.borderColor,o=n.borderWidth;!r&&(!i||!o)||(e.beginPath(),_j(e,po(t.x)+o/2,po(t.y)+o/2,po(t.w)-o,po(t.h)-o,n.borderRadius),e.closePath(),r&&(e.fillStyle=r,e.fill()),i&&o&&(e.strokeStyle=i,e.lineWidth=o,e.lineJoin="miter",e.stroke()))}function Cj(e,t,n){var r=n.lineHeight,i=e.w,o=e.x,s=e.y+r/2;return t==="center"?o+=i/2:(t==="end"||t==="right")&&(o+=i),{h:r,w:i,x:o,y:s}}function Ej(e,t,n){var r=e.shadowBlur,i=n.stroked,o=po(n.x),s=po(n.y),a=po(n.w);i&&e.strokeText(t,o,s,a),n.filled&&(r&&i&&(e.shadowBlur=0),e.fillText(t,o,s,a),r&&i&&(e.shadowBlur=r))}function Oj(e,t,n,r){var i=r.textAlign,o=r.color,s=!!o,a=r.font,l=t.length,c=r.textStrokeColor,d=r.textStrokeWidth,f=c&&d,g;if(!(!l||!s&&!f))for(n=Cj(n,i,a),e.font=a.string,e.textAlign=i,e.textBaseline="middle",e.shadowBlur=r.textShadowBlur,e.shadowColor=r.textShadowColor,s&&(e.fillStyle=o),f&&(e.lineJoin="round",e.lineWidth=d,e.strokeStyle=c),g=0,l=t.length;g<l;++g)Ej(e,t[g],{stroked:f,filled:s,w:n.w,x:n.x,y:n.y+n.h*g})}var UE=function(e,t,n,r){var i=this;i._config=e,i._index=r,i._model=null,i._rects=null,i._ctx=t,i._el=n};Ii(UE.prototype,{_modelize:function(e,t,n,r){var i=this,o=i._index,s=yn(Zt([n.font,{}],r,o)),a=Zt([n.color,an.color],r,o);return{align:Zt([n.align,"center"],r,o),anchor:Zt([n.anchor,"center"],r,o),area:r.chart.chartArea,backgroundColor:Zt([n.backgroundColor,null],r,o),borderColor:Zt([n.borderColor,null],r,o),borderRadius:Zt([n.borderRadius,0],r,o),borderWidth:Zt([n.borderWidth,0],r,o),clamp:Zt([n.clamp,!1],r,o),clip:Zt([n.clip,!1],r,o),color:a,display:e,font:s,lines:t,offset:Zt([n.offset,4],r,o),opacity:Zt([n.opacity,1],r,o),origin:xj(i._el,r),padding:Rn(Zt([n.padding,4],r,o)),positioner:wj(i._el),rotation:Zt([n.rotation,0],r,o)*(Math.PI/180),size:bu.textSize(i._ctx,t,s),textAlign:Zt([n.textAlign,"start"],r,o),textShadowBlur:Zt([n.textShadowBlur,0],r,o),textShadowColor:Zt([n.textShadowColor,a],r,o),textStrokeColor:Zt([n.textStrokeColor,a],r,o),textStrokeWidth:Zt([n.textStrokeWidth,0],r,o)}},update:function(e){var t=this,n=null,r=null,i=t._index,o=t._config,s,a,l,c=Zt([o.display,!0],e,i);c&&(s=e.dataset.data[i],a=tt(zt(o.formatter,[s,e]),s),l=bt(a)?[]:bu.toTextLines(a),l.length&&(n=t._modelize(c,l,o,e),r=yj(n))),t._model=n,t._rects=r},geometry:function(){return this._rects?this._rects.frame:{}},rotation:function(){return this._model?this._model.rotation:0},visible:function(){return this._model&&this._model.opacity},model:function(){return this._model},draw:function(e,t){var n=this,r=e.ctx,i=n._model,o=n._rects,s;this.visible()&&(r.save(),i.clip&&(s=i.area,r.beginPath(),r.rect(s.left,s.top,s.right-s.left,s.bottom-s.top),r.clip()),r.globalAlpha=bu.bound(0,i.opacity,1),r.translate(po(t.x),po(t.y)),r.rotate(i.rotation),Sj(r,o.frame,i),Oj(r,i.lines,o.text,i),r.restore())}});var Pj=Number.MIN_SAFE_INTEGER||-9007199254740991,kj=Number.MAX_SAFE_INTEGER||9007199254740991;function yu(e,t,n){var r=Math.cos(n),i=Math.sin(n),o=t.x,s=t.y;return{x:o+r*(e.x-o)-i*(e.y-s),y:s+i*(e.x-o)+r*(e.y-s)}}function GE(e,t){var n=kj,r=Pj,i=t.origin,o,s,a,l,c;for(o=0;o<e.length;++o)s=e[o],a=s.x-i.x,l=s.y-i.y,c=t.vx*a+t.vy*l,n=Math.min(n,c),r=Math.max(r,c);return{min:n,max:r}}function bh(e,t){var n=t.x-e.x,r=t.y-e.y,i=Math.sqrt(n*n+r*r);return{vx:(t.x-e.x)/i,vy:(t.y-e.y)/i,origin:e,ln:i}}var YE=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};Ii(YE.prototype,{center:function(){var e=this._rect;return{x:e.x+e.w/2,y:e.y+e.h/2}},update:function(e,t,n){this._rotation=n,this._rect={x:t.x+e.x,y:t.y+e.y,w:t.w,h:t.h}},contains:function(e){var t=this,n=1,r=t._rect;return e=yu(e,t.center(),-t._rotation),!(e.x<r.x-n||e.y<r.y-n||e.x>r.x+r.w+n*2||e.y>r.y+r.h+n*2)},intersects:function(e){var t=this._points(),n=e._points(),r=[bh(t[0],t[1]),bh(t[0],t[3])],i,o,s;for(this._rotation!==e._rotation&&r.push(bh(n[0],n[1]),bh(n[0],n[3])),i=0;i<r.length;++i)if(o=GE(t,r[i]),s=GE(n,r[i]),o.max<s.min||s.max<o.min)return!1;return!0},_points:function(){var e=this,t=e._rect,n=e._rotation,r=e.center();return[yu({x:t.x,y:t.y},r,n),yu({x:t.x+t.w,y:t.y},r,n),yu({x:t.x+t.w,y:t.y+t.h},r,n),yu({x:t.x,y:t.y+t.h},r,n)]}});function KE(e,t,n){var r=t.positioner(e,t),i=r.vx,o=r.vy;if(!i&&!o)return{x:r.x,y:r.y};var s=n.w,a=n.h,l=t.rotation,c=Math.abs(s/2*Math.cos(l))+Math.abs(a/2*Math.sin(l)),d=Math.abs(s/2*Math.sin(l))+Math.abs(a/2*Math.cos(l)),f=1/Math.max(Math.abs(i),Math.abs(o));return c*=i*f,d*=o*f,c+=t.offset*i,d+=t.offset*o,{x:r.x+c,y:r.y+d}}function Mj(e,t){var n,r,i,o;for(n=e.length-1;n>=0;--n)for(i=e[n].$layout,r=n-1;r>=0&&i._visible;--r)o=e[r].$layout,o._visible&&i._box.intersects(o._box)&&t(i,o);return e}function Dj(e){var t,n,r,i,o,s,a;for(t=0,n=e.length;t<n;++t)r=e[t],i=r.$layout,i._visible&&(a=new Proxy(r._el,{get:(l,c)=>l.getProps([c],!0)[c]}),o=r.geometry(),s=KE(a,r.model(),o),i._box.update(s,o,r.rotation()));return Mj(e,function(l,c){var d=l._hidable,f=c._hidable;d&&f||f?c._visible=!1:d&&(l._visible=!1)})}var xu={prepare:function(e){var t=[],n,r,i,o,s;for(n=0,i=e.length;n<i;++n)for(r=0,o=e[n].length;r<o;++r)s=e[n][r],t.push(s),s.$layout={_box:new YE,_hidable:!1,_visible:!0,_set:n,_idx:s._index};return t.sort(function(a,l){var c=a.$layout,d=l.$layout;return c._idx===d._idx?d._set-c._set:d._idx-c._idx}),this.update(t),t},update:function(e){var t=!1,n,r,i,o,s;for(n=0,r=e.length;n<r;++n)i=e[n],o=i.model(),s=i.$layout,s._hidable=o&&o.display==="auto",s._visible=i.visible(),t|=s._hidable;t&&Dj(e)},lookup:function(e,t){var n,r;for(n=e.length-1;n>=0;--n)if(r=e[n].$layout,r&&r._visible&&r._box.contains(t))return e[n];return null},draw:function(e,t){var n,r,i,o,s,a;for(n=0,r=t.length;n<r;++n)i=t[n],o=i.$layout,o._visible&&(s=i.geometry(),a=KE(i._el,i.model(),s),o._box.update(a,s,i.rotation()),i.draw(e,a))}},Tj=function(e){if(bt(e))return null;var t=e,n,r,i;if(_t(e))if(!bt(e.label))t=e.label;else if(!bt(e.r))t=e.r;else for(t="",n=Object.keys(e),i=0,r=n.length;i<r;++i)t+=(i!==0?", ":"")+n[i]+": "+e[n[i]];return""+t},Aj={align:"center",anchor:"center",backgroundColor:null,borderColor:null,borderRadius:0,borderWidth:0,clamp:!1,clip:!1,color:void 0,display:!0,font:{family:void 0,lineHeight:1.2,size:void 0,style:void 0,weight:null},formatter:Tj,labels:void 0,listeners:{},offset:4,opacity:1,padding:{top:4,right:4,bottom:4,left:4},rotation:0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,textShadowBlur:0,textShadowColor:void 0},dr="$datalabels",XE="$default";function Ij(e,t){var n=e.datalabels,r={},i=[],o,s;return n===!1?null:(n===!0&&(n={}),t=Ii({},[t,n]),o=t.labels||{},s=Object.keys(o),delete t.labels,s.length?s.forEach(function(a){o[a]&&i.push(Ii({},[t,o[a],{_key:a}]))}):i.push(t),r=i.reduce(function(a,l){return Rt(l.listeners||{},function(c,d){a[d]=a[d]||{},a[d][l._key||XE]=c}),delete l.listeners,a},{}),{labels:i,listeners:r})}function Eb(e,t,n,r){if(t){var i=n.$context,o=n.$groups,s;t[o._set]&&(s=t[o._set][o._key],s&&zt(s,[i,r])===!0&&(e[dr]._dirty=!0,n.update(i)))}}function Nj(e,t,n,r,i){var o,s;!n&&!r||(n?r?n!==r&&(s=o=!0):s=!0:o=!0,s&&Eb(e,t.leave,n,i),o&&Eb(e,t.enter,r,i))}function Rj(e,t){var n=e[dr],r=n._listeners,i,o;if(!(!r.enter&&!r.leave)){if(t.type==="mousemove")o=xu.lookup(n._labels,t);else if(t.type!=="mouseout")return;i=n._hovered,n._hovered=o,Nj(e,r,i,o,t)}}function Lj(e,t){var n=e[dr],r=n._listeners.click,i=r&&xu.lookup(n._labels,t);i&&Eb(e,r,i,t)}var $j={id:"datalabels",defaults:Aj,beforeInit:function(e){e[dr]={_actives:[]}},beforeUpdate:function(e){var t=e[dr];t._listened=!1,t._listeners={},t._datasets=[],t._labels=[]},afterDatasetUpdate:function(e,t,n){var r=t.index,i=e[dr],o=i._datasets[r]=[],s=e.isDatasetVisible(r),a=e.data.datasets[r],l=Ij(a,n),c=t.meta.data||[],d=e.ctx,f,g,p,v,y,x,w,S;for(d.save(),f=0,p=c.length;f<p;++f)if(w=c[f],w[dr]=[],s&&w&&e.getDataVisibility(f)&&!w.skip)for(g=0,v=l.labels.length;g<v;++g)y=l.labels[g],x=y._key,S=new UE(y,d,w,f),S.$groups={_set:r,_key:x||XE},S.$context={active:!1,chart:e,dataIndex:f,dataset:a,datasetIndex:r},S.update(S.$context),w[dr].push(S),o.push(S);d.restore(),Ii(i._listeners,l.listeners,{merger:function(C,P,O){P[C]=P[C]||{},P[C][t.index]=O[C],i._listened=!0}})},afterUpdate:function(e){e[dr]._labels=xu.prepare(e[dr]._datasets)},afterDatasetsDraw:function(e){xu.draw(e,e[dr]._labels)},beforeEvent:function(e,t){if(e[dr]._listened){var n=t.event;switch(n.type){case"mousemove":case"mouseout":Rj(e,n);break;case"click":Lj(e,n);break}}},afterEvent:function(e){var t=e[dr],n=t._actives,r=t._actives=e.getActiveElements(),i=bu.arrayDiff(n,r),o,s,a,l,c,d,f;for(o=0,s=i.length;o<s;++o)if(c=i[o],c[1])for(f=c[0].element[dr]||[],a=0,l=f.length;a<l;++a)d=f[a],d.$context.active=c[1]===1,d.update(d.$context);(t._dirty||i.length)&&(xu.update(t._labels),e.render()),delete t._dirty}};Jr.register(...gj),Jr.register($j);function QE({cfg:e,onDatapointClick:t}){var a;const n=m.useRef(null),[r,i]=m.useState(),o=ge(l=>l.themeStyle);m.useEffect(()=>{var d,f,g,p;(f=(d=o==null?void 0:o.chart)==null?void 0:d.font)!=null&&f.family&&(Jr.defaults.font={...Jr.defaults.font,...(g=o==null?void 0:o.chart)==null?void 0:g.font}),e.options&&(e.options.responsive=!0,e.options.maintainAspectRatio=!1);const l=(p=n==null?void 0:n.current)==null?void 0:p.getContext("2d");if(!l)return;let c;try{c=new Jr(l,e),i(c)}catch(v){console.log("error creating chart",v)}return()=>{c&&c.destroy()}},[(a=o==null?void 0:o.chart)==null?void 0:a.font]);function s(l){var d,f;if(!r)return;const c=r==null?void 0:r.getElementsAtEventForMode(l,"nearest",{intersect:!0},!0);if(c&&c.length>0){const g=c[0].datasetIndex,p=c[0].index,v=(f=(d=c[0].element)==null?void 0:d.$context)==null?void 0:f.raw;t==null||t(r,g,p,v)}}return _.jsx("div",{onClick:s,className:" relative h-[99%] xbg-red-100",children:_.jsx("canvas",{ref:n})})}function $i(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Fj=["color"],JE=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,Fj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),jj=["color"],zj=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,jj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Bj=["color"],ZE=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,Bj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M5 2V1H10V2H5ZM4.75 0C4.33579 0 4 0.335786 4 0.75V1H3.5C2.67157 1 2 1.67157 2 2.5V12.5C2 13.3284 2.67157 14 3.5 14H7V13H3.5C3.22386 13 3 12.7761 3 12.5V2.5C3 2.22386 3.22386 2 3.5 2H4V2.25C4 2.66421 4.33579 3 4.75 3H10.25C10.6642 3 11 2.66421 11 2.25V2H11.5C11.7761 2 12 2.22386 12 2.5V7H13V2.5C13 1.67157 12.3284 1 11.5 1H11V0.75C11 0.335786 10.6642 0 10.25 0H4.75ZM9 8.5C9 8.77614 8.77614 9 8.5 9C8.22386 9 8 8.77614 8 8.5C8 8.22386 8.22386 8 8.5 8C8.77614 8 9 8.22386 9 8.5ZM10.5 9C10.7761 9 11 8.77614 11 8.5C11 8.22386 10.7761 8 10.5 8C10.2239 8 10 8.22386 10 8.5C10 8.77614 10.2239 9 10.5 9ZM13 8.5C13 8.77614 12.7761 9 12.5 9C12.2239 9 12 8.77614 12 8.5C12 8.22386 12.2239 8 12.5 8C12.7761 8 13 8.22386 13 8.5ZM14.5 9C14.7761 9 15 8.77614 15 8.5C15 8.22386 14.7761 8 14.5 8C14.2239 8 14 8.22386 14 8.5C14 8.77614 14.2239 9 14.5 9ZM15 10.5C15 10.7761 14.7761 11 14.5 11C14.2239 11 14 10.7761 14 10.5C14 10.2239 14.2239 10 14.5 10C14.7761 10 15 10.2239 15 10.5ZM14.5 13C14.7761 13 15 12.7761 15 12.5C15 12.2239 14.7761 12 14.5 12C14.2239 12 14 12.2239 14 12.5C14 12.7761 14.2239 13 14.5 13ZM14.5 15C14.7761 15 15 14.7761 15 14.5C15 14.2239 14.7761 14 14.5 14C14.2239 14 14 14.2239 14 14.5C14 14.7761 14.2239 15 14.5 15ZM8.5 11C8.77614 11 9 10.7761 9 10.5C9 10.2239 8.77614 10 8.5 10C8.22386 10 8 10.2239 8 10.5C8 10.7761 8.22386 11 8.5 11ZM9 12.5C9 12.7761 8.77614 13 8.5 13C8.22386 13 8 12.7761 8 12.5C8 12.2239 8.22386 12 8.5 12C8.77614 12 9 12.2239 9 12.5ZM8.5 15C8.77614 15 9 14.7761 9 14.5C9 14.2239 8.77614 14 8.5 14C8.22386 14 8 14.2239 8 14.5C8 14.7761 8.22386 15 8.5 15ZM11 14.5C11 14.7761 10.7761 15 10.5 15C10.2239 15 10 14.7761 10 14.5C10 14.2239 10.2239 14 10.5 14C10.7761 14 11 14.2239 11 14.5ZM12.5 15C12.7761 15 13 14.7761 13 14.5C13 14.2239 12.7761 14 12.5 14C12.2239 14 12 14.2239 12 14.5C12 14.7761 12.2239 15 12.5 15Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Vj=["color"],oa=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,Vj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Hj=["color"],Wj=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,Hj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),qj=["color"],Uj=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,qj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M14.7649 6.07596C14.9991 6.22231 15.0703 6.53079 14.9239 6.76495C14.4849 7.46743 13.9632 8.10645 13.3702 8.66305L14.5712 9.86406C14.7664 10.0593 14.7664 10.3759 14.5712 10.5712C14.3759 10.7664 14.0593 10.7664 13.8641 10.5712L12.6011 9.30817C11.805 9.90283 10.9089 10.3621 9.93375 10.651L10.383 12.3277C10.4544 12.5944 10.2961 12.8685 10.0294 12.94C9.76267 13.0115 9.4885 12.8532 9.41704 12.5865L8.95917 10.8775C8.48743 10.958 8.00036 10.9999 7.50001 10.9999C6.99965 10.9999 6.51257 10.958 6.04082 10.8775L5.58299 12.5864C5.51153 12.8532 5.23737 13.0115 4.97064 12.94C4.7039 12.8686 4.5456 12.5944 4.61706 12.3277L5.06625 10.651C4.09111 10.3621 3.19503 9.90282 2.3989 9.30815L1.1359 10.5712C0.940638 10.7664 0.624058 10.7664 0.428798 10.5712C0.233537 10.3759 0.233537 10.0593 0.428798 9.86405L1.62982 8.66303C1.03682 8.10643 0.515113 7.46742 0.0760677 6.76495C-0.0702867 6.53079 0.000898544 6.22231 0.235065 6.07596C0.469231 5.9296 0.777703 6.00079 0.924058 6.23496C1.40354 7.00213 1.989 7.68057 2.66233 8.2427C2.67315 8.25096 2.6837 8.25972 2.69397 8.26898C4.00897 9.35527 5.65537 9.99991 7.50001 9.99991C10.3078 9.99991 12.6564 8.5063 14.076 6.23495C14.2223 6.00079 14.5308 5.9296 14.7649 6.07596Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Gj=["color"],Yj=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,Gj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M7.5 11C4.80285 11 2.52952 9.62184 1.09622 7.50001C2.52952 5.37816 4.80285 4 7.5 4C10.1971 4 12.4705 5.37816 13.9038 7.50001C12.4705 9.62183 10.1971 11 7.5 11ZM7.5 3C4.30786 3 1.65639 4.70638 0.0760002 7.23501C-0.0253338 7.39715 -0.0253334 7.60288 0.0760014 7.76501C1.65639 10.2936 4.30786 12 7.5 12C10.6921 12 13.3436 10.2936 14.924 7.76501C15.0253 7.60288 15.0253 7.39715 14.924 7.23501C13.3436 4.70638 10.6921 3 7.5 3ZM7.5 9.5C8.60457 9.5 9.5 8.60457 9.5 7.5C9.5 6.39543 8.60457 5.5 7.5 5.5C6.39543 5.5 5.5 6.39543 5.5 7.5C5.5 8.60457 6.39543 9.5 7.5 9.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Kj=["color"],e2=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,Kj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM8.24992 4.49999C8.24992 4.9142 7.91413 5.24999 7.49992 5.24999C7.08571 5.24999 6.74992 4.9142 6.74992 4.49999C6.74992 4.08577 7.08571 3.74999 7.49992 3.74999C7.91413 3.74999 8.24992 4.08577 8.24992 4.49999ZM6.00003 5.99999H6.50003H7.50003C7.77618 5.99999 8.00003 6.22384 8.00003 6.49999V9.99999H8.50003H9.00003V11H8.50003H7.50003H6.50003H6.00003V9.99999H6.50003H7.00003V6.99999H6.50003H6.00003V5.99999Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Xj=["color"],Qj=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,Xj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M1.20308 1.04312C1.00481 0.954998 0.772341 1.0048 0.627577 1.16641C0.482813 1.32802 0.458794 1.56455 0.568117 1.75196L3.92115 7.50002L0.568117 13.2481C0.458794 13.4355 0.482813 13.672 0.627577 13.8336C0.772341 13.9952 1.00481 14.045 1.20308 13.9569L14.7031 7.95693C14.8836 7.87668 15 7.69762 15 7.50002C15 7.30243 14.8836 7.12337 14.7031 7.04312L1.20308 1.04312ZM4.84553 7.10002L2.21234 2.586L13.2689 7.50002L2.21234 12.414L4.84552 7.90002H9C9.22092 7.90002 9.4 7.72094 9.4 7.50002C9.4 7.27911 9.22092 7.10002 9 7.10002H4.84553Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Jj=["color"],Zj=m.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=$i(e,Jj);return m.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),m.createElement("path",{d:"M3.24182 2.32181C3.3919 2.23132 3.5784 2.22601 3.73338 2.30781L12.7334 7.05781C12.8974 7.14436 13 7.31457 13 7.5C13 7.68543 12.8974 7.85564 12.7334 7.94219L3.73338 12.6922C3.5784 12.774 3.3919 12.7687 3.24182 12.6782C3.09175 12.5877 3 12.4252 3 12.25V2.75C3 2.57476 3.09175 2.4123 3.24182 2.32181ZM4 3.57925V11.4207L11.4288 7.5L4 3.57925Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});let yh;const ez=new Uint8Array(16);function tz(){if(!yh&&(yh=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!yh))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return yh(ez)}const Ln=[];for(let e=0;e<256;++e)Ln.push((e+256).toString(16).slice(1));function nz(e,t=0){return Ln[e[t+0]]+Ln[e[t+1]]+Ln[e[t+2]]+Ln[e[t+3]]+"-"+Ln[e[t+4]]+Ln[e[t+5]]+"-"+Ln[e[t+6]]+Ln[e[t+7]]+"-"+Ln[e[t+8]]+Ln[e[t+9]]+"-"+Ln[e[t+10]]+Ln[e[t+11]]+Ln[e[t+12]]+Ln[e[t+13]]+Ln[e[t+14]]+Ln[e[t+15]]}const t2={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function wu(e,t,n){if(t2.randomUUID&&!t&&!e)return t2.randomUUID();e=e||{};const r=e.random||(e.rng||tz)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return nz(r)}const _e=pw()(Ow((e,t)=>({isShowingVisual:!0,runSql:!1,sqlGen:{},sql:"",isSqlRunning:!1,showFilters:!1,applyFilters:!1,filterValues:[{filterId:"sample-filter-id",valueType:"string",name:"",operation:"in",values:[""]}],card:{id:wu(),title:"Editor Card",description:"Desdcription",type:"bar",data:[]},actions:{setCardPreferences:n=>{e(r=>{r.card.preferences=n})},setFilterOnClickField:n=>{e(r=>{r.card.preferences={...r.card.preferences,filterOnClick:!0,filterOnClickField:n}})},setCardRefreshInterval:n=>{e(r=>{r.card.refreshInterval=n})},setIsShowingVisual:n=>{e({isShowingVisual:n})},setRunSql:n=>{e({runSql:n})},setIsSqlRunning:n=>{e({isSqlRunning:n})},setCard:n=>{e({card:n})},setCardType:n=>{e(r=>{r.card.type=n})},setCardSql:n=>{e(r=>{r.card.sql=n})},setCardCustomCfg:n=>{e(r=>{r.card.customCfg=n})},setCardCfg:n=>{e(r=>{r.card.cfg=n})},setShowFilters:n=>{e(r=>{r.showFilters=n})},setApplyFilters:n=>{e(r=>{r.applyFilters=n})},setFilterValues:n=>{e(r=>{r.filterValues=n})},setSqlGen:n=>{e(r=>{r.sqlGen=n})},setSqlGenMeasure:(n,r)=>{e(i=>{i.sqlGen.measures=[...i.sqlGen.measures||[],{name:n,calc:r}]})},setSqlGenDimension:n=>{e(r=>{r.sqlGen.dimensions=[...r.sqlGen.dimensions||[],n]})},setCardData:n=>{e(r=>{r.card.data=n})},setSelectedConnectionId:n=>{var r,i;e(o=>{o.selectedConnectionId=n,o.card.connectionId=n}),(i=(r=t()).onConnectionChange)==null||i.call(r,n)},setSelectedDatabaseName:n=>{var r,i;e(o=>{o.selectedDatabaseName=n,o.card.lastSelectedDatabase=n}),(i=(r=t()).onDatabaseChange)==null||i.call(r,n)},setSelectedSchemaName:n=>{var r,i;e(o=>{o.selectedSchemaName=n,o.card.lastSelectedSchema=n}),(i=(r=t()).onSchemaChange)==null||i.call(r,n)},setSelectedTableName:n=>{var r,i;e(o=>{o.selectedTableName=n,o.card.lastSelectedTable=n}),(i=(r=t()).onTableChange)==null||i.call(r,n)},setCurrentColumns:n=>{e(r=>{r.currentColumns=n})},setOnConnectionChange:n=>{e({onConnectionChange:n})},setOnDatabaseChange:n=>{e({onDatabaseChange:n})},setOnSchemaChange:n=>{e({onSchemaChange:n})},setOnTableChange:n=>{e({onTableChange:n})},setOnSave:n=>{e({onSave:n})},setOnClose:n=>{e({onClose:n})}}})));process.env.NODE_ENV==="development"&&kw("EditorStore",_e);function rz({card:e}){const t=ge(y=>y.isDashboardEditing),n=ge(y=>y.filterValues),r=ge(y=>y.isVisualEditing),i=ge(y=>y.selectedSheetId),o=ge(y=>y.actions.removeCard),s=ge(y=>y.actions.setIsVisualEditing),a=_e(y=>y.actions.setFilterValues),l=_e(y=>y.actions.setApplyFilters),c=_e(y=>y.actions.setCard),d=_e(y=>y.actions.setSelectedConnectionId),f=_e(y=>y.actions.setSelectedDatabaseName),g=_e(y=>y.actions.setSelectedSchemaName),p=_e(y=>y.actions.setSelectedTableName);function v(){s(!r),c(e),e!=null&&e.connectionId&&d(e==null?void 0:e.connectionId),e!=null&&e.lastSelectedDatabase&&f(e==null?void 0:e.lastSelectedDatabase),e!=null&&e.lastSelectedSchema&&g(e==null?void 0:e.lastSelectedSchema),e!=null&&e.lastSelectedTable&&p(e==null?void 0:e.lastSelectedTable),n&&(a(n),l(!0))}return _.jsx("section",{className:"absolute right-2 top-2",children:t&&_.jsxs("div",{className:"flex items-center gap-2",children:[r?_.jsx(Uj,{onClick:()=>{s(!r)},className:"h-[14px] w-[14px] hover:cursor-pointer hover:text-foreground/50 text-foreground/30"}):_.jsx(Yj,{role:"edit-visual",onClick:v,className:"h-[14px] w-[14px] hover:cursor-pointer hover:text-foreground/50 text-foreground/30"}),_.jsx(oa,{onClick:()=>o(i,e),className:"h-[14px] w-[14px] hover:cursor-pointer hover:text-foreground/50 text-foreground/30"})]})})}function iz(e,t){var s,a,l,c;const n=ge.getState().themeStyle,r=(a=(s=n==null?void 0:n.chart)==null?void 0:s.dataset)==null?void 0:a.backgroundColor,i=(c=(l=n==null?void 0:n.chart)==null?void 0:l.dataset)==null?void 0:c.borderColor;return e.map((d,f)=>({label:d.charAt(0).toUpperCase()+d.slice(1),data:t.map(g=>g[d]),backgroundColor:r==null?void 0:r[f%r.length],borderColor:i==null?void 0:i[f%i.length]}))}function oz(e){var a,l,c,d;const{metricKeys:t,dimensionKeys:n}=sa(e);let r=[];const i=ge.getState().themeStyle,o=(l=(a=i==null?void 0:i.chart)==null?void 0:a.dataset)==null?void 0:l.backgroundColor,s=(d=(c=i==null?void 0:i.chart)==null?void 0:c.dataset)==null?void 0:d.borderColor;if((n==null?void 0:n.length)===1){const f=e.map(g=>({x:g[t[0]],y:g[t[1]],r:g[t[2]],label:g[n==null?void 0:n[0]]}));r=[{label:n==null?void 0:n[0],data:f}]}return(n==null?void 0:n.length)>1&&(r=[...new Set(e.map(g=>g[n==null?void 0:n[1]]))].map((g,p)=>{const v=e.filter(y=>y[n==null?void 0:n[1]]===g);return{label:g,data:v.map(y=>({x:y[t[0]],y:y[t[1]],r:y[t[2]],label:y[n==null?void 0:n[0]]})),backgroundColor:o==null?void 0:o[p%o.length],borderColor:s==null?void 0:s[p%s.length]}})),r}function sz(e,t){var s,a,l,c;const n=ge.getState().themeStyle,r=(a=(s=n==null?void 0:n.chart)==null?void 0:s.dataset)==null?void 0:a.backgroundColor,i=(c=(l=n==null?void 0:n.chart)==null?void 0:l.dataset)==null?void 0:c.borderColor;return e.map(d=>({label:d.charAt(0).toUpperCase()+d.slice(1),data:t.map(f=>f[d]),backgroundColor:t.map((f,g)=>r==null?void 0:r[g%r.length]),borderColor:t.map((f,g)=>i==null?void 0:i[g%i.length])}))}function sa(e){const t=Object.keys(e[0]),n=t.filter(i=>{var o,s,a,l;return!!(typeof e[0][i]&&typeof e[0][i]=="string"||typeof((o=e==null?void 0:e[1])==null?void 0:o[i])&&typeof((s=e==null?void 0:e[1])==null?void 0:s[i])=="string"||typeof((a=e==null?void 0:e[2])==null?void 0:a[i])&&typeof((l=e==null?void 0:e[2])==null?void 0:l[i])=="string")});n.length===0&&n.push(t[0]);const r=t.filter(i=>e[0][i]===+e[0][i]);return{dimensionKeys:n,metricKeys:r}}function Ob(e,t){var r;const n=(r=t==null?void 0:t.data)==null?void 0:r.datasets;return n&&n.length>0?e.map((o,s)=>({...o,...n[s],data:o.data,label:o.label})):e}function n2({dataArray:e,groupKey:t,pivotKey:n,valueKey:r}){const i=e.reduce((o,s)=>{const a=s[t],l=s[n],c=s[r];return o[a]||(o[a]={[t]:a}),o[a][l]=c,o},{});return Object.values(i)}function Pb(e,t){var s;const n=ge.getState().themeStyle,r=(s=n==null?void 0:n.chart)==null?void 0:s.options,i=Fs.cloneDeep(r);return Fs.merge(i,e,t)}function r2(e,t){return e.map(n=>n[t]?n[t]:"BLANK")}function aa({data:e,cfg:t,customCfg:n}){const{dimensionKeys:r,metricKeys:i}=sa(e),o=iz(i,e),s=Ob(o,n),a=r[0],l=r2(e,a),c=Pb((t==null?void 0:t.options)||{},(n==null?void 0:n.options)||{});return{type:(n==null?void 0:n.type)||(t==null?void 0:t.type)||"bar",data:{labels:l,datasets:s},options:c}}function az(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0},y:{display:!0}}}}}function lz(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function cz(e){var n,r,i,o;return{...e,type:"bar",options:{...e==null?void 0:e.options,scales:{x:{...(r=(n=e==null?void 0:e.options)==null?void 0:n.scales)==null?void 0:r.x,display:!0,stacked:!0},y:{...(o=(i=e==null?void 0:e.options)==null?void 0:i.scales)==null?void 0:o.y,display:!0,stacked:!0}}}}}function uz(e){return{...e,type:"line",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function i2(e,t){return{...t,type:e,options:{...t==null?void 0:t.options,scales:{x:{display:!1},y:{display:!1}}}}}function dz(e){return{...e,type:"radar",options:{...e==null?void 0:e.options,scales:{x:{display:!1},y:{display:!1}}}}}function kb({data:e,cardType:t="bar",cfg:n,customCfg:r,provider:i="chartjs",userSettings:o}){if(t==="bar"){const s=lz(n);return aa({data:e,cfg:s,customCfg:r,cardType:t,userSettings:o,provider:i})}if(t==="horizontalBar"){const s=az(n);return aa({data:e,cfg:s,customCfg:r,cardType:t,userSettings:o,provider:i})}if(t==="stackedBar"){const s=cz(n),{dimensionKeys:a,metricKeys:l}=sa(e),c=n2({dataArray:e,groupKey:a[0],pivotKey:a[1],valueKey:l[0]});return aa({data:c,cfg:s,customCfg:r,cardType:t,userSettings:o,provider:i})}if(t==="line"){const s=uz(n);return aa({data:e,cfg:s,customCfg:r,cardType:t,userSettings:o,provider:i})}if(t==="pie"||t==="doughnut"){const s=i2(t,n),{dimensionKeys:a,metricKeys:l}=sa(e),c=sz(l,e),d=Ob(c,r),f=a[0],g=r2(e,f),p=Pb((s==null?void 0:s.options)||{},(r==null?void 0:r.options)||{});return{type:t,data:{labels:g,datasets:d},options:p}}if(t==="radar"){const s=dz(n);return aa({data:e,cfg:s,customCfg:r,cardType:t,userSettings:o,provider:i})}if(t==="bubble"||t==="scatter"){const{metricKeys:s}=sa(e);if(s.length<3){console.log("Bubble charts require 3 numeric columns");return}const a=oz(e),l=Ob(a,r),c={plugins:{datalabels:{display:!0}},scales:{x:{title:{display:!0,text:s[0]},beginAtZero:!0,ticks:{precision:0}},y:{title:{display:!0,text:s[1]},beginAtZero:!0,ticks:{precision:0}}}},d=Pb(c,(r==null?void 0:r.options)||{});return{type:t,data:{datasets:l},options:d}}if(t==="polarArea"){const s=i2(t,n);return aa({data:e,cfg:s,customCfg:r,cardType:t,userSettings:o,provider:i})}return aa({data:e,cfg:n,customCfg:r,cardType:t,userSettings:o,provider:i})}var yl=1e3,xl=yl*60,wl=xl*60,la=wl*24,fz=la*7,hz=la*365.25,pz=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return gz(e);if(n==="number"&&isFinite(e))return t.long?vz(e):mz(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function gz(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*hz;case"weeks":case"week":case"w":return n*fz;case"days":case"day":case"d":return n*la;case"hours":case"hour":case"hrs":case"hr":case"h":return n*wl;case"minutes":case"minute":case"mins":case"min":case"m":return n*xl;case"seconds":case"second":case"secs":case"sec":case"s":return n*yl;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function mz(e){var t=Math.abs(e);return t>=la?Math.round(e/la)+"d":t>=wl?Math.round(e/wl)+"h":t>=xl?Math.round(e/xl)+"m":t>=yl?Math.round(e/yl)+"s":e+"ms"}function vz(e){var t=Math.abs(e);return t>=la?xh(e,t,la,"day"):t>=wl?xh(e,t,wl,"hour"):t>=xl?xh(e,t,xl,"minute"):t>=yl?xh(e,t,yl,"second"):e+" ms"}function xh(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+" "+r+(i?"s":"")}const bz=Pc(pz);function yz(e){const t=ge(l=>l.bookmarkKey),n=ge(l=>l.authToken),r=ge(l=>l.filterValues),i=ge(l=>l.isDashboardEditing),o=bz((e==null?void 0:e.refreshInterval)||"0"),s=Cr({queryKey:[e.id,e.sql],queryFn:()=>Ns("https://semaphor.cloud/api/v1/data",(n==null?void 0:n.accessToken)||"",{visual_id:e.id,active_filters:r}),refetchInterval:o,enabled:!!o&&!i}),a=Cr({queryKey:[e.id,e.sql],queryFn:()=>Ns("https://semaphor.cloud/api/v1/query",(n==null?void 0:n.accessToken)||"",{connection_id:e.connectionId,sql:e.sql,active_filters:r}),refetchInterval:o,enabled:!!o&&i});return i||t!==""?a:s}function xz(e,t=globalThis==null?void 0:globalThis.document){const n=wn(e);m.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const Mb="dismissableLayer.update",wz="dismissableLayer.pointerDownOutside",_z="dismissableLayer.focusOutside";let o2;const Sz=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_l=m.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=e,d=m.useContext(Sz),[f,g]=m.useState(null),p=(n=f==null?void 0:f.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,v]=m.useState({}),y=et(t,L=>g(L)),x=Array.from(d.layers),[w]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),S=x.indexOf(w),C=f?x.indexOf(f):-1,P=d.layersWithOutsidePointerEventsDisabled.size>0,O=C>=S,k=Cz(L=>{const F=L.target,j=[...d.branches].some(B=>B.contains(F));!O||j||(o==null||o(L),a==null||a(L),L.defaultPrevented||l==null||l())},p),A=Ez(L=>{const F=L.target;[...d.branches].some(B=>B.contains(F))||(s==null||s(L),a==null||a(L),L.defaultPrevented||l==null||l())},p);return xz(L=>{C===d.layers.size-1&&(i==null||i(L),!L.defaultPrevented&&l&&(L.preventDefault(),l()))},p),m.useEffect(()=>{if(f)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(o2=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),s2(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=o2)}},[f,p,r,d]),m.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),s2())},[f,d]),m.useEffect(()=>{const L=()=>v({});return document.addEventListener(Mb,L),()=>document.removeEventListener(Mb,L)},[]),m.createElement(Ve.div,ae({},c,{ref:y,style:{pointerEvents:P?O?"auto":"none":void 0,...e.style},onFocusCapture:Ee(e.onFocusCapture,A.onFocusCapture),onBlurCapture:Ee(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Ee(e.onPointerDownCapture,k.onPointerDownCapture)}))});function Cz(e,t=globalThis==null?void 0:globalThis.document){const n=wn(e),r=m.useRef(!1),i=m.useRef(()=>{});return m.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let c=function(){a2(wz,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=c,t.addEventListener("click",i.current,{once:!0})):c()}else t.removeEventListener("click",i.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Ez(e,t=globalThis==null?void 0:globalThis.document){const n=wn(e),r=m.useRef(!1);return m.useEffect(()=>{const i=o=>{o.target&&!r.current&&a2(_z,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function s2(){const e=new CustomEvent(Mb);document.dispatchEvent(e)}function a2(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Qw(i,o):i.dispatchEvent(o)}const Oz=["top","right","bottom","left"],Xo=Math.min,Mr=Math.max,wh=Math.round,_h=Math.floor,Qo=e=>({x:e,y:e}),Pz={left:"right",right:"left",bottom:"top",top:"bottom"},kz={start:"end",end:"start"};function Db(e,t,n){return Mr(e,Xo(t,n))}function go(e,t){return typeof e=="function"?e(t):e}function mo(e){return e.split("-")[0]}function Sl(e){return e.split("-")[1]}function Tb(e){return e==="x"?"y":"x"}function Ab(e){return e==="y"?"height":"width"}function Cl(e){return["top","bottom"].includes(mo(e))?"y":"x"}function Ib(e){return Tb(Cl(e))}function Mz(e,t,n){n===void 0&&(n=!1);const r=Sl(e),i=Ib(e),o=Ab(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Sh(s)),[s,Sh(s)]}function Dz(e){const t=Sh(e);return[Nb(e),t,Nb(t)]}function Nb(e){return e.replace(/start|end/g,t=>kz[t])}function Tz(e,t,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?o:s;default:return[]}}function Az(e,t,n,r){const i=Sl(e);let o=Tz(mo(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(Nb)))),o}function Sh(e){return e.replace(/left|right|bottom|top/g,t=>Pz[t])}function Iz(e){return{top:0,right:0,bottom:0,left:0,...e}}function l2(e){return typeof e!="number"?Iz(e):{top:e,right:e,bottom:e,left:e}}function Ch(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function c2(e,t,n){let{reference:r,floating:i}=e;const o=Cl(t),s=Ib(t),a=Ab(s),l=mo(t),c=o==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,g=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Sl(t)){case"start":p[s]-=g*(n&&c?-1:1);break;case"end":p[s]+=g*(n&&c?-1:1);break}return p}const Nz=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:f}=c2(c,r,l),g=r,p={},v=0;for(let y=0;y<a.length;y++){const{name:x,fn:w}=a[y],{x:S,y:C,data:P,reset:O}=await w({x:d,y:f,initialPlacement:r,placement:g,strategy:i,middlewareData:p,rects:c,platform:s,elements:{reference:e,floating:t}});if(d=S??d,f=C??f,p={...p,[x]:{...p[x],...P}},O&&v<=50){v++,typeof O=="object"&&(O.placement&&(g=O.placement),O.rects&&(c=O.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):O.rects),{x:d,y:f}=c2(c,g,l)),y=-1;continue}}return{x:d,y:f,placement:g,strategy:i,middlewareData:p}};async function _u(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:g=!1,padding:p=0}=go(t,e),v=l2(p),x=a[g?f==="floating"?"reference":"floating":f],w=Ch(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(x)))==null||n?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),S=f==="floating"?{...s.floating,x:r,y:i}:s.reference,C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),P=await(o.isElement==null?void 0:o.isElement(C))?await(o.getScale==null?void 0:o.getScale(C))||{x:1,y:1}:{x:1,y:1},O=Ch(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({rect:S,offsetParent:C,strategy:l}):S);return{top:(w.top-O.top+v.top)/P.y,bottom:(O.bottom-w.bottom+v.bottom)/P.y,left:(w.left-O.left+v.left)/P.x,right:(O.right-w.right+v.right)/P.x}}const u2=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:d=0}=go(e,t)||{};if(c==null)return{};const f=l2(d),g={x:n,y:r},p=Ib(i),v=Ab(p),y=await s.getDimensions(c),x=p==="y",w=x?"top":"left",S=x?"bottom":"right",C=x?"clientHeight":"clientWidth",P=o.reference[v]+o.reference[p]-g[p]-o.floating[v],O=g[p]-o.reference[p],k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let A=k?k[C]:0;(!A||!await(s.isElement==null?void 0:s.isElement(k)))&&(A=a.floating[C]||o.floating[v]);const L=P/2-O/2,F=A/2-y[v]/2-1,j=Xo(f[w],F),B=Xo(f[S],F),H=j,K=A-y[v]-B,Y=A/2-y[v]/2+L,$=Db(H,Y,K),Z=!l.arrow&&Sl(i)!=null&&Y!=$&&o.reference[v]/2-(Y<H?j:B)-y[v]/2<0,U=Z?Y<H?Y-H:Y-K:0;return{[p]:g[p]+U,data:{[p]:$,centerOffset:Y-$-U,...Z&&{alignmentOffset:U}},reset:Z}}}),Rz=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:y=!0,...x}=go(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const w=mo(i),S=mo(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(c.floating)),P=g||(S||!y?[Sh(a)]:Dz(a));!g&&v!=="none"&&P.push(...Az(a,y,v,C));const O=[a,...P],k=await _u(t,x),A=[];let L=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&A.push(k[w]),f){const H=Mz(i,s,C);A.push(k[H[0]],k[H[1]])}if(L=[...L,{placement:i,overflows:A}],!A.every(H=>H<=0)){var F,j;const H=(((F=o.flip)==null?void 0:F.index)||0)+1,K=O[H];if(K)return{data:{index:H,overflows:L},reset:{placement:K}};let Y=(j=L.filter($=>$.overflows[0]<=0).sort(($,Z)=>$.overflows[1]-Z.overflows[1])[0])==null?void 0:j.placement;if(!Y)switch(p){case"bestFit":{var B;const $=(B=L.map(Z=>[Z.placement,Z.overflows.filter(U=>U>0).reduce((U,ie)=>U+ie,0)]).sort((Z,U)=>Z[1]-U[1])[0])==null?void 0:B[0];$&&(Y=$);break}case"initialPlacement":Y=a;break}if(i!==Y)return{reset:{placement:Y}}}return{}}}};function d2(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function f2(e){return Oz.some(t=>e[t]>=0)}const Lz=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=go(e,t);switch(r){case"referenceHidden":{const o=await _u(t,{...i,elementContext:"reference"}),s=d2(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:f2(s)}}}case"escaped":{const o=await _u(t,{...i,altBoundary:!0}),s=d2(o,n.floating);return{data:{escapedOffsets:s,escaped:f2(s)}}}default:return{}}}}};async function $z(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=mo(n),a=Sl(n),l=Cl(n)==="y",c=["left","top"].includes(s)?-1:1,d=o&&l?-1:1,f=go(t,e);let{mainAxis:g,crossAxis:p,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof v=="number"&&(p=a==="end"?v*-1:v),l?{x:p*d,y:g*c}:{x:g*c,y:p*d}}const Fz=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,l=await $z(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},jz=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:w,y:S}=x;return{x:w,y:S}}},...l}=go(e,t),c={x:n,y:r},d=await _u(t,l),f=Cl(mo(i)),g=Tb(f);let p=c[g],v=c[f];if(o){const x=g==="y"?"top":"left",w=g==="y"?"bottom":"right",S=p+d[x],C=p-d[w];p=Db(S,p,C)}if(s){const x=f==="y"?"top":"left",w=f==="y"?"bottom":"right",S=v+d[x],C=v-d[w];v=Db(S,v,C)}const y=a.fn({...t,[g]:p,[f]:v});return{...y,data:{x:y.x-n,y:y.y-r}}}}},zz=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=go(e,t),d={x:n,y:r},f=Cl(i),g=Tb(f);let p=d[g],v=d[f];const y=go(a,t),x=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(l){const C=g==="y"?"height":"width",P=o.reference[g]-o.floating[C]+x.mainAxis,O=o.reference[g]+o.reference[C]-x.mainAxis;p<P?p=P:p>O&&(p=O)}if(c){var w,S;const C=g==="y"?"width":"height",P=["top","left"].includes(mo(i)),O=o.reference[f]-o.floating[C]+(P&&((w=s.offset)==null?void 0:w[f])||0)+(P?0:x.crossAxis),k=o.reference[f]+o.reference[C]+(P?0:((S=s.offset)==null?void 0:S[f])||0)-(P?x.crossAxis:0);v<O?v=O:v>k&&(v=k)}return{[g]:p,[f]:v}}}},Bz=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:i,elements:o}=t,{apply:s=()=>{},...a}=go(e,t),l=await _u(t,a),c=mo(n),d=Sl(n),f=Cl(n)==="y",{width:g,height:p}=r.floating;let v,y;c==="top"||c==="bottom"?(v=c,y=d===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(y=c,v=d==="end"?"top":"bottom");const x=p-l[v],w=g-l[y],S=!t.middlewareData.shift;let C=x,P=w;if(f){const k=g-l.left-l.right;P=d||S?Xo(w,k):k}else{const k=p-l.top-l.bottom;C=d||S?Xo(x,k):k}if(S&&!d){const k=Mr(l.left,0),A=Mr(l.right,0),L=Mr(l.top,0),F=Mr(l.bottom,0);f?P=g-2*(k!==0||A!==0?k+A:Mr(l.left,l.right)):C=p-2*(L!==0||F!==0?L+F:Mr(l.top,l.bottom))}await s({...t,availableWidth:P,availableHeight:C});const O=await i.getDimensions(o.floating);return g!==O.width||p!==O.height?{reset:{rects:!0}}:{}}}};function Jo(e){return h2(e)?(e.nodeName||"").toLowerCase():"#document"}function Dr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function vo(e){var t;return(t=(h2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function h2(e){return e instanceof Node||e instanceof Dr(e).Node}function bo(e){return e instanceof Element||e instanceof Dr(e).Element}function Fi(e){return e instanceof HTMLElement||e instanceof Dr(e).HTMLElement}function p2(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Dr(e).ShadowRoot}function Su(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Zr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function Vz(e){return["table","td","th"].includes(Jo(e))}function Rb(e){const t=Lb(),n=Zr(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Hz(e){let t=El(e);for(;Fi(t)&&!Eh(t);){if(Rb(t))return t;t=El(t)}return null}function Lb(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Eh(e){return["html","body","#document"].includes(Jo(e))}function Zr(e){return Dr(e).getComputedStyle(e)}function Oh(e){return bo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function El(e){if(Jo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||p2(e)&&e.host||vo(e);return p2(t)?t.host:t}function g2(e){const t=El(e);return Eh(t)?e.ownerDocument?e.ownerDocument.body:e.body:Fi(t)&&Su(t)?t:g2(t)}function Cu(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=g2(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=Dr(i);return o?t.concat(s,s.visualViewport||[],Su(i)?i:[],s.frameElement&&n?Cu(s.frameElement):[]):t.concat(i,Cu(i,[],n))}function m2(e){const t=Zr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Fi(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=wh(n)!==o||wh(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function $b(e){return bo(e)?e:e.contextElement}function Ol(e){const t=$b(e);if(!Fi(t))return Qo(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=m2(t);let s=(o?wh(n.width):n.width)/r,a=(o?wh(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Wz=Qo(0);function v2(e){const t=Dr(e);return!Lb()||!t.visualViewport?Wz:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qz(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Dr(e)?!1:t}function ca(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=$b(e);let s=Qo(1);t&&(r?bo(r)&&(s=Ol(r)):s=Ol(e));const a=qz(o,n,r)?v2(o):Qo(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){const g=Dr(o),p=r&&bo(r)?Dr(r):r;let v=g.frameElement;for(;v&&r&&p!==g;){const y=Ol(v),x=v.getBoundingClientRect(),w=Zr(v),S=x.left+(v.clientLeft+parseFloat(w.paddingLeft))*y.x,C=x.top+(v.clientTop+parseFloat(w.paddingTop))*y.y;l*=y.x,c*=y.y,d*=y.x,f*=y.y,l+=S,c+=C,v=Dr(v).frameElement}}return Ch({width:d,height:f,x:l,y:c})}function Uz(e){let{rect:t,offsetParent:n,strategy:r}=e;const i=Fi(n),o=vo(n);if(n===o)return t;let s={scrollLeft:0,scrollTop:0},a=Qo(1);const l=Qo(0);if((i||!i&&r!=="fixed")&&((Jo(n)!=="body"||Su(o))&&(s=Oh(n)),Fi(n))){const c=ca(n);a=Ol(n),l.x=c.x+n.clientLeft,l.y=c.y+n.clientTop}return{width:t.width*a.x,height:t.height*a.y,x:t.x*a.x-s.scrollLeft*a.x+l.x,y:t.y*a.y-s.scrollTop*a.y+l.y}}function Gz(e){return Array.from(e.getClientRects())}function b2(e){return ca(vo(e)).left+Oh(e).scrollLeft}function Yz(e){const t=vo(e),n=Oh(e),r=e.ownerDocument.body,i=Mr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Mr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+b2(e);const a=-n.scrollTop;return Zr(r).direction==="rtl"&&(s+=Mr(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function Kz(e,t){const n=Dr(e),r=vo(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const c=Lb();(!c||c&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}function Xz(e,t){const n=ca(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Fi(e)?Ol(e):Qo(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:s,height:a,x:l,y:c}}function y2(e,t,n){let r;if(t==="viewport")r=Kz(e,n);else if(t==="document")r=Yz(vo(e));else if(bo(t))r=Xz(t,n);else{const i=v2(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Ch(r)}function x2(e,t){const n=El(e);return n===t||!bo(n)||Eh(n)?!1:Zr(n).position==="fixed"||x2(n,t)}function Qz(e,t){const n=t.get(e);if(n)return n;let r=Cu(e,[],!1).filter(a=>bo(a)&&Jo(a)!=="body"),i=null;const o=Zr(e).position==="fixed";let s=o?El(e):e;for(;bo(s)&&!Eh(s);){const a=Zr(s),l=Rb(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Su(s)&&!l&&x2(e,s))?r=r.filter(d=>d!==s):i=a,s=El(s)}return t.set(e,r),r}function Jz(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Qz(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,d)=>{const f=y2(t,d,i);return c.top=Mr(f.top,c.top),c.right=Xo(f.right,c.right),c.bottom=Xo(f.bottom,c.bottom),c.left=Mr(f.left,c.left),c},y2(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Zz(e){return m2(e)}function eB(e,t,n){const r=Fi(t),i=vo(t),o=n==="fixed",s=ca(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=Qo(0);if(r||!r&&!o)if((Jo(t)!=="body"||Su(i))&&(a=Oh(t)),r){const c=ca(t,!0,o,t);l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}else i&&(l.x=b2(i));return{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function w2(e,t){return!Fi(e)||Zr(e).position==="fixed"?null:t?t(e):e.offsetParent}function _2(e,t){const n=Dr(e);if(!Fi(e))return n;let r=w2(e,t);for(;r&&Vz(r)&&Zr(r).position==="static";)r=w2(r,t);return r&&(Jo(r)==="html"||Jo(r)==="body"&&Zr(r).position==="static"&&!Rb(r))?n:r||Hz(e)||n}const tB=async function(e){let{reference:t,floating:n,strategy:r}=e;const i=this.getOffsetParent||_2,o=this.getDimensions;return{reference:eB(t,await i(n),r),floating:{x:0,y:0,...await o(n)}}};function nB(e){return Zr(e).direction==="rtl"}const rB={convertOffsetParentRelativeRectToViewportRelativeRect:Uz,getDocumentElement:vo,getClippingRect:Jz,getOffsetParent:_2,getElementRects:tB,getClientRects:Gz,getDimensions:Zz,getScale:Ol,isElement:bo,isRTL:nB};function iB(e,t){let n=null,r;const i=vo(e);function o(){clearTimeout(r),n&&n.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const{left:c,top:d,width:f,height:g}=e.getBoundingClientRect();if(a||t(),!f||!g)return;const p=_h(d),v=_h(i.clientWidth-(c+f)),y=_h(i.clientHeight-(d+g)),x=_h(c),S={rootMargin:-p+"px "+-v+"px "+-y+"px "+-x+"px",threshold:Mr(0,Xo(1,l))||1};let C=!0;function P(O){const k=O[0].intersectionRatio;if(k!==l){if(!C)return s();k?s(!1,k):r=setTimeout(()=>{s(!1,1e-7)},100)}C=!1}try{n=new IntersectionObserver(P,{...S,root:i.ownerDocument})}catch{n=new IntersectionObserver(P,S)}n.observe(e)}return s(!0),o}function oB(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=$b(e),d=i||o?[...c?Cu(c):[],...Cu(t)]:[];d.forEach(w=>{i&&w.addEventListener("scroll",n,{passive:!0}),o&&w.addEventListener("resize",n)});const f=c&&a?iB(c,n):null;let g=-1,p=null;s&&(p=new ResizeObserver(w=>{let[S]=w;S&&S.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{p&&p.observe(t)})),n()}),c&&!l&&p.observe(c),p.observe(t));let v,y=l?ca(e):null;l&&x();function x(){const w=ca(e);y&&(w.x!==y.x||w.y!==y.y||w.width!==y.width||w.height!==y.height)&&n(),y=w,v=requestAnimationFrame(x)}return n(),()=>{d.forEach(w=>{i&&w.removeEventListener("scroll",n),o&&w.removeEventListener("resize",n)}),f&&f(),p&&p.disconnect(),p=null,l&&cancelAnimationFrame(v)}}const sB=(e,t,n)=>{const r=new Map,i={platform:rB,...n},o={...i.platform,_c:r};return Nz(e,t,{...i,platform:o})},aB=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?u2({element:r.current,padding:i}).fn(n):{}:r?u2({element:r,padding:i}).fn(n):{}}}};var Ph=typeof document<"u"?m.useLayoutEffect:m.useEffect;function kh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!kh(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!kh(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function S2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function C2(e,t){const n=S2(e);return Math.round(t*n)/n}function E2(e){const t=de.useRef(e);return Ph(()=>{t.current=e}),t}function lB(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[d,f]=de.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,p]=de.useState(r);kh(g,r)||p(r);const[v,y]=de.useState(null),[x,w]=de.useState(null),S=de.useCallback(Z=>{Z!=k.current&&(k.current=Z,y(Z))},[y]),C=de.useCallback(Z=>{Z!==A.current&&(A.current=Z,w(Z))},[w]),P=o||v,O=s||x,k=de.useRef(null),A=de.useRef(null),L=de.useRef(d),F=E2(l),j=E2(i),B=de.useCallback(()=>{if(!k.current||!A.current)return;const Z={placement:t,strategy:n,middleware:g};j.current&&(Z.platform=j.current),sB(k.current,A.current,Z).then(U=>{const ie={...U,isPositioned:!0};H.current&&!kh(L.current,ie)&&(L.current=ie,i3.flushSync(()=>{f(ie)}))})},[g,t,n,j]);Ph(()=>{c===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,f(Z=>({...Z,isPositioned:!1})))},[c]);const H=de.useRef(!1);Ph(()=>(H.current=!0,()=>{H.current=!1}),[]),Ph(()=>{if(P&&(k.current=P),O&&(A.current=O),P&&O){if(F.current)return F.current(P,O,B);B()}},[P,O,B,F]);const K=de.useMemo(()=>({reference:k,floating:A,setReference:S,setFloating:C}),[S,C]),Y=de.useMemo(()=>({reference:P,floating:O}),[P,O]),$=de.useMemo(()=>{const Z={position:n,left:0,top:0};if(!Y.floating)return Z;const U=C2(Y.floating,d.x),ie=C2(Y.floating,d.y);return a?{...Z,transform:"translate("+U+"px, "+ie+"px)",...S2(Y.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:ie}},[n,a,Y.floating,d.x,d.y]);return de.useMemo(()=>({...d,update:B,refs:K,elements:Y,floatingStyles:$}),[d,B,K,Y,$])}function Mh(e){const[t,n]=m.useState(void 0);return Hn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const l=o.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const O2="Popper",[P2,ji]=kn(O2),[cB,k2]=P2(O2),uB=e=>{const{__scopePopper:t,children:n}=e,[r,i]=m.useState(null);return m.createElement(cB,{scope:t,anchor:r,onAnchorChange:i},n)},dB="PopperAnchor",fB=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,o=k2(dB,n),s=m.useRef(null),a=et(t,s);return m.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:m.createElement(Ve.div,ae({},i,{ref:a}))}),M2="PopperContent",[hB,Lde]=P2(M2),pB=m.forwardRef((e,t)=>{var n,r,i,o,s,a,l,c;const{__scopePopper:d,side:f="bottom",sideOffset:g=0,align:p="center",alignOffset:v=0,arrowPadding:y=0,avoidCollisions:x=!0,collisionBoundary:w=[],collisionPadding:S=0,sticky:C="partial",hideWhenDetached:P=!1,updatePositionStrategy:O="optimized",onPlaced:k,...A}=e,L=k2(M2,d),[F,j]=m.useState(null),B=et(t,He=>j(He)),[H,K]=m.useState(null),Y=Mh(H),$=(n=Y==null?void 0:Y.width)!==null&&n!==void 0?n:0,Z=(r=Y==null?void 0:Y.height)!==null&&r!==void 0?r:0,U=f+(p!=="center"?"-"+p:""),ie=typeof S=="number"?S:{top:0,right:0,bottom:0,left:0,...S},le=Array.isArray(w)?w:[w],M=le.length>0,W={padding:ie,boundary:le.filter(gB),altBoundary:M},{refs:ne,floatingStyles:N,placement:X,isPositioned:me,middlewareData:he}=lB({strategy:"fixed",placement:U,whileElementsMounted:(...He)=>oB(...He,{animationFrame:O==="always"}),elements:{reference:L.anchor},middleware:[Fz({mainAxis:g+Z,alignmentAxis:v}),x&&jz({mainAxis:!0,crossAxis:!1,limiter:C==="partial"?zz():void 0,...W}),x&&Rz({...W}),Bz({...W,apply:({elements:He,rects:Fe,availableWidth:xt,availableHeight:ht})=>{const{width:pt,height:Bt}=Fe.reference,Ot=He.floating.style;Ot.setProperty("--radix-popper-available-width",`${xt}px`),Ot.setProperty("--radix-popper-available-height",`${ht}px`),Ot.setProperty("--radix-popper-anchor-width",`${pt}px`),Ot.setProperty("--radix-popper-anchor-height",`${Bt}px`)}}),H&&aB({element:H,padding:y}),mB({arrowWidth:$,arrowHeight:Z}),P&&Lz({strategy:"referenceHidden",...W})]}),[fe,re]=D2(X),ee=wn(k);Hn(()=>{me&&(ee==null||ee())},[me,ee]);const oe=(i=he.arrow)===null||i===void 0?void 0:i.x,xe=(o=he.arrow)===null||o===void 0?void 0:o.y,V=((s=he.arrow)===null||s===void 0?void 0:s.centerOffset)!==0,[Me,$e]=m.useState();return Hn(()=>{F&&$e(window.getComputedStyle(F).zIndex)},[F]),m.createElement("div",{ref:ne.setFloating,"data-radix-popper-content-wrapper":"",style:{...N,transform:me?N.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Me,"--radix-popper-transform-origin":[(a=he.transformOrigin)===null||a===void 0?void 0:a.x,(l=he.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:e.dir},m.createElement(hB,{scope:d,placedSide:fe,onArrowChange:K,arrowX:oe,arrowY:xe,shouldHideArrow:V},m.createElement(Ve.div,ae({"data-side":fe,"data-align":re},A,{ref:B,style:{...A.style,animation:me?void 0:"none",opacity:(c=he.hide)!==null&&c!==void 0&&c.referenceHidden?0:void 0}}))))});function gB(e){return e!==null}const mB=e=>({name:"transformOrigin",options:e,fn(t){var n,r,i,o,s;const{placement:a,rects:l,middlewareData:c}=t,f=((n=c.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,g=f?0:e.arrowWidth,p=f?0:e.arrowHeight,[v,y]=D2(a),x={start:"0%",center:"50%",end:"100%"}[y],w=((r=(i=c.arrow)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)+g/2,S=((o=(s=c.arrow)===null||s===void 0?void 0:s.y)!==null&&o!==void 0?o:0)+p/2;let C="",P="";return v==="bottom"?(C=f?x:`${w}px`,P=`${-p}px`):v==="top"?(C=f?x:`${w}px`,P=`${l.floating.height+p}px`):v==="right"?(C=`${-p}px`,P=f?x:`${S}px`):v==="left"&&(C=`${l.floating.width+p}px`,P=f?x:`${S}px`),{data:{x:C,y:P}}}});function D2(e){const[t,n="center"]=e.split("-");return[t,n]}const Eu=uB,Ou=fB,Pu=pB,Dh=m.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...i}=e;return r?Mt.createPortal(m.createElement(Ve.div,ae({},i,{ref:t})),r):null}),T2=m.forwardRef((e,t)=>m.createElement(Ve.span,ae({},e,{ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}))),vB=T2,[Th,$de]=kn("Tooltip",[ji]),Fb=ji(),bB="TooltipProvider",yB=700,jb="tooltip.open",[xB,zb]=Th(bB),wB=e=>{const{__scopeTooltip:t,delayDuration:n=yB,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:o}=e,[s,a]=m.useState(!0),l=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),m.createElement(xB,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:m.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(d=>{l.current=d},[]),disableHoverableContent:i},o)},Bb="Tooltip",[_B,Ah]=Th(Bb),SB=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i=!1,onOpenChange:o,disableHoverableContent:s,delayDuration:a}=e,l=zb(Bb,e.__scopeTooltip),c=Fb(t),[d,f]=m.useState(null),g=sr(),p=m.useRef(0),v=s??l.disableHoverableContent,y=a??l.delayDuration,x=m.useRef(!1),[w=!1,S]=Jn({prop:r,defaultProp:i,onChange:A=>{A?(l.onOpen(),document.dispatchEvent(new CustomEvent(jb))):l.onClose(),o==null||o(A)}}),C=m.useMemo(()=>w?x.current?"delayed-open":"instant-open":"closed",[w]),P=m.useCallback(()=>{window.clearTimeout(p.current),x.current=!1,S(!0)},[S]),O=m.useCallback(()=>{window.clearTimeout(p.current),S(!1)},[S]),k=m.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{x.current=!0,S(!0)},y)},[y,S]);return m.useEffect(()=>()=>window.clearTimeout(p.current),[]),m.createElement(Eu,c,m.createElement(_B,{scope:t,contentId:g,open:w,stateAttribute:C,trigger:d,onTriggerChange:f,onTriggerEnter:m.useCallback(()=>{l.isOpenDelayed?k():P()},[l.isOpenDelayed,k,P]),onTriggerLeave:m.useCallback(()=>{v?O():window.clearTimeout(p.current)},[O,v]),onOpen:P,onClose:O,disableHoverableContent:v},n))},A2="TooltipTrigger",I2=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Ah(A2,n),o=zb(A2,n),s=Fb(n),a=m.useRef(null),l=et(t,a,i.onTriggerChange),c=m.useRef(!1),d=m.useRef(!1),f=m.useCallback(()=>c.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),m.createElement(Ou,ae({asChild:!0},s),m.createElement(Ve.button,ae({"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute},r,{ref:l,onPointerMove:Ee(e.onPointerMove,g=>{g.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:Ee(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:Ee(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Ee(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Ee(e.onBlur,i.onClose),onClick:Ee(e.onClick,i.onClose)})))}),CB="TooltipPortal",[Fde,EB]=Th(CB,{forceMount:void 0}),ku="TooltipContent",OB=m.forwardRef((e,t)=>{const n=EB(ku,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=e,s=Ah(ku,e.__scopeTooltip);return m.createElement(bn,{present:r||s.open},s.disableHoverableContent?m.createElement(N2,ae({side:i},o,{ref:t})):m.createElement(PB,ae({side:i},o,{ref:t})))}),PB=m.forwardRef((e,t)=>{const n=Ah(ku,e.__scopeTooltip),r=zb(ku,e.__scopeTooltip),i=m.useRef(null),o=et(t,i),[s,a]=m.useState(null),{trigger:l,onClose:c}=n,d=i.current,{onPointerInTransitChange:f}=r,g=m.useCallback(()=>{a(null),f(!1)},[f]),p=m.useCallback((v,y)=>{const x=v.currentTarget,w={x:v.clientX,y:v.clientY},S=MB(w,x.getBoundingClientRect()),C=DB(w,S),P=TB(y.getBoundingClientRect()),O=IB([...C,...P]);a(O),f(!0)},[f]);return m.useEffect(()=>()=>g(),[g]),m.useEffect(()=>{if(l&&d){const v=x=>p(x,d),y=x=>p(x,l);return l.addEventListener("pointerleave",v),d.addEventListener("pointerleave",y),()=>{l.removeEventListener("pointerleave",v),d.removeEventListener("pointerleave",y)}}},[l,d,p,g]),m.useEffect(()=>{if(s){const v=y=>{const x=y.target,w={x:y.clientX,y:y.clientY},S=(l==null?void 0:l.contains(x))||(d==null?void 0:d.contains(x)),C=!AB(w,s);S?g():C&&(g(),c())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[l,d,s,c,g]),m.createElement(N2,ae({},e,{ref:o}))}),[kB,jde]=Th(Bb,{isInside:!1}),N2=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...a}=e,l=Ah(ku,n),c=Fb(n),{onClose:d}=l;return m.useEffect(()=>(document.addEventListener(jb,d),()=>document.removeEventListener(jb,d)),[d]),m.useEffect(()=>{if(l.trigger){const f=g=>{const p=g.target;p!=null&&p.contains(l.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,d]),m.createElement(_l,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:d},m.createElement(Pu,ae({"data-state":l.stateAttribute},c,a,{ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}}),m.createElement(Xw,null,r),m.createElement(kB,{scope:n,isInside:!0},m.createElement(vB,{id:l.contentId,role:"tooltip"},i||r))))});function MB(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function DB(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function TB(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function AB(e,t){const{x:n,y:r}=e;let i=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){const a=t[o].x,l=t[o].y,c=t[s].x,d=t[s].y;l>r!=d>r&&n<(c-a)*(r-l)/(d-l)+a&&(i=!i)}return i}function IB(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),NB(t)}function NB(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const o=t[t.length-1],s=t[t.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const o=n[n.length-1],s=n[n.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}const RB=wB,LB=SB,$B=I2,R2=OB,FB=RB,Vb=LB,L2=$B,Ih=de.forwardRef(({className:e,sideOffset:t=4,...n},r)=>_.jsx(R2,{ref:r,sideOffset:t,className:Pe("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));Ih.displayName=R2.displayName;const $2=de.forwardRef(({className:e,...t},n)=>_.jsx("div",{className:"relative w-full overflow-auto",children:_.jsx("table",{ref:n,className:Pe("w-full caption-bottom text-sm",e),...t})}));$2.displayName="Table";const F2=de.forwardRef(({className:e,...t},n)=>_.jsx("thead",{ref:n,className:Pe("[&_tr]:border-b",e),...t}));F2.displayName="TableHeader";const j2=de.forwardRef(({className:e,...t},n)=>_.jsx("tbody",{ref:n,className:Pe("[&_tr:last-child]:border-0",e),...t}));j2.displayName="TableBody";const jB=de.forwardRef(({className:e,...t},n)=>_.jsx("tfoot",{ref:n,className:Pe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));jB.displayName="TableFooter";const Nh=de.forwardRef(({className:e,...t},n)=>_.jsx("tr",{ref:n,className:Pe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Nh.displayName="TableRow";const z2=de.forwardRef(({className:e,...t},n)=>_.jsx("th",{ref:n,className:Pe("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));z2.displayName="TableHead";const Hb=de.forwardRef(({className:e,...t},n)=>_.jsx("td",{ref:n,className:Pe("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Hb.displayName="TableCell";const zB=de.forwardRef(({className:e,...t},n)=>_.jsx("caption",{ref:n,className:Pe("mt-4 text-sm text-muted-foreground",e),...t}));zB.displayName="TableCaption";/**
130
130
  * @license lucide-react v0.298.0 - ISC
131
131
  *
132
132
  * This source code is licensed under the ISC license.
@@ -307,7 +307,7 @@ Valid keys: `+JSON.stringify(Object.keys(M),null," "));var V=xe(fe,oe,X,me,he+"
307
307
  * LICENSE.md file in the root directory of this source tree.
308
308
  *
309
309
  * @license MIT
310
- */function aO(e,t){return e?NV(e)?de.createElement(e,t):e:null}function NV(e){return RV(e)||typeof e=="function"||LV(e)}function RV(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function LV(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function $V(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=de.useState(()=>({current:PV(t)})),[r,i]=de.useState(()=>n.current.initialState);return n.current.setOptions(o=>({...o,...e,state:{...r,...e.state},onStateChange:s=>{i(s),e.onStateChange==null||e.onStateChange(s)}})),n.current}function a0({data:e}){var s;const[t,n]=m.useState([]),i=Object.keys(e[0]).map(a=>({accessorKey:a,header:({column:l})=>{const c=l.getIsSorted();return _.jsxs("div",{className:"flex items-center cursor-pointer ",onClick:()=>l.toggleSorting(l.getIsSorted()==="asc"),children:[a,c==="asc"?_.jsx(WB,{className:"ml-2 h-4 w-4"}):c==="desc"?_.jsx(HB,{className:"ml-2 h-4 w-4"}):null]})}})),o=$V({data:e,columns:i,getCoreRowModel:DV(),getPaginationRowModel:IV(),onSortingChange:n,getSortedRowModel:TV(),manualPagination:!0,state:{sorting:t}});return _.jsx(_.Fragment,{children:_.jsxs($2,{children:[_.jsx(F2,{children:o.getHeaderGroups().map(a=>_.jsx(Nh,{children:a.headers.map(l=>_.jsx(z2,{className:"sticky top-0",children:l.isPlaceholder?null:aO(l.column.columnDef.header,l.getContext())},l.id))},a.id))}),_.jsx(j2,{children:(s=o.getRowModel().rows)!=null&&s.length?o.getRowModel().rows.map(a=>_.jsx(Nh,{className:"whitespace-nowrap py-2","data-state":a.getIsSelected()&&"selected",children:a.getVisibleCells().map(l=>_.jsx(Hb,{children:aO(l.column.columnDef.cell,l.getContext())},l.id))},a.id)):_.jsx(Nh,{children:_.jsx(Hb,{colSpan:i.length,className:"h-24 text-center ",children:"No results."})})})]})})}function l0(e,[t,n]){return Math.min(n,Math.max(t,e))}function FV(e,t){return m.useReducer((n,r)=>{const i=t[n][r];return i??n},e)}const lO="ScrollArea",[cO,Qde]=kn(lO),[jV,ei]=cO(lO),uO=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:o=600,...s}=e,[a,l]=m.useState(null),[c,d]=m.useState(null),[f,g]=m.useState(null),[p,v]=m.useState(null),[y,x]=m.useState(null),[w,S]=m.useState(0),[C,P]=m.useState(0),[O,k]=m.useState(!1),[A,L]=m.useState(!1),F=et(t,B=>l(B)),j=js(i);return m.createElement(jV,{scope:n,type:r,dir:j,scrollHideDelay:o,scrollArea:a,viewport:c,onViewportChange:d,content:f,onContentChange:g,scrollbarX:p,onScrollbarXChange:v,scrollbarXEnabled:O,onScrollbarXEnabledChange:k,scrollbarY:y,onScrollbarYChange:x,scrollbarYEnabled:A,onScrollbarYEnabledChange:L,onCornerWidthChange:S,onCornerHeightChange:P},m.createElement(Ve.div,ae({dir:j},s,{ref:F,style:{position:"relative","--radix-scroll-area-corner-width":w+"px","--radix-scroll-area-corner-height":C+"px",...e.style}})))}),zV="ScrollAreaViewport",BV=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...i}=e,o=ei(zV,n),s=m.useRef(null),a=et(t,s,o.onViewportChange);return m.createElement(m.Fragment,null,m.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),m.createElement(Ve.div,ae({"data-radix-scroll-area-viewport":""},i,{ref:a,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style}}),m.createElement("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),xo="ScrollAreaScrollbar",dO=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=ei(xo,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:s}=i,a=e.orientation==="horizontal";return m.useEffect(()=>(a?o(!0):s(!0),()=>{a?o(!1):s(!1)}),[a,o,s]),i.type==="hover"?m.createElement(VV,ae({},r,{ref:t,forceMount:n})):i.type==="scroll"?m.createElement(HV,ae({},r,{ref:t,forceMount:n})):i.type==="auto"?m.createElement(fO,ae({},r,{ref:t,forceMount:n})):i.type==="always"?m.createElement(c0,ae({},r,{ref:t})):null}),VV=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=ei(xo,e.__scopeScrollArea),[o,s]=m.useState(!1);return m.useEffect(()=>{const a=i.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),s(!0)},d=()=>{l=window.setTimeout(()=>s(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",d)}}},[i.scrollArea,i.scrollHideDelay]),m.createElement(bn,{present:n||o},m.createElement(fO,ae({"data-state":o?"visible":"hidden"},r,{ref:t})))}),HV=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=ei(xo,e.__scopeScrollArea),o=e.orientation==="horizontal",s=Vh(()=>l("SCROLL_END"),100),[a,l]=FV("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return m.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,i.scrollHideDelay,l]),m.useEffect(()=>{const c=i.viewport,d=o?"scrollLeft":"scrollTop";if(c){let f=c[d];const g=()=>{const p=c[d];f!==p&&(l("SCROLL"),s()),f=p};return c.addEventListener("scroll",g),()=>c.removeEventListener("scroll",g)}},[i.viewport,o,l,s]),m.createElement(bn,{present:n||a!=="hidden"},m.createElement(c0,ae({"data-state":a==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:Ee(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Ee(e.onPointerLeave,()=>l("POINTER_LEAVE"))})))}),fO=m.forwardRef((e,t)=>{const n=ei(xo,e.__scopeScrollArea),{forceMount:r,...i}=e,[o,s]=m.useState(!1),a=e.orientation==="horizontal",l=Vh(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;s(a?c:d)}},10);return Pl(n.viewport,l),Pl(n.content,l),m.createElement(bn,{present:r||o},m.createElement(c0,ae({"data-state":o?"visible":"hidden"},i,{ref:t})))}),c0=m.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,i=ei(xo,e.__scopeScrollArea),o=m.useRef(null),s=m.useRef(0),[a,l]=m.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=mO(a.viewport,a.content),d={...r,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:g=>o.current=g,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:g=>s.current=g};function f(g,p){return QV(g,s.current,a,p)}return n==="horizontal"?m.createElement(WV,ae({},d,{ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const g=i.viewport.scrollLeft,p=vO(g,a,i.dir);o.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:g=>{i.viewport&&(i.viewport.scrollLeft=g)},onDragScroll:g=>{i.viewport&&(i.viewport.scrollLeft=f(g,i.dir))}})):n==="vertical"?m.createElement(qV,ae({},d,{ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const g=i.viewport.scrollTop,p=vO(g,a);o.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:g=>{i.viewport&&(i.viewport.scrollTop=g)},onDragScroll:g=>{i.viewport&&(i.viewport.scrollTop=f(g))}})):null}),WV=m.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...i}=e,o=ei(xo,e.__scopeScrollArea),[s,a]=m.useState(),l=m.useRef(null),c=et(t,l,o.onScrollbarXChange);return m.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),m.createElement(pO,ae({"data-orientation":"horizontal"},i,{ref:c,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Bh(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const g=o.viewport.scrollLeft+d.deltaX;e.onWheelScroll(g),yO(g,f)&&d.preventDefault()}},onResize:()=>{l.current&&o.viewport&&s&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:zh(s.paddingLeft),paddingEnd:zh(s.paddingRight)}})}}))}),qV=m.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...i}=e,o=ei(xo,e.__scopeScrollArea),[s,a]=m.useState(),l=m.useRef(null),c=et(t,l,o.onScrollbarYChange);return m.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),m.createElement(pO,ae({"data-orientation":"vertical"},i,{ref:c,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Bh(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const g=o.viewport.scrollTop+d.deltaY;e.onWheelScroll(g),yO(g,f)&&d.preventDefault()}},onResize:()=>{l.current&&o.viewport&&s&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:zh(s.paddingTop),paddingEnd:zh(s.paddingBottom)}})}}))}),[UV,hO]=cO(xo),pO=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:o,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:d,onResize:f,...g}=e,p=ei(xo,n),[v,y]=m.useState(null),x=et(t,F=>y(F)),w=m.useRef(null),S=m.useRef(""),C=p.viewport,P=r.content-r.viewport,O=wn(d),k=wn(l),A=Vh(f,10);function L(F){if(w.current){const j=F.clientX-w.current.left,B=F.clientY-w.current.top;c({x:j,y:B})}}return m.useEffect(()=>{const F=j=>{const B=j.target;(v==null?void 0:v.contains(B))&&O(j,P)};return document.addEventListener("wheel",F,{passive:!1}),()=>document.removeEventListener("wheel",F,{passive:!1})},[C,v,P,O]),m.useEffect(k,[r,k]),Pl(v,A),Pl(p.content,A),m.createElement(UV,{scope:n,scrollbar:v,hasThumb:i,onThumbChange:wn(o),onThumbPointerUp:wn(s),onThumbPositionChange:k,onThumbPointerDown:wn(a)},m.createElement(Ve.div,ae({},g,{ref:x,style:{position:"absolute",...g.style},onPointerDown:Ee(e.onPointerDown,F=>{F.button===0&&(F.target.setPointerCapture(F.pointerId),w.current=v.getBoundingClientRect(),S.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),L(F))}),onPointerMove:Ee(e.onPointerMove,L),onPointerUp:Ee(e.onPointerUp,F=>{const j=F.target;j.hasPointerCapture(F.pointerId)&&j.releasePointerCapture(F.pointerId),document.body.style.webkitUserSelect=S.current,p.viewport&&(p.viewport.style.scrollBehavior=""),w.current=null})})))}),u0="ScrollAreaThumb",GV=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=hO(u0,e.__scopeScrollArea);return m.createElement(bn,{present:n||i.hasThumb},m.createElement(YV,ae({ref:t},r)))}),YV=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...i}=e,o=ei(u0,n),s=hO(u0,n),{onThumbPositionChange:a}=s,l=et(t,f=>s.onThumbChange(f)),c=m.useRef(),d=Vh(()=>{c.current&&(c.current(),c.current=void 0)},100);return m.useEffect(()=>{const f=o.viewport;if(f){const g=()=>{if(d(),!c.current){const p=JV(f,a);c.current=p,a()}};return a(),f.addEventListener("scroll",g),()=>f.removeEventListener("scroll",g)}},[o.viewport,d,a]),m.createElement(Ve.div,ae({"data-state":s.hasThumb?"visible":"hidden"},i,{ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ee(e.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),v=f.clientX-p.left,y=f.clientY-p.top;s.onThumbPointerDown({x:v,y})}),onPointerUp:Ee(e.onPointerUp,s.onThumbPointerUp)}))}),gO="ScrollAreaCorner",KV=m.forwardRef((e,t)=>{const n=ei(gO,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?m.createElement(XV,ae({},e,{ref:t})):null}),XV=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,i=ei(gO,n),[o,s]=m.useState(0),[a,l]=m.useState(0),c=!!(o&&a);return Pl(i.scrollbarX,()=>{var d;const f=((d=i.scrollbarX)===null||d===void 0?void 0:d.offsetHeight)||0;i.onCornerHeightChange(f),l(f)}),Pl(i.scrollbarY,()=>{var d;const f=((d=i.scrollbarY)===null||d===void 0?void 0:d.offsetWidth)||0;i.onCornerWidthChange(f),s(f)}),c?m.createElement(Ve.div,ae({},r,{ref:t,style:{width:o,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function zh(e){return e?parseInt(e,10):0}function mO(e,t){const n=e/t;return isNaN(n)?0:n}function Bh(e){const t=mO(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function QV(e,t,n,r="ltr"){const i=Bh(n),o=i/2,s=t||o,a=i-s,l=n.scrollbar.paddingStart+s,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return bO([l,c],f)(e)}function vO(e,t,n="ltr"){const r=Bh(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-i,s=t.content-t.viewport,a=o-r,l=n==="ltr"?[0,s]:[s*-1,0],c=l0(e,l);return bO([0,s],[0,a])(c)}function bO(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function yO(e,t){return e>0&&e<t}const JV=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function i(){const o={left:e.scrollLeft,top:e.scrollTop},s=n.left!==o.left,a=n.top!==o.top;(s||a)&&t(),n=o,r=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(r)};function Vh(e,t){const n=wn(e),r=m.useRef(0);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),m.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Pl(e,t){const n=wn(t);Hn(()=>{let r=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(e),()=>{window.cancelAnimationFrame(r),i.unobserve(e)}}},[e,n])}const xO=uO,ZV=BV,eH=KV,kl=de.forwardRef(({className:e,children:t,...n},r)=>_.jsxs(xO,{ref:r,className:Pe("relative overflow-hidden",e),...n,children:[_.jsx(ZV,{className:"h-full w-full rounded-[inherit]",children:t}),_.jsx(Hh,{}),_.jsx(eH,{})]}));kl.displayName=xO.displayName;const Hh=de.forwardRef(({className:e,orientation:t="vertical",...n},r)=>_.jsx(dO,{ref:r,orientation:t,className:Pe("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:_.jsx(GV,{className:"relative flex-1 rounded-full bg-border"})}));Hh.displayName=dO.displayName;function tH(e,t,n,r,i){var o,s,a,l;r?(s=(o=e==null?void 0:e.data)==null?void 0:o.datasets)==null||s.forEach(c=>{var d,f;typeof c.backgroundColor=="string"&&(c.backgroundColor=new Array(c.data.length).fill(c.backgroundColor),c.borderColor=new Array(c.data.length).fill(c.borderColor)),c.backgroundColor=(d=c==null?void 0:c.backgroundColor)==null?void 0:d.map((g,p)=>p===t?g:i),c.borderColor=(f=c==null?void 0:c.borderColor)==null?void 0:f.map((g,p)=>p===t?g:i)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,d)=>{var f,g,p,v,y,x;c.backgroundColor=new Array(c.data.length).fill((p=(g=(f=n==null?void 0:n.data)==null?void 0:f.datasets)==null?void 0:g[d])==null?void 0:p.backgroundColor),c.borderColor=new Array(c.data.length).fill((x=(y=(v=n==null?void 0:n.data)==null?void 0:v.datasets)==null?void 0:y[d])==null?void 0:x.borderColor)}),e==null||e.update()}function nH(e,t,n,r,i){var o,s,a,l;r?(s=(o=e==null?void 0:e.data)==null?void 0:o.datasets)==null||s.forEach(c=>{var d,f;console.log("clicked index",t),console.log(n.data),console.log(c),c.backgroundColor=(d=c==null?void 0:c.backgroundColor)==null?void 0:d.map((g,p)=>p===t?g:i),c.borderColor=(f=c==null?void 0:c.borderColor)==null?void 0:f.map((g,p)=>p===t?g:i)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,d)=>{var f,g,p,v,y,x,w,S;typeof c.backgroundColor=="string"&&(c.backgroundColor=(p=(g=(f=n==null?void 0:n.data)==null?void 0:f.datasets)==null?void 0:g[d])==null?void 0:p.backgroundColor,c.borderColor=(x=(y=(v=n==null?void 0:n.data)==null?void 0:v.datasets)==null?void 0:y[d])==null?void 0:x.borderColor),c.backgroundColor=(w=c==null?void 0:c.backgroundColor)==null?void 0:w.map((C,P)=>{var O;return(O=n.data.datasets[d].backgroundColor)==null?void 0:O[P]}),c.borderColor=(S=c==null?void 0:c.borderColor)==null?void 0:S.map((C,P)=>{var O;return(O=n.data.datasets[d].borderColor)==null?void 0:O[P]})}),e==null||e.update()}function rH(e,t,n,r){var i,o;try{if(!e||!e.data)return;const{dimensionKeys:s,metricKeys:a}=sa(e.data);if(["bar","horizontalBar","line","pie","doughnut","radar","polarArea"].includes(e.type)){const l=s[0],c=(i=e.data[n])==null?void 0:i[l];return[{columnName:l,columnValue:c,metric:a[t],value:r}]}if(e.type==="stackedBar"){const l=n2({dataArray:e.data,groupKey:s[0],pivotKey:s[1],valueKey:a[0]}),c=s[0],d=(o=l[n])==null?void 0:o[c],f=s[1],{metricKeys:g}=sa(l),p=g[t];return[{columnName:c,columnValue:d,metric:a[0],value:r},{columnName:f,columnValue:p,metric:a[0],value:r}]}if(e.type==="bubble"||e.type==="scatter"){const l=s[0],c=r.label;return[{columnName:l,columnValue:c,metric1:a[0],value1:r.x,metric2:a[1],value2:r.y,metric3:a==null?void 0:a[2],value3:r==null?void 0:r.r}]}}catch(s){console.error("Error in getAdhocFilter",s)}}function iH(e){let t=[];const n=ge(X=>X.authToken),r=_e(X=>X.selectedConnectionId),i=_e(X=>X.selectedDatabaseName),o=_e(X=>X.selectedSchemaName),s=_e(X=>X.selectedTableName),a=_e(X=>X.actions.setCurrentColumns),{data:l,isLoading:c,isError:d}=Cr({queryKey:[e||"connections"],queryFn:()=>tl("http://localhost:3000/api/v1/connections",(n==null?void 0:n.accessToken)||""),enabled:!!(n!=null&&n.accessToken)}),f=l==null?void 0:l.connections.find(X=>X.id===r),g=(f==null?void 0:f.type)==="API",{data:p,isLoading:v,isFetching:y,isError:x,refetch:w}=Cr({queryKey:[r],queryFn:()=>tl("http://localhost:3000/api/v1/databases",(n==null?void 0:n.accessToken)||"",{connection_id:r}),enabled:!!r&&(f==null?void 0:f.type)!=="API"}),{data:S,isLoading:C,isFetching:P,isError:O,refetch:k}=Cr({queryKey:[r,i],queryFn:()=>tl("http://localhost:3000/api/v1/schemas",(n==null?void 0:n.accessToken)||"",{connection_id:r,database_name:i}),enabled:!!r&&!!i&&(f==null?void 0:f.type)!=="API"}),{data:A,isLoading:L,isFetching:F,isError:j,refetch:B}=Cr({queryKey:[r,i,o],queryFn:()=>tl("http://localhost:3000/api/v1/tables",(n==null?void 0:n.accessToken)||"",{connection_id:r,database_name:i,schema_name:o}),enabled:!!r&&!!i&&!!o&&(f==null?void 0:f.type)!=="API"}),{data:H,isLoading:K,isFetching:Y,isError:$}=Cr({queryKey:[r,i,s],queryFn:()=>tl("http://localhost:3000/api/v1/columns",(n==null?void 0:n.accessToken)||"",{connection_id:r,database_name:i,schema_name:o,table_name:s}),enabled:!!r&&!!i&&!!o&&!!s&&(f==null?void 0:f.type)!=="API"}),{data:Z,isLoading:U,isFetching:ie,isError:le}=Cr({queryKey:["api",r],queryFn:()=>Ns("http://localhost:3000/api/v1/query",(n==null?void 0:n.accessToken)||"",{connection_id:r,sql:"select * from api limit 10"}),enabled:!!r&&g});m.useEffect(()=>{a(t)},[t,a]),Z&&Z.records.length>0&&(t=aH(Z.records[0])),p&&p.databases.length>0,S&&S.schemas.length>0,H&&H.columns.length>0&&(t=H.columns.map(X=>({...X,data_type:X.data_type.toLowerCase()}))),x&&(t=[]),($||d)&&(t=[]);const M=l==null?void 0:l.connections.map(X=>({id:X.id,name:X.name})),W=p==null?void 0:p.databases.map(X=>({id:X.database_name,name:X.database_name})),ne=S==null?void 0:S.schemas.map(X=>({id:X.schema_name,name:X.schema_name})),N=A==null?void 0:A.tables.map(X=>({id:X.table_name,name:X.table_name}));return{connectionItems:M,isConnectionsLoading:c,isConnectionsError:d,databaseItems:W,isDatabasesLoadingOrFetching:v||y,isDatabaseError:x,schemaItems:ne,isSchemaLoadingOrFetching:C||P,isSchemaError:O,tableItems:N,isTableLoadingOrFetching:L||F,isTableError:j,columns:t,isColumnsLoadingOrFetching:K||Y,isColumnsError:$,isAPIConnection:g}}const oH=e=>{const t=new Date(e);return!isNaN(t.getTime())},sH=e=>!isNaN(Number(e))&&!isNaN(parseFloat(e)),wO=e=>{let t;return typeof e=="number"?t="number":typeof e=="string"?oH(e)?t="date":sH(e)?t="number":t="string":typeof e=="boolean"?t="boolean":e instanceof Date?t="date":t="unknown",t},aH=e=>Object.keys(e).map(t=>{const n=e[t],r=wO(n);return{column_name:t,data_type:r,is_nullable:n===null?"YES":"NO"}});function lH({card:e,className:t,...n}){const r=m.useRef(null),[i,o]=m.useState(0),[s,a]=m.useState(!1),l=ge(M=>M.theme),c=ge(M=>M.bookmarkKey),d=ge(M=>M.themeStyle),f=ge(M=>M.isVisualEditing),g=ge(M=>M.selectedSheetId),p=ge(M=>M.selectedCardId),v=ge(M=>M.isDashboardEditing),y=ge(M=>M.themeStyle),x=ge(M=>M.filterValues),w=ge(M=>M.actions.setCardData),S=ge(M=>M.actions.getSelectedCard),C=ge(M=>M.actions.setSelectedCardId),P=ge(M=>M.actions.addOrUpdateFilterValue),O=ge(M=>M.actions.removeFilterValue),k=ge(M=>M.actions.setSelectedCard),A=ge(M=>M.actions.setCardTitle),L=ge(M=>M.actions.setCardDescription),F=ge(M=>M.actions.addCard),{data:j,isLoading:B,isFetching:H,isError:K,refetch:Y}=yz(e);m.useEffect(()=>{!j||!j.records||w(g,e.id,(j==null?void 0:j.records)||[])},[j,g,e.id,w,x]),m.useEffect(()=>{o(i+1)},[e.data,e.type,e.cfg,e.customCfg,y]),m.useEffect(()=>{p===e.id&&v&&!f&&$()},[p,e.id,v,f]),m.useEffect(()=>{e.connectionId&&!s&&Y()},[x,c]),m.useEffect(()=>{const M=ne=>{if(v&&((ne.metaKey||ne.ctrlKey)&&ne.key==="c"&&navigator.clipboard.writeText(JSON.stringify(S())),(ne.ctrlKey||ne.metaKey)&&ne.key==="v"))try{navigator.clipboard.readText().then(N=>{try{const X=JSON.parse(N);X&&X.id&&(X.id=wu(),X.title=`${X.title} - Copy`,X.data=[],F(g,X))}catch(X){console.error("Failed to parse clipboard contents: ",X)}})}catch(N){console.error("Failed to read clipboard contents: ",N)}},W=r.current;return W==null||W.addEventListener("keydown",M),()=>{W==null||W.removeEventListener("keydown",M)}},[v,g,F,S]);const $=()=>{const M=r.current;M==null||M.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})};function Z(M,W){M.stopPropagation(),C(g,W.id),k(W)}function U(M,W,ne,N,X){if(!N)return;const me=l==="dark"?"rgb(238,238,238,0.2)":"rgb(238,238,238,0.8)";["bar","line","horizontalBar","stackedBar","bubble","scatter"].includes(ne)&&tH(M,W,N,X,me),["pie","doughnut","polarArea"].includes(ne)&&nH(M,W,N,X,me)}function ie(M,W,ne,N){var he,fe;if(!e.data)return;const X=rH(e,W,ne,N);if(!((he=e==null?void 0:e.preferences)!=null&&he.filterOnClick))return;if(s){const re=e.id;O(re),a(!1),U(M,ne,e.type,le,!1);return}if(!X)return;const me={filterId:e.id,connectionId:e==null?void 0:e.connectionId,tableName:e.lastSelectedTable,name:X[0].columnName,expression:(fe=e.preferences)==null?void 0:fe.filterOnClickField,valueType:wO(X[0].columnValue),operation:"=",values:[X[0].columnValue]};P(me),a(!0),U(M,ne,e.type,le,!0)}if(!e.id)return null;let le;return e.data&&e.data.length>0&&(le=kb({data:e.data,cardType:e.type,cfg:e.cfg,customCfg:e.customCfg})),_.jsxs(Mv,{tabIndex:-1,ref:r,role:"dashboard-card",onClick:M=>Z(M,e),className:Pe(" relative h-full flex flex-col rounded-sm ",{"border-dashed border-foreground/50 ":p===e.id&&v},t,d==null?void 0:d.dashboardCard),...n,children:[_.jsx(rz,{card:e}),_.jsxs(Dv,{className:"xbg-green-100 pb-4",children:[_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx(qc,{text:e.title,onSave:M=>A(g,e.id,M),children:_.jsx(Tv,{className:"text-base",children:e.title})}),e.refreshInterval&&_.jsxs(Vb,{children:[_.jsx(L2,{className:"pr-1",children:_.jsx("div",{className:Pe("h-2 w-2 rounded-full bg-green-500",{"bg-orange-500":B||H})})}),_.jsx(Ih,{side:"right",align:"center",children:_.jsx("p",{className:"text-xs",children:`Realtime (${e==null?void 0:e.refreshInterval})`})})]}),!e.refreshInterval&&(B||H)&&_.jsx(Mu,{className:"w-4 h-4 animate-spin text-muted-foreground"})]}),_.jsx(qc,{text:(e==null?void 0:e.description)||"",onSave:M=>L(g,e.id,M),children:_.jsxs(Av,{children:[" ",e.description]})})]}),_.jsxs(Iv,{className:"flex flex-col pb-6 grow relative overflow-auto ",children:[K&&_.jsx("p",{className:"text-sm",children:"Oops! It seems like something went wrong. Please review your connection or filters."}),!K&&le&&e.type!=="table"&&_.jsx(QE,{cfg:le,onDatapointClick:ie},i),e.type==="table"&&e.data&&e.data.length>0&&_.jsx(kl,{children:_.jsx(a0,{data:e==null?void 0:e.data})})]})]})}const cH=xS.WidthProvider(xS.Responsive);function uH(){var d,f;const e=ge(g=>g.isDashboardEditing),t=ge(g=>g.themeStyle),n=ge(g=>g.selectedSheetId),r=ge(g=>{var p,v,y;return(y=(v=(p=g.dashboard)==null?void 0:p.sheets)==null?void 0:v.find(x=>x.id===n))==null?void 0:y.cards}),{getSelectedSheet:i,getSelectedSheetLayout:o,setSheetLayout:s}=ge(g=>g.actions);if(!n)return null;const a=i(),l=o(),c=(g,p)=>_.jsx(_O,{className:" after:content-none",ref:p,handleAxis:g});return _.jsx(cH,{margin:((d=t==null?void 0:t.gridLayout)==null?void 0:d.margin)||[10,10],isDraggable:e,resizeHandles:e?["sw","nw","ne","se","e","w"]:[],onLayoutChange:g=>{a!=null&&a.id&&s(a.id,g)},className:Pe((f=t==null?void 0:t.gridLayout)==null?void 0:f.className),layouts:{lg:l||[]},breakpoints:{lg:1500},cols:{lg:48},rowHeight:48,resizeHandle:c,children:r&&r.map((g,p)=>_.jsx("div",{role:"dashboard-card-container",className:Pe("group",t==null?void 0:t.dashboardCardContainer),"data-grid":a!=null&&a.layout?a==null?void 0:a.layout[p]:{x:0,y:0,w:20,h:6,minH:5,minW:10,maxH:12},children:_.jsx(lH,{card:g})},g.id))})}const _O=m.forwardRef(({className:e,handleAxis:t,...n},r)=>_.jsx("div",{ref:r,className:Pe(`z-10 react-resizable-handle react-resizable-handle-${t} absolute border-foreground/40 `,{"group-hover:border-2 group-hover:border-r-0 group-hover:border-b-0 border-foreground/40":t==="nw","group-hover:border-2 group-hover:border-l-0 group-hover:border-b-0 border-foreground/40":t==="ne","group-hover:border-2 group-hover:border-r-0 group-hover:border-t-0 border-foreground/40":t==="sw","group-hover:border-2 group-hover:border-l-0 group-hover:border-t-0 border-foreground/40":t==="se","group-hover:border-2 group-hover:border-b-0 group-hover:border-t-0 group-hover:border-l-0 border-foreground/40 ":t==="e","group-hover:border-2 group-hover:border-b-0 group-hover:border-t-0 group-hover:border-r-0 border-foreground/40":t==="w"},e),...n}));_O.displayName="ResizeHandle";/**
310
+ */function aO(e,t){return e?NV(e)?de.createElement(e,t):e:null}function NV(e){return RV(e)||typeof e=="function"||LV(e)}function RV(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function LV(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function $V(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=de.useState(()=>({current:PV(t)})),[r,i]=de.useState(()=>n.current.initialState);return n.current.setOptions(o=>({...o,...e,state:{...r,...e.state},onStateChange:s=>{i(s),e.onStateChange==null||e.onStateChange(s)}})),n.current}function a0({data:e}){var s;const[t,n]=m.useState([]),i=Object.keys(e[0]).map(a=>({accessorKey:a,header:({column:l})=>{const c=l.getIsSorted();return _.jsxs("div",{className:"flex items-center cursor-pointer ",onClick:()=>l.toggleSorting(l.getIsSorted()==="asc"),children:[a,c==="asc"?_.jsx(WB,{className:"ml-2 h-4 w-4"}):c==="desc"?_.jsx(HB,{className:"ml-2 h-4 w-4"}):null]})}})),o=$V({data:e,columns:i,getCoreRowModel:DV(),getPaginationRowModel:IV(),onSortingChange:n,getSortedRowModel:TV(),manualPagination:!0,state:{sorting:t}});return _.jsx(_.Fragment,{children:_.jsxs($2,{children:[_.jsx(F2,{children:o.getHeaderGroups().map(a=>_.jsx(Nh,{children:a.headers.map(l=>_.jsx(z2,{className:"sticky top-0",children:l.isPlaceholder?null:aO(l.column.columnDef.header,l.getContext())},l.id))},a.id))}),_.jsx(j2,{children:(s=o.getRowModel().rows)!=null&&s.length?o.getRowModel().rows.map(a=>_.jsx(Nh,{className:"whitespace-nowrap py-2","data-state":a.getIsSelected()&&"selected",children:a.getVisibleCells().map(l=>_.jsx(Hb,{children:aO(l.column.columnDef.cell,l.getContext())},l.id))},a.id)):_.jsx(Nh,{children:_.jsx(Hb,{colSpan:i.length,className:"h-24 text-center ",children:"No results."})})})]})})}function l0(e,[t,n]){return Math.min(n,Math.max(t,e))}function FV(e,t){return m.useReducer((n,r)=>{const i=t[n][r];return i??n},e)}const lO="ScrollArea",[cO,Qde]=kn(lO),[jV,ei]=cO(lO),uO=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:o=600,...s}=e,[a,l]=m.useState(null),[c,d]=m.useState(null),[f,g]=m.useState(null),[p,v]=m.useState(null),[y,x]=m.useState(null),[w,S]=m.useState(0),[C,P]=m.useState(0),[O,k]=m.useState(!1),[A,L]=m.useState(!1),F=et(t,B=>l(B)),j=js(i);return m.createElement(jV,{scope:n,type:r,dir:j,scrollHideDelay:o,scrollArea:a,viewport:c,onViewportChange:d,content:f,onContentChange:g,scrollbarX:p,onScrollbarXChange:v,scrollbarXEnabled:O,onScrollbarXEnabledChange:k,scrollbarY:y,onScrollbarYChange:x,scrollbarYEnabled:A,onScrollbarYEnabledChange:L,onCornerWidthChange:S,onCornerHeightChange:P},m.createElement(Ve.div,ae({dir:j},s,{ref:F,style:{position:"relative","--radix-scroll-area-corner-width":w+"px","--radix-scroll-area-corner-height":C+"px",...e.style}})))}),zV="ScrollAreaViewport",BV=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...i}=e,o=ei(zV,n),s=m.useRef(null),a=et(t,s,o.onViewportChange);return m.createElement(m.Fragment,null,m.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),m.createElement(Ve.div,ae({"data-radix-scroll-area-viewport":""},i,{ref:a,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style}}),m.createElement("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),xo="ScrollAreaScrollbar",dO=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=ei(xo,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:s}=i,a=e.orientation==="horizontal";return m.useEffect(()=>(a?o(!0):s(!0),()=>{a?o(!1):s(!1)}),[a,o,s]),i.type==="hover"?m.createElement(VV,ae({},r,{ref:t,forceMount:n})):i.type==="scroll"?m.createElement(HV,ae({},r,{ref:t,forceMount:n})):i.type==="auto"?m.createElement(fO,ae({},r,{ref:t,forceMount:n})):i.type==="always"?m.createElement(c0,ae({},r,{ref:t})):null}),VV=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=ei(xo,e.__scopeScrollArea),[o,s]=m.useState(!1);return m.useEffect(()=>{const a=i.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),s(!0)},d=()=>{l=window.setTimeout(()=>s(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",d)}}},[i.scrollArea,i.scrollHideDelay]),m.createElement(bn,{present:n||o},m.createElement(fO,ae({"data-state":o?"visible":"hidden"},r,{ref:t})))}),HV=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=ei(xo,e.__scopeScrollArea),o=e.orientation==="horizontal",s=Vh(()=>l("SCROLL_END"),100),[a,l]=FV("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return m.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,i.scrollHideDelay,l]),m.useEffect(()=>{const c=i.viewport,d=o?"scrollLeft":"scrollTop";if(c){let f=c[d];const g=()=>{const p=c[d];f!==p&&(l("SCROLL"),s()),f=p};return c.addEventListener("scroll",g),()=>c.removeEventListener("scroll",g)}},[i.viewport,o,l,s]),m.createElement(bn,{present:n||a!=="hidden"},m.createElement(c0,ae({"data-state":a==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:Ee(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Ee(e.onPointerLeave,()=>l("POINTER_LEAVE"))})))}),fO=m.forwardRef((e,t)=>{const n=ei(xo,e.__scopeScrollArea),{forceMount:r,...i}=e,[o,s]=m.useState(!1),a=e.orientation==="horizontal",l=Vh(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;s(a?c:d)}},10);return Pl(n.viewport,l),Pl(n.content,l),m.createElement(bn,{present:r||o},m.createElement(c0,ae({"data-state":o?"visible":"hidden"},i,{ref:t})))}),c0=m.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,i=ei(xo,e.__scopeScrollArea),o=m.useRef(null),s=m.useRef(0),[a,l]=m.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=mO(a.viewport,a.content),d={...r,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:g=>o.current=g,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:g=>s.current=g};function f(g,p){return QV(g,s.current,a,p)}return n==="horizontal"?m.createElement(WV,ae({},d,{ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const g=i.viewport.scrollLeft,p=vO(g,a,i.dir);o.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:g=>{i.viewport&&(i.viewport.scrollLeft=g)},onDragScroll:g=>{i.viewport&&(i.viewport.scrollLeft=f(g,i.dir))}})):n==="vertical"?m.createElement(qV,ae({},d,{ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const g=i.viewport.scrollTop,p=vO(g,a);o.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:g=>{i.viewport&&(i.viewport.scrollTop=g)},onDragScroll:g=>{i.viewport&&(i.viewport.scrollTop=f(g))}})):null}),WV=m.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...i}=e,o=ei(xo,e.__scopeScrollArea),[s,a]=m.useState(),l=m.useRef(null),c=et(t,l,o.onScrollbarXChange);return m.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),m.createElement(pO,ae({"data-orientation":"horizontal"},i,{ref:c,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Bh(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const g=o.viewport.scrollLeft+d.deltaX;e.onWheelScroll(g),yO(g,f)&&d.preventDefault()}},onResize:()=>{l.current&&o.viewport&&s&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:zh(s.paddingLeft),paddingEnd:zh(s.paddingRight)}})}}))}),qV=m.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...i}=e,o=ei(xo,e.__scopeScrollArea),[s,a]=m.useState(),l=m.useRef(null),c=et(t,l,o.onScrollbarYChange);return m.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),m.createElement(pO,ae({"data-orientation":"vertical"},i,{ref:c,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Bh(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const g=o.viewport.scrollTop+d.deltaY;e.onWheelScroll(g),yO(g,f)&&d.preventDefault()}},onResize:()=>{l.current&&o.viewport&&s&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:zh(s.paddingTop),paddingEnd:zh(s.paddingBottom)}})}}))}),[UV,hO]=cO(xo),pO=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:o,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:d,onResize:f,...g}=e,p=ei(xo,n),[v,y]=m.useState(null),x=et(t,F=>y(F)),w=m.useRef(null),S=m.useRef(""),C=p.viewport,P=r.content-r.viewport,O=wn(d),k=wn(l),A=Vh(f,10);function L(F){if(w.current){const j=F.clientX-w.current.left,B=F.clientY-w.current.top;c({x:j,y:B})}}return m.useEffect(()=>{const F=j=>{const B=j.target;(v==null?void 0:v.contains(B))&&O(j,P)};return document.addEventListener("wheel",F,{passive:!1}),()=>document.removeEventListener("wheel",F,{passive:!1})},[C,v,P,O]),m.useEffect(k,[r,k]),Pl(v,A),Pl(p.content,A),m.createElement(UV,{scope:n,scrollbar:v,hasThumb:i,onThumbChange:wn(o),onThumbPointerUp:wn(s),onThumbPositionChange:k,onThumbPointerDown:wn(a)},m.createElement(Ve.div,ae({},g,{ref:x,style:{position:"absolute",...g.style},onPointerDown:Ee(e.onPointerDown,F=>{F.button===0&&(F.target.setPointerCapture(F.pointerId),w.current=v.getBoundingClientRect(),S.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),L(F))}),onPointerMove:Ee(e.onPointerMove,L),onPointerUp:Ee(e.onPointerUp,F=>{const j=F.target;j.hasPointerCapture(F.pointerId)&&j.releasePointerCapture(F.pointerId),document.body.style.webkitUserSelect=S.current,p.viewport&&(p.viewport.style.scrollBehavior=""),w.current=null})})))}),u0="ScrollAreaThumb",GV=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=hO(u0,e.__scopeScrollArea);return m.createElement(bn,{present:n||i.hasThumb},m.createElement(YV,ae({ref:t},r)))}),YV=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...i}=e,o=ei(u0,n),s=hO(u0,n),{onThumbPositionChange:a}=s,l=et(t,f=>s.onThumbChange(f)),c=m.useRef(),d=Vh(()=>{c.current&&(c.current(),c.current=void 0)},100);return m.useEffect(()=>{const f=o.viewport;if(f){const g=()=>{if(d(),!c.current){const p=JV(f,a);c.current=p,a()}};return a(),f.addEventListener("scroll",g),()=>f.removeEventListener("scroll",g)}},[o.viewport,d,a]),m.createElement(Ve.div,ae({"data-state":s.hasThumb?"visible":"hidden"},i,{ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ee(e.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),v=f.clientX-p.left,y=f.clientY-p.top;s.onThumbPointerDown({x:v,y})}),onPointerUp:Ee(e.onPointerUp,s.onThumbPointerUp)}))}),gO="ScrollAreaCorner",KV=m.forwardRef((e,t)=>{const n=ei(gO,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?m.createElement(XV,ae({},e,{ref:t})):null}),XV=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,i=ei(gO,n),[o,s]=m.useState(0),[a,l]=m.useState(0),c=!!(o&&a);return Pl(i.scrollbarX,()=>{var d;const f=((d=i.scrollbarX)===null||d===void 0?void 0:d.offsetHeight)||0;i.onCornerHeightChange(f),l(f)}),Pl(i.scrollbarY,()=>{var d;const f=((d=i.scrollbarY)===null||d===void 0?void 0:d.offsetWidth)||0;i.onCornerWidthChange(f),s(f)}),c?m.createElement(Ve.div,ae({},r,{ref:t,style:{width:o,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function zh(e){return e?parseInt(e,10):0}function mO(e,t){const n=e/t;return isNaN(n)?0:n}function Bh(e){const t=mO(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function QV(e,t,n,r="ltr"){const i=Bh(n),o=i/2,s=t||o,a=i-s,l=n.scrollbar.paddingStart+s,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return bO([l,c],f)(e)}function vO(e,t,n="ltr"){const r=Bh(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-i,s=t.content-t.viewport,a=o-r,l=n==="ltr"?[0,s]:[s*-1,0],c=l0(e,l);return bO([0,s],[0,a])(c)}function bO(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function yO(e,t){return e>0&&e<t}const JV=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function i(){const o={left:e.scrollLeft,top:e.scrollTop},s=n.left!==o.left,a=n.top!==o.top;(s||a)&&t(),n=o,r=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(r)};function Vh(e,t){const n=wn(e),r=m.useRef(0);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),m.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Pl(e,t){const n=wn(t);Hn(()=>{let r=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(e),()=>{window.cancelAnimationFrame(r),i.unobserve(e)}}},[e,n])}const xO=uO,ZV=BV,eH=KV,kl=de.forwardRef(({className:e,children:t,...n},r)=>_.jsxs(xO,{ref:r,className:Pe("relative overflow-hidden",e),...n,children:[_.jsx(ZV,{className:"h-full w-full rounded-[inherit]",children:t}),_.jsx(Hh,{}),_.jsx(eH,{})]}));kl.displayName=xO.displayName;const Hh=de.forwardRef(({className:e,orientation:t="vertical",...n},r)=>_.jsx(dO,{ref:r,orientation:t,className:Pe("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:_.jsx(GV,{className:"relative flex-1 rounded-full bg-border"})}));Hh.displayName=dO.displayName;function tH(e,t,n,r,i){var o,s,a,l;r?(s=(o=e==null?void 0:e.data)==null?void 0:o.datasets)==null||s.forEach(c=>{var d,f;typeof c.backgroundColor=="string"&&(c.backgroundColor=new Array(c.data.length).fill(c.backgroundColor),c.borderColor=new Array(c.data.length).fill(c.borderColor)),c.backgroundColor=(d=c==null?void 0:c.backgroundColor)==null?void 0:d.map((g,p)=>p===t?g:i),c.borderColor=(f=c==null?void 0:c.borderColor)==null?void 0:f.map((g,p)=>p===t?g:i)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,d)=>{var f,g,p,v,y,x;c.backgroundColor=new Array(c.data.length).fill((p=(g=(f=n==null?void 0:n.data)==null?void 0:f.datasets)==null?void 0:g[d])==null?void 0:p.backgroundColor),c.borderColor=new Array(c.data.length).fill((x=(y=(v=n==null?void 0:n.data)==null?void 0:v.datasets)==null?void 0:y[d])==null?void 0:x.borderColor)}),e==null||e.update()}function nH(e,t,n,r,i){var o,s,a,l;r?(s=(o=e==null?void 0:e.data)==null?void 0:o.datasets)==null||s.forEach(c=>{var d,f;console.log("clicked index",t),console.log(n.data),console.log(c),c.backgroundColor=(d=c==null?void 0:c.backgroundColor)==null?void 0:d.map((g,p)=>p===t?g:i),c.borderColor=(f=c==null?void 0:c.borderColor)==null?void 0:f.map((g,p)=>p===t?g:i)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,d)=>{var f,g,p,v,y,x,w,S;typeof c.backgroundColor=="string"&&(c.backgroundColor=(p=(g=(f=n==null?void 0:n.data)==null?void 0:f.datasets)==null?void 0:g[d])==null?void 0:p.backgroundColor,c.borderColor=(x=(y=(v=n==null?void 0:n.data)==null?void 0:v.datasets)==null?void 0:y[d])==null?void 0:x.borderColor),c.backgroundColor=(w=c==null?void 0:c.backgroundColor)==null?void 0:w.map((C,P)=>{var O;return(O=n.data.datasets[d].backgroundColor)==null?void 0:O[P]}),c.borderColor=(S=c==null?void 0:c.borderColor)==null?void 0:S.map((C,P)=>{var O;return(O=n.data.datasets[d].borderColor)==null?void 0:O[P]})}),e==null||e.update()}function rH(e,t,n,r){var i,o;try{if(!e||!e.data)return;const{dimensionKeys:s,metricKeys:a}=sa(e.data);if(["bar","horizontalBar","line","pie","doughnut","radar","polarArea"].includes(e.type)){const l=s[0],c=(i=e.data[n])==null?void 0:i[l];return[{columnName:l,columnValue:c,metric:a[t],value:r}]}if(e.type==="stackedBar"){const l=n2({dataArray:e.data,groupKey:s[0],pivotKey:s[1],valueKey:a[0]}),c=s[0],d=(o=l[n])==null?void 0:o[c],f=s[1],{metricKeys:g}=sa(l),p=g[t];return[{columnName:c,columnValue:d,metric:a[0],value:r},{columnName:f,columnValue:p,metric:a[0],value:r}]}if(e.type==="bubble"||e.type==="scatter"){const l=s[0],c=r.label;return[{columnName:l,columnValue:c,metric1:a[0],value1:r.x,metric2:a[1],value2:r.y,metric3:a==null?void 0:a[2],value3:r==null?void 0:r.r}]}}catch(s){console.error("Error in getAdhocFilter",s)}}function iH(e){let t=[];const n=ge(X=>X.authToken),r=_e(X=>X.selectedConnectionId),i=_e(X=>X.selectedDatabaseName),o=_e(X=>X.selectedSchemaName),s=_e(X=>X.selectedTableName),a=_e(X=>X.actions.setCurrentColumns),{data:l,isLoading:c,isError:d}=Cr({queryKey:[e||"connections"],queryFn:()=>tl("https://semaphor.cloud/api/v1/connections",(n==null?void 0:n.accessToken)||""),enabled:!!(n!=null&&n.accessToken)}),f=l==null?void 0:l.connections.find(X=>X.id===r),g=(f==null?void 0:f.type)==="API",{data:p,isLoading:v,isFetching:y,isError:x,refetch:w}=Cr({queryKey:[r],queryFn:()=>tl("https://semaphor.cloud/api/v1/databases",(n==null?void 0:n.accessToken)||"",{connection_id:r}),enabled:!!r&&(f==null?void 0:f.type)!=="API"}),{data:S,isLoading:C,isFetching:P,isError:O,refetch:k}=Cr({queryKey:[r,i],queryFn:()=>tl("https://semaphor.cloud/api/v1/schemas",(n==null?void 0:n.accessToken)||"",{connection_id:r,database_name:i}),enabled:!!r&&!!i&&(f==null?void 0:f.type)!=="API"}),{data:A,isLoading:L,isFetching:F,isError:j,refetch:B}=Cr({queryKey:[r,i,o],queryFn:()=>tl("https://semaphor.cloud/api/v1/tables",(n==null?void 0:n.accessToken)||"",{connection_id:r,database_name:i,schema_name:o}),enabled:!!r&&!!i&&!!o&&(f==null?void 0:f.type)!=="API"}),{data:H,isLoading:K,isFetching:Y,isError:$}=Cr({queryKey:[r,i,s],queryFn:()=>tl("https://semaphor.cloud/api/v1/columns",(n==null?void 0:n.accessToken)||"",{connection_id:r,database_name:i,schema_name:o,table_name:s}),enabled:!!r&&!!i&&!!o&&!!s&&(f==null?void 0:f.type)!=="API"}),{data:Z,isLoading:U,isFetching:ie,isError:le}=Cr({queryKey:["api",r],queryFn:()=>Ns("https://semaphor.cloud/api/v1/query",(n==null?void 0:n.accessToken)||"",{connection_id:r,sql:"select * from api limit 10"}),enabled:!!r&&g});m.useEffect(()=>{a(t)},[t,a]),Z&&Z.records.length>0&&(t=aH(Z.records[0])),p&&p.databases.length>0,S&&S.schemas.length>0,H&&H.columns.length>0&&(t=H.columns.map(X=>({...X,data_type:X.data_type.toLowerCase()}))),x&&(t=[]),($||d)&&(t=[]);const M=l==null?void 0:l.connections.map(X=>({id:X.id,name:X.name})),W=p==null?void 0:p.databases.map(X=>({id:X.database_name,name:X.database_name})),ne=S==null?void 0:S.schemas.map(X=>({id:X.schema_name,name:X.schema_name})),N=A==null?void 0:A.tables.map(X=>({id:X.table_name,name:X.table_name}));return{connectionItems:M,isConnectionsLoading:c,isConnectionsError:d,databaseItems:W,isDatabasesLoadingOrFetching:v||y,isDatabaseError:x,schemaItems:ne,isSchemaLoadingOrFetching:C||P,isSchemaError:O,tableItems:N,isTableLoadingOrFetching:L||F,isTableError:j,columns:t,isColumnsLoadingOrFetching:K||Y,isColumnsError:$,isAPIConnection:g}}const oH=e=>{const t=new Date(e);return!isNaN(t.getTime())},sH=e=>!isNaN(Number(e))&&!isNaN(parseFloat(e)),wO=e=>{let t;return typeof e=="number"?t="number":typeof e=="string"?oH(e)?t="date":sH(e)?t="number":t="string":typeof e=="boolean"?t="boolean":e instanceof Date?t="date":t="unknown",t},aH=e=>Object.keys(e).map(t=>{const n=e[t],r=wO(n);return{column_name:t,data_type:r,is_nullable:n===null?"YES":"NO"}});function lH({card:e,className:t,...n}){const r=m.useRef(null),[i,o]=m.useState(0),[s,a]=m.useState(!1),l=ge(M=>M.theme),c=ge(M=>M.bookmarkKey),d=ge(M=>M.themeStyle),f=ge(M=>M.isVisualEditing),g=ge(M=>M.selectedSheetId),p=ge(M=>M.selectedCardId),v=ge(M=>M.isDashboardEditing),y=ge(M=>M.themeStyle),x=ge(M=>M.filterValues),w=ge(M=>M.actions.setCardData),S=ge(M=>M.actions.getSelectedCard),C=ge(M=>M.actions.setSelectedCardId),P=ge(M=>M.actions.addOrUpdateFilterValue),O=ge(M=>M.actions.removeFilterValue),k=ge(M=>M.actions.setSelectedCard),A=ge(M=>M.actions.setCardTitle),L=ge(M=>M.actions.setCardDescription),F=ge(M=>M.actions.addCard),{data:j,isLoading:B,isFetching:H,isError:K,refetch:Y}=yz(e);m.useEffect(()=>{!j||!j.records||w(g,e.id,(j==null?void 0:j.records)||[])},[j,g,e.id,w,x]),m.useEffect(()=>{o(i+1)},[e.data,e.type,e.cfg,e.customCfg,y]),m.useEffect(()=>{p===e.id&&v&&!f&&$()},[p,e.id,v,f]),m.useEffect(()=>{e.connectionId&&!s&&Y()},[x,c]),m.useEffect(()=>{const M=ne=>{if(v&&((ne.metaKey||ne.ctrlKey)&&ne.key==="c"&&navigator.clipboard.writeText(JSON.stringify(S())),(ne.ctrlKey||ne.metaKey)&&ne.key==="v"))try{navigator.clipboard.readText().then(N=>{try{const X=JSON.parse(N);X&&X.id&&(X.id=wu(),X.title=`${X.title} - Copy`,X.data=[],F(g,X))}catch(X){console.error("Failed to parse clipboard contents: ",X)}})}catch(N){console.error("Failed to read clipboard contents: ",N)}},W=r.current;return W==null||W.addEventListener("keydown",M),()=>{W==null||W.removeEventListener("keydown",M)}},[v,g,F,S]);const $=()=>{const M=r.current;M==null||M.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})};function Z(M,W){M.stopPropagation(),C(g,W.id),k(W)}function U(M,W,ne,N,X){if(!N)return;const me=l==="dark"?"rgb(238,238,238,0.2)":"rgb(238,238,238,0.8)";["bar","line","horizontalBar","stackedBar","bubble","scatter"].includes(ne)&&tH(M,W,N,X,me),["pie","doughnut","polarArea"].includes(ne)&&nH(M,W,N,X,me)}function ie(M,W,ne,N){var he,fe;if(!e.data)return;const X=rH(e,W,ne,N);if(!((he=e==null?void 0:e.preferences)!=null&&he.filterOnClick))return;if(s){const re=e.id;O(re),a(!1),U(M,ne,e.type,le,!1);return}if(!X)return;const me={filterId:e.id,connectionId:e==null?void 0:e.connectionId,tableName:e.lastSelectedTable,name:X[0].columnName,expression:(fe=e.preferences)==null?void 0:fe.filterOnClickField,valueType:wO(X[0].columnValue),operation:"=",values:[X[0].columnValue]};P(me),a(!0),U(M,ne,e.type,le,!0)}if(!e.id)return null;let le;return e.data&&e.data.length>0&&(le=kb({data:e.data,cardType:e.type,cfg:e.cfg,customCfg:e.customCfg})),_.jsxs(Mv,{tabIndex:-1,ref:r,role:"dashboard-card",onClick:M=>Z(M,e),className:Pe(" relative h-full flex flex-col rounded-sm ",{"border-dashed border-foreground/50 ":p===e.id&&v},t,d==null?void 0:d.dashboardCard),...n,children:[_.jsx(rz,{card:e}),_.jsxs(Dv,{className:"xbg-green-100 pb-4",children:[_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx(qc,{text:e.title,onSave:M=>A(g,e.id,M),children:_.jsx(Tv,{className:"text-base",children:e.title})}),e.refreshInterval&&_.jsxs(Vb,{children:[_.jsx(L2,{className:"pr-1",children:_.jsx("div",{className:Pe("h-2 w-2 rounded-full bg-green-500",{"bg-orange-500":B||H})})}),_.jsx(Ih,{side:"right",align:"center",children:_.jsx("p",{className:"text-xs",children:`Realtime (${e==null?void 0:e.refreshInterval})`})})]}),!e.refreshInterval&&(B||H)&&_.jsx(Mu,{className:"w-4 h-4 animate-spin text-muted-foreground"})]}),_.jsx(qc,{text:(e==null?void 0:e.description)||"",onSave:M=>L(g,e.id,M),children:_.jsxs(Av,{children:[" ",e.description]})})]}),_.jsxs(Iv,{className:"flex flex-col pb-6 grow relative overflow-auto ",children:[K&&_.jsx("p",{className:"text-sm",children:"Oops! It seems like something went wrong. Please review your connection or filters."}),!K&&le&&e.type!=="table"&&_.jsx(QE,{cfg:le,onDatapointClick:ie},i),e.type==="table"&&e.data&&e.data.length>0&&_.jsx(kl,{children:_.jsx(a0,{data:e==null?void 0:e.data})})]})]})}const cH=xS.WidthProvider(xS.Responsive);function uH(){var d,f;const e=ge(g=>g.isDashboardEditing),t=ge(g=>g.themeStyle),n=ge(g=>g.selectedSheetId),r=ge(g=>{var p,v,y;return(y=(v=(p=g.dashboard)==null?void 0:p.sheets)==null?void 0:v.find(x=>x.id===n))==null?void 0:y.cards}),{getSelectedSheet:i,getSelectedSheetLayout:o,setSheetLayout:s}=ge(g=>g.actions);if(!n)return null;const a=i(),l=o(),c=(g,p)=>_.jsx(_O,{className:" after:content-none",ref:p,handleAxis:g});return _.jsx(cH,{margin:((d=t==null?void 0:t.gridLayout)==null?void 0:d.margin)||[10,10],isDraggable:e,resizeHandles:e?["sw","nw","ne","se","e","w"]:[],onLayoutChange:g=>{a!=null&&a.id&&s(a.id,g)},className:Pe((f=t==null?void 0:t.gridLayout)==null?void 0:f.className),layouts:{lg:l||[]},breakpoints:{lg:1500},cols:{lg:48},rowHeight:48,resizeHandle:c,children:r&&r.map((g,p)=>_.jsx("div",{role:"dashboard-card-container",className:Pe("group",t==null?void 0:t.dashboardCardContainer),"data-grid":a!=null&&a.layout?a==null?void 0:a.layout[p]:{x:0,y:0,w:20,h:6,minH:5,minW:10,maxH:12},children:_.jsx(lH,{card:g})},g.id))})}const _O=m.forwardRef(({className:e,handleAxis:t,...n},r)=>_.jsx("div",{ref:r,className:Pe(`z-10 react-resizable-handle react-resizable-handle-${t} absolute border-foreground/40 `,{"group-hover:border-2 group-hover:border-r-0 group-hover:border-b-0 border-foreground/40":t==="nw","group-hover:border-2 group-hover:border-l-0 group-hover:border-b-0 border-foreground/40":t==="ne","group-hover:border-2 group-hover:border-r-0 group-hover:border-t-0 border-foreground/40":t==="sw","group-hover:border-2 group-hover:border-l-0 group-hover:border-t-0 border-foreground/40":t==="se","group-hover:border-2 group-hover:border-b-0 group-hover:border-t-0 group-hover:border-l-0 border-foreground/40 ":t==="e","group-hover:border-2 group-hover:border-b-0 group-hover:border-t-0 group-hover:border-r-0 border-foreground/40":t==="w"},e),...n}));_O.displayName="ResizeHandle";/**
311
311
  * react-virtual
312
312
  *
313
313
  * Copyright (c) TanStack
@@ -358,7 +358,7 @@ Valid keys: `+JSON.stringify(Object.keys(M),null," "));var V=xe(fe,oe,X,me,he+"
358
358
  */var xH=typeof document<"u"?de.useLayoutEffect:de.useEffect;function wH(e){var t=de.useReducer(function(){return{}},{})[1],n=Wh({},e,{onChange:function(s,a){a?Mt.flushSync(t):t(),e.onChange==null||e.onChange(s,a)}}),r=de.useState(function(){return new bH(n)}),i=r[0];return i.setOptions(n),de.useEffect(function(){return i._didMount()},[]),xH(function(){return i._willUpdate()}),i}function _H(e){return wH(Wh({observeElementRect:pH,observeElementOffset:gH,scrollToFn:vH},e))}var SH=Object.defineProperty,CH=(e,t,n)=>t in e?SH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,f0=(e,t,n)=>(CH(e,typeof t!="symbol"?t+"":t,n),n);let EH=class{constructor(){f0(this,"current",this.detect()),f0(this,"handoffState","pending"),f0(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},ua=new EH,_n=(e,t)=>{ua.isServer?m.useEffect(e,t):m.useLayoutEffect(e,t)};function zi(e){let t=m.useRef(e);return _n(()=>{t.current=e},[e]),t}function h0(e,t){let[n,r]=m.useState(e),i=zi(e);return _n(()=>r(i.current),[i,r,...t]),n}let yt=function(e){let t=zi(e);return m.useCallback((...n)=>t.current(...n),[t])};function OH(e,t,n){let[r,i]=m.useState(n),o=e!==void 0,s=m.useRef(o),a=m.useRef(!1),l=m.useRef(!1);return o&&!s.current&&!a.current?(a.current=!0,s.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!o&&s.current&&!l.current&&(l.current=!0,s.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[o?e:r,yt(c=>(o||i(c),t==null?void 0:t(c)))]}function PH(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function da(){let e=[],t={addEventListener(n,r,i,o){return n.addEventListener(r,i,o),t.add(()=>n.removeEventListener(r,i,o))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return PH(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,i){let o=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:i}),this.add(()=>{Object.assign(n.style,{[r]:o})})},group(n){let r=da();return n(r),this.add(()=>r.dispose())},add(n){return e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let i of e.splice(r,1))i()}},dispose(){for(let n of e.splice(0))n()}};return t}function Tu(){let[e]=m.useState(da);return m.useEffect(()=>()=>e.dispose(),[e]),e}function kH(){let e=typeof document>"u";return"useSyncExternalStore"in de?(t=>t.useSyncExternalStore)(de)(()=>()=>{},()=>!1,()=>!e):!1}function p0(){let e=kH(),[t,n]=de.useState(ua.isHandoffComplete);return t&&ua.isHandoffComplete===!1&&n(!1),de.useEffect(()=>{t!==!0&&n(!0)},[t]),de.useEffect(()=>ua.handoff(),[]),e?!1:t}var CO;let Au=(CO=m.useId)!=null?CO:function(){let e=p0(),[t,n]=m.useState(e?()=>ua.nextId():null);return _n(()=>{t===null&&n(ua.nextId())},[t]),t!=null?""+t:void 0};function $n(e,t,...n){if(e in t){let i=t[e];return typeof i=="function"?i(...n):i}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(i=>`"${i}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,$n),r}function g0(e){return ua.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let EO=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var MH=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(MH||{}),DH=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(DH||{}),TH=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(TH||{}),OO=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(OO||{});function AH(e,t=0){var n;return e===((n=g0(e))==null?void 0:n.body)?!1:$n(t,{0(){return e.matches(EO)},1(){let r=e;for(;r!==null;){if(r.matches(EO))return!0;r=r.parentElement}return!1}})}var IH=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(IH||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function NH(e,t=n=>n){return e.slice().sort((n,r)=>{let i=t(n),o=t(r);if(i===null||o===null)return 0;let s=i.compareDocumentPosition(o);return s&Node.DOCUMENT_POSITION_FOLLOWING?-1:s&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function RH(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function LH(){return/Android/gi.test(window.navigator.userAgent)}function PO(){return RH()||LH()}function Uh(e,t,n){let r=zi(t);m.useEffect(()=>{function i(o){r.current(o)}return document.addEventListener(e,i,n),()=>document.removeEventListener(e,i,n)},[e,n])}function $H(e,t,n){let r=zi(t);m.useEffect(()=>{function i(o){r.current(o)}return window.addEventListener(e,i,n),()=>window.removeEventListener(e,i,n)},[e,n])}function FH(e,t,n=!0){let r=m.useRef(!1);m.useEffect(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function i(s,a){if(!r.current||s.defaultPrevented)return;let l=a(s);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let c=function d(f){return typeof f=="function"?d(f()):Array.isArray(f)||f instanceof Set?f:[f]}(e);for(let d of c){if(d===null)continue;let f=d instanceof HTMLElement?d:d.current;if(f!=null&&f.contains(l)||s.composed&&s.composedPath().includes(f))return}return!AH(l,OO.Loose)&&l.tabIndex!==-1&&s.preventDefault(),t(s,l)}let o=m.useRef(null);Uh("pointerdown",s=>{var a,l;r.current&&(o.current=((l=(a=s.composedPath)==null?void 0:a.call(s))==null?void 0:l[0])||s.target)},!0),Uh("mousedown",s=>{var a,l;r.current&&(o.current=((l=(a=s.composedPath)==null?void 0:a.call(s))==null?void 0:l[0])||s.target)},!0),Uh("click",s=>{PO()||o.current&&(i(s,()=>o.current),o.current=null)},!0),Uh("touchend",s=>i(s,()=>s.target instanceof HTMLElement?s.target:null),!0),$H("blur",s=>i(s,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function jH(...e){return m.useMemo(()=>g0(...e),[...e])}function kO(e){var t;if(e.type)return e.type;let n=(t=e.as)!=null?t:"button";if(typeof n=="string"&&n.toLowerCase()==="button")return"button"}function zH(e,t){let[n,r]=m.useState(()=>kO(e));return _n(()=>{r(kO(e))},[e.type,e.as]),_n(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")},[n,t]),n}let BH=Symbol();function fa(...e){let t=m.useRef(e);m.useEffect(()=>{t.current=e},[e]);let n=yt(r=>{for(let i of t.current)i!=null&&(typeof i=="function"?i(r):i.current=r)});return e.every(r=>r==null||(r==null?void 0:r[BH]))?void 0:n}function MO(e){return[e.screenX,e.screenY]}function VH(){let e=m.useRef([-1,-1]);return{wasMoved(t){let n=MO(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=MO(t)}}}function HH({container:e,accept:t,walk:n,enabled:r=!0}){let i=m.useRef(t),o=m.useRef(n);m.useEffect(()=>{i.current=t,o.current=n},[t,n]),_n(()=>{if(!e||!r)return;let s=g0(e);if(!s)return;let a=i.current,l=o.current,c=Object.assign(f=>a(f),{acceptNode:a}),d=s.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,c,!1);for(;d.nextNode();)l(d.currentNode)},[e,r,i,o])}function DO(e,t){let n=m.useRef([]),r=yt(e);m.useEffect(()=>{let i=[...n.current];for(let[o,s]of t.entries())if(n.current[o]!==s){let a=r(t,i);return n.current=t,a}},[r,...t])}function Gh(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var Yh=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Yh||{}),ts=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(ts||{});function wo({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:i,visible:o=!0,name:s,mergeRefs:a}){a=a??WH;let l=TO(t,e);if(o)return Kh(l,n,r,s,a);let c=i??0;if(c&2){let{static:d=!1,...f}=l;if(d)return Kh(f,n,r,s,a)}if(c&1){let{unmount:d=!0,...f}=l;return $n(d?0:1,{0(){return null},1(){return Kh({...f,hidden:!0,style:{display:"none"}},n,r,s,a)}})}return Kh(l,n,r,s,a)}function Kh(e,t={},n,r,i){let{as:o=n,children:s,refName:a="ref",...l}=v0(e,["unmount","static"]),c=e.ref!==void 0?{[a]:e.ref}:{},d=typeof s=="function"?s(t):s;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(t));let f={};if(t){let g=!1,p=[];for(let[v,y]of Object.entries(t))typeof y=="boolean"&&(g=!0),y===!0&&p.push(v);g&&(f["data-headlessui-state"]=p.join(" "))}if(o===m.Fragment&&Object.keys(m0(l)).length>0){if(!m.isValidElement(d)||Array.isArray(d)&&d.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(l).map(y=>` - ${y}`).join(`
359
359
  `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(y=>` - ${y}`).join(`
360
360
  `)].join(`
361
- `));let g=d.props,p=typeof(g==null?void 0:g.className)=="function"?(...y)=>Gh(g==null?void 0:g.className(...y),l.className):Gh(g==null?void 0:g.className,l.className),v=p?{className:p}:{};return m.cloneElement(d,Object.assign({},TO(d.props,m0(v0(l,["ref"]))),f,c,{ref:i(d.ref,c.ref)},v))}return m.createElement(o,Object.assign({},v0(l,["ref"]),o!==m.Fragment&&c,o!==m.Fragment&&f),d)}function WH(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function TO(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let i in r)i.startsWith("on")&&typeof r[i]=="function"?(n[i]!=null||(n[i]=[]),n[i].push(r[i])):t[i]=r[i];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](i,...o){let s=n[r];for(let a of s){if((i instanceof Event||(i==null?void 0:i.nativeEvent)instanceof Event)&&i.defaultPrevented)return;a(i,...o)}}});return t}function Bi(e){var t;return Object.assign(m.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function m0(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function v0(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}let qH="div";var AO=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(AO||{});function UH(e,t){var n;let{features:r=1,...i}=e,o={ref:t,"aria-hidden":(r&2)===2?!0:(n=i["aria-hidden"])!=null?n:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return wo({ourProps:o,theirProps:i,slot:{},defaultTag:qH,name:"Hidden"})}let GH=Bi(UH),b0=m.createContext(null);b0.displayName="OpenClosedContext";var Ar=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Ar||{});function y0(){return m.useContext(b0)}function IO({value:e,children:t}){return m.createElement(b0.Provider,{value:e},t)}function YH(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let ha=[];YH(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&ha[0]!==t.target&&(ha.unshift(t.target),ha=ha.filter(n=>n!=null&&n.isConnected),ha.splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function KH(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&XH(n)?!1:r}function XH(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function QH(e){throw new Error("Unexpected object: "+e)}var Sn=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Sn||{});function NO(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),i=r??-1;switch(e.focus){case 0:{for(let o=0;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 1:{for(let o=i-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 2:{for(let o=i+1;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 3:{for(let o=n.length-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 4:{for(let o=0;o<n.length;++o)if(t.resolveId(n[o],o,n)===e.id)return o;return r}case 5:return null;default:QH(e)}}function RO(e={},t=null,n=[]){for(let[r,i]of Object.entries(e))$O(n,LO(t,r),i);return n}function LO(e,t){return e?e+"["+t+"]":t}function $O(e,t,n){if(Array.isArray(n))for(let[r,i]of n.entries())$O(e,LO(t,r.toString()),i);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):RO(n,t,e)}var Ir=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(Ir||{}),JH=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(JH||{}),ZH=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(ZH||{}),eW=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(eW||{}),tW=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.RegisterOption=3]="RegisterOption",e[e.UnregisterOption=4]="UnregisterOption",e[e.RegisterLabel=5]="RegisterLabel",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualOptions=7]="UpdateVirtualOptions",e))(tW||{});function x0(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),i=r.length>0&&r[0].dataRef.current.order!==null?r.sort((s,a)=>s.dataRef.current.order-a.dataRef.current.order):NH(r,s=>s.dataRef.current.domRef.current),o=n?i.indexOf(n):null;return o===-1&&(o=null),{options:i,activeOptionIndex:o}}let nW={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let r=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(r!==-1)return{...e,activeOptionIndex:r,comboboxState:0}}return{...e,comboboxState:0}},2(e,t){var n,r,i,o,s;if((n=e.dataRef.current)!=null&&n.disabled||(r=e.dataRef.current)!=null&&r.optionsRef.current&&!((i=e.dataRef.current)!=null&&i.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let d=t.focus===Sn.Specific?t.idx:NO(t,{resolveItems:()=>e.virtual.options,resolveActiveIndex:()=>{var g,p;return(p=(g=e.activeOptionIndex)!=null?g:e.virtual.options.findIndex(v=>!e.virtual.disabled(v)))!=null?p:null},resolveDisabled:e.virtual.disabled,resolveId(){throw new Error("Function not implemented.")}}),f=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===d&&e.activationTrigger===f?e:{...e,activeOptionIndex:d,activationTrigger:f}}let a=x0(e);if(a.activeOptionIndex===null){let d=a.options.findIndex(f=>!f.dataRef.current.disabled);d!==-1&&(a.activeOptionIndex=d)}let l=t.focus===Sn.Specific?t.idx:NO(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled}),c=(s=t.trigger)!=null?s:2;return e.activeOptionIndex===l&&e.activationTrigger===c?e:{...e,...a,activeOptionIndex:l,activationTrigger:c}},3:(e,t)=>{var n,r,i;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let o=t.payload,s=x0(e,l=>(l.push(o),l));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(s.activeOptionIndex=s.options.indexOf(o));let a={...e,...s,activationTrigger:2};return(i=e.dataRef.current)!=null&&i.__demoMode&&e.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},4:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(i=>i.id!==t.id)};let r=x0(e,i=>{let o=i.findIndex(s=>s.id===t.id);return o!==-1&&i.splice(o,1),i});return{...e,...r,activationTrigger:2}},5:(e,t)=>e.labelId===t.id?e:{...e,labelId:t.id},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n;if(((n=e.virtual)==null?void 0:n.options)===t.options)return e;let r=e.activeOptionIndex;if(e.activeOptionIndex!==null){let i=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);i!==-1?r=i:r=null}return{...e,activeOptionIndex:r,virtual:Object.assign({},e.virtual,{options:t.options})}}},w0=m.createContext(null);w0.displayName="ComboboxActionsContext";function Iu(e){let t=m.useContext(w0);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Iu),n}return t}let FO=m.createContext(null);function rW(e){var t;let n=pa("VirtualProvider"),[r,i]=m.useMemo(()=>{let l=n.optionsRef.current;if(!l)return[0,0];let c=window.getComputedStyle(l);return[parseFloat(c.paddingBlockStart||c.paddingTop),parseFloat(c.paddingBlockEnd||c.paddingBottom)]},[n.optionsRef.current]),o=_H({scrollPaddingStart:r,scrollPaddingEnd:i,count:n.virtual.options.length,estimateSize(){return 40},getScrollElement(){var l;return(l=n.optionsRef.current)!=null?l:null},overscan:12}),[s,a]=m.useState(0);return _n(()=>{a(l=>l+1)},[(t=n.virtual)==null?void 0:t.options]),m.createElement(FO.Provider,{value:o},m.createElement("div",{style:{position:"relative",width:"100%",height:`${o.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&process.env.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&n.virtual.options.length>n.activeOptionIndex&&o.scrollToIndex(n.activeOptionIndex)}}},o.getVirtualItems().map(l=>{var c;return m.createElement(m.Fragment,{key:l.key},m.cloneElement((c=e.children)==null?void 0:c.call(e,{option:n.virtual.options[l.index],open:n.comboboxState===0}),{key:`${s}-${l.key}`,"data-index":l.index,"aria-setsize":n.virtual.options.length,"aria-posinset":l.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${l.start}px)`,overflowAnchor:"none"}}))})))}let _0=m.createContext(null);_0.displayName="ComboboxDataContext";function pa(e){let t=m.useContext(_0);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,pa),n}return t}function iW(e,t){return $n(t.type,nW,e,t)}let oW=m.Fragment;function sW(e,t){let{value:n,defaultValue:r,onChange:i,form:o,name:s,by:a=null,disabled:l=!1,__demoMode:c=!1,nullable:d=!1,multiple:f=!1,immediate:g=!1,virtual:p=null,...v}=e,y=!1,x=null,[w=f?[]:void 0,S]=OH(n,i,r),[C,P]=m.useReducer(iW,{dataRef:m.createRef(),comboboxState:c?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),O=m.useRef(!1),k=m.useRef({static:!1,hold:!1}),A=m.useRef(null),L=m.useRef(null),F=m.useRef(null),j=m.useRef(null),B=yt(typeof a=="string"?(ee,oe)=>{let xe=a;return(ee==null?void 0:ee[xe])===(oe==null?void 0:oe[xe])}:a??((ee,oe)=>ee===oe)),H=yt(ee=>C.options.findIndex(oe=>B(oe.dataRef.current.value,ee))),K=m.useCallback(ee=>$n($.mode,{1:()=>w.some(oe=>B(oe,ee)),0:()=>B(w,ee)}),[w]),Y=yt(ee=>C.activeOptionIndex===H(ee)),$=m.useMemo(()=>({...C,immediate:y,optionsPropsRef:k,labelRef:A,inputRef:L,buttonRef:F,optionsRef:j,value:w,defaultValue:r,disabled:l,mode:f?1:0,virtual:C.virtual,get activeOptionIndex(){if(O.current&&C.activeOptionIndex===null&&C.options.length>0){let ee=C.options.findIndex(oe=>!oe.dataRef.current.disabled);if(ee!==-1)return ee}return C.activeOptionIndex},calculateIndex:H,compare:B,isSelected:K,isActive:Y,nullable:d,__demoMode:c}),[w,r,l,f,d,c,C,x]);_n(()=>{},[x,void 0]),_n(()=>{C.dataRef.current=$},[$]),FH([$.buttonRef,$.inputRef,$.optionsRef],()=>me.closeCombobox(),$.comboboxState===0);let Z=m.useMemo(()=>{var ee,oe,xe;return{open:$.comboboxState===0,disabled:l,activeIndex:$.activeOptionIndex,activeOption:$.activeOptionIndex===null?null:$.virtual?$.virtual.options[(ee=$.activeOptionIndex)!=null?ee:0]:(xe=(oe=$.options[$.activeOptionIndex])==null?void 0:oe.dataRef.current.value)!=null?xe:null,value:w}},[$,l,w]),U=yt(()=>{if($.activeOptionIndex!==null){if($.virtual)N($.virtual.options[$.activeOptionIndex]);else{let{dataRef:ee}=$.options[$.activeOptionIndex];N(ee.current.value)}me.goToOption(Sn.Specific,$.activeOptionIndex)}}),ie=yt(()=>{P({type:0}),O.current=!0}),le=yt(()=>{P({type:1}),O.current=!1}),M=yt((ee,oe,xe)=>(O.current=!1,ee===Sn.Specific?P({type:2,focus:Sn.Specific,idx:oe,trigger:xe}):P({type:2,focus:ee,trigger:xe}))),W=yt((ee,oe)=>(P({type:3,payload:{id:ee,dataRef:oe}}),()=>{$.isActive(oe.current.value)&&(O.current=!0),P({type:4,id:ee})})),ne=yt(ee=>(P({type:5,id:ee}),()=>P({type:5,id:null}))),N=yt(ee=>$n($.mode,{0(){return S==null?void 0:S(ee)},1(){let oe=$.value.slice(),xe=oe.findIndex(V=>B(V,ee));return xe===-1?oe.push(ee):oe.splice(xe,1),S==null?void 0:S(oe)}})),X=yt(ee=>{P({type:6,trigger:ee})}),me=m.useMemo(()=>({onChange:N,registerOption:W,registerLabel:ne,goToOption:M,closeCombobox:le,openCombobox:ie,setActivationTrigger:X,selectActiveOption:U}),[]),he=t===null?{}:{ref:t},fe=m.useRef(null),re=Tu();return m.useEffect(()=>{fe.current&&r!==void 0&&re.addEventListener(fe.current,"reset",()=>{S==null||S(r)})},[fe,S]),m.createElement(w0.Provider,{value:me},m.createElement(_0.Provider,{value:$},m.createElement(IO,{value:$n($.comboboxState,{0:Ar.Open,1:Ar.Closed})},s!=null&&w!=null&&RO({[s]:w}).map(([ee,oe],xe)=>m.createElement(GH,{features:AO.Hidden,ref:xe===0?V=>{var Me;fe.current=(Me=V==null?void 0:V.closest("form"))!=null?Me:null}:void 0,...m0({key:ee,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:o,name:ee,value:oe})})),wo({ourProps:he,theirProps:v,slot:Z,defaultTag:oW,name:"Combobox"}))))}let aW="input";function lW(e,t){var n,r,i,o,s;let a=Au(),{id:l=`headlessui-combobox-input-${a}`,onChange:c,displayValue:d,type:f="text",...g}=e,p=pa("Combobox.Input"),v=Iu("Combobox.Input"),y=fa(p.inputRef,t),x=jH(p.inputRef),w=m.useRef(!1),S=Tu(),C=yt(()=>{v.onChange(null),p.optionsRef.current&&(p.optionsRef.current.scrollTop=0),v.goToOption(Sn.Nothing)}),P=function(){var $;return typeof d=="function"&&p.value!==void 0?($=d(p.value))!=null?$:"":typeof p.value=="string"?p.value:""}();DO(([$,Z],[U,ie])=>{if(w.current)return;let le=p.inputRef.current;le&&((ie===0&&Z===1||$!==U)&&(le.value=$),requestAnimationFrame(()=>{if(w.current||!le||(x==null?void 0:x.activeElement)!==le)return;let{selectionStart:M,selectionEnd:W}=le;Math.abs((W??0)-(M??0))===0&&M===0&&le.setSelectionRange(le.value.length,le.value.length)}))},[P,p.comboboxState,x]),DO(([$],[Z])=>{if($===0&&Z===1){if(w.current)return;let U=p.inputRef.current;if(!U)return;let ie=U.value,{selectionStart:le,selectionEnd:M,selectionDirection:W}=U;U.value="",U.value=ie,W!==null?U.setSelectionRange(le,M,W):U.setSelectionRange(le,M)}},[p.comboboxState]);let O=m.useRef(!1),k=yt(()=>{O.current=!0}),A=yt(()=>{S.nextFrame(()=>{O.current=!1})}),L=yt($=>{switch(w.current=!0,$.key){case Ir.Enter:if(w.current=!1,p.comboboxState!==0||O.current)return;if($.preventDefault(),$.stopPropagation(),p.activeOptionIndex===null){v.closeCombobox();return}v.selectActiveOption(),p.mode===0&&v.closeCombobox();break;case Ir.ArrowDown:return w.current=!1,$.preventDefault(),$.stopPropagation(),$n(p.comboboxState,{0:()=>v.goToOption(Sn.Next),1:()=>v.openCombobox()});case Ir.ArrowUp:return w.current=!1,$.preventDefault(),$.stopPropagation(),$n(p.comboboxState,{0:()=>v.goToOption(Sn.Previous),1:()=>{v.openCombobox(),S.nextFrame(()=>{p.value||v.goToOption(Sn.Last)})}});case Ir.Home:if($.shiftKey)break;return w.current=!1,$.preventDefault(),$.stopPropagation(),v.goToOption(Sn.First);case Ir.PageUp:return w.current=!1,$.preventDefault(),$.stopPropagation(),v.goToOption(Sn.First);case Ir.End:if($.shiftKey)break;return w.current=!1,$.preventDefault(),$.stopPropagation(),v.goToOption(Sn.Last);case Ir.PageDown:return w.current=!1,$.preventDefault(),$.stopPropagation(),v.goToOption(Sn.Last);case Ir.Escape:return w.current=!1,p.comboboxState!==0?void 0:($.preventDefault(),p.optionsRef.current&&!p.optionsPropsRef.current.static&&$.stopPropagation(),p.nullable&&p.mode===0&&p.value===null&&C(),v.closeCombobox());case Ir.Tab:if(w.current=!1,p.comboboxState!==0)return;p.mode===0&&p.activationTrigger!==1&&v.selectActiveOption(),v.closeCombobox();break}}),F=yt($=>{c==null||c($),p.nullable&&p.mode===0&&$.target.value===""&&C(),v.openCombobox()}),j=yt($=>{var Z,U,ie;let le=(Z=$.relatedTarget)!=null?Z:ha.find(M=>M!==$.currentTarget);if(w.current=!1,!((U=p.optionsRef.current)!=null&&U.contains(le))&&!((ie=p.buttonRef.current)!=null&&ie.contains(le))&&p.comboboxState===0)return $.preventDefault(),p.mode===0&&(p.nullable&&p.value===null?C():p.activationTrigger!==1&&v.selectActiveOption()),v.closeCombobox()}),B=yt($=>{var Z,U,ie;let le=(Z=$.relatedTarget)!=null?Z:ha.find(M=>M!==$.currentTarget);(U=p.buttonRef.current)!=null&&U.contains(le)||(ie=p.optionsRef.current)!=null&&ie.contains(le)||p.disabled||p.immediate&&p.comboboxState!==0&&(v.openCombobox(),S.nextFrame(()=>{v.setActivationTrigger(1)}))}),H=h0(()=>{if(p.labelId)return[p.labelId].join(" ")},[p.labelId]),K=m.useMemo(()=>({open:p.comboboxState===0,disabled:p.disabled}),[p]),Y={ref:y,id:l,role:"combobox",type:f,"aria-controls":(n=p.optionsRef.current)==null?void 0:n.id,"aria-expanded":p.comboboxState===0,"aria-activedescendant":p.activeOptionIndex===null?void 0:p.virtual?(r=p.options.find($=>{var Z;return!((Z=p.virtual)!=null&&Z.disabled($.dataRef.current.value))&&p.compare($.dataRef.current.value,p.virtual.options[p.activeOptionIndex])}))==null?void 0:r.id:(i=p.options[p.activeOptionIndex])==null?void 0:i.id,"aria-labelledby":H,"aria-autocomplete":"list",defaultValue:(s=(o=e.defaultValue)!=null?o:p.defaultValue!==void 0?d==null?void 0:d(p.defaultValue):null)!=null?s:p.defaultValue,disabled:p.disabled,onCompositionStart:k,onCompositionEnd:A,onKeyDown:L,onChange:F,onFocus:B,onBlur:j};return wo({ourProps:Y,theirProps:g,slot:K,defaultTag:aW,name:"Combobox.Input"})}let cW="button";function uW(e,t){var n;let r=pa("Combobox.Button"),i=Iu("Combobox.Button"),o=fa(r.buttonRef,t),s=Au(),{id:a=`headlessui-combobox-button-${s}`,...l}=e,c=Tu(),d=yt(y=>{switch(y.key){case Ir.ArrowDown:return y.preventDefault(),y.stopPropagation(),r.comboboxState===1&&i.openCombobox(),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})});case Ir.ArrowUp:return y.preventDefault(),y.stopPropagation(),r.comboboxState===1&&(i.openCombobox(),c.nextFrame(()=>{r.value||i.goToOption(Sn.Last)})),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})});case Ir.Escape:return r.comboboxState!==0?void 0:(y.preventDefault(),r.optionsRef.current&&!r.optionsPropsRef.current.static&&y.stopPropagation(),i.closeCombobox(),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})}));default:return}}),f=yt(y=>{if(KH(y.currentTarget))return y.preventDefault();r.comboboxState===0?i.closeCombobox():(y.preventDefault(),i.openCombobox()),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})})}),g=h0(()=>{if(r.labelId)return[r.labelId,a].join(" ")},[r.labelId,a]),p=m.useMemo(()=>({open:r.comboboxState===0,disabled:r.disabled,value:r.value}),[r]),v={ref:o,id:a,type:zH(e,r.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsRef.current)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":g,disabled:r.disabled,onClick:f,onKeyDown:d};return wo({ourProps:v,theirProps:l,slot:p,defaultTag:cW,name:"Combobox.Button"})}let dW="label";function fW(e,t){let n=Au(),{id:r=`headlessui-combobox-label-${n}`,...i}=e,o=pa("Combobox.Label"),s=Iu("Combobox.Label"),a=fa(o.labelRef,t);_n(()=>s.registerLabel(r),[r]);let l=yt(()=>{var d;return(d=o.inputRef.current)==null?void 0:d.focus({preventScroll:!0})}),c=m.useMemo(()=>({open:o.comboboxState===0,disabled:o.disabled}),[o]);return wo({ourProps:{ref:a,id:r,onClick:l},theirProps:i,slot:c,defaultTag:dW,name:"Combobox.Label"})}let hW="ul",pW=Yh.RenderStrategy|Yh.Static;function gW(e,t){let n=Au(),{id:r=`headlessui-combobox-options-${n}`,hold:i=!1,...o}=e,s=pa("Combobox.Options"),a=fa(s.optionsRef,t),l=y0(),c=l!==null?(l&Ar.Open)===Ar.Open:s.comboboxState===0;_n(()=>{var p;s.optionsPropsRef.current.static=(p=e.static)!=null?p:!1},[s.optionsPropsRef,e.static]),_n(()=>{s.optionsPropsRef.current.hold=i},[s.optionsPropsRef,i]),HH({container:s.optionsRef.current,enabled:s.comboboxState===0,accept(p){return p.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:p.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(p){p.setAttribute("role","none")}});let d=h0(()=>{var p,v;return(v=s.labelId)!=null?v:(p=s.buttonRef.current)==null?void 0:p.id},[s.labelId,s.buttonRef.current]),f=m.useMemo(()=>({open:s.comboboxState===0,option:void 0}),[s]),g={"aria-labelledby":d,role:"listbox","aria-multiselectable":s.mode===1?!0:void 0,id:r,ref:a};return s.virtual&&s.comboboxState===0&&Object.assign(o,{children:m.createElement(rW,null,o.children)}),wo({ourProps:g,theirProps:o,slot:f,defaultTag:hW,features:pW,visible:c,name:"Combobox.Options"})}let mW="li";function vW(e,t){var n;let r=Au(),{id:i=`headlessui-combobox-option-${r}`,disabled:o=!1,value:s,order:a=null,...l}=e,c=pa("Combobox.Option"),d=Iu("Combobox.Option"),f=c.virtual?c.activeOptionIndex===c.calculateIndex(s):c.activeOptionIndex===null?!1:((n=c.options[c.activeOptionIndex])==null?void 0:n.id)===i,g=c.isSelected(s),p=m.useRef(null),v=zi({disabled:o,value:s,domRef:p,order:a}),y=m.useContext(FO),x=fa(t,p,y?y.measureElement:null),w=yt(()=>d.onChange(s));_n(()=>d.registerOption(i,v),[v,i]);let S=m.useRef(!(c.virtual||c.__demoMode));_n(()=>{if(!c.virtual||!c.__demoMode)return;let j=da();return j.requestAnimationFrame(()=>{S.current=!0}),j.dispose},[c.virtual,c.__demoMode]),_n(()=>{if(!S.current||c.comboboxState!==0||!f||c.activationTrigger===0)return;let j=da();return j.requestAnimationFrame(()=>{var B,H;(H=(B=p.current)==null?void 0:B.scrollIntoView)==null||H.call(B,{block:"nearest"})}),j.dispose},[p,f,c.comboboxState,c.activationTrigger,c.activeOptionIndex]);let C=yt(j=>{var B;if(o||(B=c.virtual)!=null&&B.disabled(s))return j.preventDefault();w(),PO()||requestAnimationFrame(()=>{var H;return(H=c.inputRef.current)==null?void 0:H.focus({preventScroll:!0})}),c.mode===0&&requestAnimationFrame(()=>d.closeCombobox())}),P=yt(()=>{var j;if(o||(j=c.virtual)!=null&&j.disabled(s))return d.goToOption(Sn.Nothing);let B=c.calculateIndex(s);d.goToOption(Sn.Specific,B)}),O=VH(),k=yt(j=>O.update(j)),A=yt(j=>{var B;if(!O.wasMoved(j)||o||(B=c.virtual)!=null&&B.disabled(s)||f)return;let H=c.calculateIndex(s);d.goToOption(Sn.Specific,H,0)}),L=yt(j=>{var B;O.wasMoved(j)&&(o||(B=c.virtual)!=null&&B.disabled(s)||f&&(c.optionsPropsRef.current.hold||d.goToOption(Sn.Nothing)))}),F=m.useMemo(()=>({active:f,selected:g,disabled:o}),[f,g,o]);return wo({ourProps:{id:i,ref:x,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":g,disabled:void 0,onClick:C,onFocus:P,onPointerEnter:k,onMouseEnter:k,onPointerMove:A,onMouseMove:A,onPointerLeave:L,onMouseLeave:L},theirProps:l,slot:F,defaultTag:mW,name:"Combobox.Option"})}let bW=Bi(sW),yW=Bi(uW),xW=Bi(lW),wW=Bi(fW),_W=Bi(gW),SW=Bi(vW),Dl=Object.assign(bW,{Input:xW,Button:yW,Label:wW,Options:_W,Option:SW});function S0(){let e=m.useRef(!1);return _n(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function CW(e=0){let[t,n]=m.useState(e),r=S0(),i=m.useCallback(l=>{r.current&&n(c=>c|l)},[t,r]),o=m.useCallback(l=>!!(t&l),[t]),s=m.useCallback(l=>{r.current&&n(c=>c&~l)},[n,r]),a=m.useCallback(l=>{r.current&&n(c=>c^l)},[n]);return{flags:t,addFlag:i,hasFlag:o,removeFlag:s,toggleFlag:a}}function EW(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function C0(e,...t){e&&t.length>0&&e.classList.add(...t)}function E0(e,...t){e&&t.length>0&&e.classList.remove(...t)}function OW(e,t){let n=da();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:i}=getComputedStyle(e),[o,s]=[r,i].map(l=>{let[c=0]=l.split(",").filter(Boolean).map(d=>d.includes("ms")?parseFloat(d):parseFloat(d)*1e3).sort((d,f)=>f-d);return c}),a=o+s;if(a!==0){n.group(c=>{c.setTimeout(()=>{t(),c.dispose()},a),c.addEventListener(e,"transitionrun",d=>{d.target===d.currentTarget&&c.dispose()})});let l=n.addEventListener(e,"transitionend",c=>{c.target===c.currentTarget&&(t(),l())})}else t();return n.add(()=>t()),n.dispose}function PW(e,t,n,r){let i=n?"enter":"leave",o=da(),s=r!==void 0?EW(r):()=>{};i==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let a=$n(i,{enter:()=>t.enter,leave:()=>t.leave}),l=$n(i,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),c=$n(i,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return E0(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),C0(e,...t.base,...a,...c),o.nextFrame(()=>{E0(e,...t.base,...a,...c),C0(e,...t.base,...a,...l),OW(e,()=>(E0(e,...t.base,...a),C0(e,...t.base,...t.entered),s()))}),o.dispose}function kW({immediate:e,container:t,direction:n,classes:r,onStart:i,onStop:o}){let s=S0(),a=Tu(),l=zi(n);_n(()=>{e&&(l.current="enter")},[e]),_n(()=>{let c=da();a.add(c.dispose);let d=t.current;if(d&&l.current!=="idle"&&s.current)return c.dispose(),i.current(l.current),c.add(PW(d,r.current,l.current==="enter",()=>{c.dispose(),o.current(l.current)})),c.dispose},[n])}function ns(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let Xh=m.createContext(null);Xh.displayName="TransitionContext";var MW=(e=>(e.Visible="visible",e.Hidden="hidden",e))(MW||{});function DW(){let e=m.useContext(Xh);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function TW(){let e=m.useContext(Qh);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Qh=m.createContext(null);Qh.displayName="NestingContext";function Jh(e){return"children"in e?Jh(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function jO(e,t){let n=zi(e),r=m.useRef([]),i=S0(),o=Tu(),s=yt((p,v=ts.Hidden)=>{let y=r.current.findIndex(({el:x})=>x===p);y!==-1&&($n(v,{[ts.Unmount](){r.current.splice(y,1)},[ts.Hidden](){r.current[y].state="hidden"}}),o.microTask(()=>{var x;!Jh(r)&&i.current&&((x=n.current)==null||x.call(n))}))}),a=yt(p=>{let v=r.current.find(({el:y})=>y===p);return v?v.state!=="visible"&&(v.state="visible"):r.current.push({el:p,state:"visible"}),()=>s(p,ts.Unmount)}),l=m.useRef([]),c=m.useRef(Promise.resolve()),d=m.useRef({enter:[],leave:[],idle:[]}),f=yt((p,v,y)=>{l.current.splice(0),t&&(t.chains.current[v]=t.chains.current[v].filter(([x])=>x!==p)),t==null||t.chains.current[v].push([p,new Promise(x=>{l.current.push(x)})]),t==null||t.chains.current[v].push([p,new Promise(x=>{Promise.all(d.current[v].map(([w,S])=>S)).then(()=>x())})]),v==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>y(v)):y(v)}),g=yt((p,v,y)=>{Promise.all(d.current[v].splice(0).map(([x,w])=>w)).then(()=>{var x;(x=l.current.shift())==null||x()}).then(()=>y(v))});return m.useMemo(()=>({children:r,register:a,unregister:s,onStart:f,onStop:g,wait:c,chains:d}),[a,s,r,f,g,d,c])}function AW(){}let IW=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function zO(e){var t;let n={};for(let r of IW)n[r]=(t=e[r])!=null?t:AW;return n}function NW(e){let t=m.useRef(zO(e));return m.useEffect(()=>{t.current=zO(e)},[e]),t}let RW="div",BO=Yh.RenderStrategy;function LW(e,t){var n,r;let{beforeEnter:i,afterEnter:o,beforeLeave:s,afterLeave:a,enter:l,enterFrom:c,enterTo:d,entered:f,leave:g,leaveFrom:p,leaveTo:v,...y}=e,x=m.useRef(null),w=fa(x,t),S=(n=y.unmount)==null||n?ts.Unmount:ts.Hidden,{show:C,appear:P,initial:O}=DW(),[k,A]=m.useState(C?"visible":"hidden"),L=TW(),{register:F,unregister:j}=L;m.useEffect(()=>F(x),[F,x]),m.useEffect(()=>{if(S===ts.Hidden&&x.current){if(C&&k!=="visible"){A("visible");return}return $n(k,{hidden:()=>j(x),visible:()=>F(x)})}},[k,x,F,j,C,S]);let B=zi({base:ns(y.className),enter:ns(l),enterFrom:ns(c),enterTo:ns(d),entered:ns(f),leave:ns(g),leaveFrom:ns(p),leaveTo:ns(v)}),H=NW({beforeEnter:i,afterEnter:o,beforeLeave:s,afterLeave:a}),K=p0();m.useEffect(()=>{if(K&&k==="visible"&&x.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[x,k,K]);let Y=O&&!P,$=P&&C&&O,Z=!K||Y?"idle":C?"enter":"leave",U=CW(0),ie=yt(X=>$n(X,{enter:()=>{U.addFlag(Ar.Opening),H.current.beforeEnter()},leave:()=>{U.addFlag(Ar.Closing),H.current.beforeLeave()},idle:()=>{}})),le=yt(X=>$n(X,{enter:()=>{U.removeFlag(Ar.Opening),H.current.afterEnter()},leave:()=>{U.removeFlag(Ar.Closing),H.current.afterLeave()},idle:()=>{}})),M=jO(()=>{A("hidden"),j(x)},L),W=m.useRef(!1);kW({immediate:$,container:x,classes:B,direction:Z,onStart:zi(X=>{W.current=!0,M.onStart(x,X,ie)}),onStop:zi(X=>{W.current=!1,M.onStop(x,X,le),X==="leave"&&!Jh(M)&&(A("hidden"),j(x))})});let ne=y,N={ref:w};return $?ne={...ne,className:Gh(y.className,...B.current.enter,...B.current.enterFrom)}:W.current&&(ne.className=Gh(y.className,(r=x.current)==null?void 0:r.className),ne.className===""&&delete ne.className),m.createElement(Qh.Provider,{value:M},m.createElement(IO,{value:$n(k,{visible:Ar.Open,hidden:Ar.Closed})|U.flags},wo({ourProps:N,theirProps:ne,defaultTag:RW,features:BO,visible:k==="visible",name:"Transition.Child"})))}function $W(e,t){let{show:n,appear:r=!1,unmount:i=!0,...o}=e,s=m.useRef(null),a=fa(s,t);p0();let l=y0();if(n===void 0&&l!==null&&(n=(l&Ar.Open)===Ar.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[c,d]=m.useState(n?"visible":"hidden"),f=jO(()=>{d("hidden")}),[g,p]=m.useState(!0),v=m.useRef([n]);_n(()=>{g!==!1&&v.current[v.current.length-1]!==n&&(v.current.push(n),p(!1))},[v,n]);let y=m.useMemo(()=>({show:n,appear:r,initial:g}),[n,r,g]);m.useEffect(()=>{if(n)d("visible");else if(!Jh(f))d("hidden");else{let C=s.current;if(!C)return;let P=C.getBoundingClientRect();P.x===0&&P.y===0&&P.width===0&&P.height===0&&d("hidden")}},[n,f]);let x={unmount:i},w=yt(()=>{var C;g&&p(!1),(C=e.beforeEnter)==null||C.call(e)}),S=yt(()=>{var C;g&&p(!1),(C=e.beforeLeave)==null||C.call(e)});return m.createElement(Qh.Provider,{value:f},m.createElement(Xh.Provider,{value:y},wo({ourProps:{...x,as:m.Fragment,children:m.createElement(VO,{ref:a,...x,...o,beforeEnter:w,beforeLeave:S})},theirProps:{},defaultTag:m.Fragment,features:BO,visible:c==="visible",name:"Transition"})))}function FW(e,t){let n=m.useContext(Xh)!==null,r=y0()!==null;return m.createElement(m.Fragment,null,!n&&r?m.createElement(O0,{ref:t,...e}):m.createElement(VO,{ref:t,...e}))}let O0=Bi($W),VO=Bi(LW),jW=Bi(FW),zW=Object.assign(O0,{Child:jW,Root:O0});const P0=["text","varchar","nvarchar","nvarchar2","char","character","nchar","char varying","nchar varying","character varying","string"],Tl=["number","integer","int","bigint","smallint","tinyint","byteint","numeric","decimal","dec","double","real","double precision","float","float4","float8"],Nu=["date","datetime","time","timestamp","timestamp without time zone"],HO=["boolean"];function WO(e,t,n){const{measures:r,dimensions:i}=e,o=r==null?void 0:r.map(c=>`${c.calc}(${c.name}) as ${c.calc}_${c.name}`).join(", "),s=(i==null?void 0:i.join(", "))||"";let a="";const l=M0(t,n);if(o&&s)return a=`SELECT ${s}, COUNT(*), ${o} FROM ${l} GROUP BY ${s} ORDER BY ${s} DESC LIMIT 100`,a;if(!o&&s)return a=`SELECT ${s}, COUNT(*) FROM ${l} GROUP BY ${s} ORDER BY ${s} DESC LIMIT 100`,a;if(o&&!s)return a=`SELECT ${o} FROM ${l}`,a}function qO(e,t,n="AVG"){var i,o,s,a;let r={};return P0.includes(e.data_type)&&(((i=t.dimensions)==null?void 0:i.includes(e.column_name))?r={...t,dimensions:(o=t.dimensions)==null?void 0:o.filter(c=>c!==e.column_name)}:r={...t,dimensions:[...t.dimensions||[],e.column_name]}),Tl.includes(e.data_type)&&(((s=t.measures)==null?void 0:s.some(c=>c.name===e.column_name&&c.calc===n))?r={...t,measures:(a=t.measures)==null?void 0:a.filter(c=>!(c.name===e.column_name&&c.calc===n))}:r={...t,measures:[...t.measures||[],{name:e.column_name,calc:n||"SUM"}]}),r}function k0(e){return P0.includes(e.dataType)?"string":Tl.includes(e.dataType)?"number":Nu.includes(e.dataType)?"date":HO.includes(e.dataType)?"boolean":"string"}function BW(e,t){const{dimensions:n,measures:r}=t,i=n==null?void 0:n.includes(e.column_name),o=r==null?void 0:r.some(s=>s.name===e.column_name);return i||o}function M0(e,t){return e==="public"?t:e?`${e}.${t}`:`${t}`}function VW(e){const t=/(>=|<=|>|<|=)/,n=e.match(t);if(n){const r=n[0],[i,o]=e.split(r);return{operation:r,value:o.trim()}}else return null}const UO=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,GO=Gd,YO=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return GO(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=t,s=Object.keys(i).map(c=>{const d=n==null?void 0:n[c],f=o==null?void 0:o[c];if(d===null)return null;const g=UO(d)||UO(f);return i[c][g]}),a=n&&Object.entries(n).reduce((c,d)=>{let[f,g]=d;return g===void 0||(c[f]=g),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,d)=>{let{class:f,className:g,...p}=d;return Object.entries(p).every(v=>{let[y,x]=v;return Array.isArray(x)?x.includes({...o,...a}[y]):{...o,...a}[y]===x})?[...c,f,g]:c},[]);return GO(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},D0=YO("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),it=de.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},o)=>{const s=r?ro:"button";return _.jsx(s,{className:Pe(D0({variant:t,size:n,className:e})),ref:o,...i})});it.displayName="Button";function HW({filter:e}){const[t,n]=m.useState([]),[r,i]=m.useState(""),[o,s]=m.useState(""),a=m.useRef(null),l=ge(k=>k.authToken),c=ge(k=>k.filterValues),d=ge(k=>k.actions.addOrUpdateFilterValue),f=ge(k=>k.actions.removeFilterValue),{data:g,isLoading:p,isFetching:v,isError:y,refetch:x}=Cr({queryKey:[e.sql],queryFn:()=>Ns("http://localhost:3000/api/v1/query",(l==null?void 0:l.accessToken)||"",{connection_id:e.connectionId,sql:e.sql}),enabled:!!e.sql&&!!e.connectionId&&!!e.database}),w=m.useMemo(()=>{var k;return(k=g==null?void 0:g.records)==null?void 0:k.map(A=>({id:A[e.column.toLowerCase()],value:A[e.column.toLowerCase()]}))},[g,e.column]);m.useEffect(()=>{if(c){const k=c.find(A=>A.filterId===e.id);if(!k){n([]);return}if(k.operation==="in"){const A=w==null?void 0:w.filter(L=>k.values.includes(L.value));A&&n(A)}else i(`${k.operation} ${k.values[0]}`)}},[g]),m.useEffect(()=>{if(c&&!c.find(A=>A.filterId===e.id)){n([]);return}},[c,e.id]);function S(k){console.log("custom input");const A=VW(k[0].toString());if(!(A!=null&&A.value)||!(A!=null&&A.operation))return;const L={filterId:e.id,connectionType:e.database==="NA"?"api":"database",valueType:k0(e),name:e.column,operation:A.operation,values:[A.value]};d(L)}function C(k){if(console.log("onComboBoxChange",k),k.length===1&&w.find(L=>L.value===k[0].value)===void 0){S(k);return}if(n(k),k.length===0){f(e.id);return}const A={filterId:e.id,connectionType:e.database==="NA"?"api":"database",name:e.column,valueType:k0(e),operation:"in",values:k.map(L=>L.value)};d(A)}function P(){var k;i(""),f(e.id),console.log(e.id),(k=a.current)==null||k.click()}if(p)return _.jsx("div",{children:_.jsx(cf,{className:" bg-foreground/10 h-8 w-[180px]"})});if(y)return _.jsx("div",{className:"bg-muted h-8 w-[180px] px-2",children:"Error"});if(!g)return null;let O=[];return Tl.includes(e.dataType)?O=w:O=o===""?w:w.filter(k=>k.value.toLowerCase().replace(/\s+/g,"").includes(o.toLowerCase().replace(/\s+/g,""))),_.jsx(Dl,{value:t,onChange:C,multiple:!0,children:_.jsxs("div",{className:"relative",children:[_.jsxs("div",{className:" border relative w-full cursor-default overflow-hidden rounded-sm bg-background text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-background/75 focus-visible:ring-offset-2 sm:text-sm",children:[_.jsx(Dl.Input,{className:"flex h-8 w-full rounded border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50",displayValue:k=>k.map(L=>L.value).join(", ")||r,onChange:k=>{i(k.target.value),s(k.target.value)}}),_.jsx(Dl.Button,{ref:a,className:"absolute bg-background pl-1 inset-y-0 right-0 flex items-center pr-2",children:_.jsx(zj,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),_.jsx(zW,{as:m.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",afterLeave:()=>s(""),children:_.jsxs(Dl.Options,{className:" z-10 absolute mt-1 max-h-60 w-full overflow-auto rounded-sm bg-background py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm border",children:[Tl.includes(e.dataType)&&_.jsxs(Dl.Option,{value:r,className:" flex items-center px-3 justify-between gap-2 py-2",children:[_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("span",{className:" font-thin",children:"#"}),_.jsx("span",{children:r})]}),r&&_.jsx(it,{variant:"link",className:" h-4 w-3 text-foreground/50 hover:text-foreground/100 cursor-pointer",onClick:k=>{k.stopPropagation(),P()},children:"Clear"})]}),O.length===0&&o!==""?_.jsx("div",{className:"relative cursor-default select-none px-4 py-2 text-gray-700",children:"Nothing found."}):O.map(k=>_.jsx(Dl.Option,{className:({active:A})=>`relative cursor-default select-none py-2 pl-10 pr-4 ${A?"bg-muted ":"text-foreground-900"}`,value:k,children:({selected:A,active:L})=>(A&&console.log("record",k,A),_.jsxs(_.Fragment,{children:[_.jsx("span",{className:`block truncate ${A?"font-medium":"font-normal"}`,children:typeof k.value=="boolean"?k.value?"True":"False":k.value}),A?_.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 text-foreground",children:_.jsx(JE,{className:"h-5 w-5","aria-hidden":"true"})}):null]}))},k.id))]})})]})})}const KO=m.forwardRef((e,t)=>m.createElement(Ve.label,ae({},e,{ref:t,onMouseDown:n=>{var r;(r=e.onMouseDown)===null||r===void 0||r.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault()}}))),WW=YO("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),rs=de.forwardRef(({className:e,...t},n)=>_.jsx(KO,{ref:n,className:Pe(WW(),e),...t}));rs.displayName=KO.displayName;function Pt(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function Nr(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function er(e,t){const n=Pt(e);return isNaN(t)?Nr(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function xi(e,t){const n=Pt(e);if(isNaN(t))return Nr(e,NaN);if(!t)return n;const r=n.getDate(),i=Nr(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);const o=i.getDate();return r>=o?i:(n.setFullYear(i.getFullYear(),i.getMonth(),r),n)}const T0=6048e5,qW=864e5;let UW={};function Ru(){return UW}function Vi(e,t){var a,l,c,d;const n=Ru(),r=(t==null?void 0:t.weekStartsOn)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??n.weekStartsOn??((d=(c=n.locale)==null?void 0:c.options)==null?void 0:d.weekStartsOn)??0,i=Pt(e),o=i.getDay(),s=(o<r?7:0)+o-r;return i.setDate(i.getDate()-s),i.setHours(0,0,0,0),i}function ga(e){return Vi(e,{weekStartsOn:1})}function XO(e){const t=Pt(e),n=t.getFullYear(),r=Nr(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const i=ga(r),o=Nr(e,0);o.setFullYear(n,0,4),o.setHours(0,0,0,0);const s=ga(o);return t.getTime()>=i.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function Al(e){const t=Pt(e);return t.setHours(0,0,0,0),t}function Zh(e){const t=Pt(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Hi(e,t){const n=Al(e),r=Al(t),i=+n-Zh(n),o=+r-Zh(r);return Math.round((i-o)/qW)}function GW(e){const t=XO(e),n=Nr(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),ga(n)}function A0(e,t){const n=t*7;return er(e,n)}function YW(e,t){return xi(e,t*12)}function KW(e){let t;return e.forEach(function(n){const r=Pt(n);(t===void 0||t<r||isNaN(Number(r)))&&(t=r)}),t||new Date(NaN)}function XW(e){let t;return e.forEach(n=>{const r=Pt(n);(!t||t>r||isNaN(+r))&&(t=r)}),t||new Date(NaN)}function fr(e,t){const n=Al(e),r=Al(t);return+n==+r}function I0(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function QW(e){if(!I0(e)&&typeof e!="number")return!1;const t=Pt(e);return!isNaN(Number(t))}function Lu(e,t){const n=Pt(e),r=Pt(t),i=n.getFullYear()-r.getFullYear(),o=n.getMonth()-r.getMonth();return i*12+o}function JW(e,t,n){const r=Vi(e,n),i=Vi(t,n),o=+r-Zh(r),s=+i-Zh(i);return Math.round((o-s)/T0)}function N0(e){const t=Pt(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function hr(e){const t=Pt(e);return t.setDate(1),t.setHours(0,0,0,0),t}function QO(e){const t=Pt(e),n=Nr(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function R0(e,t){var a,l,c,d;const n=Ru(),r=(t==null?void 0:t.weekStartsOn)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??n.weekStartsOn??((d=(c=n.locale)==null?void 0:c.options)==null?void 0:d.weekStartsOn)??0,i=Pt(e),o=i.getDay(),s=(o<r?-7:0)+6-(o-r);return i.setDate(i.getDate()+s),i.setHours(23,59,59,999),i}function JO(e){return R0(e,{weekStartsOn:1})}const ZW={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},e6=(e,t,n)=>{let r;const i=ZW[e];return typeof i=="string"?r=i:t===1?r=i.one:r=i.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function L0(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const t6={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},n6={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},r6={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},i6={date:L0({formats:t6,defaultWidth:"full"}),time:L0({formats:n6,defaultWidth:"full"}),dateTime:L0({formats:r6,defaultWidth:"full"})},o6={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},s6=(e,t,n,r)=>o6[e];function $u(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let i;if(r==="formatting"&&e.formattingValues){const s=e.defaultFormattingWidth||e.defaultWidth,a=n!=null&&n.width?String(n.width):s;i=e.formattingValues[a]||e.formattingValues[s]}else{const s=e.defaultWidth,a=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[a]||e.values[s]}const o=e.argumentCallback?e.argumentCallback(t):t;return i[o]}}const a6={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},l6={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},c6={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},u6={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},d6={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},f6={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},h6={ordinalNumber:(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:$u({values:a6,defaultWidth:"wide"}),quarter:$u({values:l6,defaultWidth:"wide",argumentCallback:e=>e-1}),month:$u({values:c6,defaultWidth:"wide"}),day:$u({values:u6,defaultWidth:"wide"}),dayPeriod:$u({values:d6,defaultWidth:"wide",formattingValues:f6,defaultFormattingWidth:"wide"})};function Fu(e){return(t,n={})=>{const r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=t.match(i);if(!o)return null;const s=o[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?g6(a,f=>f.test(s)):p6(a,f=>f.test(s));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const d=t.slice(s.length);return{value:c,rest:d}}}function p6(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function g6(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function m6(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const i=r[0],o=t.match(e.parsePattern);if(!o)return null;let s=e.valueCallback?e.valueCallback(o[0]):o[0];s=n.valueCallback?n.valueCallback(s):s;const a=t.slice(i.length);return{value:s,rest:a}}}const v6=/^(\d+)(th|st|nd|rd)?/i,b6=/\d+/i,y6={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},x6={any:[/^b/i,/^(a|c)/i]},w6={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},_6={any:[/1/i,/2/i,/3/i,/4/i]},S6={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},C6={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},E6={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},O6={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},P6={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},k6={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},M6={ordinalNumber:m6({matchPattern:v6,parsePattern:b6,valueCallback:e=>parseInt(e,10)}),era:Fu({matchPatterns:y6,defaultMatchWidth:"wide",parsePatterns:x6,defaultParseWidth:"any"}),quarter:Fu({matchPatterns:w6,defaultMatchWidth:"wide",parsePatterns:_6,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Fu({matchPatterns:S6,defaultMatchWidth:"wide",parsePatterns:C6,defaultParseWidth:"any"}),day:Fu({matchPatterns:E6,defaultMatchWidth:"wide",parsePatterns:O6,defaultParseWidth:"any"}),dayPeriod:Fu({matchPatterns:P6,defaultMatchWidth:"any",parsePatterns:k6,defaultParseWidth:"any"})},ZO={code:"en-US",formatDistance:e6,formatLong:i6,formatRelative:s6,localize:h6,match:M6,options:{weekStartsOn:0,firstWeekContainsDate:1}};function D6(e){const t=Pt(e);return Hi(t,QO(t))+1}function eP(e){const t=Pt(e),n=+ga(t)-+GW(t);return Math.round(n/T0)+1}function tP(e,t){var d,f,g,p;const n=Pt(e),r=n.getFullYear(),i=Ru(),o=(t==null?void 0:t.firstWeekContainsDate)??((f=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??i.firstWeekContainsDate??((p=(g=i.locale)==null?void 0:g.options)==null?void 0:p.firstWeekContainsDate)??1,s=Nr(e,0);s.setFullYear(r+1,0,o),s.setHours(0,0,0,0);const a=Vi(s,t),l=Nr(e,0);l.setFullYear(r,0,o),l.setHours(0,0,0,0);const c=Vi(l,t);return n.getTime()>=a.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function T6(e,t){var a,l,c,d;const n=Ru(),r=(t==null?void 0:t.firstWeekContainsDate)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.firstWeekContainsDate)??n.firstWeekContainsDate??((d=(c=n.locale)==null?void 0:c.options)==null?void 0:d.firstWeekContainsDate)??1,i=tP(e,t),o=Nr(e,0);return o.setFullYear(i,0,r),o.setHours(0,0,0,0),Vi(o,t)}function nP(e,t){const n=Pt(e),r=+Vi(n,t)-+T6(n,t);return Math.round(r/T0)+1}function Ft(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const is={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return Ft(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Ft(n+1,2)},d(e,t){return Ft(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return Ft(e.getHours()%12||12,t.length)},H(e,t){return Ft(e.getHours(),t.length)},m(e,t){return Ft(e.getMinutes(),t.length)},s(e,t){return Ft(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return Ft(i,t.length)}},Il={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},rP={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return is.y(e,t)},Y:function(e,t,n,r){const i=tP(e,r),o=i>0?i:1-i;if(t==="YY"){const s=o%100;return Ft(s,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):Ft(o,t.length)},R:function(e,t){const n=XO(e);return Ft(n,t.length)},u:function(e,t){const n=e.getFullYear();return Ft(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Ft(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Ft(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return is.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return Ft(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const i=nP(e,r);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):Ft(i,t.length)},I:function(e,t,n){const r=eP(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):Ft(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):is.d(e,t)},D:function(e,t,n){const r=D6(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Ft(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const i=e.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return Ft(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const i=e.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return Ft(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),i=r===0?7:r;switch(t){case"i":return String(i);case"ii":return Ft(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let i;switch(r===12?i=Il.noon:r===0?i=Il.midnight:i=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let i;switch(r>=17?i=Il.evening:r>=12?i=Il.afternoon:r>=4?i=Il.morning:i=Il.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return is.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):is.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Ft(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):Ft(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):is.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):is.s(e,t)},S:function(e,t){return is.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return oP(r);case"XXXX":case"XX":return ma(r);case"XXXXX":case"XXX":default:return ma(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return oP(r);case"xxxx":case"xx":return ma(r);case"xxxxx":case"xxx":default:return ma(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+iP(r,":");case"OOOO":default:return"GMT"+ma(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+iP(r,":");case"zzzz":default:return"GMT"+ma(r,":")}},t:function(e,t,n){const r=Math.trunc(e.getTime()/1e3);return Ft(r,t.length)},T:function(e,t,n){const r=e.getTime();return Ft(r,t.length)}};function iP(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Math.trunc(r/60),o=r%60;return o===0?n+String(i):n+String(i)+t+Ft(o,2)}function oP(e,t){return e%60===0?(e>0?"-":"+")+Ft(Math.abs(e)/60,2):ma(e,t)}function ma(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Ft(Math.trunc(r/60),2),o=Ft(r%60,2);return n+i+t+o}const sP=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},aP=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},A6={p:aP,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return sP(e,t);let o;switch(r){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",sP(r,t)).replace("{{time}}",aP(i,t))}},I6=/^D+$/,N6=/^Y+$/,R6=["D","DD","YY","YYYY"];function L6(e){return I6.test(e)}function $6(e){return N6.test(e)}function F6(e,t,n){const r=j6(e,t,n);if(console.warn(r),R6.includes(e))throw new RangeError(r)}function j6(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const z6=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,B6=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,V6=/^'([^]*?)'?$/,H6=/''/g,W6=/[a-zA-Z]/;function Wi(e,t,n){var d,f,g,p,v,y,x,w;const r=Ru(),i=(n==null?void 0:n.locale)??r.locale??ZO,o=(n==null?void 0:n.firstWeekContainsDate)??((f=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??r.firstWeekContainsDate??((p=(g=r.locale)==null?void 0:g.options)==null?void 0:p.firstWeekContainsDate)??1,s=(n==null?void 0:n.weekStartsOn)??((y=(v=n==null?void 0:n.locale)==null?void 0:v.options)==null?void 0:y.weekStartsOn)??r.weekStartsOn??((w=(x=r.locale)==null?void 0:x.options)==null?void 0:w.weekStartsOn)??0,a=Pt(e);if(!QW(a))throw new RangeError("Invalid time value");let l=t.match(B6).map(S=>{const C=S[0];if(C==="p"||C==="P"){const P=A6[C];return P(S,i.formatLong)}return S}).join("").match(z6).map(S=>{if(S==="''")return{isToken:!1,value:"'"};const C=S[0];if(C==="'")return{isToken:!1,value:q6(S)};if(rP[C])return{isToken:!0,value:S};if(C.match(W6))throw new RangeError("Format string contains an unescaped latin alphabet character `"+C+"`");return{isToken:!1,value:S}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const c={firstWeekContainsDate:o,weekStartsOn:s,locale:i};return l.map(S=>{if(!S.isToken)return S.value;const C=S.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&$6(C)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&L6(C))&&F6(C,t,String(e));const P=rP[C[0]];return P(a,C,i.localize,c)}).join("")}function q6(e){const t=e.match(V6);return t?t[1].replace(H6,"'"):e}function U6(e){const t=Pt(e),n=t.getFullYear(),r=t.getMonth(),i=Nr(e,0);return i.setFullYear(n,r+1,0),i.setHours(0,0,0,0),i.getDate()}function G6(e){return Math.trunc(+Pt(e)/1e3)}function Y6(e){const t=Pt(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}function K6(e,t){return JW(Y6(e),hr(e),t)+1}function $0(e,t){const n=Pt(e),r=Pt(t);return n.getTime()>r.getTime()}function lP(e,t){const n=Pt(e),r=Pt(t);return+n<+r}function F0(e,t){const n=Pt(e),r=Pt(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function X6(e,t){const n=Pt(e),r=Pt(t);return n.getFullYear()===r.getFullYear()}function j0(e,t){return er(e,-t)}function z0(e,t){const n=Pt(e),r=n.getFullYear(),i=n.getDate(),o=Nr(e,0);o.setFullYear(r,t,15),o.setHours(0,0,0,0);const s=U6(o);return n.setMonth(t,Math.min(i,s)),n}function cP(e,t){const n=Pt(e);return isNaN(+n)?Nr(e,NaN):(n.setFullYear(t),n)}var Ge=function(){return Ge=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Ge.apply(this,arguments)};function Q6(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function uP(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var B0={exports:{}},ju={};/**
361
+ `));let g=d.props,p=typeof(g==null?void 0:g.className)=="function"?(...y)=>Gh(g==null?void 0:g.className(...y),l.className):Gh(g==null?void 0:g.className,l.className),v=p?{className:p}:{};return m.cloneElement(d,Object.assign({},TO(d.props,m0(v0(l,["ref"]))),f,c,{ref:i(d.ref,c.ref)},v))}return m.createElement(o,Object.assign({},v0(l,["ref"]),o!==m.Fragment&&c,o!==m.Fragment&&f),d)}function WH(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function TO(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let i in r)i.startsWith("on")&&typeof r[i]=="function"?(n[i]!=null||(n[i]=[]),n[i].push(r[i])):t[i]=r[i];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](i,...o){let s=n[r];for(let a of s){if((i instanceof Event||(i==null?void 0:i.nativeEvent)instanceof Event)&&i.defaultPrevented)return;a(i,...o)}}});return t}function Bi(e){var t;return Object.assign(m.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function m0(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function v0(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}let qH="div";var AO=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(AO||{});function UH(e,t){var n;let{features:r=1,...i}=e,o={ref:t,"aria-hidden":(r&2)===2?!0:(n=i["aria-hidden"])!=null?n:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return wo({ourProps:o,theirProps:i,slot:{},defaultTag:qH,name:"Hidden"})}let GH=Bi(UH),b0=m.createContext(null);b0.displayName="OpenClosedContext";var Ar=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Ar||{});function y0(){return m.useContext(b0)}function IO({value:e,children:t}){return m.createElement(b0.Provider,{value:e},t)}function YH(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let ha=[];YH(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&ha[0]!==t.target&&(ha.unshift(t.target),ha=ha.filter(n=>n!=null&&n.isConnected),ha.splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function KH(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&XH(n)?!1:r}function XH(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function QH(e){throw new Error("Unexpected object: "+e)}var Sn=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Sn||{});function NO(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),i=r??-1;switch(e.focus){case 0:{for(let o=0;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 1:{for(let o=i-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 2:{for(let o=i+1;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 3:{for(let o=n.length-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 4:{for(let o=0;o<n.length;++o)if(t.resolveId(n[o],o,n)===e.id)return o;return r}case 5:return null;default:QH(e)}}function RO(e={},t=null,n=[]){for(let[r,i]of Object.entries(e))$O(n,LO(t,r),i);return n}function LO(e,t){return e?e+"["+t+"]":t}function $O(e,t,n){if(Array.isArray(n))for(let[r,i]of n.entries())$O(e,LO(t,r.toString()),i);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):RO(n,t,e)}var Ir=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(Ir||{}),JH=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(JH||{}),ZH=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(ZH||{}),eW=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(eW||{}),tW=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.RegisterOption=3]="RegisterOption",e[e.UnregisterOption=4]="UnregisterOption",e[e.RegisterLabel=5]="RegisterLabel",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualOptions=7]="UpdateVirtualOptions",e))(tW||{});function x0(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),i=r.length>0&&r[0].dataRef.current.order!==null?r.sort((s,a)=>s.dataRef.current.order-a.dataRef.current.order):NH(r,s=>s.dataRef.current.domRef.current),o=n?i.indexOf(n):null;return o===-1&&(o=null),{options:i,activeOptionIndex:o}}let nW={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let r=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(r!==-1)return{...e,activeOptionIndex:r,comboboxState:0}}return{...e,comboboxState:0}},2(e,t){var n,r,i,o,s;if((n=e.dataRef.current)!=null&&n.disabled||(r=e.dataRef.current)!=null&&r.optionsRef.current&&!((i=e.dataRef.current)!=null&&i.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let d=t.focus===Sn.Specific?t.idx:NO(t,{resolveItems:()=>e.virtual.options,resolveActiveIndex:()=>{var g,p;return(p=(g=e.activeOptionIndex)!=null?g:e.virtual.options.findIndex(v=>!e.virtual.disabled(v)))!=null?p:null},resolveDisabled:e.virtual.disabled,resolveId(){throw new Error("Function not implemented.")}}),f=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===d&&e.activationTrigger===f?e:{...e,activeOptionIndex:d,activationTrigger:f}}let a=x0(e);if(a.activeOptionIndex===null){let d=a.options.findIndex(f=>!f.dataRef.current.disabled);d!==-1&&(a.activeOptionIndex=d)}let l=t.focus===Sn.Specific?t.idx:NO(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled}),c=(s=t.trigger)!=null?s:2;return e.activeOptionIndex===l&&e.activationTrigger===c?e:{...e,...a,activeOptionIndex:l,activationTrigger:c}},3:(e,t)=>{var n,r,i;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let o=t.payload,s=x0(e,l=>(l.push(o),l));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(s.activeOptionIndex=s.options.indexOf(o));let a={...e,...s,activationTrigger:2};return(i=e.dataRef.current)!=null&&i.__demoMode&&e.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},4:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(i=>i.id!==t.id)};let r=x0(e,i=>{let o=i.findIndex(s=>s.id===t.id);return o!==-1&&i.splice(o,1),i});return{...e,...r,activationTrigger:2}},5:(e,t)=>e.labelId===t.id?e:{...e,labelId:t.id},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n;if(((n=e.virtual)==null?void 0:n.options)===t.options)return e;let r=e.activeOptionIndex;if(e.activeOptionIndex!==null){let i=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);i!==-1?r=i:r=null}return{...e,activeOptionIndex:r,virtual:Object.assign({},e.virtual,{options:t.options})}}},w0=m.createContext(null);w0.displayName="ComboboxActionsContext";function Iu(e){let t=m.useContext(w0);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Iu),n}return t}let FO=m.createContext(null);function rW(e){var t;let n=pa("VirtualProvider"),[r,i]=m.useMemo(()=>{let l=n.optionsRef.current;if(!l)return[0,0];let c=window.getComputedStyle(l);return[parseFloat(c.paddingBlockStart||c.paddingTop),parseFloat(c.paddingBlockEnd||c.paddingBottom)]},[n.optionsRef.current]),o=_H({scrollPaddingStart:r,scrollPaddingEnd:i,count:n.virtual.options.length,estimateSize(){return 40},getScrollElement(){var l;return(l=n.optionsRef.current)!=null?l:null},overscan:12}),[s,a]=m.useState(0);return _n(()=>{a(l=>l+1)},[(t=n.virtual)==null?void 0:t.options]),m.createElement(FO.Provider,{value:o},m.createElement("div",{style:{position:"relative",width:"100%",height:`${o.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&process.env.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&n.virtual.options.length>n.activeOptionIndex&&o.scrollToIndex(n.activeOptionIndex)}}},o.getVirtualItems().map(l=>{var c;return m.createElement(m.Fragment,{key:l.key},m.cloneElement((c=e.children)==null?void 0:c.call(e,{option:n.virtual.options[l.index],open:n.comboboxState===0}),{key:`${s}-${l.key}`,"data-index":l.index,"aria-setsize":n.virtual.options.length,"aria-posinset":l.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${l.start}px)`,overflowAnchor:"none"}}))})))}let _0=m.createContext(null);_0.displayName="ComboboxDataContext";function pa(e){let t=m.useContext(_0);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,pa),n}return t}function iW(e,t){return $n(t.type,nW,e,t)}let oW=m.Fragment;function sW(e,t){let{value:n,defaultValue:r,onChange:i,form:o,name:s,by:a=null,disabled:l=!1,__demoMode:c=!1,nullable:d=!1,multiple:f=!1,immediate:g=!1,virtual:p=null,...v}=e,y=!1,x=null,[w=f?[]:void 0,S]=OH(n,i,r),[C,P]=m.useReducer(iW,{dataRef:m.createRef(),comboboxState:c?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),O=m.useRef(!1),k=m.useRef({static:!1,hold:!1}),A=m.useRef(null),L=m.useRef(null),F=m.useRef(null),j=m.useRef(null),B=yt(typeof a=="string"?(ee,oe)=>{let xe=a;return(ee==null?void 0:ee[xe])===(oe==null?void 0:oe[xe])}:a??((ee,oe)=>ee===oe)),H=yt(ee=>C.options.findIndex(oe=>B(oe.dataRef.current.value,ee))),K=m.useCallback(ee=>$n($.mode,{1:()=>w.some(oe=>B(oe,ee)),0:()=>B(w,ee)}),[w]),Y=yt(ee=>C.activeOptionIndex===H(ee)),$=m.useMemo(()=>({...C,immediate:y,optionsPropsRef:k,labelRef:A,inputRef:L,buttonRef:F,optionsRef:j,value:w,defaultValue:r,disabled:l,mode:f?1:0,virtual:C.virtual,get activeOptionIndex(){if(O.current&&C.activeOptionIndex===null&&C.options.length>0){let ee=C.options.findIndex(oe=>!oe.dataRef.current.disabled);if(ee!==-1)return ee}return C.activeOptionIndex},calculateIndex:H,compare:B,isSelected:K,isActive:Y,nullable:d,__demoMode:c}),[w,r,l,f,d,c,C,x]);_n(()=>{},[x,void 0]),_n(()=>{C.dataRef.current=$},[$]),FH([$.buttonRef,$.inputRef,$.optionsRef],()=>me.closeCombobox(),$.comboboxState===0);let Z=m.useMemo(()=>{var ee,oe,xe;return{open:$.comboboxState===0,disabled:l,activeIndex:$.activeOptionIndex,activeOption:$.activeOptionIndex===null?null:$.virtual?$.virtual.options[(ee=$.activeOptionIndex)!=null?ee:0]:(xe=(oe=$.options[$.activeOptionIndex])==null?void 0:oe.dataRef.current.value)!=null?xe:null,value:w}},[$,l,w]),U=yt(()=>{if($.activeOptionIndex!==null){if($.virtual)N($.virtual.options[$.activeOptionIndex]);else{let{dataRef:ee}=$.options[$.activeOptionIndex];N(ee.current.value)}me.goToOption(Sn.Specific,$.activeOptionIndex)}}),ie=yt(()=>{P({type:0}),O.current=!0}),le=yt(()=>{P({type:1}),O.current=!1}),M=yt((ee,oe,xe)=>(O.current=!1,ee===Sn.Specific?P({type:2,focus:Sn.Specific,idx:oe,trigger:xe}):P({type:2,focus:ee,trigger:xe}))),W=yt((ee,oe)=>(P({type:3,payload:{id:ee,dataRef:oe}}),()=>{$.isActive(oe.current.value)&&(O.current=!0),P({type:4,id:ee})})),ne=yt(ee=>(P({type:5,id:ee}),()=>P({type:5,id:null}))),N=yt(ee=>$n($.mode,{0(){return S==null?void 0:S(ee)},1(){let oe=$.value.slice(),xe=oe.findIndex(V=>B(V,ee));return xe===-1?oe.push(ee):oe.splice(xe,1),S==null?void 0:S(oe)}})),X=yt(ee=>{P({type:6,trigger:ee})}),me=m.useMemo(()=>({onChange:N,registerOption:W,registerLabel:ne,goToOption:M,closeCombobox:le,openCombobox:ie,setActivationTrigger:X,selectActiveOption:U}),[]),he=t===null?{}:{ref:t},fe=m.useRef(null),re=Tu();return m.useEffect(()=>{fe.current&&r!==void 0&&re.addEventListener(fe.current,"reset",()=>{S==null||S(r)})},[fe,S]),m.createElement(w0.Provider,{value:me},m.createElement(_0.Provider,{value:$},m.createElement(IO,{value:$n($.comboboxState,{0:Ar.Open,1:Ar.Closed})},s!=null&&w!=null&&RO({[s]:w}).map(([ee,oe],xe)=>m.createElement(GH,{features:AO.Hidden,ref:xe===0?V=>{var Me;fe.current=(Me=V==null?void 0:V.closest("form"))!=null?Me:null}:void 0,...m0({key:ee,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:o,name:ee,value:oe})})),wo({ourProps:he,theirProps:v,slot:Z,defaultTag:oW,name:"Combobox"}))))}let aW="input";function lW(e,t){var n,r,i,o,s;let a=Au(),{id:l=`headlessui-combobox-input-${a}`,onChange:c,displayValue:d,type:f="text",...g}=e,p=pa("Combobox.Input"),v=Iu("Combobox.Input"),y=fa(p.inputRef,t),x=jH(p.inputRef),w=m.useRef(!1),S=Tu(),C=yt(()=>{v.onChange(null),p.optionsRef.current&&(p.optionsRef.current.scrollTop=0),v.goToOption(Sn.Nothing)}),P=function(){var $;return typeof d=="function"&&p.value!==void 0?($=d(p.value))!=null?$:"":typeof p.value=="string"?p.value:""}();DO(([$,Z],[U,ie])=>{if(w.current)return;let le=p.inputRef.current;le&&((ie===0&&Z===1||$!==U)&&(le.value=$),requestAnimationFrame(()=>{if(w.current||!le||(x==null?void 0:x.activeElement)!==le)return;let{selectionStart:M,selectionEnd:W}=le;Math.abs((W??0)-(M??0))===0&&M===0&&le.setSelectionRange(le.value.length,le.value.length)}))},[P,p.comboboxState,x]),DO(([$],[Z])=>{if($===0&&Z===1){if(w.current)return;let U=p.inputRef.current;if(!U)return;let ie=U.value,{selectionStart:le,selectionEnd:M,selectionDirection:W}=U;U.value="",U.value=ie,W!==null?U.setSelectionRange(le,M,W):U.setSelectionRange(le,M)}},[p.comboboxState]);let O=m.useRef(!1),k=yt(()=>{O.current=!0}),A=yt(()=>{S.nextFrame(()=>{O.current=!1})}),L=yt($=>{switch(w.current=!0,$.key){case Ir.Enter:if(w.current=!1,p.comboboxState!==0||O.current)return;if($.preventDefault(),$.stopPropagation(),p.activeOptionIndex===null){v.closeCombobox();return}v.selectActiveOption(),p.mode===0&&v.closeCombobox();break;case Ir.ArrowDown:return w.current=!1,$.preventDefault(),$.stopPropagation(),$n(p.comboboxState,{0:()=>v.goToOption(Sn.Next),1:()=>v.openCombobox()});case Ir.ArrowUp:return w.current=!1,$.preventDefault(),$.stopPropagation(),$n(p.comboboxState,{0:()=>v.goToOption(Sn.Previous),1:()=>{v.openCombobox(),S.nextFrame(()=>{p.value||v.goToOption(Sn.Last)})}});case Ir.Home:if($.shiftKey)break;return w.current=!1,$.preventDefault(),$.stopPropagation(),v.goToOption(Sn.First);case Ir.PageUp:return w.current=!1,$.preventDefault(),$.stopPropagation(),v.goToOption(Sn.First);case Ir.End:if($.shiftKey)break;return w.current=!1,$.preventDefault(),$.stopPropagation(),v.goToOption(Sn.Last);case Ir.PageDown:return w.current=!1,$.preventDefault(),$.stopPropagation(),v.goToOption(Sn.Last);case Ir.Escape:return w.current=!1,p.comboboxState!==0?void 0:($.preventDefault(),p.optionsRef.current&&!p.optionsPropsRef.current.static&&$.stopPropagation(),p.nullable&&p.mode===0&&p.value===null&&C(),v.closeCombobox());case Ir.Tab:if(w.current=!1,p.comboboxState!==0)return;p.mode===0&&p.activationTrigger!==1&&v.selectActiveOption(),v.closeCombobox();break}}),F=yt($=>{c==null||c($),p.nullable&&p.mode===0&&$.target.value===""&&C(),v.openCombobox()}),j=yt($=>{var Z,U,ie;let le=(Z=$.relatedTarget)!=null?Z:ha.find(M=>M!==$.currentTarget);if(w.current=!1,!((U=p.optionsRef.current)!=null&&U.contains(le))&&!((ie=p.buttonRef.current)!=null&&ie.contains(le))&&p.comboboxState===0)return $.preventDefault(),p.mode===0&&(p.nullable&&p.value===null?C():p.activationTrigger!==1&&v.selectActiveOption()),v.closeCombobox()}),B=yt($=>{var Z,U,ie;let le=(Z=$.relatedTarget)!=null?Z:ha.find(M=>M!==$.currentTarget);(U=p.buttonRef.current)!=null&&U.contains(le)||(ie=p.optionsRef.current)!=null&&ie.contains(le)||p.disabled||p.immediate&&p.comboboxState!==0&&(v.openCombobox(),S.nextFrame(()=>{v.setActivationTrigger(1)}))}),H=h0(()=>{if(p.labelId)return[p.labelId].join(" ")},[p.labelId]),K=m.useMemo(()=>({open:p.comboboxState===0,disabled:p.disabled}),[p]),Y={ref:y,id:l,role:"combobox",type:f,"aria-controls":(n=p.optionsRef.current)==null?void 0:n.id,"aria-expanded":p.comboboxState===0,"aria-activedescendant":p.activeOptionIndex===null?void 0:p.virtual?(r=p.options.find($=>{var Z;return!((Z=p.virtual)!=null&&Z.disabled($.dataRef.current.value))&&p.compare($.dataRef.current.value,p.virtual.options[p.activeOptionIndex])}))==null?void 0:r.id:(i=p.options[p.activeOptionIndex])==null?void 0:i.id,"aria-labelledby":H,"aria-autocomplete":"list",defaultValue:(s=(o=e.defaultValue)!=null?o:p.defaultValue!==void 0?d==null?void 0:d(p.defaultValue):null)!=null?s:p.defaultValue,disabled:p.disabled,onCompositionStart:k,onCompositionEnd:A,onKeyDown:L,onChange:F,onFocus:B,onBlur:j};return wo({ourProps:Y,theirProps:g,slot:K,defaultTag:aW,name:"Combobox.Input"})}let cW="button";function uW(e,t){var n;let r=pa("Combobox.Button"),i=Iu("Combobox.Button"),o=fa(r.buttonRef,t),s=Au(),{id:a=`headlessui-combobox-button-${s}`,...l}=e,c=Tu(),d=yt(y=>{switch(y.key){case Ir.ArrowDown:return y.preventDefault(),y.stopPropagation(),r.comboboxState===1&&i.openCombobox(),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})});case Ir.ArrowUp:return y.preventDefault(),y.stopPropagation(),r.comboboxState===1&&(i.openCombobox(),c.nextFrame(()=>{r.value||i.goToOption(Sn.Last)})),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})});case Ir.Escape:return r.comboboxState!==0?void 0:(y.preventDefault(),r.optionsRef.current&&!r.optionsPropsRef.current.static&&y.stopPropagation(),i.closeCombobox(),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})}));default:return}}),f=yt(y=>{if(KH(y.currentTarget))return y.preventDefault();r.comboboxState===0?i.closeCombobox():(y.preventDefault(),i.openCombobox()),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})})}),g=h0(()=>{if(r.labelId)return[r.labelId,a].join(" ")},[r.labelId,a]),p=m.useMemo(()=>({open:r.comboboxState===0,disabled:r.disabled,value:r.value}),[r]),v={ref:o,id:a,type:zH(e,r.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsRef.current)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":g,disabled:r.disabled,onClick:f,onKeyDown:d};return wo({ourProps:v,theirProps:l,slot:p,defaultTag:cW,name:"Combobox.Button"})}let dW="label";function fW(e,t){let n=Au(),{id:r=`headlessui-combobox-label-${n}`,...i}=e,o=pa("Combobox.Label"),s=Iu("Combobox.Label"),a=fa(o.labelRef,t);_n(()=>s.registerLabel(r),[r]);let l=yt(()=>{var d;return(d=o.inputRef.current)==null?void 0:d.focus({preventScroll:!0})}),c=m.useMemo(()=>({open:o.comboboxState===0,disabled:o.disabled}),[o]);return wo({ourProps:{ref:a,id:r,onClick:l},theirProps:i,slot:c,defaultTag:dW,name:"Combobox.Label"})}let hW="ul",pW=Yh.RenderStrategy|Yh.Static;function gW(e,t){let n=Au(),{id:r=`headlessui-combobox-options-${n}`,hold:i=!1,...o}=e,s=pa("Combobox.Options"),a=fa(s.optionsRef,t),l=y0(),c=l!==null?(l&Ar.Open)===Ar.Open:s.comboboxState===0;_n(()=>{var p;s.optionsPropsRef.current.static=(p=e.static)!=null?p:!1},[s.optionsPropsRef,e.static]),_n(()=>{s.optionsPropsRef.current.hold=i},[s.optionsPropsRef,i]),HH({container:s.optionsRef.current,enabled:s.comboboxState===0,accept(p){return p.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:p.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(p){p.setAttribute("role","none")}});let d=h0(()=>{var p,v;return(v=s.labelId)!=null?v:(p=s.buttonRef.current)==null?void 0:p.id},[s.labelId,s.buttonRef.current]),f=m.useMemo(()=>({open:s.comboboxState===0,option:void 0}),[s]),g={"aria-labelledby":d,role:"listbox","aria-multiselectable":s.mode===1?!0:void 0,id:r,ref:a};return s.virtual&&s.comboboxState===0&&Object.assign(o,{children:m.createElement(rW,null,o.children)}),wo({ourProps:g,theirProps:o,slot:f,defaultTag:hW,features:pW,visible:c,name:"Combobox.Options"})}let mW="li";function vW(e,t){var n;let r=Au(),{id:i=`headlessui-combobox-option-${r}`,disabled:o=!1,value:s,order:a=null,...l}=e,c=pa("Combobox.Option"),d=Iu("Combobox.Option"),f=c.virtual?c.activeOptionIndex===c.calculateIndex(s):c.activeOptionIndex===null?!1:((n=c.options[c.activeOptionIndex])==null?void 0:n.id)===i,g=c.isSelected(s),p=m.useRef(null),v=zi({disabled:o,value:s,domRef:p,order:a}),y=m.useContext(FO),x=fa(t,p,y?y.measureElement:null),w=yt(()=>d.onChange(s));_n(()=>d.registerOption(i,v),[v,i]);let S=m.useRef(!(c.virtual||c.__demoMode));_n(()=>{if(!c.virtual||!c.__demoMode)return;let j=da();return j.requestAnimationFrame(()=>{S.current=!0}),j.dispose},[c.virtual,c.__demoMode]),_n(()=>{if(!S.current||c.comboboxState!==0||!f||c.activationTrigger===0)return;let j=da();return j.requestAnimationFrame(()=>{var B,H;(H=(B=p.current)==null?void 0:B.scrollIntoView)==null||H.call(B,{block:"nearest"})}),j.dispose},[p,f,c.comboboxState,c.activationTrigger,c.activeOptionIndex]);let C=yt(j=>{var B;if(o||(B=c.virtual)!=null&&B.disabled(s))return j.preventDefault();w(),PO()||requestAnimationFrame(()=>{var H;return(H=c.inputRef.current)==null?void 0:H.focus({preventScroll:!0})}),c.mode===0&&requestAnimationFrame(()=>d.closeCombobox())}),P=yt(()=>{var j;if(o||(j=c.virtual)!=null&&j.disabled(s))return d.goToOption(Sn.Nothing);let B=c.calculateIndex(s);d.goToOption(Sn.Specific,B)}),O=VH(),k=yt(j=>O.update(j)),A=yt(j=>{var B;if(!O.wasMoved(j)||o||(B=c.virtual)!=null&&B.disabled(s)||f)return;let H=c.calculateIndex(s);d.goToOption(Sn.Specific,H,0)}),L=yt(j=>{var B;O.wasMoved(j)&&(o||(B=c.virtual)!=null&&B.disabled(s)||f&&(c.optionsPropsRef.current.hold||d.goToOption(Sn.Nothing)))}),F=m.useMemo(()=>({active:f,selected:g,disabled:o}),[f,g,o]);return wo({ourProps:{id:i,ref:x,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":g,disabled:void 0,onClick:C,onFocus:P,onPointerEnter:k,onMouseEnter:k,onPointerMove:A,onMouseMove:A,onPointerLeave:L,onMouseLeave:L},theirProps:l,slot:F,defaultTag:mW,name:"Combobox.Option"})}let bW=Bi(sW),yW=Bi(uW),xW=Bi(lW),wW=Bi(fW),_W=Bi(gW),SW=Bi(vW),Dl=Object.assign(bW,{Input:xW,Button:yW,Label:wW,Options:_W,Option:SW});function S0(){let e=m.useRef(!1);return _n(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function CW(e=0){let[t,n]=m.useState(e),r=S0(),i=m.useCallback(l=>{r.current&&n(c=>c|l)},[t,r]),o=m.useCallback(l=>!!(t&l),[t]),s=m.useCallback(l=>{r.current&&n(c=>c&~l)},[n,r]),a=m.useCallback(l=>{r.current&&n(c=>c^l)},[n]);return{flags:t,addFlag:i,hasFlag:o,removeFlag:s,toggleFlag:a}}function EW(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function C0(e,...t){e&&t.length>0&&e.classList.add(...t)}function E0(e,...t){e&&t.length>0&&e.classList.remove(...t)}function OW(e,t){let n=da();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:i}=getComputedStyle(e),[o,s]=[r,i].map(l=>{let[c=0]=l.split(",").filter(Boolean).map(d=>d.includes("ms")?parseFloat(d):parseFloat(d)*1e3).sort((d,f)=>f-d);return c}),a=o+s;if(a!==0){n.group(c=>{c.setTimeout(()=>{t(),c.dispose()},a),c.addEventListener(e,"transitionrun",d=>{d.target===d.currentTarget&&c.dispose()})});let l=n.addEventListener(e,"transitionend",c=>{c.target===c.currentTarget&&(t(),l())})}else t();return n.add(()=>t()),n.dispose}function PW(e,t,n,r){let i=n?"enter":"leave",o=da(),s=r!==void 0?EW(r):()=>{};i==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let a=$n(i,{enter:()=>t.enter,leave:()=>t.leave}),l=$n(i,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),c=$n(i,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return E0(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),C0(e,...t.base,...a,...c),o.nextFrame(()=>{E0(e,...t.base,...a,...c),C0(e,...t.base,...a,...l),OW(e,()=>(E0(e,...t.base,...a),C0(e,...t.base,...t.entered),s()))}),o.dispose}function kW({immediate:e,container:t,direction:n,classes:r,onStart:i,onStop:o}){let s=S0(),a=Tu(),l=zi(n);_n(()=>{e&&(l.current="enter")},[e]),_n(()=>{let c=da();a.add(c.dispose);let d=t.current;if(d&&l.current!=="idle"&&s.current)return c.dispose(),i.current(l.current),c.add(PW(d,r.current,l.current==="enter",()=>{c.dispose(),o.current(l.current)})),c.dispose},[n])}function ns(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let Xh=m.createContext(null);Xh.displayName="TransitionContext";var MW=(e=>(e.Visible="visible",e.Hidden="hidden",e))(MW||{});function DW(){let e=m.useContext(Xh);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function TW(){let e=m.useContext(Qh);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Qh=m.createContext(null);Qh.displayName="NestingContext";function Jh(e){return"children"in e?Jh(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function jO(e,t){let n=zi(e),r=m.useRef([]),i=S0(),o=Tu(),s=yt((p,v=ts.Hidden)=>{let y=r.current.findIndex(({el:x})=>x===p);y!==-1&&($n(v,{[ts.Unmount](){r.current.splice(y,1)},[ts.Hidden](){r.current[y].state="hidden"}}),o.microTask(()=>{var x;!Jh(r)&&i.current&&((x=n.current)==null||x.call(n))}))}),a=yt(p=>{let v=r.current.find(({el:y})=>y===p);return v?v.state!=="visible"&&(v.state="visible"):r.current.push({el:p,state:"visible"}),()=>s(p,ts.Unmount)}),l=m.useRef([]),c=m.useRef(Promise.resolve()),d=m.useRef({enter:[],leave:[],idle:[]}),f=yt((p,v,y)=>{l.current.splice(0),t&&(t.chains.current[v]=t.chains.current[v].filter(([x])=>x!==p)),t==null||t.chains.current[v].push([p,new Promise(x=>{l.current.push(x)})]),t==null||t.chains.current[v].push([p,new Promise(x=>{Promise.all(d.current[v].map(([w,S])=>S)).then(()=>x())})]),v==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>y(v)):y(v)}),g=yt((p,v,y)=>{Promise.all(d.current[v].splice(0).map(([x,w])=>w)).then(()=>{var x;(x=l.current.shift())==null||x()}).then(()=>y(v))});return m.useMemo(()=>({children:r,register:a,unregister:s,onStart:f,onStop:g,wait:c,chains:d}),[a,s,r,f,g,d,c])}function AW(){}let IW=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function zO(e){var t;let n={};for(let r of IW)n[r]=(t=e[r])!=null?t:AW;return n}function NW(e){let t=m.useRef(zO(e));return m.useEffect(()=>{t.current=zO(e)},[e]),t}let RW="div",BO=Yh.RenderStrategy;function LW(e,t){var n,r;let{beforeEnter:i,afterEnter:o,beforeLeave:s,afterLeave:a,enter:l,enterFrom:c,enterTo:d,entered:f,leave:g,leaveFrom:p,leaveTo:v,...y}=e,x=m.useRef(null),w=fa(x,t),S=(n=y.unmount)==null||n?ts.Unmount:ts.Hidden,{show:C,appear:P,initial:O}=DW(),[k,A]=m.useState(C?"visible":"hidden"),L=TW(),{register:F,unregister:j}=L;m.useEffect(()=>F(x),[F,x]),m.useEffect(()=>{if(S===ts.Hidden&&x.current){if(C&&k!=="visible"){A("visible");return}return $n(k,{hidden:()=>j(x),visible:()=>F(x)})}},[k,x,F,j,C,S]);let B=zi({base:ns(y.className),enter:ns(l),enterFrom:ns(c),enterTo:ns(d),entered:ns(f),leave:ns(g),leaveFrom:ns(p),leaveTo:ns(v)}),H=NW({beforeEnter:i,afterEnter:o,beforeLeave:s,afterLeave:a}),K=p0();m.useEffect(()=>{if(K&&k==="visible"&&x.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[x,k,K]);let Y=O&&!P,$=P&&C&&O,Z=!K||Y?"idle":C?"enter":"leave",U=CW(0),ie=yt(X=>$n(X,{enter:()=>{U.addFlag(Ar.Opening),H.current.beforeEnter()},leave:()=>{U.addFlag(Ar.Closing),H.current.beforeLeave()},idle:()=>{}})),le=yt(X=>$n(X,{enter:()=>{U.removeFlag(Ar.Opening),H.current.afterEnter()},leave:()=>{U.removeFlag(Ar.Closing),H.current.afterLeave()},idle:()=>{}})),M=jO(()=>{A("hidden"),j(x)},L),W=m.useRef(!1);kW({immediate:$,container:x,classes:B,direction:Z,onStart:zi(X=>{W.current=!0,M.onStart(x,X,ie)}),onStop:zi(X=>{W.current=!1,M.onStop(x,X,le),X==="leave"&&!Jh(M)&&(A("hidden"),j(x))})});let ne=y,N={ref:w};return $?ne={...ne,className:Gh(y.className,...B.current.enter,...B.current.enterFrom)}:W.current&&(ne.className=Gh(y.className,(r=x.current)==null?void 0:r.className),ne.className===""&&delete ne.className),m.createElement(Qh.Provider,{value:M},m.createElement(IO,{value:$n(k,{visible:Ar.Open,hidden:Ar.Closed})|U.flags},wo({ourProps:N,theirProps:ne,defaultTag:RW,features:BO,visible:k==="visible",name:"Transition.Child"})))}function $W(e,t){let{show:n,appear:r=!1,unmount:i=!0,...o}=e,s=m.useRef(null),a=fa(s,t);p0();let l=y0();if(n===void 0&&l!==null&&(n=(l&Ar.Open)===Ar.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[c,d]=m.useState(n?"visible":"hidden"),f=jO(()=>{d("hidden")}),[g,p]=m.useState(!0),v=m.useRef([n]);_n(()=>{g!==!1&&v.current[v.current.length-1]!==n&&(v.current.push(n),p(!1))},[v,n]);let y=m.useMemo(()=>({show:n,appear:r,initial:g}),[n,r,g]);m.useEffect(()=>{if(n)d("visible");else if(!Jh(f))d("hidden");else{let C=s.current;if(!C)return;let P=C.getBoundingClientRect();P.x===0&&P.y===0&&P.width===0&&P.height===0&&d("hidden")}},[n,f]);let x={unmount:i},w=yt(()=>{var C;g&&p(!1),(C=e.beforeEnter)==null||C.call(e)}),S=yt(()=>{var C;g&&p(!1),(C=e.beforeLeave)==null||C.call(e)});return m.createElement(Qh.Provider,{value:f},m.createElement(Xh.Provider,{value:y},wo({ourProps:{...x,as:m.Fragment,children:m.createElement(VO,{ref:a,...x,...o,beforeEnter:w,beforeLeave:S})},theirProps:{},defaultTag:m.Fragment,features:BO,visible:c==="visible",name:"Transition"})))}function FW(e,t){let n=m.useContext(Xh)!==null,r=y0()!==null;return m.createElement(m.Fragment,null,!n&&r?m.createElement(O0,{ref:t,...e}):m.createElement(VO,{ref:t,...e}))}let O0=Bi($W),VO=Bi(LW),jW=Bi(FW),zW=Object.assign(O0,{Child:jW,Root:O0});const P0=["text","varchar","nvarchar","nvarchar2","char","character","nchar","char varying","nchar varying","character varying","string"],Tl=["number","integer","int","bigint","smallint","tinyint","byteint","numeric","decimal","dec","double","real","double precision","float","float4","float8"],Nu=["date","datetime","time","timestamp","timestamp without time zone"],HO=["boolean"];function WO(e,t,n){const{measures:r,dimensions:i}=e,o=r==null?void 0:r.map(c=>`${c.calc}(${c.name}) as ${c.calc}_${c.name}`).join(", "),s=(i==null?void 0:i.join(", "))||"";let a="";const l=M0(t,n);if(o&&s)return a=`SELECT ${s}, COUNT(*), ${o} FROM ${l} GROUP BY ${s} ORDER BY ${s} DESC LIMIT 100`,a;if(!o&&s)return a=`SELECT ${s}, COUNT(*) FROM ${l} GROUP BY ${s} ORDER BY ${s} DESC LIMIT 100`,a;if(o&&!s)return a=`SELECT ${o} FROM ${l}`,a}function qO(e,t,n="AVG"){var i,o,s,a;let r={};return P0.includes(e.data_type)&&(((i=t.dimensions)==null?void 0:i.includes(e.column_name))?r={...t,dimensions:(o=t.dimensions)==null?void 0:o.filter(c=>c!==e.column_name)}:r={...t,dimensions:[...t.dimensions||[],e.column_name]}),Tl.includes(e.data_type)&&(((s=t.measures)==null?void 0:s.some(c=>c.name===e.column_name&&c.calc===n))?r={...t,measures:(a=t.measures)==null?void 0:a.filter(c=>!(c.name===e.column_name&&c.calc===n))}:r={...t,measures:[...t.measures||[],{name:e.column_name,calc:n||"SUM"}]}),r}function k0(e){return P0.includes(e.dataType)?"string":Tl.includes(e.dataType)?"number":Nu.includes(e.dataType)?"date":HO.includes(e.dataType)?"boolean":"string"}function BW(e,t){const{dimensions:n,measures:r}=t,i=n==null?void 0:n.includes(e.column_name),o=r==null?void 0:r.some(s=>s.name===e.column_name);return i||o}function M0(e,t){return e==="public"?t:e?`${e}.${t}`:`${t}`}function VW(e){const t=/(>=|<=|>|<|=)/,n=e.match(t);if(n){const r=n[0],[i,o]=e.split(r);return{operation:r,value:o.trim()}}else return null}const UO=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,GO=Gd,YO=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return GO(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=t,s=Object.keys(i).map(c=>{const d=n==null?void 0:n[c],f=o==null?void 0:o[c];if(d===null)return null;const g=UO(d)||UO(f);return i[c][g]}),a=n&&Object.entries(n).reduce((c,d)=>{let[f,g]=d;return g===void 0||(c[f]=g),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,d)=>{let{class:f,className:g,...p}=d;return Object.entries(p).every(v=>{let[y,x]=v;return Array.isArray(x)?x.includes({...o,...a}[y]):{...o,...a}[y]===x})?[...c,f,g]:c},[]);return GO(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},D0=YO("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),it=de.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},o)=>{const s=r?ro:"button";return _.jsx(s,{className:Pe(D0({variant:t,size:n,className:e})),ref:o,...i})});it.displayName="Button";function HW({filter:e}){const[t,n]=m.useState([]),[r,i]=m.useState(""),[o,s]=m.useState(""),a=m.useRef(null),l=ge(k=>k.authToken),c=ge(k=>k.filterValues),d=ge(k=>k.actions.addOrUpdateFilterValue),f=ge(k=>k.actions.removeFilterValue),{data:g,isLoading:p,isFetching:v,isError:y,refetch:x}=Cr({queryKey:[e.sql],queryFn:()=>Ns("https://semaphor.cloud/api/v1/query",(l==null?void 0:l.accessToken)||"",{connection_id:e.connectionId,sql:e.sql}),enabled:!!e.sql&&!!e.connectionId&&!!e.database}),w=m.useMemo(()=>{var k;return(k=g==null?void 0:g.records)==null?void 0:k.map(A=>({id:A[e.column.toLowerCase()],value:A[e.column.toLowerCase()]}))},[g,e.column]);m.useEffect(()=>{if(c){const k=c.find(A=>A.filterId===e.id);if(!k){n([]);return}if(k.operation==="in"){const A=w==null?void 0:w.filter(L=>k.values.includes(L.value));A&&n(A)}else i(`${k.operation} ${k.values[0]}`)}},[g]),m.useEffect(()=>{if(c&&!c.find(A=>A.filterId===e.id)){n([]);return}},[c,e.id]);function S(k){console.log("custom input");const A=VW(k[0].toString());if(!(A!=null&&A.value)||!(A!=null&&A.operation))return;const L={filterId:e.id,connectionType:e.database==="NA"?"api":"database",valueType:k0(e),name:e.column,operation:A.operation,values:[A.value]};d(L)}function C(k){if(console.log("onComboBoxChange",k),k.length===1&&w.find(L=>L.value===k[0].value)===void 0){S(k);return}if(n(k),k.length===0){f(e.id);return}const A={filterId:e.id,connectionType:e.database==="NA"?"api":"database",name:e.column,valueType:k0(e),operation:"in",values:k.map(L=>L.value)};d(A)}function P(){var k;i(""),f(e.id),console.log(e.id),(k=a.current)==null||k.click()}if(p)return _.jsx("div",{children:_.jsx(cf,{className:" bg-foreground/10 h-8 w-[180px]"})});if(y)return _.jsx("div",{className:"bg-muted h-8 w-[180px] px-2",children:"Error"});if(!g)return null;let O=[];return Tl.includes(e.dataType)?O=w:O=o===""?w:w.filter(k=>k.value.toLowerCase().replace(/\s+/g,"").includes(o.toLowerCase().replace(/\s+/g,""))),_.jsx(Dl,{value:t,onChange:C,multiple:!0,children:_.jsxs("div",{className:"relative",children:[_.jsxs("div",{className:" border relative w-full cursor-default overflow-hidden rounded-sm bg-background text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-background/75 focus-visible:ring-offset-2 sm:text-sm",children:[_.jsx(Dl.Input,{className:"flex h-8 w-full rounded border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50",displayValue:k=>k.map(L=>L.value).join(", ")||r,onChange:k=>{i(k.target.value),s(k.target.value)}}),_.jsx(Dl.Button,{ref:a,className:"absolute bg-background pl-1 inset-y-0 right-0 flex items-center pr-2",children:_.jsx(zj,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),_.jsx(zW,{as:m.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",afterLeave:()=>s(""),children:_.jsxs(Dl.Options,{className:" z-10 absolute mt-1 max-h-60 w-full overflow-auto rounded-sm bg-background py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm border",children:[Tl.includes(e.dataType)&&_.jsxs(Dl.Option,{value:r,className:" flex items-center px-3 justify-between gap-2 py-2",children:[_.jsxs("div",{className:"flex items-center gap-2",children:[_.jsx("span",{className:" font-thin",children:"#"}),_.jsx("span",{children:r})]}),r&&_.jsx(it,{variant:"link",className:" h-4 w-3 text-foreground/50 hover:text-foreground/100 cursor-pointer",onClick:k=>{k.stopPropagation(),P()},children:"Clear"})]}),O.length===0&&o!==""?_.jsx("div",{className:"relative cursor-default select-none px-4 py-2 text-gray-700",children:"Nothing found."}):O.map(k=>_.jsx(Dl.Option,{className:({active:A})=>`relative cursor-default select-none py-2 pl-10 pr-4 ${A?"bg-muted ":"text-foreground-900"}`,value:k,children:({selected:A,active:L})=>(A&&console.log("record",k,A),_.jsxs(_.Fragment,{children:[_.jsx("span",{className:`block truncate ${A?"font-medium":"font-normal"}`,children:typeof k.value=="boolean"?k.value?"True":"False":k.value}),A?_.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 text-foreground",children:_.jsx(JE,{className:"h-5 w-5","aria-hidden":"true"})}):null]}))},k.id))]})})]})})}const KO=m.forwardRef((e,t)=>m.createElement(Ve.label,ae({},e,{ref:t,onMouseDown:n=>{var r;(r=e.onMouseDown)===null||r===void 0||r.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault()}}))),WW=YO("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),rs=de.forwardRef(({className:e,...t},n)=>_.jsx(KO,{ref:n,className:Pe(WW(),e),...t}));rs.displayName=KO.displayName;function Pt(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function Nr(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function er(e,t){const n=Pt(e);return isNaN(t)?Nr(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function xi(e,t){const n=Pt(e);if(isNaN(t))return Nr(e,NaN);if(!t)return n;const r=n.getDate(),i=Nr(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);const o=i.getDate();return r>=o?i:(n.setFullYear(i.getFullYear(),i.getMonth(),r),n)}const T0=6048e5,qW=864e5;let UW={};function Ru(){return UW}function Vi(e,t){var a,l,c,d;const n=Ru(),r=(t==null?void 0:t.weekStartsOn)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??n.weekStartsOn??((d=(c=n.locale)==null?void 0:c.options)==null?void 0:d.weekStartsOn)??0,i=Pt(e),o=i.getDay(),s=(o<r?7:0)+o-r;return i.setDate(i.getDate()-s),i.setHours(0,0,0,0),i}function ga(e){return Vi(e,{weekStartsOn:1})}function XO(e){const t=Pt(e),n=t.getFullYear(),r=Nr(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const i=ga(r),o=Nr(e,0);o.setFullYear(n,0,4),o.setHours(0,0,0,0);const s=ga(o);return t.getTime()>=i.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function Al(e){const t=Pt(e);return t.setHours(0,0,0,0),t}function Zh(e){const t=Pt(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Hi(e,t){const n=Al(e),r=Al(t),i=+n-Zh(n),o=+r-Zh(r);return Math.round((i-o)/qW)}function GW(e){const t=XO(e),n=Nr(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),ga(n)}function A0(e,t){const n=t*7;return er(e,n)}function YW(e,t){return xi(e,t*12)}function KW(e){let t;return e.forEach(function(n){const r=Pt(n);(t===void 0||t<r||isNaN(Number(r)))&&(t=r)}),t||new Date(NaN)}function XW(e){let t;return e.forEach(n=>{const r=Pt(n);(!t||t>r||isNaN(+r))&&(t=r)}),t||new Date(NaN)}function fr(e,t){const n=Al(e),r=Al(t);return+n==+r}function I0(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function QW(e){if(!I0(e)&&typeof e!="number")return!1;const t=Pt(e);return!isNaN(Number(t))}function Lu(e,t){const n=Pt(e),r=Pt(t),i=n.getFullYear()-r.getFullYear(),o=n.getMonth()-r.getMonth();return i*12+o}function JW(e,t,n){const r=Vi(e,n),i=Vi(t,n),o=+r-Zh(r),s=+i-Zh(i);return Math.round((o-s)/T0)}function N0(e){const t=Pt(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function hr(e){const t=Pt(e);return t.setDate(1),t.setHours(0,0,0,0),t}function QO(e){const t=Pt(e),n=Nr(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function R0(e,t){var a,l,c,d;const n=Ru(),r=(t==null?void 0:t.weekStartsOn)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??n.weekStartsOn??((d=(c=n.locale)==null?void 0:c.options)==null?void 0:d.weekStartsOn)??0,i=Pt(e),o=i.getDay(),s=(o<r?-7:0)+6-(o-r);return i.setDate(i.getDate()+s),i.setHours(23,59,59,999),i}function JO(e){return R0(e,{weekStartsOn:1})}const ZW={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},e6=(e,t,n)=>{let r;const i=ZW[e];return typeof i=="string"?r=i:t===1?r=i.one:r=i.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function L0(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const t6={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},n6={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},r6={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},i6={date:L0({formats:t6,defaultWidth:"full"}),time:L0({formats:n6,defaultWidth:"full"}),dateTime:L0({formats:r6,defaultWidth:"full"})},o6={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},s6=(e,t,n,r)=>o6[e];function $u(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let i;if(r==="formatting"&&e.formattingValues){const s=e.defaultFormattingWidth||e.defaultWidth,a=n!=null&&n.width?String(n.width):s;i=e.formattingValues[a]||e.formattingValues[s]}else{const s=e.defaultWidth,a=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[a]||e.values[s]}const o=e.argumentCallback?e.argumentCallback(t):t;return i[o]}}const a6={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},l6={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},c6={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},u6={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},d6={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},f6={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},h6={ordinalNumber:(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:$u({values:a6,defaultWidth:"wide"}),quarter:$u({values:l6,defaultWidth:"wide",argumentCallback:e=>e-1}),month:$u({values:c6,defaultWidth:"wide"}),day:$u({values:u6,defaultWidth:"wide"}),dayPeriod:$u({values:d6,defaultWidth:"wide",formattingValues:f6,defaultFormattingWidth:"wide"})};function Fu(e){return(t,n={})=>{const r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=t.match(i);if(!o)return null;const s=o[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?g6(a,f=>f.test(s)):p6(a,f=>f.test(s));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const d=t.slice(s.length);return{value:c,rest:d}}}function p6(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function g6(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function m6(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const i=r[0],o=t.match(e.parsePattern);if(!o)return null;let s=e.valueCallback?e.valueCallback(o[0]):o[0];s=n.valueCallback?n.valueCallback(s):s;const a=t.slice(i.length);return{value:s,rest:a}}}const v6=/^(\d+)(th|st|nd|rd)?/i,b6=/\d+/i,y6={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},x6={any:[/^b/i,/^(a|c)/i]},w6={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},_6={any:[/1/i,/2/i,/3/i,/4/i]},S6={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},C6={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},E6={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},O6={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},P6={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},k6={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},M6={ordinalNumber:m6({matchPattern:v6,parsePattern:b6,valueCallback:e=>parseInt(e,10)}),era:Fu({matchPatterns:y6,defaultMatchWidth:"wide",parsePatterns:x6,defaultParseWidth:"any"}),quarter:Fu({matchPatterns:w6,defaultMatchWidth:"wide",parsePatterns:_6,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Fu({matchPatterns:S6,defaultMatchWidth:"wide",parsePatterns:C6,defaultParseWidth:"any"}),day:Fu({matchPatterns:E6,defaultMatchWidth:"wide",parsePatterns:O6,defaultParseWidth:"any"}),dayPeriod:Fu({matchPatterns:P6,defaultMatchWidth:"any",parsePatterns:k6,defaultParseWidth:"any"})},ZO={code:"en-US",formatDistance:e6,formatLong:i6,formatRelative:s6,localize:h6,match:M6,options:{weekStartsOn:0,firstWeekContainsDate:1}};function D6(e){const t=Pt(e);return Hi(t,QO(t))+1}function eP(e){const t=Pt(e),n=+ga(t)-+GW(t);return Math.round(n/T0)+1}function tP(e,t){var d,f,g,p;const n=Pt(e),r=n.getFullYear(),i=Ru(),o=(t==null?void 0:t.firstWeekContainsDate)??((f=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??i.firstWeekContainsDate??((p=(g=i.locale)==null?void 0:g.options)==null?void 0:p.firstWeekContainsDate)??1,s=Nr(e,0);s.setFullYear(r+1,0,o),s.setHours(0,0,0,0);const a=Vi(s,t),l=Nr(e,0);l.setFullYear(r,0,o),l.setHours(0,0,0,0);const c=Vi(l,t);return n.getTime()>=a.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function T6(e,t){var a,l,c,d;const n=Ru(),r=(t==null?void 0:t.firstWeekContainsDate)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.firstWeekContainsDate)??n.firstWeekContainsDate??((d=(c=n.locale)==null?void 0:c.options)==null?void 0:d.firstWeekContainsDate)??1,i=tP(e,t),o=Nr(e,0);return o.setFullYear(i,0,r),o.setHours(0,0,0,0),Vi(o,t)}function nP(e,t){const n=Pt(e),r=+Vi(n,t)-+T6(n,t);return Math.round(r/T0)+1}function Ft(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const is={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return Ft(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Ft(n+1,2)},d(e,t){return Ft(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return Ft(e.getHours()%12||12,t.length)},H(e,t){return Ft(e.getHours(),t.length)},m(e,t){return Ft(e.getMinutes(),t.length)},s(e,t){return Ft(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return Ft(i,t.length)}},Il={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},rP={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return is.y(e,t)},Y:function(e,t,n,r){const i=tP(e,r),o=i>0?i:1-i;if(t==="YY"){const s=o%100;return Ft(s,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):Ft(o,t.length)},R:function(e,t){const n=XO(e);return Ft(n,t.length)},u:function(e,t){const n=e.getFullYear();return Ft(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Ft(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Ft(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return is.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return Ft(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const i=nP(e,r);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):Ft(i,t.length)},I:function(e,t,n){const r=eP(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):Ft(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):is.d(e,t)},D:function(e,t,n){const r=D6(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Ft(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const i=e.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return Ft(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const i=e.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return Ft(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),i=r===0?7:r;switch(t){case"i":return String(i);case"ii":return Ft(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let i;switch(r===12?i=Il.noon:r===0?i=Il.midnight:i=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let i;switch(r>=17?i=Il.evening:r>=12?i=Il.afternoon:r>=4?i=Il.morning:i=Il.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return is.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):is.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Ft(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):Ft(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):is.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):is.s(e,t)},S:function(e,t){return is.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return oP(r);case"XXXX":case"XX":return ma(r);case"XXXXX":case"XXX":default:return ma(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return oP(r);case"xxxx":case"xx":return ma(r);case"xxxxx":case"xxx":default:return ma(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+iP(r,":");case"OOOO":default:return"GMT"+ma(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+iP(r,":");case"zzzz":default:return"GMT"+ma(r,":")}},t:function(e,t,n){const r=Math.trunc(e.getTime()/1e3);return Ft(r,t.length)},T:function(e,t,n){const r=e.getTime();return Ft(r,t.length)}};function iP(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Math.trunc(r/60),o=r%60;return o===0?n+String(i):n+String(i)+t+Ft(o,2)}function oP(e,t){return e%60===0?(e>0?"-":"+")+Ft(Math.abs(e)/60,2):ma(e,t)}function ma(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Ft(Math.trunc(r/60),2),o=Ft(r%60,2);return n+i+t+o}const sP=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},aP=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},A6={p:aP,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return sP(e,t);let o;switch(r){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",sP(r,t)).replace("{{time}}",aP(i,t))}},I6=/^D+$/,N6=/^Y+$/,R6=["D","DD","YY","YYYY"];function L6(e){return I6.test(e)}function $6(e){return N6.test(e)}function F6(e,t,n){const r=j6(e,t,n);if(console.warn(r),R6.includes(e))throw new RangeError(r)}function j6(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const z6=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,B6=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,V6=/^'([^]*?)'?$/,H6=/''/g,W6=/[a-zA-Z]/;function Wi(e,t,n){var d,f,g,p,v,y,x,w;const r=Ru(),i=(n==null?void 0:n.locale)??r.locale??ZO,o=(n==null?void 0:n.firstWeekContainsDate)??((f=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??r.firstWeekContainsDate??((p=(g=r.locale)==null?void 0:g.options)==null?void 0:p.firstWeekContainsDate)??1,s=(n==null?void 0:n.weekStartsOn)??((y=(v=n==null?void 0:n.locale)==null?void 0:v.options)==null?void 0:y.weekStartsOn)??r.weekStartsOn??((w=(x=r.locale)==null?void 0:x.options)==null?void 0:w.weekStartsOn)??0,a=Pt(e);if(!QW(a))throw new RangeError("Invalid time value");let l=t.match(B6).map(S=>{const C=S[0];if(C==="p"||C==="P"){const P=A6[C];return P(S,i.formatLong)}return S}).join("").match(z6).map(S=>{if(S==="''")return{isToken:!1,value:"'"};const C=S[0];if(C==="'")return{isToken:!1,value:q6(S)};if(rP[C])return{isToken:!0,value:S};if(C.match(W6))throw new RangeError("Format string contains an unescaped latin alphabet character `"+C+"`");return{isToken:!1,value:S}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const c={firstWeekContainsDate:o,weekStartsOn:s,locale:i};return l.map(S=>{if(!S.isToken)return S.value;const C=S.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&$6(C)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&L6(C))&&F6(C,t,String(e));const P=rP[C[0]];return P(a,C,i.localize,c)}).join("")}function q6(e){const t=e.match(V6);return t?t[1].replace(H6,"'"):e}function U6(e){const t=Pt(e),n=t.getFullYear(),r=t.getMonth(),i=Nr(e,0);return i.setFullYear(n,r+1,0),i.setHours(0,0,0,0),i.getDate()}function G6(e){return Math.trunc(+Pt(e)/1e3)}function Y6(e){const t=Pt(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}function K6(e,t){return JW(Y6(e),hr(e),t)+1}function $0(e,t){const n=Pt(e),r=Pt(t);return n.getTime()>r.getTime()}function lP(e,t){const n=Pt(e),r=Pt(t);return+n<+r}function F0(e,t){const n=Pt(e),r=Pt(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function X6(e,t){const n=Pt(e),r=Pt(t);return n.getFullYear()===r.getFullYear()}function j0(e,t){return er(e,-t)}function z0(e,t){const n=Pt(e),r=n.getFullYear(),i=n.getDate(),o=Nr(e,0);o.setFullYear(r,t,15),o.setHours(0,0,0,0);const s=U6(o);return n.setMonth(t,Math.min(i,s)),n}function cP(e,t){const n=Pt(e);return isNaN(+n)?Nr(e,NaN):(n.setFullYear(t),n)}var Ge=function(){return Ge=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Ge.apply(this,arguments)};function Q6(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function uP(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var B0={exports:{}},ju={};/**
362
362
  * @license React
363
363
  * react-jsx-runtime.development.js
364
364
  *
@@ -424,7 +424,7 @@ Check the top-level render call using <`+se+">.")}return G}}function ja(D,G){{if
424
424
  `)},aG=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r,o=de.useMemo(function(){return iG(i)},[i]);return de.createElement(oG,{styles:sG(o,!t,i,n?"":"!important")})},oy=!1;if(typeof window<"u")try{var dp=Object.defineProperty({},"passive",{get:function(){return oy=!0,!0}});window.addEventListener("test",dp,dp),window.removeEventListener("test",dp,dp)}catch{oy=!1}var Rl=oy?{passive:!1}:!1,lG=function(e){return e.tagName==="TEXTAREA"},jP=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!lG(e)&&n[t]==="visible")},cG=function(e){return jP(e,"overflowY")},uG=function(e){return jP(e,"overflowX")},zP=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=BP(e,n);if(r){var i=VP(e,n),o=i[1],s=i[2];if(o>s)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},dG=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},fG=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},BP=function(e,t){return e==="v"?cG(t):uG(t)},VP=function(e,t){return e==="v"?dG(t):fG(t)},hG=function(e,t){return e==="h"&&t==="rtl"?-1:1},pG=function(e,t,n,r,i){var o=hG(e,window.getComputedStyle(t).direction),s=o*r,a=n.target,l=t.contains(a),c=!1,d=s>0,f=0,g=0;do{var p=VP(e,a),v=p[0],y=p[1],x=p[2],w=y-x-o*v;(v||w)&&BP(e,a)&&(f+=w,g+=v),a=a.parentNode}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(d&&(i&&f===0||!i&&s>f)||!d&&(i&&g===0||!i&&-s>g))&&(c=!0),c},fp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},HP=function(e){return[e.deltaX,e.deltaY]},WP=function(e){return e&&"current"in e?e.current:e},gG=function(e,t){return e[0]===t[0]&&e[1]===t[1]},mG=function(e){return`
425
425
  .block-interactivity-`.concat(e,` {pointer-events: none;}
426
426
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
427
- `)},vG=0,Ll=[];function bG(e){var t=de.useRef([]),n=de.useRef([0,0]),r=de.useRef(),i=de.useState(vG++)[0],o=de.useState(function(){return FP()})[0],s=de.useRef(e);de.useEffect(function(){s.current=e},[e]),de.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var y=zU([e.lockRef.current],(e.shards||[]).map(WP),!0).filter(Boolean);return y.forEach(function(x){return x.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),y.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=de.useCallback(function(y,x){if("touches"in y&&y.touches.length===2)return!s.current.allowPinchZoom;var w=fp(y),S=n.current,C="deltaX"in y?y.deltaX:S[0]-w[0],P="deltaY"in y?y.deltaY:S[1]-w[1],O,k=y.target,A=Math.abs(C)>Math.abs(P)?"h":"v";if("touches"in y&&A==="h"&&k.type==="range")return!1;var L=zP(A,k);if(!L)return!0;if(L?O=A:(O=A==="v"?"h":"v",L=zP(A,k)),!L)return!1;if(!r.current&&"changedTouches"in y&&(C||P)&&(r.current=O),!O)return!0;var F=r.current||O;return pG(F,x,y,F==="h"?C:P,!0)},[]),l=de.useCallback(function(y){var x=y;if(!(!Ll.length||Ll[Ll.length-1]!==o)){var w="deltaY"in x?HP(x):fp(x),S=t.current.filter(function(O){return O.name===x.type&&O.target===x.target&&gG(O.delta,w)})[0];if(S&&S.should){x.cancelable&&x.preventDefault();return}if(!S){var C=(s.current.shards||[]).map(WP).filter(Boolean).filter(function(O){return O.contains(x.target)}),P=C.length>0?a(x,C[0]):!s.current.noIsolation;P&&x.cancelable&&x.preventDefault()}}},[]),c=de.useCallback(function(y,x,w,S){var C={name:y,delta:x,target:w,should:S};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(P){return P!==C})},1)},[]),d=de.useCallback(function(y){n.current=fp(y),r.current=void 0},[]),f=de.useCallback(function(y){c(y.type,HP(y),y.target,a(y,e.lockRef.current))},[]),g=de.useCallback(function(y){c(y.type,fp(y),y.target,a(y,e.lockRef.current))},[]);de.useEffect(function(){return Ll.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:g}),document.addEventListener("wheel",l,Rl),document.addEventListener("touchmove",l,Rl),document.addEventListener("touchstart",d,Rl),function(){Ll=Ll.filter(function(y){return y!==o}),document.removeEventListener("wheel",l,Rl),document.removeEventListener("touchmove",l,Rl),document.removeEventListener("touchstart",d,Rl)}},[]);var p=e.removeScrollBar,v=e.inert;return de.createElement(de.Fragment,null,v?de.createElement(o,{styles:mG(i)}):null,p?de.createElement(aG,{gapMode:"margin"}):null)}const yG=KU(LP,bG);var qP=de.forwardRef(function(e,t){return de.createElement(up,qi({},e,{ref:t,sideCar:yG}))});qP.classNames=up.classNames;const hp=qP,UP="Popover",[GP,tfe]=kn(UP,[ji]),sy=ji(),[xG,$l]=GP(UP),wG=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!1}=e,a=sy(t),l=m.useRef(null),[c,d]=m.useState(!1),[f=!1,g]=Jn({prop:r,defaultProp:i,onChange:o});return m.createElement(Eu,a,m.createElement(xG,{scope:t,contentId:sr(),triggerRef:l,open:f,onOpenChange:g,onOpenToggle:m.useCallback(()=>g(p=>!p),[g]),hasCustomAnchor:c,onCustomAnchorAdd:m.useCallback(()=>d(!0),[]),onCustomAnchorRemove:m.useCallback(()=>d(!1),[]),modal:s},n))},_G="PopoverTrigger",SG=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=$l(_G,n),o=sy(n),s=et(t,i.triggerRef),a=m.createElement(Ve.button,ae({type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":XP(i.open)},r,{ref:s,onClick:Ee(e.onClick,i.onOpenToggle)}));return i.hasCustomAnchor?a:m.createElement(Ou,ae({asChild:!0},o),a)}),YP="PopoverPortal",[CG,EG]=GP(YP,{forceMount:void 0}),OG=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,o=$l(YP,t);return m.createElement(CG,{scope:t,forceMount:n},m.createElement(bn,{present:n||o.open},m.createElement(Dh,{asChild:!0,container:i},r)))},Wu="PopoverContent",PG=m.forwardRef((e,t)=>{const n=EG(Wu,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,o=$l(Wu,e.__scopePopover);return m.createElement(bn,{present:r||o.open},o.modal?m.createElement(kG,ae({},i,{ref:t})):m.createElement(MG,ae({},i,{ref:t})))}),kG=m.forwardRef((e,t)=>{const n=$l(Wu,e.__scopePopover),r=m.useRef(null),i=et(t,r),o=m.useRef(!1);return m.useEffect(()=>{const s=r.current;if(s)return ap(s)},[]),m.createElement(hp,{as:ro,allowPinchZoom:!0},m.createElement(KP,ae({},e,{ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ee(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),o.current||(a=n.triggerRef.current)===null||a===void 0||a.focus()}),onPointerDownOutside:Ee(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;o.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Ee(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})))}),MG=m.forwardRef((e,t)=>{const n=$l(Wu,e.__scopePopover),r=m.useRef(!1),i=m.useRef(!1);return m.createElement(KP,ae({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s;if((s=e.onCloseAutoFocus)===null||s===void 0||s.call(e,o),!o.defaultPrevented){var a;r.current||(a=n.triggerRef.current)===null||a===void 0||a.focus(),o.preventDefault()}r.current=!1,i.current=!1},onInteractOutside:o=>{var s,a;(s=e.onInteractOutside)===null||s===void 0||s.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=o.target;((a=n.triggerRef.current)===null||a===void 0?void 0:a.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}}))}),KP=m.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,...f}=e,g=$l(Wu,n),p=sy(n);return rp(),m.createElement(ip,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o},m.createElement(_l,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>g.onOpenChange(!1)},m.createElement(Pu,ae({"data-state":XP(g.open),role:"dialog",id:g.contentId},p,f,{ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}}))))});function XP(e){return e?"open":"closed"}const DG=wG,TG=SG,AG=OG,QP=PG,pp=DG,gp=TG,qu=de.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>_.jsx(AG,{children:_.jsx(QP,{ref:i,align:t,sideOffset:n,className:Pe("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));qu.displayName=QP.displayName;function IG({filter:e,className:t}){const[n,r]=m.useState(!1),[i,o]=m.useState(),[s,a]=m.useState(),l=ge(C=>C.filterValues),c=ge(C=>C.authToken),d=ge(C=>C.actions.addOrUpdateFilterValue),f=ge(C=>C.actions.removeFilterValue),{data:g,isLoading:p,isFetching:v,isError:y,refetch:x}=Cr({queryKey:[e.sql],queryFn:()=>Ns("http://localhost:3000/api/v1/query",(c==null?void 0:c.accessToken)||"",{connection_id:e.connectionId,sql:e.sql}),enabled:!!e.sql&&!!e.connectionId&&!!e.database});m.useEffect(()=>{var C;if(((C=g==null?void 0:g.records)==null?void 0:C.length)>0){const P=g.records[0];if(!P.min||!P.max)return;o({from:new Date(P.min),to:new Date(P.max)}),a({from:new Date(P.min),to:new Date(P.max)})}},[g]),m.useEffect(()=>{if(l&&!l.find(P=>P.filterId===e.id)){o(s);return}},[l,e.id,s]);function w(){f(e.id),o(s),r(!1)}function S(){if(!i)return;console.log(i);const C=[i==null?void 0:i.from,i==null?void 0:i.to];console.log(C);const P={filterId:e.id,connectionType:e.database==="NA"?"api":"database",valueType:k0(e),name:e.column,operation:"between",values:C};d(P),r(!1)}return p?_.jsx("div",{children:_.jsx(cf,{className:" bg-foreground/10 h-8 w-[250px]"})}):y?_.jsx("div",{className:"bg-muted h-8 w-[250px] px-2",children:"Error"}):g?_.jsx("div",{className:Pe("grid gap-2",t),children:_.jsxs(pp,{open:n,onOpenChange:r,children:[_.jsx(gp,{asChild:!0,children:_.jsxs(it,{size:"sm",id:"date",variant:"outline",className:Pe("w-[250px] justify-start text-left font-normal rounded-sm h-[34px]",!i&&"text-muted-foreground"),children:[_.jsx(qB,{className:"mr-2 h-4 w-4"}),i!=null&&i.from?i.to?_.jsxs(_.Fragment,{children:[Wi(i.from,"LLL dd, y")," -"," ",Wi(i.to,"LLL dd, y")]}):Wi(i.from,"LLL dd, y"):_.jsx("span",{children:"Pick a date"})]})}),_.jsxs(qu,{className:"w-auto p-0",align:"start",children:[_.jsx(OP,{initialFocus:!0,mode:"range",defaultMonth:i==null?void 0:i.from,selected:i,onSelect:o,numberOfMonths:2}),_.jsxs("div",{className:"flex justify-end px-4 py-3 gap-2",children:[_.jsx(it,{size:"sm",variant:"outline",onClick:S,children:"Apply"}),_.jsx(it,{size:"sm",variant:"outline",onClick:w,children:"Clear"})]})]})]})}):null}function NG(){const e=ge(s=>s.dashboard.filters),t=ge(s=>s.isDashboardEditing),n=ge(s=>s.actions.removeFilter),r=ge(s=>s.actions.updateFilter),i=ge(s=>s.actions.removeFilterValue);if(!e)return null;const o=s=>Nu.includes(s.dataType)?_.jsx(IG,{filter:s}):_.jsx(HW,{filter:s});return _.jsx("section",{role:"dashboard-filters",className:" px-[10px] pt-2 grow w-full items-center flex gap-2 flex-wrap ",children:e.map(s=>_.jsxs("div",{children:[_.jsx(qc,{className:" my-1 ",text:s.title||s.column,onSave:a=>r({...s,title:a}),children:_.jsxs("div",{className:"flex items-center justify-between group mb-1",children:[_.jsxs("div",{className:"flex gap-1 items-center ",children:[_.jsx(rs,{className:" inline-block text-sm ",children:s.title}),t&&_.jsx(oa,{onClick:()=>{i(s.id),n(s.id)},className:"w-3 h-3 invisible text-muted-foreground group-hover:visible hover:text-foreground cursor-pointer"})]}),_.jsx("div",{onClick:()=>i(s.id),className:" text-xs invisible group-hover:visible group-hover:underline cursor-pointer text-muted-foreground hover:text-foreground",children:"Clear"})]})}),o(s)]},s.id))})}function JP(){const e=ge(i=>{var o;return(o=i.dashboard)==null?void 0:o.sheets});ge(i=>i.isDashboardEditing);const t=ge(i=>i.themeStyle);ge(i=>i.isVisualEditing);const n=ge(i=>i.selectedSheetId),r=ge(i=>i.actions.setSelectedSheetId);return ge(i=>i.actions.setSheetTitle),e?_.jsxs(a_,{role:"dashboard-tabs-container",className:Pe(" grow ",t==null?void 0:t.dashboardTabsContainer),onValueChange:i=>{r(i)},value:n||e[0].id,children:[_.jsx(NG,{}),e==null?void 0:e.map(i=>_.jsx(hf,{className:"mt-0",value:i.id,children:_.jsx(uH,{})},i.id))]}):null}function ZP({children:e}){const t=new DN;return _.jsx(XN,{defaultTheme:"dark",storageKey:"vite-ui-theme",children:_.jsx(FB,{delayDuration:0,children:_.jsx(RN,{client:t,children:e})})})}function ek(e){return _.jsx(ZP,{children:_.jsx(Kw,{...e,children:_.jsx(JP,{})})})}var RG=Object.defineProperty,LG=(e,t,n)=>t in e?RG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mp=(e,t,n)=>(LG(e,typeof t!="symbol"?t+"":t,n),n);const $G={stringify:e=>e,parse:e=>e},FG={stringify:e=>`${e}`,parse:e=>parseFloat(e)},jG={stringify:e=>e?"true":"false",parse:e=>/^[ty1-9]/i.test(e)},zG={stringify:e=>e.name,parse:(e,t)=>{const n=(()=>{if(typeof window<"u"&&e in window)return window[e];if(typeof global<"u"&&e in global)return global[e]})();return typeof n=="function"?n.bind(t):void 0}},BG={stringify:e=>JSON.stringify(e),parse:e=>JSON.parse(e)},ay={string:$G,number:FG,boolean:jG,function:zG,json:BG},ly=Symbol.for("r2wc.render"),vp=Symbol.for("r2wc.connected"),va=Symbol.for("r2wc.context"),ss=Symbol.for("r2wc.props");function VG(e,t,n){var r,i,o;t.props||(t.props=e.propTypes?Object.keys(e.propTypes):[]);const s=(Array.isArray(t.props)?t.props.slice():Object.keys(t.props)).filter(f=>f!=="container"),a={},l={},c={};for(const f of s){a[f]=Array.isArray(t.props)?"string":t.props[f];const g=HG(f);l[f]=g,c[g]=f}class d extends HTMLElement{constructor(){super(),mp(this,r,!0),mp(this,i),mp(this,o,{}),mp(this,"container"),t.shadow?this.container=this.attachShadow({mode:t.shadow}):this.container=this,this[ss].container=this.container;for(const g of s){const p=l[g],v=this.getAttribute(p),y=a[g],x=ay[y];v&&x!=null&&x.parse&&(this[ss][g]=x.parse(v,this))}}static get observedAttributes(){return Object.keys(c)}connectedCallback(){this[vp]=!0,this[ly]()}disconnectedCallback(){this[vp]=!1,this[va]&&n.unmount(this[va]),delete this[va]}attributeChangedCallback(g,p,v){const y=c[g],x=a[y],w=ay[x];y in a&&w!=null&&w.parse&&(this[ss][y]=w.parse(v,this),this[ly]())}[(r=vp,i=va,o=ss,ly)](){this[vp]&&(this[va]?n.update(this[va],this[ss]):this[va]=n.mount(this.container,e,this[ss]))}}for(const f of s){const g=l[f],p=a[f];Object.defineProperty(d.prototype,f,{enumerable:!0,configurable:!0,get(){return this[ss][f]},set(v){this[ss][f]=v;const y=ay[p];if(y!=null&&y.stringify){const x=y.stringify(v);this.getAttribute(g)!==x&&this.setAttribute(g,x)}}})}return d}function HG(e=""){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function WG(e,t,n){const r=nf(e),i=m.createElement(t,n);return r.render(i),{root:r,ReactComponent:t}}function qG({root:e,ReactComponent:t},n){const r=m.createElement(t,n);e.render(r)}function UG({root:e}){e.unmount()}function GG(e,t={}){return VG(e,t,{mount:WG,update:qG,unmount:UG})}const YG=GG(ek,{props:{id:"string",authToken:"json",currentTheme:"string",style:"json",onEvent:"function",onSave:"function",LoadingComponent:"function",ErrorComponent:"function"}}),cy=["Enter"," "],KG=["ArrowDown","PageUp","Home"],tk=["ArrowUp","PageDown","End"],XG=[...KG,...tk],QG={ltr:[...cy,"ArrowRight"],rtl:[...cy,"ArrowLeft"]},JG={ltr:["ArrowLeft"],rtl:["ArrowRight"]},bp="Menu",[Uu,ZG,eY]=df(bp),[ba,nk]=kn(bp,[eY,ji,ol]),uy=ji(),rk=ol(),[tY,ya]=ba(bp),[nY,Gu]=ba(bp),rY=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:o,modal:s=!0}=e,a=uy(t),[l,c]=m.useState(null),d=m.useRef(!1),f=wn(o),g=js(i);return m.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),m.createElement(Eu,a,m.createElement(tY,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:c},m.createElement(nY,{scope:t,onClose:m.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:g,modal:s},r)))},ik=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=uy(n);return m.createElement(Ou,ae({},i,r,{ref:t}))}),ok="MenuPortal",[iY,sk]=ba(ok,{forceMount:void 0}),oY=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,o=ya(ok,t);return m.createElement(iY,{scope:t,forceMount:n},m.createElement(bn,{present:n||o.open},m.createElement(Dh,{asChild:!0,container:i},r)))},_i="MenuContent",[sY,dy]=ba(_i),aY=m.forwardRef((e,t)=>{const n=sk(_i,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=ya(_i,e.__scopeMenu),s=Gu(_i,e.__scopeMenu);return m.createElement(Uu.Provider,{scope:e.__scopeMenu},m.createElement(bn,{present:r||o.open},m.createElement(Uu.Slot,{scope:e.__scopeMenu},s.modal?m.createElement(lY,ae({},i,{ref:t})):m.createElement(cY,ae({},i,{ref:t})))))}),lY=m.forwardRef((e,t)=>{const n=ya(_i,e.__scopeMenu),r=m.useRef(null),i=et(t,r);return m.useEffect(()=>{const o=r.current;if(o)return ap(o)},[]),m.createElement(fy,ae({},e,{ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ee(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))}),cY=m.forwardRef((e,t)=>{const n=ya(_i,e.__scopeMenu);return m.createElement(fy,ae({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))}),fy=m.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:g,onDismiss:p,disableOutsideScroll:v,...y}=e,x=ya(_i,n),w=Gu(_i,n),S=uy(n),C=rk(n),P=ZG(n),[O,k]=m.useState(null),A=m.useRef(null),L=et(t,A,x.onContentChange),F=m.useRef(0),j=m.useRef(""),B=m.useRef(0),H=m.useRef(null),K=m.useRef("right"),Y=m.useRef(0),$=v?hp:m.Fragment,Z=v?{as:ro,allowPinchZoom:!0}:void 0,U=le=>{var M,W;const ne=j.current+le,N=P().filter(ee=>!ee.disabled),X=document.activeElement,me=(M=N.find(ee=>ee.ref.current===X))===null||M===void 0?void 0:M.textValue,he=N.map(ee=>ee.textValue),fe=kY(he,ne,me),re=(W=N.find(ee=>ee.textValue===fe))===null||W===void 0?void 0:W.ref.current;(function ee(oe){j.current=oe,window.clearTimeout(F.current),oe!==""&&(F.current=window.setTimeout(()=>ee(""),1e3))})(ne),re&&setTimeout(()=>re.focus())};m.useEffect(()=>()=>window.clearTimeout(F.current),[]),rp();const ie=m.useCallback(le=>{var M,W;return K.current===((M=H.current)===null||M===void 0?void 0:M.side)&&DY(le,(W=H.current)===null||W===void 0?void 0:W.area)},[]);return m.createElement(sY,{scope:n,searchRef:j,onItemEnter:m.useCallback(le=>{ie(le)&&le.preventDefault()},[ie]),onItemLeave:m.useCallback(le=>{var M;ie(le)||((M=A.current)===null||M===void 0||M.focus(),k(null))},[ie]),onTriggerLeave:m.useCallback(le=>{ie(le)&&le.preventDefault()},[ie]),pointerGraceTimerRef:B,onPointerGraceIntentChange:m.useCallback(le=>{H.current=le},[])},m.createElement($,Z,m.createElement(ip,{asChild:!0,trapped:i,onMountAutoFocus:Ee(o,le=>{var M;le.preventDefault(),(M=A.current)===null||M===void 0||M.focus()}),onUnmountAutoFocus:s},m.createElement(_l,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:g,onDismiss:p},m.createElement(Dm,ae({asChild:!0},C,{dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:O,onCurrentTabStopIdChange:k,onEntryFocus:Ee(l,le=>{w.isUsingKeyboardRef.current||le.preventDefault()})}),m.createElement(Pu,ae({role:"menu","aria-orientation":"vertical","data-state":fk(x.open),"data-radix-menu-content":"",dir:w.dir},S,y,{ref:L,style:{outline:"none",...y.style},onKeyDown:Ee(y.onKeyDown,le=>{const W=le.target.closest("[data-radix-menu-content]")===le.currentTarget,ne=le.ctrlKey||le.altKey||le.metaKey,N=le.key.length===1;W&&(le.key==="Tab"&&le.preventDefault(),!ne&&N&&U(le.key));const X=A.current;if(le.target!==X||!XG.includes(le.key))return;le.preventDefault();const he=P().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);tk.includes(le.key)&&he.reverse(),OY(he)}),onBlur:Ee(e.onBlur,le=>{le.currentTarget.contains(le.target)||(window.clearTimeout(F.current),j.current="")}),onPointerMove:Ee(e.onPointerMove,Yu(le=>{const M=le.target,W=Y.current!==le.clientX;if(le.currentTarget.contains(M)&&W){const ne=le.clientX>Y.current?"right":"left";K.current=ne,Y.current=le.clientX}}))})))))))}),uY=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Ve.div,ae({role:"group"},r,{ref:t}))}),dY=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Ve.div,ae({},r,{ref:t}))}),hy="MenuItem",ak="menu.itemSelect",py=m.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,o=m.useRef(null),s=Gu(hy,e.__scopeMenu),a=dy(hy,e.__scopeMenu),l=et(t,o),c=m.useRef(!1),d=()=>{const f=o.current;if(!n&&f){const g=new CustomEvent(ak,{bubbles:!0,cancelable:!0});f.addEventListener(ak,p=>r==null?void 0:r(p),{once:!0}),Qw(f,g),g.defaultPrevented?c.current=!1:s.onClose()}};return m.createElement(lk,ae({},i,{ref:l,disabled:n,onClick:Ee(e.onClick,d),onPointerDown:f=>{var g;(g=e.onPointerDown)===null||g===void 0||g.call(e,f),c.current=!0},onPointerUp:Ee(e.onPointerUp,f=>{var g;c.current||(g=f.currentTarget)===null||g===void 0||g.click()}),onKeyDown:Ee(e.onKeyDown,f=>{const g=a.searchRef.current!=="";n||g&&f.key===" "||cy.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})}))}),lk=m.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=e,s=dy(hy,n),a=rk(n),l=m.useRef(null),c=et(t,l),[d,f]=m.useState(!1),[g,p]=m.useState("");return m.useEffect(()=>{const v=l.current;if(v){var y;p(((y=v.textContent)!==null&&y!==void 0?y:"").trim())}},[o.children]),m.createElement(Uu.ItemSlot,{scope:n,disabled:r,textValue:i??g},m.createElement(Tm,ae({asChild:!0},a,{focusable:!r}),m.createElement(Ve.div,ae({role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},o,{ref:c,onPointerMove:Ee(e.onPointerMove,Yu(v=>{r?s.onItemLeave(v):(s.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus())})),onPointerLeave:Ee(e.onPointerLeave,Yu(v=>s.onItemLeave(v))),onFocus:Ee(e.onFocus,()=>f(!0)),onBlur:Ee(e.onBlur,()=>f(!1))}))))}),fY=m.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return m.createElement(uk,{scope:e.__scopeMenu,checked:n},m.createElement(py,ae({role:"menuitemcheckbox","aria-checked":xp(n)?"mixed":n},i,{ref:t,"data-state":gy(n),onSelect:Ee(i.onSelect,()=>r==null?void 0:r(xp(n)?!0:!n),{checkForDefaultPrevented:!1})})))}),hY="MenuRadioGroup",[pY,gY]=ba(hY,{value:void 0,onValueChange:()=>{}}),mY=m.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,o=wn(r);return m.createElement(pY,{scope:e.__scopeMenu,value:n,onValueChange:o},m.createElement(uY,ae({},i,{ref:t})))}),vY="MenuRadioItem",bY=m.forwardRef((e,t)=>{const{value:n,...r}=e,i=gY(vY,e.__scopeMenu),o=n===i.value;return m.createElement(uk,{scope:e.__scopeMenu,checked:o},m.createElement(py,ae({role:"menuitemradio","aria-checked":o},r,{ref:t,"data-state":gy(o),onSelect:Ee(r.onSelect,()=>{var s;return(s=i.onValueChange)===null||s===void 0?void 0:s.call(i,n)},{checkForDefaultPrevented:!1})})))}),ck="MenuItemIndicator",[uk,yY]=ba(ck,{checked:!1}),xY=m.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,o=yY(ck,n);return m.createElement(bn,{present:r||xp(o.checked)||o.checked===!0},m.createElement(Ve.span,ae({},i,{ref:t,"data-state":gy(o.checked)})))}),wY=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Ve.div,ae({role:"separator","aria-orientation":"horizontal"},r,{ref:t}))}),_Y="MenuSub",[rfe,dk]=ba(_Y),yp="MenuSubTrigger",SY=m.forwardRef((e,t)=>{const n=ya(yp,e.__scopeMenu),r=Gu(yp,e.__scopeMenu),i=dk(yp,e.__scopeMenu),o=dy(yp,e.__scopeMenu),s=m.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=o,c={__scopeMenu:e.__scopeMenu},d=m.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return m.useEffect(()=>d,[d]),m.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),l(null)}},[a,l]),m.createElement(ik,ae({asChild:!0},c),m.createElement(lk,ae({id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":fk(n.open)},e,{ref:uf(t,i.onTriggerChange),onClick:f=>{var g;(g=e.onClick)===null||g===void 0||g.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ee(e.onPointerMove,Yu(f=>{o.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Ee(e.onPointerLeave,Yu(f=>{var g;d();const p=(g=n.content)===null||g===void 0?void 0:g.getBoundingClientRect();if(p){var v;const y=(v=n.content)===null||v===void 0?void 0:v.dataset.side,x=y==="right",w=x?-5:5,S=p[x?"left":"right"],C=p[x?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+w,y:f.clientY},{x:S,y:p.top},{x:C,y:p.top},{x:C,y:p.bottom},{x:S,y:p.bottom}],side:y}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Ee(e.onKeyDown,f=>{const g=o.searchRef.current!=="";if(!(e.disabled||g&&f.key===" ")&&QG[r.dir].includes(f.key)){var p;n.onOpenChange(!0),(p=n.content)===null||p===void 0||p.focus(),f.preventDefault()}})})))}),CY="MenuSubContent",EY=m.forwardRef((e,t)=>{const n=sk(_i,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=ya(_i,e.__scopeMenu),s=Gu(_i,e.__scopeMenu),a=dk(CY,e.__scopeMenu),l=m.useRef(null),c=et(t,l);return m.createElement(Uu.Provider,{scope:e.__scopeMenu},m.createElement(bn,{present:r||o.open},m.createElement(Uu.Slot,{scope:e.__scopeMenu},m.createElement(fy,ae({id:a.contentId,"aria-labelledby":a.triggerId},i,{ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;s.isUsingKeyboardRef.current&&((f=l.current)===null||f===void 0||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Ee(e.onFocusOutside,d=>{d.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Ee(e.onEscapeKeyDown,d=>{s.onClose(),d.preventDefault()}),onKeyDown:Ee(e.onKeyDown,d=>{const f=d.currentTarget.contains(d.target),g=JG[s.dir].includes(d.key);if(f&&g){var p;o.onOpenChange(!1),(p=a.trigger)===null||p===void 0||p.focus(),d.preventDefault()}})})))))});function fk(e){return e?"open":"closed"}function xp(e){return e==="indeterminate"}function gy(e){return xp(e)?"indeterminate":e?"checked":"unchecked"}function OY(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function PY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function kY(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let s=PY(e,Math.max(o,0));i.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function MY(e,t){const{x:n,y:r}=e;let i=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){const a=t[o].x,l=t[o].y,c=t[s].x,d=t[s].y;l>r!=d>r&&n<(c-a)*(r-l)/(d-l)+a&&(i=!i)}return i}function DY(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return MY(n,t)}function Yu(e){return t=>t.pointerType==="mouse"?e(t):void 0}const TY=rY,AY=ik,IY=oY,NY=aY,RY=dY,LY=py,$Y=fY,FY=mY,jY=bY,zY=xY,BY=wY,VY=SY,HY=EY,hk="DropdownMenu",[WY,ife]=kn(hk,[nk]),Rr=nk(),[qY,pk]=WY(hk),UY=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,l=Rr(t),c=m.useRef(null),[d=!1,f]=Jn({prop:i,defaultProp:o,onChange:s});return m.createElement(qY,{scope:t,triggerId:sr(),triggerRef:c,contentId:sr(),open:d,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(g=>!g),[f]),modal:a},m.createElement(TY,ae({},l,{open:d,onOpenChange:f,dir:r,modal:a}),n))},GY="DropdownMenuTrigger",YY=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,o=pk(GY,n),s=Rr(n);return m.createElement(AY,ae({asChild:!0},s),m.createElement(Ve.button,ae({type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r},i,{ref:uf(t,o.triggerRef),onPointerDown:Ee(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:Ee(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})))}),KY=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Rr(t);return m.createElement(IY,ae({},r,n))},XY="DropdownMenuContent",QY=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=pk(XY,n),o=Rr(n),s=m.useRef(!1);return m.createElement(NY,ae({id:i.contentId,"aria-labelledby":i.triggerId},o,r,{ref:t,onCloseAutoFocus:Ee(e.onCloseAutoFocus,a=>{var l;s.current||(l=i.triggerRef.current)===null||l===void 0||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:Ee(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;(!i.modal||d)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),JY=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement(RY,ae({},i,r,{ref:t}))}),ZY=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement(LY,ae({},i,r,{ref:t}))}),eK=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement($Y,ae({},i,r,{ref:t}))}),tK=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement(FY,ae({},i,r,{ref:t}))}),nK=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement(jY,ae({},i,r,{ref:t}))}),rK=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement(zY,ae({},i,r,{ref:t}))}),iK=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement(BY,ae({},i,r,{ref:t}))}),oK=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement(VY,ae({},i,r,{ref:t}))}),sK=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement(HY,ae({},i,r,{ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),aK=UY,lK=YY,cK=KY,gk=QY,mk=JY,vk=ZY,bk=eK,uK=tK,yk=nK,xk=rK,wk=iK,_k=oK,Sk=sK,Ck=aK,Ek=lK,dK=uK,fK=de.forwardRef(({className:e,inset:t,children:n,...r},i)=>_.jsxs(_k,{ref:i,className:Pe("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,_.jsx(V2,{className:"ml-auto h-4 w-4"})]}));fK.displayName=_k.displayName;const hK=de.forwardRef(({className:e,...t},n)=>_.jsx(Sk,{ref:n,className:Pe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));hK.displayName=Sk.displayName;const my=de.forwardRef(({className:e,sideOffset:t=4,...n},r)=>_.jsx(cK,{children:_.jsx(gk,{ref:r,sideOffset:t,className:Pe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));my.displayName=gk.displayName;const wp=de.forwardRef(({className:e,inset:t,...n},r)=>_.jsx(vk,{ref:r,className:Pe("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));wp.displayName=vk.displayName;const pK=de.forwardRef(({className:e,children:t,checked:n,...r},i)=>_.jsxs(bk,{ref:i,className:Pe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[_.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:_.jsx(xk,{children:_.jsx(Rh,{className:"h-4 w-4"})})}),t]}));pK.displayName=bk.displayName;const vy=de.forwardRef(({className:e,children:t,...n},r)=>_.jsxs(yk,{ref:r,className:Pe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[_.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:_.jsx(xk,{children:_.jsx(H2,{className:"h-2 w-2 fill-current"})})}),t]}));vy.displayName=yk.displayName;const Ok=de.forwardRef(({className:e,inset:t,...n},r)=>_.jsx(mk,{ref:r,className:Pe("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Ok.displayName=mk.displayName;const Pk=de.forwardRef(({className:e,...t},n)=>_.jsx(wk,{ref:n,className:Pe("-mx-1 my-1 h-px bg-muted",e),...t}));Pk.displayName=wk.displayName;function gK(){const{setTheme:e}=Em(),t=ge(n=>n.actions.setDashboardTheme);return _.jsxs(Ck,{children:[_.jsx(Ek,{asChild:!0,children:_.jsxs(it,{className:"h-7 p-2",variant:"outline",size:"sm",children:[_.jsx(rV,{strokeWidth:1.5,className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),_.jsx(JB,{strokeWidth:1.5,className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),_.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),_.jsxs(my,{align:"end",children:[_.jsx(wp,{onClick:()=>{e("light"),t("light")},children:"Light"}),_.jsx(wp,{onClick:()=>{e("dark"),t("dark")},children:"Dark"}),_.jsx(wp,{onClick:()=>{e("system"),t("system")},children:"System"})]})]})}function by(e){var t;return{...e,sheets:(t=e==null?void 0:e.sheets)==null?void 0:t.map(n=>{var r;return{...n,cards:(r=n==null?void 0:n.cards)==null?void 0:r.map(i=>kk(i))}})}}function kk(e){var t,n,r,i;return{...e,cfg:{...e.cfg,data:{...(t=e.cfg)==null?void 0:t.data,labels:[],datasets:(i=(r=(n=e.cfg)==null?void 0:n.data)==null?void 0:r.datasets)==null?void 0:i.map(o=>({...o,data:[]}))}},customCfg:mK(e.customCfg),data:[]}}function mK(e){var t,n;return e?{...e,data:{...e==null?void 0:e.data,labels:[],datasets:(n=(t=e==null?void 0:e.data)==null?void 0:t.datasets)==null?void 0:n.map(r=>({...r,data:[]}))}}:null}function as(e){return`semaphor:bookmark:${e}`}const Mk="Dialog",[Dk,ofe]=kn(Mk),[vK,Si]=Dk(Mk),bK=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=e,a=m.useRef(null),l=m.useRef(null),[c=!1,d]=Jn({prop:r,defaultProp:i,onChange:o});return m.createElement(vK,{scope:t,triggerRef:a,contentRef:l,contentId:sr(),titleId:sr(),descriptionId:sr(),open:c,onOpenChange:d,onOpenToggle:m.useCallback(()=>d(f=>!f),[d]),modal:s},n)},yK="DialogTrigger",xK=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Si(yK,n),o=et(t,i.triggerRef);return m.createElement(Ve.button,ae({type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":xy(i.open)},r,{ref:o,onClick:Ee(e.onClick,i.onOpenToggle)}))}),Tk="DialogPortal",[wK,Ak]=Dk(Tk,{forceMount:void 0}),_K=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,o=Si(Tk,t);return m.createElement(wK,{scope:t,forceMount:n},m.Children.map(r,s=>m.createElement(bn,{present:n||o.open},m.createElement(Dh,{asChild:!0,container:i},s))))},yy="DialogOverlay",SK=m.forwardRef((e,t)=>{const n=Ak(yy,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Si(yy,e.__scopeDialog);return o.modal?m.createElement(bn,{present:r||o.open},m.createElement(CK,ae({},i,{ref:t}))):null}),CK=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Si(yy,n);return m.createElement(hp,{as:ro,allowPinchZoom:!0,shards:[i.contentRef]},m.createElement(Ve.div,ae({"data-state":xy(i.open)},r,{ref:t,style:{pointerEvents:"auto",...r.style}})))}),Ku="DialogContent",EK=m.forwardRef((e,t)=>{const n=Ak(Ku,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Si(Ku,e.__scopeDialog);return m.createElement(bn,{present:r||o.open},o.modal?m.createElement(OK,ae({},i,{ref:t})):m.createElement(PK,ae({},i,{ref:t})))}),OK=m.forwardRef((e,t)=>{const n=Si(Ku,e.__scopeDialog),r=m.useRef(null),i=et(t,n.contentRef,r);return m.useEffect(()=>{const o=r.current;if(o)return ap(o)},[]),m.createElement(Ik,ae({},e,{ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ee(e.onCloseAutoFocus,o=>{var s;o.preventDefault(),(s=n.triggerRef.current)===null||s===void 0||s.focus()}),onPointerDownOutside:Ee(e.onPointerDownOutside,o=>{const s=o.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&o.preventDefault()}),onFocusOutside:Ee(e.onFocusOutside,o=>o.preventDefault())}))}),PK=m.forwardRef((e,t)=>{const n=Si(Ku,e.__scopeDialog),r=m.useRef(!1),i=m.useRef(!1);return m.createElement(Ik,ae({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s;if((s=e.onCloseAutoFocus)===null||s===void 0||s.call(e,o),!o.defaultPrevented){var a;r.current||(a=n.triggerRef.current)===null||a===void 0||a.focus(),o.preventDefault()}r.current=!1,i.current=!1},onInteractOutside:o=>{var s,a;(s=e.onInteractOutside)===null||s===void 0||s.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=o.target;((a=n.triggerRef.current)===null||a===void 0?void 0:a.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}}))}),Ik=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=e,a=Si(Ku,n),l=m.useRef(null),c=et(t,l);return rp(),m.createElement(m.Fragment,null,m.createElement(ip,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o},m.createElement(_l,ae({role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":xy(a.open)},s,{ref:c,onDismiss:()=>a.onOpenChange(!1)}))),!1)}),kK="DialogTitle",MK=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Si(kK,n);return m.createElement(Ve.h2,ae({id:i.titleId},r,{ref:t}))}),DK="DialogDescription",TK=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Si(DK,n);return m.createElement(Ve.p,ae({id:i.descriptionId},r,{ref:t}))}),AK="DialogClose",IK=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Si(AK,n);return m.createElement(Ve.button,ae({type:"button"},r,{ref:t,onClick:Ee(e.onClick,()=>i.onOpenChange(!1))}))});function xy(e){return e?"open":"closed"}const NK=bK,RK=xK,LK=_K,Nk=SK,Rk=EK,Lk=MK,$k=TK,$K=IK,wy=NK,_y=RK,FK=LK,Fk=de.forwardRef(({className:e,...t},n)=>_.jsx(Nk,{ref:n,className:Pe("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Fk.displayName=Nk.displayName;const _p=de.forwardRef(({className:e,children:t,...n},r)=>_.jsxs(FK,{children:[_.jsx(Fk,{}),_.jsxs(Rk,{ref:r,className:Pe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,_.jsxs($K,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[_.jsx(sV,{className:"h-4 w-4"}),_.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_p.displayName=Rk.displayName;const Sp=({className:e,...t})=>_.jsx("div",{className:Pe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Sp.displayName="DialogHeader";const Sy=({className:e,...t})=>_.jsx("div",{className:Pe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Sy.displayName="DialogFooter";const Cp=de.forwardRef(({className:e,...t},n)=>_.jsx(Lk,{ref:n,className:Pe("text-lg font-semibold leading-none tracking-tight",e),...t}));Cp.displayName=Lk.displayName;const Ep=de.forwardRef(({className:e,...t},n)=>_.jsx($k,{ref:n,className:Pe("text-sm text-muted-foreground",e),...t}));Ep.displayName=$k.displayName;const Xu=de.forwardRef(({className:e,type:t,...n},r)=>_.jsx("input",{type:t,className:Pe("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Xu.displayName="Input";function jK(){const[e,t]=m.useState(""),[n,r]=m.useState(!1),[i,o]=m.useState(!1),s=ge(l=>l.dashboard);function a(){const l=by(s),c=as(s.id),d=JSON.parse(localStorage.getItem(c)||"[]");if(d.some(g=>g.name===e)){r(!0);return}d.push({name:e,template:l}),localStorage.setItem(c,JSON.stringify(d)),o(!1)}return _.jsxs(wy,{open:i,onOpenChange:o,children:[_.jsx(_y,{asChild:!0,children:_.jsxs(it,{variant:"outline",className:"h-7 p-2",size:"sm",children:[_.jsx(G2,{className:" mr-2 h-4 w-4",strokeWidth:1.5}),"Add Lens"]})}),_.jsxs(_p,{className:"sm:max-w-[425px]",children:[_.jsxs(Sp,{children:[_.jsx(Cp,{children:"Add a Lens"}),_.jsx(Ep,{children:"Lenses are private by default and are only visible to you."})]}),_.jsx("div",{className:"grid gap-4 py-4",children:_.jsxs("div",{className:"grid grid-cols-8 items-center gap-4",children:[_.jsx(rs,{className:"text-right",children:"Name"}),_.jsx(Xu,{value:e,onChange:l=>{n&&r(!1),t(l.target.value)},id:"name",className:"col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"})]})}),n&&_.jsx("p",{className:"text-sm",children:"The bookmark name already exists. Use a differnet name."}),_.jsx(Sy,{children:_.jsx(it,{variant:"outline",type:"submit",disabled:!e,onClick:a,children:"Save"})})]})]})}function zK(){const[e,t]=m.useState(!1),[n,r]=m.useState(""),i=ge(p=>p.dashboard),o=ge(p=>p.bookmarkKey),[s,a]=m.useState([]),l=ge(p=>p.actions.setDashboard),c=ge(p=>p.actions.setFilterValues),d=ge(p=>p.actions.setBookmarkKey);m.useEffect(()=>{const p=as(i.id),v=JSON.parse(localStorage.getItem(p)||"[]");a(v);const y=v.find(x=>x.default);y&&y.name===o&&r(y.name)},[e,i,o]);function f(p){if(p===n)return;const v=s.find(x=>x.name===p),y=v==null?void 0:v.template;y&&(l(y),c(v.filterValues||[]),d(p==="Original"?"":p)),r(p)}function g(p){const v=as(i.id),x=JSON.parse(localStorage.getItem(v)||"[]").filter(w=>w.name!==p);localStorage.setItem(v,JSON.stringify(x)),a(x)}return _.jsxs(Ck,{open:e,onOpenChange:t,children:[_.jsx(Ek,{asChild:!0,children:_.jsx(it,{variant:"outline",className:"h-7 p-2",children:_.jsx(XB,{className:"h-4 w-4",strokeWidth:1.5})})}),_.jsxs(my,{className:"w-56",children:[_.jsx(Ok,{children:"Lenses"}),_.jsx(Pk,{}),_.jsxs(dK,{value:n,onValueChange:f,children:[_.jsx(vy,{value:"Original",children:"Original"}),s.filter(p=>p.name!="Original").map((p,v)=>_.jsxs(vy,{className:"xbg-red-100 flex justify-between",value:p.name,defaultChecked:p.name===o,children:[_.jsx("p",{children:p.name}),_.jsx(oa,{onClick:y=>{y.preventDefault(),g(p.name)},className:"h-3 w-3 hover:cursor-pointer",strokeWidth:1.5})]},v))]})]})]})}function Op(e){const t=m.useRef({value:e,previous:e});return m.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}const jk="Checkbox",[BK,sfe]=kn(jk),[VK,HK]=BK(jk),WK=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:l="on",onCheckedChange:c,...d}=e,[f,g]=m.useState(null),p=et(t,C=>g(C)),v=m.useRef(!1),y=f?!!f.closest("form"):!0,[x=!1,w]=Jn({prop:i,defaultProp:o,onChange:c}),S=m.useRef(x);return m.useEffect(()=>{const C=f==null?void 0:f.form;if(C){const P=()=>w(S.current);return C.addEventListener("reset",P),()=>C.removeEventListener("reset",P)}},[f,w]),m.createElement(VK,{scope:n,state:x,disabled:a},m.createElement(Ve.button,ae({type:"button",role:"checkbox","aria-checked":xa(x)?"mixed":x,"aria-required":s,"data-state":zk(x),"data-disabled":a?"":void 0,disabled:a,value:l},d,{ref:p,onKeyDown:Ee(e.onKeyDown,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:Ee(e.onClick,C=>{w(P=>xa(P)?!0:!P),y&&(v.current=C.isPropagationStopped(),v.current||C.stopPropagation())})})),y&&m.createElement(GK,{control:f,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,style:{transform:"translateX(-100%)"}}))}),qK="CheckboxIndicator",UK=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=HK(qK,n);return m.createElement(bn,{present:r||xa(o.state)||o.state===!0},m.createElement(Ve.span,ae({"data-state":zk(o.state),"data-disabled":o.disabled?"":void 0},i,{ref:t,style:{pointerEvents:"none",...e.style}})))}),GK=e=>{const{control:t,checked:n,bubbles:r=!0,...i}=e,o=m.useRef(null),s=Op(n),a=Mh(t);return m.useEffect(()=>{const l=o.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&f){const g=new Event("click",{bubbles:r});l.indeterminate=xa(n),f.call(l,xa(n)?!1:n),l.dispatchEvent(g)}},[s,n,r]),m.createElement("input",ae({type:"checkbox","aria-hidden":!0,defaultChecked:xa(n)?!1:n},i,{tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function xa(e){return e==="indeterminate"}function zk(e){return xa(e)?"indeterminate":e?"checked":"unchecked"}const Bk=WK,YK=UK,Pp=de.forwardRef(({className:e,...t},n)=>_.jsx(Bk,{ref:n,className:Pe("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:_.jsx(YK,{className:Pe("flex items-center justify-center text-current"),children:_.jsx(Rh,{className:"h-4 w-4"})})}));Pp.displayName=Bk.displayName;function KK(){const[e,t]=m.useState(!1),n=ge(o=>o.dashboard),r=ge(o=>o.bookmarkKey);m.useEffect(()=>{if(!r){t(!1);return}const o=as(n.id),a=JSON.parse(localStorage.getItem(o)||"[]").find(l=>l.name===r);t(a?a.default:!1)},[r,n.id]);function i(o){if(t(o),!r)return;const s=as(n.id),l=JSON.parse(localStorage.getItem(s)||"[]").map(c=>(c.name===r?c.default=o:c.default=!1,c));console.log(l),localStorage.setItem(s,JSON.stringify(l))}return _.jsxs("div",{className:"flex items-center space-x-2",children:[_.jsx(Pp,{checked:e,onCheckedChange:i,id:"terms"}),_.jsx("label",{htmlFor:"terms",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Set as default"})]})}function XK(){const e=ge(P=>P.bookmarkKey),t=ge(P=>P.dashboard),n=ge(P=>P.selectedSheetId),r=ge(P=>P.isDashboardEditing),i=ge(P=>P.filterValues),o=ge(P=>P.isVisualEditing),s=ge(P=>P.showFilters),a=ge(P=>P.showDashboardJSON),l=ge(P=>P.actions.setShowDashboardJSON),c=ge(P=>P.onSaveFunction),d=ge(P=>P.actions.setShowFilters),{addCard:f,getSelectedSheet:g,setIsDashboardEditing:p,setSelectedCardId:v,setSelectedCard:y}=ge(P=>P.actions),x=g(),w=()=>{if(!r||!x)return;const P={id:wu(),title:"New Card",description:"New Card Description",preferences:{filterOnClick:!0},type:"bar",sql:"select COUNT(*) from YOUR_TABLE",data:[]};f(x.id,P),v(n,P.id),y(P)},S=()=>{p(!0)};function C(){if(!e||e==="")return;const P=by(t),O=as(t.id),k=JSON.parse(localStorage.getItem(O)||"[]"),A=k.findIndex(L=>L.name===e);A!==-1?k[A]={name:e,template:P,default:k[A].default,filterValues:i}:k.push({name:e,template:P,filterValues:i}),localStorage.setItem(O,JSON.stringify(k)),c==null||c(P)}return _.jsxs("div",{className:`flex items-center justify-between gap-2
427
+ `)},vG=0,Ll=[];function bG(e){var t=de.useRef([]),n=de.useRef([0,0]),r=de.useRef(),i=de.useState(vG++)[0],o=de.useState(function(){return FP()})[0],s=de.useRef(e);de.useEffect(function(){s.current=e},[e]),de.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var y=zU([e.lockRef.current],(e.shards||[]).map(WP),!0).filter(Boolean);return y.forEach(function(x){return x.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),y.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=de.useCallback(function(y,x){if("touches"in y&&y.touches.length===2)return!s.current.allowPinchZoom;var w=fp(y),S=n.current,C="deltaX"in y?y.deltaX:S[0]-w[0],P="deltaY"in y?y.deltaY:S[1]-w[1],O,k=y.target,A=Math.abs(C)>Math.abs(P)?"h":"v";if("touches"in y&&A==="h"&&k.type==="range")return!1;var L=zP(A,k);if(!L)return!0;if(L?O=A:(O=A==="v"?"h":"v",L=zP(A,k)),!L)return!1;if(!r.current&&"changedTouches"in y&&(C||P)&&(r.current=O),!O)return!0;var F=r.current||O;return pG(F,x,y,F==="h"?C:P,!0)},[]),l=de.useCallback(function(y){var x=y;if(!(!Ll.length||Ll[Ll.length-1]!==o)){var w="deltaY"in x?HP(x):fp(x),S=t.current.filter(function(O){return O.name===x.type&&O.target===x.target&&gG(O.delta,w)})[0];if(S&&S.should){x.cancelable&&x.preventDefault();return}if(!S){var C=(s.current.shards||[]).map(WP).filter(Boolean).filter(function(O){return O.contains(x.target)}),P=C.length>0?a(x,C[0]):!s.current.noIsolation;P&&x.cancelable&&x.preventDefault()}}},[]),c=de.useCallback(function(y,x,w,S){var C={name:y,delta:x,target:w,should:S};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(P){return P!==C})},1)},[]),d=de.useCallback(function(y){n.current=fp(y),r.current=void 0},[]),f=de.useCallback(function(y){c(y.type,HP(y),y.target,a(y,e.lockRef.current))},[]),g=de.useCallback(function(y){c(y.type,fp(y),y.target,a(y,e.lockRef.current))},[]);de.useEffect(function(){return Ll.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:g}),document.addEventListener("wheel",l,Rl),document.addEventListener("touchmove",l,Rl),document.addEventListener("touchstart",d,Rl),function(){Ll=Ll.filter(function(y){return y!==o}),document.removeEventListener("wheel",l,Rl),document.removeEventListener("touchmove",l,Rl),document.removeEventListener("touchstart",d,Rl)}},[]);var p=e.removeScrollBar,v=e.inert;return de.createElement(de.Fragment,null,v?de.createElement(o,{styles:mG(i)}):null,p?de.createElement(aG,{gapMode:"margin"}):null)}const yG=KU(LP,bG);var qP=de.forwardRef(function(e,t){return de.createElement(up,qi({},e,{ref:t,sideCar:yG}))});qP.classNames=up.classNames;const hp=qP,UP="Popover",[GP,tfe]=kn(UP,[ji]),sy=ji(),[xG,$l]=GP(UP),wG=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!1}=e,a=sy(t),l=m.useRef(null),[c,d]=m.useState(!1),[f=!1,g]=Jn({prop:r,defaultProp:i,onChange:o});return m.createElement(Eu,a,m.createElement(xG,{scope:t,contentId:sr(),triggerRef:l,open:f,onOpenChange:g,onOpenToggle:m.useCallback(()=>g(p=>!p),[g]),hasCustomAnchor:c,onCustomAnchorAdd:m.useCallback(()=>d(!0),[]),onCustomAnchorRemove:m.useCallback(()=>d(!1),[]),modal:s},n))},_G="PopoverTrigger",SG=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=$l(_G,n),o=sy(n),s=et(t,i.triggerRef),a=m.createElement(Ve.button,ae({type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":XP(i.open)},r,{ref:s,onClick:Ee(e.onClick,i.onOpenToggle)}));return i.hasCustomAnchor?a:m.createElement(Ou,ae({asChild:!0},o),a)}),YP="PopoverPortal",[CG,EG]=GP(YP,{forceMount:void 0}),OG=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,o=$l(YP,t);return m.createElement(CG,{scope:t,forceMount:n},m.createElement(bn,{present:n||o.open},m.createElement(Dh,{asChild:!0,container:i},r)))},Wu="PopoverContent",PG=m.forwardRef((e,t)=>{const n=EG(Wu,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,o=$l(Wu,e.__scopePopover);return m.createElement(bn,{present:r||o.open},o.modal?m.createElement(kG,ae({},i,{ref:t})):m.createElement(MG,ae({},i,{ref:t})))}),kG=m.forwardRef((e,t)=>{const n=$l(Wu,e.__scopePopover),r=m.useRef(null),i=et(t,r),o=m.useRef(!1);return m.useEffect(()=>{const s=r.current;if(s)return ap(s)},[]),m.createElement(hp,{as:ro,allowPinchZoom:!0},m.createElement(KP,ae({},e,{ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ee(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),o.current||(a=n.triggerRef.current)===null||a===void 0||a.focus()}),onPointerDownOutside:Ee(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;o.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Ee(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})))}),MG=m.forwardRef((e,t)=>{const n=$l(Wu,e.__scopePopover),r=m.useRef(!1),i=m.useRef(!1);return m.createElement(KP,ae({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s;if((s=e.onCloseAutoFocus)===null||s===void 0||s.call(e,o),!o.defaultPrevented){var a;r.current||(a=n.triggerRef.current)===null||a===void 0||a.focus(),o.preventDefault()}r.current=!1,i.current=!1},onInteractOutside:o=>{var s,a;(s=e.onInteractOutside)===null||s===void 0||s.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=o.target;((a=n.triggerRef.current)===null||a===void 0?void 0:a.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}}))}),KP=m.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,...f}=e,g=$l(Wu,n),p=sy(n);return rp(),m.createElement(ip,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o},m.createElement(_l,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>g.onOpenChange(!1)},m.createElement(Pu,ae({"data-state":XP(g.open),role:"dialog",id:g.contentId},p,f,{ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}}))))});function XP(e){return e?"open":"closed"}const DG=wG,TG=SG,AG=OG,QP=PG,pp=DG,gp=TG,qu=de.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>_.jsx(AG,{children:_.jsx(QP,{ref:i,align:t,sideOffset:n,className:Pe("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));qu.displayName=QP.displayName;function IG({filter:e,className:t}){const[n,r]=m.useState(!1),[i,o]=m.useState(),[s,a]=m.useState(),l=ge(C=>C.filterValues),c=ge(C=>C.authToken),d=ge(C=>C.actions.addOrUpdateFilterValue),f=ge(C=>C.actions.removeFilterValue),{data:g,isLoading:p,isFetching:v,isError:y,refetch:x}=Cr({queryKey:[e.sql],queryFn:()=>Ns("https://semaphor.cloud/api/v1/query",(c==null?void 0:c.accessToken)||"",{connection_id:e.connectionId,sql:e.sql}),enabled:!!e.sql&&!!e.connectionId&&!!e.database});m.useEffect(()=>{var C;if(((C=g==null?void 0:g.records)==null?void 0:C.length)>0){const P=g.records[0];if(!P.min||!P.max)return;o({from:new Date(P.min),to:new Date(P.max)}),a({from:new Date(P.min),to:new Date(P.max)})}},[g]),m.useEffect(()=>{if(l&&!l.find(P=>P.filterId===e.id)){o(s);return}},[l,e.id,s]);function w(){f(e.id),o(s),r(!1)}function S(){if(!i)return;console.log(i);const C=[i==null?void 0:i.from,i==null?void 0:i.to];console.log(C);const P={filterId:e.id,connectionType:e.database==="NA"?"api":"database",valueType:k0(e),name:e.column,operation:"between",values:C};d(P),r(!1)}return p?_.jsx("div",{children:_.jsx(cf,{className:" bg-foreground/10 h-8 w-[250px]"})}):y?_.jsx("div",{className:"bg-muted h-8 w-[250px] px-2",children:"Error"}):g?_.jsx("div",{className:Pe("grid gap-2",t),children:_.jsxs(pp,{open:n,onOpenChange:r,children:[_.jsx(gp,{asChild:!0,children:_.jsxs(it,{size:"sm",id:"date",variant:"outline",className:Pe("w-[250px] justify-start text-left font-normal rounded-sm h-[34px]",!i&&"text-muted-foreground"),children:[_.jsx(qB,{className:"mr-2 h-4 w-4"}),i!=null&&i.from?i.to?_.jsxs(_.Fragment,{children:[Wi(i.from,"LLL dd, y")," -"," ",Wi(i.to,"LLL dd, y")]}):Wi(i.from,"LLL dd, y"):_.jsx("span",{children:"Pick a date"})]})}),_.jsxs(qu,{className:"w-auto p-0",align:"start",children:[_.jsx(OP,{initialFocus:!0,mode:"range",defaultMonth:i==null?void 0:i.from,selected:i,onSelect:o,numberOfMonths:2}),_.jsxs("div",{className:"flex justify-end px-4 py-3 gap-2",children:[_.jsx(it,{size:"sm",variant:"outline",onClick:S,children:"Apply"}),_.jsx(it,{size:"sm",variant:"outline",onClick:w,children:"Clear"})]})]})]})}):null}function NG(){const e=ge(s=>s.dashboard.filters),t=ge(s=>s.isDashboardEditing),n=ge(s=>s.actions.removeFilter),r=ge(s=>s.actions.updateFilter),i=ge(s=>s.actions.removeFilterValue);if(!e)return null;const o=s=>Nu.includes(s.dataType)?_.jsx(IG,{filter:s}):_.jsx(HW,{filter:s});return _.jsx("section",{role:"dashboard-filters",className:" px-[10px] pt-2 grow w-full items-center flex gap-2 flex-wrap ",children:e.map(s=>_.jsxs("div",{children:[_.jsx(qc,{className:" my-1 ",text:s.title||s.column,onSave:a=>r({...s,title:a}),children:_.jsxs("div",{className:"flex items-center justify-between group mb-1",children:[_.jsxs("div",{className:"flex gap-1 items-center ",children:[_.jsx(rs,{className:" inline-block text-sm ",children:s.title}),t&&_.jsx(oa,{onClick:()=>{i(s.id),n(s.id)},className:"w-3 h-3 invisible text-muted-foreground group-hover:visible hover:text-foreground cursor-pointer"})]}),_.jsx("div",{onClick:()=>i(s.id),className:" text-xs invisible group-hover:visible group-hover:underline cursor-pointer text-muted-foreground hover:text-foreground",children:"Clear"})]})}),o(s)]},s.id))})}function JP(){const e=ge(i=>{var o;return(o=i.dashboard)==null?void 0:o.sheets});ge(i=>i.isDashboardEditing);const t=ge(i=>i.themeStyle);ge(i=>i.isVisualEditing);const n=ge(i=>i.selectedSheetId),r=ge(i=>i.actions.setSelectedSheetId);return ge(i=>i.actions.setSheetTitle),e?_.jsxs(a_,{role:"dashboard-tabs-container",className:Pe(" grow ",t==null?void 0:t.dashboardTabsContainer),onValueChange:i=>{r(i)},value:n||e[0].id,children:[_.jsx(NG,{}),e==null?void 0:e.map(i=>_.jsx(hf,{className:"mt-0",value:i.id,children:_.jsx(uH,{})},i.id))]}):null}function ZP({children:e}){const t=new DN;return _.jsx(XN,{defaultTheme:"dark",storageKey:"vite-ui-theme",children:_.jsx(FB,{delayDuration:0,children:_.jsx(RN,{client:t,children:e})})})}function ek(e){return _.jsx(ZP,{children:_.jsx(Kw,{...e,children:_.jsx(JP,{})})})}var RG=Object.defineProperty,LG=(e,t,n)=>t in e?RG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mp=(e,t,n)=>(LG(e,typeof t!="symbol"?t+"":t,n),n);const $G={stringify:e=>e,parse:e=>e},FG={stringify:e=>`${e}`,parse:e=>parseFloat(e)},jG={stringify:e=>e?"true":"false",parse:e=>/^[ty1-9]/i.test(e)},zG={stringify:e=>e.name,parse:(e,t)=>{const n=(()=>{if(typeof window<"u"&&e in window)return window[e];if(typeof global<"u"&&e in global)return global[e]})();return typeof n=="function"?n.bind(t):void 0}},BG={stringify:e=>JSON.stringify(e),parse:e=>JSON.parse(e)},ay={string:$G,number:FG,boolean:jG,function:zG,json:BG},ly=Symbol.for("r2wc.render"),vp=Symbol.for("r2wc.connected"),va=Symbol.for("r2wc.context"),ss=Symbol.for("r2wc.props");function VG(e,t,n){var r,i,o;t.props||(t.props=e.propTypes?Object.keys(e.propTypes):[]);const s=(Array.isArray(t.props)?t.props.slice():Object.keys(t.props)).filter(f=>f!=="container"),a={},l={},c={};for(const f of s){a[f]=Array.isArray(t.props)?"string":t.props[f];const g=HG(f);l[f]=g,c[g]=f}class d extends HTMLElement{constructor(){super(),mp(this,r,!0),mp(this,i),mp(this,o,{}),mp(this,"container"),t.shadow?this.container=this.attachShadow({mode:t.shadow}):this.container=this,this[ss].container=this.container;for(const g of s){const p=l[g],v=this.getAttribute(p),y=a[g],x=ay[y];v&&x!=null&&x.parse&&(this[ss][g]=x.parse(v,this))}}static get observedAttributes(){return Object.keys(c)}connectedCallback(){this[vp]=!0,this[ly]()}disconnectedCallback(){this[vp]=!1,this[va]&&n.unmount(this[va]),delete this[va]}attributeChangedCallback(g,p,v){const y=c[g],x=a[y],w=ay[x];y in a&&w!=null&&w.parse&&(this[ss][y]=w.parse(v,this),this[ly]())}[(r=vp,i=va,o=ss,ly)](){this[vp]&&(this[va]?n.update(this[va],this[ss]):this[va]=n.mount(this.container,e,this[ss]))}}for(const f of s){const g=l[f],p=a[f];Object.defineProperty(d.prototype,f,{enumerable:!0,configurable:!0,get(){return this[ss][f]},set(v){this[ss][f]=v;const y=ay[p];if(y!=null&&y.stringify){const x=y.stringify(v);this.getAttribute(g)!==x&&this.setAttribute(g,x)}}})}return d}function HG(e=""){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function WG(e,t,n){const r=nf(e),i=m.createElement(t,n);return r.render(i),{root:r,ReactComponent:t}}function qG({root:e,ReactComponent:t},n){const r=m.createElement(t,n);e.render(r)}function UG({root:e}){e.unmount()}function GG(e,t={}){return VG(e,t,{mount:WG,update:qG,unmount:UG})}const YG=GG(ek,{props:{id:"string",authToken:"json",currentTheme:"string",style:"json",onEvent:"function",onSave:"function",LoadingComponent:"function",ErrorComponent:"function"}}),cy=["Enter"," "],KG=["ArrowDown","PageUp","Home"],tk=["ArrowUp","PageDown","End"],XG=[...KG,...tk],QG={ltr:[...cy,"ArrowRight"],rtl:[...cy,"ArrowLeft"]},JG={ltr:["ArrowLeft"],rtl:["ArrowRight"]},bp="Menu",[Uu,ZG,eY]=df(bp),[ba,nk]=kn(bp,[eY,ji,ol]),uy=ji(),rk=ol(),[tY,ya]=ba(bp),[nY,Gu]=ba(bp),rY=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:o,modal:s=!0}=e,a=uy(t),[l,c]=m.useState(null),d=m.useRef(!1),f=wn(o),g=js(i);return m.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),m.createElement(Eu,a,m.createElement(tY,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:c},m.createElement(nY,{scope:t,onClose:m.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:g,modal:s},r)))},ik=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=uy(n);return m.createElement(Ou,ae({},i,r,{ref:t}))}),ok="MenuPortal",[iY,sk]=ba(ok,{forceMount:void 0}),oY=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,o=ya(ok,t);return m.createElement(iY,{scope:t,forceMount:n},m.createElement(bn,{present:n||o.open},m.createElement(Dh,{asChild:!0,container:i},r)))},_i="MenuContent",[sY,dy]=ba(_i),aY=m.forwardRef((e,t)=>{const n=sk(_i,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=ya(_i,e.__scopeMenu),s=Gu(_i,e.__scopeMenu);return m.createElement(Uu.Provider,{scope:e.__scopeMenu},m.createElement(bn,{present:r||o.open},m.createElement(Uu.Slot,{scope:e.__scopeMenu},s.modal?m.createElement(lY,ae({},i,{ref:t})):m.createElement(cY,ae({},i,{ref:t})))))}),lY=m.forwardRef((e,t)=>{const n=ya(_i,e.__scopeMenu),r=m.useRef(null),i=et(t,r);return m.useEffect(()=>{const o=r.current;if(o)return ap(o)},[]),m.createElement(fy,ae({},e,{ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ee(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))}),cY=m.forwardRef((e,t)=>{const n=ya(_i,e.__scopeMenu);return m.createElement(fy,ae({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))}),fy=m.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:g,onDismiss:p,disableOutsideScroll:v,...y}=e,x=ya(_i,n),w=Gu(_i,n),S=uy(n),C=rk(n),P=ZG(n),[O,k]=m.useState(null),A=m.useRef(null),L=et(t,A,x.onContentChange),F=m.useRef(0),j=m.useRef(""),B=m.useRef(0),H=m.useRef(null),K=m.useRef("right"),Y=m.useRef(0),$=v?hp:m.Fragment,Z=v?{as:ro,allowPinchZoom:!0}:void 0,U=le=>{var M,W;const ne=j.current+le,N=P().filter(ee=>!ee.disabled),X=document.activeElement,me=(M=N.find(ee=>ee.ref.current===X))===null||M===void 0?void 0:M.textValue,he=N.map(ee=>ee.textValue),fe=kY(he,ne,me),re=(W=N.find(ee=>ee.textValue===fe))===null||W===void 0?void 0:W.ref.current;(function ee(oe){j.current=oe,window.clearTimeout(F.current),oe!==""&&(F.current=window.setTimeout(()=>ee(""),1e3))})(ne),re&&setTimeout(()=>re.focus())};m.useEffect(()=>()=>window.clearTimeout(F.current),[]),rp();const ie=m.useCallback(le=>{var M,W;return K.current===((M=H.current)===null||M===void 0?void 0:M.side)&&DY(le,(W=H.current)===null||W===void 0?void 0:W.area)},[]);return m.createElement(sY,{scope:n,searchRef:j,onItemEnter:m.useCallback(le=>{ie(le)&&le.preventDefault()},[ie]),onItemLeave:m.useCallback(le=>{var M;ie(le)||((M=A.current)===null||M===void 0||M.focus(),k(null))},[ie]),onTriggerLeave:m.useCallback(le=>{ie(le)&&le.preventDefault()},[ie]),pointerGraceTimerRef:B,onPointerGraceIntentChange:m.useCallback(le=>{H.current=le},[])},m.createElement($,Z,m.createElement(ip,{asChild:!0,trapped:i,onMountAutoFocus:Ee(o,le=>{var M;le.preventDefault(),(M=A.current)===null||M===void 0||M.focus()}),onUnmountAutoFocus:s},m.createElement(_l,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:g,onDismiss:p},m.createElement(Dm,ae({asChild:!0},C,{dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:O,onCurrentTabStopIdChange:k,onEntryFocus:Ee(l,le=>{w.isUsingKeyboardRef.current||le.preventDefault()})}),m.createElement(Pu,ae({role:"menu","aria-orientation":"vertical","data-state":fk(x.open),"data-radix-menu-content":"",dir:w.dir},S,y,{ref:L,style:{outline:"none",...y.style},onKeyDown:Ee(y.onKeyDown,le=>{const W=le.target.closest("[data-radix-menu-content]")===le.currentTarget,ne=le.ctrlKey||le.altKey||le.metaKey,N=le.key.length===1;W&&(le.key==="Tab"&&le.preventDefault(),!ne&&N&&U(le.key));const X=A.current;if(le.target!==X||!XG.includes(le.key))return;le.preventDefault();const he=P().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);tk.includes(le.key)&&he.reverse(),OY(he)}),onBlur:Ee(e.onBlur,le=>{le.currentTarget.contains(le.target)||(window.clearTimeout(F.current),j.current="")}),onPointerMove:Ee(e.onPointerMove,Yu(le=>{const M=le.target,W=Y.current!==le.clientX;if(le.currentTarget.contains(M)&&W){const ne=le.clientX>Y.current?"right":"left";K.current=ne,Y.current=le.clientX}}))})))))))}),uY=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Ve.div,ae({role:"group"},r,{ref:t}))}),dY=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Ve.div,ae({},r,{ref:t}))}),hy="MenuItem",ak="menu.itemSelect",py=m.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,o=m.useRef(null),s=Gu(hy,e.__scopeMenu),a=dy(hy,e.__scopeMenu),l=et(t,o),c=m.useRef(!1),d=()=>{const f=o.current;if(!n&&f){const g=new CustomEvent(ak,{bubbles:!0,cancelable:!0});f.addEventListener(ak,p=>r==null?void 0:r(p),{once:!0}),Qw(f,g),g.defaultPrevented?c.current=!1:s.onClose()}};return m.createElement(lk,ae({},i,{ref:l,disabled:n,onClick:Ee(e.onClick,d),onPointerDown:f=>{var g;(g=e.onPointerDown)===null||g===void 0||g.call(e,f),c.current=!0},onPointerUp:Ee(e.onPointerUp,f=>{var g;c.current||(g=f.currentTarget)===null||g===void 0||g.click()}),onKeyDown:Ee(e.onKeyDown,f=>{const g=a.searchRef.current!=="";n||g&&f.key===" "||cy.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})}))}),lk=m.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=e,s=dy(hy,n),a=rk(n),l=m.useRef(null),c=et(t,l),[d,f]=m.useState(!1),[g,p]=m.useState("");return m.useEffect(()=>{const v=l.current;if(v){var y;p(((y=v.textContent)!==null&&y!==void 0?y:"").trim())}},[o.children]),m.createElement(Uu.ItemSlot,{scope:n,disabled:r,textValue:i??g},m.createElement(Tm,ae({asChild:!0},a,{focusable:!r}),m.createElement(Ve.div,ae({role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},o,{ref:c,onPointerMove:Ee(e.onPointerMove,Yu(v=>{r?s.onItemLeave(v):(s.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus())})),onPointerLeave:Ee(e.onPointerLeave,Yu(v=>s.onItemLeave(v))),onFocus:Ee(e.onFocus,()=>f(!0)),onBlur:Ee(e.onBlur,()=>f(!1))}))))}),fY=m.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return m.createElement(uk,{scope:e.__scopeMenu,checked:n},m.createElement(py,ae({role:"menuitemcheckbox","aria-checked":xp(n)?"mixed":n},i,{ref:t,"data-state":gy(n),onSelect:Ee(i.onSelect,()=>r==null?void 0:r(xp(n)?!0:!n),{checkForDefaultPrevented:!1})})))}),hY="MenuRadioGroup",[pY,gY]=ba(hY,{value:void 0,onValueChange:()=>{}}),mY=m.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,o=wn(r);return m.createElement(pY,{scope:e.__scopeMenu,value:n,onValueChange:o},m.createElement(uY,ae({},i,{ref:t})))}),vY="MenuRadioItem",bY=m.forwardRef((e,t)=>{const{value:n,...r}=e,i=gY(vY,e.__scopeMenu),o=n===i.value;return m.createElement(uk,{scope:e.__scopeMenu,checked:o},m.createElement(py,ae({role:"menuitemradio","aria-checked":o},r,{ref:t,"data-state":gy(o),onSelect:Ee(r.onSelect,()=>{var s;return(s=i.onValueChange)===null||s===void 0?void 0:s.call(i,n)},{checkForDefaultPrevented:!1})})))}),ck="MenuItemIndicator",[uk,yY]=ba(ck,{checked:!1}),xY=m.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,o=yY(ck,n);return m.createElement(bn,{present:r||xp(o.checked)||o.checked===!0},m.createElement(Ve.span,ae({},i,{ref:t,"data-state":gy(o.checked)})))}),wY=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Ve.div,ae({role:"separator","aria-orientation":"horizontal"},r,{ref:t}))}),_Y="MenuSub",[rfe,dk]=ba(_Y),yp="MenuSubTrigger",SY=m.forwardRef((e,t)=>{const n=ya(yp,e.__scopeMenu),r=Gu(yp,e.__scopeMenu),i=dk(yp,e.__scopeMenu),o=dy(yp,e.__scopeMenu),s=m.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=o,c={__scopeMenu:e.__scopeMenu},d=m.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return m.useEffect(()=>d,[d]),m.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),l(null)}},[a,l]),m.createElement(ik,ae({asChild:!0},c),m.createElement(lk,ae({id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":fk(n.open)},e,{ref:uf(t,i.onTriggerChange),onClick:f=>{var g;(g=e.onClick)===null||g===void 0||g.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ee(e.onPointerMove,Yu(f=>{o.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Ee(e.onPointerLeave,Yu(f=>{var g;d();const p=(g=n.content)===null||g===void 0?void 0:g.getBoundingClientRect();if(p){var v;const y=(v=n.content)===null||v===void 0?void 0:v.dataset.side,x=y==="right",w=x?-5:5,S=p[x?"left":"right"],C=p[x?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+w,y:f.clientY},{x:S,y:p.top},{x:C,y:p.top},{x:C,y:p.bottom},{x:S,y:p.bottom}],side:y}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Ee(e.onKeyDown,f=>{const g=o.searchRef.current!=="";if(!(e.disabled||g&&f.key===" ")&&QG[r.dir].includes(f.key)){var p;n.onOpenChange(!0),(p=n.content)===null||p===void 0||p.focus(),f.preventDefault()}})})))}),CY="MenuSubContent",EY=m.forwardRef((e,t)=>{const n=sk(_i,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=ya(_i,e.__scopeMenu),s=Gu(_i,e.__scopeMenu),a=dk(CY,e.__scopeMenu),l=m.useRef(null),c=et(t,l);return m.createElement(Uu.Provider,{scope:e.__scopeMenu},m.createElement(bn,{present:r||o.open},m.createElement(Uu.Slot,{scope:e.__scopeMenu},m.createElement(fy,ae({id:a.contentId,"aria-labelledby":a.triggerId},i,{ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;s.isUsingKeyboardRef.current&&((f=l.current)===null||f===void 0||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Ee(e.onFocusOutside,d=>{d.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Ee(e.onEscapeKeyDown,d=>{s.onClose(),d.preventDefault()}),onKeyDown:Ee(e.onKeyDown,d=>{const f=d.currentTarget.contains(d.target),g=JG[s.dir].includes(d.key);if(f&&g){var p;o.onOpenChange(!1),(p=a.trigger)===null||p===void 0||p.focus(),d.preventDefault()}})})))))});function fk(e){return e?"open":"closed"}function xp(e){return e==="indeterminate"}function gy(e){return xp(e)?"indeterminate":e?"checked":"unchecked"}function OY(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function PY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function kY(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let s=PY(e,Math.max(o,0));i.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function MY(e,t){const{x:n,y:r}=e;let i=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){const a=t[o].x,l=t[o].y,c=t[s].x,d=t[s].y;l>r!=d>r&&n<(c-a)*(r-l)/(d-l)+a&&(i=!i)}return i}function DY(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return MY(n,t)}function Yu(e){return t=>t.pointerType==="mouse"?e(t):void 0}const TY=rY,AY=ik,IY=oY,NY=aY,RY=dY,LY=py,$Y=fY,FY=mY,jY=bY,zY=xY,BY=wY,VY=SY,HY=EY,hk="DropdownMenu",[WY,ife]=kn(hk,[nk]),Rr=nk(),[qY,pk]=WY(hk),UY=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,l=Rr(t),c=m.useRef(null),[d=!1,f]=Jn({prop:i,defaultProp:o,onChange:s});return m.createElement(qY,{scope:t,triggerId:sr(),triggerRef:c,contentId:sr(),open:d,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(g=>!g),[f]),modal:a},m.createElement(TY,ae({},l,{open:d,onOpenChange:f,dir:r,modal:a}),n))},GY="DropdownMenuTrigger",YY=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,o=pk(GY,n),s=Rr(n);return m.createElement(AY,ae({asChild:!0},s),m.createElement(Ve.button,ae({type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r},i,{ref:uf(t,o.triggerRef),onPointerDown:Ee(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:Ee(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})))}),KY=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Rr(t);return m.createElement(IY,ae({},r,n))},XY="DropdownMenuContent",QY=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=pk(XY,n),o=Rr(n),s=m.useRef(!1);return m.createElement(NY,ae({id:i.contentId,"aria-labelledby":i.triggerId},o,r,{ref:t,onCloseAutoFocus:Ee(e.onCloseAutoFocus,a=>{var l;s.current||(l=i.triggerRef.current)===null||l===void 0||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:Ee(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;(!i.modal||d)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),JY=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement(RY,ae({},i,r,{ref:t}))}),ZY=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement(LY,ae({},i,r,{ref:t}))}),eK=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement($Y,ae({},i,r,{ref:t}))}),tK=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement(FY,ae({},i,r,{ref:t}))}),nK=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement(jY,ae({},i,r,{ref:t}))}),rK=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement(zY,ae({},i,r,{ref:t}))}),iK=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement(BY,ae({},i,r,{ref:t}))}),oK=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement(VY,ae({},i,r,{ref:t}))}),sK=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rr(n);return m.createElement(HY,ae({},i,r,{ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),aK=UY,lK=YY,cK=KY,gk=QY,mk=JY,vk=ZY,bk=eK,uK=tK,yk=nK,xk=rK,wk=iK,_k=oK,Sk=sK,Ck=aK,Ek=lK,dK=uK,fK=de.forwardRef(({className:e,inset:t,children:n,...r},i)=>_.jsxs(_k,{ref:i,className:Pe("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,_.jsx(V2,{className:"ml-auto h-4 w-4"})]}));fK.displayName=_k.displayName;const hK=de.forwardRef(({className:e,...t},n)=>_.jsx(Sk,{ref:n,className:Pe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));hK.displayName=Sk.displayName;const my=de.forwardRef(({className:e,sideOffset:t=4,...n},r)=>_.jsx(cK,{children:_.jsx(gk,{ref:r,sideOffset:t,className:Pe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));my.displayName=gk.displayName;const wp=de.forwardRef(({className:e,inset:t,...n},r)=>_.jsx(vk,{ref:r,className:Pe("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));wp.displayName=vk.displayName;const pK=de.forwardRef(({className:e,children:t,checked:n,...r},i)=>_.jsxs(bk,{ref:i,className:Pe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[_.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:_.jsx(xk,{children:_.jsx(Rh,{className:"h-4 w-4"})})}),t]}));pK.displayName=bk.displayName;const vy=de.forwardRef(({className:e,children:t,...n},r)=>_.jsxs(yk,{ref:r,className:Pe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[_.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:_.jsx(xk,{children:_.jsx(H2,{className:"h-2 w-2 fill-current"})})}),t]}));vy.displayName=yk.displayName;const Ok=de.forwardRef(({className:e,inset:t,...n},r)=>_.jsx(mk,{ref:r,className:Pe("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Ok.displayName=mk.displayName;const Pk=de.forwardRef(({className:e,...t},n)=>_.jsx(wk,{ref:n,className:Pe("-mx-1 my-1 h-px bg-muted",e),...t}));Pk.displayName=wk.displayName;function gK(){const{setTheme:e}=Em(),t=ge(n=>n.actions.setDashboardTheme);return _.jsxs(Ck,{children:[_.jsx(Ek,{asChild:!0,children:_.jsxs(it,{className:"h-7 p-2",variant:"outline",size:"sm",children:[_.jsx(rV,{strokeWidth:1.5,className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),_.jsx(JB,{strokeWidth:1.5,className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),_.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),_.jsxs(my,{align:"end",children:[_.jsx(wp,{onClick:()=>{e("light"),t("light")},children:"Light"}),_.jsx(wp,{onClick:()=>{e("dark"),t("dark")},children:"Dark"}),_.jsx(wp,{onClick:()=>{e("system"),t("system")},children:"System"})]})]})}function by(e){var t;return{...e,sheets:(t=e==null?void 0:e.sheets)==null?void 0:t.map(n=>{var r;return{...n,cards:(r=n==null?void 0:n.cards)==null?void 0:r.map(i=>kk(i))}})}}function kk(e){var t,n,r,i;return{...e,cfg:{...e.cfg,data:{...(t=e.cfg)==null?void 0:t.data,labels:[],datasets:(i=(r=(n=e.cfg)==null?void 0:n.data)==null?void 0:r.datasets)==null?void 0:i.map(o=>({...o,data:[]}))}},customCfg:mK(e.customCfg),data:[]}}function mK(e){var t,n;return e?{...e,data:{...e==null?void 0:e.data,labels:[],datasets:(n=(t=e==null?void 0:e.data)==null?void 0:t.datasets)==null?void 0:n.map(r=>({...r,data:[]}))}}:null}function as(e){return`semaphor:bookmark:${e}`}const Mk="Dialog",[Dk,ofe]=kn(Mk),[vK,Si]=Dk(Mk),bK=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=e,a=m.useRef(null),l=m.useRef(null),[c=!1,d]=Jn({prop:r,defaultProp:i,onChange:o});return m.createElement(vK,{scope:t,triggerRef:a,contentRef:l,contentId:sr(),titleId:sr(),descriptionId:sr(),open:c,onOpenChange:d,onOpenToggle:m.useCallback(()=>d(f=>!f),[d]),modal:s},n)},yK="DialogTrigger",xK=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Si(yK,n),o=et(t,i.triggerRef);return m.createElement(Ve.button,ae({type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":xy(i.open)},r,{ref:o,onClick:Ee(e.onClick,i.onOpenToggle)}))}),Tk="DialogPortal",[wK,Ak]=Dk(Tk,{forceMount:void 0}),_K=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,o=Si(Tk,t);return m.createElement(wK,{scope:t,forceMount:n},m.Children.map(r,s=>m.createElement(bn,{present:n||o.open},m.createElement(Dh,{asChild:!0,container:i},s))))},yy="DialogOverlay",SK=m.forwardRef((e,t)=>{const n=Ak(yy,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Si(yy,e.__scopeDialog);return o.modal?m.createElement(bn,{present:r||o.open},m.createElement(CK,ae({},i,{ref:t}))):null}),CK=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Si(yy,n);return m.createElement(hp,{as:ro,allowPinchZoom:!0,shards:[i.contentRef]},m.createElement(Ve.div,ae({"data-state":xy(i.open)},r,{ref:t,style:{pointerEvents:"auto",...r.style}})))}),Ku="DialogContent",EK=m.forwardRef((e,t)=>{const n=Ak(Ku,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Si(Ku,e.__scopeDialog);return m.createElement(bn,{present:r||o.open},o.modal?m.createElement(OK,ae({},i,{ref:t})):m.createElement(PK,ae({},i,{ref:t})))}),OK=m.forwardRef((e,t)=>{const n=Si(Ku,e.__scopeDialog),r=m.useRef(null),i=et(t,n.contentRef,r);return m.useEffect(()=>{const o=r.current;if(o)return ap(o)},[]),m.createElement(Ik,ae({},e,{ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ee(e.onCloseAutoFocus,o=>{var s;o.preventDefault(),(s=n.triggerRef.current)===null||s===void 0||s.focus()}),onPointerDownOutside:Ee(e.onPointerDownOutside,o=>{const s=o.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&o.preventDefault()}),onFocusOutside:Ee(e.onFocusOutside,o=>o.preventDefault())}))}),PK=m.forwardRef((e,t)=>{const n=Si(Ku,e.__scopeDialog),r=m.useRef(!1),i=m.useRef(!1);return m.createElement(Ik,ae({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s;if((s=e.onCloseAutoFocus)===null||s===void 0||s.call(e,o),!o.defaultPrevented){var a;r.current||(a=n.triggerRef.current)===null||a===void 0||a.focus(),o.preventDefault()}r.current=!1,i.current=!1},onInteractOutside:o=>{var s,a;(s=e.onInteractOutside)===null||s===void 0||s.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=o.target;((a=n.triggerRef.current)===null||a===void 0?void 0:a.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}}))}),Ik=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=e,a=Si(Ku,n),l=m.useRef(null),c=et(t,l);return rp(),m.createElement(m.Fragment,null,m.createElement(ip,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o},m.createElement(_l,ae({role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":xy(a.open)},s,{ref:c,onDismiss:()=>a.onOpenChange(!1)}))),!1)}),kK="DialogTitle",MK=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Si(kK,n);return m.createElement(Ve.h2,ae({id:i.titleId},r,{ref:t}))}),DK="DialogDescription",TK=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Si(DK,n);return m.createElement(Ve.p,ae({id:i.descriptionId},r,{ref:t}))}),AK="DialogClose",IK=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Si(AK,n);return m.createElement(Ve.button,ae({type:"button"},r,{ref:t,onClick:Ee(e.onClick,()=>i.onOpenChange(!1))}))});function xy(e){return e?"open":"closed"}const NK=bK,RK=xK,LK=_K,Nk=SK,Rk=EK,Lk=MK,$k=TK,$K=IK,wy=NK,_y=RK,FK=LK,Fk=de.forwardRef(({className:e,...t},n)=>_.jsx(Nk,{ref:n,className:Pe("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Fk.displayName=Nk.displayName;const _p=de.forwardRef(({className:e,children:t,...n},r)=>_.jsxs(FK,{children:[_.jsx(Fk,{}),_.jsxs(Rk,{ref:r,className:Pe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,_.jsxs($K,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[_.jsx(sV,{className:"h-4 w-4"}),_.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_p.displayName=Rk.displayName;const Sp=({className:e,...t})=>_.jsx("div",{className:Pe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Sp.displayName="DialogHeader";const Sy=({className:e,...t})=>_.jsx("div",{className:Pe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Sy.displayName="DialogFooter";const Cp=de.forwardRef(({className:e,...t},n)=>_.jsx(Lk,{ref:n,className:Pe("text-lg font-semibold leading-none tracking-tight",e),...t}));Cp.displayName=Lk.displayName;const Ep=de.forwardRef(({className:e,...t},n)=>_.jsx($k,{ref:n,className:Pe("text-sm text-muted-foreground",e),...t}));Ep.displayName=$k.displayName;const Xu=de.forwardRef(({className:e,type:t,...n},r)=>_.jsx("input",{type:t,className:Pe("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Xu.displayName="Input";function jK(){const[e,t]=m.useState(""),[n,r]=m.useState(!1),[i,o]=m.useState(!1),s=ge(l=>l.dashboard);function a(){const l=by(s),c=as(s.id),d=JSON.parse(localStorage.getItem(c)||"[]");if(d.some(g=>g.name===e)){r(!0);return}d.push({name:e,template:l}),localStorage.setItem(c,JSON.stringify(d)),o(!1)}return _.jsxs(wy,{open:i,onOpenChange:o,children:[_.jsx(_y,{asChild:!0,children:_.jsxs(it,{variant:"outline",className:"h-7 p-2",size:"sm",children:[_.jsx(G2,{className:" mr-2 h-4 w-4",strokeWidth:1.5}),"Add Lens"]})}),_.jsxs(_p,{className:"sm:max-w-[425px]",children:[_.jsxs(Sp,{children:[_.jsx(Cp,{children:"Add a Lens"}),_.jsx(Ep,{children:"Lenses are private by default and are only visible to you."})]}),_.jsx("div",{className:"grid gap-4 py-4",children:_.jsxs("div",{className:"grid grid-cols-8 items-center gap-4",children:[_.jsx(rs,{className:"text-right",children:"Name"}),_.jsx(Xu,{value:e,onChange:l=>{n&&r(!1),t(l.target.value)},id:"name",className:"col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"})]})}),n&&_.jsx("p",{className:"text-sm",children:"The bookmark name already exists. Use a differnet name."}),_.jsx(Sy,{children:_.jsx(it,{variant:"outline",type:"submit",disabled:!e,onClick:a,children:"Save"})})]})]})}function zK(){const[e,t]=m.useState(!1),[n,r]=m.useState(""),i=ge(p=>p.dashboard),o=ge(p=>p.bookmarkKey),[s,a]=m.useState([]),l=ge(p=>p.actions.setDashboard),c=ge(p=>p.actions.setFilterValues),d=ge(p=>p.actions.setBookmarkKey);m.useEffect(()=>{const p=as(i.id),v=JSON.parse(localStorage.getItem(p)||"[]");a(v);const y=v.find(x=>x.default);y&&y.name===o&&r(y.name)},[e,i,o]);function f(p){if(p===n)return;const v=s.find(x=>x.name===p),y=v==null?void 0:v.template;y&&(l(y),c(v.filterValues||[]),d(p==="Original"?"":p)),r(p)}function g(p){const v=as(i.id),x=JSON.parse(localStorage.getItem(v)||"[]").filter(w=>w.name!==p);localStorage.setItem(v,JSON.stringify(x)),a(x)}return _.jsxs(Ck,{open:e,onOpenChange:t,children:[_.jsx(Ek,{asChild:!0,children:_.jsx(it,{variant:"outline",className:"h-7 p-2",children:_.jsx(XB,{className:"h-4 w-4",strokeWidth:1.5})})}),_.jsxs(my,{className:"w-56",children:[_.jsx(Ok,{children:"Lenses"}),_.jsx(Pk,{}),_.jsxs(dK,{value:n,onValueChange:f,children:[_.jsx(vy,{value:"Original",children:"Original"}),s.filter(p=>p.name!="Original").map((p,v)=>_.jsxs(vy,{className:"xbg-red-100 flex justify-between",value:p.name,defaultChecked:p.name===o,children:[_.jsx("p",{children:p.name}),_.jsx(oa,{onClick:y=>{y.preventDefault(),g(p.name)},className:"h-3 w-3 hover:cursor-pointer",strokeWidth:1.5})]},v))]})]})]})}function Op(e){const t=m.useRef({value:e,previous:e});return m.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}const jk="Checkbox",[BK,sfe]=kn(jk),[VK,HK]=BK(jk),WK=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:l="on",onCheckedChange:c,...d}=e,[f,g]=m.useState(null),p=et(t,C=>g(C)),v=m.useRef(!1),y=f?!!f.closest("form"):!0,[x=!1,w]=Jn({prop:i,defaultProp:o,onChange:c}),S=m.useRef(x);return m.useEffect(()=>{const C=f==null?void 0:f.form;if(C){const P=()=>w(S.current);return C.addEventListener("reset",P),()=>C.removeEventListener("reset",P)}},[f,w]),m.createElement(VK,{scope:n,state:x,disabled:a},m.createElement(Ve.button,ae({type:"button",role:"checkbox","aria-checked":xa(x)?"mixed":x,"aria-required":s,"data-state":zk(x),"data-disabled":a?"":void 0,disabled:a,value:l},d,{ref:p,onKeyDown:Ee(e.onKeyDown,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:Ee(e.onClick,C=>{w(P=>xa(P)?!0:!P),y&&(v.current=C.isPropagationStopped(),v.current||C.stopPropagation())})})),y&&m.createElement(GK,{control:f,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,style:{transform:"translateX(-100%)"}}))}),qK="CheckboxIndicator",UK=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=HK(qK,n);return m.createElement(bn,{present:r||xa(o.state)||o.state===!0},m.createElement(Ve.span,ae({"data-state":zk(o.state),"data-disabled":o.disabled?"":void 0},i,{ref:t,style:{pointerEvents:"none",...e.style}})))}),GK=e=>{const{control:t,checked:n,bubbles:r=!0,...i}=e,o=m.useRef(null),s=Op(n),a=Mh(t);return m.useEffect(()=>{const l=o.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&f){const g=new Event("click",{bubbles:r});l.indeterminate=xa(n),f.call(l,xa(n)?!1:n),l.dispatchEvent(g)}},[s,n,r]),m.createElement("input",ae({type:"checkbox","aria-hidden":!0,defaultChecked:xa(n)?!1:n},i,{tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function xa(e){return e==="indeterminate"}function zk(e){return xa(e)?"indeterminate":e?"checked":"unchecked"}const Bk=WK,YK=UK,Pp=de.forwardRef(({className:e,...t},n)=>_.jsx(Bk,{ref:n,className:Pe("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:_.jsx(YK,{className:Pe("flex items-center justify-center text-current"),children:_.jsx(Rh,{className:"h-4 w-4"})})}));Pp.displayName=Bk.displayName;function KK(){const[e,t]=m.useState(!1),n=ge(o=>o.dashboard),r=ge(o=>o.bookmarkKey);m.useEffect(()=>{if(!r){t(!1);return}const o=as(n.id),a=JSON.parse(localStorage.getItem(o)||"[]").find(l=>l.name===r);t(a?a.default:!1)},[r,n.id]);function i(o){if(t(o),!r)return;const s=as(n.id),l=JSON.parse(localStorage.getItem(s)||"[]").map(c=>(c.name===r?c.default=o:c.default=!1,c));console.log(l),localStorage.setItem(s,JSON.stringify(l))}return _.jsxs("div",{className:"flex items-center space-x-2",children:[_.jsx(Pp,{checked:e,onCheckedChange:i,id:"terms"}),_.jsx("label",{htmlFor:"terms",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Set as default"})]})}function XK(){const e=ge(P=>P.bookmarkKey),t=ge(P=>P.dashboard),n=ge(P=>P.selectedSheetId),r=ge(P=>P.isDashboardEditing),i=ge(P=>P.filterValues),o=ge(P=>P.isVisualEditing),s=ge(P=>P.showFilters),a=ge(P=>P.showDashboardJSON),l=ge(P=>P.actions.setShowDashboardJSON),c=ge(P=>P.onSaveFunction),d=ge(P=>P.actions.setShowFilters),{addCard:f,getSelectedSheet:g,setIsDashboardEditing:p,setSelectedCardId:v,setSelectedCard:y}=ge(P=>P.actions),x=g(),w=()=>{if(!r||!x)return;const P={id:wu(),title:"New Card",description:"New Card Description",preferences:{filterOnClick:!0},type:"bar",sql:"select COUNT(*) from YOUR_TABLE",data:[]};f(x.id,P),v(n,P.id),y(P)},S=()=>{p(!0)};function C(){if(!e||e==="")return;const P=by(t),O=as(t.id),k=JSON.parse(localStorage.getItem(O)||"[]"),A=k.findIndex(L=>L.name===e);A!==-1?k[A]={name:e,template:P,default:k[A].default,filterValues:i}:k.push({name:e,template:P,filterValues:i}),localStorage.setItem(O,JSON.stringify(k)),c==null||c(P)}return _.jsxs("div",{className:`flex items-center justify-between gap-2
428
428
  py-2 `,role:"dashboard-controls",children:[!o&&_.jsxs("div",{className:"flex gap-3 items-center",children:[_.jsx(rs,{children:e}),!!e&&_.jsxs(_.Fragment,{children:[_.jsx("span",{className:" text-muted-foreground",children:"|"}),_.jsx(KK,{})]})]}),_.jsxs("div",{className:"flex gap-2",children:[r&&!o&&_.jsx(jK,{}),!o&&_.jsx(zK,{}),r&&!o&&_.jsxs(it,{variant:"outline",className:"h-7 p-2",size:"sm",disabled:!r,onClick:w,children:[_.jsx(G2,{className:" mr-2 h-4 w-4",strokeWidth:1.5}),"Add Card"]}),!r&&_.jsx(it,{variant:"outline",className:"h-7 p-2",onClick:S,size:"sm",children:_.jsx(ZB,{className:"h-4 w-4",strokeWidth:1.5})}),r&&!o&&_.jsx(it,{variant:"outline",role:"close",className:"h-7 p-2",onClick:()=>p(!1),size:"sm",children:_.jsx(oa,{className:"h-4 w-4",strokeWidth:1.5})}),r&&!o&&_.jsx(it,{className:"h-7 p-2",variant:"outline",onClick:C,size:"sm",children:_.jsx(tV,{className:"h-4 w-4",strokeWidth:1.5})}),!s&&!o&&r&&_.jsx(it,{className:"h-7 p-2",variant:"outline",onClick:()=>d(!0),size:"sm",children:_.jsx(W2,{className:"h-4 w-4",strokeWidth:1.5})}),!o&&r&&_.jsx("div",{className:" flex items-center space-x-2",children:_.jsx(it,{className:"h-7 p-2",onClick:()=>l(!a),size:"sm",variant:"outline",children:_.jsx(YB,{className:"h-4 w-4",strokeWidth:1.5})})}),!o&&_.jsx(gK,{})]})]})}const Vk=m.forwardRef(({className:e,...t},n)=>_.jsx("div",{role:"editor-panel",ref:n,className:Pe("flex grow min-h-[80vh]",e),...t}));Vk.displayName="EditorPanel";const Hk=m.forwardRef(({className:e,...t},n)=>_.jsx("div",{ref:n,className:Pe(" flex flex-col space-y-2 w-[270px]",e),...t}));Hk.displayName="EditorAside";const Wk=m.forwardRef(({className:e,...t},n)=>_.jsx("div",{ref:n,className:Pe(" grow",e),...t}));Wk.displayName="EditorMain";const QK=[" ","Enter","ArrowUp","ArrowDown"],JK=[" ","Enter"],kp="Select",[Mp,Dp,ZK]=df(kp),[Fl,afe]=kn(kp,[ZK,ji]),Cy=ji(),[eX,wa]=Fl(kp),[tX,nX]=Fl(kp),rX=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:o,value:s,defaultValue:a,onValueChange:l,dir:c,name:d,autoComplete:f,disabled:g,required:p}=e,v=Cy(t),[y,x]=m.useState(null),[w,S]=m.useState(null),[C,P]=m.useState(!1),O=js(c),[k=!1,A]=Jn({prop:r,defaultProp:i,onChange:o}),[L,F]=Jn({prop:s,defaultProp:a,onChange:l}),j=m.useRef(null),B=y?!!y.closest("form"):!0,[H,K]=m.useState(new Set),Y=Array.from(H).map($=>$.props.value).join(";");return m.createElement(Eu,v,m.createElement(eX,{required:p,scope:t,trigger:y,onTriggerChange:x,valueNode:w,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:P,contentId:sr(),value:L,onValueChange:F,open:k,onOpenChange:A,dir:O,triggerPointerDownPosRef:j,disabled:g},m.createElement(Mp.Provider,{scope:t},m.createElement(tX,{scope:e.__scopeSelect,onNativeOptionAdd:m.useCallback($=>{K(Z=>new Set(Z).add($))},[]),onNativeOptionRemove:m.useCallback($=>{K(Z=>{const U=new Set(Z);return U.delete($),U})},[])},n)),B?m.createElement(Zk,{key:Y,"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:L,onChange:$=>F($.target.value),disabled:g},L===void 0?m.createElement("option",{value:""}):null,Array.from(H)):null))},iX="SelectTrigger",oX=m.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,o=Cy(n),s=wa(iX,n),a=s.disabled||r,l=et(t,s.onTriggerChange),c=Dp(n),[d,f,g]=eM(v=>{const y=c().filter(S=>!S.disabled),x=y.find(S=>S.value===s.value),w=tM(y,v,x);w!==void 0&&s.onValueChange(w.value)}),p=()=>{a||(s.onOpenChange(!0),g())};return m.createElement(Ou,ae({asChild:!0},o),m.createElement(Ve.button,ae({type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Jk(s.value)?"":void 0},i,{ref:l,onClick:Ee(i.onClick,v=>{v.currentTarget.focus()}),onPointerDown:Ee(i.onPointerDown,v=>{const y=v.target;y.hasPointerCapture(v.pointerId)&&y.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&(p(),s.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)},v.preventDefault())}),onKeyDown:Ee(i.onKeyDown,v=>{const y=d.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&f(v.key),!(y&&v.key===" ")&&QK.includes(v.key)&&(p(),v.preventDefault())})})))}),sX="SelectValue",aX=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:o,placeholder:s="",...a}=e,l=wa(sX,n),{onValueNodeHasChildrenChange:c}=l,d=o!==void 0,f=et(t,l.onValueNodeChange);return Hn(()=>{c(d)},[c,d]),m.createElement(Ve.span,ae({},a,{ref:f,style:{pointerEvents:"none"}}),Jk(l.value)?m.createElement(m.Fragment,null,s):o)}),lX=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return m.createElement(Ve.span,ae({"aria-hidden":!0},i,{ref:t}),r||"▼")}),cX=e=>m.createElement(Dh,ae({asChild:!0},e)),jl="SelectContent",uX=m.forwardRef((e,t)=>{const n=wa(jl,e.__scopeSelect),[r,i]=m.useState();if(Hn(()=>{i(new DocumentFragment)},[]),!n.open){const o=r;return o?Mt.createPortal(m.createElement(qk,{scope:e.__scopeSelect},m.createElement(Mp.Slot,{scope:e.__scopeSelect},m.createElement("div",null,e.children))),o):null}return m.createElement(dX,ae({},e,{ref:t}))}),So=10,[qk,_a]=Fl(jl),dX=m.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:s,side:a,sideOffset:l,align:c,alignOffset:d,arrowPadding:f,collisionBoundary:g,collisionPadding:p,sticky:v,hideWhenDetached:y,avoidCollisions:x,...w}=e,S=wa(jl,n),[C,P]=m.useState(null),[O,k]=m.useState(null),A=et(t,fe=>P(fe)),[L,F]=m.useState(null),[j,B]=m.useState(null),H=Dp(n),[K,Y]=m.useState(!1),$=m.useRef(!1);m.useEffect(()=>{if(C)return ap(C)},[C]),rp();const Z=m.useCallback(fe=>{const[re,...ee]=H().map(V=>V.ref.current),[oe]=ee.slice(-1),xe=document.activeElement;for(const V of fe)if(V===xe||(V==null||V.scrollIntoView({block:"nearest"}),V===re&&O&&(O.scrollTop=0),V===oe&&O&&(O.scrollTop=O.scrollHeight),V==null||V.focus(),document.activeElement!==xe))return},[H,O]),U=m.useCallback(()=>Z([L,C]),[Z,L,C]);m.useEffect(()=>{K&&U()},[K,U]);const{onOpenChange:ie,triggerPointerDownPosRef:le}=S;m.useEffect(()=>{if(C){let fe={x:0,y:0};const re=oe=>{var xe,V,Me,$e;fe={x:Math.abs(Math.round(oe.pageX)-((xe=(V=le.current)===null||V===void 0?void 0:V.x)!==null&&xe!==void 0?xe:0)),y:Math.abs(Math.round(oe.pageY)-((Me=($e=le.current)===null||$e===void 0?void 0:$e.y)!==null&&Me!==void 0?Me:0))}},ee=oe=>{fe.x<=10&&fe.y<=10?oe.preventDefault():C.contains(oe.target)||ie(!1),document.removeEventListener("pointermove",re),le.current=null};return le.current!==null&&(document.addEventListener("pointermove",re),document.addEventListener("pointerup",ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",re),document.removeEventListener("pointerup",ee,{capture:!0})}}},[C,ie,le]),m.useEffect(()=>{const fe=()=>ie(!1);return window.addEventListener("blur",fe),window.addEventListener("resize",fe),()=>{window.removeEventListener("blur",fe),window.removeEventListener("resize",fe)}},[ie]);const[M,W]=eM(fe=>{const re=H().filter(xe=>!xe.disabled),ee=re.find(xe=>xe.ref.current===document.activeElement),oe=tM(re,fe,ee);oe&&setTimeout(()=>oe.ref.current.focus())}),ne=m.useCallback((fe,re,ee)=>{const oe=!$.current&&!ee;(S.value!==void 0&&S.value===re||oe)&&(F(fe),oe&&($.current=!0))},[S.value]),N=m.useCallback(()=>C==null?void 0:C.focus(),[C]),X=m.useCallback((fe,re,ee)=>{const oe=!$.current&&!ee;(S.value!==void 0&&S.value===re||oe)&&B(fe)},[S.value]),me=r==="popper"?Uk:fX,he=me===Uk?{side:a,sideOffset:l,align:c,alignOffset:d,arrowPadding:f,collisionBoundary:g,collisionPadding:p,sticky:v,hideWhenDetached:y,avoidCollisions:x}:{};return m.createElement(qk,{scope:n,content:C,viewport:O,onViewportChange:k,itemRefCallback:ne,selectedItem:L,onItemLeave:N,itemTextRefCallback:X,focusSelectedItem:U,selectedItemText:j,position:r,isPositioned:K,searchRef:M},m.createElement(hp,{as:ro,allowPinchZoom:!0},m.createElement(ip,{asChild:!0,trapped:S.open,onMountAutoFocus:fe=>{fe.preventDefault()},onUnmountAutoFocus:Ee(i,fe=>{var re;(re=S.trigger)===null||re===void 0||re.focus({preventScroll:!0}),fe.preventDefault()})},m.createElement(_l,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:fe=>fe.preventDefault(),onDismiss:()=>S.onOpenChange(!1)},m.createElement(me,ae({role:"listbox",id:S.contentId,"data-state":S.open?"open":"closed",dir:S.dir,onContextMenu:fe=>fe.preventDefault()},w,he,{onPlaced:()=>Y(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:Ee(w.onKeyDown,fe=>{const re=fe.ctrlKey||fe.altKey||fe.metaKey;if(fe.key==="Tab"&&fe.preventDefault(),!re&&fe.key.length===1&&W(fe.key),["ArrowUp","ArrowDown","Home","End"].includes(fe.key)){let oe=H().filter(xe=>!xe.disabled).map(xe=>xe.ref.current);if(["ArrowUp","End"].includes(fe.key)&&(oe=oe.slice().reverse()),["ArrowUp","ArrowDown"].includes(fe.key)){const xe=fe.target,V=oe.indexOf(xe);oe=oe.slice(V+1)}setTimeout(()=>Z(oe)),fe.preventDefault()}})}))))))}),fX=m.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,o=wa(jl,n),s=_a(jl,n),[a,l]=m.useState(null),[c,d]=m.useState(null),f=et(t,A=>d(A)),g=Dp(n),p=m.useRef(!1),v=m.useRef(!0),{viewport:y,selectedItem:x,selectedItemText:w,focusSelectedItem:S}=s,C=m.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&c&&y&&x&&w){const A=o.trigger.getBoundingClientRect(),L=c.getBoundingClientRect(),F=o.valueNode.getBoundingClientRect(),j=w.getBoundingClientRect();if(o.dir!=="rtl"){const xe=j.left-L.left,V=F.left-xe,Me=A.left-V,$e=A.width+Me,He=Math.max($e,L.width),Fe=window.innerWidth-So,xt=l0(V,[So,Fe-He]);a.style.minWidth=$e+"px",a.style.left=xt+"px"}else{const xe=L.right-j.right,V=window.innerWidth-F.right-xe,Me=window.innerWidth-A.right-V,$e=A.width+Me,He=Math.max($e,L.width),Fe=window.innerWidth-So,xt=l0(V,[So,Fe-He]);a.style.minWidth=$e+"px",a.style.right=xt+"px"}const B=g(),H=window.innerHeight-So*2,K=y.scrollHeight,Y=window.getComputedStyle(c),$=parseInt(Y.borderTopWidth,10),Z=parseInt(Y.paddingTop,10),U=parseInt(Y.borderBottomWidth,10),ie=parseInt(Y.paddingBottom,10),le=$+Z+K+ie+U,M=Math.min(x.offsetHeight*5,le),W=window.getComputedStyle(y),ne=parseInt(W.paddingTop,10),N=parseInt(W.paddingBottom,10),X=A.top+A.height/2-So,me=H-X,he=x.offsetHeight/2,fe=x.offsetTop+he,re=$+Z+fe,ee=le-re;if(re<=X){const xe=x===B[B.length-1].ref.current;a.style.bottom="0px";const V=c.clientHeight-y.offsetTop-y.offsetHeight,Me=Math.max(me,he+(xe?N:0)+V+U),$e=re+Me;a.style.height=$e+"px"}else{const xe=x===B[0].ref.current;a.style.top="0px";const Me=Math.max(X,$+y.offsetTop+(xe?ne:0)+he)+ee;a.style.height=Me+"px",y.scrollTop=re-X+y.offsetTop}a.style.margin=`${So}px 0`,a.style.minHeight=M+"px",a.style.maxHeight=H+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[g,o.trigger,o.valueNode,a,c,y,x,w,o.dir,r]);Hn(()=>C(),[C]);const[P,O]=m.useState();Hn(()=>{c&&O(window.getComputedStyle(c).zIndex)},[c]);const k=m.useCallback(A=>{A&&v.current===!0&&(C(),S==null||S(),v.current=!1)},[C,S]);return m.createElement(hX,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:k},m.createElement("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:P}},m.createElement(Ve.div,ae({},i,{ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}}))))}),Uk=m.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=So,...o}=e,s=Cy(n);return m.createElement(Pu,ae({},s,o,{ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}}))}),[hX,Ey]=Fl(jl,{}),Gk="SelectViewport",pX=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=_a(Gk,n),o=Ey(Gk,n),s=et(t,i.onViewportChange),a=m.useRef(0);return m.createElement(m.Fragment,null,m.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"}}),m.createElement(Mp.Slot,{scope:n},m.createElement(Ve.div,ae({"data-radix-select-viewport":"",role:"presentation"},r,{ref:s,style:{position:"relative",flex:1,overflow:"auto",...r.style},onScroll:Ee(r.onScroll,l=>{const c=l.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:f}=o;if(f!=null&&f.current&&d){const g=Math.abs(a.current-c.scrollTop);if(g>0){const p=window.innerHeight-So*2,v=parseFloat(d.style.minHeight),y=parseFloat(d.style.height),x=Math.max(v,y);if(x<p){const w=x+g,S=Math.min(p,w),C=w-S;d.style.height=S+"px",d.style.bottom==="0px"&&(c.scrollTop=C>0?C:0,d.style.justifyContent="flex-end")}}}a.current=c.scrollTop})}))))}),gX="SelectGroup",[mX,vX]=Fl(gX),bX=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=sr();return m.createElement(mX,{scope:n,id:i},m.createElement(Ve.div,ae({role:"group","aria-labelledby":i},r,{ref:t})))}),yX="SelectLabel",xX=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=vX(yX,n);return m.createElement(Ve.div,ae({id:i.id},r,{ref:t}))}),Oy="SelectItem",[wX,Yk]=Fl(Oy),_X=m.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...s}=e,a=wa(Oy,n),l=_a(Oy,n),c=a.value===r,[d,f]=m.useState(o??""),[g,p]=m.useState(!1),v=et(t,w=>{var S;return(S=l.itemRefCallback)===null||S===void 0?void 0:S.call(l,w,r,i)}),y=sr(),x=()=>{i||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return m.createElement(wX,{scope:n,value:r,disabled:i,textId:y,isSelected:c,onItemTextChange:m.useCallback(w=>{f(S=>{var C;return S||((C=w==null?void 0:w.textContent)!==null&&C!==void 0?C:"").trim()})},[])},m.createElement(Mp.ItemSlot,{scope:n,value:r,disabled:i,textValue:d},m.createElement(Ve.div,ae({role:"option","aria-labelledby":y,"data-highlighted":g?"":void 0,"aria-selected":c&&g,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1},s,{ref:v,onFocus:Ee(s.onFocus,()=>p(!0)),onBlur:Ee(s.onBlur,()=>p(!1)),onPointerUp:Ee(s.onPointerUp,x),onPointerMove:Ee(s.onPointerMove,w=>{if(i){var S;(S=l.onItemLeave)===null||S===void 0||S.call(l)}else w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ee(s.onPointerLeave,w=>{if(w.currentTarget===document.activeElement){var S;(S=l.onItemLeave)===null||S===void 0||S.call(l)}}),onKeyDown:Ee(s.onKeyDown,w=>{var S;((S=l.searchRef)===null||S===void 0?void 0:S.current)!==""&&w.key===" "||(JK.includes(w.key)&&x(),w.key===" "&&w.preventDefault())})}))))}),Tp="SelectItemText",SX=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...o}=e,s=wa(Tp,n),a=_a(Tp,n),l=Yk(Tp,n),c=nX(Tp,n),[d,f]=m.useState(null),g=et(t,w=>f(w),l.onItemTextChange,w=>{var S;return(S=a.itemTextRefCallback)===null||S===void 0?void 0:S.call(a,w,l.value,l.disabled)}),p=d==null?void 0:d.textContent,v=m.useMemo(()=>m.createElement("option",{key:l.value,value:l.value,disabled:l.disabled},p),[l.disabled,l.value,p]),{onNativeOptionAdd:y,onNativeOptionRemove:x}=c;return Hn(()=>(y(v),()=>x(v)),[y,x,v]),m.createElement(m.Fragment,null,m.createElement(Ve.span,ae({id:l.textId},o,{ref:g})),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Mt.createPortal(o.children,s.valueNode):null)}),CX="SelectItemIndicator",EX=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Yk(CX,n).isSelected?m.createElement(Ve.span,ae({"aria-hidden":!0},r,{ref:t})):null}),Kk="SelectScrollUpButton",OX=m.forwardRef((e,t)=>{const n=_a(Kk,e.__scopeSelect),r=Ey(Kk,e.__scopeSelect),[i,o]=m.useState(!1),s=et(t,r.onScrollButtonChange);return Hn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const c=a.scrollTop>0;o(c)};const a=n.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),i?m.createElement(Qk,ae({},e,{ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}})):null}),Xk="SelectScrollDownButton",PX=m.forwardRef((e,t)=>{const n=_a(Xk,e.__scopeSelect),r=Ey(Xk,e.__scopeSelect),[i,o]=m.useState(!1),s=et(t,r.onScrollButtonChange);return Hn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const c=a.scrollHeight-a.clientHeight,d=Math.ceil(a.scrollTop)<c;o(d)};const a=n.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),i?m.createElement(Qk,ae({},e,{ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}})):null}),Qk=m.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,o=_a("SelectScrollButton",n),s=m.useRef(null),a=Dp(n),l=m.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return m.useEffect(()=>()=>l(),[l]),Hn(()=>{var c;const d=a().find(f=>f.ref.current===document.activeElement);d==null||(c=d.ref.current)===null||c===void 0||c.scrollIntoView({block:"nearest"})},[a]),m.createElement(Ve.div,ae({"aria-hidden":!0},i,{ref:t,style:{flexShrink:0,...i.style},onPointerDown:Ee(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Ee(i.onPointerMove,()=>{var c;(c=o.onItemLeave)===null||c===void 0||c.call(o),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Ee(i.onPointerLeave,()=>{l()})}))}),kX=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return m.createElement(Ve.div,ae({"aria-hidden":!0},r,{ref:t}))});function Jk(e){return e===""||e===void 0}const Zk=m.forwardRef((e,t)=>{const{value:n,...r}=e,i=m.useRef(null),o=et(t,i),s=Op(n);return m.useEffect(()=>{const a=i.current,l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==n&&d){const f=new Event("change",{bubbles:!0});d.call(a,n),a.dispatchEvent(f)}},[s,n]),m.createElement(T2,{asChild:!0},m.createElement("select",ae({},r,{ref:o,defaultValue:n})))});Zk.displayName="BubbleSelect";function eM(e){const t=wn(e),n=m.useRef(""),r=m.useRef(0),i=m.useCallback(s=>{const a=n.current+s;t(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),o=m.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function tM(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let s=MX(e,Math.max(o,0));i.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function MX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const DX=rX,nM=oX,TX=aX,AX=lX,IX=cX,rM=uX,NX=pX,RX=bX,iM=xX,oM=_X,LX=SX,$X=EX,sM=OX,aM=PX,lM=kX,cM=DX,uM=RX,dM=TX,Py=de.forwardRef(({className:e,children:t,...n},r)=>_.jsxs(nM,{ref:r,className:Pe("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,_.jsx(AX,{asChild:!0,children:_.jsx(Wb,{className:"h-4 w-4 opacity-50"})})]}));Py.displayName=nM.displayName;const fM=de.forwardRef(({className:e,...t},n)=>_.jsx(sM,{ref:n,className:Pe("flex cursor-default items-center justify-center py-1",e),...t,children:_.jsx(GB,{className:"h-4 w-4"})}));fM.displayName=sM.displayName;const hM=de.forwardRef(({className:e,...t},n)=>_.jsx(aM,{ref:n,className:Pe("flex cursor-default items-center justify-center py-1",e),...t,children:_.jsx(Wb,{className:"h-4 w-4"})}));hM.displayName=aM.displayName;const ky=de.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>_.jsx(IX,{children:_.jsxs(rM,{ref:i,className:Pe("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[_.jsx(fM,{}),_.jsx(NX,{className:Pe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),_.jsx(hM,{})]})}));ky.displayName=rM.displayName;const Ap=de.forwardRef(({className:e,...t},n)=>_.jsx(iM,{ref:n,className:Pe("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Ap.displayName=iM.displayName;const Sa=de.forwardRef(({className:e,children:t,...n},r)=>_.jsxs(oM,{ref:r,className:Pe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[_.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:_.jsx($X,{children:_.jsx(Rh,{className:"h-4 w-4"})})}),_.jsx(LX,{children:t})]}));Sa.displayName=oM.displayName;const FX=de.forwardRef(({className:e,...t},n)=>_.jsx(lM,{ref:n,className:Pe("-mx-1 my-1 h-px bg-muted",e),...t}));FX.displayName=lM.displayName;function Ip({title:e,items:t,value:n,isLoading:r,isError:i,onChange:o}){const s=r?"Loading...":i?"Error":n;function a(){if(e==="Connection")return _.jsx(eV,{className:" rotate-90",strokeWidth:1,size:16});if(e==="Database")return _.jsx(KB,{strokeWidth:1,size:16});if(e==="Schema")return _.jsx(iV,{strokeWidth:1,size:16});if(e==="Table")return _.jsx(qb,{strokeWidth:1,size:16})}return _.jsxs("div",{className:"flex gap-2 items-center",children:[_.jsx("div",{className:" shrink-0",children:a()}),_.jsxs(cM,{value:s,onValueChange:o,children:[_.jsx(Py,{className:"focus:ring-offset-0 focus:ring-1 h-7 w-[190px] ",children:_.jsx(dM,{placeholder:r?"Loading...":i?"Error":`Select ${e}`})}),_.jsx(ky,{children:_.jsxs(uM,{children:[r?_.jsx(Ap,{children:"Loading..."}):_.jsx(Ap,{children:e}),_.jsx(_.Fragment,{children:t&&t.map(l=>_.jsx(Sa,{value:l.id,children:l.name},l.id))}),(r||i)&&_.jsx(Sa,{value:s,children:s})]})})]})]})}function jX({column:e}){const[t,n]=m.useState(!1),r=_e(d=>d.selectedTableName),i=_e(d=>d.selectedSchemaName),o=_e(d=>d.sqlGen),s=_e(d=>d.actions.setSqlGen),a=_e(d=>d.actions.setCardSql),l=_e(d=>d.actions.setRunSql);function c(d,f){const g=qO(d,o,f);s(g);const p=WO(g,i||"",r);p&&(a(p),l(!0)),n(!1)}return _.jsxs(pp,{open:t,onOpenChange:n,children:[_.jsx(gp,{asChild:!0,children:_.jsx(Wj,{className:"w-3 h-3 text-foreground/40 cursor-pointer"})}),_.jsx(qu,{align:"center",className:" p-0 w-18 rounded-none shadow-none ",children:_.jsxs("ul",{className:"text-xs ",children:[_.jsx("li",{onClick:()=>c(e,"COUNT"),className:" px-3 p-1 hover:bg-muted transition-colors cursor-pointer",children:"Count"}),_.jsx("li",{onClick:()=>c(e,"AVG"),className:" px-3 p-1 hover:bg-muted transition-colors cursor-pointer",children:"Avg"}),_.jsx("li",{onClick:()=>c(e,"SUM"),className:"px-3 p-1 hover:bg-muted transition-colors cursor-pointer",children:"Sum"}),_.jsx("li",{onClick:()=>c(e,"MAX"),className:"px-3 p-1 hover:bg-muted transition-colors cursor-pointer",children:"Max"}),_.jsx("li",{onClick:()=>c(e,"MIN"),className:"px-3 p-1 hover:bg-muted transition-colors cursor-pointer",children:"Min"})]})})]})}function pM({column:e}){return _.jsxs(Vb,{children:[_.jsx(I2,{asChild:!0,children:P0.includes(e.data_type.toLowerCase())?_.jsx("span",{className:" font-thin",children:"T"}):Tl.includes(e.data_type.toLowerCase())?_.jsx("span",{className:" font-thin",children:"#"}):Nu.includes(e.data_type.toLowerCase())?_.jsx("span",{className:" font-thin",children:"D"}):HO.includes(e.data_type.toLowerCase())?_.jsx("span",{className:" font-thin",children:"B"}):_.jsx("span",{className:" font-thin",children:"?"})}),_.jsx(Ih,{children:_.jsx("p",{className:"text-xs font-mono",children:e.data_type})})]})}function zX({schemaName:e,tableName:t,columns:n,status:r}){const i=_e(f=>f.sqlGen),o=_e(f=>f.actions.setRunSql),s=_e(f=>f.actions.setSqlGen),a=_e(f=>f.actions.setIsShowingVisual),l=_e(f=>f.actions.setCardSql);function c(f){const g=qO(f,i);s(g);const p=WO(g,e,t);p&&(l(p),o(!0))}function d(){const f=M0(e,t);a(!1),l(`SELECT * FROM ${f} LIMIT 10`),o(!0)}return _.jsxs("div",{className:"px-4",children:[_.jsx("div",{className:" font-medium px-2 pt-2 pb-3",children:_.jsxs(it,{disabled:r!=="Success",onClick:d,variant:"secondary",className:" h-7 flex w-full",children:[r!=="Success"&&_.jsx(Mu,{className:" w-4 h-4 animate-spin mr-2 text-foreground/50"}),"Show top 10 rows"]})}),_.jsxs(kl,{className:`w-full ${t==="api"?"h-[74vh]":"h-[60vh]"}`,children:[n==null?void 0:n.map(f=>_.jsxs("div",{onClick:()=>c(f),className:Pe(" text-sm flex items-center justify-between px-3 py-[6px] transition-colors hover:bg-muted/50 cursor-pointer rounded ",{" bg-muted":BW(f,i)}),children:[_.jsxs("div",{className:"flex items-center space-x-2 ",children:[_.jsx(pM,{column:f}),_.jsx("span",{children:f.column_name})]}),Tl.includes(f.data_type)&&_.jsx("div",{onClick:g=>g.stopPropagation(),className:" flex items-center justify-end ",children:_.jsx(jX,{column:f})})]},f.column_name)),_.jsx(Hh,{orientation:"vertical"}),_.jsx(Hh,{orientation:"horizontal"})]})]})}function gM({ColumnsComponent:e}){const t=_e(Y=>Y.selectedConnectionId);_e(Y=>Y.card.sql);const n=_e(Y=>Y.selectedDatabaseName),r=_e(Y=>Y.selectedSchemaName),i=_e(Y=>Y.selectedTableName),o=_e(Y=>Y.actions.setSelectedConnectionId),s=_e(Y=>Y.actions.setSelectedDatabaseName),a=_e(Y=>Y.actions.setSelectedSchemaName),l=_e(Y=>Y.actions.setSelectedTableName),c=_e(Y=>Y.actions.setCardSql),{connectionItems:d,schemaItems:f,databaseItems:g,tableItems:p,columns:v,isConnectionsLoading:y,isConnectionsError:x,isDatabasesLoadingOrFetching:w,isDatabaseError:S,isSchemaLoadingOrFetching:C,isSchemaError:P,isColumnsError:O,isColumnsLoadingOrFetching:k,isAPIConnection:A}=iH();m.useEffect(()=>{A&&(s("NA"),a(""),l("api"))},[A,c,l,a,s]);const L=A?"api":i||"",F=A?"":r||"";function j(Y){a(Y),l("")}function B(Y){s(Y),a(""),l("")}function H(Y){o(Y)}function K(){return e?e(F,L,v):_.jsx(zX,{schemaName:F,tableName:L,columns:v,status:k?"Loading...":O?"Error":"Success"})}return _.jsxs("aside",{className:" grow flex flex-col xbg-red-100 ",children:[_.jsxs("section",{className:"space-y-3 pt-4 pb-3 px-6",children:[_.jsx(Ip,{items:d,title:"Connection",value:t||"",onChange:H,isLoading:y,isError:x}),!A&&_.jsxs(_.Fragment,{children:[_.jsx(Ip,{onChange:B,isError:S,isLoading:w,items:g,value:n||"",title:"Database"}),_.jsx(Ip,{onChange:j,isError:P,isLoading:C,items:f,value:r||"",title:"Schema"}),_.jsx(Ip,{onChange:l,isError:S,items:p,isLoading:w,value:i||"",title:"Table"})]})]}),K(),_.jsx("div",{className:" grow justify-end flex flex-col pt-6 "})]})}const{createElement:zl,createContext:BX,createRef:lfe,forwardRef:mM,useCallback:Lr,useContext:vM,useEffect:Ca,useImperativeHandle:bM,useLayoutEffect:VX,useMemo:HX,useRef:ti,useState:Np}=de,yM=de.useId,Rp=BX(null);Rp.displayName="PanelGroupContext";const Qu=VX,WX=typeof yM=="function"?yM:()=>null;let qX=0;function My(e=null){const t=WX(),n=ti(e||t||null);return n.current===null&&(n.current=""+qX++),e??n.current}function xM({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:i,forwardedRef:o,id:s,maxSize:a,minSize:l,onCollapse:c,onExpand:d,onResize:f,order:g,style:p,tagName:v="div",...y}){const x=vM(Rp);if(x===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:w,expandPanel:S,getPanelSize:C,getPanelStyle:P,groupId:O,isPanelCollapsed:k,registerPanel:A,resizePanel:L,unregisterPanel:F}=x,j=My(s),B=ti({callbacks:{onCollapse:c,onExpand:d,onResize:f},constraints:{collapsedSize:n,collapsible:r,defaultSize:i,maxSize:a,minSize:l},id:j,idIsFromProps:s!==void 0,order:g});ti({didLogMissingDefaultSizeWarning:!1}),Qu(()=>{const{callbacks:K,constraints:Y}=B.current;B.current.id=j,B.current.idIsFromProps=s!==void 0,B.current.order=g,K.onCollapse=c,K.onExpand=d,K.onResize=f,Y.collapsedSize=n,Y.collapsible=r,Y.defaultSize=i,Y.maxSize=a,Y.minSize=l}),Qu(()=>{const K=B.current;return A(K),()=>{F(K)}},[g,j,A,F]),bM(o,()=>({collapse:()=>{w(B.current)},expand:()=>{S(B.current)},getId(){return j},getSize(){return C(B.current)},isCollapsed(){return k(B.current)},isExpanded(){return!k(B.current)},resize:K=>{L(B.current,K)}}),[w,S,C,k,j,L]);const H=P(B.current,i);return zl(v,{...y,children:e,className:t,style:{...H,...p},"data-panel":"","data-panel-id":j,"data-panel-group-id":O,"data-panel-collapsible":void 0,"data-panel-size":void 0})}const wM=mM((e,t)=>zl(xM,{...e,forwardedRef:t}));xM.displayName="Panel",wM.displayName="forwardRef(Panel)";function lt(e,t="Assertion failed!"){if(!e)throw console.error(t),Error(t)}const _M=10;function Ju(e,t,n=_M){e=parseFloat(e.toFixed(n)),t=parseFloat(t.toFixed(n));const r=e-t;return r===0?0:r>0?1:-1}function $r(e,t,n){return Ju(e,t,n)===0}function Bl({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];lt(r!=null);let{collapsedSize:i=0,collapsible:o,maxSize:s=100,minSize:a=0}=r;if(Ju(n,a)<0)if(o){const l=(i+a)/2;Ju(n,l)<0?n=i:n=a}else n=a;return n=Math.min(s,n),n=parseFloat(n.toFixed(_M)),n}function Zu({delta:e,layout:t,panelConstraints:n,pivotIndices:r,trigger:i}){if($r(e,0))return t;const o=[...t],[s,a]=r;lt(s!=null),lt(a!=null);let l=0;if(i==="keyboard"){{const d=e<0?a:s,f=n[d];if(lt(f),f.collapsible){const g=t[d];lt(g!=null);const p=n[d];lt(p);const{collapsedSize:v=0,minSize:y=0}=p;if($r(g,v)){const x=y-g;Ju(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}{const d=e<0?s:a,f=n[d];lt(f);const{collapsible:g}=f;if(g){const p=t[d];lt(p!=null);const v=n[d];lt(v);const{collapsedSize:y=0,minSize:x=0}=v;if($r(p,x)){const w=p-y;Ju(w,Math.abs(e))>0&&(e=e<0?0-w:w)}}}}{const d=e<0?1:-1;let f=e<0?a:s,g=0;for(;;){const v=t[f];lt(v!=null);const x=Bl({panelConstraints:n,panelIndex:f,size:100})-v;if(g+=x,f+=d,f<0||f>=n.length)break}const p=Math.min(Math.abs(e),Math.abs(g));e=e<0?0-p:p}{let f=e<0?s:a;for(;f>=0&&f<n.length;){const g=Math.abs(e)-Math.abs(l),p=t[f];lt(p!=null);const v=p-g,y=Bl({panelConstraints:n,panelIndex:f,size:v});if(!$r(p,y)&&(l+=p-y,o[f]=y,l.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?f--:f++}}if($r(l,0))return t;{const d=e<0?a:s,f=t[d];lt(f!=null);const g=f+l,p=Bl({panelConstraints:n,panelIndex:d,size:g});if(o[d]=p,!$r(p,g)){let v=g-p,x=e<0?a:s;for(;x>=0&&x<n.length;){const w=o[x];lt(w!=null);const S=w+v,C=Bl({panelConstraints:n,panelIndex:x,size:S});if($r(w,C)||(v-=C-w,o[x]=C),$r(v,0))break;e>0?x--:x++}}}const c=o.reduce((d,f)=>f+d,0);return $r(c,100)?o:t}function UX({layout:e,panelsArray:t,pivotIndices:n}){let r=0,i=100,o=0,s=0;const a=n[0];lt(a!=null),t.forEach((f,g)=>{const{constraints:p}=f,{maxSize:v=100,minSize:y=0}=p;g===a?(r=y,i=v):(o+=y,s+=v)});const l=Math.min(i,100-o),c=Math.max(r,100-s),d=e[a];return{valueMax:l,valueMin:c,valueNow:d}}function ed(e){return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function SM(e,t){const r=ed(e).findIndex(i=>i.getAttribute("data-panel-resize-handle-id")===t);return r??null}function CM(e,t){const n=SM(e,t);return n!=null?[n,n+1]:[-1,-1]}function EM(e){const t=document.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return t||null}function Lp(e){const t=document.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function GX(e,t,n){var r,i,o,s;const a=Lp(t),l=ed(e),c=a?l.indexOf(a):-1,d=(r=(i=n[c])===null||i===void 0?void 0:i.id)!==null&&r!==void 0?r:null,f=(o=(s=n[c+1])===null||s===void 0?void 0:s.id)!==null&&o!==void 0?o:null;return[d,f]}function YX({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:i,setLayout:o}){ti({didWarnAboutMissingResizeHandle:!1}),Qu(()=>{const s=ed(n);for(let a=0;a<i.length-1;a++){const{valueMax:l,valueMin:c,valueNow:d}=UX({layout:r,panelsArray:i,pivotIndices:[a,a+1]}),f=s[a];if(f!=null){const g=i[a];lt(g),f.setAttribute("aria-controls",g.id),f.setAttribute("aria-valuemax",""+Math.round(l)),f.setAttribute("aria-valuemin",""+Math.round(c)),f.setAttribute("aria-valuenow",d!=null?""+Math.round(d):"")}}return()=>{s.forEach((a,l)=>{a.removeAttribute("aria-controls"),a.removeAttribute("aria-valuemax"),a.removeAttribute("aria-valuemin"),a.removeAttribute("aria-valuenow")})}},[n,r,i]),Ca(()=>{const s=t.current;lt(s);const{panelDataArray:a}=s,l=EM(n);lt(l!=null,`No group found for id "${n}"`);const c=ed(n);lt(c);const d=c.map(f=>{const g=f.getAttribute("data-panel-resize-handle-id");lt(g);const[p,v]=GX(n,g,a);if(p==null||v==null)return()=>{};const y=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const w=a.findIndex(S=>S.id===p);if(w>=0){const S=a[w];lt(S);const C=r[w],{collapsedSize:P=0,collapsible:O,minSize:k=0}=S.constraints;if(C!=null&&O){const A=Zu({delta:$r(C,P)?k-P:P-C,layout:r,panelConstraints:a.map(L=>L.constraints),pivotIndices:CM(n,g),trigger:"keyboard"});r!==A&&o(A)}}break}}};return f.addEventListener("keydown",y),()=>{f.removeEventListener("keydown",y)}});return()=>{d.forEach(f=>f())}},[e,t,n,r,i,o])}function OM(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function PM(e){return e.type==="keydown"}function kM(e){return e.type.startsWith("mouse")}function MM(e){return e.type.startsWith("touch")}function DM(e,t){const n=e==="horizontal";if(kM(t))return n?t.clientX:t.clientY;if(MM(t)){const r=t.touches[0];return lt(r),n?r.screenX:r.screenY}else throw Error(`Unsupported event type "${t.type}"`)}function KX(e,t,n,r){const i=n==="horizontal",o=Lp(t);lt(o);const s=o.getAttribute("data-panel-group-id");lt(s);let{initialCursorPosition:a}=r;const l=DM(n,e),c=EM(s);lt(c);const d=c.getBoundingClientRect(),f=i?d.width:d.height;return(l-a)/f*100}function XX(e,t,n,r,i){if(PM(e)){const o=n==="horizontal";let s=0;e.shiftKey?s=100:i!=null?s=i:s=10;let a=0;switch(e.key){case"ArrowDown":a=o?0:s;break;case"ArrowLeft":a=o?-s:0;break;case"ArrowRight":a=o?s:0;break;case"ArrowUp":a=o?0:-s;break;case"End":a=100;break;case"Home":a=-100;break}return a}else return r==null?0:KX(e,t,n,r)}function QX({panelDataArray:e}){const t=Array(e.length),n=e.map(o=>o.constraints);let r=0,i=100;for(let o=0;o<e.length;o++){const s=n[o];lt(s);const{defaultSize:a}=s;a!=null&&(r++,t[o]=a,i-=a)}for(let o=0;o<e.length;o++){const s=n[o];lt(s);const{defaultSize:a}=s;if(a!=null)continue;const l=e.length-r,c=i/l;r++,t[o]=c,i-=c}return t}function Vl(e,t,n){t.forEach((r,i)=>{const o=e[i];lt(o);const{callbacks:s,constraints:a,id:l}=o,{collapsedSize:c=0,collapsible:d}=a,f=n[l];if(f==null||r!==f){n[l]=r;const{onCollapse:g,onExpand:p,onResize:v}=s;v&&v(r,f),d&&(g||p)&&(p&&(f==null||f===c)&&r!==c&&p(),g&&(f==null||f!==c)&&r===c&&g())}})}function $p(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function JX({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:i,precision:o=3}){const s=n[i];let a;return s==null?a=e??"1":r.length===1?a="1":a=s.toPrecision(o),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}let Dy=null,Ea=null;function TM(e){switch(e){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function ZX(){Ea!==null&&(document.head.removeChild(Ea),Dy=null,Ea=null)}function Ty(e){if(Dy===e)return;Dy=e;const t=TM(e);Ea===null&&(Ea=document.createElement("style"),document.head.appendChild(Ea)),Ea.innerHTML=`*{cursor: ${t}!important;}`}function eQ(e,t=10){let n=null;return(...i)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...i)},t)}}function AM(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function IM(e){return`react-resizable-panels:${e}`}function NM(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:i,order:o}=t;return i?r:o?`${o}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function RM(e,t){try{const n=IM(e),r=t.getItem(n);if(r){const i=JSON.parse(r);if(typeof i=="object"&&i!=null)return i}}catch{}return null}function tQ(e,t,n){var r,i;const o=(r=RM(e,n))!==null&&r!==void 0?r:{},s=NM(t);return(i=o[s])!==null&&i!==void 0?i:null}function nQ(e,t,n,r,i){var o;const s=IM(e),a=NM(t),l=(o=RM(e,i))!==null&&o!==void 0?o:{};l[a]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{i.setItem(s,JSON.stringify(l))}catch(c){console.error(c)}}function LM({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((o,s)=>o+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(o=>`${o}%`).join(", ")}`);if(!$r(r,100))for(let o=0;o<t.length;o++){const s=n[o];lt(s!=null);const a=100/r*s;n[o]=a}let i=0;for(let o=0;o<t.length;o++){const s=n[o];lt(s!=null);const a=Bl({panelConstraints:t,panelIndex:o,size:s});s!=a&&(i+=s-a,n[o]=a)}if(!$r(i,0))for(let o=0;o<t.length;o++){const s=n[o];lt(s!=null);const a=s+i,l=Bl({panelConstraints:t,panelIndex:o,size:a});if(s!==l&&(i-=l-s,n[o]=l,$r(i,0)))break}return n}const rQ=100,td={getItem:e=>(AM(td),td.getItem(e)),setItem:(e,t)=>{AM(td),td.setItem(e,t)}},$M={};function FM({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:i,id:o=null,onLayout:s=null,keyboardResizeBy:a=null,storage:l=td,style:c,tagName:d="div",...f}){const g=My(o),[p,v]=Np(null),[y,x]=Np([]),w=ti({}),S=ti(new Map),C=ti(0),P=ti({autoSaveId:e,direction:r,dragState:p,id:g,keyboardResizeBy:a,onLayout:s,storage:l}),O=ti({layout:y,panelDataArray:[],panelDataArrayChanged:!1});ti({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),bM(i,()=>({getId:()=>P.current.id,getLayout:()=>{const{layout:M}=O.current;return M},setLayout:M=>{const{onLayout:W}=P.current,{layout:ne,panelDataArray:N}=O.current,X=LM({layout:M,panelConstraints:N.map(me=>me.constraints)});OM(ne,X)||(x(X),O.current.layout=X,W&&W(X),Vl(N,X,w.current))}}),[]),Qu(()=>{P.current.autoSaveId=e,P.current.direction=r,P.current.dragState=p,P.current.id=g,P.current.onLayout=s,P.current.storage=l}),YX({committedValuesRef:P,eagerValuesRef:O,groupId:g,layout:y,panelDataArray:O.current.panelDataArray,setLayout:x}),Ca(()=>{const{panelDataArray:M}=O.current;if(e){if(y.length===0||y.length!==M.length)return;let W=$M[e];W==null&&(W=eQ(nQ,rQ),$M[e]=W);const ne=[...M],N=new Map(S.current);W(e,ne,N,y,l)}},[e,y,l]),Ca(()=>{});const k=Lr(M=>{const{onLayout:W}=P.current,{layout:ne,panelDataArray:N}=O.current;if(M.constraints.collapsible){const X=N.map(re=>re.constraints),{collapsedSize:me=0,panelSize:he,pivotIndices:fe}=Wl(N,M,ne);if(lt(he!=null),he!==me){S.current.set(M.id,he);const ee=Hl(N,M)===N.length-1?he-me:me-he,oe=Zu({delta:ee,layout:ne,panelConstraints:X,pivotIndices:fe,trigger:"imperative-api"});$p(ne,oe)||(x(oe),O.current.layout=oe,W&&W(oe),Vl(N,oe,w.current))}}},[]),A=Lr(M=>{const{onLayout:W}=P.current,{layout:ne,panelDataArray:N}=O.current;if(M.constraints.collapsible){const X=N.map(ee=>ee.constraints),{collapsedSize:me=0,panelSize:he,minSize:fe=0,pivotIndices:re}=Wl(N,M,ne);if(he===me){const ee=S.current.get(M.id),oe=ee!=null&&ee>=fe?ee:fe,V=Hl(N,M)===N.length-1?he-oe:oe-he,Me=Zu({delta:V,layout:ne,panelConstraints:X,pivotIndices:re,trigger:"imperative-api"});$p(ne,Me)||(x(Me),O.current.layout=Me,W&&W(Me),Vl(N,Me,w.current))}}},[]),L=Lr(M=>{const{layout:W,panelDataArray:ne}=O.current,{panelSize:N}=Wl(ne,M,W);return lt(N!=null),N},[]),F=Lr((M,W)=>{const{panelDataArray:ne}=O.current,N=Hl(ne,M);return JX({defaultSize:W,dragState:p,layout:y,panelData:ne,panelIndex:N})},[p,y]),j=Lr(M=>{const{layout:W,panelDataArray:ne}=O.current,{collapsedSize:N=0,collapsible:X,panelSize:me}=Wl(ne,M,W);return X===!0&&me===N},[]),B=Lr(M=>{const{layout:W,panelDataArray:ne}=O.current,{collapsedSize:N=0,collapsible:X,panelSize:me}=Wl(ne,M,W);return lt(me!=null),!X||me>N},[]),H=Lr(M=>{const{panelDataArray:W}=O.current;W.push(M),W.sort((ne,N)=>{const X=ne.order,me=N.order;return X==null&&me==null?0:X==null?-1:me==null?1:X-me}),O.current.panelDataArrayChanged=!0},[]);Qu(()=>{if(O.current.panelDataArrayChanged){O.current.panelDataArrayChanged=!1;const{autoSaveId:M,onLayout:W,storage:ne}=P.current,{layout:N,panelDataArray:X}=O.current;let me=null;if(M){const fe=tQ(M,X,ne);fe&&(S.current=new Map(Object.entries(fe.expandToSizes)),me=fe.layout)}me==null&&(me=QX({panelDataArray:X}));const he=LM({layout:me,panelConstraints:X.map(fe=>fe.constraints)});OM(N,he)||(x(he),O.current.layout=he,W&&W(he),Vl(X,he,w.current))}});const K=Lr(M=>function(ne){ne.preventDefault();const{direction:N,dragState:X,id:me,keyboardResizeBy:he,onLayout:fe}=P.current,{layout:re,panelDataArray:ee}=O.current,{initialLayout:oe}=X??{},xe=CM(me,M);let V=XX(ne,M,N,X,he);if(V===0)return;const Me=N==="horizontal";document.dir==="rtl"&&Me&&(V=-V);const $e=ee.map(xt=>xt.constraints),He=Zu({delta:V,layout:oe??re,panelConstraints:$e,pivotIndices:xe,trigger:PM(ne)?"keyboard":"mouse-or-touch"}),Fe=!$p(re,He);(kM(ne)||MM(ne))&&C.current!=V&&(C.current=V,Ty(Fe?Me?"horizontal":"vertical":Me?V<0?"horizontal-min":"horizontal-max":V<0?"vertical-min":"vertical-max")),Fe&&(x(He),O.current.layout=He,fe&&fe(He),Vl(ee,He,w.current))},[]),Y=Lr((M,W)=>{const{onLayout:ne}=P.current,{layout:N,panelDataArray:X}=O.current,me=X.map(xe=>xe.constraints),{panelSize:he,pivotIndices:fe}=Wl(X,M,N);lt(he!=null);const ee=Hl(X,M)===X.length-1?he-W:W-he,oe=Zu({delta:ee,layout:N,panelConstraints:me,pivotIndices:fe,trigger:"imperative-api"});$p(N,oe)||(x(oe),O.current.layout=oe,ne&&ne(oe),Vl(X,oe,w.current))},[]),$=Lr((M,W)=>{const{direction:ne}=P.current,{layout:N}=O.current,X=Lp(M);lt(X);const me=DM(ne,W);v({dragHandleId:M,dragHandleRect:X.getBoundingClientRect(),initialCursorPosition:me,initialLayout:N})},[]),Z=Lr(()=>{ZX(),v(null)},[]),U=Lr(M=>{const{panelDataArray:W}=O.current,ne=Hl(W,M);ne>=0&&(W.splice(ne,1),delete w.current[M.id],O.current.panelDataArrayChanged=!0)},[]),ie=HX(()=>({collapsePanel:k,direction:r,dragState:p,expandPanel:A,getPanelSize:L,getPanelStyle:F,groupId:g,isPanelCollapsed:j,isPanelExpanded:B,registerPanel:H,registerResizeHandle:K,resizePanel:Y,startDragging:$,stopDragging:Z,unregisterPanel:U}),[k,p,r,A,L,F,g,j,B,H,K,Y,$,Z,U]),le={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return zl(Rp.Provider,{value:ie},zl(d,{...f,children:t,className:n,style:{...le,...c},"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":g}))}const jM=mM((e,t)=>zl(FM,{...e,forwardedRef:t}));FM.displayName="PanelGroup",jM.displayName="forwardRef(PanelGroup)";function Hl(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function Wl(e,t,n){const r=e.map(c=>c.constraints),i=Hl(e,t),o=r[i],a=i===e.length-1?[i-1,i]:[i,i+1],l=n[i];return{...o,panelSize:l,pivotIndices:a}}function iQ({disabled:e,handleId:t,resizeHandler:n}){Ca(()=>{if(e||n==null)return;const r=Lp(t);if(r==null)return;const i=o=>{if(!o.defaultPrevented)switch(o.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{o.preventDefault(),n(o);break}case"F6":{o.preventDefault();const s=r.getAttribute("data-panel-group-id");lt(s);const a=ed(s),l=SM(s,t);lt(l!==null);const c=o.shiftKey?l>0?l-1:a.length-1:l+1<a.length?l+1:0;a[c].focus();break}}};return r.addEventListener("keydown",i),()=>{r.removeEventListener("keydown",i)}},[e,t,n])}function zM({children:e=null,className:t="",disabled:n=!1,id:r,onDragging:i,style:o={},tabIndex:s=0,tagName:a="div",...l}){const c=ti(null),d=ti({onDragging:i});Ca(()=>{d.current.onDragging=i});const f=vM(Rp);if(f===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:g,dragState:p,groupId:v,registerResizeHandle:y,startDragging:x,stopDragging:w}=f,S=My(r),C=(p==null?void 0:p.dragHandleId)===S,[P,O]=Np(!1),[k,A]=Np(null),L=Lr(()=>{const j=c.current;lt(j),j.blur(),w();const{onDragging:B}=d.current;B&&B(!1)},[w]);Ca(()=>{if(n)A(null);else{const j=y(S);A(()=>j)}},[n,S,y]),Ca(()=>{if(n||k==null||!C)return;const j=Y=>{k(Y)},B=Y=>{k(Y)},H=c.current;lt(H);const K=H.ownerDocument;return K.body.addEventListener("contextmenu",L),K.body.addEventListener("mousemove",j),K.body.addEventListener("touchmove",j),K.body.addEventListener("mouseleave",B),window.addEventListener("mouseup",L),window.addEventListener("touchend",L),()=>{K.body.removeEventListener("contextmenu",L),K.body.removeEventListener("mousemove",j),K.body.removeEventListener("touchmove",j),K.body.removeEventListener("mouseleave",B),window.removeEventListener("mouseup",L),window.removeEventListener("touchend",L)}},[g,n,C,k,L]),iQ({disabled:n,handleId:S,resizeHandler:k});const F={cursor:TM(g),touchAction:"none",userSelect:"none"};return zl(a,{...l,children:e,className:t,onBlur:()=>O(!1),onFocus:()=>O(!0),onMouseDown:j=>{x(S,j.nativeEvent);const B=d.current;lt(B);const{onDragging:H}=B;H&&H(!0)},onMouseUp:L,onTouchCancel:L,onTouchEnd:L,onTouchStart:j=>{x(S,j.nativeEvent);const B=d.current;lt(B);const{onDragging:H}=B;H&&H(!0)},ref:c,role:"separator",style:{...F,...o},tabIndex:s,"data-panel-group-direction":g,"data-panel-group-id":v,"data-resize-handle":"","data-resize-handle-active":C?"pointer":P?"keyboard":void 0,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":S})}zM.displayName="PanelResizeHandle";const BM=({className:e,...t})=>_.jsx(jM,{className:Pe("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),Fp=wM,VM=({withHandle:e,className:t,...n})=>_.jsx(zM,{className:Pe("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&_.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:_.jsx(QB,{className:"h-2.5 w-2.5"})})});function oQ(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function HM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function WM(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?HM(Object(n),!0).forEach(function(r){oQ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):HM(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function sQ(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function aQ(e,t){if(e==null)return{};var n=sQ(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function lQ(e,t){return cQ(e)||uQ(e,t)||dQ(e,t)||fQ()}function cQ(e){if(Array.isArray(e))return e}function uQ(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,i=!1,o=void 0;try{for(var s=e[Symbol.iterator](),a;!(r=(a=s.next()).done)&&(n.push(a.value),!(t&&n.length===t));r=!0);}catch(l){i=!0,o=l}finally{try{!r&&s.return!=null&&s.return()}finally{if(i)throw o}}return n}}function dQ(e,t){if(e){if(typeof e=="string")return qM(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qM(e,t)}}function qM(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function fQ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
429
429
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hQ(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function UM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function GM(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?UM(Object(n),!0).forEach(function(r){hQ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UM(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function pQ(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(i,o){return o(i)},r)}}function nd(e){return function t(){for(var n=this,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return i.length>=e.length?e.apply(this,i):function(){for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];return t.apply(n,[].concat(i,a))}}}function jp(e){return{}.toString.call(e).includes("Object")}function gQ(e){return!Object.keys(e).length}function rd(e){return typeof e=="function"}function mQ(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function vQ(e,t){return jp(t)||ls("changeType"),Object.keys(t).some(function(n){return!mQ(e,n)})&&ls("changeField"),t}function bQ(e){rd(e)||ls("selectorType")}function yQ(e){rd(e)||jp(e)||ls("handlerType"),jp(e)&&Object.values(e).some(function(t){return!rd(t)})&&ls("handlersType")}function xQ(e){e||ls("initialIsRequired"),jp(e)||ls("initialType"),gQ(e)&&ls("initialContent")}function wQ(e,t){throw new Error(e[t]||e.default)}var _Q={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},ls=nd(wQ)(_Q),zp={changes:vQ,selector:bQ,handler:yQ,initial:xQ};function SQ(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};zp.initial(e),zp.handler(t);var n={current:e},r=nd(OQ)(n,t),i=nd(EQ)(n),o=nd(zp.changes)(e),s=nd(CQ)(n);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return zp.selector(c),c(n.current)}function l(c){pQ(r,i,o,s)(c)}return[a,l]}function CQ(e,t){return rd(t)?t(e.current):t}function EQ(e,t){return e.current=GM(GM({},e.current),t),t}function OQ(e,t,n){return rd(t)?t(e.current):Object.keys(n).forEach(function(r){var i;return(i=t[r])===null||i===void 0?void 0:i.call(t,e.current[r])}),n}var PQ={create:SQ},kQ={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function MQ(e){return function t(){for(var n=this,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return i.length>=e.length?e.apply(this,i):function(){for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];return t.apply(n,[].concat(i,a))}}}function DQ(e){return{}.toString.call(e).includes("Object")}function TQ(e){return e||KM("configIsRequired"),DQ(e)||KM("configType"),e.urls?(AQ(),{paths:{vs:e.urls.monacoBase}}):e}function AQ(){console.warn(YM.deprecation)}function IQ(e,t){throw new Error(e[t]||e.default)}var YM={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
430
430
  You are using deprecated way of configuration.
@@ -435,7 +435,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
435
435
  monaco.config({ paths: { vs: '...' } })
436
436
 
437
437
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
438
- `},KM=MQ(IQ)(YM),NQ={config:TQ},RQ=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(i){return n.reduceRight(function(o,s){return s(o)},i)}};function XM(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],XM(e[n],t[n]))}),WM(WM({},e),t)}var LQ={type:"cancelation",msg:"operation is manually canceled"};function Ay(e){var t=!1,n=new Promise(function(r,i){e.then(function(o){return t?i(LQ):r(o)}),e.catch(i)});return n.cancel=function(){return t=!0},n}var $Q=PQ.create({config:kQ,isInitialized:!1,resolve:null,reject:null,monaco:null}),QM=lQ($Q,2),id=QM[0],Bp=QM[1];function FQ(e){var t=NQ.config(e),n=t.monaco,r=aQ(t,["monaco"]);Bp(function(i){return{config:XM(i.config,r),monaco:n}})}function jQ(){var e=id(function(t){var n=t.monaco,r=t.isInitialized,i=t.resolve;return{monaco:n,isInitialized:r,resolve:i}});if(!e.isInitialized){if(Bp({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Ay(Iy);if(window.monaco&&window.monaco.editor)return JM(window.monaco),e.resolve(window.monaco),Ay(Iy);RQ(zQ,VQ)(HQ)}return Ay(Iy)}function zQ(e){return document.body.appendChild(e)}function BQ(e){var t=document.createElement("script");return e&&(t.src=e),t}function VQ(e){var t=id(function(r){var i=r.config,o=r.reject;return{config:i,reject:o}}),n=BQ("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function HQ(){var e=id(function(n){var r=n.config,i=n.resolve,o=n.reject;return{config:r,resolve:i,reject:o}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){JM(n),e.resolve(n)},function(n){e.reject(n)})}function JM(e){id().monaco||Bp({monaco:e})}function WQ(){return id(function(e){var t=e.monaco;return t})}var Iy=new Promise(function(e,t){return Bp({resolve:e,reject:t})}),ZM={config:FQ,init:jQ,__getMonacoInstance:WQ},qQ={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Ny=qQ,UQ={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},GQ=UQ;function YQ({children:e}){return m.createElement("div",{style:GQ.container},e)}var KQ=YQ,XQ=KQ;function QQ({width:e,height:t,isEditorReady:n,loading:r,_ref:i,className:o,wrapperProps:s}){return m.createElement("section",{style:{...Ny.wrapper,width:e,height:t},...s},!n&&m.createElement(XQ,null,r),m.createElement("div",{ref:i,style:{...Ny.fullWidth,...!n&&Ny.hide},className:o}))}var JQ=QQ,eD=m.memo(JQ);function ZQ(e){m.useEffect(e,[])}var tD=ZQ;function eJ(e,t,n=!0){let r=m.useRef(!0);m.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var Fr=eJ;function od(){}function ql(e,t,n,r){return tJ(e,r)||nJ(e,t,n,r)}function tJ(e,t){return e.editor.getModel(nD(e,t))}function nJ(e,t,n,r){return e.editor.createModel(t,n,r?nD(e,r):void 0)}function nD(e,t){return e.Uri.parse(t)}function rJ({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:i,originalModelPath:o,modifiedModelPath:s,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:d="Loading...",options:f={},height:g="100%",width:p="100%",className:v,wrapperProps:y={},beforeMount:x=od,onMount:w=od}){let[S,C]=m.useState(!1),[P,O]=m.useState(!0),k=m.useRef(null),A=m.useRef(null),L=m.useRef(null),F=m.useRef(w),j=m.useRef(x),B=m.useRef(!1);tD(()=>{let $=ZM.init();return $.then(Z=>(A.current=Z)&&O(!1)).catch(Z=>(Z==null?void 0:Z.type)!=="cancelation"&&console.error("Monaco initialization: error:",Z)),()=>k.current?Y():$.cancel()}),Fr(()=>{if(k.current&&A.current){let $=k.current.getOriginalEditor(),Z=ql(A.current,e||"",r||n||"text",o||"");Z!==$.getModel()&&$.setModel(Z)}},[o],S),Fr(()=>{if(k.current&&A.current){let $=k.current.getModifiedEditor(),Z=ql(A.current,t||"",i||n||"text",s||"");Z!==$.getModel()&&$.setModel(Z)}},[s],S),Fr(()=>{let $=k.current.getModifiedEditor();$.getOption(A.current.editor.EditorOption.readOnly)?$.setValue(t||""):t!==$.getValue()&&($.executeEdits("",[{range:$.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),$.pushUndoStop())},[t],S),Fr(()=>{var $,Z;(Z=($=k.current)==null?void 0:$.getModel())==null||Z.original.setValue(e||"")},[e],S),Fr(()=>{let{original:$,modified:Z}=k.current.getModel();A.current.editor.setModelLanguage($,r||n||"text"),A.current.editor.setModelLanguage(Z,i||n||"text")},[n,r,i],S),Fr(()=>{var $;($=A.current)==null||$.editor.setTheme(c)},[c],S),Fr(()=>{var $;($=k.current)==null||$.updateOptions(f)},[f],S);let H=m.useCallback(()=>{var U;if(!A.current)return;j.current(A.current);let $=ql(A.current,e||"",r||n||"text",o||""),Z=ql(A.current,t||"",i||n||"text",s||"");(U=k.current)==null||U.setModel({original:$,modified:Z})},[n,t,i,e,r,o,s]),K=m.useCallback(()=>{var $;!B.current&&L.current&&(k.current=A.current.editor.createDiffEditor(L.current,{automaticLayout:!0,...f}),H(),($=A.current)==null||$.editor.setTheme(c),C(!0),B.current=!0)},[f,c,H]);m.useEffect(()=>{S&&F.current(k.current,A.current)},[S]),m.useEffect(()=>{!P&&!S&&K()},[P,S,K]);function Y(){var Z,U,ie,le;let $=(Z=k.current)==null?void 0:Z.getModel();a||((U=$==null?void 0:$.original)==null||U.dispose()),l||((ie=$==null?void 0:$.modified)==null||ie.dispose()),(le=k.current)==null||le.dispose()}return m.createElement(eD,{width:p,height:g,isEditorReady:S,loading:d,_ref:L,className:v,wrapperProps:y})}var iJ=rJ;m.memo(iJ);function oJ(e){let t=m.useRef();return m.useEffect(()=>{t.current=e},[e]),t.current}var sJ=oJ,Vp=new Map;function aJ({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:i,path:o,theme:s="light",line:a,loading:l="Loading...",options:c={},overrideServices:d={},saveViewState:f=!0,keepCurrentModel:g=!1,width:p="100%",height:v="100%",className:y,wrapperProps:x={},beforeMount:w=od,onMount:S=od,onChange:C,onValidate:P=od}){let[O,k]=m.useState(!1),[A,L]=m.useState(!0),F=m.useRef(null),j=m.useRef(null),B=m.useRef(null),H=m.useRef(S),K=m.useRef(w),Y=m.useRef(),$=m.useRef(r),Z=sJ(o),U=m.useRef(!1),ie=m.useRef(!1);tD(()=>{let W=ZM.init();return W.then(ne=>(F.current=ne)&&L(!1)).catch(ne=>(ne==null?void 0:ne.type)!=="cancelation"&&console.error("Monaco initialization: error:",ne)),()=>j.current?M():W.cancel()}),Fr(()=>{var ne,N,X,me;let W=ql(F.current,e||r||"",t||i||"",o||n||"");W!==((ne=j.current)==null?void 0:ne.getModel())&&(f&&Vp.set(Z,(N=j.current)==null?void 0:N.saveViewState()),(X=j.current)==null||X.setModel(W),f&&((me=j.current)==null||me.restoreViewState(Vp.get(o))))},[o],O),Fr(()=>{var W;(W=j.current)==null||W.updateOptions(c)},[c],O),Fr(()=>{!j.current||r===void 0||(j.current.getOption(F.current.editor.EditorOption.readOnly)?j.current.setValue(r):r!==j.current.getValue()&&(ie.current=!0,j.current.executeEdits("",[{range:j.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),j.current.pushUndoStop(),ie.current=!1))},[r],O),Fr(()=>{var ne,N;let W=(ne=j.current)==null?void 0:ne.getModel();W&&i&&((N=F.current)==null||N.editor.setModelLanguage(W,i))},[i],O),Fr(()=>{var W;a!==void 0&&((W=j.current)==null||W.revealLine(a))},[a],O),Fr(()=>{var W;(W=F.current)==null||W.editor.setTheme(s)},[s],O);let le=m.useCallback(()=>{var W;if(!(!B.current||!F.current)&&!U.current){K.current(F.current);let ne=o||n,N=ql(F.current,r||e||"",t||i||"",ne||"");j.current=(W=F.current)==null?void 0:W.editor.create(B.current,{model:N,automaticLayout:!0,...c},d),f&&j.current.restoreViewState(Vp.get(ne)),F.current.editor.setTheme(s),a!==void 0&&j.current.revealLine(a),k(!0),U.current=!0}},[e,t,n,r,i,o,c,d,f,s,a]);m.useEffect(()=>{O&&H.current(j.current,F.current)},[O]),m.useEffect(()=>{!A&&!O&&le()},[A,O,le]),$.current=r,m.useEffect(()=>{var W,ne;O&&C&&((W=Y.current)==null||W.dispose(),Y.current=(ne=j.current)==null?void 0:ne.onDidChangeModelContent(N=>{ie.current||C(j.current.getValue(),N)}))},[O,C]),m.useEffect(()=>{if(O){let W=F.current.editor.onDidChangeMarkers(ne=>{var X;let N=(X=j.current.getModel())==null?void 0:X.uri;if(N&&ne.find(me=>me.path===N.path)){let me=F.current.editor.getModelMarkers({resource:N});P==null||P(me)}});return()=>{W==null||W.dispose()}}return()=>{}},[O,P]);function M(){var W,ne;(W=Y.current)==null||W.dispose(),g?f&&Vp.set(o,j.current.saveViewState()):(ne=j.current.getModel())==null||ne.dispose(),j.current.dispose()}return m.createElement(eD,{width:p,height:v,isEditorReady:O,loading:l,_ref:B,className:y,wrapperProps:x})}var lJ=aJ,rD=m.memo(lJ),Ry=rD;function cJ(e){const t=e.toUpperCase().indexOf("WHERE"),n=e.toUpperCase().indexOf("GROUP BY"),r=e.toUpperCase().indexOf("LIMIT"),i=e.toUpperCase().indexOf("ORDER BY");let o=e.length;if(i!==-1&&(o=i),r!==-1&&r<o&&(o=r),t!==-1){const s=e.substring(0,t),a=e.substring(t);return`${s} {{ filters | where }} AND ${a.substring(7)}`}else if(n!==-1){const s=e.substring(0,n),a=e.substring(n);return`${s} {{ filters | where }} ${a}`}else{const s=e.substring(0,o),a=e.substring(o);return`${s} {{ filters | where }} ${a}`}}let Ly;const iD="HoverCard",[oD,cfe]=kn(iD,[ji]),$y=ji(),[uJ,Fy]=oD(iD),dJ=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:i,onOpenChange:o,openDelay:s=700,closeDelay:a=300}=e,l=$y(t),c=m.useRef(0),d=m.useRef(0),f=m.useRef(!1),g=m.useRef(!1),[p=!1,v]=Jn({prop:r,defaultProp:i,onChange:o}),y=m.useCallback(()=>{clearTimeout(d.current),c.current=window.setTimeout(()=>v(!0),s)},[s,v]),x=m.useCallback(()=>{clearTimeout(c.current),!f.current&&!g.current&&(d.current=window.setTimeout(()=>v(!1),a))},[a,v]),w=m.useCallback(()=>v(!1),[v]);return m.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(d.current)},[]),m.createElement(uJ,{scope:t,open:p,onOpenChange:v,onOpen:y,onClose:x,onDismiss:w,hasSelectionRef:f,isPointerDownOnContentRef:g},m.createElement(Eu,l,n))},fJ="HoverCardTrigger",hJ=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,i=Fy(fJ,n),o=$y(n);return m.createElement(Ou,ae({asChild:!0},o),m.createElement(Ve.a,ae({"data-state":i.open?"open":"closed"},r,{ref:t,onPointerEnter:Ee(e.onPointerEnter,Hp(i.onOpen)),onPointerLeave:Ee(e.onPointerLeave,Hp(i.onClose)),onFocus:Ee(e.onFocus,i.onOpen),onBlur:Ee(e.onBlur,i.onClose),onTouchStart:Ee(e.onTouchStart,s=>s.preventDefault())})))}),pJ="HoverCardPortal",[ufe,gJ]=oD(pJ,{forceMount:void 0}),jy="HoverCardContent",mJ=m.forwardRef((e,t)=>{const n=gJ(jy,e.__scopeHoverCard),{forceMount:r=n.forceMount,...i}=e,o=Fy(jy,e.__scopeHoverCard);return m.createElement(bn,{present:r||o.open},m.createElement(vJ,ae({"data-state":o.open?"open":"closed"},i,{onPointerEnter:Ee(e.onPointerEnter,Hp(o.onOpen)),onPointerLeave:Ee(e.onPointerLeave,Hp(o.onClose)),ref:t})))}),vJ=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,...a}=e,l=Fy(jy,n),c=$y(n),d=m.useRef(null),f=et(t,d),[g,p]=m.useState(!1);return m.useEffect(()=>{if(g){const v=document.body;return Ly=v.style.userSelect||v.style.webkitUserSelect,v.style.userSelect="none",v.style.webkitUserSelect="none",()=>{v.style.userSelect=Ly,v.style.webkitUserSelect=Ly}}},[g]),m.useEffect(()=>{if(d.current){const v=()=>{p(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var y;((y=document.getSelection())===null||y===void 0?void 0:y.toString())!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",v),()=>{document.removeEventListener("pointerup",v),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),m.useEffect(()=>{d.current&&bJ(d.current).forEach(y=>y.setAttribute("tabindex","-1"))}),m.createElement(_l,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:s,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:Ee(o,v=>{v.preventDefault()}),onDismiss:l.onDismiss},m.createElement(Pu,ae({},c,a,{onPointerDown:Ee(a.onPointerDown,v=>{v.currentTarget.contains(v.target)&&p(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:f,style:{...a.style,userSelect:g?"text":void 0,WebkitUserSelect:g?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})))});function Hp(e){return t=>t.pointerType==="touch"?void 0:e()}function bJ(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}const yJ=dJ,xJ=hJ,sD=mJ,aD=yJ,lD=xJ,zy=de.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>_.jsx(sD,{ref:i,align:t,sideOffset:n,className:Pe("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));zy.displayName=sD.displayName;function wJ({error:e}){return _.jsxs(aD,{openDelay:0,children:[_.jsx(lD,{asChild:!0,children:_.jsx(it,{variant:"link",className:" p-0 h-5",children:_.jsx(oV,{className:"h-4 w-4 text-red-500"})})}),_.jsx(zy,{align:"start",className:"w-[600px]",children:_.jsx("div",{className:"flex justify-between space-x-4",children:_.jsx("div",{className:"space-y-1",children:_.jsx("p",{className:"text-sm",children:e})})})})]})}function _J({text:e,onCheckedChange:t,checked:n}){return _.jsxs("div",{className:"flex items-center space-x-1 xbg-red-100 ml-7",children:[_.jsx(Pp,{checked:n,onCheckedChange:t}),_.jsx("label",{className:"text-xs leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e})]})}function SJ(){const e=ge(a=>a.authToken),t=m.useRef(null),n=_e(a=>a.applyFilters),[r,i]=m.useState(""),o=_e(a=>a.filterValues),s=_e(a=>a.card.sql);return _.jsxs(aD,{openDelay:0,onOpenChange:async a=>{if(!a)return;console.log("onOpenChange");const l=await Ns("http://localhost:3000/api/v1/filter-sql",(e==null?void 0:e.accessToken)||"",{sql:s,active_filters:o});console.log(l),l.sql?(console.log(l.records),i(l.sql)):i("Error")},children:[_.jsx(lD,{asChild:!0,children:n&&_.jsx("p",{className:" p-0 hover:cursor-pointer text-xs",children:"|  Filter Query"})}),_.jsxs(zy,{align:"end",className:"w-[600px] ",children:[_.jsx("div",{className:" flex justify-between space-x-4",children:_.jsx("div",{className:"bg-muted p-2 rounded-sm",children:_.jsxs("code",{ref:t,className:"text-sm font-mono ",children:[r,_.jsx(ZE,{onClick:()=>z3(t),className:" inline-block ml-3 h-4 w-4 opacity-70 hover:opacity-100 hover:cursor-pointer"})]})})}),_.jsxs("div",{className:"flex gap-2 items-center pt-2",children:[_.jsx(e2,{className:"h-4 w-4 opacity-70"}),_.jsx("span",{className:"text-xs text-muted-foreground",children:"A preview of the query with filters applied."})]})]})]})}const By=de.forwardRef(({className:e,...t},n)=>_.jsx("textarea",{className:Pe("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));By.displayName="Textarea";function dfe(){}function ffe(){}function CJ(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const EJ=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,OJ=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,PJ={};function cD(e,t){return((t||PJ).jsx?OJ:EJ).test(e)}const kJ=/[ \t\n\f\r]/g;function MJ(e){return typeof e=="object"?e.type==="text"?uD(e.value):!1:uD(e)}function uD(e){return e.replace(kJ,"")===""}class sd{constructor(t,n,r){this.property=t,this.normal=n,r&&(this.space=r)}}sd.prototype.property={},sd.prototype.normal={},sd.prototype.space=null;function dD(e,t){const n={},r={};let i=-1;for(;++i<e.length;)Object.assign(n,e[i].property),Object.assign(r,e[i].normal);return new sd(n,r,t)}function Vy(e){return e.toLowerCase()}class ni{constructor(t,n){this.property=t,this.attribute=n}}ni.prototype.space=null,ni.prototype.boolean=!1,ni.prototype.booleanish=!1,ni.prototype.overloadedBoolean=!1,ni.prototype.number=!1,ni.prototype.commaSeparated=!1,ni.prototype.spaceSeparated=!1,ni.prototype.commaOrSpaceSeparated=!1,ni.prototype.mustUseProperty=!1,ni.prototype.defined=!1;let DJ=0;const ct=Oa(),xn=Oa(),fD=Oa(),Oe=Oa(),qt=Oa(),Ul=Oa(),jr=Oa();function Oa(){return 2**++DJ}const Hy=Object.freeze(Object.defineProperty({__proto__:null,boolean:ct,booleanish:xn,commaOrSpaceSeparated:jr,commaSeparated:Ul,number:Oe,overloadedBoolean:fD,spaceSeparated:qt},Symbol.toStringTag,{value:"Module"})),Wy=Object.keys(Hy);class qy extends ni{constructor(t,n,r,i){let o=-1;if(super(t,n),hD(this,"space",i),typeof r=="number")for(;++o<Wy.length;){const s=Wy[o];hD(this,Wy[o],(r&Hy[s])===Hy[s])}}}qy.prototype.defined=!0;function hD(e,t,n){n&&(e[t]=n)}const TJ={}.hasOwnProperty;function Gl(e){const t={},n={};let r;for(r in e.properties)if(TJ.call(e.properties,r)){const i=e.properties[r],o=new qy(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Vy(r)]=r,n[Vy(o.attribute)]=r}return new sd(t,n,e.space)}const pD=Gl({space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),gD=Gl({space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function mD(e,t){return t in e?e[t]:t}function vD(e,t){return mD(e,t.toLowerCase())}const bD=Gl({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:vD,properties:{xmlns:null,xmlnsXLink:null}}),yD=Gl({transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:xn,ariaAutoComplete:null,ariaBusy:xn,ariaChecked:xn,ariaColCount:Oe,ariaColIndex:Oe,ariaColSpan:Oe,ariaControls:qt,ariaCurrent:null,ariaDescribedBy:qt,ariaDetails:null,ariaDisabled:xn,ariaDropEffect:qt,ariaErrorMessage:null,ariaExpanded:xn,ariaFlowTo:qt,ariaGrabbed:xn,ariaHasPopup:null,ariaHidden:xn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:qt,ariaLevel:Oe,ariaLive:null,ariaModal:xn,ariaMultiLine:xn,ariaMultiSelectable:xn,ariaOrientation:null,ariaOwns:qt,ariaPlaceholder:null,ariaPosInSet:Oe,ariaPressed:xn,ariaReadOnly:xn,ariaRelevant:null,ariaRequired:xn,ariaRoleDescription:qt,ariaRowCount:Oe,ariaRowIndex:Oe,ariaRowSpan:Oe,ariaSelected:xn,ariaSetSize:Oe,ariaSort:null,ariaValueMax:Oe,ariaValueMin:Oe,ariaValueNow:Oe,ariaValueText:null,role:null}}),AJ=Gl({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:vD,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ul,acceptCharset:qt,accessKey:qt,action:null,allow:null,allowFullScreen:ct,allowPaymentRequest:ct,allowUserMedia:ct,alt:null,as:null,async:ct,autoCapitalize:null,autoComplete:qt,autoFocus:ct,autoPlay:ct,blocking:qt,capture:null,charSet:null,checked:ct,cite:null,className:qt,cols:Oe,colSpan:null,content:null,contentEditable:xn,controls:ct,controlsList:qt,coords:Oe|Ul,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ct,defer:ct,dir:null,dirName:null,disabled:ct,download:fD,draggable:xn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ct,formTarget:null,headers:qt,height:Oe,hidden:ct,high:Oe,href:null,hrefLang:null,htmlFor:qt,httpEquiv:qt,id:null,imageSizes:null,imageSrcSet:null,inert:ct,inputMode:null,integrity:null,is:null,isMap:ct,itemId:null,itemProp:qt,itemRef:qt,itemScope:ct,itemType:qt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ct,low:Oe,manifest:null,max:null,maxLength:Oe,media:null,method:null,min:null,minLength:Oe,multiple:ct,muted:ct,name:null,nonce:null,noModule:ct,noValidate:ct,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ct,optimum:Oe,pattern:null,ping:qt,placeholder:null,playsInline:ct,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ct,referrerPolicy:null,rel:qt,required:ct,reversed:ct,rows:Oe,rowSpan:Oe,sandbox:qt,scope:null,scoped:ct,seamless:ct,selected:ct,shadowRootDelegatesFocus:ct,shadowRootMode:null,shape:null,size:Oe,sizes:null,slot:null,span:Oe,spellCheck:xn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Oe,step:null,style:null,tabIndex:Oe,target:null,title:null,translate:null,type:null,typeMustMatch:ct,useMap:null,value:xn,width:Oe,wrap:null,align:null,aLink:null,archive:qt,axis:null,background:null,bgColor:null,border:Oe,borderColor:null,bottomMargin:Oe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ct,declare:ct,event:null,face:null,frame:null,frameBorder:null,hSpace:Oe,leftMargin:Oe,link:null,longDesc:null,lowSrc:null,marginHeight:Oe,marginWidth:Oe,noResize:ct,noHref:ct,noShade:ct,noWrap:ct,object:null,profile:null,prompt:null,rev:null,rightMargin:Oe,rules:null,scheme:null,scrolling:xn,standby:null,summary:null,text:null,topMargin:Oe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Oe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ct,disableRemotePlayback:ct,prefix:null,property:null,results:Oe,security:null,unselectable:null}}),IJ=Gl({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:mD,properties:{about:jr,accentHeight:Oe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Oe,amplitude:Oe,arabicForm:null,ascent:Oe,attributeName:null,attributeType:null,azimuth:Oe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Oe,by:null,calcMode:null,capHeight:Oe,className:qt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Oe,diffuseConstant:Oe,direction:null,display:null,dur:null,divisor:Oe,dominantBaseline:null,download:ct,dx:null,dy:null,edgeMode:null,editable:null,elevation:Oe,enableBackground:null,end:null,event:null,exponent:Oe,externalResourcesRequired:null,fill:null,fillOpacity:Oe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ul,g2:Ul,glyphName:Ul,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Oe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Oe,horizOriginX:Oe,horizOriginY:Oe,id:null,ideographic:Oe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Oe,k:Oe,k1:Oe,k2:Oe,k3:Oe,k4:Oe,kernelMatrix:jr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Oe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Oe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Oe,overlineThickness:Oe,paintOrder:null,panose1:null,path:null,pathLength:Oe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:qt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Oe,pointsAtY:Oe,pointsAtZ:Oe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:jr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:jr,rev:jr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:jr,requiredFeatures:jr,requiredFonts:jr,requiredFormats:jr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Oe,specularExponent:Oe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Oe,strikethroughThickness:Oe,string:null,stroke:null,strokeDashArray:jr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Oe,strokeOpacity:Oe,strokeWidth:null,style:null,surfaceScale:Oe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:jr,tabIndex:Oe,tableValues:null,target:null,targetX:Oe,targetY:Oe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:jr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Oe,underlineThickness:Oe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Oe,values:null,vAlphabetic:Oe,vMathematical:Oe,vectorEffect:null,vHanging:Oe,vIdeographic:Oe,version:null,vertAdvY:Oe,vertOriginX:Oe,vertOriginY:Oe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Oe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),NJ=/^data[-\w.:]+$/i,xD=/-[a-z]/g,RJ=/[A-Z]/g;function LJ(e,t){const n=Vy(t);let r=t,i=ni;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&NJ.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(xD,FJ);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!xD.test(o)){let s=o.replace(RJ,$J);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}i=qy}return new i(r,t)}function $J(e){return"-"+e.toLowerCase()}function FJ(e){return e.charAt(1).toUpperCase()}const jJ={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},zJ=dD([gD,pD,bD,yD,AJ],"html"),Uy=dD([gD,pD,bD,yD,IJ],"svg");function BJ(e){return e.join(" ").trim()}var wD={},_D=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,VJ=/\n/g,HJ=/^\s*/,WJ=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,qJ=/^:\s*/,UJ=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,GJ=/^[;\s]*/,YJ=/^\s+|\s+$/g,KJ=`
438
+ `},KM=MQ(IQ)(YM),NQ={config:TQ},RQ=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(i){return n.reduceRight(function(o,s){return s(o)},i)}};function XM(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],XM(e[n],t[n]))}),WM(WM({},e),t)}var LQ={type:"cancelation",msg:"operation is manually canceled"};function Ay(e){var t=!1,n=new Promise(function(r,i){e.then(function(o){return t?i(LQ):r(o)}),e.catch(i)});return n.cancel=function(){return t=!0},n}var $Q=PQ.create({config:kQ,isInitialized:!1,resolve:null,reject:null,monaco:null}),QM=lQ($Q,2),id=QM[0],Bp=QM[1];function FQ(e){var t=NQ.config(e),n=t.monaco,r=aQ(t,["monaco"]);Bp(function(i){return{config:XM(i.config,r),monaco:n}})}function jQ(){var e=id(function(t){var n=t.monaco,r=t.isInitialized,i=t.resolve;return{monaco:n,isInitialized:r,resolve:i}});if(!e.isInitialized){if(Bp({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Ay(Iy);if(window.monaco&&window.monaco.editor)return JM(window.monaco),e.resolve(window.monaco),Ay(Iy);RQ(zQ,VQ)(HQ)}return Ay(Iy)}function zQ(e){return document.body.appendChild(e)}function BQ(e){var t=document.createElement("script");return e&&(t.src=e),t}function VQ(e){var t=id(function(r){var i=r.config,o=r.reject;return{config:i,reject:o}}),n=BQ("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function HQ(){var e=id(function(n){var r=n.config,i=n.resolve,o=n.reject;return{config:r,resolve:i,reject:o}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){JM(n),e.resolve(n)},function(n){e.reject(n)})}function JM(e){id().monaco||Bp({monaco:e})}function WQ(){return id(function(e){var t=e.monaco;return t})}var Iy=new Promise(function(e,t){return Bp({resolve:e,reject:t})}),ZM={config:FQ,init:jQ,__getMonacoInstance:WQ},qQ={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Ny=qQ,UQ={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},GQ=UQ;function YQ({children:e}){return m.createElement("div",{style:GQ.container},e)}var KQ=YQ,XQ=KQ;function QQ({width:e,height:t,isEditorReady:n,loading:r,_ref:i,className:o,wrapperProps:s}){return m.createElement("section",{style:{...Ny.wrapper,width:e,height:t},...s},!n&&m.createElement(XQ,null,r),m.createElement("div",{ref:i,style:{...Ny.fullWidth,...!n&&Ny.hide},className:o}))}var JQ=QQ,eD=m.memo(JQ);function ZQ(e){m.useEffect(e,[])}var tD=ZQ;function eJ(e,t,n=!0){let r=m.useRef(!0);m.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var Fr=eJ;function od(){}function ql(e,t,n,r){return tJ(e,r)||nJ(e,t,n,r)}function tJ(e,t){return e.editor.getModel(nD(e,t))}function nJ(e,t,n,r){return e.editor.createModel(t,n,r?nD(e,r):void 0)}function nD(e,t){return e.Uri.parse(t)}function rJ({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:i,originalModelPath:o,modifiedModelPath:s,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:d="Loading...",options:f={},height:g="100%",width:p="100%",className:v,wrapperProps:y={},beforeMount:x=od,onMount:w=od}){let[S,C]=m.useState(!1),[P,O]=m.useState(!0),k=m.useRef(null),A=m.useRef(null),L=m.useRef(null),F=m.useRef(w),j=m.useRef(x),B=m.useRef(!1);tD(()=>{let $=ZM.init();return $.then(Z=>(A.current=Z)&&O(!1)).catch(Z=>(Z==null?void 0:Z.type)!=="cancelation"&&console.error("Monaco initialization: error:",Z)),()=>k.current?Y():$.cancel()}),Fr(()=>{if(k.current&&A.current){let $=k.current.getOriginalEditor(),Z=ql(A.current,e||"",r||n||"text",o||"");Z!==$.getModel()&&$.setModel(Z)}},[o],S),Fr(()=>{if(k.current&&A.current){let $=k.current.getModifiedEditor(),Z=ql(A.current,t||"",i||n||"text",s||"");Z!==$.getModel()&&$.setModel(Z)}},[s],S),Fr(()=>{let $=k.current.getModifiedEditor();$.getOption(A.current.editor.EditorOption.readOnly)?$.setValue(t||""):t!==$.getValue()&&($.executeEdits("",[{range:$.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),$.pushUndoStop())},[t],S),Fr(()=>{var $,Z;(Z=($=k.current)==null?void 0:$.getModel())==null||Z.original.setValue(e||"")},[e],S),Fr(()=>{let{original:$,modified:Z}=k.current.getModel();A.current.editor.setModelLanguage($,r||n||"text"),A.current.editor.setModelLanguage(Z,i||n||"text")},[n,r,i],S),Fr(()=>{var $;($=A.current)==null||$.editor.setTheme(c)},[c],S),Fr(()=>{var $;($=k.current)==null||$.updateOptions(f)},[f],S);let H=m.useCallback(()=>{var U;if(!A.current)return;j.current(A.current);let $=ql(A.current,e||"",r||n||"text",o||""),Z=ql(A.current,t||"",i||n||"text",s||"");(U=k.current)==null||U.setModel({original:$,modified:Z})},[n,t,i,e,r,o,s]),K=m.useCallback(()=>{var $;!B.current&&L.current&&(k.current=A.current.editor.createDiffEditor(L.current,{automaticLayout:!0,...f}),H(),($=A.current)==null||$.editor.setTheme(c),C(!0),B.current=!0)},[f,c,H]);m.useEffect(()=>{S&&F.current(k.current,A.current)},[S]),m.useEffect(()=>{!P&&!S&&K()},[P,S,K]);function Y(){var Z,U,ie,le;let $=(Z=k.current)==null?void 0:Z.getModel();a||((U=$==null?void 0:$.original)==null||U.dispose()),l||((ie=$==null?void 0:$.modified)==null||ie.dispose()),(le=k.current)==null||le.dispose()}return m.createElement(eD,{width:p,height:g,isEditorReady:S,loading:d,_ref:L,className:v,wrapperProps:y})}var iJ=rJ;m.memo(iJ);function oJ(e){let t=m.useRef();return m.useEffect(()=>{t.current=e},[e]),t.current}var sJ=oJ,Vp=new Map;function aJ({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:i,path:o,theme:s="light",line:a,loading:l="Loading...",options:c={},overrideServices:d={},saveViewState:f=!0,keepCurrentModel:g=!1,width:p="100%",height:v="100%",className:y,wrapperProps:x={},beforeMount:w=od,onMount:S=od,onChange:C,onValidate:P=od}){let[O,k]=m.useState(!1),[A,L]=m.useState(!0),F=m.useRef(null),j=m.useRef(null),B=m.useRef(null),H=m.useRef(S),K=m.useRef(w),Y=m.useRef(),$=m.useRef(r),Z=sJ(o),U=m.useRef(!1),ie=m.useRef(!1);tD(()=>{let W=ZM.init();return W.then(ne=>(F.current=ne)&&L(!1)).catch(ne=>(ne==null?void 0:ne.type)!=="cancelation"&&console.error("Monaco initialization: error:",ne)),()=>j.current?M():W.cancel()}),Fr(()=>{var ne,N,X,me;let W=ql(F.current,e||r||"",t||i||"",o||n||"");W!==((ne=j.current)==null?void 0:ne.getModel())&&(f&&Vp.set(Z,(N=j.current)==null?void 0:N.saveViewState()),(X=j.current)==null||X.setModel(W),f&&((me=j.current)==null||me.restoreViewState(Vp.get(o))))},[o],O),Fr(()=>{var W;(W=j.current)==null||W.updateOptions(c)},[c],O),Fr(()=>{!j.current||r===void 0||(j.current.getOption(F.current.editor.EditorOption.readOnly)?j.current.setValue(r):r!==j.current.getValue()&&(ie.current=!0,j.current.executeEdits("",[{range:j.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),j.current.pushUndoStop(),ie.current=!1))},[r],O),Fr(()=>{var ne,N;let W=(ne=j.current)==null?void 0:ne.getModel();W&&i&&((N=F.current)==null||N.editor.setModelLanguage(W,i))},[i],O),Fr(()=>{var W;a!==void 0&&((W=j.current)==null||W.revealLine(a))},[a],O),Fr(()=>{var W;(W=F.current)==null||W.editor.setTheme(s)},[s],O);let le=m.useCallback(()=>{var W;if(!(!B.current||!F.current)&&!U.current){K.current(F.current);let ne=o||n,N=ql(F.current,r||e||"",t||i||"",ne||"");j.current=(W=F.current)==null?void 0:W.editor.create(B.current,{model:N,automaticLayout:!0,...c},d),f&&j.current.restoreViewState(Vp.get(ne)),F.current.editor.setTheme(s),a!==void 0&&j.current.revealLine(a),k(!0),U.current=!0}},[e,t,n,r,i,o,c,d,f,s,a]);m.useEffect(()=>{O&&H.current(j.current,F.current)},[O]),m.useEffect(()=>{!A&&!O&&le()},[A,O,le]),$.current=r,m.useEffect(()=>{var W,ne;O&&C&&((W=Y.current)==null||W.dispose(),Y.current=(ne=j.current)==null?void 0:ne.onDidChangeModelContent(N=>{ie.current||C(j.current.getValue(),N)}))},[O,C]),m.useEffect(()=>{if(O){let W=F.current.editor.onDidChangeMarkers(ne=>{var X;let N=(X=j.current.getModel())==null?void 0:X.uri;if(N&&ne.find(me=>me.path===N.path)){let me=F.current.editor.getModelMarkers({resource:N});P==null||P(me)}});return()=>{W==null||W.dispose()}}return()=>{}},[O,P]);function M(){var W,ne;(W=Y.current)==null||W.dispose(),g?f&&Vp.set(o,j.current.saveViewState()):(ne=j.current.getModel())==null||ne.dispose(),j.current.dispose()}return m.createElement(eD,{width:p,height:v,isEditorReady:O,loading:l,_ref:B,className:y,wrapperProps:x})}var lJ=aJ,rD=m.memo(lJ),Ry=rD;function cJ(e){const t=e.toUpperCase().indexOf("WHERE"),n=e.toUpperCase().indexOf("GROUP BY"),r=e.toUpperCase().indexOf("LIMIT"),i=e.toUpperCase().indexOf("ORDER BY");let o=e.length;if(i!==-1&&(o=i),r!==-1&&r<o&&(o=r),t!==-1){const s=e.substring(0,t),a=e.substring(t);return`${s} {{ filters | where }} AND ${a.substring(7)}`}else if(n!==-1){const s=e.substring(0,n),a=e.substring(n);return`${s} {{ filters | where }} ${a}`}else{const s=e.substring(0,o),a=e.substring(o);return`${s} {{ filters | where }} ${a}`}}let Ly;const iD="HoverCard",[oD,cfe]=kn(iD,[ji]),$y=ji(),[uJ,Fy]=oD(iD),dJ=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:i,onOpenChange:o,openDelay:s=700,closeDelay:a=300}=e,l=$y(t),c=m.useRef(0),d=m.useRef(0),f=m.useRef(!1),g=m.useRef(!1),[p=!1,v]=Jn({prop:r,defaultProp:i,onChange:o}),y=m.useCallback(()=>{clearTimeout(d.current),c.current=window.setTimeout(()=>v(!0),s)},[s,v]),x=m.useCallback(()=>{clearTimeout(c.current),!f.current&&!g.current&&(d.current=window.setTimeout(()=>v(!1),a))},[a,v]),w=m.useCallback(()=>v(!1),[v]);return m.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(d.current)},[]),m.createElement(uJ,{scope:t,open:p,onOpenChange:v,onOpen:y,onClose:x,onDismiss:w,hasSelectionRef:f,isPointerDownOnContentRef:g},m.createElement(Eu,l,n))},fJ="HoverCardTrigger",hJ=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,i=Fy(fJ,n),o=$y(n);return m.createElement(Ou,ae({asChild:!0},o),m.createElement(Ve.a,ae({"data-state":i.open?"open":"closed"},r,{ref:t,onPointerEnter:Ee(e.onPointerEnter,Hp(i.onOpen)),onPointerLeave:Ee(e.onPointerLeave,Hp(i.onClose)),onFocus:Ee(e.onFocus,i.onOpen),onBlur:Ee(e.onBlur,i.onClose),onTouchStart:Ee(e.onTouchStart,s=>s.preventDefault())})))}),pJ="HoverCardPortal",[ufe,gJ]=oD(pJ,{forceMount:void 0}),jy="HoverCardContent",mJ=m.forwardRef((e,t)=>{const n=gJ(jy,e.__scopeHoverCard),{forceMount:r=n.forceMount,...i}=e,o=Fy(jy,e.__scopeHoverCard);return m.createElement(bn,{present:r||o.open},m.createElement(vJ,ae({"data-state":o.open?"open":"closed"},i,{onPointerEnter:Ee(e.onPointerEnter,Hp(o.onOpen)),onPointerLeave:Ee(e.onPointerLeave,Hp(o.onClose)),ref:t})))}),vJ=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,...a}=e,l=Fy(jy,n),c=$y(n),d=m.useRef(null),f=et(t,d),[g,p]=m.useState(!1);return m.useEffect(()=>{if(g){const v=document.body;return Ly=v.style.userSelect||v.style.webkitUserSelect,v.style.userSelect="none",v.style.webkitUserSelect="none",()=>{v.style.userSelect=Ly,v.style.webkitUserSelect=Ly}}},[g]),m.useEffect(()=>{if(d.current){const v=()=>{p(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var y;((y=document.getSelection())===null||y===void 0?void 0:y.toString())!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",v),()=>{document.removeEventListener("pointerup",v),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),m.useEffect(()=>{d.current&&bJ(d.current).forEach(y=>y.setAttribute("tabindex","-1"))}),m.createElement(_l,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:s,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:Ee(o,v=>{v.preventDefault()}),onDismiss:l.onDismiss},m.createElement(Pu,ae({},c,a,{onPointerDown:Ee(a.onPointerDown,v=>{v.currentTarget.contains(v.target)&&p(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:f,style:{...a.style,userSelect:g?"text":void 0,WebkitUserSelect:g?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})))});function Hp(e){return t=>t.pointerType==="touch"?void 0:e()}function bJ(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}const yJ=dJ,xJ=hJ,sD=mJ,aD=yJ,lD=xJ,zy=de.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>_.jsx(sD,{ref:i,align:t,sideOffset:n,className:Pe("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));zy.displayName=sD.displayName;function wJ({error:e}){return _.jsxs(aD,{openDelay:0,children:[_.jsx(lD,{asChild:!0,children:_.jsx(it,{variant:"link",className:" p-0 h-5",children:_.jsx(oV,{className:"h-4 w-4 text-red-500"})})}),_.jsx(zy,{align:"start",className:"w-[600px]",children:_.jsx("div",{className:"flex justify-between space-x-4",children:_.jsx("div",{className:"space-y-1",children:_.jsx("p",{className:"text-sm",children:e})})})})]})}function _J({text:e,onCheckedChange:t,checked:n}){return _.jsxs("div",{className:"flex items-center space-x-1 xbg-red-100 ml-7",children:[_.jsx(Pp,{checked:n,onCheckedChange:t}),_.jsx("label",{className:"text-xs leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e})]})}function SJ(){const e=ge(a=>a.authToken),t=m.useRef(null),n=_e(a=>a.applyFilters),[r,i]=m.useState(""),o=_e(a=>a.filterValues),s=_e(a=>a.card.sql);return _.jsxs(aD,{openDelay:0,onOpenChange:async a=>{if(!a)return;console.log("onOpenChange");const l=await Ns("https://semaphor.cloud/api/v1/filter-sql",(e==null?void 0:e.accessToken)||"",{sql:s,active_filters:o});console.log(l),l.sql?(console.log(l.records),i(l.sql)):i("Error")},children:[_.jsx(lD,{asChild:!0,children:n&&_.jsx("p",{className:" p-0 hover:cursor-pointer text-xs",children:"|  Filter Query"})}),_.jsxs(zy,{align:"end",className:"w-[600px] ",children:[_.jsx("div",{className:" flex justify-between space-x-4",children:_.jsx("div",{className:"bg-muted p-2 rounded-sm",children:_.jsxs("code",{ref:t,className:"text-sm font-mono ",children:[r,_.jsx(ZE,{onClick:()=>z3(t),className:" inline-block ml-3 h-4 w-4 opacity-70 hover:opacity-100 hover:cursor-pointer"})]})})}),_.jsxs("div",{className:"flex gap-2 items-center pt-2",children:[_.jsx(e2,{className:"h-4 w-4 opacity-70"}),_.jsx("span",{className:"text-xs text-muted-foreground",children:"A preview of the query with filters applied."})]})]})]})}const By=de.forwardRef(({className:e,...t},n)=>_.jsx("textarea",{className:Pe("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));By.displayName="Textarea";function dfe(){}function ffe(){}function CJ(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const EJ=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,OJ=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,PJ={};function cD(e,t){return((t||PJ).jsx?OJ:EJ).test(e)}const kJ=/[ \t\n\f\r]/g;function MJ(e){return typeof e=="object"?e.type==="text"?uD(e.value):!1:uD(e)}function uD(e){return e.replace(kJ,"")===""}class sd{constructor(t,n,r){this.property=t,this.normal=n,r&&(this.space=r)}}sd.prototype.property={},sd.prototype.normal={},sd.prototype.space=null;function dD(e,t){const n={},r={};let i=-1;for(;++i<e.length;)Object.assign(n,e[i].property),Object.assign(r,e[i].normal);return new sd(n,r,t)}function Vy(e){return e.toLowerCase()}class ni{constructor(t,n){this.property=t,this.attribute=n}}ni.prototype.space=null,ni.prototype.boolean=!1,ni.prototype.booleanish=!1,ni.prototype.overloadedBoolean=!1,ni.prototype.number=!1,ni.prototype.commaSeparated=!1,ni.prototype.spaceSeparated=!1,ni.prototype.commaOrSpaceSeparated=!1,ni.prototype.mustUseProperty=!1,ni.prototype.defined=!1;let DJ=0;const ct=Oa(),xn=Oa(),fD=Oa(),Oe=Oa(),qt=Oa(),Ul=Oa(),jr=Oa();function Oa(){return 2**++DJ}const Hy=Object.freeze(Object.defineProperty({__proto__:null,boolean:ct,booleanish:xn,commaOrSpaceSeparated:jr,commaSeparated:Ul,number:Oe,overloadedBoolean:fD,spaceSeparated:qt},Symbol.toStringTag,{value:"Module"})),Wy=Object.keys(Hy);class qy extends ni{constructor(t,n,r,i){let o=-1;if(super(t,n),hD(this,"space",i),typeof r=="number")for(;++o<Wy.length;){const s=Wy[o];hD(this,Wy[o],(r&Hy[s])===Hy[s])}}}qy.prototype.defined=!0;function hD(e,t,n){n&&(e[t]=n)}const TJ={}.hasOwnProperty;function Gl(e){const t={},n={};let r;for(r in e.properties)if(TJ.call(e.properties,r)){const i=e.properties[r],o=new qy(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Vy(r)]=r,n[Vy(o.attribute)]=r}return new sd(t,n,e.space)}const pD=Gl({space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),gD=Gl({space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function mD(e,t){return t in e?e[t]:t}function vD(e,t){return mD(e,t.toLowerCase())}const bD=Gl({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:vD,properties:{xmlns:null,xmlnsXLink:null}}),yD=Gl({transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:xn,ariaAutoComplete:null,ariaBusy:xn,ariaChecked:xn,ariaColCount:Oe,ariaColIndex:Oe,ariaColSpan:Oe,ariaControls:qt,ariaCurrent:null,ariaDescribedBy:qt,ariaDetails:null,ariaDisabled:xn,ariaDropEffect:qt,ariaErrorMessage:null,ariaExpanded:xn,ariaFlowTo:qt,ariaGrabbed:xn,ariaHasPopup:null,ariaHidden:xn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:qt,ariaLevel:Oe,ariaLive:null,ariaModal:xn,ariaMultiLine:xn,ariaMultiSelectable:xn,ariaOrientation:null,ariaOwns:qt,ariaPlaceholder:null,ariaPosInSet:Oe,ariaPressed:xn,ariaReadOnly:xn,ariaRelevant:null,ariaRequired:xn,ariaRoleDescription:qt,ariaRowCount:Oe,ariaRowIndex:Oe,ariaRowSpan:Oe,ariaSelected:xn,ariaSetSize:Oe,ariaSort:null,ariaValueMax:Oe,ariaValueMin:Oe,ariaValueNow:Oe,ariaValueText:null,role:null}}),AJ=Gl({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:vD,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ul,acceptCharset:qt,accessKey:qt,action:null,allow:null,allowFullScreen:ct,allowPaymentRequest:ct,allowUserMedia:ct,alt:null,as:null,async:ct,autoCapitalize:null,autoComplete:qt,autoFocus:ct,autoPlay:ct,blocking:qt,capture:null,charSet:null,checked:ct,cite:null,className:qt,cols:Oe,colSpan:null,content:null,contentEditable:xn,controls:ct,controlsList:qt,coords:Oe|Ul,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ct,defer:ct,dir:null,dirName:null,disabled:ct,download:fD,draggable:xn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ct,formTarget:null,headers:qt,height:Oe,hidden:ct,high:Oe,href:null,hrefLang:null,htmlFor:qt,httpEquiv:qt,id:null,imageSizes:null,imageSrcSet:null,inert:ct,inputMode:null,integrity:null,is:null,isMap:ct,itemId:null,itemProp:qt,itemRef:qt,itemScope:ct,itemType:qt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ct,low:Oe,manifest:null,max:null,maxLength:Oe,media:null,method:null,min:null,minLength:Oe,multiple:ct,muted:ct,name:null,nonce:null,noModule:ct,noValidate:ct,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ct,optimum:Oe,pattern:null,ping:qt,placeholder:null,playsInline:ct,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ct,referrerPolicy:null,rel:qt,required:ct,reversed:ct,rows:Oe,rowSpan:Oe,sandbox:qt,scope:null,scoped:ct,seamless:ct,selected:ct,shadowRootDelegatesFocus:ct,shadowRootMode:null,shape:null,size:Oe,sizes:null,slot:null,span:Oe,spellCheck:xn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Oe,step:null,style:null,tabIndex:Oe,target:null,title:null,translate:null,type:null,typeMustMatch:ct,useMap:null,value:xn,width:Oe,wrap:null,align:null,aLink:null,archive:qt,axis:null,background:null,bgColor:null,border:Oe,borderColor:null,bottomMargin:Oe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ct,declare:ct,event:null,face:null,frame:null,frameBorder:null,hSpace:Oe,leftMargin:Oe,link:null,longDesc:null,lowSrc:null,marginHeight:Oe,marginWidth:Oe,noResize:ct,noHref:ct,noShade:ct,noWrap:ct,object:null,profile:null,prompt:null,rev:null,rightMargin:Oe,rules:null,scheme:null,scrolling:xn,standby:null,summary:null,text:null,topMargin:Oe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Oe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ct,disableRemotePlayback:ct,prefix:null,property:null,results:Oe,security:null,unselectable:null}}),IJ=Gl({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:mD,properties:{about:jr,accentHeight:Oe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Oe,amplitude:Oe,arabicForm:null,ascent:Oe,attributeName:null,attributeType:null,azimuth:Oe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Oe,by:null,calcMode:null,capHeight:Oe,className:qt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Oe,diffuseConstant:Oe,direction:null,display:null,dur:null,divisor:Oe,dominantBaseline:null,download:ct,dx:null,dy:null,edgeMode:null,editable:null,elevation:Oe,enableBackground:null,end:null,event:null,exponent:Oe,externalResourcesRequired:null,fill:null,fillOpacity:Oe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ul,g2:Ul,glyphName:Ul,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Oe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Oe,horizOriginX:Oe,horizOriginY:Oe,id:null,ideographic:Oe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Oe,k:Oe,k1:Oe,k2:Oe,k3:Oe,k4:Oe,kernelMatrix:jr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Oe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Oe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Oe,overlineThickness:Oe,paintOrder:null,panose1:null,path:null,pathLength:Oe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:qt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Oe,pointsAtY:Oe,pointsAtZ:Oe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:jr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:jr,rev:jr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:jr,requiredFeatures:jr,requiredFonts:jr,requiredFormats:jr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Oe,specularExponent:Oe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Oe,strikethroughThickness:Oe,string:null,stroke:null,strokeDashArray:jr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Oe,strokeOpacity:Oe,strokeWidth:null,style:null,surfaceScale:Oe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:jr,tabIndex:Oe,tableValues:null,target:null,targetX:Oe,targetY:Oe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:jr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Oe,underlineThickness:Oe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Oe,values:null,vAlphabetic:Oe,vMathematical:Oe,vectorEffect:null,vHanging:Oe,vIdeographic:Oe,version:null,vertAdvY:Oe,vertOriginX:Oe,vertOriginY:Oe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Oe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),NJ=/^data[-\w.:]+$/i,xD=/-[a-z]/g,RJ=/[A-Z]/g;function LJ(e,t){const n=Vy(t);let r=t,i=ni;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&NJ.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(xD,FJ);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!xD.test(o)){let s=o.replace(RJ,$J);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}i=qy}return new i(r,t)}function $J(e){return"-"+e.toLowerCase()}function FJ(e){return e.charAt(1).toUpperCase()}const jJ={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},zJ=dD([gD,pD,bD,yD,AJ],"html"),Uy=dD([gD,pD,bD,yD,IJ],"svg");function BJ(e){return e.join(" ").trim()}var wD={},_D=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,VJ=/\n/g,HJ=/^\s*/,WJ=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,qJ=/^:\s*/,UJ=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,GJ=/^[;\s]*/,YJ=/^\s+|\s+$/g,KJ=`
439
439
  `,SD="/",CD="*",Pa="",XJ="comment",QJ="declaration",JJ=function(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(v){var y=v.match(VJ);y&&(n+=y.length);var x=v.lastIndexOf(KJ);r=~x?v.length-x:r+v.length}function o(){var v={line:n,column:r};return function(y){return y.position=new s(v),c(),y}}function s(v){this.start=v,this.end={line:n,column:r},this.source=t.source}s.prototype.content=e;function a(v){var y=new Error(t.source+":"+n+":"+r+": "+v);if(y.reason=v,y.filename=t.source,y.line=n,y.column=r,y.source=e,!t.silent)throw y}function l(v){var y=v.exec(e);if(y){var x=y[0];return i(x),e=e.slice(x.length),y}}function c(){l(HJ)}function d(v){var y;for(v=v||[];y=f();)y!==!1&&v.push(y);return v}function f(){var v=o();if(!(SD!=e.charAt(0)||CD!=e.charAt(1))){for(var y=2;Pa!=e.charAt(y)&&(CD!=e.charAt(y)||SD!=e.charAt(y+1));)++y;if(y+=2,Pa===e.charAt(y-1))return a("End of comment missing");var x=e.slice(2,y-2);return r+=2,i(x),e=e.slice(y),r+=2,v({type:XJ,comment:x})}}function g(){var v=o(),y=l(WJ);if(y){if(f(),!l(qJ))return a("property missing ':'");var x=l(UJ),w=v({type:QJ,property:ED(y[0].replace(_D,Pa)),value:x?ED(x[0].replace(_D,Pa)):Pa});return l(GJ),w}}function p(){var v=[];d(v);for(var y;y=g();)y!==!1&&(v.push(y),d(v));return v}return c(),p()};function ED(e){return e?e.replace(YJ,Pa):Pa}var ZJ=Lo&&Lo.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(wD,"__esModule",{value:!0});var eZ=ZJ(JJ);function tZ(e,t){var n=null;if(!e||typeof e!="string")return n;var r=(0,eZ.default)(e),i=typeof t=="function";return r.forEach(function(o){if(o.type==="declaration"){var s=o.property,a=o.value;i?t(s,a,o):a&&(n=n||{},n[s]=a)}}),n}var OD=wD.default=tZ;const nZ=OD.default||OD,PD=kD("end"),Gy=kD("start");function kD(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function rZ(e){const t=Gy(e),n=PD(e);if(t&&n)return{start:t,end:n}}function ad(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?MD(e.position):"start"in e||"end"in e?MD(e):"line"in e||"column"in e?Yy(e):""}function Yy(e){return DD(e&&e.line)+":"+DD(e&&e.column)}function MD(e){return Yy(e&&e.start)+"-"+Yy(e&&e.end)}function DD(e){return e&&typeof e=="number"?e:1}class Yn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},s=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(s=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=a?a.line:void 0,this.name=ad(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual,this.expected,this.note,this.url}}Yn.prototype.file="",Yn.prototype.name="",Yn.prototype.reason="",Yn.prototype.message="",Yn.prototype.stack="",Yn.prototype.column=void 0,Yn.prototype.line=void 0,Yn.prototype.ancestors=void 0,Yn.prototype.cause=void 0,Yn.prototype.fatal=void 0,Yn.prototype.place=void 0,Yn.prototype.ruleId=void 0,Yn.prototype.source=void 0;const Ky={}.hasOwnProperty,iZ=new Map,oZ=/[A-Z]/g,sZ=/-([a-z])/g,aZ=new Set(["table","tbody","thead","tfoot","tr"]),lZ=new Set(["td","th"]),TD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function cZ(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=vZ(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=mZ(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Uy:zJ,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=AD(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function AD(e,t,n){if(t.type==="element")return uZ(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return dZ(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return hZ(e,t,n);if(t.type==="mdxjsEsm")return fZ(e,t);if(t.type==="root")return pZ(e,t,n);if(t.type==="text")return gZ(e,t)}function uZ(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Uy,e.schema=i),e.ancestors.push(t);const o=ND(e,t.tagName,!1),s=bZ(e,t);let a=Qy(e,t);return aZ.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!MJ(l):!0})),ID(e,s,o,t),Xy(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}function dZ(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}ld(e,t.position)}function fZ(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ld(e,t.position)}function hZ(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Uy,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:ND(e,t.name,!0),s=yZ(e,t),a=Qy(e,t);return ID(e,s,o,t),Xy(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}function pZ(e,t,n){const r={};return Xy(r,Qy(e,t)),e.create(t,e.Fragment,r,n)}function gZ(e,t){return t.value}function ID(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Xy(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function mZ(e,t,n){return r;function r(i,o,s,a){const c=Array.isArray(s.children)?n:t;return a?c(o,s,a):c(o,s)}}function vZ(e,t){return n;function n(r,i,o,s){const a=Array.isArray(o.children),l=Gy(r);return t(i,o,s,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function bZ(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Ky.call(t.properties,i)){const o=xZ(e,i,t.properties[i]);if(o){const[s,a]=o;e.tableCellAlignToStyle&&s==="align"&&typeof a=="string"&&lZ.has(t.tagName)?r=a:n[s]=a}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function yZ(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const s=o.expression;s.type;const a=s.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else ld(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,o=e.evaluater.evaluateExpression(a.expression)}else ld(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function Qy(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:iZ;for(;++r<t.children.length;){const o=t.children[r];let s;if(e.passKeys){const l=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(l){const c=i.get(l)||0;s=l+"-"+c,i.set(l,c+1)}}const a=AD(e,o,s);a!==void 0&&n.push(a)}return n}function xZ(e,t,n){const r=LJ(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?CJ(n):BJ(n)),r.property==="style"){let i=typeof n=="object"?n:wZ(e,String(n));return e.stylePropertyNameCase==="css"&&(i=_Z(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?jJ[r.property]||r.property:r.attribute,n]}}function wZ(e,t){const n={};try{nZ(t,r)}catch(i){if(!e.ignoreInvalidStyle){const o=i,s=new Yn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:o,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=TD+"#cannot-parse-style-attribute",s}}return n;function r(i,o){let s=i;s.slice(0,2)!=="--"&&(s.slice(0,4)==="-ms-"&&(s="ms-"+s.slice(4)),s=s.replace(sZ,CZ)),n[s]=o}}function ND(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,s;for(;++o<i.length;){const a=cD(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(o&&a.type==="Literal"),optional:!1}:a}r=s}else r=cD(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Ky.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);ld(e)}function ld(e,t){const n=new Yn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=TD+"#cannot-handle-mdx-estrees-without-createevaluater",n}function _Z(e){const t={};let n;for(n in e)Ky.call(e,n)&&(t[SZ(n)]=e[n]);return t}function SZ(e){let t=e.replace(oZ,EZ);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function CZ(e,t){return t.toUpperCase()}function EZ(e){return"-"+e.toLowerCase()}const Jy={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},OZ={};function PZ(e,t){const n=t||OZ,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return RD(e,r,i)}function RD(e,t,n){if(kZ(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return LD(e.children,t,n)}return Array.isArray(e)?LD(e,t,n):""}function LD(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=RD(e[i],t,n);return r.join("")}function kZ(e){return!!(e&&typeof e=="object")}const $D=document.createElement("i");function Zy(e){const t="&"+e+";";$D.innerHTML=t;const n=$D.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ui(e,t,n,r){const i=e.length;let o=0,s;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);o<r.length;)s=r.slice(o,o+1e4),s.unshift(t,0),e.splice(...s),o+=1e4,t+=1e4}function ri(e,t){return e.length>0?(Ui(e,e.length,0,t),e):t}const FD={}.hasOwnProperty;function MZ(e){const t={};let n=-1;for(;++n<e.length;)DZ(t,e[n]);return t}function DZ(e,t){let n;for(n in t){const i=(FD.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let s;if(o)for(s in o){FD.call(i,s)||(i[s]=[]);const a=o[s];TZ(i[s],Array.isArray(a)?a:a?[a]:[])}}}function TZ(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ui(e,0,0,r)}function jD(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Yl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const AZ=cs(new RegExp("\\p{P}","u")),Gi=cs(/[A-Za-z]/),zr=cs(/[\dA-Za-z]/),IZ=cs(/[#-'*+\--9=?A-Z^-~]/);function ex(e){return e!==null&&(e<32||e===127)}const tx=cs(/\d/),NZ=cs(/[\dA-Fa-f]/),zD=cs(/[!-/:-@[-`{-~]/);function Ke(e){return e!==null&&e<-2}function pr(e){return e!==null&&(e<0||e===32)}function Tt(e){return e===-2||e===-1||e===32}function RZ(e){return zD(e)||AZ(e)}const LZ=cs(/\s/);function cs(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Kl(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let s="";if(o===37&&zr(e.charCodeAt(n+1))&&zr(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(s=String.fromCharCode(o));else if(o>55295&&o<57344){const a=e.charCodeAt(n+1);o<56320&&a>56319&&a<57344?(s=String.fromCharCode(o,a),i=1):s="�"}else s=String.fromCharCode(o);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Ut(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return s;function s(l){return Tt(l)?(e.enter(n),a(l)):t(l)}function a(l){return Tt(l)&&o++<i?(e.consume(l),a):(e.exit(n),t(l))}}const $Z={tokenize:FZ};function FZ(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Ut(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),o(a)}function o(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(a)}function s(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return Ke(a)?(e.consume(a),e.exit("chunkText"),o):(e.consume(a),s)}}const jZ={tokenize:zZ},BD={tokenize:BZ};function zZ(e){const t=this,n=[];let r=0,i,o,s;return a;function a(C){if(r<n.length){const P=n[r];return t.containerState=P[1],e.attempt(P[0].continuation,l,c)(C)}return c(C)}function l(C){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&S();const P=t.events.length;let O=P,k;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){k=t.events[O][1].end;break}w(r);let A=P;for(;A<t.events.length;)t.events[A][1].end=Object.assign({},k),A++;return Ui(t.events,O+1,0,t.events.slice(P)),t.events.length=A,c(C)}return a(C)}function c(C){if(r===n.length){if(!i)return g(C);if(i.currentConstruct&&i.currentConstruct.concrete)return v(C);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(BD,d,f)(C)}function d(C){return i&&S(),w(r),g(C)}function f(C){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,v(C)}function g(C){return t.containerState={},e.attempt(BD,p,v)(C)}function p(C){return r++,n.push([t.currentConstruct,t.containerState]),g(C)}function v(C){if(C===null){i&&S(),w(0),e.consume(C);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:o,_tokenizer:i}),y(C)}function y(C){if(C===null){x(e.exit("chunkFlow"),!0),w(0),e.consume(C);return}return Ke(C)?(e.consume(C),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(C),y)}function x(C,P){const O=t.sliceStream(C);if(P&&O.push(null),C.previous=o,o&&(o.next=C),o=C,i.defineSkip(C.start),i.write(O),t.parser.lazy[C.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<s&&(!i.events[k][1].end||i.events[k][1].end.offset>s))return;const A=t.events.length;let L=A,F,j;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(F){j=t.events[L][1].end;break}F=!0}for(w(r),k=A;k<t.events.length;)t.events[k][1].end=Object.assign({},j),k++;Ui(t.events,L+1,0,t.events.slice(A)),t.events.length=k}}function w(C){let P=n.length;for(;P-- >C;){const O=n[P];t.containerState=O[1],O[0].exit.call(t,e)}n.length=C}function S(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function BZ(e,t,n){return Ut(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function VD(e){if(e===null||pr(e)||LZ(e))return 1;if(RZ(e))return 2}function nx(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const rx={name:"attention",tokenize:HZ,resolveAll:VZ};function VZ(e,t){let n=-1,r,i,o,s,a,l,c,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f=Object.assign({},e[r][1].end),g=Object.assign({},e[n][1].start);HD(f,-l),HD(g,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},e[r][1].end)},a={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:g},o={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},i={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},a.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},a.end),c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=ri(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=ri(c,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",o,t]]),c=ri(c,nx(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=ri(c,[["exit",o,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=ri(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ui(e,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function HZ(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=VD(r);let o;return s;function s(l){return o=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===o)return e.consume(l),a;const c=e.exit("attentionSequence"),d=VD(l),f=!d||d===2&&i||n.includes(l),g=!i||i===2&&d||n.includes(r);return c._open=!!(o===42?f:f&&(i||!g)),c._close=!!(o===42?g:g&&(d||!f)),t(l)}}function HD(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const WZ={name:"autolink",tokenize:qZ};function qZ(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(p){return Gi(p)?(e.consume(p),s):c(p)}function s(p){return p===43||p===45||p===46||zr(p)?(r=1,a(p)):c(p)}function a(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||zr(p))&&r++<32?(e.consume(p),a):(r=0,c(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||ex(p)?n(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),d):IZ(p)?(e.consume(p),c):n(p)}function d(p){return zr(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):g(p)}function g(p){if((p===45||zr(p))&&r++<63){const v=p===45?g:f;return e.consume(p),v}return n(p)}}const Wp={tokenize:UZ,partial:!0};function UZ(e,t,n){return r;function r(o){return Tt(o)?Ut(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||Ke(o)?t(o):n(o)}}const WD={name:"blockQuote",tokenize:GZ,continuation:{tokenize:YZ},exit:KZ};function GZ(e,t,n){const r=this;return i;function i(s){if(s===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),o}return n(s)}function o(s){return Tt(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function YZ(e,t,n){const r=this;return i;function i(s){return Tt(s)?Ut(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):o(s)}function o(s){return e.attempt(WD,t,n)(s)}}function KZ(e){e.exit("blockQuote")}const qD={name:"characterEscape",tokenize:XZ};function XZ(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return zD(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const UD={name:"characterReference",tokenize:QZ};function QZ(e,t,n){const r=this;let i=0,o,s;return a;function a(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),o=31,s=zr,d(f))}function c(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,s=NZ,d):(e.enter("characterReferenceValue"),o=7,s=tx,d(f))}function d(f){if(f===59&&i){const g=e.exit("characterReferenceValue");return s===zr&&!Zy(r.sliceSerialize(g))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(f)&&i++<o?(e.consume(f),d):n(f)}}const GD={tokenize:ZZ,partial:!0},YD={name:"codeFenced",tokenize:JZ,concrete:!0};function JZ(e,t,n){const r=this,i={tokenize:O,partial:!0};let o=0,s=0,a;return l;function l(k){return c(k)}function c(k){const A=r.events[r.events.length-1];return o=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,a=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(k)}function d(k){return k===a?(s++,e.consume(k),d):s<3?n(k):(e.exit("codeFencedFenceSequence"),Tt(k)?Ut(e,f,"whitespace")(k):f(k))}function f(k){return k===null||Ke(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(GD,y,P)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===null||Ke(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(k)):Tt(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ut(e,p,"whitespace")(k)):k===96&&k===a?n(k):(e.consume(k),g)}function p(k){return k===null||Ke(k)?f(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(k))}function v(k){return k===null||Ke(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(k)):k===96&&k===a?n(k):(e.consume(k),v)}function y(k){return e.attempt(i,P,x)(k)}function x(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),w}function w(k){return o>0&&Tt(k)?Ut(e,S,"linePrefix",o+1)(k):S(k)}function S(k){return k===null||Ke(k)?e.check(GD,y,P)(k):(e.enter("codeFlowValue"),C(k))}function C(k){return k===null||Ke(k)?(e.exit("codeFlowValue"),S(k)):(e.consume(k),C)}function P(k){return e.exit("codeFenced"),t(k)}function O(k,A,L){let F=0;return j;function j($){return k.enter("lineEnding"),k.consume($),k.exit("lineEnding"),B}function B($){return k.enter("codeFencedFence"),Tt($)?Ut(k,H,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):H($)}function H($){return $===a?(k.enter("codeFencedFenceSequence"),K($)):L($)}function K($){return $===a?(F++,k.consume($),K):F>=s?(k.exit("codeFencedFenceSequence"),Tt($)?Ut(k,Y,"whitespace")($):Y($)):L($)}function Y($){return $===null||Ke($)?(k.exit("codeFencedFence"),A($)):L($)}}}function ZZ(e,t,n){const r=this;return i;function i(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o)}function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const ix={name:"codeIndented",tokenize:tee},eee={tokenize:nee,partial:!0};function tee(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),Ut(e,o,"linePrefix",5)(c)}function o(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(c):n(c)}function s(c){return c===null?l(c):Ke(c)?e.attempt(eee,s,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||Ke(c)?(e.exit("codeFlowValue"),s(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function nee(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):Ke(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):Ut(e,o,"linePrefix",5)(s)}function o(s){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):Ke(s)?i(s):n(s)}}const ree={name:"codeText",tokenize:see,resolve:iee,previous:oee};function iee(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function oee(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function see(e,t,n){let r=0,i,o;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),a(f)}function a(f){return f===96?(e.consume(f),r++,a):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(o=e.enter("codeTextSequence"),i=0,d(f)):Ke(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(f))}function c(f){return f===null||f===32||f===96||Ke(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),c)}function d(f){return f===96?(e.consume(f),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(o.type="codeTextData",c(f))}}function KD(e){const t={};let n=-1,r,i,o,s,a,l,c;for(;++n<e.length;){for(;n in t;)n=t[n];if(r=e[n],n&&r[1].type==="chunkFlow"&&e[n-1][1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,o=0,o<l.length&&l[o][1].type==="lineEndingBlank"&&(o+=2),o<l.length&&l[o][1].type==="content"))for(;++o<l.length&&l[o][1].type!=="content";)l[o][1].type==="chunkText"&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,aee(e,n)),n=t[n],c=!0);else if(r[1]._container){for(o=n,i=void 0;o--&&(s=e[o],s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(i&&(e[i][1].type="lineEndingBlank"),s[1].type="lineEnding",i=o);i&&(r[1].end=Object.assign({},e[i][1].start),a=e.slice(i,n),a.unshift(r),Ui(e,i,n-i+1,a))}}return!c}function aee(e,t){const n=e[t][1],r=e[t][2];let i=t-1;const o=[],s=n._tokenizer||r.parser[n.contentType](n.start),a=s.events,l=[],c={};let d,f,g=-1,p=n,v=0,y=0;const x=[y];for(;p;){for(;e[++i][1]!==p;);o.push(i),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),f&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++g<a.length;)a[g][0]==="exit"&&a[g-1][0]==="enter"&&a[g][1].type===a[g-1][1].type&&a[g][1].start.line!==a[g][1].end.line&&(y=g+1,x.push(y),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):x.pop(),g=x.length;g--;){const w=a.slice(x[g],x[g+1]),S=o.pop();l.unshift([S,S+w.length-1]),Ui(e,S,2,w)}for(g=-1;++g<l.length;)c[v+l[g][0]]=v+l[g][1],v+=l[g][1]-l[g][0]-1;return c}const lee={tokenize:dee,resolve:uee},cee={tokenize:fee,partial:!0};function uee(e){return KD(e),e}function dee(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?o(a):Ke(a)?e.check(cee,s,o)(a):(e.consume(a),i)}function o(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function s(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function fee(e,t,n){const r=this;return i;function i(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ut(e,o,"linePrefix")}function o(s){if(s===null||Ke(s))return n(s);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function XD(e,t,n,r,i,o,s,a,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return f;function f(w){return w===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(w),e.exit(o),g):w===null||w===32||w===41||ex(w)?n(w):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),y(w))}function g(w){return w===62?(e.enter(o),e.consume(w),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===62?(e.exit("chunkString"),e.exit(a),g(w)):w===null||w===60||Ke(w)?n(w):(e.consume(w),w===92?v:p)}function v(w){return w===60||w===62||w===92?(e.consume(w),p):p(w)}function y(w){return!d&&(w===null||w===41||pr(w))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(w)):d<c&&w===40?(e.consume(w),d++,y):w===41?(e.consume(w),d--,y):w===null||w===32||w===40||ex(w)?n(w):(e.consume(w),w===92?x:y)}function x(w){return w===40||w===41||w===92?(e.consume(w),y):y(w)}}function QD(e,t,n,r,i,o){const s=this;let a=0,l;return c;function c(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(o),d}function d(p){return a>999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(o),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):Ke(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Ke(p)||a++>999?(e.exit("chunkString"),d(p)):(e.consume(p),l||(l=!Tt(p)),p===92?g:f)}function g(p){return p===91||p===92||p===93?(e.consume(p),a++,f):f(p)}}function JD(e,t,n,r,i,o){let s;return a;function a(g){return g===34||g===39||g===40?(e.enter(r),e.enter(i),e.consume(g),e.exit(i),s=g===40?41:g,l):n(g)}function l(g){return g===s?(e.enter(i),e.consume(g),e.exit(i),e.exit(r),t):(e.enter(o),c(g))}function c(g){return g===s?(e.exit(o),l(s)):g===null?n(g):Ke(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),Ut(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(g))}function d(g){return g===s||g===null||Ke(g)?(e.exit("chunkString"),c(g)):(e.consume(g),g===92?f:d)}function f(g){return g===s||g===92?(e.consume(g),d):d(g)}}function cd(e,t){let n;return r;function r(i){return Ke(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Tt(i)?Ut(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const hee={name:"definition",tokenize:gee},pee={tokenize:mee,partial:!0};function gee(e,t,n){const r=this;let i;return o;function o(p){return e.enter("definition"),s(p)}function s(p){return QD.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=Yl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return pr(p)?cd(e,c)(p):c(p)}function c(p){return XD(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(pee,f,f)(p)}function f(p){return Tt(p)?Ut(e,g,"whitespace")(p):g(p)}function g(p){return p===null||Ke(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function mee(e,t,n){return r;function r(a){return pr(a)?cd(e,i)(a):n(a)}function i(a){return JD(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return Tt(a)?Ut(e,s,"whitespace")(a):s(a)}function s(a){return a===null||Ke(a)?t(a):n(a)}}const vee={name:"hardBreakEscape",tokenize:bee};function bee(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return Ke(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const yee={name:"headingAtx",tokenize:wee,resolve:xee};function xee(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ui(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function wee(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),o(d)}function o(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||pr(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||Ke(d)?(e.exit("atxHeading"),t(d)):Tt(d)?Ut(e,a,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),a(d))}function c(d){return d===null||d===35||pr(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),c)}}const _ee=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ZD=["pre","script","style","textarea"],See={name:"htmlFlow",tokenize:Pee,resolveTo:Oee,concrete:!0},Cee={tokenize:Mee,partial:!0},Eee={tokenize:kee,partial:!0};function Oee(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Pee(e,t,n){const r=this;let i,o,s,a,l;return c;function c(N){return d(N)}function d(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),f}function f(N){return N===33?(e.consume(N),g):N===47?(e.consume(N),o=!0,y):N===63?(e.consume(N),i=3,r.interrupt?t:M):Gi(N)?(e.consume(N),s=String.fromCharCode(N),x):n(N)}function g(N){return N===45?(e.consume(N),i=2,p):N===91?(e.consume(N),i=5,a=0,v):Gi(N)?(e.consume(N),i=4,r.interrupt?t:M):n(N)}function p(N){return N===45?(e.consume(N),r.interrupt?t:M):n(N)}function v(N){const X="CDATA[";return N===X.charCodeAt(a++)?(e.consume(N),a===X.length?r.interrupt?t:H:v):n(N)}function y(N){return Gi(N)?(e.consume(N),s=String.fromCharCode(N),x):n(N)}function x(N){if(N===null||N===47||N===62||pr(N)){const X=N===47,me=s.toLowerCase();return!X&&!o&&ZD.includes(me)?(i=1,r.interrupt?t(N):H(N)):_ee.includes(s.toLowerCase())?(i=6,X?(e.consume(N),w):r.interrupt?t(N):H(N)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(N):o?S(N):C(N))}return N===45||zr(N)?(e.consume(N),s+=String.fromCharCode(N),x):n(N)}function w(N){return N===62?(e.consume(N),r.interrupt?t:H):n(N)}function S(N){return Tt(N)?(e.consume(N),S):j(N)}function C(N){return N===47?(e.consume(N),j):N===58||N===95||Gi(N)?(e.consume(N),P):Tt(N)?(e.consume(N),C):j(N)}function P(N){return N===45||N===46||N===58||N===95||zr(N)?(e.consume(N),P):O(N)}function O(N){return N===61?(e.consume(N),k):Tt(N)?(e.consume(N),O):C(N)}function k(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),l=N,A):Tt(N)?(e.consume(N),k):L(N)}function A(N){return N===l?(e.consume(N),l=null,F):N===null||Ke(N)?n(N):(e.consume(N),A)}function L(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||pr(N)?O(N):(e.consume(N),L)}function F(N){return N===47||N===62||Tt(N)?C(N):n(N)}function j(N){return N===62?(e.consume(N),B):n(N)}function B(N){return N===null||Ke(N)?H(N):Tt(N)?(e.consume(N),B):n(N)}function H(N){return N===45&&i===2?(e.consume(N),Z):N===60&&i===1?(e.consume(N),U):N===62&&i===4?(e.consume(N),W):N===63&&i===3?(e.consume(N),M):N===93&&i===5?(e.consume(N),le):Ke(N)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Cee,ne,K)(N)):N===null||Ke(N)?(e.exit("htmlFlowData"),K(N)):(e.consume(N),H)}function K(N){return e.check(Eee,Y,ne)(N)}function Y(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),$}function $(N){return N===null||Ke(N)?K(N):(e.enter("htmlFlowData"),H(N))}function Z(N){return N===45?(e.consume(N),M):H(N)}function U(N){return N===47?(e.consume(N),s="",ie):H(N)}function ie(N){if(N===62){const X=s.toLowerCase();return ZD.includes(X)?(e.consume(N),W):H(N)}return Gi(N)&&s.length<8?(e.consume(N),s+=String.fromCharCode(N),ie):H(N)}function le(N){return N===93?(e.consume(N),M):H(N)}function M(N){return N===62?(e.consume(N),W):N===45&&i===2?(e.consume(N),M):H(N)}function W(N){return N===null||Ke(N)?(e.exit("htmlFlowData"),ne(N)):(e.consume(N),W)}function ne(N){return e.exit("htmlFlow"),t(N)}}function kee(e,t,n){const r=this;return i;function i(s){return Ke(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):n(s)}function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function Mee(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Wp,t,n)}}const Dee={name:"htmlText",tokenize:Tee};function Tee(e,t,n){const r=this;let i,o,s;return a;function a(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),l}function l(M){return M===33?(e.consume(M),c):M===47?(e.consume(M),O):M===63?(e.consume(M),C):Gi(M)?(e.consume(M),L):n(M)}function c(M){return M===45?(e.consume(M),d):M===91?(e.consume(M),o=0,v):Gi(M)?(e.consume(M),S):n(M)}function d(M){return M===45?(e.consume(M),p):n(M)}function f(M){return M===null?n(M):M===45?(e.consume(M),g):Ke(M)?(s=f,U(M)):(e.consume(M),f)}function g(M){return M===45?(e.consume(M),p):f(M)}function p(M){return M===62?Z(M):M===45?g(M):f(M)}function v(M){const W="CDATA[";return M===W.charCodeAt(o++)?(e.consume(M),o===W.length?y:v):n(M)}function y(M){return M===null?n(M):M===93?(e.consume(M),x):Ke(M)?(s=y,U(M)):(e.consume(M),y)}function x(M){return M===93?(e.consume(M),w):y(M)}function w(M){return M===62?Z(M):M===93?(e.consume(M),w):y(M)}function S(M){return M===null||M===62?Z(M):Ke(M)?(s=S,U(M)):(e.consume(M),S)}function C(M){return M===null?n(M):M===63?(e.consume(M),P):Ke(M)?(s=C,U(M)):(e.consume(M),C)}function P(M){return M===62?Z(M):C(M)}function O(M){return Gi(M)?(e.consume(M),k):n(M)}function k(M){return M===45||zr(M)?(e.consume(M),k):A(M)}function A(M){return Ke(M)?(s=A,U(M)):Tt(M)?(e.consume(M),A):Z(M)}function L(M){return M===45||zr(M)?(e.consume(M),L):M===47||M===62||pr(M)?F(M):n(M)}function F(M){return M===47?(e.consume(M),Z):M===58||M===95||Gi(M)?(e.consume(M),j):Ke(M)?(s=F,U(M)):Tt(M)?(e.consume(M),F):Z(M)}function j(M){return M===45||M===46||M===58||M===95||zr(M)?(e.consume(M),j):B(M)}function B(M){return M===61?(e.consume(M),H):Ke(M)?(s=B,U(M)):Tt(M)?(e.consume(M),B):F(M)}function H(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),i=M,K):Ke(M)?(s=H,U(M)):Tt(M)?(e.consume(M),H):(e.consume(M),Y)}function K(M){return M===i?(e.consume(M),i=void 0,$):M===null?n(M):Ke(M)?(s=K,U(M)):(e.consume(M),K)}function Y(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||pr(M)?F(M):(e.consume(M),Y)}function $(M){return M===47||M===62||pr(M)?F(M):n(M)}function Z(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function U(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),ie}function ie(M){return Tt(M)?Ut(e,le,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):le(M)}function le(M){return e.enter("htmlTextData"),s(M)}}const ox={name:"labelEnd",tokenize:$ee,resolveTo:Lee,resolveAll:Ree},Aee={tokenize:Fee},Iee={tokenize:jee},Nee={tokenize:zee};function Ree(e){let t=-1;for(;++t<e.length;){const n=e[t][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(e.splice(t+1,n.type==="labelImage"?4:2),n.type="data",t++)}return e}function Lee(e,t){let n=e.length,r=0,i,o,s,a;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(s=n);const l={type:e[o][1].type==="labelLink"?"link":"image",start:Object.assign({},e[o][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"label",start:Object.assign({},e[o][1].start),end:Object.assign({},e[s][1].end)},d={type:"labelText",start:Object.assign({},e[o+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return a=[["enter",l,t],["enter",c,t]],a=ri(a,e.slice(o+1,o+r+3)),a=ri(a,[["enter",d,t]]),a=ri(a,nx(t.parser.constructs.insideSpan.null,e.slice(o+r+4,s-3),t)),a=ri(a,[["exit",d,t],e[s-2],e[s-1],["exit",c,t]]),a=ri(a,e.slice(s+1)),a=ri(a,[["exit",l,t]]),Ui(e,o,e.length,a),e}function $ee(e,t,n){const r=this;let i=r.events.length,o,s;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return a;function a(g){return o?o._inactive?f(g):(s=r.parser.defined.includes(Yl(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),l):n(g)}function l(g){return g===40?e.attempt(Aee,d,s?d:f)(g):g===91?e.attempt(Iee,d,s?c:f)(g):s?d(g):f(g)}function c(g){return e.attempt(Nee,d,f)(g)}function d(g){return t(g)}function f(g){return o._balanced=!0,n(g)}}function Fee(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),i}function i(f){return pr(f)?cd(e,o)(f):o(f)}function o(f){return f===41?d(f):XD(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return pr(f)?cd(e,l)(f):d(f)}function a(f){return n(f)}function l(f){return f===34||f===39||f===40?JD(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function c(f){return pr(f)?cd(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function jee(e,t,n){const r=this;return i;function i(a){return QD.call(r,e,o,s,"reference","referenceMarker","referenceString")(a)}function o(a){return r.parser.defined.includes(Yl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function s(a){return n(a)}}function zee(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const Bee={name:"labelStartImage",tokenize:Vee,resolveAll:ox.resolveAll};function Vee(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),o}function o(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),s):n(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Hee={name:"labelStartLink",tokenize:Wee,resolveAll:ox.resolveAll};function Wee(e,t,n){const r=this;return i;function i(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),o}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const sx={name:"lineEnding",tokenize:qee};function qee(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ut(e,t,"linePrefix")}}const qp={name:"thematicBreak",tokenize:Uee};function Uee(e,t,n){let r=0,i;return o;function o(c){return e.enter("thematicBreak"),s(c)}function s(c){return i=c,a(c)}function a(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||Ke(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Tt(c)?Ut(e,a,"whitespace")(c):a(c))}}const gr={name:"list",tokenize:Kee,continuation:{tokenize:Xee},exit:Jee},Gee={tokenize:Zee,partial:!0},Yee={tokenize:Qee,partial:!0};function Kee(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return a;function a(p){const v=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:tx(p)){if(r.containerState.type||(r.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(qp,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return tx(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Wp,r.interrupt?n:d,e.attempt(Gee,g,f))}function d(p){return r.containerState.initialBlankLine=!0,o++,g(p)}function f(p){return Tt(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),g):n(p)}function g(p){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Xee(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Wp,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ut(e,t,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!Tt(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Yee,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ut(e,e.attempt(gr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Qee(e,t,n){const r=this;return Ut(e,i,"listItemIndent",r.containerState.size+1);function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(o):n(o)}}function Jee(e){e.exit(this.containerState.type)}function Zee(e,t,n){const r=this;return Ut(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const s=r.events[r.events.length-1];return!Tt(o)&&s&&s[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const eT={name:"setextUnderline",tokenize:tte,resolveTo:ete};function ete(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const s={type:"setextHeading",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",s,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[o][1].end)):e[r][1]=s,e.push(["exit",s,t]),e}function tte(e,t,n){const r=this;let i;return o;function o(c){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),i=c,s(c)):n(c)}function s(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Tt(c)?Ut(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Ke(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const nte={tokenize:rte};function rte(e){const t=this,n=e.attempt(Wp,r,e.attempt(this.parser.constructs.flowInitial,i,Ut(e,e.attempt(this.parser.constructs.flow,i,e.attempt(lee,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const ite={resolveAll:nT()},ote=tT("string"),ste=tT("text");function tT(e){return{tokenize:t,resolveAll:nT(e==="text"?ate:void 0)};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,s,a);return s;function s(d){return c(d)?o(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return c(d)?(n.exit("data"),o(d)):(n.consume(d),l)}function c(d){if(d===null)return!0;const f=i[d];let g=-1;if(f)for(;++g<f.length;){const p=f[g];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function nT(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function ate(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,s=-1,a=0,l;for(;o--;){const c=i[o];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)a++,s--;if(s)break;s=-1}else if(c===-2)l=!0,a++;else if(c!==-1){o++;break}}if(a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-a,offset:r.end.offset-a,_index:r.start._index+o,_bufferIndex:o?s:r.start._bufferIndex+s},end:Object.assign({},r.end)};r.end=Object.assign({},c.start),r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}function lte(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const i={},o=[];let s=[],a=[];const l={consume:S,enter:C,exit:P,attempt:A(O),check:A(k),interrupt:A(k,{interrupt:!0})},c={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:g,now:v,defineSkip:y,write:f};let d=t.tokenize.call(c,l);return t.resolveAll&&o.push(t),c;function f(B){return s=ri(s,B),x(),s[s.length-1]!==null?[]:(L(t,0),c.events=nx(o,c.events,c),c.events)}function g(B,H){return ute(p(B),H)}function p(B){return cte(s,B)}function v(){const{line:B,column:H,offset:K,_index:Y,_bufferIndex:$}=r;return{line:B,column:H,offset:K,_index:Y,_bufferIndex:$}}function y(B){i[B.line]=B.column,j()}function x(){let B;for(;r._index<s.length;){const H=s[r._index];if(typeof H=="string")for(B=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===B&&r._bufferIndex<H.length;)w(H.charCodeAt(r._bufferIndex));else w(H)}}function w(B){d=d(B)}function S(B){Ke(B)?(r.line++,r.column=1,r.offset+=B===-3?2:1,j()):B!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=B}function C(B,H){const K=H||{};return K.type=B,K.start=v(),c.events.push(["enter",K,c]),a.push(K),K}function P(B){const H=a.pop();return H.end=v(),c.events.push(["exit",H,c]),H}function O(B,H){L(B,H.from)}function k(B,H){H.restore()}function A(B,H){return K;function K(Y,$,Z){let U,ie,le,M;return Array.isArray(Y)?ne(Y):"tokenize"in Y?ne([Y]):W(Y);function W(he){return fe;function fe(re){const ee=re!==null&&he[re],oe=re!==null&&he.null,xe=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(oe)?oe:oe?[oe]:[]];return ne(xe)(re)}}function ne(he){return U=he,ie=0,he.length===0?Z:N(he[ie])}function N(he){return fe;function fe(re){return M=F(),le=he,he.partial||(c.currentConstruct=he),he.name&&c.parser.constructs.disable.null.includes(he.name)?me():he.tokenize.call(H?Object.assign(Object.create(c),H):c,l,X,me)(re)}}function X(he){return B(le,M),$}function me(he){return M.restore(),++ie<U.length?N(U[ie]):Z}}}function L(B,H){B.resolveAll&&!o.includes(B)&&o.push(B),B.resolve&&Ui(c.events,H,c.events.length-H,B.resolve(c.events.slice(H),c)),B.resolveTo&&(c.events=B.resolveTo(c.events,c))}function F(){const B=v(),H=c.previous,K=c.currentConstruct,Y=c.events.length,$=Array.from(a);return{restore:Z,from:Y};function Z(){r=B,c.previous=H,c.currentConstruct=K,c.events.length=Y,a=$,j()}}function j(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function cte(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let s;if(n===i)s=[e[n].slice(r,o)];else{if(s=e.slice(n,i),r>-1){const a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}o>0&&s.push(e[i].slice(0,o))}return s}function ute(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let s;if(typeof o=="string")s=o;else switch(o){case-5:{s="\r";break}case-4:{s=`
440
440
  `;break}case-3:{s=`\r
441
441
  `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&i)continue;s=" ";break}default:s=String.fromCharCode(o)}i=o===-2,r.push(s)}return r.join("")}const dte=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:{91:hee},disable:{null:[]},document:{42:gr,43:gr,45:gr,48:gr,49:gr,50:gr,51:gr,52:gr,53:gr,54:gr,55:gr,56:gr,57:gr,62:WD},flow:{35:yee,42:qp,45:[eT,qp],60:See,61:eT,95:qp,96:YD,126:YD},flowInitial:{[-2]:ix,[-1]:ix,32:ix},insideSpan:{null:[rx,ite]},string:{38:UD,92:qD},text:{[-5]:sx,[-4]:sx,[-3]:sx,33:Bee,38:UD,42:rx,60:[WZ,Dee],91:Hee,92:[vee,qD],93:ox,95:rx,96:ree}},Symbol.toStringTag,{value:"Module"}));function fte(e){const n=MZ([dte,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:i($Z),document:i(jZ),flow:i(nte),string:i(ote),text:i(ste)};return r;function i(o){return s;function s(a){return lte(r,o,a)}}}function hte(e){for(;!KD(e););return e}const rT=/[\0\t\n\r]/g;function pte(){let e=1,t="",n=!0,r;return i;function i(o,s,a){const l=[];let c,d,f,g,p;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(s||void 0).decode(o)),f=0,t="",n&&(o.charCodeAt(0)===65279&&f++,n=void 0);f<o.length;){if(rT.lastIndex=f,c=rT.exec(o),g=c&&c.index!==void 0?c.index:o.length,p=o.charCodeAt(g),!c){t=o.slice(f);break}if(p===10&&f===g&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<g&&(l.push(o.slice(f,g)),e+=g-f),p){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}f=g+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const gte=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function mte(e){return e.replace(gte,vte)}function vte(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return jD(n.slice(o?2:1),o?16:10)}return Zy(n)||e}const iT={}.hasOwnProperty;function bte(e,t,n){return typeof t!="string"&&(n=t,t=void 0),yte(n)(hte(fte(n).document().write(pte()(e,t,!0))))}function yte(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(ht),autolinkProtocol:F,autolinkEmail:F,atxHeading:o($e),blockQuote:o(ee),characterEscape:F,characterReference:F,codeFenced:o(oe),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(oe,s),codeText:o(xe,s),codeTextData:F,data:F,codeFlowValue:F,definition:o(V),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(Me),hardBreakEscape:o(He),hardBreakTrailing:o(He),htmlFlow:o(Fe,s),htmlFlowData:F,htmlText:o(Fe,s),htmlTextData:F,image:o(xt),label:s,link:o(ht),listItem:o(Bt),listItemValue:g,listOrdered:o(pt,f),listUnordered:o(pt),paragraph:o(Ot),reference:N,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o($e),strong:o(tn),thematicBreak:o(Fn)},exit:{atxHeading:l(),atxHeadingSequence:O,autolink:l(),autolinkEmail:re,autolinkProtocol:fe,blockQuote:l(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:me,characterReferenceMarkerNumeric:me,characterReferenceValue:he,codeFenced:l(x),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:v,codeFlowValue:j,codeIndented:l(w),codeText:l($),codeTextData:j,data:j,definition:l(),definitionDestinationString:P,definitionLabelString:S,definitionTitleString:C,emphasis:l(),hardBreakEscape:l(H),hardBreakTrailing:l(H),htmlFlow:l(K),htmlFlowData:j,htmlText:l(Y),htmlTextData:j,image:l(U),label:le,labelText:ie,lineEnding:B,link:l(Z),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:X,resourceDestinationString:M,resourceTitleString:W,resource:ne,setextHeading:l(L),setextHeadingLineSequence:A,setextHeadingText:k,strong:l(),thematicBreak:l()}};oT(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ue){let Se={type:"root",children:[]};const Re={stack:[Se],tokenStack:[],config:t,enter:a,exit:c,buffer:s,resume:d,data:n},Ye=[];let ot=-1;for(;++ot<ue.length;)if(ue[ot][1].type==="listOrdered"||ue[ot][1].type==="listUnordered")if(ue[ot][0]==="enter")Ye.push(ot);else{const pn=Ye.pop();ot=i(ue,pn,ot)}for(ot=-1;++ot<ue.length;){const pn=t[ue[ot][0]];iT.call(pn,ue[ot][1].type)&&pn[ue[ot][1].type].call(Object.assign({sliceSerialize:ue[ot][2].sliceSerialize},Re),ue[ot][1])}if(Re.tokenStack.length>0){const pn=Re.tokenStack[Re.tokenStack.length-1];(pn[1]||sT).call(Re,void 0,pn[0])}for(Se.position={start:us(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:us(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},ot=-1;++ot<t.transforms.length;)Se=t.transforms[ot](Se)||Se;return Se}function i(ue,Se,Re){let Ye=Se-1,ot=-1,pn=!1,En,jn,Vr,Hr;for(;++Ye<=Re;){const gn=ue[Ye];switch(gn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{gn[0]==="enter"?ot++:ot--,Hr=void 0;break}case"lineEndingBlank":{gn[0]==="enter"&&(En&&!Hr&&!ot&&!Vr&&(Vr=Ye),Hr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Hr=void 0}if(!ot&&gn[0]==="enter"&&gn[1].type==="listItemPrefix"||ot===-1&&gn[0]==="exit"&&(gn[1].type==="listUnordered"||gn[1].type==="listOrdered")){if(En){let vr=Ye;for(jn=void 0;vr--;){const zn=ue[vr];if(zn[1].type==="lineEnding"||zn[1].type==="lineEndingBlank"){if(zn[0]==="exit")continue;jn&&(ue[jn][1].type="lineEndingBlank",pn=!0),zn[1].type="lineEnding",jn=vr}else if(!(zn[1].type==="linePrefix"||zn[1].type==="blockQuotePrefix"||zn[1].type==="blockQuotePrefixWhitespace"||zn[1].type==="blockQuoteMarker"||zn[1].type==="listItemIndent"))break}Vr&&(!jn||Vr<jn)&&(En._spread=!0),En.end=Object.assign({},jn?ue[jn][1].start:gn[1].end),ue.splice(jn||Ye,0,["exit",En,gn[2]]),Ye++,Re++}if(gn[1].type==="listItemPrefix"){const vr={type:"listItem",_spread:!1,start:Object.assign({},gn[1].start),end:void 0};En=vr,ue.splice(Ye,0,["enter",vr,gn[2]]),Ye++,Re++,Vr=void 0,Hr=!0}}}return ue[Se][1]._spread=pn,Re}function o(ue,Se){return Re;function Re(Ye){a.call(this,ue(Ye),Ye),Se&&Se.call(this,Ye)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(ue,Se,Re){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([Se,Re]),ue.position={start:us(Se.start),end:void 0}}function l(ue){return Se;function Se(Re){ue&&ue.call(this,Re),c.call(this,Re)}}function c(ue,Se){const Re=this.stack.pop(),Ye=this.tokenStack.pop();if(Ye)Ye[0].type!==ue.type&&(Se?Se.call(this,ue,Ye[0]):(Ye[1]||sT).call(this,ue,Ye[0]));else throw new Error("Cannot close `"+ue.type+"` ("+ad({start:ue.start,end:ue.end})+"): it’s not open");Re.position.end=us(ue.end)}function d(){return PZ(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function g(ue){if(this.data.expectingFirstListItemValue){const Se=this.stack[this.stack.length-2];Se.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function p(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.lang=ue}function v(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.meta=ue}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ue.replace(/(\r?\n|\r)$/g,"")}function S(ue){const Se=this.resume(),Re=this.stack[this.stack.length-1];Re.label=Se,Re.identifier=Yl(this.sliceSerialize(ue)).toLowerCase()}function C(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.title=ue}function P(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.url=ue}function O(ue){const Se=this.stack[this.stack.length-1];if(!Se.depth){const Re=this.sliceSerialize(ue).length;Se.depth=Re}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function A(ue){const Se=this.stack[this.stack.length-1];Se.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function F(ue){const Re=this.stack[this.stack.length-1].children;let Ye=Re[Re.length-1];(!Ye||Ye.type!=="text")&&(Ye=nn(),Ye.position={start:us(ue.start),end:void 0},Re.push(Ye)),this.stack.push(Ye)}function j(ue){const Se=this.stack.pop();Se.value+=this.sliceSerialize(ue),Se.position.end=us(ue.end)}function B(ue){const Se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Re=Se.children[Se.children.length-1];Re.position.end=us(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Se.type)&&(F.call(this,ue),j.call(this,ue))}function H(){this.data.atHardBreak=!0}function K(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ue}function Y(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ue}function $(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ue}function Z(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=Se,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function U(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=Se,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function ie(ue){const Se=this.sliceSerialize(ue),Re=this.stack[this.stack.length-2];Re.label=mte(Se),Re.identifier=Yl(Se).toLowerCase()}function le(){const ue=this.stack[this.stack.length-1],Se=this.resume(),Re=this.stack[this.stack.length-1];if(this.data.inReference=!0,Re.type==="link"){const Ye=ue.children;Re.children=Ye}else Re.alt=Se}function M(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.url=ue}function W(){const ue=this.resume(),Se=this.stack[this.stack.length-1];Se.title=ue}function ne(){this.data.inReference=void 0}function N(){this.data.referenceType="collapsed"}function X(ue){const Se=this.resume(),Re=this.stack[this.stack.length-1];Re.label=Se,Re.identifier=Yl(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function me(ue){this.data.characterReferenceType=ue.type}function he(ue){const Se=this.sliceSerialize(ue),Re=this.data.characterReferenceType;let Ye;Re?(Ye=jD(Se,Re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ye=Zy(Se);const ot=this.stack.pop();ot.value+=Ye,ot.position.end=us(ue.end)}function fe(ue){j.call(this,ue);const Se=this.stack[this.stack.length-1];Se.url=this.sliceSerialize(ue)}function re(ue){j.call(this,ue);const Se=this.stack[this.stack.length-1];Se.url="mailto:"+this.sliceSerialize(ue)}function ee(){return{type:"blockquote",children:[]}}function oe(){return{type:"code",lang:null,meta:null,value:""}}function xe(){return{type:"inlineCode",value:""}}function V(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Me(){return{type:"emphasis",children:[]}}function $e(){return{type:"heading",depth:0,children:[]}}function He(){return{type:"break"}}function Fe(){return{type:"html",value:""}}function xt(){return{type:"image",title:null,url:"",alt:null}}function ht(){return{type:"link",title:null,url:"",children:[]}}function pt(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function Bt(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function Ot(){return{type:"paragraph",children:[]}}function tn(){return{type:"strong",children:[]}}function nn(){return{type:"text",value:""}}function Fn(){return{type:"thematicBreak"}}}function us(e){return{line:e.line,column:e.column,offset:e.offset}}function oT(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?oT(e,r):xte(e,r)}}function xte(e,t){let n;for(n in t)if(iT.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function sT(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ad({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ad({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ad({start:t.start,end:t.end})+") is still open")}function wte(e){const t=this;t.parser=n;function n(r){return bte(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function _te(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Ste(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
@@ -502,4 +502,4 @@ SELECT label, measure FROM table
502
502
  Table Columns: ${g==null?void 0:g.map(K=>`${K.column_name} | ${K.data_type}`).join(", ")}
503
503
  User SQL: ${p}
504
504
  `,x=` When the user asks for a specific chart please use the following query structure to generate the chart query. Do not make up the column names. Use only the table columns provided above for the query. Replace x-axis, y-axis, and lables with the appropriate column names.
505
- Visual Query Syntax: ${Vne}`,{data:w,isLoading:S,isFetching:C,isError:P,refetch:O}=Cr({queryKey:["ai-query"],queryFn:()=>tl("http://localhost:3000/api/v1/ai",(s==null?void 0:s.accessToken)||"",{user_content:`userContent: ${y} ${a?x:""}`}),enabled:!1});function k(K){if(K.toLowerCase().includes("bar"))f("bar");else if(K.toLowerCase().includes("line"))f("line");else if(K.toLowerCase().includes("bubble"))f("bubble");else if(K.toLowerCase().includes("scatter"))f("scatter");else if(K.toLowerCase().includes("stacked"))f("stackedBar");else if(K.toLowerCase().includes("pie"))f("pie");else if(K.toLowerCase().includes("donut")||K.toLowerCase().includes("doughnut"))f("doughnut");else if(K.toLowerCase().includes("radar"))f("radar");else return f("bar"),!1;return!0}function A(){n&&(k(n)&&l(!0),O())}m.useEffect(()=>{i&&(A(),o(!1))},[i,o]);const L={fontFamily:"Arial, sans-serif",lineHeight:1.6,fontSize:15,padding:"5px",width:"100%"},F={fontFamily:"monospace",fontSize:14,lineHeight:1.6},j={fontFamily:"Arial, sans-serif",lineHeight:1.6,fontSize:15,padding:"2px 0",marginLeft:20,listStyleType:"disc"},B={p:({node:K,...Y})=>_.jsx("p",{style:L,...Y}),pre:({node:K,...Y})=>_.jsxs("pre",{className:" bg-muted/50 space-y-2 p-3 rounded-sm",style:F,children:[_.jsx("code",{className:" whitespace-normal",children:Y.children}),_.jsxs("div",{className:" flex justify-start gap-2",children:[_.jsx(it,{onClick:H,size:"sm",variant:"outline",children:_.jsx(ZE,{})}),_.jsx(it,{onClick:$=>{const Z=H($);Z&&(t(!1),c(Z),d(!0))},size:"sm",variant:"outline",children:_.jsx(Zj,{})})]})]}),li:({node:K,...Y})=>_.jsx("li",{style:j,...Y})};function H(K){const Y=K.currentTarget.closest("pre");if(!Y)return;const $=Y.textContent||Y.innerText;return navigator.clipboard.writeText($).then(()=>console.log("Text copied to clipboard")).catch(Z=>console.error("Error in copying text: ",Z)),$}return _.jsxs(wy,{open:e,onOpenChange:t,children:[_.jsx(_y,{asChild:!0,children:_.jsx(it,{size:"sm",className:"",variant:"outline",children:_.jsx(nV,{strokeWidth:1,size:16})})}),_.jsxs(_p,{className:" sm:max-w-[425px] md:min-w-[625px] md:max-h-[625px] flex flex-col justify-between overflow-auto",children:[_.jsxs(Sp,{children:[_.jsx(Cp,{children:"Ask"}),_.jsx(Ep,{children:"Need assistance with SQL queries? Feel free to ask me any question!"})]}),_.jsx(kl,{className:"h-[625px] w-full border-t border-t-muted ",children:(!S||!C)&&_.jsx(zne,{className:" pl-1 pr-3 py-1 w-full xbg-red-100 overflow-auto ",components:B,children:w==null?void 0:w.response})}),_.jsxs("div",{children:[_.jsx(cf,{className:Pe(" invisible h-1 w-full animate-pulse",{visible:S||C})}),_.jsxs("div",{className:" border rounded-md flex items-center w-full",children:[_.jsx(By,{onKeyDown:K=>{K.key==="Enter"&&!K.shiftKey&&(K.preventDefault(),r(""),A())},placeholder:"Type something...",onFocus:K=>{const Y=K.target,$=Y.value.length;Y.setSelectionRange($,$)},className:" border-none resize-none min-h-7 max-h-10 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",value:n,onChange:K=>r(K.target.value)})," ",_.jsx(it,{className:"h-8",size:"sm",variant:"ghost",onClick:A,children:!S&&!C?_.jsx(Qj,{}):_.jsx(Mu,{className:" w-4 h-4 animate-spin mr-2 text-foreground/50"})})]})]})]})]})}function Wne(){const{theme:e}=Em(),t=m.useRef(),n=m.useRef(),[r,i]=m.useState(!1),[o,s]=m.useState(!1),[a,l]=m.useState(""),[c,d]=m.useState(!1);m.useState("");const f=ge(V=>V.authToken),g=_e(V=>V.card),p=ge(V=>V.theme),v=_e(V=>V.selectedConnectionId),y=_e(V=>V.selectedDatabaseName),x=_e(V=>V.selectedSchemaName),w=_e(V=>V.selectedTableName),S=_e(V=>V.actions.setCardSql),C=_e(V=>V.card.sql),P=_e(V=>V.selectedConnectionId),O=_e(V=>V.filterValues),k=_e(V=>V.applyFilters),A=_e(V=>V.actions.setCardCustomCfg),L=_e(V=>V.actions.setFilterValues),F=_e(V=>V.onSave),j=_e(V=>V.actions.setApplyFilters),B=_e(V=>V.onClose),H=_e(V=>V.actions.setCardData),K=_e(V=>V.actions.setSqlGen),Y=_e(V=>V.runSql),$=_e(V=>V.actions.setRunSql),Z=_e(V=>V.actions.setIsSqlRunning),{data:U,isLoading:ie,isFetching:le,isSuccess:M,isError:W,error:ne,status:N,refetch:X}=Cr({queryKey:[C],queryFn:()=>Ns("http://localhost:3000/api/v1/query",(f==null?void 0:f.accessToken)||"",{connection_id:P,sql:C,active_filters:k?O:[]}),enabled:!1,retry:!1});m.useEffect(()=>{U&&(console.log("queryData",U),H(U.records))},[U,H]),m.useEffect(()=>{Y&&(X(),$(!1))},[Y,X,$]),m.useEffect(()=>{(ie||le)&&Z(!0),(W||M)&&Z(!1)},[ie,le,W,M,Z]);function me(){S(""),H([]),K({}),A("")}const he=V=>{n.current=V};function fe(){if(C&&!C.includes("{{")){const V=cJ(C);S(V),F==null||F({...g,sql:V,lastSelectedSchema:x,lastSelectedDatabase:y,lastSelectedTable:w,connectionId:v})}else F==null||F(g)}function re(){B==null||B()}function ee(V){const Me=getComputedStyle(document.documentElement).getPropertyValue(V);return oe(Me)}function oe(V){const[Me,$e,He]=V.split(" "),Fe=parseFloat(Me),xt=parseFloat($e),ht=parseFloat(He),pt=xt/100,Bt=ht/100,Ot=(1-Math.abs(2*Bt-1))*pt,tn=Ot*(1-Math.abs(Fe/60%2-1)),nn=Bt-Ot/2;let Fn=0,ue=0,Se=0;0<=Fe&&Fe<60?(Fn=Ot,ue=tn,Se=0):60<=Fe&&Fe<120?(Fn=tn,ue=Ot,Se=0):120<=Fe&&Fe<180?(Fn=0,ue=Ot,Se=tn):180<=Fe&&Fe<240?(Fn=0,ue=tn,Se=Ot):240<=Fe&&Fe<300?(Fn=tn,ue=0,Se=Ot):300<=Fe&&Fe<360&&(Fn=Ot,ue=0,Se=tn),Fn=Math.round((Fn+nn)*255),ue=Math.round((ue+nn)*255),Se=Math.round((Se+nn)*255);const Re=Ye=>{const ot=Ye.toString(16);return ot.length==1?"0"+ot:ot};return`#${Re(Fn)}${Re(ue)}${Re(Se)}`}m.useEffect(()=>{const V=t.current,Me=n.current;if(V){const $e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",He=p==="system"?$e:p;V.editor.defineTheme("default",{base:He==="light"?"vs":"vs-dark",inherit:!0,rules:[],colors:{"editor.background":He==="light"?"#ffffff":ee("--background")}}),V.editor.setTheme("default")}return Me&&V&&Me.addCommand(V.KeyMod.Shift|V.KeyCode.Enter,function(){return console.log("Executing query..."),X(),!1}),()=>{}},[e,p,t.current]);function xe(V){t.current=V}return _.jsxs("section",{role:"editor-section",className:"grow flex flex-col justify-end pt-3 p-1 ",children:[_.jsxs("div",{className:" grow flex relative overflow-y-scroll justify-between ",children:[_.jsx("div",{role:"editor-container",className:`flex ${r?"w-2/3":"w-[95%]"} xbg-red-100 p-1`,children:_.jsx(Ry,{theme:"default",onChange:V=>{S(V),console.log(V)},value:C,options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:14,renderLineHighlight:"none"},defaultLanguage:"sql",defaultValue:"SELECT * FROM table",beforeMount:xe,onMount:he})}),r&&_.jsx("div",{className:" w-1/3 text-xs relative overflow-hidden xbg-yellow-100 p-1 ",children:_.jsxs("div",{className:"min-h-0 ",children:[_.jsxs("div",{className:"flex gap-2 items-center",children:[_.jsx(_J,{checked:k,onCheckedChange:()=>j(!k),text:"Apply Filters"}),_.jsx(SJ,{})]}),_.jsx(Ry,{theme:"default",onChange:V=>{if(V)try{JSON.parse(V),L(JSON.parse(V))}catch{}},defaultLanguage:"json",className:"min-h-[220px] mt-1",value:JSON.stringify(O,null,2),options:{readOnly:!0,minimap:{enabled:!1},lineNumbers:"off",glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})]})}),O&&r&&_.jsx(oa,{onClick:()=>i(!1),className:"absolute right-6 top-1 w-3 h-3 text-foreground/50 hover:text-foreground hover:cursor-pointer"}),O&&!r&&_.jsx(W2,{onClick:()=>i(!0),className:Pe("absolute right-6 top-1 w-3 h-3 text-foreground/50 hover:text-foreground hover:cursor-pointer",{"text-red-800 font-bold":k})})]}),_.jsxs("div",{className:" flex grow px-6 pt-3 pb-4 gap-2 justify-between item-center",children:[_.jsxs("div",{className:"flex grow gap-2 items-center",children:[_.jsxs(it,{disabled:ie||le,onClick:()=>{X()},className:" shrink-0",size:"sm",variant:"outline",children:[(ie||le)&&_.jsx(Mu,{className:"w-4 h-4 mr-2 animate-spin text-foreground/50"}),"Run"]}),W&&_.jsx(wJ,{error:ne.message}),_.jsx(it,{onClick:me,className:"",size:"sm",variant:"outline",children:"Clear"}),_.jsx(Xu,{value:a,placeholder:"Type something...",onChange:V=>{l(V.target.value)},onKeyDown:V=>{V.key==="Enter"&&(V.preventDefault(),console.log("enter pressed"),d(!0),s(!0))},className:" bg-muted border-none h-9 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"}),_.jsx(Hne,{open:o,setOpen:s,userInput:a,triggerAIRun:c,setTriggerAIRun:d,setUserInput:V=>l(V)})]}),_.jsxs("div",{className:"flex gap-2 items-end ",children:[_.jsx(it,{onClick:fe,size:"sm",variant:"outline",children:_.jsx(Rh,{size:16,strokeWidth:2,className:"text-green-600 font-bold"})}),_.jsx(it,{onClick:re,className:" w-full",size:"sm",variant:"outline",children:_.jsx(oa,{})})]})]})]})}const FT="Switch",[qne,Sfe]=kn(FT),[Une,Gne]=qne(FT),Yne=m.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:l="on",onCheckedChange:c,...d}=e,[f,g]=m.useState(null),p=et(t,S=>g(S)),v=m.useRef(!1),y=f?!!f.closest("form"):!0,[x=!1,w]=Jn({prop:i,defaultProp:o,onChange:c});return m.createElement(Une,{scope:n,checked:x,disabled:a},m.createElement(Ve.button,ae({type:"button",role:"switch","aria-checked":x,"aria-required":s,"data-state":jT(x),"data-disabled":a?"":void 0,disabled:a,value:l},d,{ref:p,onClick:Ee(e.onClick,S=>{w(C=>!C),y&&(v.current=S.isPropagationStopped(),v.current||S.stopPropagation())})})),y&&m.createElement(Qne,{control:f,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,style:{transform:"translateX(-100%)"}}))}),Kne="SwitchThumb",Xne=m.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,i=Gne(Kne,n);return m.createElement(Ve.span,ae({"data-state":jT(i.checked),"data-disabled":i.disabled?"":void 0},r,{ref:t}))}),Qne=e=>{const{control:t,checked:n,bubbles:r=!0,...i}=e,o=m.useRef(null),s=Op(n),a=Mh(t);return m.useEffect(()=>{const l=o.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&f){const g=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(g)}},[s,n,r]),m.createElement("input",ae({type:"checkbox","aria-hidden":!0,defaultChecked:n},i,{tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function jT(e){return e?"checked":"unchecked"}const zT=Yne,Jne=Xne,BT=de.forwardRef(({className:e,...t},n)=>_.jsx(zT,{className:Pe("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:_.jsx(Jne,{className:Pe("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));BT.displayName=zT.displayName;function VT({className:e,...t}){const[n,r]=m.useState(0),i=ge(l=>l.themeStyle),o=_e(l=>l.card),s=_e(l=>l.actions.setCard);if(m.useEffect(()=>{r(n+1)},[o.data,o.type,o.cfg,o.customCfg,i]),!o.id)return null;let a;return o.data&&o.data.length>0&&(a=kb({data:o.data,cardType:o.type,cfg:o.cfg,customCfg:o.customCfg})),_.jsxs(Mv,{role:"editor-visual-card",className:Pe(" relative h-full flex flex-col rounded-none",e),...t,children:[_.jsxs(Dv,{children:[_.jsx(qc,{text:o.title,onSave:l=>s({...o,title:l}),children:_.jsx(Tv,{className:"text-base",children:o.title})}),_.jsx(qc,{text:o.description||"",onSave:l=>s({...o,description:l}),children:_.jsxs(Av,{children:[" ",o.description]})})]}),_.jsxs(Iv,{className:"flex flex-col pb-3 grow",children:[o.type!=="table"&&a&&_.jsx(QE,{cfg:a},n),o.type==="table"&&o.data&&o.data.length>0&&_.jsx(uO,{children:_.jsx(a0,{data:o==null?void 0:o.data})})]})]})}function Zne(){const[e,t]=m.useState(!1),[n,r]=m.useState(""),[i,o]=m.useState(""),[s,a]=m.useState(""),l=_e(x=>x.card),c=_e(x=>x.card.customCfg),d=_e(x=>x.actions.setCardCustomCfg);function f(x){var C,P;const w={...x,data:{...x==null?void 0:x.data,datasets:(P=(C=x==null?void 0:x.data)==null?void 0:C.datasets)==null?void 0:P.map(O=>({...O,data:[]}))}};return JSON.stringify(w,null,1)}function g(){if(!l.data||l.data.length===0)return;const x=kb({data:l.data,cardType:l.type,cfg:l.cfg});x&&(r(JSON.stringify(x,null,1)),c&&o(JSON.stringify(c,null,1)))}function p(){if(i)try{const x=JSON.parse(i);return x?(d(x),a(""),o(""),x):void 0}catch(x){console.log(x),a("Invalid JSON")}}function v(){o(""),d(null)}function y(){let x;if(c){const w=Fs.cloneDeep(l.cfg),S=Fs.merge(w,c);return x=f(S),x}return n?(x=f(JSON.parse(n)),x):""}return _.jsxs(wy,{open:e,onOpenChange:t,children:[_.jsx(_y,{asChild:!0,children:_.jsx(it,{onClick:g,className:`h-7 ${c&&"border-foreground/50 dark:border-foreground/70"}`,size:"sm",variant:"outline",children:c?"Custom Config":"Customize"})}),_.jsx(_p,{className:" sm:max-w-[425px] md:min-w-[600px] md:min-h-[700px] lg:min-w-[800px] xl:min-w-[1000px]",children:_.jsxs("div",{className:"bg-red-x100 flex flex-col gap-2 justify-between",children:[_.jsxs(Sp,{className:"",children:[_.jsx(Cp,{children:"Customize Chart"}),_.jsxs(Ep,{children:["See the configuration options and documentation",_.jsx("a",{target:"_blank",className:"ml-1 underline text-blue-500 ",href:"https://www.chartjs.org/docs/latest/samples/bar/vertical.html",children:"here."})]})]}),_.jsxs("div",{className:"grow flex flex-wrap gap-2",children:[_.jsx(VT,{className:"flex-1 rounded shadow-none"}),_.jsxs(a_,{defaultValue:"custom-config",className:" flex flex-col flex-1",children:[_.jsxs(l_,{className:" justify-start border rounded-sm rounded-b-none border-b-0 ",children:[_.jsxs(Im,{value:"custom-config",children:[c&&_.jsx(JE,{className:"w-5 h-5 mr-1 text-green-600"}),c?"Custom Config":"Default Config"]}),_.jsx(Im,{className:"",value:"output",children:"Output"})]}),_.jsx(hf,{className:" grow mt-0 bg-red-x p-2 border border-t-0 rounded-b ",value:"output",children:_.jsx(By,{disabled:!0,value:n,className:" border-none resize-none font-mono h-full focus-visible:ring-0 focus-visible:ring-offset-0"})}),_.jsx(hf,{className:"grow mt-0 border border-t-0 rounded-b ",value:"custom-config",children:_.jsx(Ry,{className:"h-full w-full overflow-hidden",theme:"default",options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:14,renderLineHighlight:"none"},defaultLanguage:"json",value:y(),onChange:x=>o(x)})})]})]}),_.jsxs(Sy,{className:"flex items-center",children:[_.jsx(rs,{className:"text-red-500 mr-2",children:s}),_.jsx(it,{disabled:!c,onClick:v,variant:"outline",children:"Reset"}),_.jsx(it,{onClick:p,variant:"outline",children:"Apply"}),_.jsx(it,{onClick:()=>t(!1),variant:"outline",children:"Close"})]})]})})]})}var HT={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},WT=m.createContext&&m.createContext(HT),ere=["attr","size","title"];function tre(e,t){if(e==null)return{};var n=nre(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function nre(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function tg(){return tg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tg.apply(this,arguments)}function qT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ng(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qT(Object(n),!0).forEach(function(r){rre(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rre(e,t,n){return t=ire(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ire(e){var t=ore(e,"string");return typeof t=="symbol"?t:String(t)}function ore(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function UT(e){return e&&e.map((t,n)=>m.createElement(t.tag,ng({key:n},t.attr),UT(t.child)))}function fd(e){return t=>m.createElement(sre,tg({attr:ng({},e.attr)},t),UT(e.child))}function sre(e){var t=n=>{var{attr:r,size:i,title:o}=e,s=tre(e,ere),a=i||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),m.createElement("svg",tg({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,s,{className:l,style:ng(ng({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),o&&m.createElement("title",null,o),e.children)};return WT!==void 0?m.createElement(WT.Consumer,null,n=>t(n)):t(HT)}function GT(e){return fd({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M926.8 397.1l-396-288a31.81 31.81 0 0 0-37.6 0l-396 288a31.99 31.99 0 0 0-11.6 35.8l151.3 466a32 32 0 0 0 30.4 22.1h489.5c13.9 0 26.1-8.9 30.4-22.1l151.3-466c4.2-13.2-.5-27.6-11.7-35.8zM838.6 417l-98.5 32-200-144.7V199.9L838.6 417zM466 567.2l-89.1 122.3-55.2-169.2L466 567.2zm-116.3-96.8L484 373.3v140.8l-134.3-43.7zM512 599.2l93.9 128.9H418.1L512 599.2zm28.1-225.9l134.2 97.1L540.1 514V373.3zM558 567.2l144.3-46.9-55.2 169.2L558 567.2zm-74-367.3v104.4L283.9 449l-98.5-32L484 199.9zM169.3 470.8l86.5 28.1 80.4 246.4-53.8 73.9-113.1-348.4zM327.1 853l50.3-69h269.3l50.3 69H327.1zm414.5-33.8l-53.8-73.9 80.4-246.4 86.5-28.1-113.1 348.4z"},child:[]}]})(e)}function YT(e){return fd({tag:"svg",attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm87.63,96H191.48A64.1,64.1,0,0,0,136,64.52V40.37A88.13,88.13,0,0,1,215.63,120ZM120,120H80.68A48.09,48.09,0,0,1,120,80.68Zm0,16v39.32A48.09,48.09,0,0,1,80.68,136Zm16,0h39.32A48.09,48.09,0,0,1,136,175.32Zm0-16V80.68A48.09,48.09,0,0,1,175.32,120ZM120,40.37V64.52A64.1,64.1,0,0,0,64.52,120H40.37A88.13,88.13,0,0,1,120,40.37ZM40.37,136H64.52A64.1,64.1,0,0,0,120,191.48v24.15A88.13,88.13,0,0,1,40.37,136ZM136,215.63V191.48A64.1,64.1,0,0,0,191.48,136h24.15A88.13,88.13,0,0,1,136,215.63Z"},child:[]}]})(e)}function KT(e){return fd({tag:"svg",attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M137,28.05a11.94,11.94,0,0,0-9.12,3.08A12.09,12.09,0,0,0,124,40V80.67a11.88,11.88,0,0,0,9.9,11.81,36,36,0,1,1-41.85,37.4c-.47-9.14,1.47-16.8,5.75-22.79h0a11.89,11.89,0,0,0-1.3-15.35L68.87,63.51a12,12,0,0,0-17.74.83A99.6,99.6,0,0,0,57.79,199.2,99.24,99.24,0,0,0,128,228h1.43A100.29,100.29,0,0,0,228,129.42C228.72,77.21,188.76,32.68,137,28.05ZM57.28,69.46A4,4,0,0,1,60.2,68h.19a3.91,3.91,0,0,1,2.79,1.14L90.81,97.36a3.93,3.93,0,0,1,.48,5.08A40.47,40.47,0,0,0,84.08,124h-48A90.36,90.36,0,0,1,57.28,69.46ZM36.09,132H84.18A44,44,0,0,0,124,171.81V219.9A92,92,0,0,1,36.09,132ZM193,193a91.43,91.43,0,0,1-61,26.92V171.82a43.51,43.51,0,0,0,26-11.63,44,44,0,0,0-22.79-75.6A4,4,0,0,1,132,80.67V40a4,4,0,0,1,1.31-3,3.89,3.89,0,0,1,3-1c47.59,4.26,84.34,45.24,83.67,93.29A91.42,91.42,0,0,1,193,193Z"},child:[]}]})(e)}function XT(e){return fd({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},child:[]},{tag:"path",attr:{d:"M6 16m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"},child:[]},{tag:"path",attr:{d:"M16 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},child:[]},{tag:"path",attr:{d:"M14.5 7.5m-4.5 0a4.5 4.5 0 1 0 9 0a4.5 4.5 0 1 0 -9 0"},child:[]}]})(e)}function QT(e){return fd({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M4 9h4v11H4zM4 4h4v4H4zM10 7h4v4h-4zM16 10h4v4h-4zM16 15h4v5h-4zM10 12h4v8h-4z"},child:[]}]})(e)}function are(){const[e,t]=m.useState(!1),n=_e(s=>s.card.type),r=_e(s=>s.actions.setCardType),i=_e(s=>s.actions.setCardCustomCfg);function o(s){r(s),i(null),t(!1)}return _.jsxs(pp,{open:e,onOpenChange:t,children:[_.jsx(gp,{asChild:!0,children:_.jsx(it,{className:"h-7 px-2",variant:"outline",children:_.jsx(lre,{className:"h-4 w-4",chartType:n})})}),_.jsx(qu,{className:"w-50",children:_.jsxs("div",{className:"grid grid-cols-3 place-items-center ",children:[_.jsx(it,{onClick:()=>o("bar"),className:"font-normal",variant:"ghost",children:_.jsx(B2,{strokeWidth:1})}),_.jsx(it,{onClick:()=>o("line"),variant:"ghost",children:_.jsx(q2,{strokeWidth:1})}),_.jsx(it,{onClick:()=>o("stackedBar"),variant:"ghost",children:_.jsx(QT,{className:"h-6 w-6 text-foreground/50 ",strokeWidth:0})}),_.jsx(it,{onClick:()=>o("scatter"),variant:"ghost",children:_.jsx(Y2,{strokeWidth:1})}),_.jsx(it,{onClick:()=>o("bubble"),variant:"ghost",children:_.jsx(XT,{strokeWidth:2})}),_.jsx(it,{onClick:()=>o("pie"),variant:"ghost",children:_.jsx(U2,{strokeWidth:1})}),_.jsx(it,{onClick:()=>o("doughnut"),variant:"ghost",children:_.jsx(KT,{className:"h-7 w-7",strokeWidth:.5})}),_.jsx(it,{onClick:()=>o("radar"),variant:"ghost",children:_.jsx(GT,{className:"h-6 w-6 text-foreground/50 font-extralight",strokeWidth:.5})}),_.jsx(it,{onClick:()=>o("polarArea"),variant:"ghost",children:_.jsx(YT,{className:"h-6 w-6 text-foreground/50",strokeWidth:1})}),_.jsx(it,{onClick:()=>o("table"),variant:"ghost",children:_.jsx(qb,{className:"h-6 w-6 text-foreground/90",strokeWidth:1})})]})})]})}function lre({chartType:e,className:t}){switch(e){case"bar":return _.jsx(B2,{className:t});case"line":return _.jsx(q2,{className:t});case"pie":return _.jsx(U2,{className:t});case"radar":return _.jsx(GT,{className:t});case"scatter":return _.jsx(Y2,{className:t});case"bubble":return _.jsx(XT,{className:t});case"doughnut":return _.jsx(KT,{className:t});case"stackedBar":return _.jsx(QT,{className:"h-5 w-5 text-foreground/50 ",strokeWidth:0});case"polarArea":return _.jsx(YT,{className:t});default:return _.jsx(qb,{className:t})}}function cre(){const e=_e(n=>n.card.refreshInterval),t=_e(n=>n.actions.setCardRefreshInterval);return _.jsxs(pp,{children:[_.jsx(gp,{asChild:!0,children:_.jsx(it,{className:"h-7",variant:"outline",children:"Realtime"})}),_.jsx(qu,{className:"w-[200px]",children:_.jsx("div",{className:"grid gap-4",children:_.jsx("div",{className:"grid gap-2",children:_.jsxs("div",{className:"grid grid-cols-5 items-center gap-1",children:[_.jsx(rs,{className:"col-span-3",htmlFor:"width",children:"Refresh Every"}),_.jsx(Xu,{value:e||"",onChange:n=>t(n.target.value),id:"width",placeholder:"30s",className:"col-span-2 h-7 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-0"})]})})})})]})}function JT(){const e=_e(r=>r.card),t=_e(r=>r.isShowingVisual),n=_e(r=>r.isSqlRunning);return _e(r=>r.onSave),_e(r=>r.onClose),_e(r=>r.actions.setCardSql),_e(r=>r.actions.setCardType),_e(r=>r.actions.setSqlGen),_.jsxs("div",{className:" h-full relative flex flex-col",children:[n&&_.jsx(Mu,{className:" w-10 h-10 z-10 absolute m-auto left-0 right-0 top-0 bottom-0 animate-spin text-foreground/10 "}),_.jsxs("div",{className:" h-10 px-6 pt-6 bg-red-x100 mb-0 z-10 right-0 flex justify-end items-center gap-2",children:[t&&_.jsxs("div",{className:"bg-red-x00 flex grow gap-2",children:[_.jsx(are,{}),_.jsx(Zne,{}),_.jsx(cre,{})]}),_.jsx(ure,{})]}),t?_.jsx(VT,{className:"grow border-none shadow-none "}):_.jsx("div",{className:"w-full mt-4 px-6 bg-red-x00 grow border-none shadow-none overflow-y-auto ",children:e.data&&e.data.length>0&&_.jsx(a0,{data:e.data})})]})}function ure(){const e=_e(n=>n.isShowingVisual),t=_e(n=>n.actions.setIsShowingVisual);return _.jsxs("div",{className:" flex items-center space-x-2",children:[_.jsx(rs,{htmlFor:"visualize",children:"Chart"}),_.jsx(BT,{checked:e,onCheckedChange:()=>t(!e),id:"visualize",className:"data-[state=checked]:bg-foreground/50"})]})}const ZT="Collapsible",[dre,eA]=kn(ZT),[fre,_x]=dre(ZT),hre=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:o,onOpenChange:s,...a}=e,[l=!1,c]=Jn({prop:r,defaultProp:i,onChange:s});return m.createElement(fre,{scope:n,disabled:o,contentId:sr(),open:l,onOpenToggle:m.useCallback(()=>c(d=>!d),[c])},m.createElement(Ve.div,ae({"data-state":Sx(l),"data-disabled":o?"":void 0},a,{ref:t})))}),pre="CollapsibleTrigger",gre=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=_x(pre,n);return m.createElement(Ve.button,ae({type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Sx(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled},r,{ref:t,onClick:Ee(e.onClick,i.onOpenToggle)}))}),tA="CollapsibleContent",mre=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=_x(tA,e.__scopeCollapsible);return m.createElement(bn,{present:n||i.open},({present:o})=>m.createElement(vre,ae({},r,{ref:t,present:o})))}),vre=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:i,...o}=e,s=_x(tA,n),[a,l]=m.useState(r),c=m.useRef(null),d=et(t,c),f=m.useRef(0),g=f.current,p=m.useRef(0),v=p.current,y=s.open||a,x=m.useRef(y),w=m.useRef();return m.useEffect(()=>{const S=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(S)},[]),Hn(()=>{const S=c.current;if(S){w.current=w.current||{transitionDuration:S.style.transitionDuration,animationName:S.style.animationName},S.style.transitionDuration="0s",S.style.animationName="none";const C=S.getBoundingClientRect();f.current=C.height,p.current=C.width,x.current||(S.style.transitionDuration=w.current.transitionDuration,S.style.animationName=w.current.animationName),l(r)}},[s.open,r]),m.createElement(Ve.div,ae({"data-state":Sx(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!y},o,{ref:d,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...e.style}}),y&&i)});function Sx(e){return e?"open":"closed"}const bre=hre,yre=gre,xre=mre,ds="Accordion",wre=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Cx,_re,Sre]=df(ds),[rg,Cfe]=kn(ds,[Sre,eA]),Ex=eA(),nA=m.forwardRef((e,t)=>{const{type:n,...r}=e,i=r,o=r;return m.createElement(Cx.Provider,{scope:e.__scopeAccordion},n==="multiple"?m.createElement(Pre,ae({},o,{ref:t})):m.createElement(Ore,ae({},i,{ref:t})))});nA.propTypes={type(e){const t=e.value||e.defaultValue;return e.type&&!["single","multiple"].includes(e.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):e.type==="multiple"&&typeof t=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):e.type==="single"&&Array.isArray(t)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[rA,Cre]=rg(ds),[iA,Ere]=rg(ds,{collapsible:!1}),Ore=m.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:o=!1,...s}=e,[a,l]=Jn({prop:n,defaultProp:r,onChange:i});return m.createElement(rA,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:l,onItemClose:m.useCallback(()=>o&&l(""),[o,l])},m.createElement(iA,{scope:e.__scopeAccordion,collapsible:o},m.createElement(oA,ae({},s,{ref:t}))))}),Pre=m.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...o}=e,[s=[],a]=Jn({prop:n,defaultProp:r,onChange:i}),l=m.useCallback(d=>a((f=[])=>[...f,d]),[a]),c=m.useCallback(d=>a((f=[])=>f.filter(g=>g!==d)),[a]);return m.createElement(rA,{scope:e.__scopeAccordion,value:s,onItemOpen:l,onItemClose:c},m.createElement(iA,{scope:e.__scopeAccordion,collapsible:!0},m.createElement(oA,ae({},o,{ref:t}))))}),[kre,ig]=rg(ds),oA=m.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:i,orientation:o="vertical",...s}=e,a=m.useRef(null),l=et(a,t),c=_re(n),f=js(i)==="ltr",g=Ee(e.onKeyDown,p=>{var v;if(!wre.includes(p.key))return;const y=p.target,x=c().filter(F=>{var j;return!((j=F.ref.current)!==null&&j!==void 0&&j.disabled)}),w=x.findIndex(F=>F.ref.current===y),S=x.length;if(w===-1)return;p.preventDefault();let C=w;const P=0,O=S-1,k=()=>{C=w+1,C>O&&(C=P)},A=()=>{C=w-1,C<P&&(C=O)};switch(p.key){case"Home":C=P;break;case"End":C=O;break;case"ArrowRight":o==="horizontal"&&(f?k():A());break;case"ArrowDown":o==="vertical"&&k();break;case"ArrowLeft":o==="horizontal"&&(f?A():k());break;case"ArrowUp":o==="vertical"&&A();break}const L=C%S;(v=x[L].ref.current)===null||v===void 0||v.focus()});return m.createElement(kre,{scope:n,disabled:r,direction:i,orientation:o},m.createElement(Cx.Slot,{scope:n},m.createElement(Ve.div,ae({},s,{"data-orientation":o,ref:l,onKeyDown:r?void 0:g}))))}),Ox="AccordionItem",[Mre,Px]=rg(Ox),Dre=m.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...i}=e,o=ig(Ox,n),s=Cre(Ox,n),a=Ex(n),l=sr(),c=r&&s.value.includes(r)||!1,d=o.disabled||e.disabled;return m.createElement(Mre,{scope:n,open:c,disabled:d,triggerId:l},m.createElement(bre,ae({"data-orientation":o.orientation,"data-state":aA(c)},a,i,{ref:t,disabled:d,open:c,onOpenChange:f=>{f?s.onItemOpen(r):s.onItemClose(r)}})))}),Tre="AccordionHeader",Are=m.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=ig(ds,n),o=Px(Tre,n);return m.createElement(Ve.h3,ae({"data-orientation":i.orientation,"data-state":aA(o.open),"data-disabled":o.disabled?"":void 0},r,{ref:t}))}),sA="AccordionTrigger",Ire=m.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=ig(ds,n),o=Px(sA,n),s=Ere(sA,n),a=Ex(n);return m.createElement(Cx.ItemSlot,{scope:n},m.createElement(yre,ae({"aria-disabled":o.open&&!s.collapsible||void 0,"data-orientation":i.orientation,id:o.triggerId},a,r,{ref:t})))}),Nre="AccordionContent",Rre=m.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=ig(ds,n),o=Px(Nre,n),s=Ex(n);return m.createElement(xre,ae({role:"region","aria-labelledby":o.triggerId,"data-orientation":i.orientation},s,r,{ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}}))});function aA(e){return e?"open":"closed"}const Lre=nA,$re=Dre,Fre=Are,lA=Ire,cA=Rre,uA=Lre,fs=de.forwardRef(({className:e,...t},n)=>_.jsx($re,{ref:n,className:Pe("border-b",e),...t}));fs.displayName="AccordionItem";const hs=de.forwardRef(({className:e,children:t,...n},r)=>_.jsx(Fre,{className:"flex",children:_.jsxs(lA,{ref:r,className:Pe("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,_.jsx(Wb,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));hs.displayName=lA.displayName;const ps=de.forwardRef(({className:e,children:t,...n},r)=>_.jsx(cA,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:_.jsx("div",{className:Pe("pb-4 pt-0",e),children:t})}));ps.displayName=cA.displayName;const dA="Radio",[jre,fA]=kn(dA),[zre,Bre]=jre(dA),Vre=m.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:i=!1,required:o,disabled:s,value:a="on",onCheck:l,...c}=e,[d,f]=m.useState(null),g=et(t,y=>f(y)),p=m.useRef(!1),v=d?!!d.closest("form"):!0;return m.createElement(zre,{scope:n,checked:i,disabled:s},m.createElement(Ve.button,ae({type:"button",role:"radio","aria-checked":i,"data-state":hA(i),"data-disabled":s?"":void 0,disabled:s,value:a},c,{ref:g,onClick:Ee(e.onClick,y=>{i||l==null||l(),v&&(p.current=y.isPropagationStopped(),p.current||y.stopPropagation())})})),v&&m.createElement(qre,{control:d,bubbles:!p.current,name:r,value:a,checked:i,required:o,disabled:s,style:{transform:"translateX(-100%)"}}))}),Hre="RadioIndicator",Wre=m.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...i}=e,o=Bre(Hre,n);return m.createElement(bn,{present:r||o.checked},m.createElement(Ve.span,ae({"data-state":hA(o.checked),"data-disabled":o.disabled?"":void 0},i,{ref:t})))}),qre=e=>{const{control:t,checked:n,bubbles:r=!0,...i}=e,o=m.useRef(null),s=Op(n),a=Mh(t);return m.useEffect(()=>{const l=o.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&f){const g=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(g)}},[s,n,r]),m.createElement("input",ae({type:"radio","aria-hidden":!0,defaultChecked:n},i,{tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function hA(e){return e?"checked":"unchecked"}const Ure=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],pA="RadioGroup",[Gre,Efe]=kn(pA,[ol,fA]),gA=ol(),mA=fA(),[Yre,Kre]=Gre(pA),Xre=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:i,value:o,required:s=!1,disabled:a=!1,orientation:l,dir:c,loop:d=!0,onValueChange:f,...g}=e,p=gA(n),v=js(c),[y,x]=Jn({prop:o,defaultProp:i,onChange:f});return m.createElement(Yre,{scope:n,name:r,required:s,disabled:a,value:y,onValueChange:x},m.createElement(Dm,ae({asChild:!0},p,{orientation:l,dir:v,loop:d}),m.createElement(Ve.div,ae({role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":a?"":void 0,dir:v},g,{ref:t}))))}),Qre="RadioGroupItem",Jre=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...i}=e,o=Kre(Qre,n),s=o.disabled||r,a=gA(n),l=mA(n),c=m.useRef(null),d=et(t,c),f=o.value===i.value,g=m.useRef(!1);return m.useEffect(()=>{const p=y=>{Ure.includes(y.key)&&(g.current=!0)},v=()=>g.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",v),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",v)}},[]),m.createElement(Tm,ae({asChild:!0},a,{focusable:!s,active:f}),m.createElement(Vre,ae({disabled:s,required:o.required,checked:f},l,i,{name:o.name,ref:d,onCheck:()=>o.onValueChange(i.value),onKeyDown:Ee(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:Ee(i.onFocus,()=>{var p;g.current&&((p=c.current)===null||p===void 0||p.click())})})))}),Zre=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,i=mA(n);return m.createElement(Wre,ae({},i,r,{ref:t}))}),vA=Xre,bA=Jre,eie=Zre,yA=de.forwardRef(({className:e,...t},n)=>_.jsx(vA,{className:Pe("grid gap-2",e),...t,ref:n}));yA.displayName=vA.displayName;const kx=de.forwardRef(({className:e,...t},n)=>_.jsx(bA,{ref:n,className:Pe("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:_.jsx(eie,{className:"flex items-center justify-center",children:_.jsx(H2,{className:"h-2.5 w-2.5 fill-current text-current"})})}));kx.displayName=bA.displayName;function xA(){var i;const e=_e(o=>o.card.cfg),t=_e(o=>o.actions.setCardCfg),n=(i=e==null?void 0:e.options)==null?void 0:i.indexAxis;function r(o){const s={...e,options:{...e==null?void 0:e.options,indexAxis:o}};t(s)}return _.jsxs("div",{children:[_.jsx("p",{className:"font-semibold",children:"Orientation"}),_.jsxs(yA,{value:n,onValueChange:r,className:"flex gap-3 mt-2 ",defaultValue:"x",children:[_.jsxs("div",{className:"flex items-center space-x-2",children:[_.jsx(kx,{value:"x",id:"r1"}),_.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Vertical"})]}),_.jsxs("div",{className:"flex items-center space-x-2",children:[_.jsx(kx,{value:"y",id:"r2"}),_.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Horizontal"})]})]})]})}function wA(){var r,i,o;const e=_e(s=>s.card.cfg),t=_e(s=>s.actions.setCardCfg);function n(s){var c;const a={datalabels:{display:s!=="none",align:s,anchor:s,clamp:!0}},l={...e,options:{...e==null?void 0:e.options,plugins:{...(c=e==null?void 0:e.options)==null?void 0:c.plugins,...a}}};t(l),console.log(s)}return _.jsxs(_.Fragment,{children:[_.jsx("label",{className:"font-medium",children:"Data Labels"}),_.jsxs(cM,{value:(o=(i=(r=e==null?void 0:e.options)==null?void 0:r.plugins)==null?void 0:i.datalabels)==null?void 0:o.anchor,onValueChange:n,defaultValue:"none",children:[_.jsx(Py,{className:"w-[180px] mt-2 focus:ring-1 focus:ring-offset-0 h-7",children:_.jsx(dM,{placeholder:"Select position"})}),_.jsx(ky,{children:_.jsxs(uM,{children:[_.jsx(Ap,{children:"Data Labels"}),_.jsx(Sa,{value:"none",children:"None"}),_.jsx(Sa,{value:"start",children:"Start"}),_.jsx(Sa,{value:"center",children:"Center"}),_.jsx(Sa,{value:"end",children:"End"})]})})]})]})}function _A(){const e=_e(i=>i.card.preferences),t=_e(i=>i.actions.setCardPreferences),n=_e(i=>{var o;return(o=i.card.preferences)==null?void 0:o.filterOnClickField}),r=_e(i=>i.actions.setFilterOnClickField);return _.jsxs("div",{children:[_.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[_.jsx(Pp,{checked:!!(e!=null&&e.filterOnClick),onCheckedChange:i=>{t({...e,filterOnClick:!!i})}}),_.jsx(rs,{children:"Filter on click"})]}),(e==null?void 0:e.filterOnClick)===!0&&_.jsxs("div",{className:"flex gap-2 items-center",children:[_.jsx(Xu,{value:n||"",className:" h-7 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",placeholder:"expression (optional)",onChange:i=>r(i.target.value)}),_.jsxs(Vb,{children:[_.jsx(L2,{children:_.jsx(e2,{className:"h-4 w-4 opacity-70"})}),_.jsx(Ih,{children:_.jsxs("div",{className:"max-w-[200px]",children:["The x-axis expression of your query. Example:",_.jsx("div",{className:" mt-1 text-xs font-mono",children:"TO_CHAR(order_date, 'YYYY-MM')"})]})})]})]})]})}const tie={datasets:[{type:"line",label:"Sum_sales",data:[]},{type:"bar",label:"Sum_profit",data:[]}]},nie={datasets:[{fill:"origin",type:"line",label:"Sum_sales",data:[]}]};function rie(){const e=_e(t=>t.card.type);return _.jsxs("div",{className:"p-6 space-y-6",children:[_.jsx(uA,{className:" ",type:"single",collapsible:!0,children:iie(e)}),_.jsx("section",{className:"",children:["line","bar"].includes(e)&&_.jsx(xA,{})}),_.jsx("div",{children:_.jsx(wA,{})}),_.jsx("div",{children:_.jsx(_A,{})})]})}function iie(e){if(["line","bar"].includes(e))return _.jsxs(_.Fragment,{children:[_.jsxs(fs,{value:"item-1",children:[_.jsx(hs,{className:" font-normal",children:_.jsx("p",{children:"Chart Query"})}),_.jsxs(ps,{className:" ",children:[_.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT x-axis, y-axis-1, y-axis-2, y-axis-3,... FROM table"}),_.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[_.jsx("li",{children:"X-axis - Category (ex. city)"}),_.jsx("li",{children:"Y-axis - Number (ex. population)"})]})]})]}),_.jsxs(fs,{value:"item-2",children:[_.jsx(hs,{className:" font-normal",children:"Mixed Chart"}),_.jsxs(ps,{className:" text-xs space-y-2",children:[_.jsxs("p",{children:["Click ",_.jsx("b",{children:"Customize"})," and change the `type` property in the dataset."]}),_.jsx("pre",{children:JSON.stringify(tie,null,2)})]})]}),_.jsxs(fs,{value:"item-3",children:[_.jsx(hs,{className:" font-normal",children:"Area Chart"}),_.jsxs(ps,{className:" text-xs space-y-2",children:[_.jsxs("p",{children:["Click ",_.jsx("b",{children:"Customize"})," and add `fill` property to the dataset. See",_.jsx("a",{className:"text-blue-500 hover:underline mx-1",href:"https://www.chartjs.org/docs/latest/samples/area/line-boundaries.html",target:"_blank",children:"docs"}),"for more options."]}),_.jsx("pre",{children:JSON.stringify(nie,null,2)})]})]})]});if(e==="bubble")return _.jsx(_.Fragment,{children:_.jsxs(fs,{value:"item-1",children:[_.jsx(hs,{className:" font-normal",children:_.jsxs("p",{children:["How to create a ",_.jsx("span",{children:e})," chart query?"]})}),_.jsxs(ps,{className:" ",children:[_.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT label, x-axis, y-axis, radius FROM table"}),_.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[_.jsx("li",{children:"Label - Category (ex. city)"}),_.jsx("li",{children:"Bubble Group (opt) - Category (ex. state)"}),_.jsx("li",{children:"X-axis - Number (ex. avg. age)"}),_.jsx("li",{children:"Y-axis - Number (ex. avg. weight)"}),_.jsx("li",{children:"Radius - Number (ex. population)"})]})]})]})});if(e==="scatter")return _.jsx(_.Fragment,{children:_.jsxs(fs,{value:"item-1",children:[_.jsx(hs,{className:" font-normal",children:_.jsxs("p",{children:["How to create a ",_.jsx("span",{children:e})," chart query?"]})}),_.jsxs(ps,{className:" ",children:[_.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT label, x-axis, y-axis FROM table"}),_.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[_.jsx("li",{children:"Label - Category (ex. city)"}),_.jsx("li",{children:"Group (opt) - Category (ex. state)"}),_.jsx("li",{children:"X-axis - Number (ex. avg. age)"}),_.jsx("li",{children:"Y-axis - Number (ex. avg. weight)"})]})]})]})});if(["pie","doughnut","polarArea"].includes(e))return _.jsx(_.Fragment,{children:_.jsxs(fs,{value:"item-1",children:[_.jsx(hs,{className:" font-normal",children:_.jsxs("p",{children:["How to create a"," ",_.jsxs("span",{children:[e==="polarArea"?"polar":e," "]})," ","chart query?"]})}),_.jsxs(ps,{className:" ",children:[_.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT label, measure FROM table"}),_.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[_.jsx("li",{children:"Label - Category (ex. city)"}),_.jsx("li",{children:"Measure - Number (ex. population)"})]})]})]})})}function oie(){return _.jsxs("div",{className:"px-6 py-2 space-y-6",children:[_.jsx(uA,{className:" ",type:"single",collapsible:!0,children:_.jsxs(fs,{value:"item-1",children:[_.jsx(hs,{className:" font-normal",children:"Stacked chart query?"}),_.jsxs(ps,{className:" ",children:[_.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT x-axis, stack-by, y-axis FROM table"}),_.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[_.jsx("li",{children:"X-axis - Category (ex. country)"}),_.jsx("li",{children:"Stack by - Category (ex. city)"}),_.jsx("li",{children:"Y-axis - Number (ex. population)"})]})]})]})}),_.jsx("section",{className:"",children:_.jsx(xA,{})}),_.jsx("div",{children:_.jsx(wA,{})}),_.jsx("div",{children:_.jsx(_A,{})})]})}function sie(){const e=_e(t=>t.card.type);return _.jsx(kl,{className:" text-sm h-full w-full ",children:e==="stackedBar"?_.jsx(oie,{}):_.jsx(rie,{})})}function aie(){const e=_e(t=>t.isShowingVisual);return _.jsxs(BM,{direction:"vertical",className:"min-w-full max-w-lg min-h-[250px]",children:[_.jsx(Fp,{className:"flex",minSize:40,defaultSize:40,children:_.jsx(Wne,{})}),_.jsx(VM,{className:"border-[1.5px] "}),_.jsx(Fp,{minSize:60,defaultSize:60,children:e?_.jsxs(BM,{direction:"horizontal",children:[_.jsx(_.Fragment,{children:_.jsx(Fp,{className:"flex min-w-[275px]",minSize:20,defaultSize:25,maxSize:30,children:_.jsx(sie,{})})}),_.jsx(VM,{className:"border-[1.5px] "}),_.jsx(Fp,{minSize:40,defaultSize:75,maxSize:100,children:_.jsx(JT,{})})]}):_.jsx(JT,{})})]})}function lie({authToken:e,onSave:t,onClose:n}){_e(s=>s.actions.setCard);const r=_e(s=>s.actions.setOnSave),i=_e(s=>s.actions.setOnClose),o=ge(s=>s.actions.setAuthToken);return m.useEffect(()=>{t&&r(t),n&&i(n)},[t,r,n,i]),m.useEffect(()=>{e&&e.accessToken&&o(e)},[e,o]),_.jsxs(Vk,{className:"rounded-none",children:[_.jsx(Hk,{className:" rounded-none border-r-[3px] ",children:_.jsx(gM,{})}),_.jsx(Wk,{children:_.jsx(aie,{})})]})}function cie(){ge(s=>s.selectedCardId);const e=ge(s=>s.selectedSheetId),t=ge(s=>s.actions.setIsVisualEditing);ge(s=>s.actions.setIsEditorSaveEvent);const n=ge(s=>s.isVisualEditing);ge(s=>s.actions.getSelectedCard());const r=ge(s=>s.actions.updateCard);function i(s){e&&(r(e,s),t(!1))}function o(){t(!1)}return _.jsx("div",{role:"editor-container",className:Pe("grow flex",{block:n,hidden:!n}),children:_.jsx(lie,{onSave:i,onClose:o})})}function uie({columns:e,tableName:t}){const n=_e(f=>f.selectedConnectionId),r=_e(f=>f.selectedDatabaseName),i=_e(f=>f.selectedSchemaName),o=_e(f=>f.selectedTableName),s=ge(f=>f.dashboard.filters)||[],a=ge(f=>f.actions.addFilter),l=ge(f=>f.actions.removeFilter),c=ge(f=>f.actions.removeFilterValue);function d(f){const g=s==null?void 0:s.find(p=>p.column===f.column_name&&p.table===o&&p.database===r);if(g)c(g.id),l(g.id);else{const p=M0(i||"",t),v=`SELECT ${f.column_name}, COUNT(*) FROM ${p} GROUP BY ${f.column_name} ORDER BY ${f.column_name} ASC LIMIT 50`,y=`SELECT min(${f.column_name}) as min, max(${f.column_name}) as max FROM ${p}`;if(t==="api"&&n){a({id:wu(),column:f.column_name,title:f.column_name,dataType:f.data_type,table:"api",database:"NA",connectionId:n,sql:Nu.includes(f.data_type)?y:v});return}if(!n||!r||!o)throw new Error("missing connectionId, database, or table");a({id:wu(),column:f.column_name,title:f.column_name,dataType:f.data_type,table:o,database:r,connectionId:n,sql:Nu.includes(f.data_type)?y:v})}}return _.jsx(kl,{className:" h-[70vh] mt-2 xbg-red-100 px-3",children:e==null?void 0:e.map(f=>{const g=s==null?void 0:s.find(p=>p.column===f.column_name&&p.table===o&&p.database===r);return _.jsx("div",{onClick:()=>d(f),className:Pe(" group flex text-sm items-center justify-between px-3 py-[6px] transition-colors hover:bg-muted/50 cursor-pointer border border-background border-dashed",{"bg-muted ":g}),children:_.jsxs("div",{className:"flex items-center gap-2 ",children:[_.jsx(pM,{column:f}),_.jsx("span",{children:f.column_name})]})},f.column_name)})})}function die(){ge(t=>t.showFilters);const e=ge(t=>t.actions.setShowFilters);return _.jsxs("section",{className:" relative space-y-4 py-0 px-4 ",children:[_.jsx(it,{onClick:()=>e(!1),className:" p-0 h-7 w-7 absolute top-0 right-4",variant:"outline",children:_.jsx(oa,{})}),_.jsx("p",{className:"text-md px-2",children:"Data Columns"}),_.jsx("div",{children:_.jsx(gM,{ColumnsComponent:(t,n,r)=>_.jsx(uie,{schemaName:t,tableName:n,columns:r})})})]})}function fie(){ge(n=>n.dashboard);const e=ge(n=>n.showFilters),t=ge(n=>n.isVisualEditing);return ge(n=>n.bookmarkKey),_.jsxs("div",{role:"dashboard-plus-main",className:Pe(" grow",{hidden:t,flex:!t}),children:[_.jsx(JP,{}),e&&_.jsx("div",{role:"filter-aside-container",children:_.jsx(die,{})})]})}function hie(){const e=ge(r=>r.dashboard),t=ge(r=>r.actions.setDashboard),n=ge(r=>r.showDashboardJSON);return ge(r=>r.actions.setShowDashboardJSON),_.jsx("div",{className:Pe(" p-2",{hidden:!n}),children:_.jsx(rD,{onChange:r=>{if(r)try{JSON.parse(r),t(JSON.parse(r))}catch{}},defaultLanguage:"json",className:"h-[550px] overflow-y-auto ",value:JSON.stringify(e,null,2),options:{minimap:{enabled:!1},glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})})}function pie({showControls:e=!1,showFooter:t=!0,...n}){return ge(r=>r.isVisualEditing),_.jsxs(ZP,{children:[_.jsx(hie,{}),_.jsxs(Kw,{...n,children:[e&&_.jsx(XK,{}),_.jsx(cie,{}),_.jsx(fie,{})]})]})}function gie(){const e=ge(t=>t.actions);return{setDashboardTitle:e.setDashboardTitle,getStyle:e.getStyle,getDashboard:e.getDashboard,setOnSaveFunction:e.setOnSaveFunction,setOnAddCard:e.setOnAddCard,setOnUpateCard:e.setOnUpdateCard,setOnRemoveCard:e.setOnRemoveCard}}st.Dashboard=ek,st.DashboardPlus=pie,st.DashboardWC=YG,st.cleanCard=kk,st.getBookmarkKey=as,st.getDashbaordStateWithoutData=by,st.useActions=gie,st.useDashboardStore=ge,st.useEditorStore=_e,Object.defineProperty(st,Symbol.toStringTag,{value:"Module"})});
505
+ Visual Query Syntax: ${Vne}`,{data:w,isLoading:S,isFetching:C,isError:P,refetch:O}=Cr({queryKey:["ai-query"],queryFn:()=>tl("https://semaphor.cloud/api/v1/ai",(s==null?void 0:s.accessToken)||"",{user_content:`userContent: ${y} ${a?x:""}`}),enabled:!1});function k(K){if(K.toLowerCase().includes("bar"))f("bar");else if(K.toLowerCase().includes("line"))f("line");else if(K.toLowerCase().includes("bubble"))f("bubble");else if(K.toLowerCase().includes("scatter"))f("scatter");else if(K.toLowerCase().includes("stacked"))f("stackedBar");else if(K.toLowerCase().includes("pie"))f("pie");else if(K.toLowerCase().includes("donut")||K.toLowerCase().includes("doughnut"))f("doughnut");else if(K.toLowerCase().includes("radar"))f("radar");else return f("bar"),!1;return!0}function A(){n&&(k(n)&&l(!0),O())}m.useEffect(()=>{i&&(A(),o(!1))},[i,o]);const L={fontFamily:"Arial, sans-serif",lineHeight:1.6,fontSize:15,padding:"5px",width:"100%"},F={fontFamily:"monospace",fontSize:14,lineHeight:1.6},j={fontFamily:"Arial, sans-serif",lineHeight:1.6,fontSize:15,padding:"2px 0",marginLeft:20,listStyleType:"disc"},B={p:({node:K,...Y})=>_.jsx("p",{style:L,...Y}),pre:({node:K,...Y})=>_.jsxs("pre",{className:" bg-muted/50 space-y-2 p-3 rounded-sm",style:F,children:[_.jsx("code",{className:" whitespace-normal",children:Y.children}),_.jsxs("div",{className:" flex justify-start gap-2",children:[_.jsx(it,{onClick:H,size:"sm",variant:"outline",children:_.jsx(ZE,{})}),_.jsx(it,{onClick:$=>{const Z=H($);Z&&(t(!1),c(Z),d(!0))},size:"sm",variant:"outline",children:_.jsx(Zj,{})})]})]}),li:({node:K,...Y})=>_.jsx("li",{style:j,...Y})};function H(K){const Y=K.currentTarget.closest("pre");if(!Y)return;const $=Y.textContent||Y.innerText;return navigator.clipboard.writeText($).then(()=>console.log("Text copied to clipboard")).catch(Z=>console.error("Error in copying text: ",Z)),$}return _.jsxs(wy,{open:e,onOpenChange:t,children:[_.jsx(_y,{asChild:!0,children:_.jsx(it,{size:"sm",className:"",variant:"outline",children:_.jsx(nV,{strokeWidth:1,size:16})})}),_.jsxs(_p,{className:" sm:max-w-[425px] md:min-w-[625px] md:max-h-[625px] flex flex-col justify-between overflow-auto",children:[_.jsxs(Sp,{children:[_.jsx(Cp,{children:"Ask"}),_.jsx(Ep,{children:"Need assistance with SQL queries? Feel free to ask me any question!"})]}),_.jsx(kl,{className:"h-[625px] w-full border-t border-t-muted ",children:(!S||!C)&&_.jsx(zne,{className:" pl-1 pr-3 py-1 w-full xbg-red-100 overflow-auto ",components:B,children:w==null?void 0:w.response})}),_.jsxs("div",{children:[_.jsx(cf,{className:Pe(" invisible h-1 w-full animate-pulse",{visible:S||C})}),_.jsxs("div",{className:" border rounded-md flex items-center w-full",children:[_.jsx(By,{onKeyDown:K=>{K.key==="Enter"&&!K.shiftKey&&(K.preventDefault(),r(""),A())},placeholder:"Type something...",onFocus:K=>{const Y=K.target,$=Y.value.length;Y.setSelectionRange($,$)},className:" border-none resize-none min-h-7 max-h-10 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",value:n,onChange:K=>r(K.target.value)})," ",_.jsx(it,{className:"h-8",size:"sm",variant:"ghost",onClick:A,children:!S&&!C?_.jsx(Qj,{}):_.jsx(Mu,{className:" w-4 h-4 animate-spin mr-2 text-foreground/50"})})]})]})]})]})}function Wne(){const{theme:e}=Em(),t=m.useRef(),n=m.useRef(),[r,i]=m.useState(!1),[o,s]=m.useState(!1),[a,l]=m.useState(""),[c,d]=m.useState(!1);m.useState("");const f=ge(V=>V.authToken),g=_e(V=>V.card),p=ge(V=>V.theme),v=_e(V=>V.selectedConnectionId),y=_e(V=>V.selectedDatabaseName),x=_e(V=>V.selectedSchemaName),w=_e(V=>V.selectedTableName),S=_e(V=>V.actions.setCardSql),C=_e(V=>V.card.sql),P=_e(V=>V.selectedConnectionId),O=_e(V=>V.filterValues),k=_e(V=>V.applyFilters),A=_e(V=>V.actions.setCardCustomCfg),L=_e(V=>V.actions.setFilterValues),F=_e(V=>V.onSave),j=_e(V=>V.actions.setApplyFilters),B=_e(V=>V.onClose),H=_e(V=>V.actions.setCardData),K=_e(V=>V.actions.setSqlGen),Y=_e(V=>V.runSql),$=_e(V=>V.actions.setRunSql),Z=_e(V=>V.actions.setIsSqlRunning),{data:U,isLoading:ie,isFetching:le,isSuccess:M,isError:W,error:ne,status:N,refetch:X}=Cr({queryKey:[C],queryFn:()=>Ns("https://semaphor.cloud/api/v1/query",(f==null?void 0:f.accessToken)||"",{connection_id:P,sql:C,active_filters:k?O:[]}),enabled:!1,retry:!1});m.useEffect(()=>{U&&(console.log("queryData",U),H(U.records))},[U,H]),m.useEffect(()=>{Y&&(X(),$(!1))},[Y,X,$]),m.useEffect(()=>{(ie||le)&&Z(!0),(W||M)&&Z(!1)},[ie,le,W,M,Z]);function me(){S(""),H([]),K({}),A("")}const he=V=>{n.current=V};function fe(){if(C&&!C.includes("{{")){const V=cJ(C);S(V),F==null||F({...g,sql:V,lastSelectedSchema:x,lastSelectedDatabase:y,lastSelectedTable:w,connectionId:v})}else F==null||F(g)}function re(){B==null||B()}function ee(V){const Me=getComputedStyle(document.documentElement).getPropertyValue(V);return oe(Me)}function oe(V){const[Me,$e,He]=V.split(" "),Fe=parseFloat(Me),xt=parseFloat($e),ht=parseFloat(He),pt=xt/100,Bt=ht/100,Ot=(1-Math.abs(2*Bt-1))*pt,tn=Ot*(1-Math.abs(Fe/60%2-1)),nn=Bt-Ot/2;let Fn=0,ue=0,Se=0;0<=Fe&&Fe<60?(Fn=Ot,ue=tn,Se=0):60<=Fe&&Fe<120?(Fn=tn,ue=Ot,Se=0):120<=Fe&&Fe<180?(Fn=0,ue=Ot,Se=tn):180<=Fe&&Fe<240?(Fn=0,ue=tn,Se=Ot):240<=Fe&&Fe<300?(Fn=tn,ue=0,Se=Ot):300<=Fe&&Fe<360&&(Fn=Ot,ue=0,Se=tn),Fn=Math.round((Fn+nn)*255),ue=Math.round((ue+nn)*255),Se=Math.round((Se+nn)*255);const Re=Ye=>{const ot=Ye.toString(16);return ot.length==1?"0"+ot:ot};return`#${Re(Fn)}${Re(ue)}${Re(Se)}`}m.useEffect(()=>{const V=t.current,Me=n.current;if(V){const $e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",He=p==="system"?$e:p;V.editor.defineTheme("default",{base:He==="light"?"vs":"vs-dark",inherit:!0,rules:[],colors:{"editor.background":He==="light"?"#ffffff":ee("--background")}}),V.editor.setTheme("default")}return Me&&V&&Me.addCommand(V.KeyMod.Shift|V.KeyCode.Enter,function(){return console.log("Executing query..."),X(),!1}),()=>{}},[e,p,t.current]);function xe(V){t.current=V}return _.jsxs("section",{role:"editor-section",className:"grow flex flex-col justify-end pt-3 p-1 ",children:[_.jsxs("div",{className:" grow flex relative overflow-y-scroll justify-between ",children:[_.jsx("div",{role:"editor-container",className:`flex ${r?"w-2/3":"w-[95%]"} xbg-red-100 p-1`,children:_.jsx(Ry,{theme:"default",onChange:V=>{S(V),console.log(V)},value:C,options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:14,renderLineHighlight:"none"},defaultLanguage:"sql",defaultValue:"SELECT * FROM table",beforeMount:xe,onMount:he})}),r&&_.jsx("div",{className:" w-1/3 text-xs relative overflow-hidden xbg-yellow-100 p-1 ",children:_.jsxs("div",{className:"min-h-0 ",children:[_.jsxs("div",{className:"flex gap-2 items-center",children:[_.jsx(_J,{checked:k,onCheckedChange:()=>j(!k),text:"Apply Filters"}),_.jsx(SJ,{})]}),_.jsx(Ry,{theme:"default",onChange:V=>{if(V)try{JSON.parse(V),L(JSON.parse(V))}catch{}},defaultLanguage:"json",className:"min-h-[220px] mt-1",value:JSON.stringify(O,null,2),options:{readOnly:!0,minimap:{enabled:!1},lineNumbers:"off",glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})]})}),O&&r&&_.jsx(oa,{onClick:()=>i(!1),className:"absolute right-6 top-1 w-3 h-3 text-foreground/50 hover:text-foreground hover:cursor-pointer"}),O&&!r&&_.jsx(W2,{onClick:()=>i(!0),className:Pe("absolute right-6 top-1 w-3 h-3 text-foreground/50 hover:text-foreground hover:cursor-pointer",{"text-red-800 font-bold":k})})]}),_.jsxs("div",{className:" flex grow px-6 pt-3 pb-4 gap-2 justify-between item-center",children:[_.jsxs("div",{className:"flex grow gap-2 items-center",children:[_.jsxs(it,{disabled:ie||le,onClick:()=>{X()},className:" shrink-0",size:"sm",variant:"outline",children:[(ie||le)&&_.jsx(Mu,{className:"w-4 h-4 mr-2 animate-spin text-foreground/50"}),"Run"]}),W&&_.jsx(wJ,{error:ne.message}),_.jsx(it,{onClick:me,className:"",size:"sm",variant:"outline",children:"Clear"}),_.jsx(Xu,{value:a,placeholder:"Type something...",onChange:V=>{l(V.target.value)},onKeyDown:V=>{V.key==="Enter"&&(V.preventDefault(),console.log("enter pressed"),d(!0),s(!0))},className:" bg-muted border-none h-9 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"}),_.jsx(Hne,{open:o,setOpen:s,userInput:a,triggerAIRun:c,setTriggerAIRun:d,setUserInput:V=>l(V)})]}),_.jsxs("div",{className:"flex gap-2 items-end ",children:[_.jsx(it,{onClick:fe,size:"sm",variant:"outline",children:_.jsx(Rh,{size:16,strokeWidth:2,className:"text-green-600 font-bold"})}),_.jsx(it,{onClick:re,className:" w-full",size:"sm",variant:"outline",children:_.jsx(oa,{})})]})]})]})}const FT="Switch",[qne,Sfe]=kn(FT),[Une,Gne]=qne(FT),Yne=m.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:l="on",onCheckedChange:c,...d}=e,[f,g]=m.useState(null),p=et(t,S=>g(S)),v=m.useRef(!1),y=f?!!f.closest("form"):!0,[x=!1,w]=Jn({prop:i,defaultProp:o,onChange:c});return m.createElement(Une,{scope:n,checked:x,disabled:a},m.createElement(Ve.button,ae({type:"button",role:"switch","aria-checked":x,"aria-required":s,"data-state":jT(x),"data-disabled":a?"":void 0,disabled:a,value:l},d,{ref:p,onClick:Ee(e.onClick,S=>{w(C=>!C),y&&(v.current=S.isPropagationStopped(),v.current||S.stopPropagation())})})),y&&m.createElement(Qne,{control:f,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,style:{transform:"translateX(-100%)"}}))}),Kne="SwitchThumb",Xne=m.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,i=Gne(Kne,n);return m.createElement(Ve.span,ae({"data-state":jT(i.checked),"data-disabled":i.disabled?"":void 0},r,{ref:t}))}),Qne=e=>{const{control:t,checked:n,bubbles:r=!0,...i}=e,o=m.useRef(null),s=Op(n),a=Mh(t);return m.useEffect(()=>{const l=o.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&f){const g=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(g)}},[s,n,r]),m.createElement("input",ae({type:"checkbox","aria-hidden":!0,defaultChecked:n},i,{tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function jT(e){return e?"checked":"unchecked"}const zT=Yne,Jne=Xne,BT=de.forwardRef(({className:e,...t},n)=>_.jsx(zT,{className:Pe("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:_.jsx(Jne,{className:Pe("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));BT.displayName=zT.displayName;function VT({className:e,...t}){const[n,r]=m.useState(0),i=ge(l=>l.themeStyle),o=_e(l=>l.card),s=_e(l=>l.actions.setCard);if(m.useEffect(()=>{r(n+1)},[o.data,o.type,o.cfg,o.customCfg,i]),!o.id)return null;let a;return o.data&&o.data.length>0&&(a=kb({data:o.data,cardType:o.type,cfg:o.cfg,customCfg:o.customCfg})),_.jsxs(Mv,{role:"editor-visual-card",className:Pe(" relative h-full flex flex-col rounded-none",e),...t,children:[_.jsxs(Dv,{children:[_.jsx(qc,{text:o.title,onSave:l=>s({...o,title:l}),children:_.jsx(Tv,{className:"text-base",children:o.title})}),_.jsx(qc,{text:o.description||"",onSave:l=>s({...o,description:l}),children:_.jsxs(Av,{children:[" ",o.description]})})]}),_.jsxs(Iv,{className:"flex flex-col pb-3 grow",children:[o.type!=="table"&&a&&_.jsx(QE,{cfg:a},n),o.type==="table"&&o.data&&o.data.length>0&&_.jsx(uO,{children:_.jsx(a0,{data:o==null?void 0:o.data})})]})]})}function Zne(){const[e,t]=m.useState(!1),[n,r]=m.useState(""),[i,o]=m.useState(""),[s,a]=m.useState(""),l=_e(x=>x.card),c=_e(x=>x.card.customCfg),d=_e(x=>x.actions.setCardCustomCfg);function f(x){var C,P;const w={...x,data:{...x==null?void 0:x.data,datasets:(P=(C=x==null?void 0:x.data)==null?void 0:C.datasets)==null?void 0:P.map(O=>({...O,data:[]}))}};return JSON.stringify(w,null,1)}function g(){if(!l.data||l.data.length===0)return;const x=kb({data:l.data,cardType:l.type,cfg:l.cfg});x&&(r(JSON.stringify(x,null,1)),c&&o(JSON.stringify(c,null,1)))}function p(){if(i)try{const x=JSON.parse(i);return x?(d(x),a(""),o(""),x):void 0}catch(x){console.log(x),a("Invalid JSON")}}function v(){o(""),d(null)}function y(){let x;if(c){const w=Fs.cloneDeep(l.cfg),S=Fs.merge(w,c);return x=f(S),x}return n?(x=f(JSON.parse(n)),x):""}return _.jsxs(wy,{open:e,onOpenChange:t,children:[_.jsx(_y,{asChild:!0,children:_.jsx(it,{onClick:g,className:`h-7 ${c&&"border-foreground/50 dark:border-foreground/70"}`,size:"sm",variant:"outline",children:c?"Custom Config":"Customize"})}),_.jsx(_p,{className:" sm:max-w-[425px] md:min-w-[600px] md:min-h-[700px] lg:min-w-[800px] xl:min-w-[1000px]",children:_.jsxs("div",{className:"bg-red-x100 flex flex-col gap-2 justify-between",children:[_.jsxs(Sp,{className:"",children:[_.jsx(Cp,{children:"Customize Chart"}),_.jsxs(Ep,{children:["See the configuration options and documentation",_.jsx("a",{target:"_blank",className:"ml-1 underline text-blue-500 ",href:"https://www.chartjs.org/docs/latest/samples/bar/vertical.html",children:"here."})]})]}),_.jsxs("div",{className:"grow flex flex-wrap gap-2",children:[_.jsx(VT,{className:"flex-1 rounded shadow-none"}),_.jsxs(a_,{defaultValue:"custom-config",className:" flex flex-col flex-1",children:[_.jsxs(l_,{className:" justify-start border rounded-sm rounded-b-none border-b-0 ",children:[_.jsxs(Im,{value:"custom-config",children:[c&&_.jsx(JE,{className:"w-5 h-5 mr-1 text-green-600"}),c?"Custom Config":"Default Config"]}),_.jsx(Im,{className:"",value:"output",children:"Output"})]}),_.jsx(hf,{className:" grow mt-0 bg-red-x p-2 border border-t-0 rounded-b ",value:"output",children:_.jsx(By,{disabled:!0,value:n,className:" border-none resize-none font-mono h-full focus-visible:ring-0 focus-visible:ring-offset-0"})}),_.jsx(hf,{className:"grow mt-0 border border-t-0 rounded-b ",value:"custom-config",children:_.jsx(Ry,{className:"h-full w-full overflow-hidden",theme:"default",options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:14,renderLineHighlight:"none"},defaultLanguage:"json",value:y(),onChange:x=>o(x)})})]})]}),_.jsxs(Sy,{className:"flex items-center",children:[_.jsx(rs,{className:"text-red-500 mr-2",children:s}),_.jsx(it,{disabled:!c,onClick:v,variant:"outline",children:"Reset"}),_.jsx(it,{onClick:p,variant:"outline",children:"Apply"}),_.jsx(it,{onClick:()=>t(!1),variant:"outline",children:"Close"})]})]})})]})}var HT={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},WT=m.createContext&&m.createContext(HT),ere=["attr","size","title"];function tre(e,t){if(e==null)return{};var n=nre(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function nre(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function tg(){return tg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tg.apply(this,arguments)}function qT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ng(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qT(Object(n),!0).forEach(function(r){rre(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rre(e,t,n){return t=ire(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ire(e){var t=ore(e,"string");return typeof t=="symbol"?t:String(t)}function ore(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function UT(e){return e&&e.map((t,n)=>m.createElement(t.tag,ng({key:n},t.attr),UT(t.child)))}function fd(e){return t=>m.createElement(sre,tg({attr:ng({},e.attr)},t),UT(e.child))}function sre(e){var t=n=>{var{attr:r,size:i,title:o}=e,s=tre(e,ere),a=i||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),m.createElement("svg",tg({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,s,{className:l,style:ng(ng({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),o&&m.createElement("title",null,o),e.children)};return WT!==void 0?m.createElement(WT.Consumer,null,n=>t(n)):t(HT)}function GT(e){return fd({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M926.8 397.1l-396-288a31.81 31.81 0 0 0-37.6 0l-396 288a31.99 31.99 0 0 0-11.6 35.8l151.3 466a32 32 0 0 0 30.4 22.1h489.5c13.9 0 26.1-8.9 30.4-22.1l151.3-466c4.2-13.2-.5-27.6-11.7-35.8zM838.6 417l-98.5 32-200-144.7V199.9L838.6 417zM466 567.2l-89.1 122.3-55.2-169.2L466 567.2zm-116.3-96.8L484 373.3v140.8l-134.3-43.7zM512 599.2l93.9 128.9H418.1L512 599.2zm28.1-225.9l134.2 97.1L540.1 514V373.3zM558 567.2l144.3-46.9-55.2 169.2L558 567.2zm-74-367.3v104.4L283.9 449l-98.5-32L484 199.9zM169.3 470.8l86.5 28.1 80.4 246.4-53.8 73.9-113.1-348.4zM327.1 853l50.3-69h269.3l50.3 69H327.1zm414.5-33.8l-53.8-73.9 80.4-246.4 86.5-28.1-113.1 348.4z"},child:[]}]})(e)}function YT(e){return fd({tag:"svg",attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm87.63,96H191.48A64.1,64.1,0,0,0,136,64.52V40.37A88.13,88.13,0,0,1,215.63,120ZM120,120H80.68A48.09,48.09,0,0,1,120,80.68Zm0,16v39.32A48.09,48.09,0,0,1,80.68,136Zm16,0h39.32A48.09,48.09,0,0,1,136,175.32Zm0-16V80.68A48.09,48.09,0,0,1,175.32,120ZM120,40.37V64.52A64.1,64.1,0,0,0,64.52,120H40.37A88.13,88.13,0,0,1,120,40.37ZM40.37,136H64.52A64.1,64.1,0,0,0,120,191.48v24.15A88.13,88.13,0,0,1,40.37,136ZM136,215.63V191.48A64.1,64.1,0,0,0,191.48,136h24.15A88.13,88.13,0,0,1,136,215.63Z"},child:[]}]})(e)}function KT(e){return fd({tag:"svg",attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M137,28.05a11.94,11.94,0,0,0-9.12,3.08A12.09,12.09,0,0,0,124,40V80.67a11.88,11.88,0,0,0,9.9,11.81,36,36,0,1,1-41.85,37.4c-.47-9.14,1.47-16.8,5.75-22.79h0a11.89,11.89,0,0,0-1.3-15.35L68.87,63.51a12,12,0,0,0-17.74.83A99.6,99.6,0,0,0,57.79,199.2,99.24,99.24,0,0,0,128,228h1.43A100.29,100.29,0,0,0,228,129.42C228.72,77.21,188.76,32.68,137,28.05ZM57.28,69.46A4,4,0,0,1,60.2,68h.19a3.91,3.91,0,0,1,2.79,1.14L90.81,97.36a3.93,3.93,0,0,1,.48,5.08A40.47,40.47,0,0,0,84.08,124h-48A90.36,90.36,0,0,1,57.28,69.46ZM36.09,132H84.18A44,44,0,0,0,124,171.81V219.9A92,92,0,0,1,36.09,132ZM193,193a91.43,91.43,0,0,1-61,26.92V171.82a43.51,43.51,0,0,0,26-11.63,44,44,0,0,0-22.79-75.6A4,4,0,0,1,132,80.67V40a4,4,0,0,1,1.31-3,3.89,3.89,0,0,1,3-1c47.59,4.26,84.34,45.24,83.67,93.29A91.42,91.42,0,0,1,193,193Z"},child:[]}]})(e)}function XT(e){return fd({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},child:[]},{tag:"path",attr:{d:"M6 16m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"},child:[]},{tag:"path",attr:{d:"M16 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},child:[]},{tag:"path",attr:{d:"M14.5 7.5m-4.5 0a4.5 4.5 0 1 0 9 0a4.5 4.5 0 1 0 -9 0"},child:[]}]})(e)}function QT(e){return fd({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M4 9h4v11H4zM4 4h4v4H4zM10 7h4v4h-4zM16 10h4v4h-4zM16 15h4v5h-4zM10 12h4v8h-4z"},child:[]}]})(e)}function are(){const[e,t]=m.useState(!1),n=_e(s=>s.card.type),r=_e(s=>s.actions.setCardType),i=_e(s=>s.actions.setCardCustomCfg);function o(s){r(s),i(null),t(!1)}return _.jsxs(pp,{open:e,onOpenChange:t,children:[_.jsx(gp,{asChild:!0,children:_.jsx(it,{className:"h-7 px-2",variant:"outline",children:_.jsx(lre,{className:"h-4 w-4",chartType:n})})}),_.jsx(qu,{className:"w-50",children:_.jsxs("div",{className:"grid grid-cols-3 place-items-center ",children:[_.jsx(it,{onClick:()=>o("bar"),className:"font-normal",variant:"ghost",children:_.jsx(B2,{strokeWidth:1})}),_.jsx(it,{onClick:()=>o("line"),variant:"ghost",children:_.jsx(q2,{strokeWidth:1})}),_.jsx(it,{onClick:()=>o("stackedBar"),variant:"ghost",children:_.jsx(QT,{className:"h-6 w-6 text-foreground/50 ",strokeWidth:0})}),_.jsx(it,{onClick:()=>o("scatter"),variant:"ghost",children:_.jsx(Y2,{strokeWidth:1})}),_.jsx(it,{onClick:()=>o("bubble"),variant:"ghost",children:_.jsx(XT,{strokeWidth:2})}),_.jsx(it,{onClick:()=>o("pie"),variant:"ghost",children:_.jsx(U2,{strokeWidth:1})}),_.jsx(it,{onClick:()=>o("doughnut"),variant:"ghost",children:_.jsx(KT,{className:"h-7 w-7",strokeWidth:.5})}),_.jsx(it,{onClick:()=>o("radar"),variant:"ghost",children:_.jsx(GT,{className:"h-6 w-6 text-foreground/50 font-extralight",strokeWidth:.5})}),_.jsx(it,{onClick:()=>o("polarArea"),variant:"ghost",children:_.jsx(YT,{className:"h-6 w-6 text-foreground/50",strokeWidth:1})}),_.jsx(it,{onClick:()=>o("table"),variant:"ghost",children:_.jsx(qb,{className:"h-6 w-6 text-foreground/90",strokeWidth:1})})]})})]})}function lre({chartType:e,className:t}){switch(e){case"bar":return _.jsx(B2,{className:t});case"line":return _.jsx(q2,{className:t});case"pie":return _.jsx(U2,{className:t});case"radar":return _.jsx(GT,{className:t});case"scatter":return _.jsx(Y2,{className:t});case"bubble":return _.jsx(XT,{className:t});case"doughnut":return _.jsx(KT,{className:t});case"stackedBar":return _.jsx(QT,{className:"h-5 w-5 text-foreground/50 ",strokeWidth:0});case"polarArea":return _.jsx(YT,{className:t});default:return _.jsx(qb,{className:t})}}function cre(){const e=_e(n=>n.card.refreshInterval),t=_e(n=>n.actions.setCardRefreshInterval);return _.jsxs(pp,{children:[_.jsx(gp,{asChild:!0,children:_.jsx(it,{className:"h-7",variant:"outline",children:"Realtime"})}),_.jsx(qu,{className:"w-[200px]",children:_.jsx("div",{className:"grid gap-4",children:_.jsx("div",{className:"grid gap-2",children:_.jsxs("div",{className:"grid grid-cols-5 items-center gap-1",children:[_.jsx(rs,{className:"col-span-3",htmlFor:"width",children:"Refresh Every"}),_.jsx(Xu,{value:e||"",onChange:n=>t(n.target.value),id:"width",placeholder:"30s",className:"col-span-2 h-7 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-0"})]})})})})]})}function JT(){const e=_e(r=>r.card),t=_e(r=>r.isShowingVisual),n=_e(r=>r.isSqlRunning);return _e(r=>r.onSave),_e(r=>r.onClose),_e(r=>r.actions.setCardSql),_e(r=>r.actions.setCardType),_e(r=>r.actions.setSqlGen),_.jsxs("div",{className:" h-full relative flex flex-col",children:[n&&_.jsx(Mu,{className:" w-10 h-10 z-10 absolute m-auto left-0 right-0 top-0 bottom-0 animate-spin text-foreground/10 "}),_.jsxs("div",{className:" h-10 px-6 pt-6 bg-red-x100 mb-0 z-10 right-0 flex justify-end items-center gap-2",children:[t&&_.jsxs("div",{className:"bg-red-x00 flex grow gap-2",children:[_.jsx(are,{}),_.jsx(Zne,{}),_.jsx(cre,{})]}),_.jsx(ure,{})]}),t?_.jsx(VT,{className:"grow border-none shadow-none "}):_.jsx("div",{className:"w-full mt-4 px-6 bg-red-x00 grow border-none shadow-none overflow-y-auto ",children:e.data&&e.data.length>0&&_.jsx(a0,{data:e.data})})]})}function ure(){const e=_e(n=>n.isShowingVisual),t=_e(n=>n.actions.setIsShowingVisual);return _.jsxs("div",{className:" flex items-center space-x-2",children:[_.jsx(rs,{htmlFor:"visualize",children:"Chart"}),_.jsx(BT,{checked:e,onCheckedChange:()=>t(!e),id:"visualize",className:"data-[state=checked]:bg-foreground/50"})]})}const ZT="Collapsible",[dre,eA]=kn(ZT),[fre,_x]=dre(ZT),hre=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:o,onOpenChange:s,...a}=e,[l=!1,c]=Jn({prop:r,defaultProp:i,onChange:s});return m.createElement(fre,{scope:n,disabled:o,contentId:sr(),open:l,onOpenToggle:m.useCallback(()=>c(d=>!d),[c])},m.createElement(Ve.div,ae({"data-state":Sx(l),"data-disabled":o?"":void 0},a,{ref:t})))}),pre="CollapsibleTrigger",gre=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=_x(pre,n);return m.createElement(Ve.button,ae({type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Sx(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled},r,{ref:t,onClick:Ee(e.onClick,i.onOpenToggle)}))}),tA="CollapsibleContent",mre=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=_x(tA,e.__scopeCollapsible);return m.createElement(bn,{present:n||i.open},({present:o})=>m.createElement(vre,ae({},r,{ref:t,present:o})))}),vre=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:i,...o}=e,s=_x(tA,n),[a,l]=m.useState(r),c=m.useRef(null),d=et(t,c),f=m.useRef(0),g=f.current,p=m.useRef(0),v=p.current,y=s.open||a,x=m.useRef(y),w=m.useRef();return m.useEffect(()=>{const S=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(S)},[]),Hn(()=>{const S=c.current;if(S){w.current=w.current||{transitionDuration:S.style.transitionDuration,animationName:S.style.animationName},S.style.transitionDuration="0s",S.style.animationName="none";const C=S.getBoundingClientRect();f.current=C.height,p.current=C.width,x.current||(S.style.transitionDuration=w.current.transitionDuration,S.style.animationName=w.current.animationName),l(r)}},[s.open,r]),m.createElement(Ve.div,ae({"data-state":Sx(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!y},o,{ref:d,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...e.style}}),y&&i)});function Sx(e){return e?"open":"closed"}const bre=hre,yre=gre,xre=mre,ds="Accordion",wre=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Cx,_re,Sre]=df(ds),[rg,Cfe]=kn(ds,[Sre,eA]),Ex=eA(),nA=m.forwardRef((e,t)=>{const{type:n,...r}=e,i=r,o=r;return m.createElement(Cx.Provider,{scope:e.__scopeAccordion},n==="multiple"?m.createElement(Pre,ae({},o,{ref:t})):m.createElement(Ore,ae({},i,{ref:t})))});nA.propTypes={type(e){const t=e.value||e.defaultValue;return e.type&&!["single","multiple"].includes(e.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):e.type==="multiple"&&typeof t=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):e.type==="single"&&Array.isArray(t)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[rA,Cre]=rg(ds),[iA,Ere]=rg(ds,{collapsible:!1}),Ore=m.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:o=!1,...s}=e,[a,l]=Jn({prop:n,defaultProp:r,onChange:i});return m.createElement(rA,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:l,onItemClose:m.useCallback(()=>o&&l(""),[o,l])},m.createElement(iA,{scope:e.__scopeAccordion,collapsible:o},m.createElement(oA,ae({},s,{ref:t}))))}),Pre=m.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...o}=e,[s=[],a]=Jn({prop:n,defaultProp:r,onChange:i}),l=m.useCallback(d=>a((f=[])=>[...f,d]),[a]),c=m.useCallback(d=>a((f=[])=>f.filter(g=>g!==d)),[a]);return m.createElement(rA,{scope:e.__scopeAccordion,value:s,onItemOpen:l,onItemClose:c},m.createElement(iA,{scope:e.__scopeAccordion,collapsible:!0},m.createElement(oA,ae({},o,{ref:t}))))}),[kre,ig]=rg(ds),oA=m.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:i,orientation:o="vertical",...s}=e,a=m.useRef(null),l=et(a,t),c=_re(n),f=js(i)==="ltr",g=Ee(e.onKeyDown,p=>{var v;if(!wre.includes(p.key))return;const y=p.target,x=c().filter(F=>{var j;return!((j=F.ref.current)!==null&&j!==void 0&&j.disabled)}),w=x.findIndex(F=>F.ref.current===y),S=x.length;if(w===-1)return;p.preventDefault();let C=w;const P=0,O=S-1,k=()=>{C=w+1,C>O&&(C=P)},A=()=>{C=w-1,C<P&&(C=O)};switch(p.key){case"Home":C=P;break;case"End":C=O;break;case"ArrowRight":o==="horizontal"&&(f?k():A());break;case"ArrowDown":o==="vertical"&&k();break;case"ArrowLeft":o==="horizontal"&&(f?A():k());break;case"ArrowUp":o==="vertical"&&A();break}const L=C%S;(v=x[L].ref.current)===null||v===void 0||v.focus()});return m.createElement(kre,{scope:n,disabled:r,direction:i,orientation:o},m.createElement(Cx.Slot,{scope:n},m.createElement(Ve.div,ae({},s,{"data-orientation":o,ref:l,onKeyDown:r?void 0:g}))))}),Ox="AccordionItem",[Mre,Px]=rg(Ox),Dre=m.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...i}=e,o=ig(Ox,n),s=Cre(Ox,n),a=Ex(n),l=sr(),c=r&&s.value.includes(r)||!1,d=o.disabled||e.disabled;return m.createElement(Mre,{scope:n,open:c,disabled:d,triggerId:l},m.createElement(bre,ae({"data-orientation":o.orientation,"data-state":aA(c)},a,i,{ref:t,disabled:d,open:c,onOpenChange:f=>{f?s.onItemOpen(r):s.onItemClose(r)}})))}),Tre="AccordionHeader",Are=m.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=ig(ds,n),o=Px(Tre,n);return m.createElement(Ve.h3,ae({"data-orientation":i.orientation,"data-state":aA(o.open),"data-disabled":o.disabled?"":void 0},r,{ref:t}))}),sA="AccordionTrigger",Ire=m.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=ig(ds,n),o=Px(sA,n),s=Ere(sA,n),a=Ex(n);return m.createElement(Cx.ItemSlot,{scope:n},m.createElement(yre,ae({"aria-disabled":o.open&&!s.collapsible||void 0,"data-orientation":i.orientation,id:o.triggerId},a,r,{ref:t})))}),Nre="AccordionContent",Rre=m.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=ig(ds,n),o=Px(Nre,n),s=Ex(n);return m.createElement(xre,ae({role:"region","aria-labelledby":o.triggerId,"data-orientation":i.orientation},s,r,{ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}}))});function aA(e){return e?"open":"closed"}const Lre=nA,$re=Dre,Fre=Are,lA=Ire,cA=Rre,uA=Lre,fs=de.forwardRef(({className:e,...t},n)=>_.jsx($re,{ref:n,className:Pe("border-b",e),...t}));fs.displayName="AccordionItem";const hs=de.forwardRef(({className:e,children:t,...n},r)=>_.jsx(Fre,{className:"flex",children:_.jsxs(lA,{ref:r,className:Pe("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,_.jsx(Wb,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));hs.displayName=lA.displayName;const ps=de.forwardRef(({className:e,children:t,...n},r)=>_.jsx(cA,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:_.jsx("div",{className:Pe("pb-4 pt-0",e),children:t})}));ps.displayName=cA.displayName;const dA="Radio",[jre,fA]=kn(dA),[zre,Bre]=jre(dA),Vre=m.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:i=!1,required:o,disabled:s,value:a="on",onCheck:l,...c}=e,[d,f]=m.useState(null),g=et(t,y=>f(y)),p=m.useRef(!1),v=d?!!d.closest("form"):!0;return m.createElement(zre,{scope:n,checked:i,disabled:s},m.createElement(Ve.button,ae({type:"button",role:"radio","aria-checked":i,"data-state":hA(i),"data-disabled":s?"":void 0,disabled:s,value:a},c,{ref:g,onClick:Ee(e.onClick,y=>{i||l==null||l(),v&&(p.current=y.isPropagationStopped(),p.current||y.stopPropagation())})})),v&&m.createElement(qre,{control:d,bubbles:!p.current,name:r,value:a,checked:i,required:o,disabled:s,style:{transform:"translateX(-100%)"}}))}),Hre="RadioIndicator",Wre=m.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...i}=e,o=Bre(Hre,n);return m.createElement(bn,{present:r||o.checked},m.createElement(Ve.span,ae({"data-state":hA(o.checked),"data-disabled":o.disabled?"":void 0},i,{ref:t})))}),qre=e=>{const{control:t,checked:n,bubbles:r=!0,...i}=e,o=m.useRef(null),s=Op(n),a=Mh(t);return m.useEffect(()=>{const l=o.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&f){const g=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(g)}},[s,n,r]),m.createElement("input",ae({type:"radio","aria-hidden":!0,defaultChecked:n},i,{tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function hA(e){return e?"checked":"unchecked"}const Ure=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],pA="RadioGroup",[Gre,Efe]=kn(pA,[ol,fA]),gA=ol(),mA=fA(),[Yre,Kre]=Gre(pA),Xre=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:i,value:o,required:s=!1,disabled:a=!1,orientation:l,dir:c,loop:d=!0,onValueChange:f,...g}=e,p=gA(n),v=js(c),[y,x]=Jn({prop:o,defaultProp:i,onChange:f});return m.createElement(Yre,{scope:n,name:r,required:s,disabled:a,value:y,onValueChange:x},m.createElement(Dm,ae({asChild:!0},p,{orientation:l,dir:v,loop:d}),m.createElement(Ve.div,ae({role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":a?"":void 0,dir:v},g,{ref:t}))))}),Qre="RadioGroupItem",Jre=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...i}=e,o=Kre(Qre,n),s=o.disabled||r,a=gA(n),l=mA(n),c=m.useRef(null),d=et(t,c),f=o.value===i.value,g=m.useRef(!1);return m.useEffect(()=>{const p=y=>{Ure.includes(y.key)&&(g.current=!0)},v=()=>g.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",v),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",v)}},[]),m.createElement(Tm,ae({asChild:!0},a,{focusable:!s,active:f}),m.createElement(Vre,ae({disabled:s,required:o.required,checked:f},l,i,{name:o.name,ref:d,onCheck:()=>o.onValueChange(i.value),onKeyDown:Ee(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:Ee(i.onFocus,()=>{var p;g.current&&((p=c.current)===null||p===void 0||p.click())})})))}),Zre=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,i=mA(n);return m.createElement(Wre,ae({},i,r,{ref:t}))}),vA=Xre,bA=Jre,eie=Zre,yA=de.forwardRef(({className:e,...t},n)=>_.jsx(vA,{className:Pe("grid gap-2",e),...t,ref:n}));yA.displayName=vA.displayName;const kx=de.forwardRef(({className:e,...t},n)=>_.jsx(bA,{ref:n,className:Pe("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:_.jsx(eie,{className:"flex items-center justify-center",children:_.jsx(H2,{className:"h-2.5 w-2.5 fill-current text-current"})})}));kx.displayName=bA.displayName;function xA(){var i;const e=_e(o=>o.card.cfg),t=_e(o=>o.actions.setCardCfg),n=(i=e==null?void 0:e.options)==null?void 0:i.indexAxis;function r(o){const s={...e,options:{...e==null?void 0:e.options,indexAxis:o}};t(s)}return _.jsxs("div",{children:[_.jsx("p",{className:"font-semibold",children:"Orientation"}),_.jsxs(yA,{value:n,onValueChange:r,className:"flex gap-3 mt-2 ",defaultValue:"x",children:[_.jsxs("div",{className:"flex items-center space-x-2",children:[_.jsx(kx,{value:"x",id:"r1"}),_.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Vertical"})]}),_.jsxs("div",{className:"flex items-center space-x-2",children:[_.jsx(kx,{value:"y",id:"r2"}),_.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Horizontal"})]})]})]})}function wA(){var r,i,o;const e=_e(s=>s.card.cfg),t=_e(s=>s.actions.setCardCfg);function n(s){var c;const a={datalabels:{display:s!=="none",align:s,anchor:s,clamp:!0}},l={...e,options:{...e==null?void 0:e.options,plugins:{...(c=e==null?void 0:e.options)==null?void 0:c.plugins,...a}}};t(l),console.log(s)}return _.jsxs(_.Fragment,{children:[_.jsx("label",{className:"font-medium",children:"Data Labels"}),_.jsxs(cM,{value:(o=(i=(r=e==null?void 0:e.options)==null?void 0:r.plugins)==null?void 0:i.datalabels)==null?void 0:o.anchor,onValueChange:n,defaultValue:"none",children:[_.jsx(Py,{className:"w-[180px] mt-2 focus:ring-1 focus:ring-offset-0 h-7",children:_.jsx(dM,{placeholder:"Select position"})}),_.jsx(ky,{children:_.jsxs(uM,{children:[_.jsx(Ap,{children:"Data Labels"}),_.jsx(Sa,{value:"none",children:"None"}),_.jsx(Sa,{value:"start",children:"Start"}),_.jsx(Sa,{value:"center",children:"Center"}),_.jsx(Sa,{value:"end",children:"End"})]})})]})]})}function _A(){const e=_e(i=>i.card.preferences),t=_e(i=>i.actions.setCardPreferences),n=_e(i=>{var o;return(o=i.card.preferences)==null?void 0:o.filterOnClickField}),r=_e(i=>i.actions.setFilterOnClickField);return _.jsxs("div",{children:[_.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[_.jsx(Pp,{checked:!!(e!=null&&e.filterOnClick),onCheckedChange:i=>{t({...e,filterOnClick:!!i})}}),_.jsx(rs,{children:"Filter on click"})]}),(e==null?void 0:e.filterOnClick)===!0&&_.jsxs("div",{className:"flex gap-2 items-center",children:[_.jsx(Xu,{value:n||"",className:" h-7 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",placeholder:"expression (optional)",onChange:i=>r(i.target.value)}),_.jsxs(Vb,{children:[_.jsx(L2,{children:_.jsx(e2,{className:"h-4 w-4 opacity-70"})}),_.jsx(Ih,{children:_.jsxs("div",{className:"max-w-[200px]",children:["The x-axis expression of your query. Example:",_.jsx("div",{className:" mt-1 text-xs font-mono",children:"TO_CHAR(order_date, 'YYYY-MM')"})]})})]})]})]})}const tie={datasets:[{type:"line",label:"Sum_sales",data:[]},{type:"bar",label:"Sum_profit",data:[]}]},nie={datasets:[{fill:"origin",type:"line",label:"Sum_sales",data:[]}]};function rie(){const e=_e(t=>t.card.type);return _.jsxs("div",{className:"p-6 space-y-6",children:[_.jsx(uA,{className:" ",type:"single",collapsible:!0,children:iie(e)}),_.jsx("section",{className:"",children:["line","bar"].includes(e)&&_.jsx(xA,{})}),_.jsx("div",{children:_.jsx(wA,{})}),_.jsx("div",{children:_.jsx(_A,{})})]})}function iie(e){if(["line","bar"].includes(e))return _.jsxs(_.Fragment,{children:[_.jsxs(fs,{value:"item-1",children:[_.jsx(hs,{className:" font-normal",children:_.jsx("p",{children:"Chart Query"})}),_.jsxs(ps,{className:" ",children:[_.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT x-axis, y-axis-1, y-axis-2, y-axis-3,... FROM table"}),_.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[_.jsx("li",{children:"X-axis - Category (ex. city)"}),_.jsx("li",{children:"Y-axis - Number (ex. population)"})]})]})]}),_.jsxs(fs,{value:"item-2",children:[_.jsx(hs,{className:" font-normal",children:"Mixed Chart"}),_.jsxs(ps,{className:" text-xs space-y-2",children:[_.jsxs("p",{children:["Click ",_.jsx("b",{children:"Customize"})," and change the `type` property in the dataset."]}),_.jsx("pre",{children:JSON.stringify(tie,null,2)})]})]}),_.jsxs(fs,{value:"item-3",children:[_.jsx(hs,{className:" font-normal",children:"Area Chart"}),_.jsxs(ps,{className:" text-xs space-y-2",children:[_.jsxs("p",{children:["Click ",_.jsx("b",{children:"Customize"})," and add `fill` property to the dataset. See",_.jsx("a",{className:"text-blue-500 hover:underline mx-1",href:"https://www.chartjs.org/docs/latest/samples/area/line-boundaries.html",target:"_blank",children:"docs"}),"for more options."]}),_.jsx("pre",{children:JSON.stringify(nie,null,2)})]})]})]});if(e==="bubble")return _.jsx(_.Fragment,{children:_.jsxs(fs,{value:"item-1",children:[_.jsx(hs,{className:" font-normal",children:_.jsxs("p",{children:["How to create a ",_.jsx("span",{children:e})," chart query?"]})}),_.jsxs(ps,{className:" ",children:[_.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT label, x-axis, y-axis, radius FROM table"}),_.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[_.jsx("li",{children:"Label - Category (ex. city)"}),_.jsx("li",{children:"Bubble Group (opt) - Category (ex. state)"}),_.jsx("li",{children:"X-axis - Number (ex. avg. age)"}),_.jsx("li",{children:"Y-axis - Number (ex. avg. weight)"}),_.jsx("li",{children:"Radius - Number (ex. population)"})]})]})]})});if(e==="scatter")return _.jsx(_.Fragment,{children:_.jsxs(fs,{value:"item-1",children:[_.jsx(hs,{className:" font-normal",children:_.jsxs("p",{children:["How to create a ",_.jsx("span",{children:e})," chart query?"]})}),_.jsxs(ps,{className:" ",children:[_.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT label, x-axis, y-axis FROM table"}),_.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[_.jsx("li",{children:"Label - Category (ex. city)"}),_.jsx("li",{children:"Group (opt) - Category (ex. state)"}),_.jsx("li",{children:"X-axis - Number (ex. avg. age)"}),_.jsx("li",{children:"Y-axis - Number (ex. avg. weight)"})]})]})]})});if(["pie","doughnut","polarArea"].includes(e))return _.jsx(_.Fragment,{children:_.jsxs(fs,{value:"item-1",children:[_.jsx(hs,{className:" font-normal",children:_.jsxs("p",{children:["How to create a"," ",_.jsxs("span",{children:[e==="polarArea"?"polar":e," "]})," ","chart query?"]})}),_.jsxs(ps,{className:" ",children:[_.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT label, measure FROM table"}),_.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[_.jsx("li",{children:"Label - Category (ex. city)"}),_.jsx("li",{children:"Measure - Number (ex. population)"})]})]})]})})}function oie(){return _.jsxs("div",{className:"px-6 py-2 space-y-6",children:[_.jsx(uA,{className:" ",type:"single",collapsible:!0,children:_.jsxs(fs,{value:"item-1",children:[_.jsx(hs,{className:" font-normal",children:"Stacked chart query?"}),_.jsxs(ps,{className:" ",children:[_.jsx("div",{className:"bg-muted px-2 py-1 rounded font-mono font-semibold text-xs",children:"SELECT x-axis, stack-by, y-axis FROM table"}),_.jsxs("ul",{className:"my-6 ml-6 list-disc [&>li]:mt-2 font-normal text-xs",children:[_.jsx("li",{children:"X-axis - Category (ex. country)"}),_.jsx("li",{children:"Stack by - Category (ex. city)"}),_.jsx("li",{children:"Y-axis - Number (ex. population)"})]})]})]})}),_.jsx("section",{className:"",children:_.jsx(xA,{})}),_.jsx("div",{children:_.jsx(wA,{})}),_.jsx("div",{children:_.jsx(_A,{})})]})}function sie(){const e=_e(t=>t.card.type);return _.jsx(kl,{className:" text-sm h-full w-full ",children:e==="stackedBar"?_.jsx(oie,{}):_.jsx(rie,{})})}function aie(){const e=_e(t=>t.isShowingVisual);return _.jsxs(BM,{direction:"vertical",className:"min-w-full max-w-lg min-h-[250px]",children:[_.jsx(Fp,{className:"flex",minSize:40,defaultSize:40,children:_.jsx(Wne,{})}),_.jsx(VM,{className:"border-[1.5px] "}),_.jsx(Fp,{minSize:60,defaultSize:60,children:e?_.jsxs(BM,{direction:"horizontal",children:[_.jsx(_.Fragment,{children:_.jsx(Fp,{className:"flex min-w-[275px]",minSize:20,defaultSize:25,maxSize:30,children:_.jsx(sie,{})})}),_.jsx(VM,{className:"border-[1.5px] "}),_.jsx(Fp,{minSize:40,defaultSize:75,maxSize:100,children:_.jsx(JT,{})})]}):_.jsx(JT,{})})]})}function lie({authToken:e,onSave:t,onClose:n}){_e(s=>s.actions.setCard);const r=_e(s=>s.actions.setOnSave),i=_e(s=>s.actions.setOnClose),o=ge(s=>s.actions.setAuthToken);return m.useEffect(()=>{t&&r(t),n&&i(n)},[t,r,n,i]),m.useEffect(()=>{e&&e.accessToken&&o(e)},[e,o]),_.jsxs(Vk,{className:"rounded-none",children:[_.jsx(Hk,{className:" rounded-none border-r-[3px] ",children:_.jsx(gM,{})}),_.jsx(Wk,{children:_.jsx(aie,{})})]})}function cie(){ge(s=>s.selectedCardId);const e=ge(s=>s.selectedSheetId),t=ge(s=>s.actions.setIsVisualEditing);ge(s=>s.actions.setIsEditorSaveEvent);const n=ge(s=>s.isVisualEditing);ge(s=>s.actions.getSelectedCard());const r=ge(s=>s.actions.updateCard);function i(s){e&&(r(e,s),t(!1))}function o(){t(!1)}return _.jsx("div",{role:"editor-container",className:Pe("grow flex",{block:n,hidden:!n}),children:_.jsx(lie,{onSave:i,onClose:o})})}function uie({columns:e,tableName:t}){const n=_e(f=>f.selectedConnectionId),r=_e(f=>f.selectedDatabaseName),i=_e(f=>f.selectedSchemaName),o=_e(f=>f.selectedTableName),s=ge(f=>f.dashboard.filters)||[],a=ge(f=>f.actions.addFilter),l=ge(f=>f.actions.removeFilter),c=ge(f=>f.actions.removeFilterValue);function d(f){const g=s==null?void 0:s.find(p=>p.column===f.column_name&&p.table===o&&p.database===r);if(g)c(g.id),l(g.id);else{const p=M0(i||"",t),v=`SELECT ${f.column_name}, COUNT(*) FROM ${p} GROUP BY ${f.column_name} ORDER BY ${f.column_name} ASC LIMIT 50`,y=`SELECT min(${f.column_name}) as min, max(${f.column_name}) as max FROM ${p}`;if(t==="api"&&n){a({id:wu(),column:f.column_name,title:f.column_name,dataType:f.data_type,table:"api",database:"NA",connectionId:n,sql:Nu.includes(f.data_type)?y:v});return}if(!n||!r||!o)throw new Error("missing connectionId, database, or table");a({id:wu(),column:f.column_name,title:f.column_name,dataType:f.data_type,table:o,database:r,connectionId:n,sql:Nu.includes(f.data_type)?y:v})}}return _.jsx(kl,{className:" h-[70vh] mt-2 xbg-red-100 px-3",children:e==null?void 0:e.map(f=>{const g=s==null?void 0:s.find(p=>p.column===f.column_name&&p.table===o&&p.database===r);return _.jsx("div",{onClick:()=>d(f),className:Pe(" group flex text-sm items-center justify-between px-3 py-[6px] transition-colors hover:bg-muted/50 cursor-pointer border border-background border-dashed",{"bg-muted ":g}),children:_.jsxs("div",{className:"flex items-center gap-2 ",children:[_.jsx(pM,{column:f}),_.jsx("span",{children:f.column_name})]})},f.column_name)})})}function die(){ge(t=>t.showFilters);const e=ge(t=>t.actions.setShowFilters);return _.jsxs("section",{className:" relative space-y-4 py-0 px-4 ",children:[_.jsx(it,{onClick:()=>e(!1),className:" p-0 h-7 w-7 absolute top-0 right-4",variant:"outline",children:_.jsx(oa,{})}),_.jsx("p",{className:"text-md px-2",children:"Data Columns"}),_.jsx("div",{children:_.jsx(gM,{ColumnsComponent:(t,n,r)=>_.jsx(uie,{schemaName:t,tableName:n,columns:r})})})]})}function fie(){ge(n=>n.dashboard);const e=ge(n=>n.showFilters),t=ge(n=>n.isVisualEditing);return ge(n=>n.bookmarkKey),_.jsxs("div",{role:"dashboard-plus-main",className:Pe(" grow",{hidden:t,flex:!t}),children:[_.jsx(JP,{}),e&&_.jsx("div",{role:"filter-aside-container",children:_.jsx(die,{})})]})}function hie(){const e=ge(r=>r.dashboard),t=ge(r=>r.actions.setDashboard),n=ge(r=>r.showDashboardJSON);return ge(r=>r.actions.setShowDashboardJSON),_.jsx("div",{className:Pe(" p-2",{hidden:!n}),children:_.jsx(rD,{onChange:r=>{if(r)try{JSON.parse(r),t(JSON.parse(r))}catch{}},defaultLanguage:"json",className:"h-[550px] overflow-y-auto ",value:JSON.stringify(e,null,2),options:{minimap:{enabled:!1},glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})})}function pie({showControls:e=!1,showFooter:t=!0,...n}){return ge(r=>r.isVisualEditing),_.jsxs(ZP,{children:[_.jsx(hie,{}),_.jsxs(Kw,{...n,children:[e&&_.jsx(XK,{}),_.jsx(cie,{}),_.jsx(fie,{})]})]})}function gie(){const e=ge(t=>t.actions);return{setDashboardTitle:e.setDashboardTitle,getStyle:e.getStyle,getDashboard:e.getDashboard,setOnSaveFunction:e.setOnSaveFunction,setOnAddCard:e.setOnAddCard,setOnUpateCard:e.setOnUpdateCard,setOnRemoveCard:e.setOnRemoveCard}}st.Dashboard=ek,st.DashboardPlus=pie,st.DashboardWC=YG,st.cleanCard=kk,st.getBookmarkKey=as,st.getDashbaordStateWithoutData=by,st.useActions=gie,st.useDashboardStore=ge,st.useEditorStore=_e,Object.defineProperty(st,Symbol.toStringTag,{value:"Module"})});