react-semaphor 0.0.204 → 0.0.206
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.
- package/dist/chunks/{dashboard-plus-jsYN4XbU.js → dashboard-plus-wP98d1VM.js} +2 -2
- package/dist/chunks/dashboard-plus-z6ljHA5H.js +210 -0
- package/dist/chunks/{index-wSiLyrBE.js → index-FKRPJKTT.js} +4 -4
- package/dist/chunks/{index-S7oXWfBC.js → index-tjnD7EOn.js} +13 -13
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/dashboard-plus-BVLDgaVC.js +0 -210
|
@@ -85,7 +85,7 @@ __p += '`),Mt&&(Re+=`' +
|
|
|
85
85
|
function print() { __p += __j.call(arguments, '') }
|
|
86
86
|
`:`;
|
|
87
87
|
`)+Re+`return __p
|
|
88
|
-
}`;var yt=kE(function(){return jt(j,Ye+"return "+Re).apply(n,U)});if(yt.source=Re,ub(yt))throw yt;return yt}function _8(d){return Ut(d).toLowerCase()}function S8(d){return Ut(d).toUpperCase()}function C8(d,p,y){if(d=Ut(d),d&&(y||p===n))return VS(d);if(!d||!(p=Vr(p)))return d;var E=jo(d),M=jo(p),j=HS(E,M),U=WS(E,M)+1;return Os(E,j,U).join("")}function E8(d,p,y){if(d=Ut(d),d&&(y||p===n))return d.slice(0,qS(d)+1);if(!d||!(p=Vr(p)))return d;var E=jo(d),M=WS(E,jo(p))+1;return Os(E,0,M).join("")}function R8(d,p,y){if(d=Ut(d),d&&(y||p===n))return d.replace(jn,"");if(!d||!(p=Vr(p)))return d;var E=jo(d),M=HS(E,jo(p));return Os(E,M).join("")}function O8(d,p){var y=I,E=F;if(wn(p)){var M="separator"in p?p.separator:M;y="length"in p?pt(p.length):y,E="omission"in p?Vr(p.omission):E}d=Ut(d);var j=d.length;if(Nl(d)){var U=jo(d);j=U.length}if(y>=j)return d;var X=y-Ll(E);if(X<1)return E;var se=U?Os(U,0,X).join(""):d.slice(0,X);if(M===n)return se+E;if(U&&(X+=se.length-X),db(M)){if(d.slice(X).search(M)){var xe,we=se;for(M.global||(M=Ov(M.source,Ut(qe.exec(M))+"g")),M.lastIndex=0;xe=M.exec(we);)var Re=xe.index;se=se.slice(0,Re===n?X:Re)}}else if(d.indexOf(Vr(M),X)!=X){var je=se.lastIndexOf(M);je>-1&&(se=se.slice(0,je))}return se+E}function P8(d){return d=Ut(d),d&&Rn.test(d)?d.replace(Xt,rF):d}var T8=Wl(function(d,p,y){return d+(y?" ":"")+p.toUpperCase()}),pb=MC("toUpperCase");function AE(d,p,y){return d=Ut(d),p=y?n:p,p===n?J3(d)?sF(d):H3(d):d.match(p)||[]}var kE=St(function(d,p){try{return zr(d,n,p)}catch(y){return ub(y)?y:new ct(y)}}),D8=Fi(function(d,p){return mo(p,function(y){y=ai(y),Ni(d,y,lb(d[y],d))}),d});function $8(d){var p=d==null?0:d.length,y=Je();return d=p?yn(d,function(E){if(typeof E[1]!="function")throw new vo(s);return[y(E[0]),E[1]]}):[],St(function(E){for(var M=-1;++M<p;){var j=d[M];if(zr(j[0],this,E))return zr(j[1],this,E)}})}function A8(d){return r7(yo(d,f))}function gb(d){return function(){return d}}function k8(d,p){return d==null||d!==d?p:d}var M8=NC(),I8=NC(!0);function Er(d){return d}function mb(d){return fC(typeof d=="function"?d:yo(d,f))}function N8(d){return pC(yo(d,f))}function L8(d,p){return gC(d,yo(p,f))}var F8=St(function(d,p){return function(y){return _u(y,d,p)}}),j8=St(function(d,p){return function(y){return _u(d,y,p)}});function vb(d,p,y){var E=Bn(p),M=wh(p,E);y==null&&!(wn(p)&&(M.length||!E.length))&&(y=p,p=d,d=this,M=wh(p,Bn(p)));var j=!(wn(y)&&"chain"in y)||!!y.chain,U=zi(d);return mo(M,function(X){var se=p[X];d[X]=se,U&&(d.prototype[X]=function(){var xe=this.__chain__;if(j||xe){var we=d(this.__wrapped__),Re=we.__actions__=_r(this.__actions__);return Re.push({func:se,args:arguments,thisArg:d}),we.__chain__=xe,we}return se.apply(d,ws([this.value()],arguments))})}),d}function z8(){return qn._===this&&(qn._=fF),this}function bb(){}function B8(d){return d=pt(d),St(function(p){return mC(p,d)})}var V8=Kv(yn),H8=Kv(LS),W8=Kv(xv);function ME(d){return nb(d)?wv(ai(d)):x7(d)}function U8(d){return function(p){return d==null?n:Ea(d,p)}}var q8=FC(),G8=FC(!0);function yb(){return[]}function xb(){return!1}function Y8(){return{}}function K8(){return""}function X8(){return!0}function Q8(d,p){if(d=pt(d),d<1||d>Y)return[];var y=H,E=nr(d,H);p=Je(p),d-=H;for(var M=Cv(E,p);++y<d;)p(y);return M}function J8(d){return ut(d)?yn(d,ai):Hr(d)?[d]:_r(eE(Ut(d)))}function Z8(d){var p=++uF;return Ut(d)+p}var ej=Oh(function(d,p){return d+p},0),tj=Xv("ceil"),nj=Oh(function(d,p){return d/p},1),rj=Xv("floor");function oj(d){return d&&d.length?xh(d,Er,Iv):n}function ij(d,p){return d&&d.length?xh(d,Je(p,2),Iv):n}function sj(d){return zS(d,Er)}function aj(d,p){return zS(d,Je(p,2))}function lj(d){return d&&d.length?xh(d,Er,jv):n}function cj(d,p){return d&&d.length?xh(d,Je(p,2),jv):n}var uj=Oh(function(d,p){return d*p},1),dj=Xv("round"),fj=Oh(function(d,p){return d-p},0);function hj(d){return d&&d.length?Sv(d,Er):0}function pj(d,p){return d&&d.length?Sv(d,Je(p,2)):0}return L.after=N9,L.ary=dE,L.assign=S4,L.assignIn=EE,L.assignInWith=zh,L.assignWith=C4,L.at=E4,L.before=fE,L.bind=lb,L.bindAll=D8,L.bindKey=hE,L.castArray=Y9,L.chain=lE,L.chunk=r6,L.compact=o6,L.concat=i6,L.cond=$8,L.conforms=A8,L.constant=gb,L.countBy=h9,L.create=R4,L.curry=pE,L.curryRight=gE,L.debounce=mE,L.defaults=O4,L.defaultsDeep=P4,L.defer=L9,L.delay=F9,L.difference=s6,L.differenceBy=a6,L.differenceWith=l6,L.drop=c6,L.dropRight=u6,L.dropRightWhile=d6,L.dropWhile=f6,L.fill=h6,L.filter=g9,L.flatMap=b9,L.flatMapDeep=y9,L.flatMapDepth=x9,L.flatten=oE,L.flattenDeep=p6,L.flattenDepth=g6,L.flip=j9,L.flow=M8,L.flowRight=I8,L.fromPairs=m6,L.functions=I4,L.functionsIn=N4,L.groupBy=w9,L.initial=b6,L.intersection=y6,L.intersectionBy=x6,L.intersectionWith=w6,L.invert=F4,L.invertBy=j4,L.invokeMap=S9,L.iteratee=mb,L.keyBy=C9,L.keys=Bn,L.keysIn=Cr,L.map=Mh,L.mapKeys=B4,L.mapValues=V4,L.matches=N8,L.matchesProperty=L8,L.memoize=Nh,L.merge=H4,L.mergeWith=RE,L.method=F8,L.methodOf=j8,L.mixin=vb,L.negate=Lh,L.nthArg=B8,L.omit=W4,L.omitBy=U4,L.once=z9,L.orderBy=E9,L.over=V8,L.overArgs=B9,L.overEvery=H8,L.overSome=W8,L.partial=cb,L.partialRight=vE,L.partition=R9,L.pick=q4,L.pickBy=OE,L.property=ME,L.propertyOf=U8,L.pull=E6,L.pullAll=sE,L.pullAllBy=R6,L.pullAllWith=O6,L.pullAt=P6,L.range=q8,L.rangeRight=G8,L.rearg=V9,L.reject=T9,L.remove=T6,L.rest=H9,L.reverse=sb,L.sampleSize=$9,L.set=Y4,L.setWith=K4,L.shuffle=A9,L.slice=D6,L.sortBy=I9,L.sortedUniq=L6,L.sortedUniqBy=F6,L.split=b8,L.spread=W9,L.tail=j6,L.take=z6,L.takeRight=B6,L.takeRightWhile=V6,L.takeWhile=H6,L.tap=o9,L.throttle=U9,L.thru=kh,L.toArray=_E,L.toPairs=PE,L.toPairsIn=TE,L.toPath=J8,L.toPlainObject=CE,L.transform=X4,L.unary=q9,L.union=W6,L.unionBy=U6,L.unionWith=q6,L.uniq=G6,L.uniqBy=Y6,L.uniqWith=K6,L.unset=Q4,L.unzip=ab,L.unzipWith=aE,L.update=J4,L.updateWith=Z4,L.values=Gl,L.valuesIn=e8,L.without=X6,L.words=AE,L.wrap=G9,L.xor=Q6,L.xorBy=J6,L.xorWith=Z6,L.zip=e9,L.zipObject=t9,L.zipObjectDeep=n9,L.zipWith=r9,L.entries=PE,L.entriesIn=TE,L.extend=EE,L.extendWith=zh,vb(L,L),L.add=ej,L.attempt=kE,L.camelCase=o8,L.capitalize=DE,L.ceil=tj,L.clamp=t8,L.clone=K9,L.cloneDeep=Q9,L.cloneDeepWith=J9,L.cloneWith=X9,L.conformsTo=Z9,L.deburr=$E,L.defaultTo=k8,L.divide=nj,L.endsWith=i8,L.eq=Bo,L.escape=s8,L.escapeRegExp=a8,L.every=p9,L.find=m9,L.findIndex=nE,L.findKey=T4,L.findLast=v9,L.findLastIndex=rE,L.findLastKey=D4,L.floor=rj,L.forEach=cE,L.forEachRight=uE,L.forIn=$4,L.forInRight=A4,L.forOwn=k4,L.forOwnRight=M4,L.get=fb,L.gt=e4,L.gte=t4,L.has=L4,L.hasIn=hb,L.head=iE,L.identity=Er,L.includes=_9,L.indexOf=v6,L.inRange=n8,L.invoke=z4,L.isArguments=Pa,L.isArray=ut,L.isArrayBuffer=n4,L.isArrayLike=Sr,L.isArrayLikeObject=On,L.isBoolean=r4,L.isBuffer=Ps,L.isDate=o4,L.isElement=i4,L.isEmpty=s4,L.isEqual=a4,L.isEqualWith=l4,L.isError=ub,L.isFinite=c4,L.isFunction=zi,L.isInteger=bE,L.isLength=Fh,L.isMap=yE,L.isMatch=u4,L.isMatchWith=d4,L.isNaN=f4,L.isNative=h4,L.isNil=g4,L.isNull=p4,L.isNumber=xE,L.isObject=wn,L.isObjectLike=Sn,L.isPlainObject=Pu,L.isRegExp=db,L.isSafeInteger=m4,L.isSet=wE,L.isString=jh,L.isSymbol=Hr,L.isTypedArray=ql,L.isUndefined=v4,L.isWeakMap=b4,L.isWeakSet=y4,L.join=_6,L.kebabCase=l8,L.last=wo,L.lastIndexOf=S6,L.lowerCase=c8,L.lowerFirst=u8,L.lt=x4,L.lte=w4,L.max=oj,L.maxBy=ij,L.mean=sj,L.meanBy=aj,L.min=lj,L.minBy=cj,L.stubArray=yb,L.stubFalse=xb,L.stubObject=Y8,L.stubString=K8,L.stubTrue=X8,L.multiply=uj,L.nth=C6,L.noConflict=z8,L.noop=bb,L.now=Ih,L.pad=d8,L.padEnd=f8,L.padStart=h8,L.parseInt=p8,L.random=r8,L.reduce=O9,L.reduceRight=P9,L.repeat=g8,L.replace=m8,L.result=G4,L.round=dj,L.runInContext=ne,L.sample=D9,L.size=k9,L.snakeCase=v8,L.some=M9,L.sortedIndex=$6,L.sortedIndexBy=A6,L.sortedIndexOf=k6,L.sortedLastIndex=M6,L.sortedLastIndexBy=I6,L.sortedLastIndexOf=N6,L.startCase=y8,L.startsWith=x8,L.subtract=fj,L.sum=hj,L.sumBy=pj,L.template=w8,L.times=Q8,L.toFinite=Bi,L.toInteger=pt,L.toLength=SE,L.toLower=_8,L.toNumber=_o,L.toSafeInteger=_4,L.toString=Ut,L.toUpper=S8,L.trim=C8,L.trimEnd=E8,L.trimStart=R8,L.truncate=O8,L.unescape=P8,L.uniqueId=Z8,L.upperCase=T8,L.upperFirst=pb,L.each=cE,L.eachRight=uE,L.first=iE,vb(L,function(){var d={};return ii(L,function(p,y){Qt.call(L.prototype,y)||(d[y]=p)}),d}(),{chain:!1}),L.VERSION=r,mo(["bind","bindKey","curry","curryRight","partial","partialRight"],function(d){L[d].placeholder=L}),mo(["drop","take"],function(d,p){kt.prototype[d]=function(y){y=y===n?1:Mn(pt(y),0);var E=this.__filtered__&&!p?new kt(this):this.clone();return E.__filtered__?E.__takeCount__=nr(y,E.__takeCount__):E.__views__.push({size:nr(y,H),type:d+(E.__dir__<0?"Right":"")}),E},kt.prototype[d+"Right"]=function(y){return this.reverse()[d](y).reverse()}}),mo(["filter","map","takeWhile"],function(d,p){var y=p+1,E=y==Z||y==Q;kt.prototype[d]=function(M){var j=this.clone();return j.__iteratees__.push({iteratee:Je(M,3),type:y}),j.__filtered__=j.__filtered__||E,j}}),mo(["head","last"],function(d,p){var y="take"+(p?"Right":"");kt.prototype[d]=function(){return this[y](1).value()[0]}}),mo(["initial","tail"],function(d,p){var y="drop"+(p?"":"Right");kt.prototype[d]=function(){return this.__filtered__?new kt(this):this[y](1)}}),kt.prototype.compact=function(){return this.filter(Er)},kt.prototype.find=function(d){return this.filter(d).head()},kt.prototype.findLast=function(d){return this.reverse().find(d)},kt.prototype.invokeMap=St(function(d,p){return typeof d=="function"?new kt(this):this.map(function(y){return _u(y,d,p)})}),kt.prototype.reject=function(d){return this.filter(Lh(Je(d)))},kt.prototype.slice=function(d,p){d=pt(d);var y=this;return y.__filtered__&&(d>0||p<0)?new kt(y):(d<0?y=y.takeRight(-d):d&&(y=y.drop(d)),p!==n&&(p=pt(p),y=p<0?y.dropRight(-p):y.take(p-d)),y)},kt.prototype.takeRightWhile=function(d){return this.reverse().takeWhile(d).reverse()},kt.prototype.toArray=function(){return this.take(H)},ii(kt.prototype,function(d,p){var y=/^(?:filter|find|map|reject)|While$/.test(p),E=/^(?:head|last)$/.test(p),M=L[E?"take"+(p=="last"?"Right":""):p],j=E||/^find/.test(p);M&&(L.prototype[p]=function(){var U=this.__wrapped__,X=E?[1]:arguments,se=U instanceof kt,xe=X[0],we=se||ut(U),Re=function(Pt){var Mt=M.apply(L,ws([Pt],X));return E&&je?Mt[0]:Mt};we&&y&&typeof xe=="function"&&xe.length!=1&&(se=we=!1);var je=this.__chain__,Ye=!!this.__actions__.length,et=j&&!je,yt=se&&!Ye;if(!j&&we){U=yt?U:new kt(this);var tt=d.apply(U,X);return tt.__actions__.push({func:kh,args:[Re],thisArg:n}),new bo(tt,je)}return et&&yt?d.apply(this,X):(tt=this.thru(Re),et?E?tt.value()[0]:tt.value():tt)})}),mo(["pop","push","shift","sort","splice","unshift"],function(d){var p=ih[d],y=/^(?:push|sort|unshift)$/.test(d)?"tap":"thru",E=/^(?:pop|shift)$/.test(d);L.prototype[d]=function(){var M=arguments;if(E&&!this.__chain__){var j=this.value();return p.apply(ut(j)?j:[],M)}return this[y](function(U){return p.apply(ut(U)?U:[],M)})}}),ii(kt.prototype,function(d,p){var y=L[p];if(y){var E=y.name+"";Qt.call(Bl,E)||(Bl[E]=[]),Bl[E].push({name:p,func:y})}}),Bl[Rh(n,w).name]=[{name:"wrapper",func:n}],kt.prototype.clone=PF,kt.prototype.reverse=TF,kt.prototype.value=DF,L.prototype.at=i9,L.prototype.chain=s9,L.prototype.commit=a9,L.prototype.next=l9,L.prototype.plant=u9,L.prototype.reverse=d9,L.prototype.toJSON=L.prototype.valueOf=L.prototype.value=f9,L.prototype.first=L.prototype.head,gu&&(L.prototype[gu]=c9),L},Fl=aF();xa?((xa.exports=Fl)._=Fl,mv._=Fl):qn._=Fl}).call(Vs)})(hg,hg.exports);var uc=hg.exports;const ol=nu(uc);function eR({id:e,layouts:t,initialHeight:n,y:r,x:o,w:i,minH:s}){const a={i:e,x:o??0,y:r??1/0,w:i||20,h:n||35,minW:6,minH:s||10};return t||(t={}),vw.forEach(l=>{t!=null&&t[l]||(t={...t,[l]:[]});const c=t[l].reduce((u,f)=>Math.max(u,f.y+f.h),0);a.y=a.y===0?0:c,t[l].push(a)}),t}function tR(e,t){t&&vw.forEach(n=>{t!=null&&t[n]&&(t[n]=t[n].filter(r=>r.i!==e))})}const ke=X2()(rD((e,t)=>({isSessionExpired:!1,currentBreakpoint:"lg",dashboard:{id:"",style:x0},showContext:!1,selectedSheetId:null,selectedCardId:null,selectedFrameId:null,selectedCard:null,showFilters:!1,isDashboardEditing:!1,isVisualEditing:!1,showDashboardJSON:!1,filteringCards:[],actions:{deleteSheet:n=>{e(r=>{var i,s,a,l;const o=(i=r.dashboard.sheets)==null?void 0:i.findIndex(c=>c.id===n);o!==void 0&&o>-1&&((s=r.dashboard.sheets)==null||s.splice(o,1),r.selectedSheetId=(l=(a=r.dashboard.sheets)==null?void 0:a[0])==null?void 0:l.id)})},addSheet:n=>{e(r=>{r.dashboard.sheets||(r.dashboard.sheets=[]);const o=r.dashboard.filters;let i={};o==null||o.forEach(a=>{vw.forEach(l=>{i!=null&&i[l]||(i={...i,[l]:[]});const c={i:a.id,x:0,y:0,w:10,h:8};i[l].push(c)})});const s={...n,layouts:i};r.dashboard.sheets.push(s)})},setGlobalStyle:n=>{e(r=>{r.dashboard.globalStyle=n})},setAIScopeTables:n=>{e(r=>{r.dashboard.aiScopeTables=n})},setIsSessionExpired:n=>{e(()=>({isSessionExpired:n}))},setCardPython:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===o.selectedSheetId);i&&uc.forEach(i.frames,l=>{var u;const c=(u=l.cards)==null?void 0:u.find(f=>f.id===n);c&&(c.python=r)})})},addBaseQuery:n=>{e(r=>{var o;r.dashboard.baseQueries||(r.dashboard.baseQueries=[]),(o=r.dashboard.baseQueries)==null||o.push(n)})},removeBaseQuery:n=>{e(r=>{var i,s;const o=(i=r.dashboard.baseQueries)==null?void 0:i.findIndex(a=>a.id===n);o!=null&&o>-1&&((s=r.dashboard.baseQueries)==null||s.splice(o,1))})},setBaseQueries:n=>{e(r=>{r.dashboard.baseQueries=n})},setCurrentBreakpoint:n=>{e(()=>({currentBreakpoint:n}))},addFilteringCard:n=>{e(r=>{var o;(o=r.filteringCards)==null||o.push(n)})},removeFilteringCard:n=>{e(r=>{var i,s;const o=(i=r.filteringCards)==null?void 0:i.findIndex(a=>a.id===n.id);o!==void 0&&o>-1&&((s=r.filteringCards)==null||s.splice(o,1))})},setCustomCards:n=>{e(r=>{r.dashboard.customCards=n})},setAuthToken:n=>{e(()=>({authToken:n}))},setThemeStyle:n=>{e(()=>({themeStyle:n}))},setDashboard:n=>e({dashboard:n}),setBookmarkKey:n=>{e(()=>({bookmarkKey:n}))},setDashboardTheme:n=>{e(r=>{r.theme=n})},setSheets:n=>{e(r=>{r.dashboard&&(r.dashboard.sheets=n)})},setSheetTitle:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.title=r)})},setCardTitle:(n,r,o)=>{e(i=>{var a,l;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.title=o)})})},setCardInfo:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===o.selectedSheetId);i&&uc.forEach(i.frames,l=>{var u;const c=(u=l.cards)==null?void 0:u.find(f=>f.id===n);c&&(c.info=r)})})},setCardDescription:(n,r,o)=>{e(i=>{var a,l;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.description=o)})})},setCardSql:(n,r,o)=>{e(i=>{var a,l,c,u;const s=(l=(a=i.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(h=>h.id===r);f&&(f.sql=o,(u=i.onUpdateCard)==null||u.call(i,f,n))}})},setFrameCardData:(n,r,o)=>{e(i=>{var a,l;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.data=o)})})},setSheetLayout:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.layout=r)})},setSheetLayouts:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.layouts=r)})},setShowContext:n=>{e(()=>({showContext:n}))},setShowFilters:n=>{e(()=>({showFilters:n}))},setFilterValues:n=>{e(()=>({filterValues:n}))},addOrUpdateFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.findIndex(i=>i.filterId===n.filterId);o>-1?r.filterValues.splice(o,1,n):r.filterValues.push(n)}else r.filterValues=[n]})},addOrUpdateFilterValues:n=>{e(r=>{r.filterValues?n.forEach(o=>{var s,a,l;const i=(s=r==null?void 0:r.filterValues)==null?void 0:s.findIndex(c=>c.filterId===o.filterId);i!==void 0&&i>-1?(a=r.filterValues)==null||a.splice(i,1,o):(l=r.filterValues)==null||l.push(o)}):r.filterValues=n})},removeFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.filter(i=>i.filterId!==n&&!i.filterId.startsWith(n));r.filterValues=o}})},replaceFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.findIndex(i=>i.filterId===n.filterId);o>-1&&r.filterValues.splice(o,1,n)}})},addFilter:n=>{e(r=>{var i,s;r.dashboard.filters?(i=r.dashboard.filters)==null||i.push(n):r.dashboard.filters=[n];const o=(s=r.dashboard.sheets)==null?void 0:s.find(a=>a.id===r.selectedSheetId);eR({id:n.id,layouts:o==null?void 0:o.layouts,y:0,initialHeight:8,minH:7,w:10})})},removeFilter:n=>{e(r=>{var o,i,s;if(r.dashboard.filters){const a=(o=r.dashboard.filters)==null?void 0:o.findIndex(l=>l.id===n);if(a>-1){(i=r.dashboard.filters)==null||i.splice(a,1);const l=(s=r.dashboard.sheets)==null?void 0:s.find(c=>c.id===r.selectedSheetId);tR(n,l==null?void 0:l.layouts)}}})},updateFrameCard:(n,r,o)=>{e(i=>{var l,c,u,f,h;const s=(c=(l=i.dashboard)==null?void 0:l.sheets)==null?void 0:c.find(g=>g.id===n);if(!s)return;const a=(u=s==null?void 0:s.frames)==null?void 0:u.find(g=>g.id===r);if(a){const g=(f=a.cards)==null?void 0:f.findIndex(v=>v.id===o.id);g>-1&&((h=a.cards)==null||h.splice(g,1,o))}})},updateFilter:n=>{e(r=>{var o,i;if(r.dashboard.filters){const s=(o=r.dashboard.filters)==null?void 0:o.findIndex(a=>a.id===n.id);s>-1&&((i=r.dashboard.filters)==null||i.splice(s,1,n))}})},setIsDashboardEditing:n=>{e(()=>({isDashboardEditing:n}))},setShowDashboardJSON:n=>{e(()=>({showDashboardJSON:n}))},setIsVisualEditing:n=>{e(()=>({isVisualEditing:n}))},addFrame:(n,r,o)=>{e(i=>{var a,l,c,u;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n);if(s){s.frames||(s.frames=[]),(c=s.frames)==null||c.push(r);let f=1/0,h=0;o==="start"&&(f=0),eR({id:r.id,layouts:s.layouts,minH:10,x:h,y:f}),(u=i.onAddFrame)==null||u.call(i,r,n)}})},removeFrame:(n,r)=>{e(o=>{var s,a,l,c,u;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(f=>f.id===n);if(i){const f=(l=i.frames)==null?void 0:l.findIndex(h=>h.id===r);console.log(f),typeof f=="number"&&f>-1&&((c=i.frames)==null||c.splice(f,1),(u=i.layout)==null||u.splice(f,1),tR(r,i.layouts))}})},updateFrame:(n,r)=>{e(o=>{var a,l,c,u;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n),s=(c=i==null?void 0:i.frames)==null?void 0:c.findIndex(f=>f.id===r.id);i&&((u=i.frames)==null||u.splice(s,1,r))})},updateCard:(n,r)=>{e(o=>{var a,l,c,u,f;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(h=>h.id===r.id);i&&((u=i.cards)==null||u.splice(s,1,r),(f=o.onUpdateCard)==null||f.call(o,r,n))})},removeCard:(n,r)=>{e(o=>{var a,l,c,u,f,h;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(g=>g.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(g=>g.id===r.id);i&&((u=i.cards)==null||u.splice(s,1),(f=i.layout)==null||f.splice(s,1),(h=o.onRemoveCard)==null||h.call(o,r,n))})},setStyle:n=>{e(r=>{r.dashboard&&(r.dashboard.style=n)})},setSelectedCardId:(n,r)=>{e(o=>{var s,a,l;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===n);i&&(((l=i.cards)==null?void 0:l.find(u=>u.id===r))?o.selectedCardId=r:o.selectedCardId=null)})},setSelectedFrameId:n=>{e(r=>{var i,s;((s=(i=r.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(a=>a.id===r.selectedSheetId))&&(r.selectedFrameId=n)})},setSelectedSheetId:n=>{e(r=>{var i,s;((s=(i=r.dashboard)==null?void 0:i.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(o=>o.id===t().selectedSheetId)},getSelectedFrame:()=>{var r,o,i;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(s=>s.id===t().selectedSheetId);return(i=n==null?void 0:n.frames)==null?void 0:i.find(s=>s.id===t().selectedFrameId)},getCard:n=>{var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a)for(let l=0;l<a.length;l++){const c=(i=a[l].cards)==null?void 0:i.find(u=>u.id===n);if(c)return c}}},getSelectedSheetLayout:()=>{var r,o;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(i=>i.id===t().selectedSheetId);return n==null?void 0:n.layout},getSelectedSheetLayouts:()=>{var r,o;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(i=>i.id===t().selectedSheetId);return n==null?void 0:n.layouts},getStyle:()=>{var n;return(n=t().dashboard)==null?void 0:n.style},getCardSheet(n){var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a){for(let l=0;l<a.length;l++)if((i=a[l].cards)==null?void 0:i.find(u=>u.id===n))return r[s]}}},handleDataPointClickAction:(n,r)=>{Iz({card:n,dataPoint:r,set:e,get:t})}}}))),Mo=()=>ke(e=>e.actions);var Pf=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(){}},Hc=typeof window>"u"||"Deno"in window;function Oo(){}function Nz(e,t){return typeof e=="function"?e(t):e}function _0(e){return typeof e=="number"&&e>=0&&e!==1/0}function cD(e,t){return Math.max(e+(t||0)-Date.now(),0)}function nR(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==xw(s,t.options))return!1}else if(!Dd(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 o<"u"&&o!==t.state.fetchStatus||i&&!i(t))}function rR(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Td(t.options.mutationKey)!==Td(i))return!1}else if(!Dd(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function xw(e,t){return((t==null?void 0:t.queryKeyHashFn)||Td)(e)}function Td(e){return JSON.stringify(e,(t,n)=>C0(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Dd(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Dd(e[n],t[n])):!1}function uD(e,t){if(e===t)return e;const n=oR(e)&&oR(t);if(n||C0(e)&&C0(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let l=0;for(let c=0;c<s;c++){const u=n?c:i[c];!n&&e[u]===void 0&&t[u]===void 0&&r.includes(u)?(a[u]=void 0,l++):(a[u]=uD(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&l++)}return o===s&&l===o?e:a}return t}function S0(e,t){if(e&&!t||t&&!e)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function oR(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function C0(e){if(!iR(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!iR(n)||!n.hasOwnProperty("isPrototypeOf"))}function iR(e){return Object.prototype.toString.call(e)==="[object Object]"}function Lz(e){return new Promise(t=>{setTimeout(t,e)})}function E0(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?uD(e,t):t}function Fz(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function jz(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Xa,Hs,Cc,A2,zz=(A2=class extends Pf{constructor(){super();Xe(this,Xa,void 0);Xe(this,Hs,void 0);Xe(this,Cc,void 0);Ve(this,Cc,t=>{if(!Hc&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){re(this,Hs)||this.setEventListener(re(this,Cc))}onUnsubscribe(){var t;this.hasListeners()||((t=re(this,Hs))==null||t.call(this),Ve(this,Hs,void 0))}setEventListener(t){var n;Ve(this,Cc,t),(n=re(this,Hs))==null||n.call(this),Ve(this,Hs,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){re(this,Xa)!==t&&(Ve(this,Xa,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof re(this,Xa)=="boolean"?re(this,Xa):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Xa=new WeakMap,Hs=new WeakMap,Cc=new WeakMap,A2),pg=new zz,Ec,Ws,Rc,k2,Bz=(k2=class extends Pf{constructor(){super();Xe(this,Ec,!0);Xe(this,Ws,void 0);Xe(this,Rc,void 0);Ve(this,Rc,t=>{if(!Hc&&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(){re(this,Ws)||this.setEventListener(re(this,Rc))}onUnsubscribe(){var t;this.hasListeners()||((t=re(this,Ws))==null||t.call(this),Ve(this,Ws,void 0))}setEventListener(t){var n;Ve(this,Rc,t),(n=re(this,Ws))==null||n.call(this),Ve(this,Ws,t(this.setOnline.bind(this)))}setOnline(t){re(this,Ec)!==t&&(Ve(this,Ec,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return re(this,Ec)}},Ec=new WeakMap,Ws=new WeakMap,Rc=new WeakMap,k2),gg=new Bz;function Vz(e){return Math.min(1e3*2**e,3e4)}function om(e){return(e??"online")==="online"?gg.isOnline():!0}var dD=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Tb(e){return e instanceof dD}function fD(e){let t=!1,n=0,r=!1,o,i,s;const a=new Promise((x,w)=>{i=x,s=w}),l=x=>{var w;r||(g(new dD(x)),(w=e.abort)==null||w.call(e))},c=()=>{t=!0},u=()=>{t=!1},f=()=>!pg.isFocused()||e.networkMode!=="always"&&!gg.isOnline(),h=x=>{var w;r||(r=!0,(w=e.onSuccess)==null||w.call(e,x),o==null||o(),i(x))},g=x=>{var w;r||(r=!0,(w=e.onError)==null||w.call(e,x),o==null||o(),s(x))},v=()=>new Promise(x=>{var w;o=_=>{const S=r||!f();return S&&x(_),S},(w=e.onPause)==null||w.call(e)}).then(()=>{var x;o=void 0,r||(x=e.onContinue)==null||x.call(e)}),b=()=>{if(r)return;let x;try{x=e.fn()}catch(w){x=Promise.reject(w)}Promise.resolve(x).then(h).catch(w=>{var P;if(r)return;const _=e.retry??(Hc?0:3),S=e.retryDelay??Vz,R=typeof S=="function"?S(n,w):S,C=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,w);if(t||!C){g(w);return}n++,(P=e.onFail)==null||P.call(e,n,w),Lz(R).then(()=>{if(f())return v()}).then(()=>{t?g(w):b()})})};return om(e.networkMode)?b():v().then(b),{promise:a,cancel:l,continue:()=>(o==null?void 0:o())?a:Promise.resolve(),cancelRetry:c,continueRetry:u}}function Hz(){let e=[],t=0,n=h=>{h()},r=h=>{h()},o=h=>setTimeout(h,0);const i=h=>{o=h},s=h=>{let g;t++;try{g=h()}finally{t--,t||c()}return g},a=h=>{t?e.push(h):o(()=>{n(h)})},l=h=>(...g)=>{a(()=>{h(...g)})},c=()=>{const h=e;e=[],h.length&&o(()=>{r(()=>{h.forEach(g=>{n(g)})})})};return{batch:s,batchCalls:l,schedule:a,setNotifyFunction:h=>{n=h},setBatchNotifyFunction:h=>{r=h},setScheduler:i}}var Xn=Hz(),Qa,M2,hD=(M2=class{constructor(){Xe(this,Qa,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),_0(this.gcTime)&&Ve(this,Qa,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Hc?1/0:5*60*1e3))}clearGcTimeout(){re(this,Qa)&&(clearTimeout(re(this,Qa)),Ve(this,Qa,void 0))}},Qa=new WeakMap,M2),Oc,Pc,Co,Us,Eo,Vn,pf,Ja,Tc,Kp,Go,qi,I2,Wz=(I2=class extends hD{constructor(t){super();Xe(this,Tc);Xe(this,Go);Xe(this,Oc,void 0);Xe(this,Pc,void 0);Xe(this,Co,void 0);Xe(this,Us,void 0);Xe(this,Eo,void 0);Xe(this,Vn,void 0);Xe(this,pf,void 0);Xe(this,Ja,void 0);Ve(this,Ja,!1),Ve(this,pf,t.defaultOptions),Ct(this,Tc,Kp).call(this,t.options),Ve(this,Vn,[]),Ve(this,Co,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Ve(this,Oc,t.state||Uz(this.options)),this.state=re(this,Oc),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!re(this,Vn).length&&this.state.fetchStatus==="idle"&&re(this,Co).remove(this)}setData(t,n){const r=E0(this.state.data,t,this.options);return Ct(this,Go,qi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Ct(this,Go,qi).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r;const n=re(this,Us);return(r=re(this,Eo))==null||r.cancel(t),n?n.then(Oo).catch(Oo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(re(this,Oc))}isActive(){return re(this,Vn).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||re(this,Vn).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!cD(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=re(this,Vn).find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=re(this,Eo))==null||n.continue()}onOnline(){var n;const t=re(this,Vn).find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=re(this,Eo))==null||n.continue()}addObserver(t){re(this,Vn).includes(t)||(re(this,Vn).push(t),this.clearGcTimeout(),re(this,Co).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){re(this,Vn).includes(t)&&(Ve(this,Vn,re(this,Vn).filter(n=>n!==t)),re(this,Vn).length||(re(this,Eo)&&(re(this,Ja)?re(this,Eo).cancel({revert:!0}):re(this,Eo).cancelRetry()),this.scheduleGc()),re(this,Co).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return re(this,Vn).length}invalidate(){this.state.isInvalidated||Ct(this,Go,qi).call(this,{type:"invalidate"})}fetch(t,n){var c,u,f,h;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(re(this,Us))return(c=re(this,Eo))==null||c.continueRetry(),re(this,Us)}if(t&&Ct(this,Tc,Kp).call(this,t),!this.options.queryFn){const g=re(this,Vn).find(v=>v.options.queryFn);g&&Ct(this,Tc,Kp).call(this,g.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,o={queryKey:this.queryKey,meta:this.meta},i=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(Ve(this,Ja,!0),r.signal)})};i(o);const s=()=>this.options.queryFn?(Ve(this,Ja,!1),this.options.persister?this.options.persister(this.options.queryFn,o,this):this.options.queryFn(o)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),a={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:s};i(a),(u=this.options.behavior)==null||u.onFetch(a,this),Ve(this,Pc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&Ct(this,Go,qi).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta});const l=g=>{var v,b,x,w;Tb(g)&&g.silent||Ct(this,Go,qi).call(this,{type:"error",error:g}),Tb(g)||((b=(v=re(this,Co).config).onError)==null||b.call(v,g,this),(w=(x=re(this,Co).config).onSettled)==null||w.call(x,this.state.data,g,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return Ve(this,Eo,fD({fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:g=>{var v,b,x,w;if(typeof g>"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(g),(b=(v=re(this,Co).config).onSuccess)==null||b.call(v,g,this),(w=(x=re(this,Co).config).onSettled)==null||w.call(x,g,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:l,onFail:(g,v)=>{Ct(this,Go,qi).call(this,{type:"failed",failureCount:g,error:v})},onPause:()=>{Ct(this,Go,qi).call(this,{type:"pause"})},onContinue:()=>{Ct(this,Go,qi).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode})),Ve(this,Us,re(this,Eo).promise),re(this,Us)}},Oc=new WeakMap,Pc=new WeakMap,Co=new WeakMap,Us=new WeakMap,Eo=new WeakMap,Vn=new WeakMap,pf=new WeakMap,Ja=new WeakMap,Tc=new WeakSet,Kp=function(t){this.options={...re(this,pf),...t},this.updateGcTime(this.options.gcTime)},Go=new WeakSet,qi=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:om(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 o=t.error;return Tb(o)&&o.revert&&re(this,Pc)?{...re(this,Pc),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Xn.batch(()=>{re(this,Vn).forEach(r=>{r.onQueryUpdate()}),re(this,Co).notify({query:this,type:"updated",action:t})})},I2);function Uz(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 fi,N2,pD=(N2=class extends Pf{constructor(t={}){super();Xe(this,fi,void 0);this.config=t,Ve(this,fi,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??xw(o,n);let s=this.get(i);return s||(s=new Wz({cache:this,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){re(this,fi).has(t.queryHash)||(re(this,fi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=re(this,fi).get(t.queryHash);n&&(t.destroy(),n===t&&re(this,fi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Xn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return re(this,fi).get(t)}getAll(){return[...re(this,fi).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>nR(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>nR(t,r)):n}notify(t){Xn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Xn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Xn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},fi=new WeakMap,N2),hi,gf,Xr,Dc,pi,Ls,L2,qz=(L2=class extends hD{constructor(t){super();Xe(this,pi);Xe(this,hi,void 0);Xe(this,gf,void 0);Xe(this,Xr,void 0);Xe(this,Dc,void 0);this.mutationId=t.mutationId,Ve(this,gf,t.defaultOptions),Ve(this,Xr,t.mutationCache),Ve(this,hi,[]),this.state=t.state||Gz(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...re(this,gf),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){re(this,hi).includes(t)||(re(this,hi).push(t),this.clearGcTimeout(),re(this,Xr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Ve(this,hi,re(this,hi).filter(n=>n!==t)),this.scheduleGc(),re(this,Xr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){re(this,hi).length||(this.state.status==="pending"?this.scheduleGc():re(this,Xr).remove(this))}continue(){var t;return((t=re(this,Dc))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,c,u,f,h,g,v,b,x,w,_,S,R,C,P,A;const n=()=>(Ve(this,Dc,fD({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(k,D)=>{Ct(this,pi,Ls).call(this,{type:"failed",failureCount:k,error:D})},onPause:()=>{Ct(this,pi,Ls).call(this,{type:"pause"})},onContinue:()=>{Ct(this,pi,Ls).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),re(this,Dc).promise),r=this.state.status==="pending";try{if(!r){Ct(this,pi,Ls).call(this,{type:"pending",variables:t}),await((i=(o=re(this,Xr).config).onMutate)==null?void 0:i.call(o,t,this));const D=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));D!==this.state.context&&Ct(this,pi,Ls).call(this,{type:"pending",context:D,variables:t})}const k=await n();return await((c=(l=re(this,Xr).config).onSuccess)==null?void 0:c.call(l,k,t,this.state.context,this)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,k,t,this.state.context)),await((g=(h=re(this,Xr).config).onSettled)==null?void 0:g.call(h,k,null,this.state.variables,this.state.context,this)),await((b=(v=this.options).onSettled)==null?void 0:b.call(v,k,null,t,this.state.context)),Ct(this,pi,Ls).call(this,{type:"success",data:k}),k}catch(k){try{throw await((w=(x=re(this,Xr).config).onError)==null?void 0:w.call(x,k,t,this.state.context,this)),await((S=(_=this.options).onError)==null?void 0:S.call(_,k,t,this.state.context)),await((C=(R=re(this,Xr).config).onSettled)==null?void 0:C.call(R,void 0,k,this.state.variables,this.state.context,this)),await((A=(P=this.options).onSettled)==null?void 0:A.call(P,void 0,k,t,this.state.context)),k}finally{Ct(this,pi,Ls).call(this,{type:"error",error:k})}}}},hi=new WeakMap,gf=new WeakMap,Xr=new WeakMap,Dc=new WeakMap,pi=new WeakSet,Ls=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:!om(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),Xn.batch(()=>{re(this,hi).forEach(r=>{r.onMutationUpdate(t)}),re(this,Xr).notify({mutation:this,type:"updated",action:t})})},L2);function Gz(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ro,mf,Za,F2,Yz=(F2=class extends Pf{constructor(t={}){super();Xe(this,Ro,void 0);Xe(this,mf,void 0);Xe(this,Za,void 0);this.config=t,Ve(this,Ro,[]),Ve(this,mf,0)}build(t,n,r){const o=new qz({mutationCache:this,mutationId:++Bh(this,mf)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){re(this,Ro).push(t),this.notify({type:"added",mutation:t})}remove(t){Ve(this,Ro,re(this,Ro).filter(n=>n!==t)),this.notify({type:"removed",mutation:t})}clear(){Xn.batch(()=>{re(this,Ro).forEach(t=>{this.remove(t)})})}getAll(){return re(this,Ro)}find(t){const n={exact:!0,...t};return re(this,Ro).find(r=>rR(n,r))}findAll(t={}){return re(this,Ro).filter(n=>rR(t,n))}notify(t){Xn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){return Ve(this,Za,(re(this,Za)??Promise.resolve()).then(()=>{const t=re(this,Ro).filter(n=>n.state.isPaused);return Xn.batch(()=>t.reduce((n,r)=>n.then(()=>r.continue().catch(Oo)),Promise.resolve()))}).then(()=>{Ve(this,Za,void 0)})),re(this,Za)}},Ro=new WeakMap,mf=new WeakMap,Za=new WeakMap,F2);function Kz(e){return{onFetch:(t,n)=>{const r=async()=>{var v,b,x,w,_;const o=t.options,i=(x=(b=(v=t.fetchOptions)==null?void 0:v.meta)==null?void 0:b.fetchMore)==null?void 0:x.direction,s=((w=t.state.data)==null?void 0:w.pages)||[],a=((_=t.state.data)==null?void 0:_.pageParams)||[],l={pages:[],pageParams:[]};let c=!1;const u=S=>{Object.defineProperty(S,"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}'`))),h=async(S,R,C)=>{if(c)return Promise.reject();if(R==null&&S.pages.length)return Promise.resolve(S);const P={queryKey:t.queryKey,pageParam:R,direction:C?"backward":"forward",meta:t.options.meta};u(P);const A=await f(P),{maxPages:k}=t.options,D=C?jz:Fz;return{pages:D(S.pages,A,k),pageParams:D(S.pageParams,R,k)}};let g;if(i&&s.length){const S=i==="backward",R=S?Xz:sR,C={pages:s,pageParams:a},P=R(o,C);g=await h(C,P,S)}else{g=await h(l,a[0]??o.initialPageParam);const S=e??s.length;for(let R=1;R<S;R++){const C=sR(o,g);g=await h(g,C)}}return g};t.options.persister?t.fetchFn=()=>{var o,i;return(i=(o=t.options).persister)==null?void 0:i.call(o,r,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=r}}}function sR(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function Xz(e,{pages:t,pageParams:n}){var r;return(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n)}var In,qs,Gs,$c,Ac,Ys,kc,Mc,j2,Qz=(j2=class{constructor(e={}){Xe(this,In,void 0);Xe(this,qs,void 0);Xe(this,Gs,void 0);Xe(this,$c,void 0);Xe(this,Ac,void 0);Xe(this,Ys,void 0);Xe(this,kc,void 0);Xe(this,Mc,void 0);Ve(this,In,e.queryCache||new pD),Ve(this,qs,e.mutationCache||new Yz),Ve(this,Gs,e.defaultOptions||{}),Ve(this,$c,new Map),Ve(this,Ac,new Map),Ve(this,Ys,0)}mount(){Bh(this,Ys)._++,re(this,Ys)===1&&(Ve(this,kc,pg.subscribe(()=>{pg.isFocused()&&(this.resumePausedMutations(),re(this,In).onFocus())})),Ve(this,Mc,gg.subscribe(()=>{gg.isOnline()&&(this.resumePausedMutations(),re(this,In).onOnline())})))}unmount(){var e,t;Bh(this,Ys)._--,re(this,Ys)===0&&((e=re(this,kc))==null||e.call(this),Ve(this,kc,void 0),(t=re(this,Mc))==null||t.call(this),Ve(this,Mc,void 0))}isFetching(e){return re(this,In).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return re(this,qs).findAll({...e,status:"pending"}).length}getQueryData(e){var t;return(t=re(this,In).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=re(this,In).find({queryKey:e}),o=r==null?void 0:r.state.data,i=Nz(t,o);if(typeof i>"u")return;const s=this.defaultQueryOptions({queryKey:e});return re(this,In).build(this,s).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Xn.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var t;return(t=re(this,In).find({queryKey:e}))==null?void 0:t.state}removeQueries(e){const t=re(this,In);Xn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=re(this,In),r={type:"active",...e};return Xn.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=Xn.batch(()=>re(this,In).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Oo).catch(Oo)}invalidateQueries(e={},t={}){return Xn.batch(()=>{if(re(this,In).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=Xn.batch(()=>re(this,In).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Oo)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Oo)}fetchQuery(e){const t=this.defaultQueryOptions(e);typeof t.retry>"u"&&(t.retry=!1);const n=re(this,In).build(this,t);return n.isStaleByTime(t.staleTime)?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Oo).catch(Oo)}fetchInfiniteQuery(e){return e.behavior=Kz(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Oo).catch(Oo)}resumePausedMutations(){return re(this,qs).resumePausedMutations()}getQueryCache(){return re(this,In)}getMutationCache(){return re(this,qs)}getDefaultOptions(){return re(this,Gs)}setDefaultOptions(e){Ve(this,Gs,e)}setQueryDefaults(e,t){re(this,$c).set(Td(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...re(this,$c).values()];let n={};return t.forEach(r=>{Dd(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){re(this,Ac).set(Td(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...re(this,Ac).values()];let n={};return t.forEach(r=>{Dd(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const t={...re(this,Gs).queries,...(e==null?void 0:e.queryKey)&&this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=xw(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:{...re(this,Gs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){re(this,In).clear(),re(this,qs).clear()}},In=new WeakMap,qs=new WeakMap,Gs=new WeakMap,$c=new WeakMap,Ac=new WeakMap,Ys=new WeakMap,kc=new WeakMap,Mc=new WeakMap,j2),$r,fn,vf,vr,el,Ic,gi,bf,Nc,Lc,tl,nl,Ks,Fc,rl,Zu,yf,R0,xf,O0,wf,P0,_f,T0,Sf,D0,Cf,$0,Ef,A0,Jg,gD,z2,Jz=(z2=class extends Pf{constructor(t,n){super();Xe(this,rl);Xe(this,yf);Xe(this,xf);Xe(this,wf);Xe(this,_f);Xe(this,Sf);Xe(this,Cf);Xe(this,Ef);Xe(this,Jg);Xe(this,$r,void 0);Xe(this,fn,void 0);Xe(this,vf,void 0);Xe(this,vr,void 0);Xe(this,el,void 0);Xe(this,Ic,void 0);Xe(this,gi,void 0);Xe(this,bf,void 0);Xe(this,Nc,void 0);Xe(this,Lc,void 0);Xe(this,tl,void 0);Xe(this,nl,void 0);Xe(this,Ks,void 0);Xe(this,Fc,new Set);this.options=n,Ve(this,$r,t),Ve(this,gi,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(re(this,fn).addObserver(this),aR(re(this,fn),this.options)?Ct(this,rl,Zu).call(this):this.updateResult(),Ct(this,_f,T0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return k0(re(this,fn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return k0(re(this,fn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ct(this,Sf,D0).call(this),Ct(this,Cf,$0).call(this),re(this,fn).removeObserver(this)}setOptions(t,n){const r=this.options,o=re(this,fn);if(this.options=re(this,$r).defaultQueryOptions(t),S0(r,this.options)||re(this,$r).getQueryCache().notify({type:"observerOptionsUpdated",query:re(this,fn),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),Ct(this,Ef,A0).call(this);const i=this.hasListeners();i&&lR(re(this,fn),o,this.options,r)&&Ct(this,rl,Zu).call(this),this.updateResult(n),i&&(re(this,fn)!==o||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&Ct(this,yf,R0).call(this);const s=Ct(this,xf,O0).call(this);i&&(re(this,fn)!==o||this.options.enabled!==r.enabled||s!==re(this,Ks))&&Ct(this,wf,P0).call(this,s)}getOptimisticResult(t){const n=re(this,$r).getQueryCache().build(re(this,$r),t),r=this.createResult(n,t);return eB(this,r)&&(Ve(this,vr,r),Ve(this,Ic,this.options),Ve(this,el,re(this,fn).state)),r}getCurrentResult(){return re(this,vr)}trackResult(t){const n={};return Object.keys(t).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(re(this,Fc).add(r),t[r])})}),n}getCurrentQuery(){return re(this,fn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=re(this,$r).defaultQueryOptions(t),r=re(this,$r).getQueryCache().build(re(this,$r),n);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Ct(this,rl,Zu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),re(this,vr)))}createResult(t,n){var P;const r=re(this,fn),o=this.options,i=re(this,vr),s=re(this,el),a=re(this,Ic),c=t!==r?t.state:re(this,vf),{state:u}=t;let{error:f,errorUpdatedAt:h,fetchStatus:g,status:v}=u,b=!1,x;if(n._optimisticResults){const A=this.hasListeners(),k=!A&&aR(t,n),D=A&&lR(t,r,n,o);(k||D)&&(g=om(t.options.networkMode)?"fetching":"paused",u.dataUpdatedAt||(v="pending")),n._optimisticResults==="isRestoring"&&(g="idle")}if(n.select&&typeof u.data<"u")if(i&&u.data===(s==null?void 0:s.data)&&n.select===re(this,bf))x=re(this,Nc);else try{Ve(this,bf,n.select),x=n.select(u.data),x=E0(i==null?void 0:i.data,x,n),Ve(this,Nc,x),Ve(this,gi,null)}catch(A){Ve(this,gi,A)}else x=u.data;if(typeof n.placeholderData<"u"&&typeof x>"u"&&v==="pending"){let A;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))A=i.data;else if(A=typeof n.placeholderData=="function"?n.placeholderData((P=re(this,Lc))==null?void 0:P.state.data,re(this,Lc)):n.placeholderData,n.select&&typeof A<"u")try{A=n.select(A),Ve(this,gi,null)}catch(k){Ve(this,gi,k)}typeof A<"u"&&(v="success",x=E0(i==null?void 0:i.data,A,n),b=!0)}re(this,gi)&&(f=re(this,gi),x=re(this,Nc),h=Date.now(),v="error");const w=g==="fetching",_=v==="pending",S=v==="error",R=_&&w;return{status:v,fetchStatus:g,isPending:_,isSuccess:v==="success",isError:S,isInitialLoading:R,isLoading:R,data:x,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:h,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:w,isRefetching:w&&!_,isLoadingError:S&&u.dataUpdatedAt===0,isPaused:g==="paused",isPlaceholderData:b,isRefetchError:S&&u.dataUpdatedAt!==0,isStale:ww(t,n),refetch:this.refetch}}updateResult(t){const n=re(this,vr),r=this.createResult(re(this,fn),this.options);if(Ve(this,el,re(this,fn).state),Ve(this,Ic,this.options),re(this,el).data!==void 0&&Ve(this,Lc,re(this,fn)),S0(r,n))return;Ve(this,vr,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!re(this,Fc).size)return!0;const l=new Set(a??re(this,Fc));return this.options.throwOnError&&l.add("error"),Object.keys(re(this,vr)).some(c=>{const u=c;return re(this,vr)[u]!==n[u]&&l.has(u)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),Ct(this,Jg,gD).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ct(this,_f,T0).call(this)}},$r=new WeakMap,fn=new WeakMap,vf=new WeakMap,vr=new WeakMap,el=new WeakMap,Ic=new WeakMap,gi=new WeakMap,bf=new WeakMap,Nc=new WeakMap,Lc=new WeakMap,tl=new WeakMap,nl=new WeakMap,Ks=new WeakMap,Fc=new WeakMap,rl=new WeakSet,Zu=function(t){Ct(this,Ef,A0).call(this);let n=re(this,fn).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Oo)),n},yf=new WeakSet,R0=function(){if(Ct(this,Sf,D0).call(this),Hc||re(this,vr).isStale||!_0(this.options.staleTime))return;const n=cD(re(this,vr).dataUpdatedAt,this.options.staleTime)+1;Ve(this,tl,setTimeout(()=>{re(this,vr).isStale||this.updateResult()},n))},xf=new WeakSet,O0=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(re(this,fn)):this.options.refetchInterval)??!1},wf=new WeakSet,P0=function(t){Ct(this,Cf,$0).call(this),Ve(this,Ks,t),!(Hc||this.options.enabled===!1||!_0(re(this,Ks))||re(this,Ks)===0)&&Ve(this,nl,setInterval(()=>{(this.options.refetchIntervalInBackground||pg.isFocused())&&Ct(this,rl,Zu).call(this)},re(this,Ks)))},_f=new WeakSet,T0=function(){Ct(this,yf,R0).call(this),Ct(this,wf,P0).call(this,Ct(this,xf,O0).call(this))},Sf=new WeakSet,D0=function(){re(this,tl)&&(clearTimeout(re(this,tl)),Ve(this,tl,void 0))},Cf=new WeakSet,$0=function(){re(this,nl)&&(clearInterval(re(this,nl)),Ve(this,nl,void 0))},Ef=new WeakSet,A0=function(){const t=re(this,$r).getQueryCache().build(re(this,$r),this.options);if(t===re(this,fn))return;const n=re(this,fn);Ve(this,fn,t),Ve(this,vf,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Jg=new WeakSet,gD=function(t){Xn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(re(this,vr))}),re(this,$r).getQueryCache().notify({query:re(this,fn),type:"observerResultsUpdated"})})},z2);function Zz(e,t){return t.enabled!==!1&&!e.state.dataUpdatedAt&&!(e.state.status==="error"&&t.retryOnMount===!1)}function aR(e,t){return Zz(e,t)||e.state.dataUpdatedAt>0&&k0(e,t,t.refetchOnMount)}function k0(e,t,n){if(t.enabled!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ww(e,t)}return!1}function lR(e,t,n,r){return n.enabled!==!1&&(e!==t||r.enabled===!1)&&(!n.suspense||e.state.status!=="error")&&ww(e,n)}function ww(e,t){return e.isStaleByTime(t.staleTime)}function eB(e,t){return!S0(e.getCurrentResult(),t)}var mD=V.createContext(void 0),vD=e=>{const t=V.useContext(mD);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},tB=({client:e,children:t})=>(V.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),V.createElement(mD.Provider,{value:e},t)),bD=V.createContext(!1),nB=()=>V.useContext(bD);bD.Provider;function rB(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var oB=V.createContext(rB()),iB=()=>V.useContext(oB);function sB(e,t){return typeof e=="function"?e(...t):!!e}var aB=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},lB=e=>{V.useEffect(()=>{e.clearReset()},[e])},cB=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&sB(n,[e.error,r]),uB=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},dB=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,fB=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function hB(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=vD(n),o=nB(),i=iB(),s=r.defaultQueryOptions(e);s._optimisticResults=o?"isRestoring":"optimistic",uB(s),aB(s,i),lB(i);const[a]=V.useState(()=>new t(r,s)),l=a.getOptimisticResult(s);if(V.useSyncExternalStore(V.useCallback(c=>{const u=o?()=>{}:a.subscribe(Xn.batchCalls(c));return a.updateResult(),u},[a,o]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),V.useEffect(()=>{a.setOptions(s,{listeners:!1})},[s,a]),dB(s,l))throw fB(s,a,i);if(cB({result:l,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw l.error;return s.notifyOnChangeProps?l:a.trackResult(l)}function Tf(e,t){return hB(e,Jz,t)}const pB={theme:"system",setTheme:()=>null},yD=m.createContext(pB);function gB({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[o,i]=m.useState(()=>localStorage.getItem(n)||t);m.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),o==="system"){const l=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(l);return}a.classList.add(o)},[o]);const s={theme:o,setTheme:a=>{localStorage.setItem(n,a),i(a)}};return O.jsx(yD.Provider,{...r,value:s,children:e})}const xD=()=>{const e=m.useContext(yD);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};async function mB(e){return await(await fetch("https://semaphor.cloud/api/v1/dashboard",{headers:{Authorization:`Bearer ${e}`}})).json()}function wD(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function cR(e,t){const n=wD(e);return n==="dark"?ol.merge({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function vB({authToken:e,customStyle:t,currentTheme:n,onSave:r,onEvent:o}){const{data:i,refetch:s,isLoading:a,isError:l}=Tf({queryKey:["dashboard",e==null?void 0:e.accessToken],queryFn:()=>mB(e==null?void 0:e.accessToken),enabled:!1}),{theme:c,setTheme:u}=xD(),f=ke(A=>A.dashboard.globalStyle),{setDashboard:h,setSelectedSheetId:g,setStyle:v,setOnSaveFunction:b}=ke(A=>A.actions);ke(A=>A.actions.setCustomCards);const x=ke(A=>A.actions.setFilterValues),w=ke(A=>A.actions.setBookmarkKey),_=ke(A=>A.actions.setAuthToken),S=ke(A=>A.actions.setThemeStyle),R=ke(A=>A.actions.setDashboardTheme),C=ke(A=>A.actions.setOnEvent);m.useEffect(()=>{if(c){const A=wD(c);R(A)}},[c,R]),m.useEffect(()=>{n&&u(n)},[n,u]);function P(){const A=ol.cloneDeep(x0),k=ol.merge(A,f);if(t){const D=ol.merge(k,t),I=cR(c,D);S(I),v(D)}else{const D=cR(c,k);S(D),v(x0)}}return m.useEffect(()=>{i&&i.dashboard&&P()},[c,t,f]),m.useEffect(()=>{var F;if(!i||!i.dashboard)return;const A=i.dashboard,k=yL(A.id),D=JSON.parse(localStorage.getItem(k)||"[]"),I=D.find(B=>B.default===!0);if(I)h(I.template),P(),w(I.name),I.filterValues&&x(I.filterValues);else{h(A),P();const B=D.find(K=>(K==null?void 0:K.name)==="Original");B?B.template=A:D.push({name:"Original",template:A,default:!1}),localStorage.setItem(k,JSON.stringify(D))}g((F=A.sheets)==null?void 0:F[0].id)},[i,h,g,x,w]),m.useEffect(()=>{r&&b(r),o&&C(o)},[r,b,o,C]),m.useEffect(()=>{e&&e.accessToken&&(_(e),s())},[e,s,_]),{isLoading:a,isError:l}}function im({className:e,...t}){return O.jsx("div",{className:Ee("animate-pulse rounded-md bg-muted",e),...t})}const _w=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));_w.displayName="Card";const sm=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee("flex flex-col space-y-1.5 p-6",e),...t}));sm.displayName="CardHeader";const Df=V.forwardRef(({className:e,...t},n)=>O.jsx("h3",{ref:n,className:Ee("text-2xl font-semibold leading-none tracking-tight",e),...t}));Df.displayName="CardTitle";const Sw=V.forwardRef(({className:e,...t},n)=>O.jsx("p",{ref:n,className:Ee("text-sm text-muted-foreground",e),...t}));Sw.displayName="CardDescription";const am=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee("px-6 pt-0",e),...t}));am.displayName="CardContent";const Cw=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee("flex items-center p-6 pt-0",e),...t}));Cw.displayName="CardFooter";function _D({className:e,customStyle:t,onSave:n,onEvent:r,LoadingComponent:o,ErrorComponent:i,onChartElementClicked:s,id:a,authToken:l,currentTheme:c,version:u,customCards:f,showAssistant:h,...g}){ke(_=>_.selectedSheetId);const v=ke(_=>_.themeStyle),b=ke(_=>_.isSessionExpired),{isLoading:x,isError:w}=vB({authToken:l,customStyle:t,currentTheme:c,onSave:n,onEvent:r});return x||!l?(r==null||r({type:"info",message:"Loading dashboard"}),o?O.jsx(o,{message:"loading"}):O.jsx("div",{className:"flex items-center gap-3",children:O.jsx(im,{className:"h-1 w-full dark:h-[2px]"})})):w?(r==null||r({type:"error",message:"Error fetching dashboard"}),i?(console.log("Error fetching dashboard"),O.jsx(i,{})):O.jsx("div",{children:"Error"})):b?(r==null||r({type:"error",message:"Session Expired"}),O.jsx("div",{className:"flex h-full items-center justify-center",children:O.jsxs("div",{className:"space-y-4 rounded-md border border-muted p-10",children:[O.jsx(Df,{children:"Session Expired"}),O.jsx("p",{className:"text-muted-foreground",children:"Please refresh your page to continue."})]})})):O.jsx("div",{className:Ee("flex h-full grow flex-col justify-between",v==null?void 0:v.dashboardPanel,e),role:"dashboard-panel",...g})}function he(){return he=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},he.apply(this,arguments)}function Me(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Zn(e,t=[]){let n=[];function r(i,s){const a=m.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:g,...v}=f,b=(h==null?void 0:h[e][l])||a,x=m.useMemo(()=>v,Object.values(v));return m.createElement(b.Provider,{value:x},g)}function u(f,h){const g=(h==null?void 0:h[e][l])||a,v=m.useContext(g);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>m.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,bB(o,...t)]}function bB(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function yB(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function cs(...e){return t=>e.forEach(n=>yB(n,t))}function _t(...e){return m.useCallback(cs(...e),e)}const M0=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(wB);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(I0,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(I0,he({},r,{ref:t}),n)});M0.displayName="Slot";const I0=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{..._B(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});I0.displayName="SlotClone";const xB=({children:e})=>m.createElement(m.Fragment,null,e);function wB(e){return m.isValidElement(e)&&e.type===xB}function _B(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function lm(e){const t=e+"CollectionProvider",[n,r]=Zn(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=g=>{const{scope:v,children:b}=g,x=m.useRef(null),w=m.useRef(new Map).current;return m.createElement(o,{scope:v,itemMap:w,collectionRef:x},b)},a=e+"CollectionSlot",l=m.forwardRef((g,v)=>{const{scope:b,children:x}=g,w=i(a,b),_=_t(v,w.collectionRef);return m.createElement(M0,{ref:_},x)}),c=e+"CollectionItemSlot",u="data-radix-collection-item",f=m.forwardRef((g,v)=>{const{scope:b,children:x,...w}=g,_=m.useRef(null),S=_t(v,_),R=i(c,b);return m.useEffect(()=>(R.itemMap.set(_,{ref:_,...w}),()=>void R.itemMap.delete(_))),m.createElement(M0,{[u]:"",ref:S},x)});function h(g){const v=i(e+"CollectionConsumer",g);return m.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((R,C)=>w.indexOf(R.ref.current)-w.indexOf(C.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},h,r]}const ur=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},SB=V.useId||(()=>{});let CB=0;function Jo(e){const[t,n]=V.useState(SB());return ur(()=>{e||n(r=>r??String(CB++))},[e]),e||(t?`radix-${t}`:"")}const SD=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(RB);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(N0,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(N0,he({},r,{ref:t}),n)});SD.displayName="Slot";const N0=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...OB(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});N0.displayName="SlotClone";const EB=({children:e})=>m.createElement(m.Fragment,null,e);function RB(e){return m.isValidElement(e)&&e.type===EB}function OB(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const PB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Qe=PB.reduce((e,t)=>{const n=m.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?SD:t;return m.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),m.createElement(a,he({},s,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function CD(e,t){e&&ko.flushSync(()=>e.dispatchEvent(t))}function Ln(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 xr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=TB({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=Ln(n),l=m.useCallback(c=>{if(i){const f=typeof c=="function"?c(e):c;f!==e&&a(f)}else o(c)},[i,e,o,a]);return[s,l]}function TB({defaultProp:e,onChange:t}){const n=m.useState(e),[r]=n,o=m.useRef(r),i=Ln(t);return m.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}const DB=m.createContext(void 0);function _l(e){const t=m.useContext(DB);return e||t||"ltr"}const Db="rovingFocusGroup.onEntryFocus",$B={bubbles:!1,cancelable:!0},Ew="RovingFocusGroup",[L0,ED,AB]=lm(Ew),[kB,ou]=Zn(Ew,[AB]),[MB,IB]=kB(Ew),NB=m.forwardRef((e,t)=>m.createElement(L0.Provider,{scope:e.__scopeRovingFocusGroup},m.createElement(L0.Slot,{scope:e.__scopeRovingFocusGroup},m.createElement(LB,he({},e,{ref:t}))))),LB=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,...u}=e,f=m.useRef(null),h=_t(t,f),g=_l(i),[v=null,b]=xr({prop:s,defaultProp:a,onChange:l}),[x,w]=m.useState(!1),_=Ln(c),S=ED(n),R=m.useRef(!1),[C,P]=m.useState(0);return m.useEffect(()=>{const A=f.current;if(A)return A.addEventListener(Db,_),()=>A.removeEventListener(Db,_)},[_]),m.createElement(MB,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:v,onItemFocus:m.useCallback(A=>b(A),[b]),onItemShiftTab:m.useCallback(()=>w(!0),[]),onFocusableItemAdd:m.useCallback(()=>P(A=>A+1),[]),onFocusableItemRemove:m.useCallback(()=>P(A=>A-1),[])},m.createElement(Qe.div,he({tabIndex:x||C===0?-1:0,"data-orientation":r},u,{ref:h,style:{outline:"none",...e.style},onMouseDown:Me(e.onMouseDown,()=>{R.current=!0}),onFocus:Me(e.onFocus,A=>{const k=!R.current;if(A.target===A.currentTarget&&k&&!x){const D=new CustomEvent(Db,$B);if(A.currentTarget.dispatchEvent(D),!D.defaultPrevented){const I=S().filter(z=>z.focusable),F=I.find(z=>z.active),B=I.find(z=>z.id===v),Z=[F,B,...I].filter(Boolean).map(z=>z.ref.current);RD(Z)}}R.current=!1}),onBlur:Me(e.onBlur,()=>w(!1))})))}),FB="RovingFocusGroupItem",jB=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Jo(),l=i||a,c=IB(FB,n),u=c.currentTabStopId===l,f=ED(n),{onFocusableItemAdd:h,onFocusableItemRemove:g}=c;return m.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),m.createElement(L0.ItemSlot,{scope:n,id:l,focusable:r,active:o},m.createElement(Qe.span,he({tabIndex:u?0:-1,"data-orientation":c.orientation},s,{ref:t,onMouseDown:Me(e.onMouseDown,v=>{r?c.onItemFocus(l):v.preventDefault()}),onFocus:Me(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:Me(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){c.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=VB(v,c.orientation,c.dir);if(b!==void 0){v.preventDefault();let w=f().filter(_=>_.focusable).map(_=>_.ref.current);if(b==="last")w.reverse();else if(b==="prev"||b==="next"){b==="prev"&&w.reverse();const _=w.indexOf(v.currentTarget);w=c.loop?HB(w,_+1):w.slice(_+1)}setTimeout(()=>RD(w))}})})))}),zB={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function BB(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function VB(e,t,n){const r=BB(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return zB[r]}function RD(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function HB(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const Rw=NB,Ow=jB;function WB(e,t){return m.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const er=e=>{const{present:t,children:n}=e,r=UB(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),i=_t(r.ref,o.ref);return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:i}):null};er.displayName="Presence";function UB(e){const[t,n]=m.useState(),r=m.useRef({}),o=m.useRef(e),i=m.useRef("none"),s=e?"mounted":"unmounted",[a,l]=WB(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=Uh(r.current);i.current=a==="mounted"?c:"none"},[a]),ur(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,g=Uh(c);e?l("MOUNT"):g==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),ur(()=>{if(t){const c=f=>{const g=Uh(r.current).includes(f.animationName);f.target===t&&g&&ko.flushSync(()=>l("ANIMATION_END"))},u=f=>{f.target===t&&(i.current=Uh(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),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 Uh(e){return(e==null?void 0:e.animationName)||"none"}const OD="Tabs",[qB,tye]=Zn(OD,[ou]),PD=ou(),[GB,Pw]=qB(OD),YB=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=_l(a),[f,h]=xr({prop:r,onChange:o,defaultProp:i});return m.createElement(GB,{scope:n,baseId:Jo(),value:f,onValueChange:h,orientation:s,dir:u,activationMode:l},m.createElement(Qe.div,he({dir:u,"data-orientation":s},c,{ref:t})))}),KB="TabsList",XB=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Pw(KB,n),s=PD(n);return m.createElement(Rw,he({asChild:!0},s,{orientation:i.orientation,dir:i.dir,loop:r}),m.createElement(Qe.div,he({role:"tablist","aria-orientation":i.orientation},o,{ref:t})))}),QB="TabsTrigger",JB=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Pw(QB,n),a=PD(n),l=TD(s.baseId,r),c=DD(s.baseId,r),u=r===s.value;return m.createElement(Ow,he({asChild:!0},a,{focusable:!o,active:u}),m.createElement(Qe.button,he({type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l},i,{ref:t,onMouseDown:Me(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Me(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Me(e.onFocus,()=>{const f=s.activationMode!=="manual";!u&&!o&&f&&s.onValueChange(r)})})))}),ZB="TabsContent",eV=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=Pw(ZB,n),l=TD(a.baseId,r),c=DD(a.baseId,r),u=r===a.value,f=m.useRef(u);return m.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),m.createElement(er,{present:o||u},({present:h})=>m.createElement(Qe.div,he({"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0}}),h&&i))});function TD(e,t){return`${e}-trigger-${t}`}function DD(e,t){return`${e}-content-${t}`}const tV=YB,$D=XB,AD=JB,kD=eV,MD=tV,Tw=V.forwardRef(({className:e,...t},n)=>O.jsx($D,{ref:n,className:Ee("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Tw.displayName=$D.displayName;const Dw=V.forwardRef(({className:e,...t},n)=>O.jsx(AD,{ref:n,className:Ee("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}));Dw.displayName=AD.displayName;const $w=V.forwardRef(({className:e,...t},n)=>O.jsx(kD,{ref:n,className:Ee("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));$w.displayName=kD.displayName;var ID={exports:{}},$f={},F0={exports:{}};(function(e,t){(function(n,r){r(t)})(Vs,function(n){function r(ie){return function(ae,ye,G,be,_e,Pe,Te){return ie(ae,ye,Te)}}function o(ie){return function(ae,ye,G,be){if(!ae||!ye||typeof ae!="object"||typeof ye!="object")return ie(ae,ye,G,be);var _e=be.get(ae),Pe=be.get(ye);if(_e&&Pe)return _e===ye&&Pe===ae;be.set(ae,ye),be.set(ye,ae);var Te=ie(ae,ye,G,be);return be.delete(ae),be.delete(ye),Te}}function i(ie,te){var ae={};for(var ye in ie)ae[ye]=ie[ye];for(var ye in te)ae[ye]=te[ye];return ae}function s(ie){return ie.constructor===Object||ie.constructor==null}function a(ie){return typeof ie.then=="function"}function l(ie,te){return ie===te||ie!==ie&&te!==te}var c="[object Arguments]",u="[object Boolean]",f="[object Date]",h="[object RegExp]",g="[object Map]",v="[object Number]",b="[object Object]",x="[object Set]",w="[object String]",_=Object.prototype.toString;function S(ie){var te=ie.areArraysEqual,ae=ie.areDatesEqual,ye=ie.areMapsEqual,G=ie.areObjectsEqual,be=ie.areRegExpsEqual,_e=ie.areSetsEqual,Pe=ie.createIsNestedEqual,Te=Pe(Ue);function Ue(Be,Ie,Ke){if(Be===Ie)return!0;if(!Be||!Ie||typeof Be!="object"||typeof Ie!="object")return Be!==Be&&Ie!==Ie;if(s(Be)&&s(Ie))return G(Be,Ie,Te,Ke);var lt=Array.isArray(Be),It=Array.isArray(Ie);if(lt||It)return lt===It&&te(Be,Ie,Te,Ke);var $t=_.call(Be);return $t!==_.call(Ie)?!1:$t===f?ae(Be,Ie,Te,Ke):$t===h?be(Be,Ie,Te,Ke):$t===g?ye(Be,Ie,Te,Ke):$t===x?_e(Be,Ie,Te,Ke):$t===b||$t===c?a(Be)||a(Ie)?!1:G(Be,Ie,Te,Ke):$t===u||$t===v||$t===w?l(Be.valueOf(),Ie.valueOf()):!1}return Ue}function R(ie,te,ae,ye){var G=ie.length;if(te.length!==G)return!1;for(;G-- >0;)if(!ae(ie[G],te[G],G,G,ie,te,ye))return!1;return!0}var C=o(R);function P(ie,te){return l(ie.valueOf(),te.valueOf())}function A(ie,te,ae,ye){var G=ie.size===te.size;if(!G)return!1;if(!ie.size)return!0;var be={},_e=0;return ie.forEach(function(Pe,Te){if(G){var Ue=!1,Be=0;te.forEach(function(Ie,Ke){!Ue&&!be[Be]&&(Ue=ae(Te,Ke,_e,Be,ie,te,ye)&&ae(Pe,Ie,Te,Ke,ie,te,ye))&&(be[Be]=!0),Be++}),_e++,G=Ue}}),G}var k=o(A),D="_owner",I=Object.prototype.hasOwnProperty;function F(ie,te,ae,ye){var G=Object.keys(ie),be=G.length;if(Object.keys(te).length!==be)return!1;for(var _e;be-- >0;){if(_e=G[be],_e===D){var Pe=!!ie.$$typeof,Te=!!te.$$typeof;if((Pe||Te)&&Pe!==Te)return!1}if(!I.call(te,_e)||!ae(ie[_e],te[_e],_e,_e,ie,te,ye))return!1}return!0}var B=o(F);function K(ie,te){return ie.source===te.source&&ie.flags===te.flags}function Z(ie,te,ae,ye){var G=ie.size===te.size;if(!G)return!1;if(!ie.size)return!0;var be={};return ie.forEach(function(_e,Pe){if(G){var Te=!1,Ue=0;te.forEach(function(Be,Ie){!Te&&!be[Ue]&&(Te=ae(_e,Be,Pe,Ie,ie,te,ye))&&(be[Ue]=!0),Ue++}),G=Te}}),G}var z=o(Z),Q=Object.freeze({areArraysEqual:R,areDatesEqual:P,areMapsEqual:A,areObjectsEqual:F,areRegExpsEqual:K,areSetsEqual:Z,createIsNestedEqual:r}),W=Object.freeze({areArraysEqual:C,areDatesEqual:P,areMapsEqual:k,areObjectsEqual:B,areRegExpsEqual:K,areSetsEqual:z,createIsNestedEqual:r}),Y=S(Q);function oe(ie,te){return Y(ie,te,void 0)}var $=S(i(Q,{createIsNestedEqual:function(){return l}}));function H(ie,te){return $(ie,te,void 0)}var J=S(W);function N(ie,te){return J(ie,te,new WeakMap)}var ce=S(i(W,{createIsNestedEqual:function(){return l}}));function le(ie,te){return ce(ie,te,new WeakMap)}function de(ie){return S(i(Q,ie(Q)))}function pe(ie){var te=S(i(W,ie(W)));return function(ae,ye,G){return G===void 0&&(G=new WeakMap),te(ae,ye,G)}}n.circularDeepEqual=N,n.circularShallowEqual=le,n.createCustomCircularEqual=pe,n.createCustomEqual=de,n.deepEqual=oe,n.sameValueZeroEqual=l,n.shallowEqual=H,Object.defineProperty(n,"__esModule",{value:!0})})})(F0,F0.exports);var Aw=F0.exports;const kw=dw(yj);var Ot={},nV=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(Ot,"__esModule",{value:!0});Ot.bottom=Mw;Ot.childrenEqual=sV;Ot.cloneLayout=ND;Ot.cloneLayoutItem=il;Ot.collides=cm;Ot.compact=FD;Ot.compactItem=jD;Ot.compactType=xV;Ot.correctBounds=zD;Ot.fastPositionEqual=lV;Ot.fastRGLPropsEqual=void 0;Ot.getAllCollisions=BD;Ot.getFirstCollision=qa;Ot.getLayoutItem=Iw;Ot.getStatics=Nw;Ot.modifyLayout=LD;Ot.moveElement=td;Ot.moveElementAwayFromCollision=z0;Ot.noop=void 0;Ot.perc=uV;Ot.resizeItemInDirection=mV;Ot.setTopLeft=bV;Ot.setTransform=vV;Ot.sortLayoutItems=Vw;Ot.sortLayoutItemsByColRow=qD;Ot.sortLayoutItemsByRowCol=UD;Ot.synchronizeLayoutWithChildren=yV;Ot.validateLayout=GD;Ot.withLayoutItem=iV;var uR=Aw,ed=rV(m);function rV(e){return e&&e.__esModule?e:{default:e}}const oV=process.env.NODE_ENV==="production";function Mw(e){let t=0,n;for(let r=0,o=e.length;r<o;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function ND(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=il(e[n]);return t}function LD(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function iV(e,t,n){let r=Iw(e,t);return r?(r=n(il(r)),e=LD(e,r),[e,r]):[e,null]}function il(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 sV(e,t){return(0,uR.deepEqual)(ed.default.Children.map(e,n=>n==null?void 0:n.key),ed.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,uR.deepEqual)(ed.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),ed.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}const aV=nV;Ot.fastRGLPropsEqual=aV;function lV(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function cm(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 FD(e,t,n,r){const o=Nw(e),i=Vw(e,t),s=Array(e.length);for(let a=0,l=i.length;a<l;a++){let c=il(i[a]);c.static||(c=jD(o,c,t,n,i,r),o.push(c)),s[e.indexOf(i[a])]=c,c.moved=!1}return s}const cV={x:"w",y:"h"};function j0(e,t,n,r){const o=cV[r];t[r]+=1;const i=e.map(s=>s.i).indexOf(t.i);for(let s=i+1;s<e.length;s++){const a=e[s];if(!a.static){if(a.y>t.y+t.h)break;cm(t,a)&&j0(e,a,n+t[o],r)}}t[r]=n}function jD(e,t,n,r,o,i){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min(Mw(e),t.y);t.y>0&&!qa(e,t);)t.y--;else if(a)for(;t.x>0&&!qa(e,t);)t.x--;let l;for(;(l=qa(e,t))&&!(n===null&&i);)if(a?j0(o,t,l.x+l.w,"x"):j0(o,t,l.y+l.h,"y"),a&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!qa(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function zD(e,t){const n=Nw(e);for(let r=0,o=e.length;r<o;r++){const i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;qa(n,i);)i.y++}return e}function Iw(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function qa(e,t){for(let n=0,r=e.length;n<r;n++)if(cm(e[n],t))return e[n]}function BD(e,t){return e.filter(n=>cm(n,t))}function Nw(e){return e.filter(t=>t.static)}function td(e,t,n,r,o,i,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,u=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let f=Vw(e,s);(s==="vertical"&&typeof r=="number"?u>=r:s==="horizontal"&&typeof n=="number"?c>=n:!1)&&(f=f.reverse());const g=BD(f,t),v=g.length>0;if(v&&l)return ND(e);if(v&&i)return"Collision prevented on ".concat(t.i,", reverting."),t.x=c,t.y=u,t.moved=!1,e;for(let b=0,x=g.length;b<x;b++){const w=g[b];"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=z0(e,w,t,o,s):e=z0(e,t,w,o,s))}return e}function z0(e,t,n,r,o,i){const s=o==="horizontal",a=o==="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"},h=qa(e,f),g=h&&h.y+h.h>t.y,v=h&&t.x+t.w>h.x;if(h){if(g&&a)return td(e,n,void 0,t.y+1,r,l,o);if(g&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(v&&s)return td(e,t,n.x,void 0,r,l,o)}else return"Doing reverse collision on ".concat(n.i," up to [").concat(f.x,",").concat(f.y,"]."),td(e,n,s?f.x:void 0,a?f.y:void 0,r,l,o)}const c=s?n.x+1:void 0,u=a?n.y+1:void 0;return c==null&&u==null?e:td(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,o)}function uV(e){return e*100+"%"}const VD=(e,t,n,r)=>e+n>r?t:n,HD=(e,t,n)=>e<0?t:n,WD=e=>Math.max(0,e),Lw=e=>Math.max(0,e),Fw=(e,t,n)=>{let{left:r,height:o,width:i}=t;const s=e.top-(o-e.height);return{left:r,width:i,height:HD(s,e.height,o),top:Lw(s)}},jw=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{top:r,height:i,width:VD(e.left,e.width,s,n),left:WD(o)}},zw=(e,t,n)=>{let{top:r,height:o,width:i}=t;const s=e.left-(i-e.width);return{height:o,width:s<0?e.width:VD(e.left,e.width,i,n),top:Lw(r),left:WD(s)}},Bw=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{width:s,left:o,height:HD(r,e.height,i),top:Lw(r)}},dV=function(){return Fw(arguments.length<=0?void 0:arguments[0],jw(...arguments))},fV=function(){return Fw(arguments.length<=0?void 0:arguments[0],zw(...arguments))},hV=function(){return Bw(arguments.length<=0?void 0:arguments[0],jw(...arguments))},pV=function(){return Bw(arguments.length<=0?void 0:arguments[0],zw(...arguments))},gV={n:Fw,ne:dV,e:jw,se:hV,s:Bw,sw:pV,w:zw,nw:fV};function mV(e,t,n,r){const o=gV[e];return o?o(t,{...t,...n},r):n}function vV(e){let{top:t,left:n,width:r,height:o}=e;const i="translate(".concat(n,"px,").concat(t,"px)");return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:"".concat(r,"px"),height:"".concat(o,"px"),position:"absolute"}}function bV(e){let{top:t,left:n,width:r,height:o}=e;return{top:"".concat(t,"px"),left:"".concat(n,"px"),width:"".concat(r,"px"),height:"".concat(o,"px"),position:"absolute"}}function Vw(e,t){return t==="horizontal"?qD(e):t==="vertical"?UD(e):e}function UD(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 qD(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 yV(e,t,n,r,o){e=e||[];const i=[];ed.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=Iw(e,String(a.key)),c=a.props["data-grid"];l&&c==null?i.push(il(l)):c?(oV||GD([c],"ReactGridLayout.children"),i.push(il({...c,i:a.key}))):i.push(il({w:1,h:1,x:0,y:Mw(i),i:String(a.key)}))});const s=zD(i,{cols:n});return o?s:FD(s,r,n)}function GD(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,o=e.length;r<o;r++){const i=e[r];for(let s=0;s<n.length;s++)if(typeof i[n[s]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[s]+" must be a number!")}}function xV(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const wV=()=>{};Ot.noop=wV;var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});Ri.calcGridColWidth=um;Ri.calcGridItemPosition=_V;Ri.calcGridItemWHPx=B0;Ri.calcWH=CV;Ri.calcXY=SV;Ri.clamp=Ga;function um(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function B0(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function _V(e,t,n,r,o,i){const{margin:s,containerPadding:a,rowHeight:l}=e,c=um(e),u={};return i&&i.resizing?(u.width=Math.round(i.resizing.width),u.height=Math.round(i.resizing.height)):(u.width=B0(r,c,s[0]),u.height=B0(o,l,s[1])),i&&i.dragging?(u.top=Math.round(i.dragging.top),u.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(u.top=Math.round(i.resizing.top),u.left=Math.round(i.resizing.left)):(u.top=Math.round((l+s[1])*n+a[1]),u.left=Math.round((c+s[0])*t+a[0])),u}function SV(e,t,n,r,o){const{margin:i,cols:s,rowHeight:a,maxRows:l}=e,c=um(e);let u=Math.round((n-i[0])/(c+i[0])),f=Math.round((t-i[1])/(a+i[1]));return u=Ga(u,0,s-r),f=Ga(f,0,l-o),{x:u,y:f}}function CV(e,t,n,r,o,i){const{margin:s,maxRows:a,cols:l,rowHeight:c}=e,u=um(e);let f=Math.round((t+s[0])/(u+s[0])),h=Math.round((n+s[1])/(c+s[1])),g=Ga(f,0,l-r),v=Ga(h,0,a-o);return["sw","w","nw"].indexOf(i)!==-1&&(g=Ga(f,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(v=Ga(h,0,a)),{w:g,h:v}}function Ga(e,t,n){return Math.max(Math.min(e,n),t)}var dm={},V0={exports:{}},$b,dR;function Hw(){if(dR)return $b;dR=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return $b=e,$b}var Ab,fR;function EV(){if(fR)return Ab;fR=1;var e=Hw();function t(){}function n(){}return n.resetWarningCache=t,Ab=function(){function r(s,a,l,c,u,f){if(f!==e){var h=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 h.name="Invariant Violation",h}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Ab}var qh={exports:{}},qt={};/** @license React v16.13.1
|
|
88
|
+
}`;var yt=kE(function(){return jt(j,Ye+"return "+Re).apply(n,U)});if(yt.source=Re,ub(yt))throw yt;return yt}function _8(d){return Ut(d).toLowerCase()}function S8(d){return Ut(d).toUpperCase()}function C8(d,p,y){if(d=Ut(d),d&&(y||p===n))return VS(d);if(!d||!(p=Vr(p)))return d;var E=jo(d),M=jo(p),j=HS(E,M),U=WS(E,M)+1;return Os(E,j,U).join("")}function E8(d,p,y){if(d=Ut(d),d&&(y||p===n))return d.slice(0,qS(d)+1);if(!d||!(p=Vr(p)))return d;var E=jo(d),M=WS(E,jo(p))+1;return Os(E,0,M).join("")}function R8(d,p,y){if(d=Ut(d),d&&(y||p===n))return d.replace(jn,"");if(!d||!(p=Vr(p)))return d;var E=jo(d),M=HS(E,jo(p));return Os(E,M).join("")}function O8(d,p){var y=I,E=F;if(wn(p)){var M="separator"in p?p.separator:M;y="length"in p?pt(p.length):y,E="omission"in p?Vr(p.omission):E}d=Ut(d);var j=d.length;if(Nl(d)){var U=jo(d);j=U.length}if(y>=j)return d;var X=y-Ll(E);if(X<1)return E;var se=U?Os(U,0,X).join(""):d.slice(0,X);if(M===n)return se+E;if(U&&(X+=se.length-X),db(M)){if(d.slice(X).search(M)){var xe,we=se;for(M.global||(M=Ov(M.source,Ut(qe.exec(M))+"g")),M.lastIndex=0;xe=M.exec(we);)var Re=xe.index;se=se.slice(0,Re===n?X:Re)}}else if(d.indexOf(Vr(M),X)!=X){var je=se.lastIndexOf(M);je>-1&&(se=se.slice(0,je))}return se+E}function P8(d){return d=Ut(d),d&&Rn.test(d)?d.replace(Xt,rF):d}var T8=Wl(function(d,p,y){return d+(y?" ":"")+p.toUpperCase()}),pb=MC("toUpperCase");function AE(d,p,y){return d=Ut(d),p=y?n:p,p===n?J3(d)?sF(d):H3(d):d.match(p)||[]}var kE=St(function(d,p){try{return zr(d,n,p)}catch(y){return ub(y)?y:new ct(y)}}),D8=Fi(function(d,p){return mo(p,function(y){y=ai(y),Ni(d,y,lb(d[y],d))}),d});function $8(d){var p=d==null?0:d.length,y=Je();return d=p?yn(d,function(E){if(typeof E[1]!="function")throw new vo(s);return[y(E[0]),E[1]]}):[],St(function(E){for(var M=-1;++M<p;){var j=d[M];if(zr(j[0],this,E))return zr(j[1],this,E)}})}function A8(d){return r7(yo(d,f))}function gb(d){return function(){return d}}function k8(d,p){return d==null||d!==d?p:d}var M8=NC(),I8=NC(!0);function Er(d){return d}function mb(d){return fC(typeof d=="function"?d:yo(d,f))}function N8(d){return pC(yo(d,f))}function L8(d,p){return gC(d,yo(p,f))}var F8=St(function(d,p){return function(y){return _u(y,d,p)}}),j8=St(function(d,p){return function(y){return _u(d,y,p)}});function vb(d,p,y){var E=Bn(p),M=wh(p,E);y==null&&!(wn(p)&&(M.length||!E.length))&&(y=p,p=d,d=this,M=wh(p,Bn(p)));var j=!(wn(y)&&"chain"in y)||!!y.chain,U=zi(d);return mo(M,function(X){var se=p[X];d[X]=se,U&&(d.prototype[X]=function(){var xe=this.__chain__;if(j||xe){var we=d(this.__wrapped__),Re=we.__actions__=_r(this.__actions__);return Re.push({func:se,args:arguments,thisArg:d}),we.__chain__=xe,we}return se.apply(d,ws([this.value()],arguments))})}),d}function z8(){return qn._===this&&(qn._=fF),this}function bb(){}function B8(d){return d=pt(d),St(function(p){return mC(p,d)})}var V8=Kv(yn),H8=Kv(LS),W8=Kv(xv);function ME(d){return nb(d)?wv(ai(d)):x7(d)}function U8(d){return function(p){return d==null?n:Ea(d,p)}}var q8=FC(),G8=FC(!0);function yb(){return[]}function xb(){return!1}function Y8(){return{}}function K8(){return""}function X8(){return!0}function Q8(d,p){if(d=pt(d),d<1||d>Y)return[];var y=H,E=nr(d,H);p=Je(p),d-=H;for(var M=Cv(E,p);++y<d;)p(y);return M}function J8(d){return ut(d)?yn(d,ai):Hr(d)?[d]:_r(eE(Ut(d)))}function Z8(d){var p=++uF;return Ut(d)+p}var ej=Oh(function(d,p){return d+p},0),tj=Xv("ceil"),nj=Oh(function(d,p){return d/p},1),rj=Xv("floor");function oj(d){return d&&d.length?xh(d,Er,Iv):n}function ij(d,p){return d&&d.length?xh(d,Je(p,2),Iv):n}function sj(d){return zS(d,Er)}function aj(d,p){return zS(d,Je(p,2))}function lj(d){return d&&d.length?xh(d,Er,jv):n}function cj(d,p){return d&&d.length?xh(d,Je(p,2),jv):n}var uj=Oh(function(d,p){return d*p},1),dj=Xv("round"),fj=Oh(function(d,p){return d-p},0);function hj(d){return d&&d.length?Sv(d,Er):0}function pj(d,p){return d&&d.length?Sv(d,Je(p,2)):0}return L.after=N9,L.ary=dE,L.assign=S4,L.assignIn=EE,L.assignInWith=zh,L.assignWith=C4,L.at=E4,L.before=fE,L.bind=lb,L.bindAll=D8,L.bindKey=hE,L.castArray=Y9,L.chain=lE,L.chunk=r6,L.compact=o6,L.concat=i6,L.cond=$8,L.conforms=A8,L.constant=gb,L.countBy=h9,L.create=R4,L.curry=pE,L.curryRight=gE,L.debounce=mE,L.defaults=O4,L.defaultsDeep=P4,L.defer=L9,L.delay=F9,L.difference=s6,L.differenceBy=a6,L.differenceWith=l6,L.drop=c6,L.dropRight=u6,L.dropRightWhile=d6,L.dropWhile=f6,L.fill=h6,L.filter=g9,L.flatMap=b9,L.flatMapDeep=y9,L.flatMapDepth=x9,L.flatten=oE,L.flattenDeep=p6,L.flattenDepth=g6,L.flip=j9,L.flow=M8,L.flowRight=I8,L.fromPairs=m6,L.functions=I4,L.functionsIn=N4,L.groupBy=w9,L.initial=b6,L.intersection=y6,L.intersectionBy=x6,L.intersectionWith=w6,L.invert=F4,L.invertBy=j4,L.invokeMap=S9,L.iteratee=mb,L.keyBy=C9,L.keys=Bn,L.keysIn=Cr,L.map=Mh,L.mapKeys=B4,L.mapValues=V4,L.matches=N8,L.matchesProperty=L8,L.memoize=Nh,L.merge=H4,L.mergeWith=RE,L.method=F8,L.methodOf=j8,L.mixin=vb,L.negate=Lh,L.nthArg=B8,L.omit=W4,L.omitBy=U4,L.once=z9,L.orderBy=E9,L.over=V8,L.overArgs=B9,L.overEvery=H8,L.overSome=W8,L.partial=cb,L.partialRight=vE,L.partition=R9,L.pick=q4,L.pickBy=OE,L.property=ME,L.propertyOf=U8,L.pull=E6,L.pullAll=sE,L.pullAllBy=R6,L.pullAllWith=O6,L.pullAt=P6,L.range=q8,L.rangeRight=G8,L.rearg=V9,L.reject=T9,L.remove=T6,L.rest=H9,L.reverse=sb,L.sampleSize=$9,L.set=Y4,L.setWith=K4,L.shuffle=A9,L.slice=D6,L.sortBy=I9,L.sortedUniq=L6,L.sortedUniqBy=F6,L.split=b8,L.spread=W9,L.tail=j6,L.take=z6,L.takeRight=B6,L.takeRightWhile=V6,L.takeWhile=H6,L.tap=o9,L.throttle=U9,L.thru=kh,L.toArray=_E,L.toPairs=PE,L.toPairsIn=TE,L.toPath=J8,L.toPlainObject=CE,L.transform=X4,L.unary=q9,L.union=W6,L.unionBy=U6,L.unionWith=q6,L.uniq=G6,L.uniqBy=Y6,L.uniqWith=K6,L.unset=Q4,L.unzip=ab,L.unzipWith=aE,L.update=J4,L.updateWith=Z4,L.values=Gl,L.valuesIn=e8,L.without=X6,L.words=AE,L.wrap=G9,L.xor=Q6,L.xorBy=J6,L.xorWith=Z6,L.zip=e9,L.zipObject=t9,L.zipObjectDeep=n9,L.zipWith=r9,L.entries=PE,L.entriesIn=TE,L.extend=EE,L.extendWith=zh,vb(L,L),L.add=ej,L.attempt=kE,L.camelCase=o8,L.capitalize=DE,L.ceil=tj,L.clamp=t8,L.clone=K9,L.cloneDeep=Q9,L.cloneDeepWith=J9,L.cloneWith=X9,L.conformsTo=Z9,L.deburr=$E,L.defaultTo=k8,L.divide=nj,L.endsWith=i8,L.eq=Bo,L.escape=s8,L.escapeRegExp=a8,L.every=p9,L.find=m9,L.findIndex=nE,L.findKey=T4,L.findLast=v9,L.findLastIndex=rE,L.findLastKey=D4,L.floor=rj,L.forEach=cE,L.forEachRight=uE,L.forIn=$4,L.forInRight=A4,L.forOwn=k4,L.forOwnRight=M4,L.get=fb,L.gt=e4,L.gte=t4,L.has=L4,L.hasIn=hb,L.head=iE,L.identity=Er,L.includes=_9,L.indexOf=v6,L.inRange=n8,L.invoke=z4,L.isArguments=Pa,L.isArray=ut,L.isArrayBuffer=n4,L.isArrayLike=Sr,L.isArrayLikeObject=On,L.isBoolean=r4,L.isBuffer=Ps,L.isDate=o4,L.isElement=i4,L.isEmpty=s4,L.isEqual=a4,L.isEqualWith=l4,L.isError=ub,L.isFinite=c4,L.isFunction=zi,L.isInteger=bE,L.isLength=Fh,L.isMap=yE,L.isMatch=u4,L.isMatchWith=d4,L.isNaN=f4,L.isNative=h4,L.isNil=g4,L.isNull=p4,L.isNumber=xE,L.isObject=wn,L.isObjectLike=Sn,L.isPlainObject=Pu,L.isRegExp=db,L.isSafeInteger=m4,L.isSet=wE,L.isString=jh,L.isSymbol=Hr,L.isTypedArray=ql,L.isUndefined=v4,L.isWeakMap=b4,L.isWeakSet=y4,L.join=_6,L.kebabCase=l8,L.last=wo,L.lastIndexOf=S6,L.lowerCase=c8,L.lowerFirst=u8,L.lt=x4,L.lte=w4,L.max=oj,L.maxBy=ij,L.mean=sj,L.meanBy=aj,L.min=lj,L.minBy=cj,L.stubArray=yb,L.stubFalse=xb,L.stubObject=Y8,L.stubString=K8,L.stubTrue=X8,L.multiply=uj,L.nth=C6,L.noConflict=z8,L.noop=bb,L.now=Ih,L.pad=d8,L.padEnd=f8,L.padStart=h8,L.parseInt=p8,L.random=r8,L.reduce=O9,L.reduceRight=P9,L.repeat=g8,L.replace=m8,L.result=G4,L.round=dj,L.runInContext=ne,L.sample=D9,L.size=k9,L.snakeCase=v8,L.some=M9,L.sortedIndex=$6,L.sortedIndexBy=A6,L.sortedIndexOf=k6,L.sortedLastIndex=M6,L.sortedLastIndexBy=I6,L.sortedLastIndexOf=N6,L.startCase=y8,L.startsWith=x8,L.subtract=fj,L.sum=hj,L.sumBy=pj,L.template=w8,L.times=Q8,L.toFinite=Bi,L.toInteger=pt,L.toLength=SE,L.toLower=_8,L.toNumber=_o,L.toSafeInteger=_4,L.toString=Ut,L.toUpper=S8,L.trim=C8,L.trimEnd=E8,L.trimStart=R8,L.truncate=O8,L.unescape=P8,L.uniqueId=Z8,L.upperCase=T8,L.upperFirst=pb,L.each=cE,L.eachRight=uE,L.first=iE,vb(L,function(){var d={};return ii(L,function(p,y){Qt.call(L.prototype,y)||(d[y]=p)}),d}(),{chain:!1}),L.VERSION=r,mo(["bind","bindKey","curry","curryRight","partial","partialRight"],function(d){L[d].placeholder=L}),mo(["drop","take"],function(d,p){kt.prototype[d]=function(y){y=y===n?1:Mn(pt(y),0);var E=this.__filtered__&&!p?new kt(this):this.clone();return E.__filtered__?E.__takeCount__=nr(y,E.__takeCount__):E.__views__.push({size:nr(y,H),type:d+(E.__dir__<0?"Right":"")}),E},kt.prototype[d+"Right"]=function(y){return this.reverse()[d](y).reverse()}}),mo(["filter","map","takeWhile"],function(d,p){var y=p+1,E=y==Z||y==Q;kt.prototype[d]=function(M){var j=this.clone();return j.__iteratees__.push({iteratee:Je(M,3),type:y}),j.__filtered__=j.__filtered__||E,j}}),mo(["head","last"],function(d,p){var y="take"+(p?"Right":"");kt.prototype[d]=function(){return this[y](1).value()[0]}}),mo(["initial","tail"],function(d,p){var y="drop"+(p?"":"Right");kt.prototype[d]=function(){return this.__filtered__?new kt(this):this[y](1)}}),kt.prototype.compact=function(){return this.filter(Er)},kt.prototype.find=function(d){return this.filter(d).head()},kt.prototype.findLast=function(d){return this.reverse().find(d)},kt.prototype.invokeMap=St(function(d,p){return typeof d=="function"?new kt(this):this.map(function(y){return _u(y,d,p)})}),kt.prototype.reject=function(d){return this.filter(Lh(Je(d)))},kt.prototype.slice=function(d,p){d=pt(d);var y=this;return y.__filtered__&&(d>0||p<0)?new kt(y):(d<0?y=y.takeRight(-d):d&&(y=y.drop(d)),p!==n&&(p=pt(p),y=p<0?y.dropRight(-p):y.take(p-d)),y)},kt.prototype.takeRightWhile=function(d){return this.reverse().takeWhile(d).reverse()},kt.prototype.toArray=function(){return this.take(H)},ii(kt.prototype,function(d,p){var y=/^(?:filter|find|map|reject)|While$/.test(p),E=/^(?:head|last)$/.test(p),M=L[E?"take"+(p=="last"?"Right":""):p],j=E||/^find/.test(p);M&&(L.prototype[p]=function(){var U=this.__wrapped__,X=E?[1]:arguments,se=U instanceof kt,xe=X[0],we=se||ut(U),Re=function(Pt){var Mt=M.apply(L,ws([Pt],X));return E&&je?Mt[0]:Mt};we&&y&&typeof xe=="function"&&xe.length!=1&&(se=we=!1);var je=this.__chain__,Ye=!!this.__actions__.length,et=j&&!je,yt=se&&!Ye;if(!j&&we){U=yt?U:new kt(this);var tt=d.apply(U,X);return tt.__actions__.push({func:kh,args:[Re],thisArg:n}),new bo(tt,je)}return et&&yt?d.apply(this,X):(tt=this.thru(Re),et?E?tt.value()[0]:tt.value():tt)})}),mo(["pop","push","shift","sort","splice","unshift"],function(d){var p=ih[d],y=/^(?:push|sort|unshift)$/.test(d)?"tap":"thru",E=/^(?:pop|shift)$/.test(d);L.prototype[d]=function(){var M=arguments;if(E&&!this.__chain__){var j=this.value();return p.apply(ut(j)?j:[],M)}return this[y](function(U){return p.apply(ut(U)?U:[],M)})}}),ii(kt.prototype,function(d,p){var y=L[p];if(y){var E=y.name+"";Qt.call(Bl,E)||(Bl[E]=[]),Bl[E].push({name:p,func:y})}}),Bl[Rh(n,w).name]=[{name:"wrapper",func:n}],kt.prototype.clone=PF,kt.prototype.reverse=TF,kt.prototype.value=DF,L.prototype.at=i9,L.prototype.chain=s9,L.prototype.commit=a9,L.prototype.next=l9,L.prototype.plant=u9,L.prototype.reverse=d9,L.prototype.toJSON=L.prototype.valueOf=L.prototype.value=f9,L.prototype.first=L.prototype.head,gu&&(L.prototype[gu]=c9),L},Fl=aF();xa?((xa.exports=Fl)._=Fl,mv._=Fl):qn._=Fl}).call(Vs)})(hg,hg.exports);var uc=hg.exports;const ol=nu(uc);function eR({id:e,layouts:t,initialHeight:n,y:r,x:o,w:i,minH:s}){const a={i:e,x:o??0,y:r??1/0,w:i||20,h:n||35,minW:6,minH:s||10};return t||(t={}),vw.forEach(l=>{t!=null&&t[l]||(t={...t,[l]:[]});const c=t[l].reduce((u,f)=>Math.max(u,f.y+f.h),0);a.y=a.y===0?0:c,t[l].push(a)}),t}function tR(e,t){t&&vw.forEach(n=>{t!=null&&t[n]&&(t[n]=t[n].filter(r=>r.i!==e))})}const ke=X2()(rD((e,t)=>({isSessionExpired:!1,currentBreakpoint:"lg",dashboard:{id:"",style:x0},showContext:!1,selectedSheetId:null,selectedCardId:null,selectedFrameId:null,selectedCard:null,showFilters:!1,isDashboardEditing:!1,isVisualEditing:!1,showDashboardJSON:!1,filteringCards:[],actions:{deleteSheet:n=>{e(r=>{var i,s,a,l;const o=(i=r.dashboard.sheets)==null?void 0:i.findIndex(c=>c.id===n);o!==void 0&&o>-1&&((s=r.dashboard.sheets)==null||s.splice(o,1),r.selectedSheetId=(l=(a=r.dashboard.sheets)==null?void 0:a[0])==null?void 0:l.id)})},addSheet:n=>{e(r=>{r.dashboard.sheets||(r.dashboard.sheets=[]);const o=r.dashboard.filters;let i={};o==null||o.forEach(a=>{vw.forEach(l=>{i!=null&&i[l]||(i={...i,[l]:[]});const c={i:a.id,x:0,y:0,w:10,h:8};i[l].push(c)})});const s={...n,layouts:i};r.dashboard.sheets.push(s)})},setGlobalStyle:n=>{e(r=>{r.dashboard.globalStyle=n})},setAIScopeTables:n=>{e(r=>{r.dashboard.aiScopeTables=n})},setIsSessionExpired:n=>{e(()=>({isSessionExpired:n}))},setCardPython:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===o.selectedSheetId);i&&uc.forEach(i.frames,l=>{var u;const c=(u=l.cards)==null?void 0:u.find(f=>f.id===n);c&&(c.python=r)})})},addBaseQuery:n=>{e(r=>{var o;r.dashboard.baseQueries||(r.dashboard.baseQueries=[]),(o=r.dashboard.baseQueries)==null||o.push(n)})},removeBaseQuery:n=>{e(r=>{var i,s;const o=(i=r.dashboard.baseQueries)==null?void 0:i.findIndex(a=>a.id===n);o!=null&&o>-1&&((s=r.dashboard.baseQueries)==null||s.splice(o,1))})},setBaseQueries:n=>{e(r=>{r.dashboard.baseQueries=n})},setCurrentBreakpoint:n=>{e(()=>({currentBreakpoint:n}))},addFilteringCard:n=>{e(r=>{var o;(o=r.filteringCards)==null||o.push(n)})},removeFilteringCard:n=>{e(r=>{var i,s;const o=(i=r.filteringCards)==null?void 0:i.findIndex(a=>a.id===n.id);o!==void 0&&o>-1&&((s=r.filteringCards)==null||s.splice(o,1))})},setCustomCards:n=>{e(r=>{r.dashboard.customCards=n})},setAuthToken:n=>{e(()=>({authToken:n}))},setThemeStyle:n=>{e(()=>({themeStyle:n}))},setDashboard:n=>e({dashboard:n}),setBookmarkKey:n=>{e(()=>({bookmarkKey:n}))},setDashboardTheme:n=>{e(r=>{r.theme=n})},setSheets:n=>{e(r=>{r.dashboard&&(r.dashboard.sheets=n)})},setSheetTitle:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.title=r)})},setCardTitle:(n,r,o)=>{e(i=>{var a,l;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.title=o)})})},setCardInfo:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===o.selectedSheetId);i&&uc.forEach(i.frames,l=>{var u;const c=(u=l.cards)==null?void 0:u.find(f=>f.id===n);c&&(c.info=r)})})},setCardDescription:(n,r,o)=>{e(i=>{var a,l;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.description=o)})})},setCardSql:(n,r,o)=>{e(i=>{var a,l,c,u;const s=(l=(a=i.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(h=>h.id===r);f&&(f.sql=o,(u=i.onUpdateCard)==null||u.call(i,f,n))}})},setFrameCardData:(n,r,o)=>{e(i=>{var a,l;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.data=o)})})},setSheetLayout:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.layout=r)})},setSheetLayouts:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.layouts=r)})},setShowContext:n=>{e(()=>({showContext:n}))},setShowFilters:n=>{e(()=>({showFilters:n}))},setFilterValues:n=>{e(()=>({filterValues:n}))},addOrUpdateFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.findIndex(i=>i.filterId===n.filterId);o>-1?r.filterValues.splice(o,1,n):r.filterValues.push(n)}else r.filterValues=[n]})},addOrUpdateFilterValues:n=>{e(r=>{r.filterValues?n.forEach(o=>{var s,a,l;const i=(s=r==null?void 0:r.filterValues)==null?void 0:s.findIndex(c=>c.filterId===o.filterId);i!==void 0&&i>-1?(a=r.filterValues)==null||a.splice(i,1,o):(l=r.filterValues)==null||l.push(o)}):r.filterValues=n})},removeFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.filter(i=>i.filterId!==n&&!i.filterId.startsWith(n));r.filterValues=o}})},replaceFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.findIndex(i=>i.filterId===n.filterId);o>-1&&r.filterValues.splice(o,1,n)}})},addFilter:n=>{e(r=>{var i,s;r.dashboard.filters?(i=r.dashboard.filters)==null||i.push(n):r.dashboard.filters=[n];const o=(s=r.dashboard.sheets)==null?void 0:s.find(a=>a.id===r.selectedSheetId);eR({id:n.id,layouts:o==null?void 0:o.layouts,y:0,initialHeight:8,minH:7,w:10})})},removeFilter:n=>{e(r=>{var o,i,s;if(r.dashboard.filters){const a=(o=r.dashboard.filters)==null?void 0:o.findIndex(l=>l.id===n);if(a>-1){(i=r.dashboard.filters)==null||i.splice(a,1);const l=(s=r.dashboard.sheets)==null?void 0:s.find(c=>c.id===r.selectedSheetId);tR(n,l==null?void 0:l.layouts)}}})},updateFrameCard:(n,r,o)=>{e(i=>{var l,c,u,f,h;const s=(c=(l=i.dashboard)==null?void 0:l.sheets)==null?void 0:c.find(g=>g.id===n);if(!s)return;const a=(u=s==null?void 0:s.frames)==null?void 0:u.find(g=>g.id===r);if(a){const g=(f=a.cards)==null?void 0:f.findIndex(v=>v.id===o.id);g>-1&&((h=a.cards)==null||h.splice(g,1,o))}})},updateFilter:n=>{e(r=>{var o,i;if(r.dashboard.filters){const s=(o=r.dashboard.filters)==null?void 0:o.findIndex(a=>a.id===n.id);s>-1&&((i=r.dashboard.filters)==null||i.splice(s,1,n))}})},setIsDashboardEditing:n=>{e(()=>({isDashboardEditing:n}))},setShowDashboardJSON:n=>{e(()=>({showDashboardJSON:n}))},setIsVisualEditing:n=>{e(()=>({isVisualEditing:n}))},addFrame:(n,r,o)=>{e(i=>{var a,l,c,u;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n);if(s){s.frames||(s.frames=[]),(c=s.frames)==null||c.push(r);let f=1/0,h=0;o==="start"&&(f=0),eR({id:r.id,layouts:s.layouts,minH:10,x:h,y:f}),(u=i.onAddFrame)==null||u.call(i,r,n)}})},removeFrame:(n,r)=>{e(o=>{var s,a,l,c,u;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(f=>f.id===n);if(i){const f=(l=i.frames)==null?void 0:l.findIndex(h=>h.id===r);console.log(f),typeof f=="number"&&f>-1&&((c=i.frames)==null||c.splice(f,1),(u=i.layout)==null||u.splice(f,1),tR(r,i.layouts))}})},updateFrame:(n,r)=>{e(o=>{var a,l,c,u;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n),s=(c=i==null?void 0:i.frames)==null?void 0:c.findIndex(f=>f.id===r.id);i&&((u=i.frames)==null||u.splice(s,1,r))})},updateCard:(n,r)=>{e(o=>{var a,l,c,u,f;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(h=>h.id===r.id);i&&((u=i.cards)==null||u.splice(s,1,r),(f=o.onUpdateCard)==null||f.call(o,r,n))})},removeCard:(n,r)=>{e(o=>{var a,l,c,u,f,h;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(g=>g.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(g=>g.id===r.id);i&&((u=i.cards)==null||u.splice(s,1),(f=i.layout)==null||f.splice(s,1),(h=o.onRemoveCard)==null||h.call(o,r,n))})},setStyle:n=>{e(r=>{r.dashboard&&(r.dashboard.style=n)})},setSelectedCardId:(n,r)=>{e(o=>{var s,a,l;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===n);i&&(((l=i.cards)==null?void 0:l.find(u=>u.id===r))?o.selectedCardId=r:o.selectedCardId=null)})},setSelectedFrameId:n=>{e(r=>{var i,s;((s=(i=r.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(a=>a.id===r.selectedSheetId))&&(r.selectedFrameId=n)})},setSelectedSheetId:n=>{e(r=>{var i,s;((s=(i=r.dashboard)==null?void 0:i.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(o=>o.id===t().selectedSheetId)},getSelectedFrame:()=>{var r,o,i;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(s=>s.id===t().selectedSheetId);return(i=n==null?void 0:n.frames)==null?void 0:i.find(s=>s.id===t().selectedFrameId)},getCard:n=>{var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a)for(let l=0;l<a.length;l++){const c=(i=a[l].cards)==null?void 0:i.find(u=>u.id===n);if(c)return c}}},getSelectedSheetLayout:()=>{var r,o;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(i=>i.id===t().selectedSheetId);return n==null?void 0:n.layout},getSelectedSheetLayouts:()=>{var r,o;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(i=>i.id===t().selectedSheetId);return n==null?void 0:n.layouts},getStyle:()=>{var n;return(n=t().dashboard)==null?void 0:n.style},getCardSheet(n){var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a){for(let l=0;l<a.length;l++)if((i=a[l].cards)==null?void 0:i.find(u=>u.id===n))return r[s]}}},handleDataPointClickAction:(n,r)=>{Iz({card:n,dataPoint:r,set:e,get:t})}}}))),Mo=()=>ke(e=>e.actions);var Pf=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(){}},Hc=typeof window>"u"||"Deno"in window;function Oo(){}function Nz(e,t){return typeof e=="function"?e(t):e}function _0(e){return typeof e=="number"&&e>=0&&e!==1/0}function cD(e,t){return Math.max(e+(t||0)-Date.now(),0)}function nR(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==xw(s,t.options))return!1}else if(!Dd(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 o<"u"&&o!==t.state.fetchStatus||i&&!i(t))}function rR(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Td(t.options.mutationKey)!==Td(i))return!1}else if(!Dd(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function xw(e,t){return((t==null?void 0:t.queryKeyHashFn)||Td)(e)}function Td(e){return JSON.stringify(e,(t,n)=>C0(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Dd(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Dd(e[n],t[n])):!1}function uD(e,t){if(e===t)return e;const n=oR(e)&&oR(t);if(n||C0(e)&&C0(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let l=0;for(let c=0;c<s;c++){const u=n?c:i[c];!n&&e[u]===void 0&&t[u]===void 0&&r.includes(u)?(a[u]=void 0,l++):(a[u]=uD(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&l++)}return o===s&&l===o?e:a}return t}function S0(e,t){if(e&&!t||t&&!e)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function oR(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function C0(e){if(!iR(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!iR(n)||!n.hasOwnProperty("isPrototypeOf"))}function iR(e){return Object.prototype.toString.call(e)==="[object Object]"}function Lz(e){return new Promise(t=>{setTimeout(t,e)})}function E0(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?uD(e,t):t}function Fz(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function jz(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Xa,Hs,Cc,A2,zz=(A2=class extends Pf{constructor(){super();Xe(this,Xa,void 0);Xe(this,Hs,void 0);Xe(this,Cc,void 0);Ve(this,Cc,t=>{if(!Hc&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){re(this,Hs)||this.setEventListener(re(this,Cc))}onUnsubscribe(){var t;this.hasListeners()||((t=re(this,Hs))==null||t.call(this),Ve(this,Hs,void 0))}setEventListener(t){var n;Ve(this,Cc,t),(n=re(this,Hs))==null||n.call(this),Ve(this,Hs,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){re(this,Xa)!==t&&(Ve(this,Xa,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof re(this,Xa)=="boolean"?re(this,Xa):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Xa=new WeakMap,Hs=new WeakMap,Cc=new WeakMap,A2),pg=new zz,Ec,Ws,Rc,k2,Bz=(k2=class extends Pf{constructor(){super();Xe(this,Ec,!0);Xe(this,Ws,void 0);Xe(this,Rc,void 0);Ve(this,Rc,t=>{if(!Hc&&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(){re(this,Ws)||this.setEventListener(re(this,Rc))}onUnsubscribe(){var t;this.hasListeners()||((t=re(this,Ws))==null||t.call(this),Ve(this,Ws,void 0))}setEventListener(t){var n;Ve(this,Rc,t),(n=re(this,Ws))==null||n.call(this),Ve(this,Ws,t(this.setOnline.bind(this)))}setOnline(t){re(this,Ec)!==t&&(Ve(this,Ec,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return re(this,Ec)}},Ec=new WeakMap,Ws=new WeakMap,Rc=new WeakMap,k2),gg=new Bz;function Vz(e){return Math.min(1e3*2**e,3e4)}function om(e){return(e??"online")==="online"?gg.isOnline():!0}var dD=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Tb(e){return e instanceof dD}function fD(e){let t=!1,n=0,r=!1,o,i,s;const a=new Promise((x,w)=>{i=x,s=w}),l=x=>{var w;r||(g(new dD(x)),(w=e.abort)==null||w.call(e))},c=()=>{t=!0},u=()=>{t=!1},f=()=>!pg.isFocused()||e.networkMode!=="always"&&!gg.isOnline(),h=x=>{var w;r||(r=!0,(w=e.onSuccess)==null||w.call(e,x),o==null||o(),i(x))},g=x=>{var w;r||(r=!0,(w=e.onError)==null||w.call(e,x),o==null||o(),s(x))},v=()=>new Promise(x=>{var w;o=_=>{const S=r||!f();return S&&x(_),S},(w=e.onPause)==null||w.call(e)}).then(()=>{var x;o=void 0,r||(x=e.onContinue)==null||x.call(e)}),b=()=>{if(r)return;let x;try{x=e.fn()}catch(w){x=Promise.reject(w)}Promise.resolve(x).then(h).catch(w=>{var P;if(r)return;const _=e.retry??(Hc?0:3),S=e.retryDelay??Vz,R=typeof S=="function"?S(n,w):S,C=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,w);if(t||!C){g(w);return}n++,(P=e.onFail)==null||P.call(e,n,w),Lz(R).then(()=>{if(f())return v()}).then(()=>{t?g(w):b()})})};return om(e.networkMode)?b():v().then(b),{promise:a,cancel:l,continue:()=>(o==null?void 0:o())?a:Promise.resolve(),cancelRetry:c,continueRetry:u}}function Hz(){let e=[],t=0,n=h=>{h()},r=h=>{h()},o=h=>setTimeout(h,0);const i=h=>{o=h},s=h=>{let g;t++;try{g=h()}finally{t--,t||c()}return g},a=h=>{t?e.push(h):o(()=>{n(h)})},l=h=>(...g)=>{a(()=>{h(...g)})},c=()=>{const h=e;e=[],h.length&&o(()=>{r(()=>{h.forEach(g=>{n(g)})})})};return{batch:s,batchCalls:l,schedule:a,setNotifyFunction:h=>{n=h},setBatchNotifyFunction:h=>{r=h},setScheduler:i}}var Xn=Hz(),Qa,M2,hD=(M2=class{constructor(){Xe(this,Qa,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),_0(this.gcTime)&&Ve(this,Qa,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Hc?1/0:5*60*1e3))}clearGcTimeout(){re(this,Qa)&&(clearTimeout(re(this,Qa)),Ve(this,Qa,void 0))}},Qa=new WeakMap,M2),Oc,Pc,Co,Us,Eo,Vn,pf,Ja,Tc,Kp,Go,qi,I2,Wz=(I2=class extends hD{constructor(t){super();Xe(this,Tc);Xe(this,Go);Xe(this,Oc,void 0);Xe(this,Pc,void 0);Xe(this,Co,void 0);Xe(this,Us,void 0);Xe(this,Eo,void 0);Xe(this,Vn,void 0);Xe(this,pf,void 0);Xe(this,Ja,void 0);Ve(this,Ja,!1),Ve(this,pf,t.defaultOptions),Ct(this,Tc,Kp).call(this,t.options),Ve(this,Vn,[]),Ve(this,Co,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Ve(this,Oc,t.state||Uz(this.options)),this.state=re(this,Oc),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!re(this,Vn).length&&this.state.fetchStatus==="idle"&&re(this,Co).remove(this)}setData(t,n){const r=E0(this.state.data,t,this.options);return Ct(this,Go,qi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Ct(this,Go,qi).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r;const n=re(this,Us);return(r=re(this,Eo))==null||r.cancel(t),n?n.then(Oo).catch(Oo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(re(this,Oc))}isActive(){return re(this,Vn).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||re(this,Vn).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!cD(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=re(this,Vn).find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=re(this,Eo))==null||n.continue()}onOnline(){var n;const t=re(this,Vn).find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=re(this,Eo))==null||n.continue()}addObserver(t){re(this,Vn).includes(t)||(re(this,Vn).push(t),this.clearGcTimeout(),re(this,Co).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){re(this,Vn).includes(t)&&(Ve(this,Vn,re(this,Vn).filter(n=>n!==t)),re(this,Vn).length||(re(this,Eo)&&(re(this,Ja)?re(this,Eo).cancel({revert:!0}):re(this,Eo).cancelRetry()),this.scheduleGc()),re(this,Co).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return re(this,Vn).length}invalidate(){this.state.isInvalidated||Ct(this,Go,qi).call(this,{type:"invalidate"})}fetch(t,n){var c,u,f,h;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(re(this,Us))return(c=re(this,Eo))==null||c.continueRetry(),re(this,Us)}if(t&&Ct(this,Tc,Kp).call(this,t),!this.options.queryFn){const g=re(this,Vn).find(v=>v.options.queryFn);g&&Ct(this,Tc,Kp).call(this,g.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,o={queryKey:this.queryKey,meta:this.meta},i=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(Ve(this,Ja,!0),r.signal)})};i(o);const s=()=>this.options.queryFn?(Ve(this,Ja,!1),this.options.persister?this.options.persister(this.options.queryFn,o,this):this.options.queryFn(o)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),a={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:s};i(a),(u=this.options.behavior)==null||u.onFetch(a,this),Ve(this,Pc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&Ct(this,Go,qi).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta});const l=g=>{var v,b,x,w;Tb(g)&&g.silent||Ct(this,Go,qi).call(this,{type:"error",error:g}),Tb(g)||((b=(v=re(this,Co).config).onError)==null||b.call(v,g,this),(w=(x=re(this,Co).config).onSettled)==null||w.call(x,this.state.data,g,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return Ve(this,Eo,fD({fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:g=>{var v,b,x,w;if(typeof g>"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(g),(b=(v=re(this,Co).config).onSuccess)==null||b.call(v,g,this),(w=(x=re(this,Co).config).onSettled)==null||w.call(x,g,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:l,onFail:(g,v)=>{Ct(this,Go,qi).call(this,{type:"failed",failureCount:g,error:v})},onPause:()=>{Ct(this,Go,qi).call(this,{type:"pause"})},onContinue:()=>{Ct(this,Go,qi).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode})),Ve(this,Us,re(this,Eo).promise),re(this,Us)}},Oc=new WeakMap,Pc=new WeakMap,Co=new WeakMap,Us=new WeakMap,Eo=new WeakMap,Vn=new WeakMap,pf=new WeakMap,Ja=new WeakMap,Tc=new WeakSet,Kp=function(t){this.options={...re(this,pf),...t},this.updateGcTime(this.options.gcTime)},Go=new WeakSet,qi=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:om(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 o=t.error;return Tb(o)&&o.revert&&re(this,Pc)?{...re(this,Pc),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Xn.batch(()=>{re(this,Vn).forEach(r=>{r.onQueryUpdate()}),re(this,Co).notify({query:this,type:"updated",action:t})})},I2);function Uz(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 fi,N2,pD=(N2=class extends Pf{constructor(t={}){super();Xe(this,fi,void 0);this.config=t,Ve(this,fi,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??xw(o,n);let s=this.get(i);return s||(s=new Wz({cache:this,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){re(this,fi).has(t.queryHash)||(re(this,fi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=re(this,fi).get(t.queryHash);n&&(t.destroy(),n===t&&re(this,fi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Xn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return re(this,fi).get(t)}getAll(){return[...re(this,fi).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>nR(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>nR(t,r)):n}notify(t){Xn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Xn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Xn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},fi=new WeakMap,N2),hi,gf,Xr,Dc,pi,Ls,L2,qz=(L2=class extends hD{constructor(t){super();Xe(this,pi);Xe(this,hi,void 0);Xe(this,gf,void 0);Xe(this,Xr,void 0);Xe(this,Dc,void 0);this.mutationId=t.mutationId,Ve(this,gf,t.defaultOptions),Ve(this,Xr,t.mutationCache),Ve(this,hi,[]),this.state=t.state||Gz(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...re(this,gf),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){re(this,hi).includes(t)||(re(this,hi).push(t),this.clearGcTimeout(),re(this,Xr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Ve(this,hi,re(this,hi).filter(n=>n!==t)),this.scheduleGc(),re(this,Xr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){re(this,hi).length||(this.state.status==="pending"?this.scheduleGc():re(this,Xr).remove(this))}continue(){var t;return((t=re(this,Dc))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,c,u,f,h,g,v,b,x,w,_,S,R,C,P,A;const n=()=>(Ve(this,Dc,fD({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(k,D)=>{Ct(this,pi,Ls).call(this,{type:"failed",failureCount:k,error:D})},onPause:()=>{Ct(this,pi,Ls).call(this,{type:"pause"})},onContinue:()=>{Ct(this,pi,Ls).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),re(this,Dc).promise),r=this.state.status==="pending";try{if(!r){Ct(this,pi,Ls).call(this,{type:"pending",variables:t}),await((i=(o=re(this,Xr).config).onMutate)==null?void 0:i.call(o,t,this));const D=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));D!==this.state.context&&Ct(this,pi,Ls).call(this,{type:"pending",context:D,variables:t})}const k=await n();return await((c=(l=re(this,Xr).config).onSuccess)==null?void 0:c.call(l,k,t,this.state.context,this)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,k,t,this.state.context)),await((g=(h=re(this,Xr).config).onSettled)==null?void 0:g.call(h,k,null,this.state.variables,this.state.context,this)),await((b=(v=this.options).onSettled)==null?void 0:b.call(v,k,null,t,this.state.context)),Ct(this,pi,Ls).call(this,{type:"success",data:k}),k}catch(k){try{throw await((w=(x=re(this,Xr).config).onError)==null?void 0:w.call(x,k,t,this.state.context,this)),await((S=(_=this.options).onError)==null?void 0:S.call(_,k,t,this.state.context)),await((C=(R=re(this,Xr).config).onSettled)==null?void 0:C.call(R,void 0,k,this.state.variables,this.state.context,this)),await((A=(P=this.options).onSettled)==null?void 0:A.call(P,void 0,k,t,this.state.context)),k}finally{Ct(this,pi,Ls).call(this,{type:"error",error:k})}}}},hi=new WeakMap,gf=new WeakMap,Xr=new WeakMap,Dc=new WeakMap,pi=new WeakSet,Ls=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:!om(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),Xn.batch(()=>{re(this,hi).forEach(r=>{r.onMutationUpdate(t)}),re(this,Xr).notify({mutation:this,type:"updated",action:t})})},L2);function Gz(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ro,mf,Za,F2,Yz=(F2=class extends Pf{constructor(t={}){super();Xe(this,Ro,void 0);Xe(this,mf,void 0);Xe(this,Za,void 0);this.config=t,Ve(this,Ro,[]),Ve(this,mf,0)}build(t,n,r){const o=new qz({mutationCache:this,mutationId:++Bh(this,mf)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){re(this,Ro).push(t),this.notify({type:"added",mutation:t})}remove(t){Ve(this,Ro,re(this,Ro).filter(n=>n!==t)),this.notify({type:"removed",mutation:t})}clear(){Xn.batch(()=>{re(this,Ro).forEach(t=>{this.remove(t)})})}getAll(){return re(this,Ro)}find(t){const n={exact:!0,...t};return re(this,Ro).find(r=>rR(n,r))}findAll(t={}){return re(this,Ro).filter(n=>rR(t,n))}notify(t){Xn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){return Ve(this,Za,(re(this,Za)??Promise.resolve()).then(()=>{const t=re(this,Ro).filter(n=>n.state.isPaused);return Xn.batch(()=>t.reduce((n,r)=>n.then(()=>r.continue().catch(Oo)),Promise.resolve()))}).then(()=>{Ve(this,Za,void 0)})),re(this,Za)}},Ro=new WeakMap,mf=new WeakMap,Za=new WeakMap,F2);function Kz(e){return{onFetch:(t,n)=>{const r=async()=>{var v,b,x,w,_;const o=t.options,i=(x=(b=(v=t.fetchOptions)==null?void 0:v.meta)==null?void 0:b.fetchMore)==null?void 0:x.direction,s=((w=t.state.data)==null?void 0:w.pages)||[],a=((_=t.state.data)==null?void 0:_.pageParams)||[],l={pages:[],pageParams:[]};let c=!1;const u=S=>{Object.defineProperty(S,"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}'`))),h=async(S,R,C)=>{if(c)return Promise.reject();if(R==null&&S.pages.length)return Promise.resolve(S);const P={queryKey:t.queryKey,pageParam:R,direction:C?"backward":"forward",meta:t.options.meta};u(P);const A=await f(P),{maxPages:k}=t.options,D=C?jz:Fz;return{pages:D(S.pages,A,k),pageParams:D(S.pageParams,R,k)}};let g;if(i&&s.length){const S=i==="backward",R=S?Xz:sR,C={pages:s,pageParams:a},P=R(o,C);g=await h(C,P,S)}else{g=await h(l,a[0]??o.initialPageParam);const S=e??s.length;for(let R=1;R<S;R++){const C=sR(o,g);g=await h(g,C)}}return g};t.options.persister?t.fetchFn=()=>{var o,i;return(i=(o=t.options).persister)==null?void 0:i.call(o,r,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=r}}}function sR(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function Xz(e,{pages:t,pageParams:n}){var r;return(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n)}var In,qs,Gs,$c,Ac,Ys,kc,Mc,j2,Qz=(j2=class{constructor(e={}){Xe(this,In,void 0);Xe(this,qs,void 0);Xe(this,Gs,void 0);Xe(this,$c,void 0);Xe(this,Ac,void 0);Xe(this,Ys,void 0);Xe(this,kc,void 0);Xe(this,Mc,void 0);Ve(this,In,e.queryCache||new pD),Ve(this,qs,e.mutationCache||new Yz),Ve(this,Gs,e.defaultOptions||{}),Ve(this,$c,new Map),Ve(this,Ac,new Map),Ve(this,Ys,0)}mount(){Bh(this,Ys)._++,re(this,Ys)===1&&(Ve(this,kc,pg.subscribe(()=>{pg.isFocused()&&(this.resumePausedMutations(),re(this,In).onFocus())})),Ve(this,Mc,gg.subscribe(()=>{gg.isOnline()&&(this.resumePausedMutations(),re(this,In).onOnline())})))}unmount(){var e,t;Bh(this,Ys)._--,re(this,Ys)===0&&((e=re(this,kc))==null||e.call(this),Ve(this,kc,void 0),(t=re(this,Mc))==null||t.call(this),Ve(this,Mc,void 0))}isFetching(e){return re(this,In).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return re(this,qs).findAll({...e,status:"pending"}).length}getQueryData(e){var t;return(t=re(this,In).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=re(this,In).find({queryKey:e}),o=r==null?void 0:r.state.data,i=Nz(t,o);if(typeof i>"u")return;const s=this.defaultQueryOptions({queryKey:e});return re(this,In).build(this,s).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Xn.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var t;return(t=re(this,In).find({queryKey:e}))==null?void 0:t.state}removeQueries(e){const t=re(this,In);Xn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=re(this,In),r={type:"active",...e};return Xn.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=Xn.batch(()=>re(this,In).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Oo).catch(Oo)}invalidateQueries(e={},t={}){return Xn.batch(()=>{if(re(this,In).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=Xn.batch(()=>re(this,In).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Oo)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Oo)}fetchQuery(e){const t=this.defaultQueryOptions(e);typeof t.retry>"u"&&(t.retry=!1);const n=re(this,In).build(this,t);return n.isStaleByTime(t.staleTime)?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Oo).catch(Oo)}fetchInfiniteQuery(e){return e.behavior=Kz(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Oo).catch(Oo)}resumePausedMutations(){return re(this,qs).resumePausedMutations()}getQueryCache(){return re(this,In)}getMutationCache(){return re(this,qs)}getDefaultOptions(){return re(this,Gs)}setDefaultOptions(e){Ve(this,Gs,e)}setQueryDefaults(e,t){re(this,$c).set(Td(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...re(this,$c).values()];let n={};return t.forEach(r=>{Dd(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){re(this,Ac).set(Td(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...re(this,Ac).values()];let n={};return t.forEach(r=>{Dd(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const t={...re(this,Gs).queries,...(e==null?void 0:e.queryKey)&&this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=xw(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:{...re(this,Gs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){re(this,In).clear(),re(this,qs).clear()}},In=new WeakMap,qs=new WeakMap,Gs=new WeakMap,$c=new WeakMap,Ac=new WeakMap,Ys=new WeakMap,kc=new WeakMap,Mc=new WeakMap,j2),$r,fn,vf,vr,el,Ic,gi,bf,Nc,Lc,tl,nl,Ks,Fc,rl,Zu,yf,R0,xf,O0,wf,P0,_f,T0,Sf,D0,Cf,$0,Ef,A0,Jg,gD,z2,Jz=(z2=class extends Pf{constructor(t,n){super();Xe(this,rl);Xe(this,yf);Xe(this,xf);Xe(this,wf);Xe(this,_f);Xe(this,Sf);Xe(this,Cf);Xe(this,Ef);Xe(this,Jg);Xe(this,$r,void 0);Xe(this,fn,void 0);Xe(this,vf,void 0);Xe(this,vr,void 0);Xe(this,el,void 0);Xe(this,Ic,void 0);Xe(this,gi,void 0);Xe(this,bf,void 0);Xe(this,Nc,void 0);Xe(this,Lc,void 0);Xe(this,tl,void 0);Xe(this,nl,void 0);Xe(this,Ks,void 0);Xe(this,Fc,new Set);this.options=n,Ve(this,$r,t),Ve(this,gi,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(re(this,fn).addObserver(this),aR(re(this,fn),this.options)?Ct(this,rl,Zu).call(this):this.updateResult(),Ct(this,_f,T0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return k0(re(this,fn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return k0(re(this,fn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ct(this,Sf,D0).call(this),Ct(this,Cf,$0).call(this),re(this,fn).removeObserver(this)}setOptions(t,n){const r=this.options,o=re(this,fn);if(this.options=re(this,$r).defaultQueryOptions(t),S0(r,this.options)||re(this,$r).getQueryCache().notify({type:"observerOptionsUpdated",query:re(this,fn),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),Ct(this,Ef,A0).call(this);const i=this.hasListeners();i&&lR(re(this,fn),o,this.options,r)&&Ct(this,rl,Zu).call(this),this.updateResult(n),i&&(re(this,fn)!==o||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&Ct(this,yf,R0).call(this);const s=Ct(this,xf,O0).call(this);i&&(re(this,fn)!==o||this.options.enabled!==r.enabled||s!==re(this,Ks))&&Ct(this,wf,P0).call(this,s)}getOptimisticResult(t){const n=re(this,$r).getQueryCache().build(re(this,$r),t),r=this.createResult(n,t);return eB(this,r)&&(Ve(this,vr,r),Ve(this,Ic,this.options),Ve(this,el,re(this,fn).state)),r}getCurrentResult(){return re(this,vr)}trackResult(t){const n={};return Object.keys(t).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(re(this,Fc).add(r),t[r])})}),n}getCurrentQuery(){return re(this,fn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=re(this,$r).defaultQueryOptions(t),r=re(this,$r).getQueryCache().build(re(this,$r),n);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Ct(this,rl,Zu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),re(this,vr)))}createResult(t,n){var P;const r=re(this,fn),o=this.options,i=re(this,vr),s=re(this,el),a=re(this,Ic),c=t!==r?t.state:re(this,vf),{state:u}=t;let{error:f,errorUpdatedAt:h,fetchStatus:g,status:v}=u,b=!1,x;if(n._optimisticResults){const A=this.hasListeners(),k=!A&&aR(t,n),D=A&&lR(t,r,n,o);(k||D)&&(g=om(t.options.networkMode)?"fetching":"paused",u.dataUpdatedAt||(v="pending")),n._optimisticResults==="isRestoring"&&(g="idle")}if(n.select&&typeof u.data<"u")if(i&&u.data===(s==null?void 0:s.data)&&n.select===re(this,bf))x=re(this,Nc);else try{Ve(this,bf,n.select),x=n.select(u.data),x=E0(i==null?void 0:i.data,x,n),Ve(this,Nc,x),Ve(this,gi,null)}catch(A){Ve(this,gi,A)}else x=u.data;if(typeof n.placeholderData<"u"&&typeof x>"u"&&v==="pending"){let A;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))A=i.data;else if(A=typeof n.placeholderData=="function"?n.placeholderData((P=re(this,Lc))==null?void 0:P.state.data,re(this,Lc)):n.placeholderData,n.select&&typeof A<"u")try{A=n.select(A),Ve(this,gi,null)}catch(k){Ve(this,gi,k)}typeof A<"u"&&(v="success",x=E0(i==null?void 0:i.data,A,n),b=!0)}re(this,gi)&&(f=re(this,gi),x=re(this,Nc),h=Date.now(),v="error");const w=g==="fetching",_=v==="pending",S=v==="error",R=_&&w;return{status:v,fetchStatus:g,isPending:_,isSuccess:v==="success",isError:S,isInitialLoading:R,isLoading:R,data:x,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:h,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:w,isRefetching:w&&!_,isLoadingError:S&&u.dataUpdatedAt===0,isPaused:g==="paused",isPlaceholderData:b,isRefetchError:S&&u.dataUpdatedAt!==0,isStale:ww(t,n),refetch:this.refetch}}updateResult(t){const n=re(this,vr),r=this.createResult(re(this,fn),this.options);if(Ve(this,el,re(this,fn).state),Ve(this,Ic,this.options),re(this,el).data!==void 0&&Ve(this,Lc,re(this,fn)),S0(r,n))return;Ve(this,vr,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!re(this,Fc).size)return!0;const l=new Set(a??re(this,Fc));return this.options.throwOnError&&l.add("error"),Object.keys(re(this,vr)).some(c=>{const u=c;return re(this,vr)[u]!==n[u]&&l.has(u)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),Ct(this,Jg,gD).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ct(this,_f,T0).call(this)}},$r=new WeakMap,fn=new WeakMap,vf=new WeakMap,vr=new WeakMap,el=new WeakMap,Ic=new WeakMap,gi=new WeakMap,bf=new WeakMap,Nc=new WeakMap,Lc=new WeakMap,tl=new WeakMap,nl=new WeakMap,Ks=new WeakMap,Fc=new WeakMap,rl=new WeakSet,Zu=function(t){Ct(this,Ef,A0).call(this);let n=re(this,fn).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Oo)),n},yf=new WeakSet,R0=function(){if(Ct(this,Sf,D0).call(this),Hc||re(this,vr).isStale||!_0(this.options.staleTime))return;const n=cD(re(this,vr).dataUpdatedAt,this.options.staleTime)+1;Ve(this,tl,setTimeout(()=>{re(this,vr).isStale||this.updateResult()},n))},xf=new WeakSet,O0=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(re(this,fn)):this.options.refetchInterval)??!1},wf=new WeakSet,P0=function(t){Ct(this,Cf,$0).call(this),Ve(this,Ks,t),!(Hc||this.options.enabled===!1||!_0(re(this,Ks))||re(this,Ks)===0)&&Ve(this,nl,setInterval(()=>{(this.options.refetchIntervalInBackground||pg.isFocused())&&Ct(this,rl,Zu).call(this)},re(this,Ks)))},_f=new WeakSet,T0=function(){Ct(this,yf,R0).call(this),Ct(this,wf,P0).call(this,Ct(this,xf,O0).call(this))},Sf=new WeakSet,D0=function(){re(this,tl)&&(clearTimeout(re(this,tl)),Ve(this,tl,void 0))},Cf=new WeakSet,$0=function(){re(this,nl)&&(clearInterval(re(this,nl)),Ve(this,nl,void 0))},Ef=new WeakSet,A0=function(){const t=re(this,$r).getQueryCache().build(re(this,$r),this.options);if(t===re(this,fn))return;const n=re(this,fn);Ve(this,fn,t),Ve(this,vf,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Jg=new WeakSet,gD=function(t){Xn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(re(this,vr))}),re(this,$r).getQueryCache().notify({query:re(this,fn),type:"observerResultsUpdated"})})},z2);function Zz(e,t){return t.enabled!==!1&&!e.state.dataUpdatedAt&&!(e.state.status==="error"&&t.retryOnMount===!1)}function aR(e,t){return Zz(e,t)||e.state.dataUpdatedAt>0&&k0(e,t,t.refetchOnMount)}function k0(e,t,n){if(t.enabled!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ww(e,t)}return!1}function lR(e,t,n,r){return n.enabled!==!1&&(e!==t||r.enabled===!1)&&(!n.suspense||e.state.status!=="error")&&ww(e,n)}function ww(e,t){return e.isStaleByTime(t.staleTime)}function eB(e,t){return!S0(e.getCurrentResult(),t)}var mD=V.createContext(void 0),vD=e=>{const t=V.useContext(mD);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},tB=({client:e,children:t})=>(V.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),V.createElement(mD.Provider,{value:e},t)),bD=V.createContext(!1),nB=()=>V.useContext(bD);bD.Provider;function rB(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var oB=V.createContext(rB()),iB=()=>V.useContext(oB);function sB(e,t){return typeof e=="function"?e(...t):!!e}var aB=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},lB=e=>{V.useEffect(()=>{e.clearReset()},[e])},cB=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&sB(n,[e.error,r]),uB=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},dB=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,fB=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function hB(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=vD(n),o=nB(),i=iB(),s=r.defaultQueryOptions(e);s._optimisticResults=o?"isRestoring":"optimistic",uB(s),aB(s,i),lB(i);const[a]=V.useState(()=>new t(r,s)),l=a.getOptimisticResult(s);if(V.useSyncExternalStore(V.useCallback(c=>{const u=o?()=>{}:a.subscribe(Xn.batchCalls(c));return a.updateResult(),u},[a,o]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),V.useEffect(()=>{a.setOptions(s,{listeners:!1})},[s,a]),dB(s,l))throw fB(s,a,i);if(cB({result:l,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw l.error;return s.notifyOnChangeProps?l:a.trackResult(l)}function Tf(e,t){return hB(e,Jz,t)}const pB={theme:"system",setTheme:()=>null},yD=m.createContext(pB);function gB({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[o,i]=m.useState(()=>localStorage.getItem(n)||t);m.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),o==="system"){const l=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(l);return}a.classList.add(o)},[o]);const s={theme:o,setTheme:a=>{localStorage.setItem(n,a),i(a)}};return O.jsx(yD.Provider,{...r,value:s,children:e})}const xD=()=>{const e=m.useContext(yD);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};async function mB(e){return await(await fetch("https://semaphor.cloud/api/v1/dashboard",{headers:{Authorization:`Bearer ${e}`}})).json()}function wD(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function cR(e,t){const n=wD(e);return n==="dark"?ol.merge({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function vB({authToken:e,customStyle:t,currentTheme:n,onSave:r,onEvent:o}){const{data:i,refetch:s,isLoading:a,isError:l}=Tf({queryKey:["dashboard",e==null?void 0:e.accessToken],queryFn:()=>mB(e==null?void 0:e.accessToken),enabled:!1}),{theme:c,setTheme:u}=xD(),f=ke(A=>A.dashboard.globalStyle),{setDashboard:h,setSelectedSheetId:g,setStyle:v,setOnSaveFunction:b}=ke(A=>A.actions);ke(A=>A.actions.setCustomCards);const x=ke(A=>A.actions.setFilterValues),w=ke(A=>A.actions.setBookmarkKey),_=ke(A=>A.actions.setAuthToken),S=ke(A=>A.actions.setThemeStyle),R=ke(A=>A.actions.setDashboardTheme),C=ke(A=>A.actions.setOnEvent);m.useEffect(()=>{if(c){const A=wD(c);R(A)}},[c,R]),m.useEffect(()=>{n&&u(n)},[n,u]);function P(){const A=ol.cloneDeep(x0),k=ol.merge(A,f);if(t){const D=ol.merge(k,t),I=cR(c,D);S(I),v(D)}else{const D=cR(c,k);S(D),v(x0)}}return m.useEffect(()=>{i&&i.dashboard&&P()},[c,t,f]),m.useEffect(()=>{var F;if(!i||!i.dashboard)return;const A=i.dashboard,k=yL(A.id),D=JSON.parse(localStorage.getItem(k)||"[]"),I=D.find(B=>B.default===!0);if(I)h(I.template),P(),w(I.name),I.filterValues&&x(I.filterValues);else{h(A),P();const B=D.find(K=>(K==null?void 0:K.name)==="Original");B?B.template=A:D.push({name:"Original",template:A,default:!1}),localStorage.setItem(k,JSON.stringify(D))}g((F=A.sheets)==null?void 0:F[0].id)},[i,h,g,x,w]),m.useEffect(()=>{r&&b(r),o&&C(o)},[r,b,o,C]),m.useEffect(()=>{e&&e.accessToken&&(_(e),s())},[e,s,_]),{isLoading:a,isError:l}}function im({className:e,...t}){return O.jsx("div",{className:Ee("animate-pulse rounded-md bg-muted",e),...t})}const _w=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));_w.displayName="Card";const sm=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee("flex flex-col space-y-1.5 p-6",e),...t}));sm.displayName="CardHeader";const Df=V.forwardRef(({className:e,...t},n)=>O.jsx("h3",{ref:n,className:Ee("text-2xl font-semibold leading-none tracking-tight",e),...t}));Df.displayName="CardTitle";const Sw=V.forwardRef(({className:e,...t},n)=>O.jsx("p",{ref:n,className:Ee("text-sm text-muted-foreground",e),...t}));Sw.displayName="CardDescription";const am=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee("px-6 pt-0",e),...t}));am.displayName="CardContent";const Cw=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee("flex items-center p-6 pt-0",e),...t}));Cw.displayName="CardFooter";function _D({className:e,customStyle:t,onSave:n,onEvent:r,LoadingComponent:o,ErrorComponent:i,onChartElementClicked:s,id:a,authToken:l,currentTheme:c,version:u,customCards:f,showAssistant:h,...g}){ke(_=>_.selectedSheetId);const v=ke(_=>_.themeStyle),b=ke(_=>_.isSessionExpired),{isLoading:x,isError:w}=vB({authToken:l,customStyle:t,currentTheme:c,onSave:n,onEvent:r});return x||!l?(r==null||r({type:"info",message:"Loading dashboard"}),o?O.jsx(o,{message:"loading"}):O.jsx("div",{className:"flex items-center gap-3",children:O.jsx(im,{className:"h-1 w-full dark:h-[2px]"})})):w?(r==null||r({type:"error",message:"Error fetching dashboard"}),i?(console.log("Error fetching dashboard"),O.jsx(i,{})):O.jsx("div",{children:"Error"})):b?(r==null||r({type:"error",message:"Session Expired"}),O.jsx("div",{className:"flex h-full items-center justify-center",children:O.jsxs("div",{className:"space-y-4 rounded-md border border-muted p-10",children:[O.jsx(Df,{children:"Session Expired"}),O.jsx("p",{className:"text-muted-foreground",children:"Please refresh your page to continue."})]})})):O.jsx("div",{className:Ee("flex h-full flex-col justify-between",v==null?void 0:v.dashboardPanel,e),role:"dashboard-panel",...g})}function he(){return he=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},he.apply(this,arguments)}function Me(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Zn(e,t=[]){let n=[];function r(i,s){const a=m.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:g,...v}=f,b=(h==null?void 0:h[e][l])||a,x=m.useMemo(()=>v,Object.values(v));return m.createElement(b.Provider,{value:x},g)}function u(f,h){const g=(h==null?void 0:h[e][l])||a,v=m.useContext(g);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>m.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,bB(o,...t)]}function bB(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function yB(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function cs(...e){return t=>e.forEach(n=>yB(n,t))}function _t(...e){return m.useCallback(cs(...e),e)}const M0=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(wB);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(I0,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(I0,he({},r,{ref:t}),n)});M0.displayName="Slot";const I0=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{..._B(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});I0.displayName="SlotClone";const xB=({children:e})=>m.createElement(m.Fragment,null,e);function wB(e){return m.isValidElement(e)&&e.type===xB}function _B(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function lm(e){const t=e+"CollectionProvider",[n,r]=Zn(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=g=>{const{scope:v,children:b}=g,x=m.useRef(null),w=m.useRef(new Map).current;return m.createElement(o,{scope:v,itemMap:w,collectionRef:x},b)},a=e+"CollectionSlot",l=m.forwardRef((g,v)=>{const{scope:b,children:x}=g,w=i(a,b),_=_t(v,w.collectionRef);return m.createElement(M0,{ref:_},x)}),c=e+"CollectionItemSlot",u="data-radix-collection-item",f=m.forwardRef((g,v)=>{const{scope:b,children:x,...w}=g,_=m.useRef(null),S=_t(v,_),R=i(c,b);return m.useEffect(()=>(R.itemMap.set(_,{ref:_,...w}),()=>void R.itemMap.delete(_))),m.createElement(M0,{[u]:"",ref:S},x)});function h(g){const v=i(e+"CollectionConsumer",g);return m.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((R,C)=>w.indexOf(R.ref.current)-w.indexOf(C.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},h,r]}const ur=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},SB=V.useId||(()=>{});let CB=0;function Jo(e){const[t,n]=V.useState(SB());return ur(()=>{e||n(r=>r??String(CB++))},[e]),e||(t?`radix-${t}`:"")}const SD=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(RB);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(N0,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(N0,he({},r,{ref:t}),n)});SD.displayName="Slot";const N0=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...OB(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});N0.displayName="SlotClone";const EB=({children:e})=>m.createElement(m.Fragment,null,e);function RB(e){return m.isValidElement(e)&&e.type===EB}function OB(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const PB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Qe=PB.reduce((e,t)=>{const n=m.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?SD:t;return m.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),m.createElement(a,he({},s,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function CD(e,t){e&&ko.flushSync(()=>e.dispatchEvent(t))}function Ln(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 xr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=TB({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=Ln(n),l=m.useCallback(c=>{if(i){const f=typeof c=="function"?c(e):c;f!==e&&a(f)}else o(c)},[i,e,o,a]);return[s,l]}function TB({defaultProp:e,onChange:t}){const n=m.useState(e),[r]=n,o=m.useRef(r),i=Ln(t);return m.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}const DB=m.createContext(void 0);function _l(e){const t=m.useContext(DB);return e||t||"ltr"}const Db="rovingFocusGroup.onEntryFocus",$B={bubbles:!1,cancelable:!0},Ew="RovingFocusGroup",[L0,ED,AB]=lm(Ew),[kB,ou]=Zn(Ew,[AB]),[MB,IB]=kB(Ew),NB=m.forwardRef((e,t)=>m.createElement(L0.Provider,{scope:e.__scopeRovingFocusGroup},m.createElement(L0.Slot,{scope:e.__scopeRovingFocusGroup},m.createElement(LB,he({},e,{ref:t}))))),LB=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,...u}=e,f=m.useRef(null),h=_t(t,f),g=_l(i),[v=null,b]=xr({prop:s,defaultProp:a,onChange:l}),[x,w]=m.useState(!1),_=Ln(c),S=ED(n),R=m.useRef(!1),[C,P]=m.useState(0);return m.useEffect(()=>{const A=f.current;if(A)return A.addEventListener(Db,_),()=>A.removeEventListener(Db,_)},[_]),m.createElement(MB,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:v,onItemFocus:m.useCallback(A=>b(A),[b]),onItemShiftTab:m.useCallback(()=>w(!0),[]),onFocusableItemAdd:m.useCallback(()=>P(A=>A+1),[]),onFocusableItemRemove:m.useCallback(()=>P(A=>A-1),[])},m.createElement(Qe.div,he({tabIndex:x||C===0?-1:0,"data-orientation":r},u,{ref:h,style:{outline:"none",...e.style},onMouseDown:Me(e.onMouseDown,()=>{R.current=!0}),onFocus:Me(e.onFocus,A=>{const k=!R.current;if(A.target===A.currentTarget&&k&&!x){const D=new CustomEvent(Db,$B);if(A.currentTarget.dispatchEvent(D),!D.defaultPrevented){const I=S().filter(z=>z.focusable),F=I.find(z=>z.active),B=I.find(z=>z.id===v),Z=[F,B,...I].filter(Boolean).map(z=>z.ref.current);RD(Z)}}R.current=!1}),onBlur:Me(e.onBlur,()=>w(!1))})))}),FB="RovingFocusGroupItem",jB=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Jo(),l=i||a,c=IB(FB,n),u=c.currentTabStopId===l,f=ED(n),{onFocusableItemAdd:h,onFocusableItemRemove:g}=c;return m.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),m.createElement(L0.ItemSlot,{scope:n,id:l,focusable:r,active:o},m.createElement(Qe.span,he({tabIndex:u?0:-1,"data-orientation":c.orientation},s,{ref:t,onMouseDown:Me(e.onMouseDown,v=>{r?c.onItemFocus(l):v.preventDefault()}),onFocus:Me(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:Me(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){c.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=VB(v,c.orientation,c.dir);if(b!==void 0){v.preventDefault();let w=f().filter(_=>_.focusable).map(_=>_.ref.current);if(b==="last")w.reverse();else if(b==="prev"||b==="next"){b==="prev"&&w.reverse();const _=w.indexOf(v.currentTarget);w=c.loop?HB(w,_+1):w.slice(_+1)}setTimeout(()=>RD(w))}})})))}),zB={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function BB(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function VB(e,t,n){const r=BB(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return zB[r]}function RD(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function HB(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const Rw=NB,Ow=jB;function WB(e,t){return m.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const er=e=>{const{present:t,children:n}=e,r=UB(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),i=_t(r.ref,o.ref);return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:i}):null};er.displayName="Presence";function UB(e){const[t,n]=m.useState(),r=m.useRef({}),o=m.useRef(e),i=m.useRef("none"),s=e?"mounted":"unmounted",[a,l]=WB(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=Uh(r.current);i.current=a==="mounted"?c:"none"},[a]),ur(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,g=Uh(c);e?l("MOUNT"):g==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),ur(()=>{if(t){const c=f=>{const g=Uh(r.current).includes(f.animationName);f.target===t&&g&&ko.flushSync(()=>l("ANIMATION_END"))},u=f=>{f.target===t&&(i.current=Uh(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),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 Uh(e){return(e==null?void 0:e.animationName)||"none"}const OD="Tabs",[qB,tye]=Zn(OD,[ou]),PD=ou(),[GB,Pw]=qB(OD),YB=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=_l(a),[f,h]=xr({prop:r,onChange:o,defaultProp:i});return m.createElement(GB,{scope:n,baseId:Jo(),value:f,onValueChange:h,orientation:s,dir:u,activationMode:l},m.createElement(Qe.div,he({dir:u,"data-orientation":s},c,{ref:t})))}),KB="TabsList",XB=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Pw(KB,n),s=PD(n);return m.createElement(Rw,he({asChild:!0},s,{orientation:i.orientation,dir:i.dir,loop:r}),m.createElement(Qe.div,he({role:"tablist","aria-orientation":i.orientation},o,{ref:t})))}),QB="TabsTrigger",JB=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Pw(QB,n),a=PD(n),l=TD(s.baseId,r),c=DD(s.baseId,r),u=r===s.value;return m.createElement(Ow,he({asChild:!0},a,{focusable:!o,active:u}),m.createElement(Qe.button,he({type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l},i,{ref:t,onMouseDown:Me(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Me(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Me(e.onFocus,()=>{const f=s.activationMode!=="manual";!u&&!o&&f&&s.onValueChange(r)})})))}),ZB="TabsContent",eV=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=Pw(ZB,n),l=TD(a.baseId,r),c=DD(a.baseId,r),u=r===a.value,f=m.useRef(u);return m.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),m.createElement(er,{present:o||u},({present:h})=>m.createElement(Qe.div,he({"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0}}),h&&i))});function TD(e,t){return`${e}-trigger-${t}`}function DD(e,t){return`${e}-content-${t}`}const tV=YB,$D=XB,AD=JB,kD=eV,MD=tV,Tw=V.forwardRef(({className:e,...t},n)=>O.jsx($D,{ref:n,className:Ee("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Tw.displayName=$D.displayName;const Dw=V.forwardRef(({className:e,...t},n)=>O.jsx(AD,{ref:n,className:Ee("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}));Dw.displayName=AD.displayName;const $w=V.forwardRef(({className:e,...t},n)=>O.jsx(kD,{ref:n,className:Ee("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));$w.displayName=kD.displayName;var ID={exports:{}},$f={},F0={exports:{}};(function(e,t){(function(n,r){r(t)})(Vs,function(n){function r(ie){return function(ae,ye,G,be,_e,Pe,Te){return ie(ae,ye,Te)}}function o(ie){return function(ae,ye,G,be){if(!ae||!ye||typeof ae!="object"||typeof ye!="object")return ie(ae,ye,G,be);var _e=be.get(ae),Pe=be.get(ye);if(_e&&Pe)return _e===ye&&Pe===ae;be.set(ae,ye),be.set(ye,ae);var Te=ie(ae,ye,G,be);return be.delete(ae),be.delete(ye),Te}}function i(ie,te){var ae={};for(var ye in ie)ae[ye]=ie[ye];for(var ye in te)ae[ye]=te[ye];return ae}function s(ie){return ie.constructor===Object||ie.constructor==null}function a(ie){return typeof ie.then=="function"}function l(ie,te){return ie===te||ie!==ie&&te!==te}var c="[object Arguments]",u="[object Boolean]",f="[object Date]",h="[object RegExp]",g="[object Map]",v="[object Number]",b="[object Object]",x="[object Set]",w="[object String]",_=Object.prototype.toString;function S(ie){var te=ie.areArraysEqual,ae=ie.areDatesEqual,ye=ie.areMapsEqual,G=ie.areObjectsEqual,be=ie.areRegExpsEqual,_e=ie.areSetsEqual,Pe=ie.createIsNestedEqual,Te=Pe(Ue);function Ue(Be,Ie,Ke){if(Be===Ie)return!0;if(!Be||!Ie||typeof Be!="object"||typeof Ie!="object")return Be!==Be&&Ie!==Ie;if(s(Be)&&s(Ie))return G(Be,Ie,Te,Ke);var lt=Array.isArray(Be),It=Array.isArray(Ie);if(lt||It)return lt===It&&te(Be,Ie,Te,Ke);var $t=_.call(Be);return $t!==_.call(Ie)?!1:$t===f?ae(Be,Ie,Te,Ke):$t===h?be(Be,Ie,Te,Ke):$t===g?ye(Be,Ie,Te,Ke):$t===x?_e(Be,Ie,Te,Ke):$t===b||$t===c?a(Be)||a(Ie)?!1:G(Be,Ie,Te,Ke):$t===u||$t===v||$t===w?l(Be.valueOf(),Ie.valueOf()):!1}return Ue}function R(ie,te,ae,ye){var G=ie.length;if(te.length!==G)return!1;for(;G-- >0;)if(!ae(ie[G],te[G],G,G,ie,te,ye))return!1;return!0}var C=o(R);function P(ie,te){return l(ie.valueOf(),te.valueOf())}function A(ie,te,ae,ye){var G=ie.size===te.size;if(!G)return!1;if(!ie.size)return!0;var be={},_e=0;return ie.forEach(function(Pe,Te){if(G){var Ue=!1,Be=0;te.forEach(function(Ie,Ke){!Ue&&!be[Be]&&(Ue=ae(Te,Ke,_e,Be,ie,te,ye)&&ae(Pe,Ie,Te,Ke,ie,te,ye))&&(be[Be]=!0),Be++}),_e++,G=Ue}}),G}var k=o(A),D="_owner",I=Object.prototype.hasOwnProperty;function F(ie,te,ae,ye){var G=Object.keys(ie),be=G.length;if(Object.keys(te).length!==be)return!1;for(var _e;be-- >0;){if(_e=G[be],_e===D){var Pe=!!ie.$$typeof,Te=!!te.$$typeof;if((Pe||Te)&&Pe!==Te)return!1}if(!I.call(te,_e)||!ae(ie[_e],te[_e],_e,_e,ie,te,ye))return!1}return!0}var B=o(F);function K(ie,te){return ie.source===te.source&&ie.flags===te.flags}function Z(ie,te,ae,ye){var G=ie.size===te.size;if(!G)return!1;if(!ie.size)return!0;var be={};return ie.forEach(function(_e,Pe){if(G){var Te=!1,Ue=0;te.forEach(function(Be,Ie){!Te&&!be[Ue]&&(Te=ae(_e,Be,Pe,Ie,ie,te,ye))&&(be[Ue]=!0),Ue++}),G=Te}}),G}var z=o(Z),Q=Object.freeze({areArraysEqual:R,areDatesEqual:P,areMapsEqual:A,areObjectsEqual:F,areRegExpsEqual:K,areSetsEqual:Z,createIsNestedEqual:r}),W=Object.freeze({areArraysEqual:C,areDatesEqual:P,areMapsEqual:k,areObjectsEqual:B,areRegExpsEqual:K,areSetsEqual:z,createIsNestedEqual:r}),Y=S(Q);function oe(ie,te){return Y(ie,te,void 0)}var $=S(i(Q,{createIsNestedEqual:function(){return l}}));function H(ie,te){return $(ie,te,void 0)}var J=S(W);function N(ie,te){return J(ie,te,new WeakMap)}var ce=S(i(W,{createIsNestedEqual:function(){return l}}));function le(ie,te){return ce(ie,te,new WeakMap)}function de(ie){return S(i(Q,ie(Q)))}function pe(ie){var te=S(i(W,ie(W)));return function(ae,ye,G){return G===void 0&&(G=new WeakMap),te(ae,ye,G)}}n.circularDeepEqual=N,n.circularShallowEqual=le,n.createCustomCircularEqual=pe,n.createCustomEqual=de,n.deepEqual=oe,n.sameValueZeroEqual=l,n.shallowEqual=H,Object.defineProperty(n,"__esModule",{value:!0})})})(F0,F0.exports);var Aw=F0.exports;const kw=dw(yj);var Ot={},nV=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(Ot,"__esModule",{value:!0});Ot.bottom=Mw;Ot.childrenEqual=sV;Ot.cloneLayout=ND;Ot.cloneLayoutItem=il;Ot.collides=cm;Ot.compact=FD;Ot.compactItem=jD;Ot.compactType=xV;Ot.correctBounds=zD;Ot.fastPositionEqual=lV;Ot.fastRGLPropsEqual=void 0;Ot.getAllCollisions=BD;Ot.getFirstCollision=qa;Ot.getLayoutItem=Iw;Ot.getStatics=Nw;Ot.modifyLayout=LD;Ot.moveElement=td;Ot.moveElementAwayFromCollision=z0;Ot.noop=void 0;Ot.perc=uV;Ot.resizeItemInDirection=mV;Ot.setTopLeft=bV;Ot.setTransform=vV;Ot.sortLayoutItems=Vw;Ot.sortLayoutItemsByColRow=qD;Ot.sortLayoutItemsByRowCol=UD;Ot.synchronizeLayoutWithChildren=yV;Ot.validateLayout=GD;Ot.withLayoutItem=iV;var uR=Aw,ed=rV(m);function rV(e){return e&&e.__esModule?e:{default:e}}const oV=process.env.NODE_ENV==="production";function Mw(e){let t=0,n;for(let r=0,o=e.length;r<o;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function ND(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=il(e[n]);return t}function LD(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function iV(e,t,n){let r=Iw(e,t);return r?(r=n(il(r)),e=LD(e,r),[e,r]):[e,null]}function il(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 sV(e,t){return(0,uR.deepEqual)(ed.default.Children.map(e,n=>n==null?void 0:n.key),ed.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,uR.deepEqual)(ed.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),ed.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}const aV=nV;Ot.fastRGLPropsEqual=aV;function lV(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function cm(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 FD(e,t,n,r){const o=Nw(e),i=Vw(e,t),s=Array(e.length);for(let a=0,l=i.length;a<l;a++){let c=il(i[a]);c.static||(c=jD(o,c,t,n,i,r),o.push(c)),s[e.indexOf(i[a])]=c,c.moved=!1}return s}const cV={x:"w",y:"h"};function j0(e,t,n,r){const o=cV[r];t[r]+=1;const i=e.map(s=>s.i).indexOf(t.i);for(let s=i+1;s<e.length;s++){const a=e[s];if(!a.static){if(a.y>t.y+t.h)break;cm(t,a)&&j0(e,a,n+t[o],r)}}t[r]=n}function jD(e,t,n,r,o,i){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min(Mw(e),t.y);t.y>0&&!qa(e,t);)t.y--;else if(a)for(;t.x>0&&!qa(e,t);)t.x--;let l;for(;(l=qa(e,t))&&!(n===null&&i);)if(a?j0(o,t,l.x+l.w,"x"):j0(o,t,l.y+l.h,"y"),a&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!qa(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function zD(e,t){const n=Nw(e);for(let r=0,o=e.length;r<o;r++){const i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;qa(n,i);)i.y++}return e}function Iw(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function qa(e,t){for(let n=0,r=e.length;n<r;n++)if(cm(e[n],t))return e[n]}function BD(e,t){return e.filter(n=>cm(n,t))}function Nw(e){return e.filter(t=>t.static)}function td(e,t,n,r,o,i,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,u=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let f=Vw(e,s);(s==="vertical"&&typeof r=="number"?u>=r:s==="horizontal"&&typeof n=="number"?c>=n:!1)&&(f=f.reverse());const g=BD(f,t),v=g.length>0;if(v&&l)return ND(e);if(v&&i)return"Collision prevented on ".concat(t.i,", reverting."),t.x=c,t.y=u,t.moved=!1,e;for(let b=0,x=g.length;b<x;b++){const w=g[b];"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=z0(e,w,t,o,s):e=z0(e,t,w,o,s))}return e}function z0(e,t,n,r,o,i){const s=o==="horizontal",a=o==="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"},h=qa(e,f),g=h&&h.y+h.h>t.y,v=h&&t.x+t.w>h.x;if(h){if(g&&a)return td(e,n,void 0,t.y+1,r,l,o);if(g&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(v&&s)return td(e,t,n.x,void 0,r,l,o)}else return"Doing reverse collision on ".concat(n.i," up to [").concat(f.x,",").concat(f.y,"]."),td(e,n,s?f.x:void 0,a?f.y:void 0,r,l,o)}const c=s?n.x+1:void 0,u=a?n.y+1:void 0;return c==null&&u==null?e:td(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,o)}function uV(e){return e*100+"%"}const VD=(e,t,n,r)=>e+n>r?t:n,HD=(e,t,n)=>e<0?t:n,WD=e=>Math.max(0,e),Lw=e=>Math.max(0,e),Fw=(e,t,n)=>{let{left:r,height:o,width:i}=t;const s=e.top-(o-e.height);return{left:r,width:i,height:HD(s,e.height,o),top:Lw(s)}},jw=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{top:r,height:i,width:VD(e.left,e.width,s,n),left:WD(o)}},zw=(e,t,n)=>{let{top:r,height:o,width:i}=t;const s=e.left-(i-e.width);return{height:o,width:s<0?e.width:VD(e.left,e.width,i,n),top:Lw(r),left:WD(s)}},Bw=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{width:s,left:o,height:HD(r,e.height,i),top:Lw(r)}},dV=function(){return Fw(arguments.length<=0?void 0:arguments[0],jw(...arguments))},fV=function(){return Fw(arguments.length<=0?void 0:arguments[0],zw(...arguments))},hV=function(){return Bw(arguments.length<=0?void 0:arguments[0],jw(...arguments))},pV=function(){return Bw(arguments.length<=0?void 0:arguments[0],zw(...arguments))},gV={n:Fw,ne:dV,e:jw,se:hV,s:Bw,sw:pV,w:zw,nw:fV};function mV(e,t,n,r){const o=gV[e];return o?o(t,{...t,...n},r):n}function vV(e){let{top:t,left:n,width:r,height:o}=e;const i="translate(".concat(n,"px,").concat(t,"px)");return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:"".concat(r,"px"),height:"".concat(o,"px"),position:"absolute"}}function bV(e){let{top:t,left:n,width:r,height:o}=e;return{top:"".concat(t,"px"),left:"".concat(n,"px"),width:"".concat(r,"px"),height:"".concat(o,"px"),position:"absolute"}}function Vw(e,t){return t==="horizontal"?qD(e):t==="vertical"?UD(e):e}function UD(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 qD(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 yV(e,t,n,r,o){e=e||[];const i=[];ed.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=Iw(e,String(a.key)),c=a.props["data-grid"];l&&c==null?i.push(il(l)):c?(oV||GD([c],"ReactGridLayout.children"),i.push(il({...c,i:a.key}))):i.push(il({w:1,h:1,x:0,y:Mw(i),i:String(a.key)}))});const s=zD(i,{cols:n});return o?s:FD(s,r,n)}function GD(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,o=e.length;r<o;r++){const i=e[r];for(let s=0;s<n.length;s++)if(typeof i[n[s]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[s]+" must be a number!")}}function xV(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const wV=()=>{};Ot.noop=wV;var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});Ri.calcGridColWidth=um;Ri.calcGridItemPosition=_V;Ri.calcGridItemWHPx=B0;Ri.calcWH=CV;Ri.calcXY=SV;Ri.clamp=Ga;function um(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function B0(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function _V(e,t,n,r,o,i){const{margin:s,containerPadding:a,rowHeight:l}=e,c=um(e),u={};return i&&i.resizing?(u.width=Math.round(i.resizing.width),u.height=Math.round(i.resizing.height)):(u.width=B0(r,c,s[0]),u.height=B0(o,l,s[1])),i&&i.dragging?(u.top=Math.round(i.dragging.top),u.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(u.top=Math.round(i.resizing.top),u.left=Math.round(i.resizing.left)):(u.top=Math.round((l+s[1])*n+a[1]),u.left=Math.round((c+s[0])*t+a[0])),u}function SV(e,t,n,r,o){const{margin:i,cols:s,rowHeight:a,maxRows:l}=e,c=um(e);let u=Math.round((n-i[0])/(c+i[0])),f=Math.round((t-i[1])/(a+i[1]));return u=Ga(u,0,s-r),f=Ga(f,0,l-o),{x:u,y:f}}function CV(e,t,n,r,o,i){const{margin:s,maxRows:a,cols:l,rowHeight:c}=e,u=um(e);let f=Math.round((t+s[0])/(u+s[0])),h=Math.round((n+s[1])/(c+s[1])),g=Ga(f,0,l-r),v=Ga(h,0,a-o);return["sw","w","nw"].indexOf(i)!==-1&&(g=Ga(f,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(v=Ga(h,0,a)),{w:g,h:v}}function Ga(e,t,n){return Math.max(Math.min(e,n),t)}var dm={},V0={exports:{}},$b,dR;function Hw(){if(dR)return $b;dR=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return $b=e,$b}var Ab,fR;function EV(){if(fR)return Ab;fR=1;var e=Hw();function t(){}function n(){}return n.resetWarningCache=t,Ab=function(){function r(s,a,l,c,u,f){if(f!==e){var h=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 h.name="Invariant Violation",h}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Ab}var qh={exports:{}},qt={};/** @license React v16.13.1
|
|
89
89
|
* react-is.development.js
|
|
90
90
|
*
|
|
91
91
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -250,7 +250,7 @@ Valid keys: `+JSON.stringify(Object.keys($),null," "));var G=ye(pe,ae,ce,le,de+
|
|
|
250
250
|
* This source code is licensed under the ISC license.
|
|
251
251
|
* See the LICENSE file in the root directory of this source tree.
|
|
252
252
|
*/const Pm=Dn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),rQ=({data:e,filename:t="output.csv"})=>{const n=()=>{if(e.length===0)return;const r=[],o=Object.keys(e[0]);r.push(o.join(","));for(const c of e){const u=o.map(f=>`"${(""+c[f]).replace(/"/g,'""')}"`);r.push(u.join(","))}const i=r.join(`
|
|
253
|
-
`),s=new Blob([i],{type:"text/csv"}),a=window.URL.createObjectURL(s),l=document.createElement("a");l.setAttribute("hidden",""),l.setAttribute("href",a),l.setAttribute("download",t),document.body.appendChild(l),l.click(),document.body.removeChild(l)};return O.jsx(XX,{onClick:n,className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"})};function oQ({frame:e}){var _;const t=ke(S=>S.isDashboardEditing),n=ke(S=>S.filterValues),r=ke(S=>S.isVisualEditing),o=ke(S=>S.selectedSheetId);ke(S=>S.currentBreakpoint);const{removeFrame:i}=ke(S=>S.actions),s=ke(S=>S.actions.setIsVisualEditing),a=Ar(S=>S.actions.setFilterValues),l=Ar(S=>S.actions.setApplyFilters),{setCard:c,setFrame:u,setQueryResultColumns:f}=Ar(S=>S.actions),h=Ar(S=>S.actions.setSelectedConnectionId),g=Ar(S=>S.actions.setSelectedDatabaseName),v=Ar(S=>S.actions.setSelectedSchemaName),b=Ar(S=>S.actions.setSelectedTableName),x=e.cards.find(S=>S.id===e.activeCardId);function w(){s(!r),c(x);const{dimensionKeys:S}=ar((x==null?void 0:x.data)||[]);f(S),u(e),x!=null&&x.connectionId&&h(x==null?void 0:x.connectionId),x!=null&&x.lastSelectedDatabase&&g(x==null?void 0:x.lastSelectedDatabase),x!=null&&x.lastSelectedSchema&&v(x==null?void 0:x.lastSelectedSchema),x!=null&&x.lastSelectedTable&&b(x==null?void 0:x.lastSelectedTable),n&&(a(n),l(!0))}return O.jsx("section",{className:"absolute right-2 top-2 z-10",children:O.jsxs("div",{className:"flex items-center gap-2",children:[t&&(r?O.jsx(_X,{onClick:()=>{s(!r)},className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"}):O.jsx(CX,{role:"edit-visual",onClick:w,className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"})),t&&O.jsx(TA,{onClick:()=>i(o,e.id),className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"}),((_=x.preferences)==null?void 0:_.allowDownload)===!0&&O.jsx(rQ,{data:(x==null?void 0:x.data)||[],filename:x.title})]})})}function iQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e);m.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const px="dismissableLayer.update",sQ="dismissableLayer.pointerDownOutside",aQ="dismissableLayer.focusOutside";let sP;const lQ=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ff=m.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=e,u=m.useContext(lQ),[f,h]=m.useState(null),g=(n=f==null?void 0:f.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,v]=m.useState({}),b=_t(t,k=>h(k)),x=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),_=x.indexOf(w),S=f?x.indexOf(f):-1,R=u.layersWithOutsidePointerEventsDisabled.size>0,C=S>=_,P=cQ(k=>{const D=k.target,I=[...u.branches].some(F=>F.contains(D));!C||I||(i==null||i(k),a==null||a(k),k.defaultPrevented||l==null||l())},g),A=uQ(k=>{const D=k.target;[...u.branches].some(F=>F.contains(D))||(s==null||s(k),a==null||a(k),k.defaultPrevented||l==null||l())},g);return iQ(k=>{S===u.layers.size-1&&(o==null||o(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},g),m.useEffect(()=>{if(f)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(sP=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),aP(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=sP)}},[f,g,r,u]),m.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),aP())},[f,u]),m.useEffect(()=>{const k=()=>v({});return document.addEventListener(px,k),()=>document.removeEventListener(px,k)},[]),m.createElement(Qe.div,he({},c,{ref:b,style:{pointerEvents:R?C?"auto":"none":void 0,...e.style},onFocusCapture:Me(e.onFocusCapture,A.onFocusCapture),onBlurCapture:Me(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Me(e.onPointerDownCapture,P.onPointerDownCapture)}))});function cQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let c=function(){NA(sQ,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function uQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e),r=m.useRef(!1);return m.useEffect(()=>{const o=i=>{i.target&&!r.current&&NA(aQ,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function aP(){const e=new CustomEvent(px);document.dispatchEvent(e)}function NA(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?CD(o,i):o.dispatchEvent(i)}const dQ=["top","right","bottom","left"],ca=Math.min,no=Math.max,Tg=Math.round,mp=Math.floor,ua=e=>({x:e,y:e}),fQ={left:"right",right:"left",bottom:"top",top:"bottom"},hQ={start:"end",end:"start"};function gx(e,t,n){return no(e,ca(t,n))}function ss(e,t){return typeof e=="function"?e(t):e}function as(e){return e.split("-")[0]}function iu(e){return e.split("-")[1]}function R1(e){return e==="x"?"y":"x"}function O1(e){return e==="y"?"height":"width"}function su(e){return["top","bottom"].includes(as(e))?"y":"x"}function P1(e){return R1(su(e))}function pQ(e,t,n){n===void 0&&(n=!1);const r=iu(e),o=P1(e),i=O1(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Dg(s)),[s,Dg(s)]}function gQ(e){const t=Dg(e);return[mx(e),t,mx(t)]}function mx(e){return e.replace(/start|end/g,t=>hQ[t])}function mQ(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function vQ(e,t,n,r){const o=iu(e);let i=mQ(as(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(mx)))),i}function Dg(e){return e.replace(/left|right|bottom|top/g,t=>fQ[t])}function bQ(e){return{top:0,right:0,bottom:0,left:0,...e}}function LA(e){return typeof e!="number"?bQ(e):{top:e,right:e,bottom:e,left:e}}function $g(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function lP(e,t,n){let{reference:r,floating:o}=e;const i=su(t),s=P1(t),a=O1(s),l=as(t),c=i==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let g;switch(l){case"top":g={x:u,y:r.y-o.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:f};break;case"left":g={x:r.x-o.width,y:f};break;default:g={x:r.x,y:r.y}}switch(iu(t)){case"start":g[s]-=h*(n&&c?-1:1);break;case"end":g[s]+=h*(n&&c?-1:1);break}return g}const yQ=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=lP(c,r,l),h=r,g={},v=0;for(let b=0;b<a.length;b++){const{name:x,fn:w}=a[b],{x:_,y:S,data:R,reset:C}=await w({x:u,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:g,rects:c,platform:s,elements:{reference:e,floating:t}});if(u=_??u,f=S??f,g={...g,[x]:{...g[x],...R}},C&&v<=50){v++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(c=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:u,y:f}=lP(c,h,l)),b=-1;continue}}return{x:u,y:f,placement:h,strategy:o,middlewareData:g}};async function Fd(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:g=0}=ss(t,e),v=LA(g),x=a[h?f==="floating"?"reference":"floating":f],w=$g(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),_=f==="floating"?{...s.floating,x:r,y:o}:s.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),R=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},C=$g(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:_,offsetParent:S,strategy:l}):_);return{top:(w.top-C.top+v.top)/R.y,bottom:(C.bottom-w.bottom+v.bottom)/R.y,left:(w.left-C.left+v.left)/R.x,right:(C.right-w.right+v.right)/R.x}}const cP=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=ss(e,t)||{};if(c==null)return{};const f=LA(u),h={x:n,y:r},g=P1(o),v=O1(g),b=await s.getDimensions(c),x=g==="y",w=x?"top":"left",_=x?"bottom":"right",S=x?"clientHeight":"clientWidth",R=i.reference[v]+i.reference[g]-h[g]-i.floating[v],C=h[g]-i.reference[g],P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let A=P?P[S]:0;(!A||!await(s.isElement==null?void 0:s.isElement(P)))&&(A=a.floating[S]||i.floating[v]);const k=R/2-C/2,D=A/2-b[v]/2-1,I=ca(f[w],D),F=ca(f[_],D),B=I,K=A-b[v]-F,Z=A/2-b[v]/2+k,z=gx(B,Z,K),Q=!l.arrow&&iu(o)!=null&&Z!=z&&i.reference[v]/2-(Z<B?I:F)-b[v]/2<0,W=Q?Z<B?Z-B:Z-K:0;return{[g]:h[g]+W,data:{[g]:z,centerOffset:Z-z-W,...Q&&{alignmentOffset:W}},reset:Q}}}),xQ=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:b=!0,...x}=ss(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=as(o),_=as(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),R=h||(_||!b?[Dg(a)]:gQ(a));!h&&v!=="none"&&R.push(...vQ(a,b,v,S));const C=[a,...R],P=await Fd(t,x),A=[];let k=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&A.push(P[w]),f){const B=pQ(o,s,S);A.push(P[B[0]],P[B[1]])}if(k=[...k,{placement:o,overflows:A}],!A.every(B=>B<=0)){var D,I;const B=(((D=i.flip)==null?void 0:D.index)||0)+1,K=C[B];if(K)return{data:{index:B,overflows:k},reset:{placement:K}};let Z=(I=k.filter(z=>z.overflows[0]<=0).sort((z,Q)=>z.overflows[1]-Q.overflows[1])[0])==null?void 0:I.placement;if(!Z)switch(g){case"bestFit":{var F;const z=(F=k.map(Q=>[Q.placement,Q.overflows.filter(W=>W>0).reduce((W,Y)=>W+Y,0)]).sort((Q,W)=>Q[1]-W[1])[0])==null?void 0:F[0];z&&(Z=z);break}case"initialPlacement":Z=a;break}if(o!==Z)return{reset:{placement:Z}}}return{}}}};function uP(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function dP(e){return dQ.some(t=>e[t]>=0)}const wQ=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=ss(e,t);switch(r){case"referenceHidden":{const i=await Fd(t,{...o,elementContext:"reference"}),s=uP(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:dP(s)}}}case"escaped":{const i=await Fd(t,{...o,altBoundary:!0}),s=uP(i,n.floating);return{data:{escapedOffsets:s,escaped:dP(s)}}}default:return{}}}}};async function _Q(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=as(n),a=iu(n),l=su(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,f=ss(t,e);let{mainAxis:h,crossAxis:g,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),l?{x:g*u,y:h*c}:{x:h*c,y:g*u}}const SQ=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await _Q(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},CQ=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:w,y:_}=x;return{x:w,y:_}}},...l}=ss(e,t),c={x:n,y:r},u=await Fd(t,l),f=su(as(o)),h=R1(f);let g=c[h],v=c[f];if(i){const x=h==="y"?"top":"left",w=h==="y"?"bottom":"right",_=g+u[x],S=g-u[w];g=gx(_,g,S)}if(s){const x=f==="y"?"top":"left",w=f==="y"?"bottom":"right",_=v+u[x],S=v-u[w];v=gx(_,v,S)}const b=a.fn({...t,[h]:g,[f]:v});return{...b,data:{x:b.x-n,y:b.y-r}}}}},EQ=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=ss(e,t),u={x:n,y:r},f=su(o),h=R1(f);let g=u[h],v=u[f];const b=ss(a,t),x=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(l){const S=h==="y"?"height":"width",R=i.reference[h]-i.floating[S]+x.mainAxis,C=i.reference[h]+i.reference[S]-x.mainAxis;g<R?g=R:g>C&&(g=C)}if(c){var w,_;const S=h==="y"?"width":"height",R=["top","left"].includes(as(o)),C=i.reference[f]-i.floating[S]+(R&&((w=s.offset)==null?void 0:w[f])||0)+(R?0:x.crossAxis),P=i.reference[f]+i.reference[S]+(R?0:((_=s.offset)==null?void 0:_[f])||0)-(R?x.crossAxis:0);v<C?v=C:v>P&&(v=P)}return{[h]:g,[f]:v}}}},RQ=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:s=()=>{},...a}=ss(e,t),l=await Fd(t,a),c=as(n),u=iu(n),f=su(n)==="y",{width:h,height:g}=r.floating;let v,b;c==="top"||c==="bottom"?(v=c,b=u===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(b=c,v=u==="end"?"top":"bottom");const x=g-l[v],w=h-l[b],_=!t.middlewareData.shift;let S=x,R=w;if(f){const P=h-l.left-l.right;R=u||_?ca(w,P):P}else{const P=g-l.top-l.bottom;S=u||_?ca(x,P):P}if(_&&!u){const P=no(l.left,0),A=no(l.right,0),k=no(l.top,0),D=no(l.bottom,0);f?R=h-2*(P!==0||A!==0?P+A:no(l.left,l.right)):S=g-2*(k!==0||D!==0?k+D:no(l.top,l.bottom))}await s({...t,availableWidth:R,availableHeight:S});const C=await o.getDimensions(i.floating);return h!==C.width||g!==C.height?{reset:{rects:!0}}:{}}}};function da(e){return FA(e)?(e.nodeName||"").toLowerCase():"#document"}function so(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ds(e){var t;return(t=(FA(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function FA(e){return e instanceof Node||e instanceof so(e).Node}function ls(e){return e instanceof Element||e instanceof so(e).Element}function Si(e){return e instanceof HTMLElement||e instanceof so(e).HTMLElement}function fP(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof so(e).ShadowRoot}function jf(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=$o(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function OQ(e){return["table","td","th"].includes(da(e))}function T1(e){const t=D1(),n=$o(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 PQ(e){let t=Yc(e);for(;Si(t)&&!Tm(t);){if(T1(t))return t;t=Yc(t)}return null}function D1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Tm(e){return["html","body","#document"].includes(da(e))}function $o(e){return so(e).getComputedStyle(e)}function Dm(e){return ls(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Yc(e){if(da(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fP(e)&&e.host||ds(e);return fP(t)?t.host:t}function jA(e){const t=Yc(e);return Tm(t)?e.ownerDocument?e.ownerDocument.body:e.body:Si(t)&&jf(t)?t:jA(t)}function jd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=jA(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=so(o);return i?t.concat(s,s.visualViewport||[],jf(o)?o:[],s.frameElement&&n?jd(s.frameElement):[]):t.concat(o,jd(o,[],n))}function zA(e){const t=$o(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Si(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Tg(n)!==i||Tg(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function $1(e){return ls(e)?e:e.contextElement}function yc(e){const t=$1(e);if(!Si(t))return ua(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=zA(t);let s=(i?Tg(n.width):n.width)/r,a=(i?Tg(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const TQ=ua(0);function BA(e){const t=so(e);return!D1()||!t.visualViewport?TQ:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function DQ(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==so(e)?!1:t}function ml(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=$1(e);let s=ua(1);t&&(r?ls(r)&&(s=yc(r)):s=yc(e));const a=DQ(i,n,r)?BA(i):ua(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,f=o.height/s.y;if(i){const h=so(i),g=r&&ls(r)?so(r):r;let v=h.frameElement;for(;v&&r&&g!==h;){const b=yc(v),x=v.getBoundingClientRect(),w=$o(v),_=x.left+(v.clientLeft+parseFloat(w.paddingLeft))*b.x,S=x.top+(v.clientTop+parseFloat(w.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,f*=b.y,l+=_,c+=S,v=so(v).frameElement}}return $g({width:u,height:f,x:l,y:c})}function $Q(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Si(n),i=ds(n);if(n===i)return t;let s={scrollLeft:0,scrollTop:0},a=ua(1);const l=ua(0);if((o||!o&&r!=="fixed")&&((da(n)!=="body"||jf(i))&&(s=Dm(n)),Si(n))){const c=ml(n);a=yc(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 AQ(e){return Array.from(e.getClientRects())}function VA(e){return ml(ds(e)).left+Dm(e).scrollLeft}function kQ(e){const t=ds(e),n=Dm(e),r=e.ownerDocument.body,o=no(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=no(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+VA(e);const a=-n.scrollTop;return $o(r).direction==="rtl"&&(s+=no(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function MQ(e,t){const n=so(e),r=ds(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const c=D1();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function IQ(e,t){const n=ml(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Si(e)?yc(e):ua(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function hP(e,t,n){let r;if(t==="viewport")r=MQ(e,n);else if(t==="document")r=kQ(ds(e));else if(ls(t))r=IQ(t,n);else{const o=BA(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return $g(r)}function HA(e,t){const n=Yc(e);return n===t||!ls(n)||Tm(n)?!1:$o(n).position==="fixed"||HA(n,t)}function NQ(e,t){const n=t.get(e);if(n)return n;let r=jd(e,[],!1).filter(a=>ls(a)&&da(a)!=="body"),o=null;const i=$o(e).position==="fixed";let s=i?Yc(e):e;for(;ls(s)&&!Tm(s);){const a=$o(s),l=T1(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||jf(s)&&!l&&HA(e,s))?r=r.filter(u=>u!==s):o=a,s=Yc(s)}return t.set(e,r),r}function LQ(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?NQ(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const f=hP(t,u,o);return c.top=no(f.top,c.top),c.right=ca(f.right,c.right),c.bottom=ca(f.bottom,c.bottom),c.left=no(f.left,c.left),c},hP(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function FQ(e){return zA(e)}function jQ(e,t,n){const r=Si(t),o=ds(t),i=n==="fixed",s=ml(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=ua(0);if(r||!r&&!i)if((da(t)!=="body"||jf(o))&&(a=Dm(t)),r){const c=ml(t,!0,i,t);l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}else o&&(l.x=VA(o));return{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function pP(e,t){return!Si(e)||$o(e).position==="fixed"?null:t?t(e):e.offsetParent}function WA(e,t){const n=so(e);if(!Si(e))return n;let r=pP(e,t);for(;r&&OQ(r)&&$o(r).position==="static";)r=pP(r,t);return r&&(da(r)==="html"||da(r)==="body"&&$o(r).position==="static"&&!T1(r))?n:r||PQ(e)||n}const zQ=async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||WA,i=this.getDimensions;return{reference:jQ(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}};function BQ(e){return $o(e).direction==="rtl"}const VQ={convertOffsetParentRelativeRectToViewportRelativeRect:$Q,getDocumentElement:ds,getClippingRect:LQ,getOffsetParent:WA,getElementRects:zQ,getClientRects:AQ,getDimensions:FQ,getScale:yc,isElement:ls,isRTL:BQ};function HQ(e,t){let n=null,r;const o=ds(e);function i(){clearTimeout(r),n&&n.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:c,top:u,width:f,height:h}=e.getBoundingClientRect();if(a||t(),!f||!h)return;const g=mp(u),v=mp(o.clientWidth-(c+f)),b=mp(o.clientHeight-(u+h)),x=mp(c),_={rootMargin:-g+"px "+-v+"px "+-b+"px "+-x+"px",threshold:no(0,ca(1,l))||1};let S=!0;function R(C){const P=C[0].intersectionRatio;if(P!==l){if(!S)return s();P?s(!1,P):r=setTimeout(()=>{s(!1,1e-7)},100)}S=!1}try{n=new IntersectionObserver(R,{..._,root:o.ownerDocument})}catch{n=new IntersectionObserver(R,_)}n.observe(e)}return s(!0),i}function WQ(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=$1(e),u=o||i?[...c?jd(c):[],...jd(t)]:[];u.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const f=c&&a?HQ(c,n):null;let h=-1,g=null;s&&(g=new ResizeObserver(w=>{let[_]=w;_&&_.target===c&&g&&(g.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{g&&g.observe(t)})),n()}),c&&!l&&g.observe(c),g.observe(t));let v,b=l?ml(e):null;l&&x();function x(){const w=ml(e);b&&(w.x!==b.x||w.y!==b.y||w.width!==b.width||w.height!==b.height)&&n(),b=w,v=requestAnimationFrame(x)}return n(),()=>{u.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f&&f(),g&&g.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const UQ=(e,t,n)=>{const r=new Map,o={platform:VQ,...n},i={...o.platform,_c:r};return yQ(e,t,{...o,platform:i})},qQ=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?cP({element:r.current,padding:o}).fn(n):{}:r?cP({element:r,padding:o}).fn(n):{}}}};var og=typeof document<"u"?m.useLayoutEffect:m.useEffect;function Ag(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,o;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(!Ag(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Ag(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function UA(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gP(e,t){const n=UA(e);return Math.round(t*n)/n}function mP(e){const t=V.useRef(e);return og(()=>{t.current=e}),t}function GQ(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,f]=V.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,g]=V.useState(r);Ag(h,r)||g(r);const[v,b]=V.useState(null),[x,w]=V.useState(null),_=V.useCallback(Q=>{Q!=P.current&&(P.current=Q,b(Q))},[b]),S=V.useCallback(Q=>{Q!==A.current&&(A.current=Q,w(Q))},[w]),R=i||v,C=s||x,P=V.useRef(null),A=V.useRef(null),k=V.useRef(u),D=mP(l),I=mP(o),F=V.useCallback(()=>{if(!P.current||!A.current)return;const Q={placement:t,strategy:n,middleware:h};I.current&&(Q.platform=I.current),UQ(P.current,A.current,Q).then(W=>{const Y={...W,isPositioned:!0};B.current&&!Ag(k.current,Y)&&(k.current=Y,uw.flushSync(()=>{f(Y)}))})},[h,t,n,I]);og(()=>{c===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,f(Q=>({...Q,isPositioned:!1})))},[c]);const B=V.useRef(!1);og(()=>(B.current=!0,()=>{B.current=!1}),[]),og(()=>{if(R&&(P.current=R),C&&(A.current=C),R&&C){if(D.current)return D.current(R,C,F);F()}},[R,C,F,D]);const K=V.useMemo(()=>({reference:P,floating:A,setReference:_,setFloating:S}),[_,S]),Z=V.useMemo(()=>({reference:R,floating:C}),[R,C]),z=V.useMemo(()=>{const Q={position:n,left:0,top:0};if(!Z.floating)return Q;const W=gP(Z.floating,u.x),Y=gP(Z.floating,u.y);return a?{...Q,transform:"translate("+W+"px, "+Y+"px)",...UA(Z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:Y}},[n,a,Z.floating,u.x,u.y]);return V.useMemo(()=>({...u,update:F,refs:K,elements:Z,floatingStyles:z}),[u,F,K,Z,z])}function $m(e){const[t,n]=m.useState(void 0);return ur(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.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 qA="Popper",[GA,Ti]=Zn(qA),[YQ,YA]=GA(qA),KQ=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return m.createElement(YQ,{scope:t,anchor:r,onAnchorChange:o},n)},XQ="PopperAnchor",QQ=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=YA(XQ,n),s=m.useRef(null),a=_t(t,s);return m.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:m.createElement(Qe.div,he({},o,{ref:a}))}),KA="PopperContent",[JQ,aye]=GA(KA),ZQ=m.forwardRef((e,t)=>{var n,r,o,i,s,a,l,c;const{__scopePopper:u,side:f="bottom",sideOffset:h=0,align:g="center",alignOffset:v=0,arrowPadding:b=0,avoidCollisions:x=!0,collisionBoundary:w=[],collisionPadding:_=0,sticky:S="partial",hideWhenDetached:R=!1,updatePositionStrategy:C="optimized",onPlaced:P,...A}=e,k=YA(KA,u),[D,I]=m.useState(null),F=_t(t,Pe=>I(Pe)),[B,K]=m.useState(null),Z=$m(B),z=(n=Z==null?void 0:Z.width)!==null&&n!==void 0?n:0,Q=(r=Z==null?void 0:Z.height)!==null&&r!==void 0?r:0,W=f+(g!=="center"?"-"+g:""),Y=typeof _=="number"?_:{top:0,right:0,bottom:0,left:0,..._},oe=Array.isArray(w)?w:[w],$=oe.length>0,H={padding:Y,boundary:oe.filter(eJ),altBoundary:$},{refs:J,floatingStyles:N,placement:ce,isPositioned:le,middlewareData:de}=GQ({strategy:"fixed",placement:W,whileElementsMounted:(...Pe)=>WQ(...Pe,{animationFrame:C==="always"}),elements:{reference:k.anchor},middleware:[SQ({mainAxis:h+Q,alignmentAxis:v}),x&&CQ({mainAxis:!0,crossAxis:!1,limiter:S==="partial"?EQ():void 0,...H}),x&&xQ({...H}),RQ({...H,apply:({elements:Pe,rects:Te,availableWidth:Ue,availableHeight:Be})=>{const{width:Ie,height:Ke}=Te.reference,lt=Pe.floating.style;lt.setProperty("--radix-popper-available-width",`${Ue}px`),lt.setProperty("--radix-popper-available-height",`${Be}px`),lt.setProperty("--radix-popper-anchor-width",`${Ie}px`),lt.setProperty("--radix-popper-anchor-height",`${Ke}px`)}}),B&&qQ({element:B,padding:b}),tJ({arrowWidth:z,arrowHeight:Q}),R&&wQ({strategy:"referenceHidden",...H})]}),[pe,ie]=XA(ce),te=Ln(P);ur(()=>{le&&(te==null||te())},[le,te]);const ae=(o=de.arrow)===null||o===void 0?void 0:o.x,ye=(i=de.arrow)===null||i===void 0?void 0:i.y,G=((s=de.arrow)===null||s===void 0?void 0:s.centerOffset)!==0,[be,_e]=m.useState();return ur(()=>{D&&_e(window.getComputedStyle(D).zIndex)},[D]),m.createElement("div",{ref:J.setFloating,"data-radix-popper-content-wrapper":"",style:{...N,transform:le?N.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:be,"--radix-popper-transform-origin":[(a=de.transformOrigin)===null||a===void 0?void 0:a.x,(l=de.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:e.dir},m.createElement(JQ,{scope:u,placedSide:pe,onArrowChange:K,arrowX:ae,arrowY:ye,shouldHideArrow:G},m.createElement(Qe.div,he({"data-side":pe,"data-align":ie},A,{ref:F,style:{...A.style,animation:le?void 0:"none",opacity:(c=de.hide)!==null&&c!==void 0&&c.referenceHidden?0:void 0}}))))});function eJ(e){return e!==null}const tJ=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o,i,s;const{placement:a,rects:l,middlewareData:c}=t,f=((n=c.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,h=f?0:e.arrowWidth,g=f?0:e.arrowHeight,[v,b]=XA(a),x={start:"0%",center:"50%",end:"100%"}[b],w=((r=(o=c.arrow)===null||o===void 0?void 0:o.x)!==null&&r!==void 0?r:0)+h/2,_=((i=(s=c.arrow)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0)+g/2;let S="",R="";return v==="bottom"?(S=f?x:`${w}px`,R=`${-g}px`):v==="top"?(S=f?x:`${w}px`,R=`${l.floating.height+g}px`):v==="right"?(S=`${-g}px`,R=f?x:`${_}px`):v==="left"&&(S=`${l.floating.width+g}px`,R=f?x:`${_}px`),{data:{x:S,y:R}}}});function XA(e){const[t,n="center"]=e.split("-");return[t,n]}const zf=KQ,Bf=QQ,Vf=ZQ,A1=m.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...o}=e;return r?ko.createPortal(m.createElement(Qe.div,he({},o,{ref:t})),r):null}),nJ=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(rJ);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(vx,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(vx,he({},r,{ref:t}),n)});nJ.displayName="Slot";const vx=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...oJ(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});vx.displayName="SlotClone";const QA=({children:e})=>m.createElement(m.Fragment,null,e);function rJ(e){return m.isValidElement(e)&&e.type===QA}function oJ(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const JA=m.forwardRef((e,t)=>m.createElement(Qe.span,he({},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}}))),iJ=JA,[Am,lye]=Zn("Tooltip",[Ti]),k1=Ti(),sJ="TooltipProvider",aJ=700,bx="tooltip.open",[lJ,M1]=Am(sJ),cJ=e=>{const{__scopeTooltip:t,delayDuration:n=aJ,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,a]=m.useState(!0),l=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),m.createElement(lJ,{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(u=>{l.current=u},[]),disableHoverableContent:o},i)},I1="Tooltip",[uJ,km]=Am(I1),dJ=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=M1(I1,e.__scopeTooltip),c=k1(t),[u,f]=m.useState(null),h=Jo(),g=m.useRef(0),v=s??l.disableHoverableContent,b=a??l.delayDuration,x=m.useRef(!1),[w=!1,_]=xr({prop:r,defaultProp:o,onChange:A=>{A?(l.onOpen(),document.dispatchEvent(new CustomEvent(bx))):l.onClose(),i==null||i(A)}}),S=m.useMemo(()=>w?x.current?"delayed-open":"instant-open":"closed",[w]),R=m.useCallback(()=>{window.clearTimeout(g.current),x.current=!1,_(!0)},[_]),C=m.useCallback(()=>{window.clearTimeout(g.current),_(!1)},[_]),P=m.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{x.current=!0,_(!0)},b)},[b,_]);return m.useEffect(()=>()=>window.clearTimeout(g.current),[]),m.createElement(zf,c,m.createElement(uJ,{scope:t,contentId:h,open:w,stateAttribute:S,trigger:u,onTriggerChange:f,onTriggerEnter:m.useCallback(()=>{l.isOpenDelayed?P():R()},[l.isOpenDelayed,P,R]),onTriggerLeave:m.useCallback(()=>{v?C():window.clearTimeout(g.current)},[C,v]),onOpen:R,onClose:C,disableHoverableContent:v},n))},vP="TooltipTrigger",ZA=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=km(vP,n),i=M1(vP,n),s=k1(n),a=m.useRef(null),l=_t(t,a,o.onTriggerChange),c=m.useRef(!1),u=m.useRef(!1),f=m.useCallback(()=>c.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),m.createElement(Bf,he({asChild:!0},s),m.createElement(Qe.button,he({"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute},r,{ref:l,onPointerMove:Me(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:Me(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:Me(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Me(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:Me(e.onBlur,o.onClose),onClick:Me(e.onClick,o.onClose)})))}),fJ="TooltipPortal",[cye,hJ]=Am(fJ,{forceMount:void 0}),zd="TooltipContent",pJ=m.forwardRef((e,t)=>{const n=hJ(zd,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=km(zd,e.__scopeTooltip);return m.createElement(er,{present:r||s.open},s.disableHoverableContent?m.createElement(ek,he({side:o},i,{ref:t})):m.createElement(gJ,he({side:o},i,{ref:t})))}),gJ=m.forwardRef((e,t)=>{const n=km(zd,e.__scopeTooltip),r=M1(zd,e.__scopeTooltip),o=m.useRef(null),i=_t(t,o),[s,a]=m.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:f}=r,h=m.useCallback(()=>{a(null),f(!1)},[f]),g=m.useCallback((v,b)=>{const x=v.currentTarget,w={x:v.clientX,y:v.clientY},_=vJ(w,x.getBoundingClientRect()),S=bJ(w,_),R=yJ(b.getBoundingClientRect()),C=wJ([...S,...R]);a(C),f(!0)},[f]);return m.useEffect(()=>()=>h(),[h]),m.useEffect(()=>{if(l&&u){const v=x=>g(x,u),b=x=>g(x,l);return l.addEventListener("pointerleave",v),u.addEventListener("pointerleave",b),()=>{l.removeEventListener("pointerleave",v),u.removeEventListener("pointerleave",b)}}},[l,u,g,h]),m.useEffect(()=>{if(s){const v=b=>{const x=b.target,w={x:b.clientX,y:b.clientY},_=(l==null?void 0:l.contains(x))||(u==null?void 0:u.contains(x)),S=!xJ(w,s);_?h():S&&(h(),c())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[l,u,s,c,h]),m.createElement(ek,he({},e,{ref:i}))}),[mJ,uye]=Am(I1,{isInside:!1}),ek=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=km(zd,n),c=k1(n),{onClose:u}=l;return m.useEffect(()=>(document.addEventListener(bx,u),()=>document.removeEventListener(bx,u)),[u]),m.useEffect(()=>{if(l.trigger){const f=h=>{const g=h.target;g!=null&&g.contains(l.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,u]),m.createElement(Ff,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:u},m.createElement(Vf,he({"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(QA,null,r),m.createElement(mJ,{scope:n,isInside:!0},m.createElement(iJ,{id:l.contentId,role:"tooltip"},o||r))))});function vJ(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function bJ(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 yJ(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function xJ(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function wJ(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),_J(t)}function _J(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}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 SJ=cJ,CJ=dJ,EJ=ZA,tk=pJ,RJ=SJ,nk=CJ,rk=EJ,N1=V.forwardRef(({className:e,sideOffset:t=4,...n},r)=>O.jsx(tk,{ref:r,sideOffset:t,className:Ee("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}));N1.displayName=tk.displayName;function ll({number:e,decimalPlaces:t=0,useSuffix:n=!1,customSuffix:r="",currency:o="",locale:i="en-US"}){let s=1,a=r,l=i;const c=t;n&&!r&&(e>=1e9?(s=1e9,a="B"):e>=1e7&&i==="en-IN"?(s=1e7,a="Cr"):e>=1e5&&i==="en-IN"?(s=1e5,a="L"):e>=1e6?(s=1e6,a="M"):e>=1e3&&(s=1e3,a="K"));const u=e/s,f={maximumFractionDigits:c,minimumFractionDigits:c};if(o){f.style="currency",f.currency=o;try{new Intl.NumberFormat(i,f).format(0)}catch{f.currency="USD"}}try{new Intl.NumberFormat(i,f).format(0)}catch{l="en-US"}let g=new Intl.NumberFormat(l,f).format(u);return n&&(g+=a),g}function ok(e,t){if(!t)return"";const n=t.find(r=>e>=r.start&&e<=r.end);return(n==null?void 0:n.color)||""}function ik({card:e,isLoading:t}){var w,_,S,R,C,P,A,k,D,I,F,B,K,Z,z,Q,W,Y,oe,$,H,J,N,ce;const n=ke(le=>le.actions.setCardTitle),r=ke(le=>le.actions.setCardDescription),o=ke(le=>le.isVisualEditing),i=Ar(le=>le.card),s=Ar(le=>le.actions.setCard);Ar(le=>le.actions.setNumberFormat);const a=ke(le=>le.selectedSheetId),l=e.data,c=(_=(w=e.preferences)==null?void 0:w.formatNumber)==null?void 0:_.colorRanges,{metricKeys:u}=ar(l||[]),f=(S=l==null?void 0:l[0])==null?void 0:S[u==null?void 0:u[0]],h=(R=l==null?void 0:l[0])==null?void 0:R[u==null?void 0:u[1]],g=!!e.data&&e.data.length>0;function v(le){o?s({...i,title:le}):n(a,e.id,le)}function b(le){o?s({...i,description:le}):r(a,e.id,le)}const x=h&&h-f!==0?(f-h)/h:null;return O.jsxs("div",{className:"kpi-card flex grow flex-col overflow-scroll",children:[O.jsxs(sm,{className:"grow pb-3",children:[O.jsx(is,{text:o?i.title:e.title,onSave:v,children:O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx(Df,{className:"text-base font-medium text-muted-foreground",children:e.title}),!e.refreshInterval&&t&&O.jsx(S1,{className:"h-4 w-4 animate-spin text-muted-foreground"})]})}),g&&O.jsxs("div",{className:"flex flex-wrap items-end gap-3 text-foreground",children:[O.jsx("p",{style:{color:ok(f,c)},className:"text-3xl font-semibold",children:ll({number:f,decimalPlaces:((P=(C=e.preferences)==null?void 0:C.formatNumber)==null?void 0:P.decimalPlaces)||0,useSuffix:!!((k=(A=e.preferences)==null?void 0:A.formatNumber)!=null&&k.suffix),customSuffix:((I=(D=e.preferences)==null?void 0:D.formatNumber)==null?void 0:I.suffix)||"",locale:((B=(F=e.preferences)==null?void 0:F.formatNumber)==null?void 0:B.locale)||"",currency:((Z=(K=e.preferences)==null?void 0:K.formatNumber)==null?void 0:Z.currency)||""})}),h&&O.jsxs("span",{className:"min-w-fit text-base font-normal text-muted-foreground",children:["from ",ll({number:h,decimalPlaces:((Q=(z=e.preferences)==null?void 0:z.formatNumber)==null?void 0:Q.decimalPlaces)||0,useSuffix:!!((Y=(W=e.preferences)==null?void 0:W.formatNumber)!=null&&Y.suffix),customSuffix:(($=(oe=e.preferences)==null?void 0:oe.formatNumber)==null?void 0:$.suffix)||"",locale:((J=(H=e.preferences)==null?void 0:H.formatNumber)==null?void 0:J.locale)||"",currency:((ce=(N=e.preferences)==null?void 0:N.formatNumber)==null?void 0:ce.currency)||""})]})]})]}),x&&O.jsxs(am,{className:"grow items-start gap-1 pb-4 text-sm",children:[O.jsx(OJ,{children:x}),O.jsxs("div",{className:"flex gap-1 text-muted-foreground",children:[x>0?"up ":"down ",O.jsx(is,{text:e.description||"",onSave:b,children:e.description})]})]})]})}function OJ({children:e}){const t=e>0?O.jsx(w1,{className:"h-4 w-4"}):O.jsx(x1,{className:"h-4 w-4"}),n=`${Math.abs(e*100).toFixed(0)}%`;return O.jsxs("div",{className:Ee("flex items-center",{"text-green-600":e>0,"text-destructive":e<0}),children:[t,O.jsx("span",{className:"ml-[1px]",children:n})]})}var Kc=1e3,Xc=Kc*60,Qc=Xc*60,vl=Qc*24,PJ=vl*7,TJ=vl*365.25,DJ=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return $J(e);if(n==="number"&&isFinite(e))return t.long?kJ(e):AJ(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function $J(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*TJ;case"weeks":case"week":case"w":return n*PJ;case"days":case"day":case"d":return n*vl;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Qc;case"minutes":case"minute":case"mins":case"min":case"m":return n*Xc;case"seconds":case"second":case"secs":case"sec":case"s":return n*Kc;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function AJ(e){var t=Math.abs(e);return t>=vl?Math.round(e/vl)+"d":t>=Qc?Math.round(e/Qc)+"h":t>=Xc?Math.round(e/Xc)+"m":t>=Kc?Math.round(e/Kc)+"s":e+"ms"}function kJ(e){var t=Math.abs(e);return t>=vl?vp(e,t,vl,"day"):t>=Qc?vp(e,t,Qc,"hour"):t>=Xc?vp(e,t,Xc,"minute"):t>=Kc?vp(e,t,Kc,"second"):e+" ms"}function vp(e,t,n,r){var o=t>=n*1.5;return Math.round(e/n)+" "+r+(o?"s":"")}const MJ=nu(DJ);function sk({children:e}){const{setIsSessionExpired:t}=Mo(),n=new Qz({queryCache:new pD({onError:r=>{console.error(`Something went wrong: ${r.message}`),r.message==="invalid token"&&t(!0)}}),defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});return O.jsx(tB,{client:n,children:e})}const IJ={id:"",authToken:void 0},ak=m.createContext(IJ),lk=({children:e,dashboardProps:t})=>O.jsx(sk,{children:O.jsx(ak.Provider,{value:t,children:e})});function ma(){const e=m.useContext(ak);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}function NJ(e){ke(u=>u.bookmarkKey),ke(u=>u.selectedSheetId);const t=ke(u=>u.dashboard.baseQueries),n=ke(u=>u.actions.getCardSheet),{authToken:r}=ma(),o=ke(u=>u.authToken),i=ke(u=>u.filterValues),s=ke(u=>u.isDashboardEditing),a=MJ((e==null?void 0:e.refreshInterval)||"0");n(e.id);const l=Y2(e.sql,t);return Tf({queryKey:[e.id,l],queryFn:()=>Rf("https://semaphor.cloud/api/v1/query",(r==null?void 0:r.accessToken)||(o==null?void 0:o.accessToken)||"",{connection_id:e.connectionId,sql:l,python:e.python===aD?"":e.python,active_filters:i}),refetchInterval:a,enabled:!!e.connectionId&&!s})}function Ia({data:e,cfg:t,customCfg:n,preferences:r}){const{dimensionKeys:o,metricKeys:i}=ar(e),s=zX(i,e,r),a=rg(s,n),l=o[0],c=fx(e,l);L1(r,t),ck(r);const u=uk(t,r),f=qo((t==null?void 0:t.options)||{},r==null?void 0:r.chartOptions),h=qo(u,f),g=qo(h,(n==null?void 0:n.options)||{});return{type:(n==null?void 0:n.type)||(t==null?void 0:t.type)||"bar",data:{labels:c,datasets:a},options:g}}function L1(e,t){var o,i,s;const n=((o=t==null?void 0:t.options)==null?void 0:o.indexAxis)==="y"?"x":"y";return(i=e==null?void 0:e.chartOptions)!=null&&i.indexAxis?((s=e==null?void 0:e.chartOptions)==null?void 0:s.indexAxis)==="x"?"y":"x":n}function ck(e){var n,r;return(n=e==null?void 0:e.chartOptions)!=null&&n.indexAxis?((r=e==null?void 0:e.chartOptions)==null?void 0:r.indexAxis)==="x"?"x":"y":"x"}function uk(e,t){var i,s,a,l,c,u,f,h,g,v,b,x;const n=L1(t,e),r=ck(t);return{...e==null?void 0:e.options,scales:{...(i=e==null?void 0:e.options)==null?void 0:i.scales,[n]:{...(a=(s=e==null?void 0:e.options)==null?void 0:s.scales)==null?void 0:a[n],ticks:{...(u=(c=(l=e==null?void 0:e.options)==null?void 0:l.scales)==null?void 0:c[n])==null?void 0:u.ticks,callback:w=>{var _,S,R,C;return ll({number:Number(w),decimalPlaces:((_=t==null?void 0:t.numberAxisFormat)==null?void 0:_.decimalPlaces)||0,useSuffix:!!((S=t==null?void 0:t.numberAxisFormat)!=null&&S.suffix),customSuffix:"",locale:((R=t==null?void 0:t.numberAxisFormat)==null?void 0:R.locale)||"",currency:((C=t==null?void 0:t.numberAxisFormat)==null?void 0:C.currency)||""})}}},[r]:{...(g=(h=(f=e==null?void 0:e.options)==null?void 0:f.scales)==null?void 0:h[r])==null?void 0:g.ticks,callback:null}},plugins:{...(v=e==null?void 0:e.options)==null?void 0:v.plugins,datalabels:{...(x=(b=e==null?void 0:e.options)==null?void 0:b.plugins)==null?void 0:x.datalabels,formatter:function(w){var _,S,R,C;return ll({number:Number(w),decimalPlaces:((_=t==null?void 0:t.numberAxisFormat)==null?void 0:_.decimalPlaces)||0,useSuffix:!!((S=t==null?void 0:t.numberAxisFormat)!=null&&S.suffix),customSuffix:"",locale:((R=t==null?void 0:t.numberAxisFormat)==null?void 0:R.locale)||"",currency:((C=t==null?void 0:t.numberAxisFormat)==null?void 0:C.currency)||""})}}}}}function LJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0},y:{display:!0}}}}}function FJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{beginAtZero:!0,stack:1,reverse:!0},y:{stacked:!0,beginAtZero:!0}}}}}function jJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function zJ(e,t=!1){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0,beginAtZero:!1},y:{display:!0,stacked:t}}}}}function BJ(e,t){var r,o,i,s;return{...e,type:t==="stackedBar"?"bar":"line",options:{...e==null?void 0:e.options,scales:{x:{...(o=(r=e==null?void 0:e.options)==null?void 0:r.scales)==null?void 0:o.x,display:!0,stacked:!0},y:{...(s=(i=e==null?void 0:e.options)==null?void 0:i.scales)==null?void 0:s.y,display:!0,stacked:!0}}}}}function VJ(e){return{...e,type:"line",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function HJ(e,t){var r;return{...t,type:e,options:{...t==null?void 0:t.options,scales:{x:{display:!1},y:{display:!1}},plugins:{...(r=t==null?void 0:t.options)==null?void 0:r.plugins,legend:{position:"top",align:"center",maxHeight:0,labels:{useBorderRadius:!0,borderRadius:2}}},borderRadius:0}}}function WJ(e){return{...e,type:"radar",options:{...e==null?void 0:e.options,scales:{x:{display:!1},y:{display:!1}}}}}function UJ(e){const n=new Function("getDatalabelColor",e)(w0);return{options:n==null?void 0:n.options,plugins:(n==null?void 0:n.plugins)||[]}}function F1({data:e,cardType:t="bar",cfg:n,customCfg:r,provider:o="chartjs",userSettings:i,preferences:s}){var a,l,c;if(t==="bar"){const u=jJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="horizontalBar"){const u=LJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="pyramid"){const u=FJ(n),{dimensionKeys:f,metricKeys:h}=ar(e),g=Pg({dataArray:e,groupKey:f[0],pivotKey:f[1],valueKey:h[0]}),v=Ia({data:g,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s}),b="x2";return{...v,data:{...v.data,datasets:v.data.datasets.map((w,_)=>_===1?{...w,xAxisID:b}:w)},options:{...v.options,scales:{...(a=v==null?void 0:v.options)==null?void 0:a.scales,[b]:{beginAtZero:!0,stack:1}}}}}if(t==="stackedBar"||t==="stackedLine"){const u=BJ(n,t),{dimensionKeys:f,metricKeys:h}=ar(e),g=Pg({dataArray:e,groupKey:f[0],pivotKey:f[1],valueKey:h[0]});return Ia({data:g,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="line"){const u=VJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="range"){const u=zJ(n),f=HX(e),h=rg(f,r),{plugins:g,options:v}=UJ((s==null?void 0:s.customVisualCode)||""),b=qo((u==null?void 0:u.options)||{},(n==null?void 0:n.options)||{}),x=qo(b,(s==null?void 0:s.chartOptions)||{}),w=qo(x,(r==null?void 0:r.options)||{}),_=qo(w,v),S=uk(n,s),R=qo(_,S),C={...R,plugins:{...R==null?void 0:R.plugins,datalabels:{...(l=R==null?void 0:R.plugins)==null?void 0:l.datalabels,formatter:(I,F)=>I.map(K=>{var Z,z,Q,W;return ll({number:Number(K),decimalPlaces:((Z=s==null?void 0:s.numberAxisFormat)==null?void 0:Z.decimalPlaces)||0,useSuffix:!!((z=s==null?void 0:s.numberAxisFormat)!=null&&z.suffix),customSuffix:"",locale:((Q=s==null?void 0:s.numberAxisFormat)==null?void 0:Q.locale)||"",currency:((W=s==null?void 0:s.numberAxisFormat)==null?void 0:W.currency)||""})}).slice(0,2).join(" - ")}}},{dimensionKeys:P}=ar(e),A=P[0];return{type:"bar",data:{labels:[...new Set(fx(e,A))],datasets:h},options:C,plugins:[...g]}}if(t==="pie"||t==="doughnut"||t==="polarArea"){const u=HJ(t,n),{dimensionKeys:f,metricKeys:h}=ar(e),g=WX(h,e),v=rg(g,r),b=f[0],x=fx(e,b),w=qo((u==null?void 0:u.options)||{},(r==null?void 0:r.options)||{}),_=qo(w,(s==null?void 0:s.chartOptions)||{}),S={..._,plugins:{..._.plugins,datalabels:{...(c=_.plugins)==null?void 0:c.datalabels,formatter:(P,A)=>{var k,D,I,F;return ll({number:Number(P),decimalPlaces:((k=s==null?void 0:s.numberAxisFormat)==null?void 0:k.decimalPlaces)||0,useSuffix:!!((D=s==null?void 0:s.numberAxisFormat)!=null&&D.suffix),customSuffix:"",locale:((I=s==null?void 0:s.numberAxisFormat)==null?void 0:I.locale)||"",currency:((F=s==null?void 0:s.numberAxisFormat)==null?void 0:F.currency)||""})}}}};return{type:t,data:{labels:x,datasets:v},options:S,plugins:[t==="doughnut"?{id:"doughnutLabel",beforeDatasetsDraw:function(P,A,k){var Q,W,Y,oe;const{ctx:D,data:I}=P;D.save();const F=P.getDatasetMeta(0).data[0].x,B=P.getDatasetMeta(0).data[0].y,K=Bc(Od());D.font="1.2rem Arial",D.fontWeight="bolder",D.fillStyle=K,D.textAlign="center",D.textBaseline="middle";const Z=I.datasets[0].data.reduce(($,H)=>$+H,0),z=ll({number:Number(Z),decimalPlaces:((Q=s==null?void 0:s.numberAxisFormat)==null?void 0:Q.decimalPlaces)||0,useSuffix:!!((W=s==null?void 0:s.numberAxisFormat)!=null&&W.suffix),customSuffix:"",locale:((Y=s==null?void 0:s.numberAxisFormat)==null?void 0:Y.locale)||"",currency:((oe=s==null?void 0:s.numberAxisFormat)==null?void 0:oe.currency)||""});D.fillText(z,F,B)}}:""]}}if(t==="radar"){const u=WJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="bubble"||t==="scatter"){const{metricKeys:u}=ar(e);if(u.length<3){console.log("Bubble charts require 3 numeric columns");return}const f=VX(e),h=rg(f,r),g={plugins:{datalabels:{display:!0}},scales:{x:{title:{display:!0,text:u[0]},beginAtZero:!0,ticks:{precision:0}},y:{title:{display:!0,text:u[1]},beginAtZero:!0,ticks:{precision:0}}}},v=qo(g,(r==null?void 0:r.options)||{});return{type:t,data:{datasets:h},options:v}}return Ia({data:e,cfg:n,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}function qJ({chart:e,elementIndex:t,datasetIndex:n,cardType:r,cfg:o,apply:i}){const s=ke.getState().theme;if(!o)return;const a=s==="dark"?"rgb(238,238,238,0.2)":"rgb(238,238,238,0.8)";["bar","line","horizontalBar","bubble","scatter"].includes(r)&&YJ(e,t,o,i,a),["pie","doughnut","polarArea"].includes(r)&&KJ(e,t,o,i,a),["stackedBar","pyramid"].includes(r)&&GJ({chart:e,elementIndex:t,datasetIndex:n,cfg:o,apply:i,blurColor:a})}function GJ(e){var a,l,c,u;const{chart:t,elementIndex:n,datasetIndex:r,cfg:o,apply:i,blurColor:s}=e;i?(l=(a=t==null?void 0:t.data)==null?void 0:a.datasets)==null||l.forEach((f,h)=>{var g,v;typeof f.backgroundColor=="string"&&(f.backgroundColor=new Array(f.data.length).fill(f.backgroundColor),f.borderColor=new Array(f.data.length).fill(f.borderColor)),f.backgroundColor=(g=f==null?void 0:f.backgroundColor)==null?void 0:g.map((b,x)=>x===n&&h===r?b:s),f.borderColor=(v=f==null?void 0:f.borderColor)==null?void 0:v.map((b,x)=>x===n&&h===r?b:s)}):(u=(c=t==null?void 0:t.data)==null?void 0:c.datasets)==null||u.forEach((f,h)=>{var g,v,b,x,w,_;f.backgroundColor=new Array(f.data.length).fill((b=(v=(g=o==null?void 0:o.data)==null?void 0:g.datasets)==null?void 0:v[h])==null?void 0:b.backgroundColor),f.borderColor=new Array(f.data.length).fill((_=(w=(x=o==null?void 0:o.data)==null?void 0:x.datasets)==null?void 0:w[h])==null?void 0:_.borderColor)}),t==null||t.update()}function YJ(e,t,n,r,o){var i,s,a,l;console.log("clicked index",t),r?(s=(i=e==null?void 0:e.data)==null?void 0:i.datasets)==null||s.forEach(c=>{var u,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=(u=c==null?void 0:c.backgroundColor)==null?void 0:u.map((h,g)=>g===t?h:o),c.borderColor=(f=c==null?void 0:c.borderColor)==null?void 0:f.map((h,g)=>g===t?h:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,u)=>{var f,h,g,v,b,x;c.backgroundColor=new Array(c.data.length).fill((g=(h=(f=n==null?void 0:n.data)==null?void 0:f.datasets)==null?void 0:h[u])==null?void 0:g.backgroundColor),c.borderColor=new Array(c.data.length).fill((x=(b=(v=n==null?void 0:n.data)==null?void 0:v.datasets)==null?void 0:b[u])==null?void 0:x.borderColor)}),e==null||e.update()}function KJ(e,t,n,r,o){var i,s,a,l;r?(s=(i=e==null?void 0:e.data)==null?void 0:i.datasets)==null||s.forEach(c=>{var u,f;c.backgroundColor=(u=c==null?void 0:c.backgroundColor)==null?void 0:u.map((h,g)=>g===t?h:o),c.borderColor=(f=c==null?void 0:c.borderColor)==null?void 0:f.map((h,g)=>g===t?h:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,u)=>{var f,h,g,v,b,x,w,_;typeof c.backgroundColor=="string"&&(c.backgroundColor=(g=(h=(f=n==null?void 0:n.data)==null?void 0:f.datasets)==null?void 0:h[u])==null?void 0:g.backgroundColor,c.borderColor=(x=(b=(v=n==null?void 0:n.data)==null?void 0:v.datasets)==null?void 0:b[u])==null?void 0:x.borderColor),c.backgroundColor=(w=c==null?void 0:c.backgroundColor)==null?void 0:w.map((S,R)=>{var C;return(C=n.data.datasets[u].backgroundColor)==null?void 0:C[R]}),c.borderColor=(_=c==null?void 0:c.borderColor)==null?void 0:_.map((S,R)=>{var C;return(C=n.data.datasets[u].borderColor)==null?void 0:C[R]})}),e==null||e.update()}function XJ(e,t,n,r){var o,i;try{if(!e||!e.data)return;const{dimensionKeys:s,metricKeys:a}=ar(e.data);if(["bar","horizontalBar","line","pie","doughnut","radar","polarArea"].includes(e.type)){const l=s[0],c=(o=e.data[n])==null?void 0:o[l];return[{columnName:l,columnValue:c,metric:a[t],value:r}]}if(["stackedBar","pyramid"].includes(e.type)){const l=Pg({dataArray:e.data,groupKey:s[0],pivotKey:s[1],valueKey:a[0]}),c=s[0],u=(i=l[n])==null?void 0:i[c],f=s[1],{metricKeys:h}=ar(l),g=h[t];return[{columnName:c,columnValue:u,metric:a[0],value:r},{columnName:f,columnValue:g,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 QJ(e){var s,a;const[t]=m.useState({id:"",title:"",type:"bar",data:[]}),{getCard:n}=Mo(),r=n(e),o=j1(r||t),i={...r,data:((s=o==null?void 0:o.data)==null?void 0:s.records)||[]};return{...o,data:((a=o==null?void 0:o.data)==null?void 0:a.records)||[],card:i}}function j1(e){var B,K,Z;const{onChartElementClicked:t}=ma(),[n,r]=m.useState(0),o=((B=e==null?void 0:e.preferences)==null?void 0:B.filterOnClickColumnIndex)===void 0?0:(K=e.preferences)==null?void 0:K.filterOnClickColumnIndex,i=ke(z=>z.bookmarkKey);ke(z=>z.isVisualEditing);const s=ke(z=>z.filteringCards),a=ke(z=>z.selectedSheetId);ke(z=>z.selectedCardId),ke(z=>z.isDashboardEditing);const l=ke(z=>z.themeStyle),c=ke(z=>z.filterValues),u=m.useRef(c),f=(Z=e==null?void 0:e.preferences)==null?void 0:Z.onClickFilter,{addFrame:h,addFilteringCard:g,setFrameCardData:v,getSelectedFrame:b,addOrUpdateFilterValue:x,addOrUpdateFilterValues:w,removeFilterValue:_,removeFilteringCard:S}=Mo(),{data:R,isLoading:C,isFetching:P,isError:A,refetch:k}=NJ(e),D=s==null?void 0:s.find(z=>z.id===e.id);let I;e.data&&e.data.length>0&&(I=F1({data:e.data,cardType:e.type,cfg:e.cfg,customCfg:e.customCfg,preferences:e.preferences})),m.useEffect(()=>{!R||!R.records||v(a,e.id,(R==null?void 0:R.records)||[])},[R,a,e.id,v,c]),m.useEffect(()=>{e.data&&r(n+1)},[e.data,e.type,e.cfg,e.customCfg,e.preferences,l]),m.useEffect(()=>{e.connectionId&&!D&&(k(),u.current=c)},[c,i]);function F(z,Q,W,Y){var H,J;let oe=!1;if(!e.data)return;const $=XJ(e,Q,W,Y);if(console.log("fieldValues",$),t==null||t(e,$),!!(((H=e==null?void 0:e.preferences)==null?void 0:H.onClickFilter)??[]).length){if(D){const N=e.id;_(N),S(e)}else{if(oe=!0,!$)return;const N=[];$.forEach((ce,le)=>{const de=f==null?void 0:f.find(ie=>ie.columnIndex===le);if(!de)return;const pe={filterId:e.id+"-"+ce.columnName,connectionId:e==null?void 0:e.connectionId,tableName:e.lastSelectedTable,name:ce.columnName,expression:de.expression,valueType:Pd($[de.columnIndex].columnValue),operation:"=",values:[$[de.columnIndex].columnValue]};N.push(pe)}),e.id,e==null||e.connectionId,e.lastSelectedTable,$[o].columnName,(J=e.preferences)==null||J.filterOnClickField,Pd($[o].columnValue),$[o].columnValue,w(N),g(e)}qJ({chart:z,elementIndex:W,datasetIndex:Q,cardType:e.type,cfg:I,apply:oe})}}return{isError:A,isLoading:C,isFetching:P,data:R,visualKey:n,handleDatapointClick:F,cfg:I}}var JJ=e=>{switch(e){case"success":return tZ;case"info":return rZ;case"warning":return nZ;case"error":return oZ;default:return null}},ZJ=Array(12).fill(0),eZ=({visible:e})=>m.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},m.createElement("div",{className:"sonner-spinner"},ZJ.map((t,n)=>m.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),tZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),nZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),rZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),oZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),iZ=()=>{let[e,t]=m.useState(document.hidden);return m.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},yx=1,sZ=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;let{message:r,...o}=t,i=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:yx++,s=this.toasts.find(l=>l.id===i),a=t.dismissible===void 0?!0:t.dismissible;return s?this.toasts=this.toasts.map(l=>l.id===i?(this.publish({...l,...t,id:i,title:r}),{...l,...t,id:i,dismissible:a,title:r}):l):this.addToast({title:r,...o,dismissible:a,id:i}),i},this.dismiss=t=>(t||this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),this.subscribers.forEach(n=>n({id:t,dismiss:!0})),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let o=t instanceof Promise?t:t(),i=r!==void 0;return o.then(async s=>{if(lZ(s)&&!s.ok){i=!1;let a=typeof n.error=="function"?await n.error(`HTTP error! status: ${s.status}`):n.error,l=typeof n.description=="function"?await n.description(`HTTP error! status: ${s.status}`):n.description;this.create({id:r,type:"error",message:a,description:l})}else if(n.success!==void 0){i=!1;let a=typeof n.success=="function"?await n.success(s):n.success,l=typeof n.description=="function"?await n.description(s):n.description;this.create({id:r,type:"success",message:a,description:l})}}).catch(async s=>{if(n.error!==void 0){i=!1;let a=typeof n.error=="function"?await n.error(s):n.error,l=typeof n.description=="function"?await n.description(s):n.description;this.create({id:r,type:"error",message:a,description:l})}}).finally(()=>{var s;i&&(this.dismiss(r),r=void 0),(s=n.finally)==null||s.call(n)}),r},this.custom=(t,n)=>{let r=(n==null?void 0:n.id)||yx++;return this.create({jsx:t(r),id:r,...n}),r},this.subscribers=[],this.toasts=[]}},Qr=new sZ,aZ=(e,t)=>{let n=(t==null?void 0:t.id)||yx++;return Qr.addToast({title:e,...t,id:n}),n},lZ=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",cZ=aZ,uZ=()=>Qr.toasts,dk=Object.assign(cZ,{success:Qr.success,info:Qr.info,warning:Qr.warning,error:Qr.error,custom:Qr.custom,message:Qr.message,promise:Qr.promise,dismiss:Qr.dismiss,loading:Qr.loading},{getHistory:uZ});function dZ(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}dZ(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
253
|
+
`),s=new Blob([i],{type:"text/csv"}),a=window.URL.createObjectURL(s),l=document.createElement("a");l.setAttribute("hidden",""),l.setAttribute("href",a),l.setAttribute("download",t),document.body.appendChild(l),l.click(),document.body.removeChild(l)};return O.jsx(XX,{onClick:n,className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"})};function oQ({frame:e}){var _;const t=ke(S=>S.isDashboardEditing),n=ke(S=>S.filterValues),r=ke(S=>S.isVisualEditing),o=ke(S=>S.selectedSheetId);ke(S=>S.currentBreakpoint);const{removeFrame:i}=ke(S=>S.actions),s=ke(S=>S.actions.setIsVisualEditing),a=Ar(S=>S.actions.setFilterValues),l=Ar(S=>S.actions.setApplyFilters),{setCard:c,setFrame:u,setQueryResultColumns:f}=Ar(S=>S.actions),h=Ar(S=>S.actions.setSelectedConnectionId),g=Ar(S=>S.actions.setSelectedDatabaseName),v=Ar(S=>S.actions.setSelectedSchemaName),b=Ar(S=>S.actions.setSelectedTableName),x=e.cards.find(S=>S.id===e.activeCardId);function w(){s(!r),c(x);const{dimensionKeys:S}=ar((x==null?void 0:x.data)||[]);f(S),u(e),x!=null&&x.connectionId&&h(x==null?void 0:x.connectionId),x!=null&&x.lastSelectedDatabase&&g(x==null?void 0:x.lastSelectedDatabase),x!=null&&x.lastSelectedSchema&&v(x==null?void 0:x.lastSelectedSchema),x!=null&&x.lastSelectedTable&&b(x==null?void 0:x.lastSelectedTable),n&&(a(n),l(!0))}return O.jsx("section",{className:"absolute right-2 top-2 z-10",children:O.jsxs("div",{className:"flex items-center gap-2",children:[t&&(r?O.jsx(_X,{onClick:()=>{s(!r)},className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"}):O.jsx(CX,{role:"edit-visual",onClick:w,className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"})),t&&O.jsx(TA,{onClick:()=>i(o,e.id),className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"}),((_=x.preferences)==null?void 0:_.allowDownload)===!0&&O.jsx(rQ,{data:(x==null?void 0:x.data)||[],filename:x.title})]})})}function iQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e);m.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const px="dismissableLayer.update",sQ="dismissableLayer.pointerDownOutside",aQ="dismissableLayer.focusOutside";let sP;const lQ=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ff=m.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=e,u=m.useContext(lQ),[f,h]=m.useState(null),g=(n=f==null?void 0:f.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,v]=m.useState({}),b=_t(t,k=>h(k)),x=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),_=x.indexOf(w),S=f?x.indexOf(f):-1,R=u.layersWithOutsidePointerEventsDisabled.size>0,C=S>=_,P=cQ(k=>{const D=k.target,I=[...u.branches].some(F=>F.contains(D));!C||I||(i==null||i(k),a==null||a(k),k.defaultPrevented||l==null||l())},g),A=uQ(k=>{const D=k.target;[...u.branches].some(F=>F.contains(D))||(s==null||s(k),a==null||a(k),k.defaultPrevented||l==null||l())},g);return iQ(k=>{S===u.layers.size-1&&(o==null||o(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},g),m.useEffect(()=>{if(f)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(sP=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),aP(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=sP)}},[f,g,r,u]),m.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),aP())},[f,u]),m.useEffect(()=>{const k=()=>v({});return document.addEventListener(px,k),()=>document.removeEventListener(px,k)},[]),m.createElement(Qe.div,he({},c,{ref:b,style:{pointerEvents:R?C?"auto":"none":void 0,...e.style},onFocusCapture:Me(e.onFocusCapture,A.onFocusCapture),onBlurCapture:Me(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Me(e.onPointerDownCapture,P.onPointerDownCapture)}))});function cQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let c=function(){NA(sQ,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function uQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e),r=m.useRef(!1);return m.useEffect(()=>{const o=i=>{i.target&&!r.current&&NA(aQ,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function aP(){const e=new CustomEvent(px);document.dispatchEvent(e)}function NA(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?CD(o,i):o.dispatchEvent(i)}const dQ=["top","right","bottom","left"],ca=Math.min,no=Math.max,Tg=Math.round,mp=Math.floor,ua=e=>({x:e,y:e}),fQ={left:"right",right:"left",bottom:"top",top:"bottom"},hQ={start:"end",end:"start"};function gx(e,t,n){return no(e,ca(t,n))}function ss(e,t){return typeof e=="function"?e(t):e}function as(e){return e.split("-")[0]}function iu(e){return e.split("-")[1]}function R1(e){return e==="x"?"y":"x"}function O1(e){return e==="y"?"height":"width"}function su(e){return["top","bottom"].includes(as(e))?"y":"x"}function P1(e){return R1(su(e))}function pQ(e,t,n){n===void 0&&(n=!1);const r=iu(e),o=P1(e),i=O1(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Dg(s)),[s,Dg(s)]}function gQ(e){const t=Dg(e);return[mx(e),t,mx(t)]}function mx(e){return e.replace(/start|end/g,t=>hQ[t])}function mQ(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function vQ(e,t,n,r){const o=iu(e);let i=mQ(as(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(mx)))),i}function Dg(e){return e.replace(/left|right|bottom|top/g,t=>fQ[t])}function bQ(e){return{top:0,right:0,bottom:0,left:0,...e}}function LA(e){return typeof e!="number"?bQ(e):{top:e,right:e,bottom:e,left:e}}function $g(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function lP(e,t,n){let{reference:r,floating:o}=e;const i=su(t),s=P1(t),a=O1(s),l=as(t),c=i==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let g;switch(l){case"top":g={x:u,y:r.y-o.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:f};break;case"left":g={x:r.x-o.width,y:f};break;default:g={x:r.x,y:r.y}}switch(iu(t)){case"start":g[s]-=h*(n&&c?-1:1);break;case"end":g[s]+=h*(n&&c?-1:1);break}return g}const yQ=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=lP(c,r,l),h=r,g={},v=0;for(let b=0;b<a.length;b++){const{name:x,fn:w}=a[b],{x:_,y:S,data:R,reset:C}=await w({x:u,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:g,rects:c,platform:s,elements:{reference:e,floating:t}});if(u=_??u,f=S??f,g={...g,[x]:{...g[x],...R}},C&&v<=50){v++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(c=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:u,y:f}=lP(c,h,l)),b=-1;continue}}return{x:u,y:f,placement:h,strategy:o,middlewareData:g}};async function Fd(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:g=0}=ss(t,e),v=LA(g),x=a[h?f==="floating"?"reference":"floating":f],w=$g(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),_=f==="floating"?{...s.floating,x:r,y:o}:s.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),R=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},C=$g(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:_,offsetParent:S,strategy:l}):_);return{top:(w.top-C.top+v.top)/R.y,bottom:(C.bottom-w.bottom+v.bottom)/R.y,left:(w.left-C.left+v.left)/R.x,right:(C.right-w.right+v.right)/R.x}}const cP=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=ss(e,t)||{};if(c==null)return{};const f=LA(u),h={x:n,y:r},g=P1(o),v=O1(g),b=await s.getDimensions(c),x=g==="y",w=x?"top":"left",_=x?"bottom":"right",S=x?"clientHeight":"clientWidth",R=i.reference[v]+i.reference[g]-h[g]-i.floating[v],C=h[g]-i.reference[g],P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let A=P?P[S]:0;(!A||!await(s.isElement==null?void 0:s.isElement(P)))&&(A=a.floating[S]||i.floating[v]);const k=R/2-C/2,D=A/2-b[v]/2-1,I=ca(f[w],D),F=ca(f[_],D),B=I,K=A-b[v]-F,Z=A/2-b[v]/2+k,z=gx(B,Z,K),Q=!l.arrow&&iu(o)!=null&&Z!=z&&i.reference[v]/2-(Z<B?I:F)-b[v]/2<0,W=Q?Z<B?Z-B:Z-K:0;return{[g]:h[g]+W,data:{[g]:z,centerOffset:Z-z-W,...Q&&{alignmentOffset:W}},reset:Q}}}),xQ=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:b=!0,...x}=ss(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=as(o),_=as(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),R=h||(_||!b?[Dg(a)]:gQ(a));!h&&v!=="none"&&R.push(...vQ(a,b,v,S));const C=[a,...R],P=await Fd(t,x),A=[];let k=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&A.push(P[w]),f){const B=pQ(o,s,S);A.push(P[B[0]],P[B[1]])}if(k=[...k,{placement:o,overflows:A}],!A.every(B=>B<=0)){var D,I;const B=(((D=i.flip)==null?void 0:D.index)||0)+1,K=C[B];if(K)return{data:{index:B,overflows:k},reset:{placement:K}};let Z=(I=k.filter(z=>z.overflows[0]<=0).sort((z,Q)=>z.overflows[1]-Q.overflows[1])[0])==null?void 0:I.placement;if(!Z)switch(g){case"bestFit":{var F;const z=(F=k.map(Q=>[Q.placement,Q.overflows.filter(W=>W>0).reduce((W,Y)=>W+Y,0)]).sort((Q,W)=>Q[1]-W[1])[0])==null?void 0:F[0];z&&(Z=z);break}case"initialPlacement":Z=a;break}if(o!==Z)return{reset:{placement:Z}}}return{}}}};function uP(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function dP(e){return dQ.some(t=>e[t]>=0)}const wQ=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=ss(e,t);switch(r){case"referenceHidden":{const i=await Fd(t,{...o,elementContext:"reference"}),s=uP(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:dP(s)}}}case"escaped":{const i=await Fd(t,{...o,altBoundary:!0}),s=uP(i,n.floating);return{data:{escapedOffsets:s,escaped:dP(s)}}}default:return{}}}}};async function _Q(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=as(n),a=iu(n),l=su(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,f=ss(t,e);let{mainAxis:h,crossAxis:g,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),l?{x:g*u,y:h*c}:{x:h*c,y:g*u}}const SQ=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await _Q(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},CQ=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:w,y:_}=x;return{x:w,y:_}}},...l}=ss(e,t),c={x:n,y:r},u=await Fd(t,l),f=su(as(o)),h=R1(f);let g=c[h],v=c[f];if(i){const x=h==="y"?"top":"left",w=h==="y"?"bottom":"right",_=g+u[x],S=g-u[w];g=gx(_,g,S)}if(s){const x=f==="y"?"top":"left",w=f==="y"?"bottom":"right",_=v+u[x],S=v-u[w];v=gx(_,v,S)}const b=a.fn({...t,[h]:g,[f]:v});return{...b,data:{x:b.x-n,y:b.y-r}}}}},EQ=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=ss(e,t),u={x:n,y:r},f=su(o),h=R1(f);let g=u[h],v=u[f];const b=ss(a,t),x=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(l){const S=h==="y"?"height":"width",R=i.reference[h]-i.floating[S]+x.mainAxis,C=i.reference[h]+i.reference[S]-x.mainAxis;g<R?g=R:g>C&&(g=C)}if(c){var w,_;const S=h==="y"?"width":"height",R=["top","left"].includes(as(o)),C=i.reference[f]-i.floating[S]+(R&&((w=s.offset)==null?void 0:w[f])||0)+(R?0:x.crossAxis),P=i.reference[f]+i.reference[S]+(R?0:((_=s.offset)==null?void 0:_[f])||0)-(R?x.crossAxis:0);v<C?v=C:v>P&&(v=P)}return{[h]:g,[f]:v}}}},RQ=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:s=()=>{},...a}=ss(e,t),l=await Fd(t,a),c=as(n),u=iu(n),f=su(n)==="y",{width:h,height:g}=r.floating;let v,b;c==="top"||c==="bottom"?(v=c,b=u===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(b=c,v=u==="end"?"top":"bottom");const x=g-l[v],w=h-l[b],_=!t.middlewareData.shift;let S=x,R=w;if(f){const P=h-l.left-l.right;R=u||_?ca(w,P):P}else{const P=g-l.top-l.bottom;S=u||_?ca(x,P):P}if(_&&!u){const P=no(l.left,0),A=no(l.right,0),k=no(l.top,0),D=no(l.bottom,0);f?R=h-2*(P!==0||A!==0?P+A:no(l.left,l.right)):S=g-2*(k!==0||D!==0?k+D:no(l.top,l.bottom))}await s({...t,availableWidth:R,availableHeight:S});const C=await o.getDimensions(i.floating);return h!==C.width||g!==C.height?{reset:{rects:!0}}:{}}}};function da(e){return FA(e)?(e.nodeName||"").toLowerCase():"#document"}function so(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ds(e){var t;return(t=(FA(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function FA(e){return e instanceof Node||e instanceof so(e).Node}function ls(e){return e instanceof Element||e instanceof so(e).Element}function Si(e){return e instanceof HTMLElement||e instanceof so(e).HTMLElement}function fP(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof so(e).ShadowRoot}function jf(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=$o(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function OQ(e){return["table","td","th"].includes(da(e))}function T1(e){const t=D1(),n=$o(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 PQ(e){let t=Yc(e);for(;Si(t)&&!Tm(t);){if(T1(t))return t;t=Yc(t)}return null}function D1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Tm(e){return["html","body","#document"].includes(da(e))}function $o(e){return so(e).getComputedStyle(e)}function Dm(e){return ls(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Yc(e){if(da(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fP(e)&&e.host||ds(e);return fP(t)?t.host:t}function jA(e){const t=Yc(e);return Tm(t)?e.ownerDocument?e.ownerDocument.body:e.body:Si(t)&&jf(t)?t:jA(t)}function jd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=jA(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=so(o);return i?t.concat(s,s.visualViewport||[],jf(o)?o:[],s.frameElement&&n?jd(s.frameElement):[]):t.concat(o,jd(o,[],n))}function zA(e){const t=$o(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Si(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Tg(n)!==i||Tg(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function $1(e){return ls(e)?e:e.contextElement}function yc(e){const t=$1(e);if(!Si(t))return ua(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=zA(t);let s=(i?Tg(n.width):n.width)/r,a=(i?Tg(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const TQ=ua(0);function BA(e){const t=so(e);return!D1()||!t.visualViewport?TQ:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function DQ(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==so(e)?!1:t}function ml(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=$1(e);let s=ua(1);t&&(r?ls(r)&&(s=yc(r)):s=yc(e));const a=DQ(i,n,r)?BA(i):ua(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,f=o.height/s.y;if(i){const h=so(i),g=r&&ls(r)?so(r):r;let v=h.frameElement;for(;v&&r&&g!==h;){const b=yc(v),x=v.getBoundingClientRect(),w=$o(v),_=x.left+(v.clientLeft+parseFloat(w.paddingLeft))*b.x,S=x.top+(v.clientTop+parseFloat(w.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,f*=b.y,l+=_,c+=S,v=so(v).frameElement}}return $g({width:u,height:f,x:l,y:c})}function $Q(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Si(n),i=ds(n);if(n===i)return t;let s={scrollLeft:0,scrollTop:0},a=ua(1);const l=ua(0);if((o||!o&&r!=="fixed")&&((da(n)!=="body"||jf(i))&&(s=Dm(n)),Si(n))){const c=ml(n);a=yc(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 AQ(e){return Array.from(e.getClientRects())}function VA(e){return ml(ds(e)).left+Dm(e).scrollLeft}function kQ(e){const t=ds(e),n=Dm(e),r=e.ownerDocument.body,o=no(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=no(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+VA(e);const a=-n.scrollTop;return $o(r).direction==="rtl"&&(s+=no(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function MQ(e,t){const n=so(e),r=ds(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const c=D1();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function IQ(e,t){const n=ml(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Si(e)?yc(e):ua(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function hP(e,t,n){let r;if(t==="viewport")r=MQ(e,n);else if(t==="document")r=kQ(ds(e));else if(ls(t))r=IQ(t,n);else{const o=BA(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return $g(r)}function HA(e,t){const n=Yc(e);return n===t||!ls(n)||Tm(n)?!1:$o(n).position==="fixed"||HA(n,t)}function NQ(e,t){const n=t.get(e);if(n)return n;let r=jd(e,[],!1).filter(a=>ls(a)&&da(a)!=="body"),o=null;const i=$o(e).position==="fixed";let s=i?Yc(e):e;for(;ls(s)&&!Tm(s);){const a=$o(s),l=T1(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||jf(s)&&!l&&HA(e,s))?r=r.filter(u=>u!==s):o=a,s=Yc(s)}return t.set(e,r),r}function LQ(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?NQ(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const f=hP(t,u,o);return c.top=no(f.top,c.top),c.right=ca(f.right,c.right),c.bottom=ca(f.bottom,c.bottom),c.left=no(f.left,c.left),c},hP(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function FQ(e){return zA(e)}function jQ(e,t,n){const r=Si(t),o=ds(t),i=n==="fixed",s=ml(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=ua(0);if(r||!r&&!i)if((da(t)!=="body"||jf(o))&&(a=Dm(t)),r){const c=ml(t,!0,i,t);l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}else o&&(l.x=VA(o));return{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function pP(e,t){return!Si(e)||$o(e).position==="fixed"?null:t?t(e):e.offsetParent}function WA(e,t){const n=so(e);if(!Si(e))return n;let r=pP(e,t);for(;r&&OQ(r)&&$o(r).position==="static";)r=pP(r,t);return r&&(da(r)==="html"||da(r)==="body"&&$o(r).position==="static"&&!T1(r))?n:r||PQ(e)||n}const zQ=async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||WA,i=this.getDimensions;return{reference:jQ(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}};function BQ(e){return $o(e).direction==="rtl"}const VQ={convertOffsetParentRelativeRectToViewportRelativeRect:$Q,getDocumentElement:ds,getClippingRect:LQ,getOffsetParent:WA,getElementRects:zQ,getClientRects:AQ,getDimensions:FQ,getScale:yc,isElement:ls,isRTL:BQ};function HQ(e,t){let n=null,r;const o=ds(e);function i(){clearTimeout(r),n&&n.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:c,top:u,width:f,height:h}=e.getBoundingClientRect();if(a||t(),!f||!h)return;const g=mp(u),v=mp(o.clientWidth-(c+f)),b=mp(o.clientHeight-(u+h)),x=mp(c),_={rootMargin:-g+"px "+-v+"px "+-b+"px "+-x+"px",threshold:no(0,ca(1,l))||1};let S=!0;function R(C){const P=C[0].intersectionRatio;if(P!==l){if(!S)return s();P?s(!1,P):r=setTimeout(()=>{s(!1,1e-7)},100)}S=!1}try{n=new IntersectionObserver(R,{..._,root:o.ownerDocument})}catch{n=new IntersectionObserver(R,_)}n.observe(e)}return s(!0),i}function WQ(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=$1(e),u=o||i?[...c?jd(c):[],...jd(t)]:[];u.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const f=c&&a?HQ(c,n):null;let h=-1,g=null;s&&(g=new ResizeObserver(w=>{let[_]=w;_&&_.target===c&&g&&(g.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{g&&g.observe(t)})),n()}),c&&!l&&g.observe(c),g.observe(t));let v,b=l?ml(e):null;l&&x();function x(){const w=ml(e);b&&(w.x!==b.x||w.y!==b.y||w.width!==b.width||w.height!==b.height)&&n(),b=w,v=requestAnimationFrame(x)}return n(),()=>{u.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f&&f(),g&&g.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const UQ=(e,t,n)=>{const r=new Map,o={platform:VQ,...n},i={...o.platform,_c:r};return yQ(e,t,{...o,platform:i})},qQ=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?cP({element:r.current,padding:o}).fn(n):{}:r?cP({element:r,padding:o}).fn(n):{}}}};var og=typeof document<"u"?m.useLayoutEffect:m.useEffect;function Ag(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,o;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(!Ag(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Ag(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function UA(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gP(e,t){const n=UA(e);return Math.round(t*n)/n}function mP(e){const t=V.useRef(e);return og(()=>{t.current=e}),t}function GQ(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,f]=V.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,g]=V.useState(r);Ag(h,r)||g(r);const[v,b]=V.useState(null),[x,w]=V.useState(null),_=V.useCallback(Q=>{Q!=P.current&&(P.current=Q,b(Q))},[b]),S=V.useCallback(Q=>{Q!==A.current&&(A.current=Q,w(Q))},[w]),R=i||v,C=s||x,P=V.useRef(null),A=V.useRef(null),k=V.useRef(u),D=mP(l),I=mP(o),F=V.useCallback(()=>{if(!P.current||!A.current)return;const Q={placement:t,strategy:n,middleware:h};I.current&&(Q.platform=I.current),UQ(P.current,A.current,Q).then(W=>{const Y={...W,isPositioned:!0};B.current&&!Ag(k.current,Y)&&(k.current=Y,uw.flushSync(()=>{f(Y)}))})},[h,t,n,I]);og(()=>{c===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,f(Q=>({...Q,isPositioned:!1})))},[c]);const B=V.useRef(!1);og(()=>(B.current=!0,()=>{B.current=!1}),[]),og(()=>{if(R&&(P.current=R),C&&(A.current=C),R&&C){if(D.current)return D.current(R,C,F);F()}},[R,C,F,D]);const K=V.useMemo(()=>({reference:P,floating:A,setReference:_,setFloating:S}),[_,S]),Z=V.useMemo(()=>({reference:R,floating:C}),[R,C]),z=V.useMemo(()=>{const Q={position:n,left:0,top:0};if(!Z.floating)return Q;const W=gP(Z.floating,u.x),Y=gP(Z.floating,u.y);return a?{...Q,transform:"translate("+W+"px, "+Y+"px)",...UA(Z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:Y}},[n,a,Z.floating,u.x,u.y]);return V.useMemo(()=>({...u,update:F,refs:K,elements:Z,floatingStyles:z}),[u,F,K,Z,z])}function $m(e){const[t,n]=m.useState(void 0);return ur(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.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 qA="Popper",[GA,Ti]=Zn(qA),[YQ,YA]=GA(qA),KQ=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return m.createElement(YQ,{scope:t,anchor:r,onAnchorChange:o},n)},XQ="PopperAnchor",QQ=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=YA(XQ,n),s=m.useRef(null),a=_t(t,s);return m.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:m.createElement(Qe.div,he({},o,{ref:a}))}),KA="PopperContent",[JQ,aye]=GA(KA),ZQ=m.forwardRef((e,t)=>{var n,r,o,i,s,a,l,c;const{__scopePopper:u,side:f="bottom",sideOffset:h=0,align:g="center",alignOffset:v=0,arrowPadding:b=0,avoidCollisions:x=!0,collisionBoundary:w=[],collisionPadding:_=0,sticky:S="partial",hideWhenDetached:R=!1,updatePositionStrategy:C="optimized",onPlaced:P,...A}=e,k=YA(KA,u),[D,I]=m.useState(null),F=_t(t,Pe=>I(Pe)),[B,K]=m.useState(null),Z=$m(B),z=(n=Z==null?void 0:Z.width)!==null&&n!==void 0?n:0,Q=(r=Z==null?void 0:Z.height)!==null&&r!==void 0?r:0,W=f+(g!=="center"?"-"+g:""),Y=typeof _=="number"?_:{top:0,right:0,bottom:0,left:0,..._},oe=Array.isArray(w)?w:[w],$=oe.length>0,H={padding:Y,boundary:oe.filter(eJ),altBoundary:$},{refs:J,floatingStyles:N,placement:ce,isPositioned:le,middlewareData:de}=GQ({strategy:"fixed",placement:W,whileElementsMounted:(...Pe)=>WQ(...Pe,{animationFrame:C==="always"}),elements:{reference:k.anchor},middleware:[SQ({mainAxis:h+Q,alignmentAxis:v}),x&&CQ({mainAxis:!0,crossAxis:!1,limiter:S==="partial"?EQ():void 0,...H}),x&&xQ({...H}),RQ({...H,apply:({elements:Pe,rects:Te,availableWidth:Ue,availableHeight:Be})=>{const{width:Ie,height:Ke}=Te.reference,lt=Pe.floating.style;lt.setProperty("--radix-popper-available-width",`${Ue}px`),lt.setProperty("--radix-popper-available-height",`${Be}px`),lt.setProperty("--radix-popper-anchor-width",`${Ie}px`),lt.setProperty("--radix-popper-anchor-height",`${Ke}px`)}}),B&&qQ({element:B,padding:b}),tJ({arrowWidth:z,arrowHeight:Q}),R&&wQ({strategy:"referenceHidden",...H})]}),[pe,ie]=XA(ce),te=Ln(P);ur(()=>{le&&(te==null||te())},[le,te]);const ae=(o=de.arrow)===null||o===void 0?void 0:o.x,ye=(i=de.arrow)===null||i===void 0?void 0:i.y,G=((s=de.arrow)===null||s===void 0?void 0:s.centerOffset)!==0,[be,_e]=m.useState();return ur(()=>{D&&_e(window.getComputedStyle(D).zIndex)},[D]),m.createElement("div",{ref:J.setFloating,"data-radix-popper-content-wrapper":"",style:{...N,transform:le?N.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:be,"--radix-popper-transform-origin":[(a=de.transformOrigin)===null||a===void 0?void 0:a.x,(l=de.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:e.dir},m.createElement(JQ,{scope:u,placedSide:pe,onArrowChange:K,arrowX:ae,arrowY:ye,shouldHideArrow:G},m.createElement(Qe.div,he({"data-side":pe,"data-align":ie},A,{ref:F,style:{...A.style,animation:le?void 0:"none",opacity:(c=de.hide)!==null&&c!==void 0&&c.referenceHidden?0:void 0}}))))});function eJ(e){return e!==null}const tJ=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o,i,s;const{placement:a,rects:l,middlewareData:c}=t,f=((n=c.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,h=f?0:e.arrowWidth,g=f?0:e.arrowHeight,[v,b]=XA(a),x={start:"0%",center:"50%",end:"100%"}[b],w=((r=(o=c.arrow)===null||o===void 0?void 0:o.x)!==null&&r!==void 0?r:0)+h/2,_=((i=(s=c.arrow)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0)+g/2;let S="",R="";return v==="bottom"?(S=f?x:`${w}px`,R=`${-g}px`):v==="top"?(S=f?x:`${w}px`,R=`${l.floating.height+g}px`):v==="right"?(S=`${-g}px`,R=f?x:`${_}px`):v==="left"&&(S=`${l.floating.width+g}px`,R=f?x:`${_}px`),{data:{x:S,y:R}}}});function XA(e){const[t,n="center"]=e.split("-");return[t,n]}const zf=KQ,Bf=QQ,Vf=ZQ,A1=m.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...o}=e;return r?ko.createPortal(m.createElement(Qe.div,he({},o,{ref:t})),r):null}),nJ=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(rJ);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(vx,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(vx,he({},r,{ref:t}),n)});nJ.displayName="Slot";const vx=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...oJ(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});vx.displayName="SlotClone";const QA=({children:e})=>m.createElement(m.Fragment,null,e);function rJ(e){return m.isValidElement(e)&&e.type===QA}function oJ(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const JA=m.forwardRef((e,t)=>m.createElement(Qe.span,he({},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}}))),iJ=JA,[Am,lye]=Zn("Tooltip",[Ti]),k1=Ti(),sJ="TooltipProvider",aJ=700,bx="tooltip.open",[lJ,M1]=Am(sJ),cJ=e=>{const{__scopeTooltip:t,delayDuration:n=aJ,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,a]=m.useState(!0),l=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),m.createElement(lJ,{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(u=>{l.current=u},[]),disableHoverableContent:o},i)},I1="Tooltip",[uJ,km]=Am(I1),dJ=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=M1(I1,e.__scopeTooltip),c=k1(t),[u,f]=m.useState(null),h=Jo(),g=m.useRef(0),v=s??l.disableHoverableContent,b=a??l.delayDuration,x=m.useRef(!1),[w=!1,_]=xr({prop:r,defaultProp:o,onChange:A=>{A?(l.onOpen(),document.dispatchEvent(new CustomEvent(bx))):l.onClose(),i==null||i(A)}}),S=m.useMemo(()=>w?x.current?"delayed-open":"instant-open":"closed",[w]),R=m.useCallback(()=>{window.clearTimeout(g.current),x.current=!1,_(!0)},[_]),C=m.useCallback(()=>{window.clearTimeout(g.current),_(!1)},[_]),P=m.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{x.current=!0,_(!0)},b)},[b,_]);return m.useEffect(()=>()=>window.clearTimeout(g.current),[]),m.createElement(zf,c,m.createElement(uJ,{scope:t,contentId:h,open:w,stateAttribute:S,trigger:u,onTriggerChange:f,onTriggerEnter:m.useCallback(()=>{l.isOpenDelayed?P():R()},[l.isOpenDelayed,P,R]),onTriggerLeave:m.useCallback(()=>{v?C():window.clearTimeout(g.current)},[C,v]),onOpen:R,onClose:C,disableHoverableContent:v},n))},vP="TooltipTrigger",ZA=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=km(vP,n),i=M1(vP,n),s=k1(n),a=m.useRef(null),l=_t(t,a,o.onTriggerChange),c=m.useRef(!1),u=m.useRef(!1),f=m.useCallback(()=>c.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),m.createElement(Bf,he({asChild:!0},s),m.createElement(Qe.button,he({"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute},r,{ref:l,onPointerMove:Me(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:Me(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:Me(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Me(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:Me(e.onBlur,o.onClose),onClick:Me(e.onClick,o.onClose)})))}),fJ="TooltipPortal",[cye,hJ]=Am(fJ,{forceMount:void 0}),zd="TooltipContent",pJ=m.forwardRef((e,t)=>{const n=hJ(zd,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=km(zd,e.__scopeTooltip);return m.createElement(er,{present:r||s.open},s.disableHoverableContent?m.createElement(ek,he({side:o},i,{ref:t})):m.createElement(gJ,he({side:o},i,{ref:t})))}),gJ=m.forwardRef((e,t)=>{const n=km(zd,e.__scopeTooltip),r=M1(zd,e.__scopeTooltip),o=m.useRef(null),i=_t(t,o),[s,a]=m.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:f}=r,h=m.useCallback(()=>{a(null),f(!1)},[f]),g=m.useCallback((v,b)=>{const x=v.currentTarget,w={x:v.clientX,y:v.clientY},_=vJ(w,x.getBoundingClientRect()),S=bJ(w,_),R=yJ(b.getBoundingClientRect()),C=wJ([...S,...R]);a(C),f(!0)},[f]);return m.useEffect(()=>()=>h(),[h]),m.useEffect(()=>{if(l&&u){const v=x=>g(x,u),b=x=>g(x,l);return l.addEventListener("pointerleave",v),u.addEventListener("pointerleave",b),()=>{l.removeEventListener("pointerleave",v),u.removeEventListener("pointerleave",b)}}},[l,u,g,h]),m.useEffect(()=>{if(s){const v=b=>{const x=b.target,w={x:b.clientX,y:b.clientY},_=(l==null?void 0:l.contains(x))||(u==null?void 0:u.contains(x)),S=!xJ(w,s);_?h():S&&(h(),c())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[l,u,s,c,h]),m.createElement(ek,he({},e,{ref:i}))}),[mJ,uye]=Am(I1,{isInside:!1}),ek=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=km(zd,n),c=k1(n),{onClose:u}=l;return m.useEffect(()=>(document.addEventListener(bx,u),()=>document.removeEventListener(bx,u)),[u]),m.useEffect(()=>{if(l.trigger){const f=h=>{const g=h.target;g!=null&&g.contains(l.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,u]),m.createElement(Ff,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:u},m.createElement(Vf,he({"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(QA,null,r),m.createElement(mJ,{scope:n,isInside:!0},m.createElement(iJ,{id:l.contentId,role:"tooltip"},o||r))))});function vJ(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function bJ(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 yJ(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function xJ(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function wJ(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),_J(t)}function _J(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}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 SJ=cJ,CJ=dJ,EJ=ZA,tk=pJ,RJ=SJ,nk=CJ,rk=EJ,N1=V.forwardRef(({className:e,sideOffset:t=4,...n},r)=>O.jsx(tk,{ref:r,sideOffset:t,className:Ee("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}));N1.displayName=tk.displayName;function ll({number:e,decimalPlaces:t=0,useSuffix:n=!1,customSuffix:r="",currency:o="",locale:i="en-US"}){let s=1,a=r,l=i;const c=t;n&&!r&&(e>=1e9?(s=1e9,a="B"):e>=1e7&&i==="en-IN"?(s=1e7,a="Cr"):e>=1e5&&i==="en-IN"?(s=1e5,a="L"):e>=1e6?(s=1e6,a="M"):e>=1e3&&(s=1e3,a="K"));const u=e/s,f={maximumFractionDigits:c,minimumFractionDigits:c};if(o){f.style="currency",f.currency=o;try{new Intl.NumberFormat(i,f).format(0)}catch{f.currency="USD"}}try{new Intl.NumberFormat(i,f).format(0)}catch{l="en-US"}let g=new Intl.NumberFormat(l,f).format(u);return n&&(g+=a),g}function ok(e,t){if(!t)return"";const n=t.find(r=>e>=r.start&&e<=r.end);return(n==null?void 0:n.color)||""}function ik({card:e,isLoading:t}){var w,_,S,R,C,P,A,k,D,I,F,B,K,Z,z,Q,W,Y,oe,$,H,J,N,ce;const n=ke(le=>le.actions.setCardTitle),r=ke(le=>le.actions.setCardDescription),o=ke(le=>le.isVisualEditing),i=Ar(le=>le.card),s=Ar(le=>le.actions.setCard);Ar(le=>le.actions.setNumberFormat);const a=ke(le=>le.selectedSheetId),l=e.data,c=(_=(w=e.preferences)==null?void 0:w.formatNumber)==null?void 0:_.colorRanges,{metricKeys:u}=ar(l||[]),f=(S=l==null?void 0:l[0])==null?void 0:S[u==null?void 0:u[0]],h=(R=l==null?void 0:l[0])==null?void 0:R[u==null?void 0:u[1]],g=!!e.data&&e.data.length>0;function v(le){o?s({...i,title:le}):n(a,e.id,le)}function b(le){o?s({...i,description:le}):r(a,e.id,le)}const x=h&&h-f!==0?(f-h)/h:null;return O.jsxs("div",{className:"kpi-card flex grow flex-col overflow-scroll",children:[O.jsxs(sm,{className:"grow pb-3",children:[O.jsx(is,{text:o?i.title:e.title,onSave:v,children:O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx(Df,{className:"text-base font-medium text-muted-foreground",children:e.title}),!e.refreshInterval&&t&&O.jsx(S1,{className:"h-4 w-4 animate-spin text-muted-foreground"})]})}),g&&O.jsxs("div",{className:"flex flex-wrap items-end gap-3 text-foreground",children:[O.jsx("p",{style:{color:ok(f,c)},className:"text-3xl font-semibold",children:ll({number:f,decimalPlaces:((P=(C=e.preferences)==null?void 0:C.formatNumber)==null?void 0:P.decimalPlaces)||0,useSuffix:!!((k=(A=e.preferences)==null?void 0:A.formatNumber)!=null&&k.suffix),customSuffix:((I=(D=e.preferences)==null?void 0:D.formatNumber)==null?void 0:I.suffix)||"",locale:((B=(F=e.preferences)==null?void 0:F.formatNumber)==null?void 0:B.locale)||"",currency:((Z=(K=e.preferences)==null?void 0:K.formatNumber)==null?void 0:Z.currency)||""})}),h&&O.jsxs("span",{className:"min-w-fit text-base font-normal text-muted-foreground",children:["from ",ll({number:h,decimalPlaces:((Q=(z=e.preferences)==null?void 0:z.formatNumber)==null?void 0:Q.decimalPlaces)||0,useSuffix:!!((Y=(W=e.preferences)==null?void 0:W.formatNumber)!=null&&Y.suffix),customSuffix:(($=(oe=e.preferences)==null?void 0:oe.formatNumber)==null?void 0:$.suffix)||"",locale:((J=(H=e.preferences)==null?void 0:H.formatNumber)==null?void 0:J.locale)||"",currency:((ce=(N=e.preferences)==null?void 0:N.formatNumber)==null?void 0:ce.currency)||""})]})]})]}),x&&O.jsxs(am,{className:"grow items-start gap-1 pb-4 text-sm",children:[O.jsx(OJ,{children:x}),O.jsxs("div",{className:"flex gap-1 text-muted-foreground",children:[x>0?"up ":"down ",O.jsx(is,{text:e.description||"",onSave:b,children:e.description})]})]})]})}function OJ({children:e}){const t=e>0?O.jsx(w1,{className:"h-4 w-4"}):O.jsx(x1,{className:"h-4 w-4"}),n=`${Math.abs(e*100).toFixed(0)}%`;return O.jsxs("div",{className:Ee("flex items-center",{"text-green-600":e>0,"text-destructive":e<0}),children:[t,O.jsx("span",{className:"ml-[1px]",children:n})]})}var Kc=1e3,Xc=Kc*60,Qc=Xc*60,vl=Qc*24,PJ=vl*7,TJ=vl*365.25,DJ=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return $J(e);if(n==="number"&&isFinite(e))return t.long?kJ(e):AJ(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function $J(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*TJ;case"weeks":case"week":case"w":return n*PJ;case"days":case"day":case"d":return n*vl;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Qc;case"minutes":case"minute":case"mins":case"min":case"m":return n*Xc;case"seconds":case"second":case"secs":case"sec":case"s":return n*Kc;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function AJ(e){var t=Math.abs(e);return t>=vl?Math.round(e/vl)+"d":t>=Qc?Math.round(e/Qc)+"h":t>=Xc?Math.round(e/Xc)+"m":t>=Kc?Math.round(e/Kc)+"s":e+"ms"}function kJ(e){var t=Math.abs(e);return t>=vl?vp(e,t,vl,"day"):t>=Qc?vp(e,t,Qc,"hour"):t>=Xc?vp(e,t,Xc,"minute"):t>=Kc?vp(e,t,Kc,"second"):e+" ms"}function vp(e,t,n,r){var o=t>=n*1.5;return Math.round(e/n)+" "+r+(o?"s":"")}const MJ=nu(DJ);function sk({children:e}){const{setIsSessionExpired:t}=Mo(),n=new Qz({queryCache:new pD({onError:r=>{console.error(`Something went wrong: ${r.message}`),r.message==="invalid token"&&t(!0)}}),defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});return O.jsx(tB,{client:n,children:e})}const IJ={id:"",authToken:void 0},ak=m.createContext(IJ),lk=({children:e,dashboardProps:t})=>O.jsx(sk,{children:O.jsx(ak.Provider,{value:t,children:O.jsx("div",{style:{height:"100%"},id:"semaphor-scope",children:e})})});function ma(){const e=m.useContext(ak);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}function NJ(e){ke(u=>u.bookmarkKey),ke(u=>u.selectedSheetId);const t=ke(u=>u.dashboard.baseQueries),n=ke(u=>u.actions.getCardSheet),{authToken:r}=ma(),o=ke(u=>u.authToken),i=ke(u=>u.filterValues),s=ke(u=>u.isDashboardEditing),a=MJ((e==null?void 0:e.refreshInterval)||"0");n(e.id);const l=Y2(e.sql,t);return Tf({queryKey:[e.id,l],queryFn:()=>Rf("https://semaphor.cloud/api/v1/query",(r==null?void 0:r.accessToken)||(o==null?void 0:o.accessToken)||"",{connection_id:e.connectionId,sql:l,python:e.python===aD?"":e.python,active_filters:i}),refetchInterval:a,enabled:!!e.connectionId&&!s})}function Ia({data:e,cfg:t,customCfg:n,preferences:r}){const{dimensionKeys:o,metricKeys:i}=ar(e),s=zX(i,e,r),a=rg(s,n),l=o[0],c=fx(e,l);L1(r,t),ck(r);const u=uk(t,r),f=qo((t==null?void 0:t.options)||{},r==null?void 0:r.chartOptions),h=qo(u,f),g=qo(h,(n==null?void 0:n.options)||{});return{type:(n==null?void 0:n.type)||(t==null?void 0:t.type)||"bar",data:{labels:c,datasets:a},options:g}}function L1(e,t){var o,i,s;const n=((o=t==null?void 0:t.options)==null?void 0:o.indexAxis)==="y"?"x":"y";return(i=e==null?void 0:e.chartOptions)!=null&&i.indexAxis?((s=e==null?void 0:e.chartOptions)==null?void 0:s.indexAxis)==="x"?"y":"x":n}function ck(e){var n,r;return(n=e==null?void 0:e.chartOptions)!=null&&n.indexAxis?((r=e==null?void 0:e.chartOptions)==null?void 0:r.indexAxis)==="x"?"x":"y":"x"}function uk(e,t){var i,s,a,l,c,u,f,h,g,v,b,x;const n=L1(t,e),r=ck(t);return{...e==null?void 0:e.options,scales:{...(i=e==null?void 0:e.options)==null?void 0:i.scales,[n]:{...(a=(s=e==null?void 0:e.options)==null?void 0:s.scales)==null?void 0:a[n],ticks:{...(u=(c=(l=e==null?void 0:e.options)==null?void 0:l.scales)==null?void 0:c[n])==null?void 0:u.ticks,callback:w=>{var _,S,R,C;return ll({number:Number(w),decimalPlaces:((_=t==null?void 0:t.numberAxisFormat)==null?void 0:_.decimalPlaces)||0,useSuffix:!!((S=t==null?void 0:t.numberAxisFormat)!=null&&S.suffix),customSuffix:"",locale:((R=t==null?void 0:t.numberAxisFormat)==null?void 0:R.locale)||"",currency:((C=t==null?void 0:t.numberAxisFormat)==null?void 0:C.currency)||""})}}},[r]:{...(g=(h=(f=e==null?void 0:e.options)==null?void 0:f.scales)==null?void 0:h[r])==null?void 0:g.ticks,callback:null}},plugins:{...(v=e==null?void 0:e.options)==null?void 0:v.plugins,datalabels:{...(x=(b=e==null?void 0:e.options)==null?void 0:b.plugins)==null?void 0:x.datalabels,formatter:function(w){var _,S,R,C;return ll({number:Number(w),decimalPlaces:((_=t==null?void 0:t.numberAxisFormat)==null?void 0:_.decimalPlaces)||0,useSuffix:!!((S=t==null?void 0:t.numberAxisFormat)!=null&&S.suffix),customSuffix:"",locale:((R=t==null?void 0:t.numberAxisFormat)==null?void 0:R.locale)||"",currency:((C=t==null?void 0:t.numberAxisFormat)==null?void 0:C.currency)||""})}}}}}function LJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0},y:{display:!0}}}}}function FJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{beginAtZero:!0,stack:1,reverse:!0},y:{stacked:!0,beginAtZero:!0}}}}}function jJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function zJ(e,t=!1){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0,beginAtZero:!1},y:{display:!0,stacked:t}}}}}function BJ(e,t){var r,o,i,s;return{...e,type:t==="stackedBar"?"bar":"line",options:{...e==null?void 0:e.options,scales:{x:{...(o=(r=e==null?void 0:e.options)==null?void 0:r.scales)==null?void 0:o.x,display:!0,stacked:!0},y:{...(s=(i=e==null?void 0:e.options)==null?void 0:i.scales)==null?void 0:s.y,display:!0,stacked:!0}}}}}function VJ(e){return{...e,type:"line",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function HJ(e,t){var r;return{...t,type:e,options:{...t==null?void 0:t.options,scales:{x:{display:!1},y:{display:!1}},plugins:{...(r=t==null?void 0:t.options)==null?void 0:r.plugins,legend:{position:"top",align:"center",maxHeight:0,labels:{useBorderRadius:!0,borderRadius:2}}},borderRadius:0}}}function WJ(e){return{...e,type:"radar",options:{...e==null?void 0:e.options,scales:{x:{display:!1},y:{display:!1}}}}}function UJ(e){const n=new Function("getDatalabelColor",e)(w0);return{options:n==null?void 0:n.options,plugins:(n==null?void 0:n.plugins)||[]}}function F1({data:e,cardType:t="bar",cfg:n,customCfg:r,provider:o="chartjs",userSettings:i,preferences:s}){var a,l,c;if(t==="bar"){const u=jJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="horizontalBar"){const u=LJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="pyramid"){const u=FJ(n),{dimensionKeys:f,metricKeys:h}=ar(e),g=Pg({dataArray:e,groupKey:f[0],pivotKey:f[1],valueKey:h[0]}),v=Ia({data:g,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s}),b="x2";return{...v,data:{...v.data,datasets:v.data.datasets.map((w,_)=>_===1?{...w,xAxisID:b}:w)},options:{...v.options,scales:{...(a=v==null?void 0:v.options)==null?void 0:a.scales,[b]:{beginAtZero:!0,stack:1}}}}}if(t==="stackedBar"||t==="stackedLine"){const u=BJ(n,t),{dimensionKeys:f,metricKeys:h}=ar(e),g=Pg({dataArray:e,groupKey:f[0],pivotKey:f[1],valueKey:h[0]});return Ia({data:g,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="line"){const u=VJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="range"){const u=zJ(n),f=HX(e),h=rg(f,r),{plugins:g,options:v}=UJ((s==null?void 0:s.customVisualCode)||""),b=qo((u==null?void 0:u.options)||{},(n==null?void 0:n.options)||{}),x=qo(b,(s==null?void 0:s.chartOptions)||{}),w=qo(x,(r==null?void 0:r.options)||{}),_=qo(w,v),S=uk(n,s),R=qo(_,S),C={...R,plugins:{...R==null?void 0:R.plugins,datalabels:{...(l=R==null?void 0:R.plugins)==null?void 0:l.datalabels,formatter:(I,F)=>I.map(K=>{var Z,z,Q,W;return ll({number:Number(K),decimalPlaces:((Z=s==null?void 0:s.numberAxisFormat)==null?void 0:Z.decimalPlaces)||0,useSuffix:!!((z=s==null?void 0:s.numberAxisFormat)!=null&&z.suffix),customSuffix:"",locale:((Q=s==null?void 0:s.numberAxisFormat)==null?void 0:Q.locale)||"",currency:((W=s==null?void 0:s.numberAxisFormat)==null?void 0:W.currency)||""})}).slice(0,2).join(" - ")}}},{dimensionKeys:P}=ar(e),A=P[0];return{type:"bar",data:{labels:[...new Set(fx(e,A))],datasets:h},options:C,plugins:[...g]}}if(t==="pie"||t==="doughnut"||t==="polarArea"){const u=HJ(t,n),{dimensionKeys:f,metricKeys:h}=ar(e),g=WX(h,e),v=rg(g,r),b=f[0],x=fx(e,b),w=qo((u==null?void 0:u.options)||{},(r==null?void 0:r.options)||{}),_=qo(w,(s==null?void 0:s.chartOptions)||{}),S={..._,plugins:{..._.plugins,datalabels:{...(c=_.plugins)==null?void 0:c.datalabels,formatter:(P,A)=>{var k,D,I,F;return ll({number:Number(P),decimalPlaces:((k=s==null?void 0:s.numberAxisFormat)==null?void 0:k.decimalPlaces)||0,useSuffix:!!((D=s==null?void 0:s.numberAxisFormat)!=null&&D.suffix),customSuffix:"",locale:((I=s==null?void 0:s.numberAxisFormat)==null?void 0:I.locale)||"",currency:((F=s==null?void 0:s.numberAxisFormat)==null?void 0:F.currency)||""})}}}};return{type:t,data:{labels:x,datasets:v},options:S,plugins:[t==="doughnut"?{id:"doughnutLabel",beforeDatasetsDraw:function(P,A,k){var Q,W,Y,oe;const{ctx:D,data:I}=P;D.save();const F=P.getDatasetMeta(0).data[0].x,B=P.getDatasetMeta(0).data[0].y,K=Bc(Od());D.font="1.2rem Arial",D.fontWeight="bolder",D.fillStyle=K,D.textAlign="center",D.textBaseline="middle";const Z=I.datasets[0].data.reduce(($,H)=>$+H,0),z=ll({number:Number(Z),decimalPlaces:((Q=s==null?void 0:s.numberAxisFormat)==null?void 0:Q.decimalPlaces)||0,useSuffix:!!((W=s==null?void 0:s.numberAxisFormat)!=null&&W.suffix),customSuffix:"",locale:((Y=s==null?void 0:s.numberAxisFormat)==null?void 0:Y.locale)||"",currency:((oe=s==null?void 0:s.numberAxisFormat)==null?void 0:oe.currency)||""});D.fillText(z,F,B)}}:""]}}if(t==="radar"){const u=WJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="bubble"||t==="scatter"){const{metricKeys:u}=ar(e);if(u.length<3){console.log("Bubble charts require 3 numeric columns");return}const f=VX(e),h=rg(f,r),g={plugins:{datalabels:{display:!0}},scales:{x:{title:{display:!0,text:u[0]},beginAtZero:!0,ticks:{precision:0}},y:{title:{display:!0,text:u[1]},beginAtZero:!0,ticks:{precision:0}}}},v=qo(g,(r==null?void 0:r.options)||{});return{type:t,data:{datasets:h},options:v}}return Ia({data:e,cfg:n,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}function qJ({chart:e,elementIndex:t,datasetIndex:n,cardType:r,cfg:o,apply:i}){const s=ke.getState().theme;if(!o)return;const a=s==="dark"?"rgb(238,238,238,0.2)":"rgb(238,238,238,0.8)";["bar","line","horizontalBar","bubble","scatter"].includes(r)&&YJ(e,t,o,i,a),["pie","doughnut","polarArea"].includes(r)&&KJ(e,t,o,i,a),["stackedBar","pyramid"].includes(r)&&GJ({chart:e,elementIndex:t,datasetIndex:n,cfg:o,apply:i,blurColor:a})}function GJ(e){var a,l,c,u;const{chart:t,elementIndex:n,datasetIndex:r,cfg:o,apply:i,blurColor:s}=e;i?(l=(a=t==null?void 0:t.data)==null?void 0:a.datasets)==null||l.forEach((f,h)=>{var g,v;typeof f.backgroundColor=="string"&&(f.backgroundColor=new Array(f.data.length).fill(f.backgroundColor),f.borderColor=new Array(f.data.length).fill(f.borderColor)),f.backgroundColor=(g=f==null?void 0:f.backgroundColor)==null?void 0:g.map((b,x)=>x===n&&h===r?b:s),f.borderColor=(v=f==null?void 0:f.borderColor)==null?void 0:v.map((b,x)=>x===n&&h===r?b:s)}):(u=(c=t==null?void 0:t.data)==null?void 0:c.datasets)==null||u.forEach((f,h)=>{var g,v,b,x,w,_;f.backgroundColor=new Array(f.data.length).fill((b=(v=(g=o==null?void 0:o.data)==null?void 0:g.datasets)==null?void 0:v[h])==null?void 0:b.backgroundColor),f.borderColor=new Array(f.data.length).fill((_=(w=(x=o==null?void 0:o.data)==null?void 0:x.datasets)==null?void 0:w[h])==null?void 0:_.borderColor)}),t==null||t.update()}function YJ(e,t,n,r,o){var i,s,a,l;console.log("clicked index",t),r?(s=(i=e==null?void 0:e.data)==null?void 0:i.datasets)==null||s.forEach(c=>{var u,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=(u=c==null?void 0:c.backgroundColor)==null?void 0:u.map((h,g)=>g===t?h:o),c.borderColor=(f=c==null?void 0:c.borderColor)==null?void 0:f.map((h,g)=>g===t?h:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,u)=>{var f,h,g,v,b,x;c.backgroundColor=new Array(c.data.length).fill((g=(h=(f=n==null?void 0:n.data)==null?void 0:f.datasets)==null?void 0:h[u])==null?void 0:g.backgroundColor),c.borderColor=new Array(c.data.length).fill((x=(b=(v=n==null?void 0:n.data)==null?void 0:v.datasets)==null?void 0:b[u])==null?void 0:x.borderColor)}),e==null||e.update()}function KJ(e,t,n,r,o){var i,s,a,l;r?(s=(i=e==null?void 0:e.data)==null?void 0:i.datasets)==null||s.forEach(c=>{var u,f;c.backgroundColor=(u=c==null?void 0:c.backgroundColor)==null?void 0:u.map((h,g)=>g===t?h:o),c.borderColor=(f=c==null?void 0:c.borderColor)==null?void 0:f.map((h,g)=>g===t?h:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,u)=>{var f,h,g,v,b,x,w,_;typeof c.backgroundColor=="string"&&(c.backgroundColor=(g=(h=(f=n==null?void 0:n.data)==null?void 0:f.datasets)==null?void 0:h[u])==null?void 0:g.backgroundColor,c.borderColor=(x=(b=(v=n==null?void 0:n.data)==null?void 0:v.datasets)==null?void 0:b[u])==null?void 0:x.borderColor),c.backgroundColor=(w=c==null?void 0:c.backgroundColor)==null?void 0:w.map((S,R)=>{var C;return(C=n.data.datasets[u].backgroundColor)==null?void 0:C[R]}),c.borderColor=(_=c==null?void 0:c.borderColor)==null?void 0:_.map((S,R)=>{var C;return(C=n.data.datasets[u].borderColor)==null?void 0:C[R]})}),e==null||e.update()}function XJ(e,t,n,r){var o,i;try{if(!e||!e.data)return;const{dimensionKeys:s,metricKeys:a}=ar(e.data);if(["bar","horizontalBar","line","pie","doughnut","radar","polarArea"].includes(e.type)){const l=s[0],c=(o=e.data[n])==null?void 0:o[l];return[{columnName:l,columnValue:c,metric:a[t],value:r}]}if(["stackedBar","pyramid"].includes(e.type)){const l=Pg({dataArray:e.data,groupKey:s[0],pivotKey:s[1],valueKey:a[0]}),c=s[0],u=(i=l[n])==null?void 0:i[c],f=s[1],{metricKeys:h}=ar(l),g=h[t];return[{columnName:c,columnValue:u,metric:a[0],value:r},{columnName:f,columnValue:g,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 QJ(e){var s,a;const[t]=m.useState({id:"",title:"",type:"bar",data:[]}),{getCard:n}=Mo(),r=n(e),o=j1(r||t),i={...r,data:((s=o==null?void 0:o.data)==null?void 0:s.records)||[]};return{...o,data:((a=o==null?void 0:o.data)==null?void 0:a.records)||[],card:i}}function j1(e){var B,K,Z;const{onChartElementClicked:t}=ma(),[n,r]=m.useState(0),o=((B=e==null?void 0:e.preferences)==null?void 0:B.filterOnClickColumnIndex)===void 0?0:(K=e.preferences)==null?void 0:K.filterOnClickColumnIndex,i=ke(z=>z.bookmarkKey);ke(z=>z.isVisualEditing);const s=ke(z=>z.filteringCards),a=ke(z=>z.selectedSheetId);ke(z=>z.selectedCardId),ke(z=>z.isDashboardEditing);const l=ke(z=>z.themeStyle),c=ke(z=>z.filterValues),u=m.useRef(c),f=(Z=e==null?void 0:e.preferences)==null?void 0:Z.onClickFilter,{addFrame:h,addFilteringCard:g,setFrameCardData:v,getSelectedFrame:b,addOrUpdateFilterValue:x,addOrUpdateFilterValues:w,removeFilterValue:_,removeFilteringCard:S}=Mo(),{data:R,isLoading:C,isFetching:P,isError:A,refetch:k}=NJ(e),D=s==null?void 0:s.find(z=>z.id===e.id);let I;e.data&&e.data.length>0&&(I=F1({data:e.data,cardType:e.type,cfg:e.cfg,customCfg:e.customCfg,preferences:e.preferences})),m.useEffect(()=>{!R||!R.records||v(a,e.id,(R==null?void 0:R.records)||[])},[R,a,e.id,v,c]),m.useEffect(()=>{e.data&&r(n+1)},[e.data,e.type,e.cfg,e.customCfg,e.preferences,l]),m.useEffect(()=>{e.connectionId&&!D&&(k(),u.current=c)},[c,i]);function F(z,Q,W,Y){var H,J;let oe=!1;if(!e.data)return;const $=XJ(e,Q,W,Y);if(console.log("fieldValues",$),t==null||t(e,$),!!(((H=e==null?void 0:e.preferences)==null?void 0:H.onClickFilter)??[]).length){if(D){const N=e.id;_(N),S(e)}else{if(oe=!0,!$)return;const N=[];$.forEach((ce,le)=>{const de=f==null?void 0:f.find(ie=>ie.columnIndex===le);if(!de)return;const pe={filterId:e.id+"-"+ce.columnName,connectionId:e==null?void 0:e.connectionId,tableName:e.lastSelectedTable,name:ce.columnName,expression:de.expression,valueType:Pd($[de.columnIndex].columnValue),operation:"=",values:[$[de.columnIndex].columnValue]};N.push(pe)}),e.id,e==null||e.connectionId,e.lastSelectedTable,$[o].columnName,(J=e.preferences)==null||J.filterOnClickField,Pd($[o].columnValue),$[o].columnValue,w(N),g(e)}qJ({chart:z,elementIndex:W,datasetIndex:Q,cardType:e.type,cfg:I,apply:oe})}}return{isError:A,isLoading:C,isFetching:P,data:R,visualKey:n,handleDatapointClick:F,cfg:I}}var JJ=e=>{switch(e){case"success":return tZ;case"info":return rZ;case"warning":return nZ;case"error":return oZ;default:return null}},ZJ=Array(12).fill(0),eZ=({visible:e})=>m.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},m.createElement("div",{className:"sonner-spinner"},ZJ.map((t,n)=>m.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),tZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),nZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),rZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),oZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),iZ=()=>{let[e,t]=m.useState(document.hidden);return m.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},yx=1,sZ=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;let{message:r,...o}=t,i=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:yx++,s=this.toasts.find(l=>l.id===i),a=t.dismissible===void 0?!0:t.dismissible;return s?this.toasts=this.toasts.map(l=>l.id===i?(this.publish({...l,...t,id:i,title:r}),{...l,...t,id:i,dismissible:a,title:r}):l):this.addToast({title:r,...o,dismissible:a,id:i}),i},this.dismiss=t=>(t||this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),this.subscribers.forEach(n=>n({id:t,dismiss:!0})),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let o=t instanceof Promise?t:t(),i=r!==void 0;return o.then(async s=>{if(lZ(s)&&!s.ok){i=!1;let a=typeof n.error=="function"?await n.error(`HTTP error! status: ${s.status}`):n.error,l=typeof n.description=="function"?await n.description(`HTTP error! status: ${s.status}`):n.description;this.create({id:r,type:"error",message:a,description:l})}else if(n.success!==void 0){i=!1;let a=typeof n.success=="function"?await n.success(s):n.success,l=typeof n.description=="function"?await n.description(s):n.description;this.create({id:r,type:"success",message:a,description:l})}}).catch(async s=>{if(n.error!==void 0){i=!1;let a=typeof n.error=="function"?await n.error(s):n.error,l=typeof n.description=="function"?await n.description(s):n.description;this.create({id:r,type:"error",message:a,description:l})}}).finally(()=>{var s;i&&(this.dismiss(r),r=void 0),(s=n.finally)==null||s.call(n)}),r},this.custom=(t,n)=>{let r=(n==null?void 0:n.id)||yx++;return this.create({jsx:t(r),id:r,...n}),r},this.subscribers=[],this.toasts=[]}},Qr=new sZ,aZ=(e,t)=>{let n=(t==null?void 0:t.id)||yx++;return Qr.addToast({title:e,...t,id:n}),n},lZ=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",cZ=aZ,uZ=()=>Qr.toasts,dk=Object.assign(cZ,{success:Qr.success,info:Qr.info,warning:Qr.warning,error:Qr.error,custom:Qr.custom,message:Qr.message,promise:Qr.promise,dismiss:Qr.dismiss,loading:Qr.loading},{getHistory:uZ});function dZ(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}dZ(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
254
254
|
`);function bp(e){return e.label!==void 0}var fZ=3,hZ="32px",pZ=4e3,gZ=356,mZ=14,vZ=20,bZ=200;function yZ(...e){return e.filter(Boolean).join(" ")}var xZ=e=>{var t,n,r,o,i,s,a,l,c,u;let{invert:f,toast:h,unstyled:g,interacting:v,setHeights:b,visibleToasts:x,heights:w,index:_,toasts:S,expanded:R,removeToast:C,defaultRichColors:P,closeButton:A,style:k,cancelButtonStyle:D,actionButtonStyle:I,className:F="",descriptionClassName:B="",duration:K,position:Z,gap:z,loadingIcon:Q,expandByDefault:W,classNames:Y,icons:oe,closeButtonAriaLabel:$="Close toast",pauseWhenPageIsHidden:H,cn:J}=e,[N,ce]=m.useState(!1),[le,de]=m.useState(!1),[pe,ie]=m.useState(!1),[te,ae]=m.useState(!1),[ye,G]=m.useState(0),[be,_e]=m.useState(0),Pe=m.useRef(null),Te=m.useRef(null),Ue=_===0,Be=_+1<=x,Ie=h.type,Ke=h.dismissible!==!1,lt=h.className||"",It=h.descriptionClassName||"",$t=m.useMemo(()=>w.findIndex(nt=>nt.toastId===h.id)||0,[w,h.id]),Ht=m.useMemo(()=>{var nt;return(nt=h.closeButton)!=null?nt:A},[h.closeButton,A]),fe=m.useMemo(()=>h.duration||K||pZ,[h.duration,K]),Ce=m.useRef(0),Le=m.useRef(0),Ge=m.useRef(0),Ze=m.useRef(null),[Wt,Zt]=Z.split("-"),Kt=m.useMemo(()=>w.reduce((nt,ht,At)=>At>=$t?nt:nt+ht.height,0),[w,$t]),vn=iZ(),ln=h.invert||f,Lt=Ie==="loading";Le.current=m.useMemo(()=>$t*z+Kt,[$t,Kt]),m.useEffect(()=>{ce(!0)},[]),m.useLayoutEffect(()=>{if(!N)return;let nt=Te.current,ht=nt.style.height;nt.style.height="auto";let At=nt.getBoundingClientRect().height;nt.style.height=ht,_e(At),b(Xt=>Xt.find(bt=>bt.toastId===h.id)?Xt.map(bt=>bt.toastId===h.id?{...bt,height:At}:bt):[{toastId:h.id,height:At,position:h.position},...Xt])},[N,h.title,h.description,b,h.id]);let tn=m.useCallback(()=>{de(!0),G(Le.current),b(nt=>nt.filter(ht=>ht.toastId!==h.id)),setTimeout(()=>{C(h)},bZ)},[h,C,b,Le]);m.useEffect(()=>{if(h.promise&&Ie==="loading"||h.duration===1/0||h.type==="loading")return;let nt,ht=fe;return R||v||H&&vn?(()=>{if(Ge.current<Ce.current){let At=new Date().getTime()-Ce.current;ht=ht-At}Ge.current=new Date().getTime()})():ht!==1/0&&(Ce.current=new Date().getTime(),nt=setTimeout(()=>{var At;(At=h.onAutoClose)==null||At.call(h,h),tn()},ht)),()=>clearTimeout(nt)},[R,v,W,h,fe,tn,h.promise,Ie,H,vn]),m.useEffect(()=>{let nt=Te.current;if(nt){let ht=nt.getBoundingClientRect().height;return _e(ht),b(At=>[{toastId:h.id,height:ht,position:h.position},...At]),()=>b(At=>At.filter(Xt=>Xt.toastId!==h.id))}},[b,h.id]),m.useEffect(()=>{h.delete&&tn()},[tn,h.delete]);function xn(){return oe!=null&&oe.loading?m.createElement("div",{className:"sonner-loader","data-visible":Ie==="loading"},oe.loading):Q?m.createElement("div",{className:"sonner-loader","data-visible":Ie==="loading"},Q):m.createElement(eZ,{visible:Ie==="loading"})}return m.createElement("li",{"aria-live":h.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:Te,className:J(F,lt,Y==null?void 0:Y.toast,(t=h==null?void 0:h.classNames)==null?void 0:t.toast,Y==null?void 0:Y.default,Y==null?void 0:Y[Ie],(n=h==null?void 0:h.classNames)==null?void 0:n[Ie]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:P,"data-styled":!(h.jsx||h.unstyled||g),"data-mounted":N,"data-promise":!!h.promise,"data-removed":le,"data-visible":Be,"data-y-position":Wt,"data-x-position":Zt,"data-index":_,"data-front":Ue,"data-swiping":pe,"data-dismissible":Ke,"data-type":Ie,"data-invert":ln,"data-swipe-out":te,"data-expanded":!!(R||W&&N),style:{"--index":_,"--toasts-before":_,"--z-index":S.length-_,"--offset":`${le?ye:Le.current}px`,"--initial-height":W?"auto":`${be}px`,...k,...h.style},onPointerDown:nt=>{Lt||!Ke||(Pe.current=new Date,G(Le.current),nt.target.setPointerCapture(nt.pointerId),nt.target.tagName!=="BUTTON"&&(ie(!0),Ze.current={x:nt.clientX,y:nt.clientY}))},onPointerUp:()=>{var nt,ht,At,Xt;if(te||!Ke)return;Ze.current=null;let bt=Number(((nt=Te.current)==null?void 0:nt.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Rn=new Date().getTime()-((ht=Pe.current)==null?void 0:ht.getTime()),Lo=Math.abs(bt)/Rn;if(Math.abs(bt)>=vZ||Lo>.11){G(Le.current),(At=h.onDismiss)==null||At.call(h,h),tn(),ae(!0);return}(Xt=Te.current)==null||Xt.style.setProperty("--swipe-amount","0px"),ie(!1)},onPointerMove:nt=>{var ht;if(!Ze.current||!Ke)return;let At=nt.clientY-Ze.current.y,Xt=nt.clientX-Ze.current.x,bt=(Wt==="top"?Math.min:Math.max)(0,At),Rn=nt.pointerType==="touch"?10:2;Math.abs(bt)>Rn?(ht=Te.current)==null||ht.style.setProperty("--swipe-amount",`${At}px`):Math.abs(Xt)>Rn&&(Ze.current=null)}},Ht&&!h.jsx?m.createElement("button",{"aria-label":$,"data-disabled":Lt,"data-close-button":!0,onClick:Lt||!Ke?()=>{}:()=>{var nt;tn(),(nt=h.onDismiss)==null||nt.call(h,h)},className:J(Y==null?void 0:Y.closeButton,(o=h==null?void 0:h.classNames)==null?void 0:o.closeButton)},m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},m.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,h.jsx||m.isValidElement(h.title)?h.jsx||h.title:m.createElement(m.Fragment,null,Ie||h.icon||h.promise?m.createElement("div",{"data-icon":"",className:J(Y==null?void 0:Y.icon,(i=h==null?void 0:h.classNames)==null?void 0:i.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||xn():null,h.type!=="loading"?h.icon||(oe==null?void 0:oe[Ie])||JJ(Ie):null):null,m.createElement("div",{"data-content":"",className:J(Y==null?void 0:Y.content,(s=h==null?void 0:h.classNames)==null?void 0:s.content)},m.createElement("div",{"data-title":"",className:J(Y==null?void 0:Y.title,(a=h==null?void 0:h.classNames)==null?void 0:a.title)},h.title),h.description?m.createElement("div",{"data-description":"",className:J(B,It,Y==null?void 0:Y.description,(l=h==null?void 0:h.classNames)==null?void 0:l.description)},h.description):null),m.isValidElement(h.cancel)?h.cancel:h.cancel&&bp(h.cancel)?m.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||D,onClick:nt=>{var ht,At;bp(h.cancel)&&Ke&&((At=(ht=h.cancel).onClick)==null||At.call(ht,nt),tn())},className:J(Y==null?void 0:Y.cancelButton,(c=h==null?void 0:h.classNames)==null?void 0:c.cancelButton)},h.cancel.label):null,m.isValidElement(h.action)?h.action:h.action&&bp(h.action)?m.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||I,onClick:nt=>{var ht,At;bp(h.action)&&(nt.defaultPrevented||((At=(ht=h.action).onClick)==null||At.call(ht,nt),tn()))},className:J(Y==null?void 0:Y.actionButton,(u=h==null?void 0:h.classNames)==null?void 0:u.actionButton)},h.action.label):null))};function bP(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}var wZ=e=>{let{invert:t,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:o,closeButton:i,className:s,offset:a,theme:l="light",richColors:c,duration:u,style:f,visibleToasts:h=fZ,toastOptions:g,dir:v=bP(),gap:b=mZ,loadingIcon:x,icons:w,containerAriaLabel:_="Notifications",pauseWhenPageIsHidden:S,cn:R=yZ}=e,[C,P]=m.useState([]),A=m.useMemo(()=>Array.from(new Set([n].concat(C.filter(H=>H.position).map(H=>H.position)))),[C,n]),[k,D]=m.useState([]),[I,F]=m.useState(!1),[B,K]=m.useState(!1),[Z,z]=m.useState(l!=="system"?l:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Q=m.useRef(null),W=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),Y=m.useRef(null),oe=m.useRef(!1),$=m.useCallback(H=>{var J;(J=C.find(N=>N.id===H.id))!=null&&J.delete||Qr.dismiss(H.id),P(N=>N.filter(({id:ce})=>ce!==H.id))},[C]);return m.useEffect(()=>Qr.subscribe(H=>{if(H.dismiss){P(J=>J.map(N=>N.id===H.id?{...N,delete:!0}:N));return}setTimeout(()=>{ko.flushSync(()=>{P(J=>{let N=J.findIndex(ce=>ce.id===H.id);return N!==-1?[...J.slice(0,N),{...J[N],...H},...J.slice(N+1)]:[H,...J]})})})}),[]),m.useEffect(()=>{if(l!=="system"){z(l);return}l==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:H})=>{z(H?"dark":"light")})},[l]),m.useEffect(()=>{C.length<=1&&F(!1)},[C]),m.useEffect(()=>{let H=J=>{var N,ce;r.every(le=>J[le]||J.code===le)&&(F(!0),(N=Q.current)==null||N.focus()),J.code==="Escape"&&(document.activeElement===Q.current||(ce=Q.current)!=null&&ce.contains(document.activeElement))&&F(!1)};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[r]),m.useEffect(()=>{if(Q.current)return()=>{Y.current&&(Y.current.focus({preventScroll:!0}),Y.current=null,oe.current=!1)}},[Q.current]),C.length?m.createElement("section",{"aria-label":`${_} ${W}`,tabIndex:-1},A.map((H,J)=>{var N;let[ce,le]=H.split("-");return m.createElement("ol",{key:H,dir:v==="auto"?bP():v,tabIndex:-1,ref:Q,className:s,"data-sonner-toaster":!0,"data-theme":Z,"data-y-position":ce,"data-x-position":le,style:{"--front-toast-height":`${((N=k[0])==null?void 0:N.height)||0}px`,"--offset":typeof a=="number"?`${a}px`:a||hZ,"--width":`${gZ}px`,"--gap":`${b}px`,...f},onBlur:de=>{oe.current&&!de.currentTarget.contains(de.relatedTarget)&&(oe.current=!1,Y.current&&(Y.current.focus({preventScroll:!0}),Y.current=null))},onFocus:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||oe.current||(oe.current=!0,Y.current=de.relatedTarget)},onMouseEnter:()=>F(!0),onMouseMove:()=>F(!0),onMouseLeave:()=>{B||F(!1)},onPointerDown:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||K(!0)},onPointerUp:()=>K(!1)},C.filter(de=>!de.position&&J===0||de.position===H).map((de,pe)=>{var ie,te;return m.createElement(xZ,{key:de.id,icons:w,index:pe,toast:de,defaultRichColors:c,duration:(ie=g==null?void 0:g.duration)!=null?ie:u,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:t,visibleToasts:h,closeButton:(te=g==null?void 0:g.closeButton)!=null?te:i,interacting:B,position:H,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:$,toasts:C.filter(ae=>ae.position==de.position),heights:k.filter(ae=>ae.position==de.position),setHeights:D,expandByDefault:o,gap:b,loadingIcon:x,expanded:I,pauseWhenPageIsHidden:S,cn:R})}))})):null};function _Z(e,t){const n=ke(u=>u.selectedSheetId),r=ke(u=>u.selectedFrameId),o=ke(u=>u.isDashboardEditing),i=ke(u=>u.isVisualEditing),{addFrame:s,getSelectedFrame:a,setSelectedFrameId:l}=ke(u=>u.actions);m.useEffect(()=>{const u=h=>{if(o&&((h.metaKey||h.ctrlKey)&&h.key==="c"&&(navigator.clipboard.writeText(JSON.stringify(a())),dk.success("Card copied to clipboard")),(h.ctrlKey||h.metaKey)&&h.key==="v")){console.log("Ctrl+V has been pressed");try{navigator.clipboard.readText().then(g=>{try{const v=JSON.parse(g);if(v&&v.id){v.id=la();const b=v.activeCardId;v.cards.forEach(x=>{const w=x.id;x.id=la(),w===b&&(v.activeCardId=x.id,x.title=`${x.title} (Copy)`)}),s(n,v),l(v.id)}}catch(v){console.error("Failed to parse clipboard contents: ",v)}})}catch(g){console.error("Failed to read clipboard contents: ",g)}}},f=t==null?void 0:t.current;return f==null||f.addEventListener("keydown",u),()=>{f==null||f.removeEventListener("keydown",u)}},[o,n,a,s,t,l]),m.useEffect(()=>{r===e.id&&o&&!i&&c()},[r,e.id,o,i]);function c(){const u=t==null?void 0:t.current;u==null||u.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}let ry;const fk="HoverCard",[hk,fye]=Zn(fk,[Ti]),z1=Ti(),[SZ,B1]=hk(fk),CZ=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:o,onOpenChange:i,openDelay:s=700,closeDelay:a=300}=e,l=z1(t),c=m.useRef(0),u=m.useRef(0),f=m.useRef(!1),h=m.useRef(!1),[g=!1,v]=xr({prop:r,defaultProp:o,onChange:i}),b=m.useCallback(()=>{clearTimeout(u.current),c.current=window.setTimeout(()=>v(!0),s)},[s,v]),x=m.useCallback(()=>{clearTimeout(c.current),!f.current&&!h.current&&(u.current=window.setTimeout(()=>v(!1),a))},[a,v]),w=m.useCallback(()=>v(!1),[v]);return m.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(u.current)},[]),m.createElement(SZ,{scope:t,open:g,onOpenChange:v,onOpen:b,onClose:x,onDismiss:w,hasSelectionRef:f,isPointerDownOnContentRef:h},m.createElement(zf,l,n))},EZ="HoverCardTrigger",RZ=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=B1(EZ,n),i=z1(n);return m.createElement(Bf,he({asChild:!0},i),m.createElement(Qe.a,he({"data-state":o.open?"open":"closed"},r,{ref:t,onPointerEnter:Me(e.onPointerEnter,kg(o.onOpen)),onPointerLeave:Me(e.onPointerLeave,kg(o.onClose)),onFocus:Me(e.onFocus,o.onOpen),onBlur:Me(e.onBlur,o.onClose),onTouchStart:Me(e.onTouchStart,s=>s.preventDefault())})))}),OZ="HoverCardPortal",[hye,PZ]=hk(OZ,{forceMount:void 0}),xx="HoverCardContent",TZ=m.forwardRef((e,t)=>{const n=PZ(xx,e.__scopeHoverCard),{forceMount:r=n.forceMount,...o}=e,i=B1(xx,e.__scopeHoverCard);return m.createElement(er,{present:r||i.open},m.createElement(DZ,he({"data-state":i.open?"open":"closed"},o,{onPointerEnter:Me(e.onPointerEnter,kg(i.onOpen)),onPointerLeave:Me(e.onPointerLeave,kg(i.onClose)),ref:t})))}),DZ=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,...a}=e,l=B1(xx,n),c=z1(n),u=m.useRef(null),f=_t(t,u),[h,g]=m.useState(!1);return m.useEffect(()=>{if(h){const v=document.body;return ry=v.style.userSelect||v.style.webkitUserSelect,v.style.userSelect="none",v.style.webkitUserSelect="none",()=>{v.style.userSelect=ry,v.style.webkitUserSelect=ry}}},[h]),m.useEffect(()=>{if(u.current){const v=()=>{g(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var b;((b=document.getSelection())===null||b===void 0?void 0:b.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(()=>{u.current&&$Z(u.current).forEach(b=>b.setAttribute("tabindex","-1"))}),m.createElement(Ff,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:s,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:Me(i,v=>{v.preventDefault()}),onDismiss:l.onDismiss},m.createElement(Vf,he({},c,a,{onPointerDown:Me(a.onPointerDown,v=>{v.currentTarget.contains(v.target)&&g(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:f,style:{...a.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"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 kg(e){return t=>t.pointerType==="touch"?void 0:e()}function $Z(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 AZ=CZ,kZ=RZ,pk=TZ,V1=AZ,H1=kZ,Mm=V.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>O.jsx(pk,{ref:o,align:t,sideOffset:n,className:Ee("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}));Mm.displayName=pk.displayName;function MZ({card:e}){const{setCardInfo:t}=Mo();return O.jsxs(V1,{openDelay:0,children:[O.jsx(H1,{children:O.jsx(JX,{className:"size-4 text-muted-foreground/40"})}),O.jsx(Mm,{align:"start",className:"w-[300px]",onMouseDown:n=>n.stopPropagation(),children:O.jsx(is,{type:"textarea",text:e.info||"",onSave:n=>t(e.id,n),children:O.jsx("p",{className:"text-sm text-muted-foreground",children:e.info||"Double-click to add info"})})})]})}const W1=V.forwardRef(({className:e,containerClassName:t,containerStyle:n,...r},o)=>O.jsx("div",{style:n,className:Ee("relative w-full overflow-auto",t),children:O.jsx("table",{ref:o,className:Ee("w-full caption-bottom text-sm",e),...r})}));W1.displayName="Table";const U1=V.forwardRef(({className:e,...t},n)=>O.jsx("thead",{ref:n,className:Ee("[&_tr]:border-b",e),...t}));U1.displayName="TableHeader";const q1=V.forwardRef(({className:e,...t},n)=>O.jsx("tbody",{ref:n,className:Ee("[&_tr:last-child]:border-0",e),...t}));q1.displayName="TableBody";const IZ=V.forwardRef(({className:e,...t},n)=>O.jsx("tfoot",{ref:n,className:Ee("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));IZ.displayName="TableFooter";const bd=V.forwardRef(({className:e,...t},n)=>O.jsx("tr",{ref:n,className:Ee("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));bd.displayName="TableRow";const G1=V.forwardRef(({className:e,...t},n)=>O.jsx("th",{ref:n,className:Ee("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));G1.displayName="TableHead";const Mg=V.forwardRef(({className:e,...t},n)=>O.jsx("td",{ref:n,className:Ee("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Mg.displayName="TableCell";const NZ=V.forwardRef(({className:e,...t},n)=>O.jsx("caption",{ref:n,className:Ee("mt-4 text-sm text-muted-foreground",e),...t}));NZ.displayName="TableCaption";/**
|
|
255
255
|
* table-core
|
|
256
256
|
*
|
|
@@ -312,7 +312,7 @@ Valid keys: `+JSON.stringify(Object.keys($),null," "));var G=ye(pe,ae,ce,le,de+
|
|
|
312
312
|
`)},Lk=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,i=V.useMemo(function(){return Gee(o)},[o]);return V.createElement(Yee,{styles:Kee(i,!t,o,n?"":"!important")})},Tx=!1;if(typeof window<"u")try{var Cp=Object.defineProperty({},"passive",{get:function(){return Tx=!0,!0}});window.addEventListener("test",Cp,Cp),window.removeEventListener("test",Cp,Cp)}catch{Tx=!1}var ec=Tx?{passive:!1}:!1,Xee=function(e){return e.tagName==="TEXTAREA"},Fk=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Xee(e)&&n[t]==="visible")},Qee=function(e){return Fk(e,"overflowY")},Jee=function(e){return Fk(e,"overflowX")},PP=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=jk(e,n);if(r){var o=zk(e,n),i=o[1],s=o[2];if(i>s)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},Zee=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},ete=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},jk=function(e,t){return e==="v"?Qee(t):Jee(t)},zk=function(e,t){return e==="v"?Zee(t):ete(t)},tte=function(e,t){return e==="h"&&t==="rtl"?-1:1},nte=function(e,t,n,r,o){var i=tte(e,window.getComputedStyle(t).direction),s=i*r,a=n.target,l=t.contains(a),c=!1,u=s>0,f=0,h=0;do{var g=zk(e,a),v=g[0],b=g[1],x=g[2],w=b-x-i*v;(v||w)&&jk(e,a)&&(f+=w,h+=v),a=a.parentNode}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&(o&&f===0||!o&&s>f)||!u&&(o&&h===0||!o&&-s>h))&&(c=!0),c},Ep=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},TP=function(e){return[e.deltaX,e.deltaY]},DP=function(e){return e&&"current"in e?e.current:e},rte=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ote=function(e){return`
|
|
313
313
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
314
314
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
315
|
-
`)},ite=0,tc=[];function ste(e){var t=V.useRef([]),n=V.useRef([0,0]),r=V.useRef(),o=V.useState(ite++)[0],i=V.useState(function(){return e_()})[0],s=V.useRef(e);V.useEffect(function(){s.current=e},[e]),V.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var b=$k([e.lockRef.current],(e.shards||[]).map(DP),!0).filter(Boolean);return b.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),b.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=V.useCallback(function(b,x){if("touches"in b&&b.touches.length===2)return!s.current.allowPinchZoom;var w=Ep(b),_=n.current,S="deltaX"in b?b.deltaX:_[0]-w[0],R="deltaY"in b?b.deltaY:_[1]-w[1],C,P=b.target,A=Math.abs(S)>Math.abs(R)?"h":"v";if("touches"in b&&A==="h"&&P.type==="range")return!1;var k=PP(A,P);if(!k)return!0;if(k?C=A:(C=A==="v"?"h":"v",k=PP(A,P)),!k)return!1;if(!r.current&&"changedTouches"in b&&(S||R)&&(r.current=C),!C)return!0;var D=r.current||C;return nte(D,x,b,D==="h"?S:R,!0)},[]),l=V.useCallback(function(b){var x=b;if(!(!tc.length||tc[tc.length-1]!==i)){var w="deltaY"in x?TP(x):Ep(x),_=t.current.filter(function(C){return C.name===x.type&&C.target===x.target&&rte(C.delta,w)})[0];if(_&&_.should){x.cancelable&&x.preventDefault();return}if(!_){var S=(s.current.shards||[]).map(DP).filter(Boolean).filter(function(C){return C.contains(x.target)}),R=S.length>0?a(x,S[0]):!s.current.noIsolation;R&&x.cancelable&&x.preventDefault()}}},[]),c=V.useCallback(function(b,x,w,_){var S={name:b,delta:x,target:w,should:_};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(R){return R!==S})},1)},[]),u=V.useCallback(function(b){n.current=Ep(b),r.current=void 0},[]),f=V.useCallback(function(b){c(b.type,TP(b),b.target,a(b,e.lockRef.current))},[]),h=V.useCallback(function(b){c(b.type,Ep(b),b.target,a(b,e.lockRef.current))},[]);V.useEffect(function(){return tc.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,ec),document.addEventListener("touchmove",l,ec),document.addEventListener("touchstart",u,ec),function(){tc=tc.filter(function(b){return b!==i}),document.removeEventListener("wheel",l,ec),document.removeEventListener("touchmove",l,ec),document.removeEventListener("touchstart",u,ec)}},[]);var g=e.removeScrollBar,v=e.inert;return V.createElement(V.Fragment,null,v?V.createElement(i,{styles:ote(o)}):null,g?V.createElement(Lk,{gapMode:"margin"}):null)}const ate=Ik(Nk,ste);var Bk=V.forwardRef(function(e,t){return V.createElement(Lm,lr({},e,{ref:t,sideCar:ate}))});Bk.classNames=Lm.classNames;const t_=Bk,lte=[" ","Enter","ArrowUp","ArrowDown"],cte=[" ","Enter"],Fm="Select",[jm,zm,ute]=lm(Fm),[au,pye]=Zn(Fm,[ute,Ti]),n_=Ti(),[dte,Rl]=au(Fm),[fte,hte]=au(Fm),pte=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:f,disabled:h,required:g}=e,v=n_(t),[b,x]=m.useState(null),[w,_]=m.useState(null),[S,R]=m.useState(!1),C=_l(c),[P=!1,A]=xr({prop:r,defaultProp:o,onChange:i}),[k,D]=xr({prop:s,defaultProp:a,onChange:l}),I=m.useRef(null),F=b?!!b.closest("form"):!0,[B,K]=m.useState(new Set),Z=Array.from(B).map(z=>z.props.value).join(";");return m.createElement(zf,v,m.createElement(dte,{required:g,scope:t,trigger:b,onTriggerChange:x,valueNode:w,onValueNodeChange:_,valueNodeHasChildren:S,onValueNodeHasChildrenChange:R,contentId:Jo(),value:k,onValueChange:D,open:P,onOpenChange:A,dir:C,triggerPointerDownPosRef:I,disabled:h},m.createElement(jm.Provider,{scope:t},m.createElement(fte,{scope:e.__scopeSelect,onNativeOptionAdd:m.useCallback(z=>{K(Q=>new Set(Q).add(z))},[]),onNativeOptionRemove:m.useCallback(z=>{K(Q=>{const W=new Set(Q);return W.delete(z),W})},[])},n)),F?m.createElement(qk,{key:Z,"aria-hidden":!0,required:g,tabIndex:-1,name:u,autoComplete:f,value:k,onChange:z=>D(z.target.value),disabled:h},k===void 0?m.createElement("option",{value:""}):null,Array.from(B)):null))},gte="SelectTrigger",mte=m.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=n_(n),s=Rl(gte,n),a=s.disabled||r,l=_t(t,s.onTriggerChange),c=zm(n),[u,f,h]=Gk(v=>{const b=c().filter(_=>!_.disabled),x=b.find(_=>_.value===s.value),w=Yk(b,v,x);w!==void 0&&s.onValueChange(w.value)}),g=()=>{a||(s.onOpenChange(!0),h())};return m.createElement(Bf,he({asChild:!0},i),m.createElement(Qe.button,he({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":Uk(s.value)?"":void 0},o,{ref:l,onClick:Me(o.onClick,v=>{v.currentTarget.focus()}),onPointerDown:Me(o.onPointerDown,v=>{const b=v.target;b.hasPointerCapture(v.pointerId)&&b.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&(g(),s.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)},v.preventDefault())}),onKeyDown:Me(o.onKeyDown,v=>{const b=u.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&f(v.key),!(b&&v.key===" ")&<e.includes(v.key)&&(g(),v.preventDefault())})})))}),vte="SelectValue",bte=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:s="",...a}=e,l=Rl(vte,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,f=_t(t,l.onValueNodeChange);return ur(()=>{c(u)},[c,u]),m.createElement(Qe.span,he({},a,{ref:f,style:{pointerEvents:"none"}}),Uk(l.value)?m.createElement(m.Fragment,null,s):i)}),yte=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return m.createElement(Qe.span,he({"aria-hidden":!0},o,{ref:t}),r||"▼")}),xte=e=>m.createElement(A1,he({asChild:!0},e)),Jc="SelectContent",wte=m.forwardRef((e,t)=>{const n=Rl(Jc,e.__scopeSelect),[r,o]=m.useState();if(ur(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?ko.createPortal(m.createElement(Vk,{scope:e.__scopeSelect},m.createElement(jm.Slot,{scope:e.__scopeSelect},m.createElement("div",null,e.children))),i):null}return m.createElement(_te,he({},e,{ref:t}))}),Ki=10,[Vk,Ol]=au(Jc),_te=m.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:g,sticky:v,hideWhenDetached:b,avoidCollisions:x,...w}=e,_=Rl(Jc,n),[S,R]=m.useState(null),[C,P]=m.useState(null),A=_t(t,pe=>R(pe)),[k,D]=m.useState(null),[I,F]=m.useState(null),B=zm(n),[K,Z]=m.useState(!1),z=m.useRef(!1);m.useEffect(()=>{if(S)return Nm(S)},[S]),Q1();const Q=m.useCallback(pe=>{const[ie,...te]=B().map(G=>G.ref.current),[ae]=te.slice(-1),ye=document.activeElement;for(const G of pe)if(G===ye||(G==null||G.scrollIntoView({block:"nearest"}),G===ie&&C&&(C.scrollTop=0),G===ae&&C&&(C.scrollTop=C.scrollHeight),G==null||G.focus(),document.activeElement!==ye))return},[B,C]),W=m.useCallback(()=>Q([k,S]),[Q,k,S]);m.useEffect(()=>{K&&W()},[K,W]);const{onOpenChange:Y,triggerPointerDownPosRef:oe}=_;m.useEffect(()=>{if(S){let pe={x:0,y:0};const ie=ae=>{var ye,G,be,_e;pe={x:Math.abs(Math.round(ae.pageX)-((ye=(G=oe.current)===null||G===void 0?void 0:G.x)!==null&&ye!==void 0?ye:0)),y:Math.abs(Math.round(ae.pageY)-((be=(_e=oe.current)===null||_e===void 0?void 0:_e.y)!==null&&be!==void 0?be:0))}},te=ae=>{pe.x<=10&&pe.y<=10?ae.preventDefault():S.contains(ae.target)||Y(!1),document.removeEventListener("pointermove",ie),oe.current=null};return oe.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",te,{capture:!0})}}},[S,Y,oe]),m.useEffect(()=>{const pe=()=>Y(!1);return window.addEventListener("blur",pe),window.addEventListener("resize",pe),()=>{window.removeEventListener("blur",pe),window.removeEventListener("resize",pe)}},[Y]);const[$,H]=Gk(pe=>{const ie=B().filter(ye=>!ye.disabled),te=ie.find(ye=>ye.ref.current===document.activeElement),ae=Yk(ie,pe,te);ae&&setTimeout(()=>ae.ref.current.focus())}),J=m.useCallback((pe,ie,te)=>{const ae=!z.current&&!te;(_.value!==void 0&&_.value===ie||ae)&&(D(pe),ae&&(z.current=!0))},[_.value]),N=m.useCallback(()=>S==null?void 0:S.focus(),[S]),ce=m.useCallback((pe,ie,te)=>{const ae=!z.current&&!te;(_.value!==void 0&&_.value===ie||ae)&&F(pe)},[_.value]),le=r==="popper"?$P:Ste,de=le===$P?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:g,sticky:v,hideWhenDetached:b,avoidCollisions:x}:{};return m.createElement(Vk,{scope:n,content:S,viewport:C,onViewportChange:P,itemRefCallback:J,selectedItem:k,onItemLeave:N,itemTextRefCallback:ce,focusSelectedItem:W,selectedItemText:I,position:r,isPositioned:K,searchRef:$},m.createElement(t_,{as:Tk,allowPinchZoom:!0},m.createElement(J1,{asChild:!0,trapped:_.open,onMountAutoFocus:pe=>{pe.preventDefault()},onUnmountAutoFocus:Me(o,pe=>{var ie;(ie=_.trigger)===null||ie===void 0||ie.focus({preventScroll:!0}),pe.preventDefault()})},m.createElement(Ff,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:pe=>pe.preventDefault(),onDismiss:()=>_.onOpenChange(!1)},m.createElement(le,he({role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:pe=>pe.preventDefault()},w,de,{onPlaced:()=>Z(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:Me(w.onKeyDown,pe=>{const ie=pe.ctrlKey||pe.altKey||pe.metaKey;if(pe.key==="Tab"&&pe.preventDefault(),!ie&&pe.key.length===1&&H(pe.key),["ArrowUp","ArrowDown","Home","End"].includes(pe.key)){let ae=B().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);if(["ArrowUp","End"].includes(pe.key)&&(ae=ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(pe.key)){const ye=pe.target,G=ae.indexOf(ye);ae=ae.slice(G+1)}setTimeout(()=>Q(ae)),pe.preventDefault()}})}))))))}),Ste=m.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=Rl(Jc,n),s=Ol(Jc,n),[a,l]=m.useState(null),[c,u]=m.useState(null),f=_t(t,A=>u(A)),h=zm(n),g=m.useRef(!1),v=m.useRef(!0),{viewport:b,selectedItem:x,selectedItemText:w,focusSelectedItem:_}=s,S=m.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&b&&x&&w){const A=i.trigger.getBoundingClientRect(),k=c.getBoundingClientRect(),D=i.valueNode.getBoundingClientRect(),I=w.getBoundingClientRect();if(i.dir!=="rtl"){const ye=I.left-k.left,G=D.left-ye,be=A.left-G,_e=A.width+be,Pe=Math.max(_e,k.width),Te=window.innerWidth-Ki,Ue=Ox(G,[Ki,Te-Pe]);a.style.minWidth=_e+"px",a.style.left=Ue+"px"}else{const ye=k.right-I.right,G=window.innerWidth-D.right-ye,be=window.innerWidth-A.right-G,_e=A.width+be,Pe=Math.max(_e,k.width),Te=window.innerWidth-Ki,Ue=Ox(G,[Ki,Te-Pe]);a.style.minWidth=_e+"px",a.style.right=Ue+"px"}const F=h(),B=window.innerHeight-Ki*2,K=b.scrollHeight,Z=window.getComputedStyle(c),z=parseInt(Z.borderTopWidth,10),Q=parseInt(Z.paddingTop,10),W=parseInt(Z.borderBottomWidth,10),Y=parseInt(Z.paddingBottom,10),oe=z+Q+K+Y+W,$=Math.min(x.offsetHeight*5,oe),H=window.getComputedStyle(b),J=parseInt(H.paddingTop,10),N=parseInt(H.paddingBottom,10),ce=A.top+A.height/2-Ki,le=B-ce,de=x.offsetHeight/2,pe=x.offsetTop+de,ie=z+Q+pe,te=oe-ie;if(ie<=ce){const ye=x===F[F.length-1].ref.current;a.style.bottom="0px";const G=c.clientHeight-b.offsetTop-b.offsetHeight,be=Math.max(le,de+(ye?N:0)+G+W),_e=ie+be;a.style.height=_e+"px"}else{const ye=x===F[0].ref.current;a.style.top="0px";const be=Math.max(ce,z+b.offsetTop+(ye?J:0)+de)+te;a.style.height=be+"px",b.scrollTop=ie-ce+b.offsetTop}a.style.margin=`${Ki}px 0`,a.style.minHeight=$+"px",a.style.maxHeight=B+"px",r==null||r(),requestAnimationFrame(()=>g.current=!0)}},[h,i.trigger,i.valueNode,a,c,b,x,w,i.dir,r]);ur(()=>S(),[S]);const[R,C]=m.useState();ur(()=>{c&&C(window.getComputedStyle(c).zIndex)},[c]);const P=m.useCallback(A=>{A&&v.current===!0&&(S(),_==null||_(),v.current=!1)},[S,_]);return m.createElement(Cte,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:g,onScrollButtonChange:P},m.createElement("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R}},m.createElement(Qe.div,he({},o,{ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}}))))}),$P=m.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Ki,...i}=e,s=n_(n);return m.createElement(Vf,he({},s,i,{ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.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)"}}))}),[Cte,r_]=au(Jc,{}),AP="SelectViewport",Ete=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ol(AP,n),i=r_(AP,n),s=_t(t,o.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(jm.Slot,{scope:n},m.createElement(Qe.div,he({"data-radix-select-viewport":"",role:"presentation"},r,{ref:s,style:{position:"relative",flex:1,overflow:"auto",...r.style},onScroll:Me(r.onScroll,l=>{const c=l.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:f}=i;if(f!=null&&f.current&&u){const h=Math.abs(a.current-c.scrollTop);if(h>0){const g=window.innerHeight-Ki*2,v=parseFloat(u.style.minHeight),b=parseFloat(u.style.height),x=Math.max(v,b);if(x<g){const w=x+h,_=Math.min(g,w),S=w-_;u.style.height=_+"px",u.style.bottom==="0px"&&(c.scrollTop=S>0?S:0,u.style.justifyContent="flex-end")}}}a.current=c.scrollTop})}))))}),Rte="SelectGroup",[Ote,Pte]=au(Rte),Tte=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Jo();return m.createElement(Ote,{scope:n,id:o},m.createElement(Qe.div,he({role:"group","aria-labelledby":o},r,{ref:t})))}),Dte="SelectLabel",$te=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Pte(Dte,n);return m.createElement(Qe.div,he({id:o.id},r,{ref:t}))}),Dx="SelectItem",[Ate,Hk]=au(Dx),kte=m.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=e,a=Rl(Dx,n),l=Ol(Dx,n),c=a.value===r,[u,f]=m.useState(i??""),[h,g]=m.useState(!1),v=_t(t,w=>{var _;return(_=l.itemRefCallback)===null||_===void 0?void 0:_.call(l,w,r,o)}),b=Jo(),x=()=>{o||(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(Ate,{scope:n,value:r,disabled:o,textId:b,isSelected:c,onItemTextChange:m.useCallback(w=>{f(_=>{var S;return _||((S=w==null?void 0:w.textContent)!==null&&S!==void 0?S:"").trim()})},[])},m.createElement(jm.ItemSlot,{scope:n,value:r,disabled:o,textValue:u},m.createElement(Qe.div,he({role:"option","aria-labelledby":b,"data-highlighted":h?"":void 0,"aria-selected":c&&h,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1},s,{ref:v,onFocus:Me(s.onFocus,()=>g(!0)),onBlur:Me(s.onBlur,()=>g(!1)),onPointerUp:Me(s.onPointerUp,x),onPointerMove:Me(s.onPointerMove,w=>{if(o){var _;(_=l.onItemLeave)===null||_===void 0||_.call(l)}else w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Me(s.onPointerLeave,w=>{if(w.currentTarget===document.activeElement){var _;(_=l.onItemLeave)===null||_===void 0||_.call(l)}}),onKeyDown:Me(s.onKeyDown,w=>{var _;((_=l.searchRef)===null||_===void 0?void 0:_.current)!==""&&w.key===" "||(cte.includes(w.key)&&x(),w.key===" "&&w.preventDefault())})}))))}),Rp="SelectItemText",Mte=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,s=Rl(Rp,n),a=Ol(Rp,n),l=Hk(Rp,n),c=hte(Rp,n),[u,f]=m.useState(null),h=_t(t,w=>f(w),l.onItemTextChange,w=>{var _;return(_=a.itemTextRefCallback)===null||_===void 0?void 0:_.call(a,w,l.value,l.disabled)}),g=u==null?void 0:u.textContent,v=m.useMemo(()=>m.createElement("option",{key:l.value,value:l.value,disabled:l.disabled},g),[l.disabled,l.value,g]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=c;return ur(()=>(b(v),()=>x(v)),[b,x,v]),m.createElement(m.Fragment,null,m.createElement(Qe.span,he({id:l.textId},i,{ref:h})),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?ko.createPortal(i.children,s.valueNode):null)}),Ite="SelectItemIndicator",Nte=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Hk(Ite,n).isSelected?m.createElement(Qe.span,he({"aria-hidden":!0},r,{ref:t})):null}),kP="SelectScrollUpButton",Lte=m.forwardRef((e,t)=>{const n=Ol(kP,e.__scopeSelect),r=r_(kP,e.__scopeSelect),[o,i]=m.useState(!1),s=_t(t,r.onScrollButtonChange);return ur(()=>{if(n.viewport&&n.isPositioned){let l=function(){const c=a.scrollTop>0;i(c)};const a=n.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?m.createElement(Wk,he({},e,{ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}})):null}),MP="SelectScrollDownButton",Fte=m.forwardRef((e,t)=>{const n=Ol(MP,e.__scopeSelect),r=r_(MP,e.__scopeSelect),[o,i]=m.useState(!1),s=_t(t,r.onScrollButtonChange);return ur(()=>{if(n.viewport&&n.isPositioned){let l=function(){const c=a.scrollHeight-a.clientHeight,u=Math.ceil(a.scrollTop)<c;i(u)};const a=n.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?m.createElement(Wk,he({},e,{ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}})):null}),Wk=m.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=Ol("SelectScrollButton",n),s=m.useRef(null),a=zm(n),l=m.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return m.useEffect(()=>()=>l(),[l]),ur(()=>{var c;const u=a().find(f=>f.ref.current===document.activeElement);u==null||(c=u.ref.current)===null||c===void 0||c.scrollIntoView({block:"nearest"})},[a]),m.createElement(Qe.div,he({"aria-hidden":!0},o,{ref:t,style:{flexShrink:0,...o.style},onPointerDown:Me(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Me(o.onPointerMove,()=>{var c;(c=i.onItemLeave)===null||c===void 0||c.call(i),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Me(o.onPointerLeave,()=>{l()})}))}),jte=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return m.createElement(Qe.div,he({"aria-hidden":!0},r,{ref:t}))});function Uk(e){return e===""||e===void 0}const qk=m.forwardRef((e,t)=>{const{value:n,...r}=e,o=m.useRef(null),i=_t(t,o),s=Im(n);return m.useEffect(()=>{const a=o.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==n&&u){const f=new Event("change",{bubbles:!0});u.call(a,n),a.dispatchEvent(f)}},[s,n]),m.createElement(JA,{asChild:!0},m.createElement("select",he({},r,{ref:i,defaultValue:n})))});qk.displayName="BubbleSelect";function Gk(e){const t=Ln(e),n=m.useRef(""),r=m.useRef(0),o=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]),i=m.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function Yk(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=zte(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function zte(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const Bte=pte,Kk=mte,Vte=bte,Hte=yte,Wte=xte,Xk=wte,Ute=Ete,qte=Tte,Qk=$te,Jk=kte,Gte=Mte,Yte=Nte,Zk=Lte,eM=Fte,tM=jte,zs=Bte,dc=qte,Bs=Vte,Qi=V.forwardRef(({className:e,children:t,...n},r)=>O.jsxs(Kk,{ref:r,className:Ee("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,O.jsx(Hte,{asChild:!0,children:O.jsx(Om,{className:"h-4 w-4 opacity-50"})})]}));Qi.displayName=Kk.displayName;const nM=V.forwardRef(({className:e,...t},n)=>O.jsx(Zk,{ref:n,className:Ee("flex cursor-default items-center justify-center py-1",e),...t,children:O.jsx(KX,{className:"h-4 w-4"})}));nM.displayName=Zk.displayName;const rM=V.forwardRef(({className:e,...t},n)=>O.jsx(eM,{ref:n,className:Ee("flex cursor-default items-center justify-center py-1",e),...t,children:O.jsx(Om,{className:"h-4 w-4"})}));rM.displayName=eM.displayName;const Ji=V.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>O.jsx(Wte,{children:O.jsxs(Xk,{ref:o,className:Ee("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:[O.jsx(nM,{}),O.jsx(Ute,{className:Ee("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),O.jsx(rM,{})]})}));Ji.displayName=Xk.displayName;const Va=V.forwardRef(({className:e,...t},n)=>O.jsx(Qk,{ref:n,className:Ee("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Va.displayName=Qk.displayName;const Hn=V.forwardRef(({className:e,children:t,...n},r)=>O.jsxs(Jk,{ref:r,className:Ee("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:[O.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:O.jsx(Yte,{children:O.jsx(Lf,{className:"h-4 w-4"})})}),O.jsx(Gte,{children:t})]}));Hn.displayName=Jk.displayName;const Ng=V.forwardRef(({className:e,...t},n)=>O.jsx(tM,{ref:n,className:Ee("-mx-1 my-1 h-px bg-muted",e),...t}));Ng.displayName=tM.displayName;function Kte(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Xte(...e){return t=>e.forEach(n=>Kte(n,t))}var Bm=V.forwardRef((e,t)=>{const{children:n,...r}=e,o=V.Children.toArray(n),i=o.find(Qte);if(i){const s=i.props.children,a=o.map(l=>l===i?V.Children.count(s)>1?V.Children.only(null):V.isValidElement(s)?s.props.children:null:l);return O.jsx($x,{...r,ref:t,children:V.isValidElement(s)?V.cloneElement(s,void 0,a):null})}return O.jsx($x,{...r,ref:t,children:n})});Bm.displayName="Slot";var $x=V.forwardRef((e,t)=>{const{children:n,...r}=e;if(V.isValidElement(n)){const o=Zte(n);return V.cloneElement(n,{...Jte(r,n.props),ref:t?Xte(t,o):o})}return V.Children.count(n)>1?V.Children.only(null):null});$x.displayName="SlotClone";var oM=({children:e})=>O.jsx(O.Fragment,{children:e});function Qte(e){return V.isValidElement(e)&&e.type===oM}function Jte(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Zte(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const IP=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,NP=cg,o_=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return NP(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(c=>{const u=n==null?void 0:n[c],f=i==null?void 0:i[c];if(u===null)return null;const h=IP(u)||IP(f);return o[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[f,h]=u;return h===void 0||(c[f]=h),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:f,className:h,...g}=u;return Object.entries(g).every(v=>{let[b,x]=v;return Array.isArray(x)?x.includes({...i,...a}[b]):{...i,...a}[b]===x})?[...c,f,h]:c},[]);return NP(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},Bd=o_("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"}}),yr=V.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?Bm:"button";return O.jsx(s,{className:Ee(Bd({variant:t,size:n,className:e})),ref:i,...o})});yr.displayName="Button";const ene=m.forwardRef((e,t)=>m.createElement(Qe.label,he({},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()}}))),iM=ene,tne=o_("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Wn=V.forwardRef(({className:e,...t},n)=>O.jsx(iM,{ref:n,className:Ee(tne(),e),...t}));Wn.displayName=iM.displayName;const sM=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(rne);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(Ax,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(Ax,he({},r,{ref:t}),n)});sM.displayName="Slot";const Ax=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...one(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});Ax.displayName="SlotClone";const nne=({children:e})=>m.createElement(m.Fragment,null,e);function rne(e){return m.isValidElement(e)&&e.type===nne}function one(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const aM="Popover",[lM,gye]=Zn(aM,[Ti]),i_=Ti(),[ine,lu]=lM(aM),sne=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=e,a=i_(t),l=m.useRef(null),[c,u]=m.useState(!1),[f=!1,h]=xr({prop:r,defaultProp:o,onChange:i});return m.createElement(zf,a,m.createElement(ine,{scope:t,contentId:Jo(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:m.useCallback(()=>h(g=>!g),[h]),hasCustomAnchor:c,onCustomAnchorAdd:m.useCallback(()=>u(!0),[]),onCustomAnchorRemove:m.useCallback(()=>u(!1),[]),modal:s},n))},ane="PopoverTrigger",lne=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=lu(ane,n),i=i_(n),s=_t(t,o.triggerRef),a=m.createElement(Qe.button,he({type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":dM(o.open)},r,{ref:s,onClick:Me(e.onClick,o.onOpenToggle)}));return o.hasCustomAnchor?a:m.createElement(Bf,he({asChild:!0},i),a)}),cM="PopoverPortal",[cne,une]=lM(cM,{forceMount:void 0}),dne=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,i=lu(cM,t);return m.createElement(cne,{scope:t,forceMount:n},m.createElement(er,{present:n||i.open},m.createElement(A1,{asChild:!0,container:o},r)))},Vd="PopoverContent",fne=m.forwardRef((e,t)=>{const n=une(Vd,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,i=lu(Vd,e.__scopePopover);return m.createElement(er,{present:r||i.open},i.modal?m.createElement(hne,he({},o,{ref:t})):m.createElement(pne,he({},o,{ref:t})))}),hne=m.forwardRef((e,t)=>{const n=lu(Vd,e.__scopePopover),r=m.useRef(null),o=_t(t,r),i=m.useRef(!1);return m.useEffect(()=>{const s=r.current;if(s)return Nm(s)},[]),m.createElement(t_,{as:sM,allowPinchZoom:!0},m.createElement(uM,he({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Me(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),i.current||(a=n.triggerRef.current)===null||a===void 0||a.focus()}),onPointerDownOutside:Me(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Me(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})))}),pne=m.forwardRef((e,t)=>{const n=lu(Vd,e.__scopePopover),r=m.useRef(!1),o=m.useRef(!1);return m.createElement(uM,he({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s;if((s=e.onCloseAutoFocus)===null||s===void 0||s.call(e,i),!i.defaultPrevented){var a;r.current||(a=n.triggerRef.current)===null||a===void 0||a.focus(),i.preventDefault()}r.current=!1,o.current=!1},onInteractOutside:i=>{var s,a;(s=e.onInteractOutside)===null||s===void 0||s.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=i.target;((a=n.triggerRef.current)===null||a===void 0?void 0:a.contains(l))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}}))}),uM=m.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=e,h=lu(Vd,n),g=i_(n);return Q1(),m.createElement(J1,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i},m.createElement(Ff,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1)},m.createElement(Vf,he({"data-state":dM(h.open),role:"dialog",id:h.contentId},g,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 dM(e){return e?"open":"closed"}const gne=sne,mne=lne,vne=dne,fM=fne,Vm=gne,Hm=mne,Hf=V.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>O.jsx(vne,{children:O.jsx(fM,{ref:o,align:t,sideOffset:n,className:Ee("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})}));Hf.displayName=fM.displayName;function bne(e,t){switch(t){case"full-date-time":return{locale:e,format:"full-date-time",options:{weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0}};case"short-date-time":return{locale:e,format:"short-date-time",options:{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!0}};case"hours-date-time":return{locale:e,format:"hours-date-time",options:{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}};case"short-date":return{format:"short-date",locale:e,options:{}};case"long-date":return{format:"long-date",locale:e,options:{year:"numeric",month:"long",day:"numeric"}};default:return{format:"short-date-time",locale:e,options:{}}}}const xc=V.forwardRef(({className:e,type:t,...n},r)=>O.jsx("input",{type:t,className:Ee("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}));xc.displayName="Input";function hM({colorRanges:e,setColorRanges:t}){const n={start:-1/0,end:100,color:""};function r(s,a,l){const c=[...e];c[s]={...c[s],[a]:l},t(c)}function o(s){const a=[...e];a.splice(s,1),t(a)}function i(){t([...e,n])}return O.jsxs("div",{className:"space-y-3",children:[O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx(Wn,{children:"Color Range"}),O.jsx(yr,{onClick:i,variant:"secondary",className:"h-5 p-1 text-muted-foreground",children:O.jsx(C1,{className:"size-3"})})]}),e.map((s,a)=>O.jsxs("div",{className:"flex items-center gap-2 px-2",children:[O.jsx(xc,{onChange:l=>r(a,"start",l.target.value),value:s.start,className:Ee(`h-7 ${Yp}`)}),O.jsx("span",{children:"-"}),O.jsx(xc,{value:s.end,onChange:l=>r(a,"end",l.target.value),className:Ee(`h-7 ${Yp}`)}),O.jsx(xc,{onChange:l=>r(a,"color",l.target.value),value:s.color,className:Ee(`h-7 min-w-14 p-0 ${Yp}`),type:"color",list:"presetColors"}),O.jsxs("datalist",{id:"presetColors",children:[O.jsx("option",{children:Bt.green[600]}),O.jsx("option",{children:Bt.red[500]}),O.jsx("option",{children:Bt.yellow[400]}),O.jsx("option",{children:Bt.orange[500]})]}),O.jsx(yr,{onClick:()=>o(a),variant:"secondary",className:"h-5 p-1 text-muted-foreground",children:O.jsx(Pm,{className:"size-3"})})]},a))]})}const yne=m.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r=!1,onPressedChange:o,...i}=e,[s=!1,a]=xr({prop:n,onChange:o,defaultProp:r});return m.createElement(Qe.button,he({type:"button","aria-pressed":s,"data-state":s?"on":"off","data-disabled":e.disabled?"":void 0},i,{ref:t,onClick:Me(e.onClick,()=>{e.disabled||a(!s)})}))}),pM=yne,xne=o_("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground 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=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),s_=V.forwardRef(({className:e,variant:t,size:n,...r},o)=>O.jsx(pM,{ref:o,className:Ee(xne({variant:t,size:n,className:e})),...r}));s_.displayName=pM.displayName;function wne(e,t){var r;const n=(r=e==null?void 0:e.columnSettings)==null?void 0:r.find(o=>o.columnIdx===t);return n==null?void 0:n.type}function _ne(e,t){var r,o;const n=(r=e==null?void 0:e.columnSettings)==null?void 0:r.find(i=>i.columnIdx===t);return((o=n==null?void 0:n.options)==null?void 0:o.locale)||"en-US"}function Sne(e,t){var r,o;const n=(r=e==null?void 0:e.columnSettings)==null?void 0:r.find(i=>i.columnIdx===t&&i.type==="date");return((o=n==null?void 0:n.options)==null?void 0:o.format)||"short-date-time"}function Cne(e,t){var r,o;const n=(r=e==null?void 0:e.columnSettings)==null?void 0:r.find(i=>i.columnIdx===t);return(o=n==null?void 0:n.options)==null?void 0:o.currency}function Ene(e,t){var r,o,i;const n=(r=e==null?void 0:e.columnSettings)==null?void 0:r.find(s=>s.columnIdx===t);return((i=(o=n==null?void 0:n.options)==null?void 0:o.options)==null?void 0:i.minimumFractionDigits)||0}function Rne(e,t){var r,o;const n=(r=e==null?void 0:e.columnSettings)==null?void 0:r.find(i=>i.columnIdx===t);return((o=n==null?void 0:n.options)==null?void 0:o.colorRanges)||[]}function One(e,t){var r,o,i;const n=(r=e==null?void 0:e.columnSettings)==null?void 0:r.find(s=>s.columnIdx===t);return((i=(o=n==null?void 0:n.options)==null?void 0:o.options)==null?void 0:i.style)==="percent"}function Pne({columnIndex:e,columnName:t}){const[n,r]=m.useState(!1),o=Ar(D=>{var I;return(I=D.card)==null?void 0:I.preferences}),[i,s]=m.useState(wne(o,e)),[a,l]=m.useState(Rne(o,e)),[c,u]=m.useState(_ne(o,e)),[f,h]=m.useState(Sne(o,e)),[g,v]=m.useState(Cne(o,e)),[b,x]=m.useState(Ene(o,e).toString()),[w,_]=m.useState(One(o,e));m.useState("");const S=Ar(D=>D.actions.setCardPreferences);function R(){const D=[...new Set(y0.map(I=>I.currency))];return O.jsx(O.Fragment,{children:O.jsxs("div",{className:"grid grid-cols-9 items-center gap-2",children:[O.jsx(Wn,{className:"col-span-3",htmlFor:"format",children:"Locale"}),O.jsxs(zs,{value:c,onValueChange:I=>u(I),children:[O.jsx(Qi,{className:"col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0",children:O.jsx(Bs,{})}),O.jsx(Ji,{children:O.jsxs(dc,{children:[O.jsx(Va,{children:"Locale"}),y0.map(I=>O.jsx(Hn,{value:I.locale,children:I.locale},I.locale))]})})]}),O.jsx(Wn,{className:"col-span-3",htmlFor:"format",children:"Currency"}),O.jsxs(zs,{value:g||"none",onValueChange:I=>v(I==="none"?void 0:I),children:[O.jsx(Qi,{className:"col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0",children:O.jsx(Bs,{})}),O.jsx(Ji,{children:O.jsxs(dc,{children:[O.jsx(Va,{children:"Currency"}),O.jsx(Hn,{value:"none",children:"None"}),D.map(I=>O.jsx(Hn,{value:I,children:I},I))]})})]}),O.jsx(Wn,{className:"col-span-3",htmlFor:"format",children:"Decimals"}),O.jsxs(zs,{value:b,onValueChange:I=>x(I),children:[O.jsx(Qi,{className:"col-span-3 h-8 w-full focus:ring-1 focus:ring-offset-0",children:O.jsx(Bs,{})}),O.jsx(Ji,{children:["0","1","2","3","4"].map(I=>O.jsx(Hn,{value:I,children:I},I))})]}),!g&&O.jsx(s_,{onPressedChange:I=>_(I),variant:"outline",size:"sm",className:"col-span-3 h-8","aria-label":"Toggle italic",children:O.jsx(ZX,{className:"size-3"})})]})})}function C(){return O.jsx(O.Fragment,{children:O.jsxs("div",{className:"grid grid-cols-9 items-center gap-2",children:[O.jsx(Wn,{className:"col-span-3",htmlFor:"format",children:"Locale"}),O.jsxs(zs,{defaultValue:"en-US",value:c,onValueChange:D=>u(D),children:[O.jsx(Qi,{className:"col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0",children:O.jsx(Bs,{})}),O.jsx(Ji,{children:Pz.map(D=>O.jsxs(dc,{children:[O.jsx(Va,{children:D.label}),D.locales.map(I=>O.jsx(Hn,{value:I.code,children:I.name},I.code))]},D.label))})]}),O.jsx(Wn,{className:"col-span-3",htmlFor:"format",children:"Format"}),O.jsxs(zs,{defaultValue:"short-date-time",value:f,onValueChange:D=>{console.log("format",D),h(D)},children:[O.jsx(Qi,{className:"col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0",children:O.jsx(Bs,{})}),O.jsx(Ji,{className:"",id:"type",children:O.jsxs(dc,{children:[O.jsx(Va,{children:"Option"}),O.jsx(Hn,{value:"full-date-time",children:"Full Date-Time"}),O.jsx(Hn,{value:"short-date-time",children:"Short Date-Time"}),O.jsx(Hn,{value:"hours-date-time",children:"24-Hour Date-Time"}),O.jsx(Hn,{value:"short-date",children:"Short Date"}),O.jsx(Hn,{value:"long-date",children:"Long Date"})]})})]})]})})}function P(){S({...o,columnSettings:[]})}function A(){var D;S({...o,columnSettings:[...((D=o==null?void 0:o.columnSettings)==null?void 0:D.filter(I=>I.columnIdx!==e))||[]]})}function k(){var D,I,F;if(i==="date"){const B=bne(c,f),K={columnIdx:e,type:i,options:B};S({...o,columnSettings:[...((D=o==null?void 0:o.columnSettings)==null?void 0:D.filter(Z=>Z.columnIdx!==e))||[],K]})}else if(i==="number"){let B;g?B={locale:c,currency:g,options:{style:"currency",currency:g,minimumFractionDigits:Number(b)},colorRanges:a.length>0?a:void 0}:B={locale:c,currency:void 0,options:{style:w?"percent":"decimal",minimumFractionDigits:Number(b)},colorRanges:a.length>0?a:void 0};const K={columnIdx:e,type:i,options:B};S({...o,columnSettings:[...((I=o==null?void 0:o.columnSettings)==null?void 0:I.filter(Z=>Z.columnIdx!==e))||[],K]})}else S({...o,columnSettings:[...((F=o==null?void 0:o.columnSettings)==null?void 0:F.filter(B=>B.columnIdx!==e))||[]]})}return O.jsxs(Vm,{onOpenChange:D=>r(D),children:[O.jsx(Hm,{asChild:!0,children:O.jsx(E1,{className:"size-3.5 cursor-pointer text-muted"})}),O.jsx(Hf,{align:"center",className:"max-w-70",children:O.jsxs("div",{className:"grid gap-4",children:[O.jsxs("div",{className:"space-y-2",children:[O.jsx("h4",{className:"font-medium leading-none",children:"Display Settings"}),O.jsx("p",{className:"text-sm text-muted-foreground",children:`Display setting for '${t}'`})]}),O.jsxs("div",{className:"grid gap-2",children:[O.jsxs("div",{className:"grid grid-cols-3 items-center gap-2",children:[O.jsx(Wn,{htmlFor:"scale",children:"Type"}),O.jsxs(zs,{value:i||"none",onValueChange:D=>s(D),children:[O.jsx(Qi,{className:"col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0",children:O.jsx(Bs,{})}),O.jsx(Ji,{id:"type",children:O.jsxs(dc,{children:[O.jsx(Va,{children:"Option"}),O.jsx(Hn,{value:"number",children:"Number"}),O.jsx(Hn,{value:"date",children:"Date"}),O.jsx(Hn,{value:"none",children:"None"})]})})]})]}),i==="number"&&R(),i==="date"&&C(),i==="number"&&O.jsxs(O.Fragment,{children:[O.jsx(Ng,{}),O.jsx(hM,{colorRanges:a,setColorRanges:l})]}),O.jsx(Ng,{}),O.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[O.jsx(yr,{onClick:P,variant:"secondary",className:"col-span-1 col-start-1 h-8 w-full text-destructive",children:"Reset All"}),O.jsx(yr,{onClick:A,variant:"secondary",className:"col-span-1 col-start-2 h-8 w-full",children:"Reset"}),O.jsx(yr,{onClick:k,variant:"secondary",className:"col-span-1 col-start-3 h-8 w-full",children:"Apply"})]})]})]})})]})}function Tne(e){const t=new Date(e);return!isNaN(t.getTime())}function gM({data:e,card:t}){var R,C,P,A;const[n,r]=m.useState([]),{keys:o}=ar(e),i=ke(k=>k.filteringCards),s=ke(k=>k.themeStyle),a=ke(k=>k.isVisualEditing),l=i==null?void 0:i.find(k=>k.id===t.id),c=(R=t==null?void 0:t.preferences)==null?void 0:R.onClickFilter,{addOrUpdateFilterValues:u,addFilteringCard:f,removeFilterValue:h,removeFilteringCard:g}=Mo(),v=t==null?void 0:t.preferences;function b(k,D){if((D==null?void 0:D.type)==="date"&&Tne(k)){const{locale:I,options:F}=D.options,B=new Date(k);return new Date(B.getTime()).toLocaleDateString(I,F)}if((D==null?void 0:D.type)==="number"){const{locale:I,currency:F,options:B}=D.options;return F?new Intl.NumberFormat(I,{style:"currency",currency:F,...B}).format(k):new Intl.NumberFormat(I,B).format(k)}return k}const x=o.map((k,D)=>({accessorKey:k,header:({column:I})=>{const F=I.getIsSorted();return O.jsxs("div",{className:"flex items-center justify-between gap-2",children:[O.jsxs("div",{className:"flex cursor-pointer items-center",onClick:()=>I.toggleSorting(I.getIsSorted()==="asc"),children:[k,F==="asc"?O.jsx(w1,{className:"ml-2 h-5 w-5"}):F==="desc"?O.jsx(x1,{className:"ml-2 h-5 w-5"}):null]}),a&&O.jsx(Pne,{columnName:I.id,columnIndex:D})]})},cell:({cell:I})=>{var z,Q;const F=I.getValue(),B=(z=v==null?void 0:v.columnSettings)==null?void 0:z.find(W=>W.columnIdx===D),K=b(F,B),Z=ok(F,(Q=B==null?void 0:B.options)==null?void 0:Q.colorRanges);return O.jsx("div",{className:"px-2 py-1",style:{backgroundColor:Z},children:K})}})),w=Ok({data:e,columns:x,getCoreRowModel:Ck(),getPaginationRowModel:Rk(),onSortingChange:r,getSortedRowModel:Ek(),manualPagination:!0,state:{sorting:n}}),_=w.getSelectedRowModel().rows;m.useEffect(()=>{if(_.length===0){if(l){const k=t.id;h(k),g(t)}return}if(c){const{dimensionKeys:k}=ar(e),D=c.map(I=>{const F=k==null?void 0:k[I.columnIndex],B=_.map(Z=>Z.getValue(F));return{filterId:t.id+"-"+F,connectionId:t==null?void 0:t.connectionId,tableName:t.lastSelectedTable,name:F,expression:I.expression,valueType:Pd(B[0]===void 0?"":B[0]),operation:"in",values:B}});u(D),f(t)}},[f,u,t,e,l,c,h,g,_]);function S(k){k.toggleSelected()}return O.jsxs(W1,{className:"",containerClassName:"rounded-md",containerStyle:{borderTopRightRadius:(C=s==null?void 0:s.chart)==null?void 0:C.options.borderRadius,borderTopLeftRadius:(P=s==null?void 0:s.chart)==null?void 0:P.options.borderRadius},onMouseDown:k=>k.stopPropagation(),children:[O.jsx(U1,{children:w.getHeaderGroups().map(k=>O.jsx(bd,{children:k.headers.map((D,I)=>{var F,B,K,Z,z,Q,W;return O.jsx(G1,{style:{backgroundColor:(K=(B=(F=s==null?void 0:s.chart)==null?void 0:F.dataset)==null?void 0:B.backgroundColor)==null?void 0:K[0],color:Bc((Q=(z=(Z=s==null?void 0:s.chart)==null?void 0:Z.dataset)==null?void 0:z.backgroundColor)==null?void 0:Q[0])},className:Ee("sticky -top-[1px] z-50 h-9 bg-muted-foreground px-2 text-background",{"border-x":I>0&&I<k.headers.length-1,"border-l":I===1&&k.headers.length==2},(W=s==null?void 0:s.table)==null?void 0:W.tableHeaderColor),children:D.isPlaceholder?null:Rx(D.column.columnDef.header,D.getContext())},D.id)})},k.id))}),O.jsx(q1,{children:(A=w.getRowModel().rows)!=null&&A.length?w.getRowModel().rows.map((k,D)=>O.jsx(bd,{onClick:()=>S(k),className:Ee("whitespace-nowrap p-1",{"cursor-pointer data-[state=selected]:border-2 data-[state=selected]:border-dashed":c&&(c==null?void 0:c.length)>0}),"data-state":k.getIsSelected()&&"selected",children:k.getVisibleCells().map((I,F)=>{var B;return O.jsx(Mg,{onClick:K=>{var z;const Z=((z=window==null?void 0:window.getSelection())==null?void 0:z.toString())||"";(Z==null?void 0:Z.length)>0&&K.stopPropagation()},className:Ee("p-0",{"border-x":F>0&&F<x.length-1||F===1&&x.length==2,"border-l":F==0,"border-r":F===x.length-1,"border-b":D===((B=w.getRowModel().rows)==null?void 0:B.length)-1}),children:Rx(I.column.columnDef.cell,I.getContext())},I.id)})},k.id)):O.jsx(bd,{children:O.jsx(Mg,{colSpan:x.length,className:"p-1 text-center",children:"No results."})})})]})}/*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */const{entries:mM,setPrototypeOf:LP,isFrozen:Dne,getPrototypeOf:$ne,getOwnPropertyDescriptor:Ane}=Object;let{freeze:wr,seal:Ao,create:vM}=Object,{apply:kx,construct:Mx}=typeof Reflect<"u"&&Reflect;wr||(wr=function(t){return t});Ao||(Ao=function(t){return t});kx||(kx=function(t,n,r){return t.apply(n,r)});Mx||(Mx=function(t,n){return new t(...n)});const Op=uo(Array.prototype.forEach),FP=uo(Array.prototype.pop),Vu=uo(Array.prototype.push),ig=uo(String.prototype.toLowerCase),vy=uo(String.prototype.toString),jP=uo(String.prototype.match),Hu=uo(String.prototype.replace),kne=uo(String.prototype.indexOf),Mne=uo(String.prototype.trim),Uo=uo(Object.prototype.hasOwnProperty),gr=uo(RegExp.prototype.test),Wu=Ine(TypeError);function uo(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return kx(e,t,r)}}function Ine(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Mx(e,n)}}function Tt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ig;LP&&LP(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(Dne(t)||(t[r]=i),o=i)}e[o]=!0}return e}function Nne(e){for(let t=0;t<e.length;t++)Uo(e,t)||(e[t]=null);return e}function za(e){const t=vM(null);for(const[n,r]of mM(e))Uo(e,n)&&(Array.isArray(r)?t[n]=Nne(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=za(r):t[n]=r);return t}function Uu(e,t){for(;e!==null;){const r=Ane(e,t);if(r){if(r.get)return uo(r.get);if(typeof r.value=="function")return uo(r.value)}e=$ne(e)}function n(){return null}return n}const zP=wr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),by=wr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),yy=wr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Lne=wr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),xy=wr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Fne=wr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),BP=wr(["#text"]),VP=wr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),wy=wr(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),HP=wr(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Pp=wr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),jne=Ao(/\{\{[\w\W]*|[\w\W]*\}\}/gm),zne=Ao(/<%[\w\W]*|[\w\W]*%>/gm),Bne=Ao(/\${[\w\W]*}/gm),Vne=Ao(/^data-[\-\w.\u00B7-\uFFFF]/),Hne=Ao(/^aria-[\-\w]+$/),bM=Ao(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Wne=Ao(/^(?:\w+script|data):/i),Une=Ao(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),yM=Ao(/^html$/i),qne=Ao(/^[a-z][.\w]*(-[.\w]+)+$/i);var WP=Object.freeze({__proto__:null,MUSTACHE_EXPR:jne,ERB_EXPR:zne,TMPLIT_EXPR:Bne,DATA_ATTR:Vne,ARIA_ATTR:Hne,IS_ALLOWED_URI:bM,IS_SCRIPT_OR_DATA:Wne,ATTR_WHITESPACE:Une,DOCTYPE_NAME:yM,CUSTOM_ELEMENT:qne});const qu={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Gne=function(){return typeof window>"u"?null:window},Yne=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}};function xM(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Gne();const t=$e=>xM($e);if(t.version="3.1.6",t.removed=[],!e||!e.document||e.document.nodeType!==qu.document)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:s,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:h,trustedTypes:g}=e,v=l.prototype,b=Uu(v,"cloneNode"),x=Uu(v,"remove"),w=Uu(v,"nextSibling"),_=Uu(v,"childNodes"),S=Uu(v,"parentNode");if(typeof s=="function"){const $e=n.createElement("template");$e.content&&$e.content.ownerDocument&&(n=$e.content.ownerDocument)}let R,C="";const{implementation:P,createNodeIterator:A,createDocumentFragment:k,getElementsByTagName:D}=n,{importNode:I}=r;let F={};t.isSupported=typeof mM=="function"&&typeof S=="function"&&P&&P.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:B,ERB_EXPR:K,TMPLIT_EXPR:Z,DATA_ATTR:z,ARIA_ATTR:Q,IS_SCRIPT_OR_DATA:W,ATTR_WHITESPACE:Y,CUSTOM_ELEMENT:oe}=WP;let{IS_ALLOWED_URI:$}=WP,H=null;const J=Tt({},[...zP,...by,...yy,...xy,...BP]);let N=null;const ce=Tt({},[...VP,...wy,...HP,...Pp]);let le=Object.seal(vM(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),de=null,pe=null,ie=!0,te=!0,ae=!1,ye=!0,G=!1,be=!0,_e=!1,Pe=!1,Te=!1,Ue=!1,Be=!1,Ie=!1,Ke=!0,lt=!1;const It="user-content-";let $t=!0,Ht=!1,fe={},Ce=null;const Le=Tt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ge=null;const Ze=Tt({},["audio","video","img","source","image","track"]);let Wt=null;const Zt=Tt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Kt="http://www.w3.org/1998/Math/MathML",vn="http://www.w3.org/2000/svg",ln="http://www.w3.org/1999/xhtml";let Lt=ln,tn=!1,xn=null;const nt=Tt({},[Kt,vn,ln],vy);let ht=null;const At=["application/xhtml+xml","text/html"],Xt="text/html";let bt=null,Rn=null;const Lo=n.createElement("form"),ms=function(q){return q instanceof RegExp||q instanceof Function},Fo=function(){let q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Rn&&Rn===q)){if((!q||typeof q!="object")&&(q={}),q=za(q),ht=At.indexOf(q.PARSER_MEDIA_TYPE)===-1?Xt:q.PARSER_MEDIA_TYPE,bt=ht==="application/xhtml+xml"?vy:ig,H=Uo(q,"ALLOWED_TAGS")?Tt({},q.ALLOWED_TAGS,bt):J,N=Uo(q,"ALLOWED_ATTR")?Tt({},q.ALLOWED_ATTR,bt):ce,xn=Uo(q,"ALLOWED_NAMESPACES")?Tt({},q.ALLOWED_NAMESPACES,vy):nt,Wt=Uo(q,"ADD_URI_SAFE_ATTR")?Tt(za(Zt),q.ADD_URI_SAFE_ATTR,bt):Zt,Ge=Uo(q,"ADD_DATA_URI_TAGS")?Tt(za(Ze),q.ADD_DATA_URI_TAGS,bt):Ze,Ce=Uo(q,"FORBID_CONTENTS")?Tt({},q.FORBID_CONTENTS,bt):Le,de=Uo(q,"FORBID_TAGS")?Tt({},q.FORBID_TAGS,bt):{},pe=Uo(q,"FORBID_ATTR")?Tt({},q.FORBID_ATTR,bt):{},fe=Uo(q,"USE_PROFILES")?q.USE_PROFILES:!1,ie=q.ALLOW_ARIA_ATTR!==!1,te=q.ALLOW_DATA_ATTR!==!1,ae=q.ALLOW_UNKNOWN_PROTOCOLS||!1,ye=q.ALLOW_SELF_CLOSE_IN_ATTR!==!1,G=q.SAFE_FOR_TEMPLATES||!1,be=q.SAFE_FOR_XML!==!1,_e=q.WHOLE_DOCUMENT||!1,Ue=q.RETURN_DOM||!1,Be=q.RETURN_DOM_FRAGMENT||!1,Ie=q.RETURN_TRUSTED_TYPE||!1,Te=q.FORCE_BODY||!1,Ke=q.SANITIZE_DOM!==!1,lt=q.SANITIZE_NAMED_PROPS||!1,$t=q.KEEP_CONTENT!==!1,Ht=q.IN_PLACE||!1,$=q.ALLOWED_URI_REGEXP||bM,Lt=q.NAMESPACE||ln,le=q.CUSTOM_ELEMENT_HANDLING||{},q.CUSTOM_ELEMENT_HANDLING&&ms(q.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(le.tagNameCheck=q.CUSTOM_ELEMENT_HANDLING.tagNameCheck),q.CUSTOM_ELEMENT_HANDLING&&ms(q.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(le.attributeNameCheck=q.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),q.CUSTOM_ELEMENT_HANDLING&&typeof q.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(le.allowCustomizedBuiltInElements=q.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),G&&(te=!1),Be&&(Ue=!0),fe&&(H=Tt({},BP),N=[],fe.html===!0&&(Tt(H,zP),Tt(N,VP)),fe.svg===!0&&(Tt(H,by),Tt(N,wy),Tt(N,Pp)),fe.svgFilters===!0&&(Tt(H,yy),Tt(N,wy),Tt(N,Pp)),fe.mathMl===!0&&(Tt(H,xy),Tt(N,HP),Tt(N,Pp))),q.ADD_TAGS&&(H===J&&(H=za(H)),Tt(H,q.ADD_TAGS,bt)),q.ADD_ATTR&&(N===ce&&(N=za(N)),Tt(N,q.ADD_ATTR,bt)),q.ADD_URI_SAFE_ATTR&&Tt(Wt,q.ADD_URI_SAFE_ATTR,bt),q.FORBID_CONTENTS&&(Ce===Le&&(Ce=za(Ce)),Tt(Ce,q.FORBID_CONTENTS,bt)),$t&&(H["#text"]=!0),_e&&Tt(H,["html","head","body"]),H.table&&(Tt(H,["tbody"]),delete de.tbody),q.TRUSTED_TYPES_POLICY){if(typeof q.TRUSTED_TYPES_POLICY.createHTML!="function")throw Wu('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof q.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Wu('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');R=q.TRUSTED_TYPES_POLICY,C=R.createHTML("")}else R===void 0&&(R=Yne(g,o)),R!==null&&typeof C=="string"&&(C=R.createHTML(""));wr&&wr(q),Rn=q}},$i=Tt({},["mi","mo","mn","ms","mtext"]),ni=Tt({},["foreignobject","annotation-xml"]),Ai=Tt({},["title","style","font","a","script"]),vs=Tt({},[...by,...yy,...Lne]),ri=Tt({},[...xy,...Fne]),ki=function(q){let me=S(q);(!me||!me.tagName)&&(me={namespaceURI:Lt,tagName:"template"});const Ae=ig(q.tagName),st=ig(me.tagName);return xn[q.namespaceURI]?q.namespaceURI===vn?me.namespaceURI===ln?Ae==="svg":me.namespaceURI===Kt?Ae==="svg"&&(st==="annotation-xml"||$i[st]):!!vs[Ae]:q.namespaceURI===Kt?me.namespaceURI===ln?Ae==="math":me.namespaceURI===vn?Ae==="math"&&ni[st]:!!ri[Ae]:q.namespaceURI===ln?me.namespaceURI===vn&&!ni[st]||me.namespaceURI===Kt&&!$i[st]?!1:!ri[Ae]&&(Ai[Ae]||!vs[Ae]):!!(ht==="application/xhtml+xml"&&xn[q.namespaceURI]):!1},jn=function(q){Vu(t.removed,{element:q});try{S(q).removeChild(q)}catch{x(q)}},oi=function(q,me){try{Vu(t.removed,{attribute:me.getAttributeNode(q),from:me})}catch{Vu(t.removed,{attribute:null,from:me})}if(me.removeAttribute(q),q==="is"&&!N[q])if(Ue||Be)try{jn(me)}catch{}else try{me.setAttribute(q,"")}catch{}},bs=function(q){let me=null,Ae=null;if(Te)q="<remove></remove>"+q;else{const ft=jP(q,/^[\r\n\t ]+/);Ae=ft&&ft[0]}ht==="application/xhtml+xml"&&Lt===ln&&(q='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+q+"</body></html>");const st=R?R.createHTML(q):q;if(Lt===ln)try{me=new h().parseFromString(st,ht)}catch{}if(!me||!me.documentElement){me=P.createDocument(Lt,"template",null);try{me.documentElement.innerHTML=tn?C:st}catch{}}const bn=me.body||me.documentElement;return q&&Ae&&bn.insertBefore(n.createTextNode(Ae),bn.childNodes[0]||null),Lt===ln?D.call(me,_e?"html":"body")[0]:_e?me.documentElement:bn},ys=function(q){return A.call(q.ownerDocument||q,q,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},T=function(q){return q instanceof f&&(typeof q.nodeName!="string"||typeof q.textContent!="string"||typeof q.removeChild!="function"||!(q.attributes instanceof u)||typeof q.removeAttribute!="function"||typeof q.setAttribute!="function"||typeof q.namespaceURI!="string"||typeof q.insertBefore!="function"||typeof q.hasChildNodes!="function")},ee=function(q){return typeof a=="function"&&q instanceof a},ue=function(q,me,Ae){F[q]&&Op(F[q],st=>{st.call(t,me,Ae,Rn)})},Oe=function(q){let me=null;if(ue("beforeSanitizeElements",q,null),T(q))return jn(q),!0;const Ae=bt(q.nodeName);if(ue("uponSanitizeElement",q,{tagName:Ae,allowedTags:H}),q.hasChildNodes()&&!ee(q.firstElementChild)&&gr(/<[/\w]/g,q.innerHTML)&&gr(/<[/\w]/g,q.textContent)||q.nodeType===qu.progressingInstruction||be&&q.nodeType===qu.comment&&gr(/<[/\w]/g,q.data))return jn(q),!0;if(!H[Ae]||de[Ae]){if(!de[Ae]&&qe(Ae)&&(le.tagNameCheck instanceof RegExp&&gr(le.tagNameCheck,Ae)||le.tagNameCheck instanceof Function&&le.tagNameCheck(Ae)))return!1;if($t&&!Ce[Ae]){const st=S(q)||q.parentNode,bn=_(q)||q.childNodes;if(bn&&st){const ft=bn.length;for(let tr=ft-1;tr>=0;--tr){const po=b(bn[tr],!0);po.__removalCount=(q.__removalCount||0)+1,st.insertBefore(po,w(q))}}}return jn(q),!0}return q instanceof l&&!ki(q)||(Ae==="noscript"||Ae==="noembed"||Ae==="noframes")&&gr(/<\/no(script|embed|frames)/i,q.innerHTML)?(jn(q),!0):(G&&q.nodeType===qu.text&&(me=q.textContent,Op([B,K,Z],st=>{me=Hu(me,st," ")}),q.textContent!==me&&(Vu(t.removed,{element:q.cloneNode()}),q.textContent=me)),ue("afterSanitizeElements",q,null),!1)},He=function(q,me,Ae){if(Ke&&(me==="id"||me==="name")&&(Ae in n||Ae in Lo))return!1;if(!(te&&!pe[me]&&gr(z,me))){if(!(ie&&gr(Q,me))){if(!N[me]||pe[me]){if(!(qe(q)&&(le.tagNameCheck instanceof RegExp&&gr(le.tagNameCheck,q)||le.tagNameCheck instanceof Function&&le.tagNameCheck(q))&&(le.attributeNameCheck instanceof RegExp&&gr(le.attributeNameCheck,me)||le.attributeNameCheck instanceof Function&&le.attributeNameCheck(me))||me==="is"&&le.allowCustomizedBuiltInElements&&(le.tagNameCheck instanceof RegExp&&gr(le.tagNameCheck,Ae)||le.tagNameCheck instanceof Function&&le.tagNameCheck(Ae))))return!1}else if(!Wt[me]){if(!gr($,Hu(Ae,Y,""))){if(!((me==="src"||me==="xlink:href"||me==="href")&&q!=="script"&&kne(Ae,"data:")===0&&Ge[q])){if(!(ae&&!gr(W,Hu(Ae,Y,"")))){if(Ae)return!1}}}}}}return!0},qe=function(q){return q!=="annotation-xml"&&jP(q,oe)},ze=function(q){ue("beforeSanitizeAttributes",q,null);const{attributes:me}=q;if(!me)return;const Ae={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:N};let st=me.length;for(;st--;){const bn=me[st],{name:ft,namespaceURI:tr,value:po}=bn,ya=bt(ft);let zn=ft==="value"?po:Mne(po);if(Ae.attrName=ya,Ae.attrValue=zn,Ae.keepAttr=!0,Ae.forceKeepAttr=void 0,ue("uponSanitizeAttribute",q,Ae),zn=Ae.attrValue,be&&gr(/((--!?|])>)|<\/(style|title)/i,zn)){oi(ft,q);continue}if(Ae.forceKeepAttr||(oi(ft,q),!Ae.keepAttr))continue;if(!ye&&gr(/\/>/i,zn)){oi(ft,q);continue}G&&Op([B,K,Z],hu=>{zn=Hu(zn,hu," ")});const fu=bt(q.nodeName);if(He(fu,ya,zn)){if(lt&&(ya==="id"||ya==="name")&&(oi(ft,q),zn=It+zn),R&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!tr)switch(g.getAttributeType(fu,ya)){case"TrustedHTML":{zn=R.createHTML(zn);break}case"TrustedScriptURL":{zn=R.createScriptURL(zn);break}}try{tr?q.setAttributeNS(tr,ft,zn):q.setAttribute(ft,zn),T(q)?jn(q):FP(t.removed)}catch{}}}ue("afterSanitizeAttributes",q,null)},Fe=function $e(q){let me=null;const Ae=ys(q);for(ue("beforeSanitizeShadowDOM",q,null);me=Ae.nextNode();)ue("uponSanitizeShadowNode",me,null),!Oe(me)&&(me.content instanceof i&&$e(me.content),ze(me));ue("afterSanitizeShadowDOM",q,null)};return t.sanitize=function($e){let q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},me=null,Ae=null,st=null,bn=null;if(tn=!$e,tn&&($e="<!-->"),typeof $e!="string"&&!ee($e))if(typeof $e.toString=="function"){if($e=$e.toString(),typeof $e!="string")throw Wu("dirty is not a string, aborting")}else throw Wu("toString is not a function");if(!t.isSupported)return $e;if(Pe||Fo(q),t.removed=[],typeof $e=="string"&&(Ht=!1),Ht){if($e.nodeName){const po=bt($e.nodeName);if(!H[po]||de[po])throw Wu("root node is forbidden and cannot be sanitized in-place")}}else if($e instanceof a)me=bs("<!---->"),Ae=me.ownerDocument.importNode($e,!0),Ae.nodeType===qu.element&&Ae.nodeName==="BODY"||Ae.nodeName==="HTML"?me=Ae:me.appendChild(Ae);else{if(!Ue&&!G&&!_e&&$e.indexOf("<")===-1)return R&&Ie?R.createHTML($e):$e;if(me=bs($e),!me)return Ue?null:Ie?C:""}me&&Te&&jn(me.firstChild);const ft=ys(Ht?$e:me);for(;st=ft.nextNode();)Oe(st)||(st.content instanceof i&&Fe(st.content),ze(st));if(Ht)return $e;if(Ue){if(Be)for(bn=k.call(me.ownerDocument);me.firstChild;)bn.appendChild(me.firstChild);else bn=me;return(N.shadowroot||N.shadowrootmode)&&(bn=I.call(r,bn,!0)),bn}let tr=_e?me.outerHTML:me.innerHTML;return _e&&H["!doctype"]&&me.ownerDocument&&me.ownerDocument.doctype&&me.ownerDocument.doctype.name&&gr(yM,me.ownerDocument.doctype.name)&&(tr="<!DOCTYPE "+me.ownerDocument.doctype.name+`>
|
|
315
|
+
`)},ite=0,tc=[];function ste(e){var t=V.useRef([]),n=V.useRef([0,0]),r=V.useRef(),o=V.useState(ite++)[0],i=V.useState(function(){return e_()})[0],s=V.useRef(e);V.useEffect(function(){s.current=e},[e]),V.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var b=$k([e.lockRef.current],(e.shards||[]).map(DP),!0).filter(Boolean);return b.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),b.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=V.useCallback(function(b,x){if("touches"in b&&b.touches.length===2)return!s.current.allowPinchZoom;var w=Ep(b),_=n.current,S="deltaX"in b?b.deltaX:_[0]-w[0],R="deltaY"in b?b.deltaY:_[1]-w[1],C,P=b.target,A=Math.abs(S)>Math.abs(R)?"h":"v";if("touches"in b&&A==="h"&&P.type==="range")return!1;var k=PP(A,P);if(!k)return!0;if(k?C=A:(C=A==="v"?"h":"v",k=PP(A,P)),!k)return!1;if(!r.current&&"changedTouches"in b&&(S||R)&&(r.current=C),!C)return!0;var D=r.current||C;return nte(D,x,b,D==="h"?S:R,!0)},[]),l=V.useCallback(function(b){var x=b;if(!(!tc.length||tc[tc.length-1]!==i)){var w="deltaY"in x?TP(x):Ep(x),_=t.current.filter(function(C){return C.name===x.type&&C.target===x.target&&rte(C.delta,w)})[0];if(_&&_.should){x.cancelable&&x.preventDefault();return}if(!_){var S=(s.current.shards||[]).map(DP).filter(Boolean).filter(function(C){return C.contains(x.target)}),R=S.length>0?a(x,S[0]):!s.current.noIsolation;R&&x.cancelable&&x.preventDefault()}}},[]),c=V.useCallback(function(b,x,w,_){var S={name:b,delta:x,target:w,should:_};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(R){return R!==S})},1)},[]),u=V.useCallback(function(b){n.current=Ep(b),r.current=void 0},[]),f=V.useCallback(function(b){c(b.type,TP(b),b.target,a(b,e.lockRef.current))},[]),h=V.useCallback(function(b){c(b.type,Ep(b),b.target,a(b,e.lockRef.current))},[]);V.useEffect(function(){return tc.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,ec),document.addEventListener("touchmove",l,ec),document.addEventListener("touchstart",u,ec),function(){tc=tc.filter(function(b){return b!==i}),document.removeEventListener("wheel",l,ec),document.removeEventListener("touchmove",l,ec),document.removeEventListener("touchstart",u,ec)}},[]);var g=e.removeScrollBar,v=e.inert;return V.createElement(V.Fragment,null,v?V.createElement(i,{styles:ote(o)}):null,g?V.createElement(Lk,{gapMode:"margin"}):null)}const ate=Ik(Nk,ste);var Bk=V.forwardRef(function(e,t){return V.createElement(Lm,lr({},e,{ref:t,sideCar:ate}))});Bk.classNames=Lm.classNames;const t_=Bk,lte=[" ","Enter","ArrowUp","ArrowDown"],cte=[" ","Enter"],Fm="Select",[jm,zm,ute]=lm(Fm),[au,pye]=Zn(Fm,[ute,Ti]),n_=Ti(),[dte,Rl]=au(Fm),[fte,hte]=au(Fm),pte=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:f,disabled:h,required:g}=e,v=n_(t),[b,x]=m.useState(null),[w,_]=m.useState(null),[S,R]=m.useState(!1),C=_l(c),[P=!1,A]=xr({prop:r,defaultProp:o,onChange:i}),[k,D]=xr({prop:s,defaultProp:a,onChange:l}),I=m.useRef(null),F=b?!!b.closest("form"):!0,[B,K]=m.useState(new Set),Z=Array.from(B).map(z=>z.props.value).join(";");return m.createElement(zf,v,m.createElement(dte,{required:g,scope:t,trigger:b,onTriggerChange:x,valueNode:w,onValueNodeChange:_,valueNodeHasChildren:S,onValueNodeHasChildrenChange:R,contentId:Jo(),value:k,onValueChange:D,open:P,onOpenChange:A,dir:C,triggerPointerDownPosRef:I,disabled:h},m.createElement(jm.Provider,{scope:t},m.createElement(fte,{scope:e.__scopeSelect,onNativeOptionAdd:m.useCallback(z=>{K(Q=>new Set(Q).add(z))},[]),onNativeOptionRemove:m.useCallback(z=>{K(Q=>{const W=new Set(Q);return W.delete(z),W})},[])},n)),F?m.createElement(qk,{key:Z,"aria-hidden":!0,required:g,tabIndex:-1,name:u,autoComplete:f,value:k,onChange:z=>D(z.target.value),disabled:h},k===void 0?m.createElement("option",{value:""}):null,Array.from(B)):null))},gte="SelectTrigger",mte=m.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=n_(n),s=Rl(gte,n),a=s.disabled||r,l=_t(t,s.onTriggerChange),c=zm(n),[u,f,h]=Gk(v=>{const b=c().filter(_=>!_.disabled),x=b.find(_=>_.value===s.value),w=Yk(b,v,x);w!==void 0&&s.onValueChange(w.value)}),g=()=>{a||(s.onOpenChange(!0),h())};return m.createElement(Bf,he({asChild:!0},i),m.createElement(Qe.button,he({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":Uk(s.value)?"":void 0},o,{ref:l,onClick:Me(o.onClick,v=>{v.currentTarget.focus()}),onPointerDown:Me(o.onPointerDown,v=>{const b=v.target;b.hasPointerCapture(v.pointerId)&&b.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&(g(),s.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)},v.preventDefault())}),onKeyDown:Me(o.onKeyDown,v=>{const b=u.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&f(v.key),!(b&&v.key===" ")&<e.includes(v.key)&&(g(),v.preventDefault())})})))}),vte="SelectValue",bte=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:s="",...a}=e,l=Rl(vte,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,f=_t(t,l.onValueNodeChange);return ur(()=>{c(u)},[c,u]),m.createElement(Qe.span,he({},a,{ref:f,style:{pointerEvents:"none"}}),Uk(l.value)?m.createElement(m.Fragment,null,s):i)}),yte=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return m.createElement(Qe.span,he({"aria-hidden":!0},o,{ref:t}),r||"▼")}),xte=e=>m.createElement(A1,he({asChild:!0},e)),Jc="SelectContent",wte=m.forwardRef((e,t)=>{const n=Rl(Jc,e.__scopeSelect),[r,o]=m.useState();if(ur(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?ko.createPortal(m.createElement(Vk,{scope:e.__scopeSelect},m.createElement(jm.Slot,{scope:e.__scopeSelect},m.createElement("div",null,e.children))),i):null}return m.createElement(_te,he({},e,{ref:t}))}),Ki=10,[Vk,Ol]=au(Jc),_te=m.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:g,sticky:v,hideWhenDetached:b,avoidCollisions:x,...w}=e,_=Rl(Jc,n),[S,R]=m.useState(null),[C,P]=m.useState(null),A=_t(t,pe=>R(pe)),[k,D]=m.useState(null),[I,F]=m.useState(null),B=zm(n),[K,Z]=m.useState(!1),z=m.useRef(!1);m.useEffect(()=>{if(S)return Nm(S)},[S]),Q1();const Q=m.useCallback(pe=>{const[ie,...te]=B().map(G=>G.ref.current),[ae]=te.slice(-1),ye=document.activeElement;for(const G of pe)if(G===ye||(G==null||G.scrollIntoView({block:"nearest"}),G===ie&&C&&(C.scrollTop=0),G===ae&&C&&(C.scrollTop=C.scrollHeight),G==null||G.focus(),document.activeElement!==ye))return},[B,C]),W=m.useCallback(()=>Q([k,S]),[Q,k,S]);m.useEffect(()=>{K&&W()},[K,W]);const{onOpenChange:Y,triggerPointerDownPosRef:oe}=_;m.useEffect(()=>{if(S){let pe={x:0,y:0};const ie=ae=>{var ye,G,be,_e;pe={x:Math.abs(Math.round(ae.pageX)-((ye=(G=oe.current)===null||G===void 0?void 0:G.x)!==null&&ye!==void 0?ye:0)),y:Math.abs(Math.round(ae.pageY)-((be=(_e=oe.current)===null||_e===void 0?void 0:_e.y)!==null&&be!==void 0?be:0))}},te=ae=>{pe.x<=10&&pe.y<=10?ae.preventDefault():S.contains(ae.target)||Y(!1),document.removeEventListener("pointermove",ie),oe.current=null};return oe.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",te,{capture:!0})}}},[S,Y,oe]),m.useEffect(()=>{const pe=()=>Y(!1);return window.addEventListener("blur",pe),window.addEventListener("resize",pe),()=>{window.removeEventListener("blur",pe),window.removeEventListener("resize",pe)}},[Y]);const[$,H]=Gk(pe=>{const ie=B().filter(ye=>!ye.disabled),te=ie.find(ye=>ye.ref.current===document.activeElement),ae=Yk(ie,pe,te);ae&&setTimeout(()=>ae.ref.current.focus())}),J=m.useCallback((pe,ie,te)=>{const ae=!z.current&&!te;(_.value!==void 0&&_.value===ie||ae)&&(D(pe),ae&&(z.current=!0))},[_.value]),N=m.useCallback(()=>S==null?void 0:S.focus(),[S]),ce=m.useCallback((pe,ie,te)=>{const ae=!z.current&&!te;(_.value!==void 0&&_.value===ie||ae)&&F(pe)},[_.value]),le=r==="popper"?$P:Ste,de=le===$P?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:g,sticky:v,hideWhenDetached:b,avoidCollisions:x}:{};return m.createElement(Vk,{scope:n,content:S,viewport:C,onViewportChange:P,itemRefCallback:J,selectedItem:k,onItemLeave:N,itemTextRefCallback:ce,focusSelectedItem:W,selectedItemText:I,position:r,isPositioned:K,searchRef:$},m.createElement(t_,{as:Tk,allowPinchZoom:!0},m.createElement(J1,{asChild:!0,trapped:_.open,onMountAutoFocus:pe=>{pe.preventDefault()},onUnmountAutoFocus:Me(o,pe=>{var ie;(ie=_.trigger)===null||ie===void 0||ie.focus({preventScroll:!0}),pe.preventDefault()})},m.createElement(Ff,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:pe=>pe.preventDefault(),onDismiss:()=>_.onOpenChange(!1)},m.createElement(le,he({role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:pe=>pe.preventDefault()},w,de,{onPlaced:()=>Z(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:Me(w.onKeyDown,pe=>{const ie=pe.ctrlKey||pe.altKey||pe.metaKey;if(pe.key==="Tab"&&pe.preventDefault(),!ie&&pe.key.length===1&&H(pe.key),["ArrowUp","ArrowDown","Home","End"].includes(pe.key)){let ae=B().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);if(["ArrowUp","End"].includes(pe.key)&&(ae=ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(pe.key)){const ye=pe.target,G=ae.indexOf(ye);ae=ae.slice(G+1)}setTimeout(()=>Q(ae)),pe.preventDefault()}})}))))))}),Ste=m.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=Rl(Jc,n),s=Ol(Jc,n),[a,l]=m.useState(null),[c,u]=m.useState(null),f=_t(t,A=>u(A)),h=zm(n),g=m.useRef(!1),v=m.useRef(!0),{viewport:b,selectedItem:x,selectedItemText:w,focusSelectedItem:_}=s,S=m.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&b&&x&&w){const A=i.trigger.getBoundingClientRect(),k=c.getBoundingClientRect(),D=i.valueNode.getBoundingClientRect(),I=w.getBoundingClientRect();if(i.dir!=="rtl"){const ye=I.left-k.left,G=D.left-ye,be=A.left-G,_e=A.width+be,Pe=Math.max(_e,k.width),Te=window.innerWidth-Ki,Ue=Ox(G,[Ki,Te-Pe]);a.style.minWidth=_e+"px",a.style.left=Ue+"px"}else{const ye=k.right-I.right,G=window.innerWidth-D.right-ye,be=window.innerWidth-A.right-G,_e=A.width+be,Pe=Math.max(_e,k.width),Te=window.innerWidth-Ki,Ue=Ox(G,[Ki,Te-Pe]);a.style.minWidth=_e+"px",a.style.right=Ue+"px"}const F=h(),B=window.innerHeight-Ki*2,K=b.scrollHeight,Z=window.getComputedStyle(c),z=parseInt(Z.borderTopWidth,10),Q=parseInt(Z.paddingTop,10),W=parseInt(Z.borderBottomWidth,10),Y=parseInt(Z.paddingBottom,10),oe=z+Q+K+Y+W,$=Math.min(x.offsetHeight*5,oe),H=window.getComputedStyle(b),J=parseInt(H.paddingTop,10),N=parseInt(H.paddingBottom,10),ce=A.top+A.height/2-Ki,le=B-ce,de=x.offsetHeight/2,pe=x.offsetTop+de,ie=z+Q+pe,te=oe-ie;if(ie<=ce){const ye=x===F[F.length-1].ref.current;a.style.bottom="0px";const G=c.clientHeight-b.offsetTop-b.offsetHeight,be=Math.max(le,de+(ye?N:0)+G+W),_e=ie+be;a.style.height=_e+"px"}else{const ye=x===F[0].ref.current;a.style.top="0px";const be=Math.max(ce,z+b.offsetTop+(ye?J:0)+de)+te;a.style.height=be+"px",b.scrollTop=ie-ce+b.offsetTop}a.style.margin=`${Ki}px 0`,a.style.minHeight=$+"px",a.style.maxHeight=B+"px",r==null||r(),requestAnimationFrame(()=>g.current=!0)}},[h,i.trigger,i.valueNode,a,c,b,x,w,i.dir,r]);ur(()=>S(),[S]);const[R,C]=m.useState();ur(()=>{c&&C(window.getComputedStyle(c).zIndex)},[c]);const P=m.useCallback(A=>{A&&v.current===!0&&(S(),_==null||_(),v.current=!1)},[S,_]);return m.createElement(Cte,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:g,onScrollButtonChange:P},m.createElement("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R}},m.createElement(Qe.div,he({},o,{ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}}))))}),$P=m.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Ki,...i}=e,s=n_(n);return m.createElement(Vf,he({},s,i,{ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.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)"}}))}),[Cte,r_]=au(Jc,{}),AP="SelectViewport",Ete=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ol(AP,n),i=r_(AP,n),s=_t(t,o.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(jm.Slot,{scope:n},m.createElement(Qe.div,he({"data-radix-select-viewport":"",role:"presentation"},r,{ref:s,style:{position:"relative",flex:1,overflow:"auto",...r.style},onScroll:Me(r.onScroll,l=>{const c=l.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:f}=i;if(f!=null&&f.current&&u){const h=Math.abs(a.current-c.scrollTop);if(h>0){const g=window.innerHeight-Ki*2,v=parseFloat(u.style.minHeight),b=parseFloat(u.style.height),x=Math.max(v,b);if(x<g){const w=x+h,_=Math.min(g,w),S=w-_;u.style.height=_+"px",u.style.bottom==="0px"&&(c.scrollTop=S>0?S:0,u.style.justifyContent="flex-end")}}}a.current=c.scrollTop})}))))}),Rte="SelectGroup",[Ote,Pte]=au(Rte),Tte=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Jo();return m.createElement(Ote,{scope:n,id:o},m.createElement(Qe.div,he({role:"group","aria-labelledby":o},r,{ref:t})))}),Dte="SelectLabel",$te=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Pte(Dte,n);return m.createElement(Qe.div,he({id:o.id},r,{ref:t}))}),Dx="SelectItem",[Ate,Hk]=au(Dx),kte=m.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=e,a=Rl(Dx,n),l=Ol(Dx,n),c=a.value===r,[u,f]=m.useState(i??""),[h,g]=m.useState(!1),v=_t(t,w=>{var _;return(_=l.itemRefCallback)===null||_===void 0?void 0:_.call(l,w,r,o)}),b=Jo(),x=()=>{o||(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(Ate,{scope:n,value:r,disabled:o,textId:b,isSelected:c,onItemTextChange:m.useCallback(w=>{f(_=>{var S;return _||((S=w==null?void 0:w.textContent)!==null&&S!==void 0?S:"").trim()})},[])},m.createElement(jm.ItemSlot,{scope:n,value:r,disabled:o,textValue:u},m.createElement(Qe.div,he({role:"option","aria-labelledby":b,"data-highlighted":h?"":void 0,"aria-selected":c&&h,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1},s,{ref:v,onFocus:Me(s.onFocus,()=>g(!0)),onBlur:Me(s.onBlur,()=>g(!1)),onPointerUp:Me(s.onPointerUp,x),onPointerMove:Me(s.onPointerMove,w=>{if(o){var _;(_=l.onItemLeave)===null||_===void 0||_.call(l)}else w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Me(s.onPointerLeave,w=>{if(w.currentTarget===document.activeElement){var _;(_=l.onItemLeave)===null||_===void 0||_.call(l)}}),onKeyDown:Me(s.onKeyDown,w=>{var _;((_=l.searchRef)===null||_===void 0?void 0:_.current)!==""&&w.key===" "||(cte.includes(w.key)&&x(),w.key===" "&&w.preventDefault())})}))))}),Rp="SelectItemText",Mte=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,s=Rl(Rp,n),a=Ol(Rp,n),l=Hk(Rp,n),c=hte(Rp,n),[u,f]=m.useState(null),h=_t(t,w=>f(w),l.onItemTextChange,w=>{var _;return(_=a.itemTextRefCallback)===null||_===void 0?void 0:_.call(a,w,l.value,l.disabled)}),g=u==null?void 0:u.textContent,v=m.useMemo(()=>m.createElement("option",{key:l.value,value:l.value,disabled:l.disabled},g),[l.disabled,l.value,g]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=c;return ur(()=>(b(v),()=>x(v)),[b,x,v]),m.createElement(m.Fragment,null,m.createElement(Qe.span,he({id:l.textId},i,{ref:h})),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?ko.createPortal(i.children,s.valueNode):null)}),Ite="SelectItemIndicator",Nte=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Hk(Ite,n).isSelected?m.createElement(Qe.span,he({"aria-hidden":!0},r,{ref:t})):null}),kP="SelectScrollUpButton",Lte=m.forwardRef((e,t)=>{const n=Ol(kP,e.__scopeSelect),r=r_(kP,e.__scopeSelect),[o,i]=m.useState(!1),s=_t(t,r.onScrollButtonChange);return ur(()=>{if(n.viewport&&n.isPositioned){let l=function(){const c=a.scrollTop>0;i(c)};const a=n.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?m.createElement(Wk,he({},e,{ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}})):null}),MP="SelectScrollDownButton",Fte=m.forwardRef((e,t)=>{const n=Ol(MP,e.__scopeSelect),r=r_(MP,e.__scopeSelect),[o,i]=m.useState(!1),s=_t(t,r.onScrollButtonChange);return ur(()=>{if(n.viewport&&n.isPositioned){let l=function(){const c=a.scrollHeight-a.clientHeight,u=Math.ceil(a.scrollTop)<c;i(u)};const a=n.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?m.createElement(Wk,he({},e,{ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}})):null}),Wk=m.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=Ol("SelectScrollButton",n),s=m.useRef(null),a=zm(n),l=m.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return m.useEffect(()=>()=>l(),[l]),ur(()=>{var c;const u=a().find(f=>f.ref.current===document.activeElement);u==null||(c=u.ref.current)===null||c===void 0||c.scrollIntoView({block:"nearest"})},[a]),m.createElement(Qe.div,he({"aria-hidden":!0},o,{ref:t,style:{flexShrink:0,...o.style},onPointerDown:Me(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Me(o.onPointerMove,()=>{var c;(c=i.onItemLeave)===null||c===void 0||c.call(i),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Me(o.onPointerLeave,()=>{l()})}))}),jte=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return m.createElement(Qe.div,he({"aria-hidden":!0},r,{ref:t}))});function Uk(e){return e===""||e===void 0}const qk=m.forwardRef((e,t)=>{const{value:n,...r}=e,o=m.useRef(null),i=_t(t,o),s=Im(n);return m.useEffect(()=>{const a=o.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==n&&u){const f=new Event("change",{bubbles:!0});u.call(a,n),a.dispatchEvent(f)}},[s,n]),m.createElement(JA,{asChild:!0},m.createElement("select",he({},r,{ref:i,defaultValue:n})))});qk.displayName="BubbleSelect";function Gk(e){const t=Ln(e),n=m.useRef(""),r=m.useRef(0),o=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]),i=m.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function Yk(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=zte(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function zte(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const Bte=pte,Kk=mte,Vte=bte,Hte=yte,Wte=xte,Xk=wte,Ute=Ete,qte=Tte,Qk=$te,Jk=kte,Gte=Mte,Yte=Nte,Zk=Lte,eM=Fte,tM=jte,zs=Bte,dc=qte,Bs=Vte,Qi=V.forwardRef(({className:e,children:t,...n},r)=>O.jsxs(Kk,{ref:r,className:Ee("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,O.jsx(Hte,{asChild:!0,children:O.jsx(Om,{className:"h-4 w-4 opacity-50"})})]}));Qi.displayName=Kk.displayName;const nM=V.forwardRef(({className:e,...t},n)=>O.jsx(Zk,{ref:n,className:Ee("flex cursor-default items-center justify-center py-1",e),...t,children:O.jsx(KX,{className:"h-4 w-4"})}));nM.displayName=Zk.displayName;const rM=V.forwardRef(({className:e,...t},n)=>O.jsx(eM,{ref:n,className:Ee("flex cursor-default items-center justify-center py-1",e),...t,children:O.jsx(Om,{className:"h-4 w-4"})}));rM.displayName=eM.displayName;const Ji=V.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>O.jsx(Wte,{children:O.jsx("div",{id:"semaphor-scope",children:O.jsxs(Xk,{ref:o,className:Ee("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:[O.jsx(nM,{}),O.jsx(Ute,{className:Ee("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),O.jsx(rM,{})]})})}));Ji.displayName=Xk.displayName;const Va=V.forwardRef(({className:e,...t},n)=>O.jsx(Qk,{ref:n,className:Ee("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Va.displayName=Qk.displayName;const Hn=V.forwardRef(({className:e,children:t,...n},r)=>O.jsxs(Jk,{ref:r,className:Ee("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:[O.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:O.jsx(Yte,{children:O.jsx(Lf,{className:"h-4 w-4"})})}),O.jsx(Gte,{children:t})]}));Hn.displayName=Jk.displayName;const Ng=V.forwardRef(({className:e,...t},n)=>O.jsx(tM,{ref:n,className:Ee("-mx-1 my-1 h-px bg-muted",e),...t}));Ng.displayName=tM.displayName;function Kte(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Xte(...e){return t=>e.forEach(n=>Kte(n,t))}var Bm=V.forwardRef((e,t)=>{const{children:n,...r}=e,o=V.Children.toArray(n),i=o.find(Qte);if(i){const s=i.props.children,a=o.map(l=>l===i?V.Children.count(s)>1?V.Children.only(null):V.isValidElement(s)?s.props.children:null:l);return O.jsx($x,{...r,ref:t,children:V.isValidElement(s)?V.cloneElement(s,void 0,a):null})}return O.jsx($x,{...r,ref:t,children:n})});Bm.displayName="Slot";var $x=V.forwardRef((e,t)=>{const{children:n,...r}=e;if(V.isValidElement(n)){const o=Zte(n);return V.cloneElement(n,{...Jte(r,n.props),ref:t?Xte(t,o):o})}return V.Children.count(n)>1?V.Children.only(null):null});$x.displayName="SlotClone";var oM=({children:e})=>O.jsx(O.Fragment,{children:e});function Qte(e){return V.isValidElement(e)&&e.type===oM}function Jte(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Zte(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const IP=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,NP=cg,o_=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return NP(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(c=>{const u=n==null?void 0:n[c],f=i==null?void 0:i[c];if(u===null)return null;const h=IP(u)||IP(f);return o[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[f,h]=u;return h===void 0||(c[f]=h),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:f,className:h,...g}=u;return Object.entries(g).every(v=>{let[b,x]=v;return Array.isArray(x)?x.includes({...i,...a}[b]):{...i,...a}[b]===x})?[...c,f,h]:c},[]);return NP(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},Bd=o_("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"}}),yr=V.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?Bm:"button";return O.jsx(s,{className:Ee(Bd({variant:t,size:n,className:e})),ref:i,...o})});yr.displayName="Button";const ene=m.forwardRef((e,t)=>m.createElement(Qe.label,he({},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()}}))),iM=ene,tne=o_("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Wn=V.forwardRef(({className:e,...t},n)=>O.jsx(iM,{ref:n,className:Ee(tne(),e),...t}));Wn.displayName=iM.displayName;const sM=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(rne);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(Ax,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(Ax,he({},r,{ref:t}),n)});sM.displayName="Slot";const Ax=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...one(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});Ax.displayName="SlotClone";const nne=({children:e})=>m.createElement(m.Fragment,null,e);function rne(e){return m.isValidElement(e)&&e.type===nne}function one(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const aM="Popover",[lM,gye]=Zn(aM,[Ti]),i_=Ti(),[ine,lu]=lM(aM),sne=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=e,a=i_(t),l=m.useRef(null),[c,u]=m.useState(!1),[f=!1,h]=xr({prop:r,defaultProp:o,onChange:i});return m.createElement(zf,a,m.createElement(ine,{scope:t,contentId:Jo(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:m.useCallback(()=>h(g=>!g),[h]),hasCustomAnchor:c,onCustomAnchorAdd:m.useCallback(()=>u(!0),[]),onCustomAnchorRemove:m.useCallback(()=>u(!1),[]),modal:s},n))},ane="PopoverTrigger",lne=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=lu(ane,n),i=i_(n),s=_t(t,o.triggerRef),a=m.createElement(Qe.button,he({type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":dM(o.open)},r,{ref:s,onClick:Me(e.onClick,o.onOpenToggle)}));return o.hasCustomAnchor?a:m.createElement(Bf,he({asChild:!0},i),a)}),cM="PopoverPortal",[cne,une]=lM(cM,{forceMount:void 0}),dne=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,i=lu(cM,t);return m.createElement(cne,{scope:t,forceMount:n},m.createElement(er,{present:n||i.open},m.createElement(A1,{asChild:!0,container:o},r)))},Vd="PopoverContent",fne=m.forwardRef((e,t)=>{const n=une(Vd,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,i=lu(Vd,e.__scopePopover);return m.createElement(er,{present:r||i.open},i.modal?m.createElement(hne,he({},o,{ref:t})):m.createElement(pne,he({},o,{ref:t})))}),hne=m.forwardRef((e,t)=>{const n=lu(Vd,e.__scopePopover),r=m.useRef(null),o=_t(t,r),i=m.useRef(!1);return m.useEffect(()=>{const s=r.current;if(s)return Nm(s)},[]),m.createElement(t_,{as:sM,allowPinchZoom:!0},m.createElement(uM,he({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Me(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),i.current||(a=n.triggerRef.current)===null||a===void 0||a.focus()}),onPointerDownOutside:Me(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Me(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})))}),pne=m.forwardRef((e,t)=>{const n=lu(Vd,e.__scopePopover),r=m.useRef(!1),o=m.useRef(!1);return m.createElement(uM,he({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s;if((s=e.onCloseAutoFocus)===null||s===void 0||s.call(e,i),!i.defaultPrevented){var a;r.current||(a=n.triggerRef.current)===null||a===void 0||a.focus(),i.preventDefault()}r.current=!1,o.current=!1},onInteractOutside:i=>{var s,a;(s=e.onInteractOutside)===null||s===void 0||s.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=i.target;((a=n.triggerRef.current)===null||a===void 0?void 0:a.contains(l))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}}))}),uM=m.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=e,h=lu(Vd,n),g=i_(n);return Q1(),m.createElement(J1,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i},m.createElement(Ff,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1)},m.createElement(Vf,he({"data-state":dM(h.open),role:"dialog",id:h.contentId},g,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 dM(e){return e?"open":"closed"}const gne=sne,mne=lne,vne=dne,fM=fne,Vm=gne,Hm=mne,Hf=V.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>O.jsx(vne,{children:O.jsx("div",{id:"semaphor-scope",children:O.jsx(fM,{ref:o,align:t,sideOffset:n,className:Ee("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})})}));Hf.displayName=fM.displayName;function bne(e,t){switch(t){case"full-date-time":return{locale:e,format:"full-date-time",options:{weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0}};case"short-date-time":return{locale:e,format:"short-date-time",options:{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!0}};case"hours-date-time":return{locale:e,format:"hours-date-time",options:{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}};case"short-date":return{format:"short-date",locale:e,options:{}};case"long-date":return{format:"long-date",locale:e,options:{year:"numeric",month:"long",day:"numeric"}};default:return{format:"short-date-time",locale:e,options:{}}}}const xc=V.forwardRef(({className:e,type:t,...n},r)=>O.jsx("input",{type:t,className:Ee("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}));xc.displayName="Input";function hM({colorRanges:e,setColorRanges:t}){const n={start:-1/0,end:100,color:""};function r(s,a,l){const c=[...e];c[s]={...c[s],[a]:l},t(c)}function o(s){const a=[...e];a.splice(s,1),t(a)}function i(){t([...e,n])}return O.jsxs("div",{className:"space-y-3",children:[O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx(Wn,{children:"Color Range"}),O.jsx(yr,{onClick:i,variant:"secondary",className:"h-5 p-1 text-muted-foreground",children:O.jsx(C1,{className:"size-3"})})]}),e.map((s,a)=>O.jsxs("div",{className:"flex items-center gap-2 px-2",children:[O.jsx(xc,{onChange:l=>r(a,"start",l.target.value),value:s.start,className:Ee(`h-7 ${Yp}`)}),O.jsx("span",{children:"-"}),O.jsx(xc,{value:s.end,onChange:l=>r(a,"end",l.target.value),className:Ee(`h-7 ${Yp}`)}),O.jsx(xc,{onChange:l=>r(a,"color",l.target.value),value:s.color,className:Ee(`h-7 min-w-14 p-0 ${Yp}`),type:"color",list:"presetColors"}),O.jsxs("datalist",{id:"presetColors",children:[O.jsx("option",{children:Bt.green[600]}),O.jsx("option",{children:Bt.red[500]}),O.jsx("option",{children:Bt.yellow[400]}),O.jsx("option",{children:Bt.orange[500]})]}),O.jsx(yr,{onClick:()=>o(a),variant:"secondary",className:"h-5 p-1 text-muted-foreground",children:O.jsx(Pm,{className:"size-3"})})]},a))]})}const yne=m.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r=!1,onPressedChange:o,...i}=e,[s=!1,a]=xr({prop:n,onChange:o,defaultProp:r});return m.createElement(Qe.button,he({type:"button","aria-pressed":s,"data-state":s?"on":"off","data-disabled":e.disabled?"":void 0},i,{ref:t,onClick:Me(e.onClick,()=>{e.disabled||a(!s)})}))}),pM=yne,xne=o_("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground 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=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),s_=V.forwardRef(({className:e,variant:t,size:n,...r},o)=>O.jsx(pM,{ref:o,className:Ee(xne({variant:t,size:n,className:e})),...r}));s_.displayName=pM.displayName;function wne(e,t){var r;const n=(r=e==null?void 0:e.columnSettings)==null?void 0:r.find(o=>o.columnIdx===t);return n==null?void 0:n.type}function _ne(e,t){var r,o;const n=(r=e==null?void 0:e.columnSettings)==null?void 0:r.find(i=>i.columnIdx===t);return((o=n==null?void 0:n.options)==null?void 0:o.locale)||"en-US"}function Sne(e,t){var r,o;const n=(r=e==null?void 0:e.columnSettings)==null?void 0:r.find(i=>i.columnIdx===t&&i.type==="date");return((o=n==null?void 0:n.options)==null?void 0:o.format)||"short-date-time"}function Cne(e,t){var r,o;const n=(r=e==null?void 0:e.columnSettings)==null?void 0:r.find(i=>i.columnIdx===t);return(o=n==null?void 0:n.options)==null?void 0:o.currency}function Ene(e,t){var r,o,i;const n=(r=e==null?void 0:e.columnSettings)==null?void 0:r.find(s=>s.columnIdx===t);return((i=(o=n==null?void 0:n.options)==null?void 0:o.options)==null?void 0:i.minimumFractionDigits)||0}function Rne(e,t){var r,o;const n=(r=e==null?void 0:e.columnSettings)==null?void 0:r.find(i=>i.columnIdx===t);return((o=n==null?void 0:n.options)==null?void 0:o.colorRanges)||[]}function One(e,t){var r,o,i;const n=(r=e==null?void 0:e.columnSettings)==null?void 0:r.find(s=>s.columnIdx===t);return((i=(o=n==null?void 0:n.options)==null?void 0:o.options)==null?void 0:i.style)==="percent"}function Pne({columnIndex:e,columnName:t}){const[n,r]=m.useState(!1),o=Ar(D=>{var I;return(I=D.card)==null?void 0:I.preferences}),[i,s]=m.useState(wne(o,e)),[a,l]=m.useState(Rne(o,e)),[c,u]=m.useState(_ne(o,e)),[f,h]=m.useState(Sne(o,e)),[g,v]=m.useState(Cne(o,e)),[b,x]=m.useState(Ene(o,e).toString()),[w,_]=m.useState(One(o,e));m.useState("");const S=Ar(D=>D.actions.setCardPreferences);function R(){const D=[...new Set(y0.map(I=>I.currency))];return O.jsx(O.Fragment,{children:O.jsxs("div",{className:"grid grid-cols-9 items-center gap-2",children:[O.jsx(Wn,{className:"col-span-3",htmlFor:"format",children:"Locale"}),O.jsxs(zs,{value:c,onValueChange:I=>u(I),children:[O.jsx(Qi,{className:"col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0",children:O.jsx(Bs,{})}),O.jsx(Ji,{children:O.jsxs(dc,{children:[O.jsx(Va,{children:"Locale"}),y0.map(I=>O.jsx(Hn,{value:I.locale,children:I.locale},I.locale))]})})]}),O.jsx(Wn,{className:"col-span-3",htmlFor:"format",children:"Currency"}),O.jsxs(zs,{value:g||"none",onValueChange:I=>v(I==="none"?void 0:I),children:[O.jsx(Qi,{className:"col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0",children:O.jsx(Bs,{})}),O.jsx(Ji,{children:O.jsxs(dc,{children:[O.jsx(Va,{children:"Currency"}),O.jsx(Hn,{value:"none",children:"None"}),D.map(I=>O.jsx(Hn,{value:I,children:I},I))]})})]}),O.jsx(Wn,{className:"col-span-3",htmlFor:"format",children:"Decimals"}),O.jsxs(zs,{value:b,onValueChange:I=>x(I),children:[O.jsx(Qi,{className:"col-span-3 h-8 w-full focus:ring-1 focus:ring-offset-0",children:O.jsx(Bs,{})}),O.jsx(Ji,{children:["0","1","2","3","4"].map(I=>O.jsx(Hn,{value:I,children:I},I))})]}),!g&&O.jsx(s_,{onPressedChange:I=>_(I),variant:"outline",size:"sm",className:"col-span-3 h-8","aria-label":"Toggle italic",children:O.jsx(ZX,{className:"size-3"})})]})})}function C(){return O.jsx(O.Fragment,{children:O.jsxs("div",{className:"grid grid-cols-9 items-center gap-2",children:[O.jsx(Wn,{className:"col-span-3",htmlFor:"format",children:"Locale"}),O.jsxs(zs,{defaultValue:"en-US",value:c,onValueChange:D=>u(D),children:[O.jsx(Qi,{className:"col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0",children:O.jsx(Bs,{})}),O.jsx(Ji,{children:Pz.map(D=>O.jsxs(dc,{children:[O.jsx(Va,{children:D.label}),D.locales.map(I=>O.jsx(Hn,{value:I.code,children:I.name},I.code))]},D.label))})]}),O.jsx(Wn,{className:"col-span-3",htmlFor:"format",children:"Format"}),O.jsxs(zs,{defaultValue:"short-date-time",value:f,onValueChange:D=>{console.log("format",D),h(D)},children:[O.jsx(Qi,{className:"col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0",children:O.jsx(Bs,{})}),O.jsx(Ji,{className:"",id:"type",children:O.jsxs(dc,{children:[O.jsx(Va,{children:"Option"}),O.jsx(Hn,{value:"full-date-time",children:"Full Date-Time"}),O.jsx(Hn,{value:"short-date-time",children:"Short Date-Time"}),O.jsx(Hn,{value:"hours-date-time",children:"24-Hour Date-Time"}),O.jsx(Hn,{value:"short-date",children:"Short Date"}),O.jsx(Hn,{value:"long-date",children:"Long Date"})]})})]})]})})}function P(){S({...o,columnSettings:[]})}function A(){var D;S({...o,columnSettings:[...((D=o==null?void 0:o.columnSettings)==null?void 0:D.filter(I=>I.columnIdx!==e))||[]]})}function k(){var D,I,F;if(i==="date"){const B=bne(c,f),K={columnIdx:e,type:i,options:B};S({...o,columnSettings:[...((D=o==null?void 0:o.columnSettings)==null?void 0:D.filter(Z=>Z.columnIdx!==e))||[],K]})}else if(i==="number"){let B;g?B={locale:c,currency:g,options:{style:"currency",currency:g,minimumFractionDigits:Number(b)},colorRanges:a.length>0?a:void 0}:B={locale:c,currency:void 0,options:{style:w?"percent":"decimal",minimumFractionDigits:Number(b)},colorRanges:a.length>0?a:void 0};const K={columnIdx:e,type:i,options:B};S({...o,columnSettings:[...((I=o==null?void 0:o.columnSettings)==null?void 0:I.filter(Z=>Z.columnIdx!==e))||[],K]})}else S({...o,columnSettings:[...((F=o==null?void 0:o.columnSettings)==null?void 0:F.filter(B=>B.columnIdx!==e))||[]]})}return O.jsxs(Vm,{onOpenChange:D=>r(D),children:[O.jsx(Hm,{asChild:!0,children:O.jsx(E1,{className:"size-3.5 cursor-pointer text-muted"})}),O.jsx(Hf,{align:"center",className:"max-w-70",children:O.jsxs("div",{className:"grid gap-4",children:[O.jsxs("div",{className:"space-y-2",children:[O.jsx("h4",{className:"font-medium leading-none",children:"Display Settings"}),O.jsx("p",{className:"text-sm text-muted-foreground",children:`Display setting for '${t}'`})]}),O.jsxs("div",{className:"grid gap-2",children:[O.jsxs("div",{className:"grid grid-cols-3 items-center gap-2",children:[O.jsx(Wn,{htmlFor:"scale",children:"Type"}),O.jsxs(zs,{value:i||"none",onValueChange:D=>s(D),children:[O.jsx(Qi,{className:"col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0",children:O.jsx(Bs,{})}),O.jsx(Ji,{id:"type",children:O.jsxs(dc,{children:[O.jsx(Va,{children:"Option"}),O.jsx(Hn,{value:"number",children:"Number"}),O.jsx(Hn,{value:"date",children:"Date"}),O.jsx(Hn,{value:"none",children:"None"})]})})]})]}),i==="number"&&R(),i==="date"&&C(),i==="number"&&O.jsxs(O.Fragment,{children:[O.jsx(Ng,{}),O.jsx(hM,{colorRanges:a,setColorRanges:l})]}),O.jsx(Ng,{}),O.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[O.jsx(yr,{onClick:P,variant:"secondary",className:"col-span-1 col-start-1 h-8 w-full text-destructive",children:"Reset All"}),O.jsx(yr,{onClick:A,variant:"secondary",className:"col-span-1 col-start-2 h-8 w-full",children:"Reset"}),O.jsx(yr,{onClick:k,variant:"secondary",className:"col-span-1 col-start-3 h-8 w-full",children:"Apply"})]})]})]})})]})}function Tne(e){const t=new Date(e);return!isNaN(t.getTime())}function gM({data:e,card:t}){var R,C,P,A;const[n,r]=m.useState([]),{keys:o}=ar(e),i=ke(k=>k.filteringCards),s=ke(k=>k.themeStyle),a=ke(k=>k.isVisualEditing),l=i==null?void 0:i.find(k=>k.id===t.id),c=(R=t==null?void 0:t.preferences)==null?void 0:R.onClickFilter,{addOrUpdateFilterValues:u,addFilteringCard:f,removeFilterValue:h,removeFilteringCard:g}=Mo(),v=t==null?void 0:t.preferences;function b(k,D){if((D==null?void 0:D.type)==="date"&&Tne(k)){const{locale:I,options:F}=D.options,B=new Date(k);return new Date(B.getTime()).toLocaleDateString(I,F)}if((D==null?void 0:D.type)==="number"){const{locale:I,currency:F,options:B}=D.options;return F?new Intl.NumberFormat(I,{style:"currency",currency:F,...B}).format(k):new Intl.NumberFormat(I,B).format(k)}return k}const x=o.map((k,D)=>({accessorKey:k,header:({column:I})=>{const F=I.getIsSorted();return O.jsxs("div",{className:"flex items-center justify-between gap-2",children:[O.jsxs("div",{className:"flex cursor-pointer items-center",onClick:()=>I.toggleSorting(I.getIsSorted()==="asc"),children:[k,F==="asc"?O.jsx(w1,{className:"ml-2 h-5 w-5"}):F==="desc"?O.jsx(x1,{className:"ml-2 h-5 w-5"}):null]}),a&&O.jsx(Pne,{columnName:I.id,columnIndex:D})]})},cell:({cell:I})=>{var z,Q;const F=I.getValue(),B=(z=v==null?void 0:v.columnSettings)==null?void 0:z.find(W=>W.columnIdx===D),K=b(F,B),Z=ok(F,(Q=B==null?void 0:B.options)==null?void 0:Q.colorRanges);return O.jsx("div",{className:"px-2 py-1",style:{backgroundColor:Z},children:K})}})),w=Ok({data:e,columns:x,getCoreRowModel:Ck(),getPaginationRowModel:Rk(),onSortingChange:r,getSortedRowModel:Ek(),manualPagination:!0,state:{sorting:n}}),_=w.getSelectedRowModel().rows;m.useEffect(()=>{if(_.length===0){if(l){const k=t.id;h(k),g(t)}return}if(c){const{dimensionKeys:k}=ar(e),D=c.map(I=>{const F=k==null?void 0:k[I.columnIndex],B=_.map(Z=>Z.getValue(F));return{filterId:t.id+"-"+F,connectionId:t==null?void 0:t.connectionId,tableName:t.lastSelectedTable,name:F,expression:I.expression,valueType:Pd(B[0]===void 0?"":B[0]),operation:"in",values:B}});u(D),f(t)}},[f,u,t,e,l,c,h,g,_]);function S(k){k.toggleSelected()}return O.jsxs(W1,{className:"",containerClassName:"rounded-md",containerStyle:{borderTopRightRadius:(C=s==null?void 0:s.chart)==null?void 0:C.options.borderRadius,borderTopLeftRadius:(P=s==null?void 0:s.chart)==null?void 0:P.options.borderRadius},onMouseDown:k=>k.stopPropagation(),children:[O.jsx(U1,{children:w.getHeaderGroups().map(k=>O.jsx(bd,{children:k.headers.map((D,I)=>{var F,B,K,Z,z,Q,W;return O.jsx(G1,{style:{backgroundColor:(K=(B=(F=s==null?void 0:s.chart)==null?void 0:F.dataset)==null?void 0:B.backgroundColor)==null?void 0:K[0],color:Bc((Q=(z=(Z=s==null?void 0:s.chart)==null?void 0:Z.dataset)==null?void 0:z.backgroundColor)==null?void 0:Q[0])},className:Ee("sticky -top-[1px] z-50 h-9 bg-muted-foreground px-2 text-background",{"border-x":I>0&&I<k.headers.length-1,"border-l":I===1&&k.headers.length==2},(W=s==null?void 0:s.table)==null?void 0:W.tableHeaderColor),children:D.isPlaceholder?null:Rx(D.column.columnDef.header,D.getContext())},D.id)})},k.id))}),O.jsx(q1,{children:(A=w.getRowModel().rows)!=null&&A.length?w.getRowModel().rows.map((k,D)=>O.jsx(bd,{onClick:()=>S(k),className:Ee("whitespace-nowrap p-1",{"cursor-pointer data-[state=selected]:border-2 data-[state=selected]:border-dashed":c&&(c==null?void 0:c.length)>0}),"data-state":k.getIsSelected()&&"selected",children:k.getVisibleCells().map((I,F)=>{var B;return O.jsx(Mg,{onClick:K=>{var z;const Z=((z=window==null?void 0:window.getSelection())==null?void 0:z.toString())||"";(Z==null?void 0:Z.length)>0&&K.stopPropagation()},className:Ee("p-0",{"border-x":F>0&&F<x.length-1||F===1&&x.length==2,"border-l":F==0,"border-r":F===x.length-1,"border-b":D===((B=w.getRowModel().rows)==null?void 0:B.length)-1}),children:Rx(I.column.columnDef.cell,I.getContext())},I.id)})},k.id)):O.jsx(bd,{children:O.jsx(Mg,{colSpan:x.length,className:"p-1 text-center",children:"No results."})})})]})}/*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */const{entries:mM,setPrototypeOf:LP,isFrozen:Dne,getPrototypeOf:$ne,getOwnPropertyDescriptor:Ane}=Object;let{freeze:wr,seal:Ao,create:vM}=Object,{apply:kx,construct:Mx}=typeof Reflect<"u"&&Reflect;wr||(wr=function(t){return t});Ao||(Ao=function(t){return t});kx||(kx=function(t,n,r){return t.apply(n,r)});Mx||(Mx=function(t,n){return new t(...n)});const Op=uo(Array.prototype.forEach),FP=uo(Array.prototype.pop),Vu=uo(Array.prototype.push),ig=uo(String.prototype.toLowerCase),vy=uo(String.prototype.toString),jP=uo(String.prototype.match),Hu=uo(String.prototype.replace),kne=uo(String.prototype.indexOf),Mne=uo(String.prototype.trim),Uo=uo(Object.prototype.hasOwnProperty),gr=uo(RegExp.prototype.test),Wu=Ine(TypeError);function uo(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return kx(e,t,r)}}function Ine(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Mx(e,n)}}function Tt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ig;LP&&LP(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(Dne(t)||(t[r]=i),o=i)}e[o]=!0}return e}function Nne(e){for(let t=0;t<e.length;t++)Uo(e,t)||(e[t]=null);return e}function za(e){const t=vM(null);for(const[n,r]of mM(e))Uo(e,n)&&(Array.isArray(r)?t[n]=Nne(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=za(r):t[n]=r);return t}function Uu(e,t){for(;e!==null;){const r=Ane(e,t);if(r){if(r.get)return uo(r.get);if(typeof r.value=="function")return uo(r.value)}e=$ne(e)}function n(){return null}return n}const zP=wr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),by=wr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),yy=wr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Lne=wr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),xy=wr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Fne=wr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),BP=wr(["#text"]),VP=wr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),wy=wr(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),HP=wr(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Pp=wr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),jne=Ao(/\{\{[\w\W]*|[\w\W]*\}\}/gm),zne=Ao(/<%[\w\W]*|[\w\W]*%>/gm),Bne=Ao(/\${[\w\W]*}/gm),Vne=Ao(/^data-[\-\w.\u00B7-\uFFFF]/),Hne=Ao(/^aria-[\-\w]+$/),bM=Ao(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Wne=Ao(/^(?:\w+script|data):/i),Une=Ao(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),yM=Ao(/^html$/i),qne=Ao(/^[a-z][.\w]*(-[.\w]+)+$/i);var WP=Object.freeze({__proto__:null,MUSTACHE_EXPR:jne,ERB_EXPR:zne,TMPLIT_EXPR:Bne,DATA_ATTR:Vne,ARIA_ATTR:Hne,IS_ALLOWED_URI:bM,IS_SCRIPT_OR_DATA:Wne,ATTR_WHITESPACE:Une,DOCTYPE_NAME:yM,CUSTOM_ELEMENT:qne});const qu={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Gne=function(){return typeof window>"u"?null:window},Yne=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}};function xM(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Gne();const t=$e=>xM($e);if(t.version="3.1.6",t.removed=[],!e||!e.document||e.document.nodeType!==qu.document)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:s,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:h,trustedTypes:g}=e,v=l.prototype,b=Uu(v,"cloneNode"),x=Uu(v,"remove"),w=Uu(v,"nextSibling"),_=Uu(v,"childNodes"),S=Uu(v,"parentNode");if(typeof s=="function"){const $e=n.createElement("template");$e.content&&$e.content.ownerDocument&&(n=$e.content.ownerDocument)}let R,C="";const{implementation:P,createNodeIterator:A,createDocumentFragment:k,getElementsByTagName:D}=n,{importNode:I}=r;let F={};t.isSupported=typeof mM=="function"&&typeof S=="function"&&P&&P.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:B,ERB_EXPR:K,TMPLIT_EXPR:Z,DATA_ATTR:z,ARIA_ATTR:Q,IS_SCRIPT_OR_DATA:W,ATTR_WHITESPACE:Y,CUSTOM_ELEMENT:oe}=WP;let{IS_ALLOWED_URI:$}=WP,H=null;const J=Tt({},[...zP,...by,...yy,...xy,...BP]);let N=null;const ce=Tt({},[...VP,...wy,...HP,...Pp]);let le=Object.seal(vM(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),de=null,pe=null,ie=!0,te=!0,ae=!1,ye=!0,G=!1,be=!0,_e=!1,Pe=!1,Te=!1,Ue=!1,Be=!1,Ie=!1,Ke=!0,lt=!1;const It="user-content-";let $t=!0,Ht=!1,fe={},Ce=null;const Le=Tt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ge=null;const Ze=Tt({},["audio","video","img","source","image","track"]);let Wt=null;const Zt=Tt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Kt="http://www.w3.org/1998/Math/MathML",vn="http://www.w3.org/2000/svg",ln="http://www.w3.org/1999/xhtml";let Lt=ln,tn=!1,xn=null;const nt=Tt({},[Kt,vn,ln],vy);let ht=null;const At=["application/xhtml+xml","text/html"],Xt="text/html";let bt=null,Rn=null;const Lo=n.createElement("form"),ms=function(q){return q instanceof RegExp||q instanceof Function},Fo=function(){let q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Rn&&Rn===q)){if((!q||typeof q!="object")&&(q={}),q=za(q),ht=At.indexOf(q.PARSER_MEDIA_TYPE)===-1?Xt:q.PARSER_MEDIA_TYPE,bt=ht==="application/xhtml+xml"?vy:ig,H=Uo(q,"ALLOWED_TAGS")?Tt({},q.ALLOWED_TAGS,bt):J,N=Uo(q,"ALLOWED_ATTR")?Tt({},q.ALLOWED_ATTR,bt):ce,xn=Uo(q,"ALLOWED_NAMESPACES")?Tt({},q.ALLOWED_NAMESPACES,vy):nt,Wt=Uo(q,"ADD_URI_SAFE_ATTR")?Tt(za(Zt),q.ADD_URI_SAFE_ATTR,bt):Zt,Ge=Uo(q,"ADD_DATA_URI_TAGS")?Tt(za(Ze),q.ADD_DATA_URI_TAGS,bt):Ze,Ce=Uo(q,"FORBID_CONTENTS")?Tt({},q.FORBID_CONTENTS,bt):Le,de=Uo(q,"FORBID_TAGS")?Tt({},q.FORBID_TAGS,bt):{},pe=Uo(q,"FORBID_ATTR")?Tt({},q.FORBID_ATTR,bt):{},fe=Uo(q,"USE_PROFILES")?q.USE_PROFILES:!1,ie=q.ALLOW_ARIA_ATTR!==!1,te=q.ALLOW_DATA_ATTR!==!1,ae=q.ALLOW_UNKNOWN_PROTOCOLS||!1,ye=q.ALLOW_SELF_CLOSE_IN_ATTR!==!1,G=q.SAFE_FOR_TEMPLATES||!1,be=q.SAFE_FOR_XML!==!1,_e=q.WHOLE_DOCUMENT||!1,Ue=q.RETURN_DOM||!1,Be=q.RETURN_DOM_FRAGMENT||!1,Ie=q.RETURN_TRUSTED_TYPE||!1,Te=q.FORCE_BODY||!1,Ke=q.SANITIZE_DOM!==!1,lt=q.SANITIZE_NAMED_PROPS||!1,$t=q.KEEP_CONTENT!==!1,Ht=q.IN_PLACE||!1,$=q.ALLOWED_URI_REGEXP||bM,Lt=q.NAMESPACE||ln,le=q.CUSTOM_ELEMENT_HANDLING||{},q.CUSTOM_ELEMENT_HANDLING&&ms(q.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(le.tagNameCheck=q.CUSTOM_ELEMENT_HANDLING.tagNameCheck),q.CUSTOM_ELEMENT_HANDLING&&ms(q.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(le.attributeNameCheck=q.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),q.CUSTOM_ELEMENT_HANDLING&&typeof q.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(le.allowCustomizedBuiltInElements=q.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),G&&(te=!1),Be&&(Ue=!0),fe&&(H=Tt({},BP),N=[],fe.html===!0&&(Tt(H,zP),Tt(N,VP)),fe.svg===!0&&(Tt(H,by),Tt(N,wy),Tt(N,Pp)),fe.svgFilters===!0&&(Tt(H,yy),Tt(N,wy),Tt(N,Pp)),fe.mathMl===!0&&(Tt(H,xy),Tt(N,HP),Tt(N,Pp))),q.ADD_TAGS&&(H===J&&(H=za(H)),Tt(H,q.ADD_TAGS,bt)),q.ADD_ATTR&&(N===ce&&(N=za(N)),Tt(N,q.ADD_ATTR,bt)),q.ADD_URI_SAFE_ATTR&&Tt(Wt,q.ADD_URI_SAFE_ATTR,bt),q.FORBID_CONTENTS&&(Ce===Le&&(Ce=za(Ce)),Tt(Ce,q.FORBID_CONTENTS,bt)),$t&&(H["#text"]=!0),_e&&Tt(H,["html","head","body"]),H.table&&(Tt(H,["tbody"]),delete de.tbody),q.TRUSTED_TYPES_POLICY){if(typeof q.TRUSTED_TYPES_POLICY.createHTML!="function")throw Wu('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof q.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Wu('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');R=q.TRUSTED_TYPES_POLICY,C=R.createHTML("")}else R===void 0&&(R=Yne(g,o)),R!==null&&typeof C=="string"&&(C=R.createHTML(""));wr&&wr(q),Rn=q}},$i=Tt({},["mi","mo","mn","ms","mtext"]),ni=Tt({},["foreignobject","annotation-xml"]),Ai=Tt({},["title","style","font","a","script"]),vs=Tt({},[...by,...yy,...Lne]),ri=Tt({},[...xy,...Fne]),ki=function(q){let me=S(q);(!me||!me.tagName)&&(me={namespaceURI:Lt,tagName:"template"});const Ae=ig(q.tagName),st=ig(me.tagName);return xn[q.namespaceURI]?q.namespaceURI===vn?me.namespaceURI===ln?Ae==="svg":me.namespaceURI===Kt?Ae==="svg"&&(st==="annotation-xml"||$i[st]):!!vs[Ae]:q.namespaceURI===Kt?me.namespaceURI===ln?Ae==="math":me.namespaceURI===vn?Ae==="math"&&ni[st]:!!ri[Ae]:q.namespaceURI===ln?me.namespaceURI===vn&&!ni[st]||me.namespaceURI===Kt&&!$i[st]?!1:!ri[Ae]&&(Ai[Ae]||!vs[Ae]):!!(ht==="application/xhtml+xml"&&xn[q.namespaceURI]):!1},jn=function(q){Vu(t.removed,{element:q});try{S(q).removeChild(q)}catch{x(q)}},oi=function(q,me){try{Vu(t.removed,{attribute:me.getAttributeNode(q),from:me})}catch{Vu(t.removed,{attribute:null,from:me})}if(me.removeAttribute(q),q==="is"&&!N[q])if(Ue||Be)try{jn(me)}catch{}else try{me.setAttribute(q,"")}catch{}},bs=function(q){let me=null,Ae=null;if(Te)q="<remove></remove>"+q;else{const ft=jP(q,/^[\r\n\t ]+/);Ae=ft&&ft[0]}ht==="application/xhtml+xml"&&Lt===ln&&(q='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+q+"</body></html>");const st=R?R.createHTML(q):q;if(Lt===ln)try{me=new h().parseFromString(st,ht)}catch{}if(!me||!me.documentElement){me=P.createDocument(Lt,"template",null);try{me.documentElement.innerHTML=tn?C:st}catch{}}const bn=me.body||me.documentElement;return q&&Ae&&bn.insertBefore(n.createTextNode(Ae),bn.childNodes[0]||null),Lt===ln?D.call(me,_e?"html":"body")[0]:_e?me.documentElement:bn},ys=function(q){return A.call(q.ownerDocument||q,q,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},T=function(q){return q instanceof f&&(typeof q.nodeName!="string"||typeof q.textContent!="string"||typeof q.removeChild!="function"||!(q.attributes instanceof u)||typeof q.removeAttribute!="function"||typeof q.setAttribute!="function"||typeof q.namespaceURI!="string"||typeof q.insertBefore!="function"||typeof q.hasChildNodes!="function")},ee=function(q){return typeof a=="function"&&q instanceof a},ue=function(q,me,Ae){F[q]&&Op(F[q],st=>{st.call(t,me,Ae,Rn)})},Oe=function(q){let me=null;if(ue("beforeSanitizeElements",q,null),T(q))return jn(q),!0;const Ae=bt(q.nodeName);if(ue("uponSanitizeElement",q,{tagName:Ae,allowedTags:H}),q.hasChildNodes()&&!ee(q.firstElementChild)&&gr(/<[/\w]/g,q.innerHTML)&&gr(/<[/\w]/g,q.textContent)||q.nodeType===qu.progressingInstruction||be&&q.nodeType===qu.comment&&gr(/<[/\w]/g,q.data))return jn(q),!0;if(!H[Ae]||de[Ae]){if(!de[Ae]&&qe(Ae)&&(le.tagNameCheck instanceof RegExp&&gr(le.tagNameCheck,Ae)||le.tagNameCheck instanceof Function&&le.tagNameCheck(Ae)))return!1;if($t&&!Ce[Ae]){const st=S(q)||q.parentNode,bn=_(q)||q.childNodes;if(bn&&st){const ft=bn.length;for(let tr=ft-1;tr>=0;--tr){const po=b(bn[tr],!0);po.__removalCount=(q.__removalCount||0)+1,st.insertBefore(po,w(q))}}}return jn(q),!0}return q instanceof l&&!ki(q)||(Ae==="noscript"||Ae==="noembed"||Ae==="noframes")&&gr(/<\/no(script|embed|frames)/i,q.innerHTML)?(jn(q),!0):(G&&q.nodeType===qu.text&&(me=q.textContent,Op([B,K,Z],st=>{me=Hu(me,st," ")}),q.textContent!==me&&(Vu(t.removed,{element:q.cloneNode()}),q.textContent=me)),ue("afterSanitizeElements",q,null),!1)},He=function(q,me,Ae){if(Ke&&(me==="id"||me==="name")&&(Ae in n||Ae in Lo))return!1;if(!(te&&!pe[me]&&gr(z,me))){if(!(ie&&gr(Q,me))){if(!N[me]||pe[me]){if(!(qe(q)&&(le.tagNameCheck instanceof RegExp&&gr(le.tagNameCheck,q)||le.tagNameCheck instanceof Function&&le.tagNameCheck(q))&&(le.attributeNameCheck instanceof RegExp&&gr(le.attributeNameCheck,me)||le.attributeNameCheck instanceof Function&&le.attributeNameCheck(me))||me==="is"&&le.allowCustomizedBuiltInElements&&(le.tagNameCheck instanceof RegExp&&gr(le.tagNameCheck,Ae)||le.tagNameCheck instanceof Function&&le.tagNameCheck(Ae))))return!1}else if(!Wt[me]){if(!gr($,Hu(Ae,Y,""))){if(!((me==="src"||me==="xlink:href"||me==="href")&&q!=="script"&&kne(Ae,"data:")===0&&Ge[q])){if(!(ae&&!gr(W,Hu(Ae,Y,"")))){if(Ae)return!1}}}}}}return!0},qe=function(q){return q!=="annotation-xml"&&jP(q,oe)},ze=function(q){ue("beforeSanitizeAttributes",q,null);const{attributes:me}=q;if(!me)return;const Ae={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:N};let st=me.length;for(;st--;){const bn=me[st],{name:ft,namespaceURI:tr,value:po}=bn,ya=bt(ft);let zn=ft==="value"?po:Mne(po);if(Ae.attrName=ya,Ae.attrValue=zn,Ae.keepAttr=!0,Ae.forceKeepAttr=void 0,ue("uponSanitizeAttribute",q,Ae),zn=Ae.attrValue,be&&gr(/((--!?|])>)|<\/(style|title)/i,zn)){oi(ft,q);continue}if(Ae.forceKeepAttr||(oi(ft,q),!Ae.keepAttr))continue;if(!ye&&gr(/\/>/i,zn)){oi(ft,q);continue}G&&Op([B,K,Z],hu=>{zn=Hu(zn,hu," ")});const fu=bt(q.nodeName);if(He(fu,ya,zn)){if(lt&&(ya==="id"||ya==="name")&&(oi(ft,q),zn=It+zn),R&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!tr)switch(g.getAttributeType(fu,ya)){case"TrustedHTML":{zn=R.createHTML(zn);break}case"TrustedScriptURL":{zn=R.createScriptURL(zn);break}}try{tr?q.setAttributeNS(tr,ft,zn):q.setAttribute(ft,zn),T(q)?jn(q):FP(t.removed)}catch{}}}ue("afterSanitizeAttributes",q,null)},Fe=function $e(q){let me=null;const Ae=ys(q);for(ue("beforeSanitizeShadowDOM",q,null);me=Ae.nextNode();)ue("uponSanitizeShadowNode",me,null),!Oe(me)&&(me.content instanceof i&&$e(me.content),ze(me));ue("afterSanitizeShadowDOM",q,null)};return t.sanitize=function($e){let q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},me=null,Ae=null,st=null,bn=null;if(tn=!$e,tn&&($e="<!-->"),typeof $e!="string"&&!ee($e))if(typeof $e.toString=="function"){if($e=$e.toString(),typeof $e!="string")throw Wu("dirty is not a string, aborting")}else throw Wu("toString is not a function");if(!t.isSupported)return $e;if(Pe||Fo(q),t.removed=[],typeof $e=="string"&&(Ht=!1),Ht){if($e.nodeName){const po=bt($e.nodeName);if(!H[po]||de[po])throw Wu("root node is forbidden and cannot be sanitized in-place")}}else if($e instanceof a)me=bs("<!---->"),Ae=me.ownerDocument.importNode($e,!0),Ae.nodeType===qu.element&&Ae.nodeName==="BODY"||Ae.nodeName==="HTML"?me=Ae:me.appendChild(Ae);else{if(!Ue&&!G&&!_e&&$e.indexOf("<")===-1)return R&&Ie?R.createHTML($e):$e;if(me=bs($e),!me)return Ue?null:Ie?C:""}me&&Te&&jn(me.firstChild);const ft=ys(Ht?$e:me);for(;st=ft.nextNode();)Oe(st)||(st.content instanceof i&&Fe(st.content),ze(st));if(Ht)return $e;if(Ue){if(Be)for(bn=k.call(me.ownerDocument);me.firstChild;)bn.appendChild(me.firstChild);else bn=me;return(N.shadowroot||N.shadowrootmode)&&(bn=I.call(r,bn,!0)),bn}let tr=_e?me.outerHTML:me.innerHTML;return _e&&H["!doctype"]&&me.ownerDocument&&me.ownerDocument.doctype&&me.ownerDocument.doctype.name&&gr(yM,me.ownerDocument.doctype.name)&&(tr="<!DOCTYPE "+me.ownerDocument.doctype.name+`>
|
|
316
316
|
`+tr),G&&Op([B,K,Z],po=>{tr=Hu(tr,po," ")}),R&&Ie?R.createHTML(tr):tr},t.setConfig=function(){let $e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Fo($e),Pe=!0},t.clearConfig=function(){Rn=null,Pe=!1},t.isValidAttribute=function($e,q,me){Rn||Fo({});const Ae=bt($e),st=bt(q);return He(Ae,st,me)},t.addHook=function($e,q){typeof q=="function"&&(F[$e]=F[$e]||[],Vu(F[$e],q))},t.removeHook=function($e){if(F[$e])return FP(F[$e])},t.removeHooks=function($e){F[$e]&&(F[$e]=[])},t.removeAllHooks=function(){F={}},t}var UP=xM();function wM({card:e,isLoading:t}){var f,h;const n=(e==null?void 0:e.data)||[],{keys:r}=ar(n),o=ke(g=>g.selectedSheetId),i=ke(g=>g.isVisualEditing),s=(h=(f=e==null?void 0:e.preferences)==null?void 0:f.textVisualOptions)==null?void 0:h.isDynamicText,{setCardDescription:a}=Mo(),{setCard:l}=Rm();function c(){var x;if(t)return O.jsx(im,{className:"h-7 animate-pulse bg-muted"});const g=(x=n==null?void 0:n[0])==null?void 0:x[r[0]],v=UP.sanitize(g),b=O.jsx("div",{dangerouslySetInnerHTML:{__html:v}});return O.jsx("div",{className:"hover:cursor-text",onMouseDown:w=>w.stopPropagation(),children:b})}function u(){return O.jsx("div",{onMouseDown:g=>g.stopPropagation(),children:O.jsx(is,{type:"textarea",className:"w-full",text:(e==null?void 0:e.description)||"Double click to add description",onSave:g=>{i===!1&&a(o,e.id,g),i===!0&&l({...e,description:g})},children:O.jsx("div",{dangerouslySetInnerHTML:{__html:UP.sanitize((e==null?void 0:e.description)||"")}})})})}return O.jsxs("div",{className:"break-words p-6",children:[!s&&u(),s===!0&&c()]})}function Kne({frame:e,footer:t,className:n,...r}){var K,Z,z,Q;const{customCards:o}=ma(),i=m.useRef(null),s=ke(W=>W.themeStyle),a=ke(W=>W.selectedSheetId),l=ke(W=>W.selectedFrameId),c=ke(W=>W.isDashboardEditing),u=e.cards.find(W=>W.id===e.activeCardId);_Z(e,i);const{isError:f,isLoading:h,isFetching:g,cfg:v,visualKey:b,handleDatapointClick:x}=j1(u),{setCardTitle:w,setCardDescription:_,setSelectedFrameId:S}=Mo(),{setSelectedConnectionId:R,setSelectedDatabaseName:C,setSelectedSchemaName:P,setSelectedTableName:A}=Rm();function k(W){W.stopPropagation(),S(e.id),u!=null&&u.connectionId&&R(u==null?void 0:u.connectionId),u!=null&&u.lastSelectedDatabase&&C(u==null?void 0:u.lastSelectedDatabase),u!=null&&u.lastSelectedSchema&&P(u==null?void 0:u.lastSelectedSchema),u!=null&&u.lastSelectedTable&&A(u==null?void 0:u.lastSelectedTable)}function D(){if(o&&o.length>0){const W=o.find(Y=>Y.cardId===u.id);if(W&&W.replaceDefault){const Y=W.content;if(Y)return O.jsx(Y,{card:u})}}return u.type==="kpi"?O.jsx(ik,{isLoading:h||g,card:u}):u.type==="text"?O.jsx(wM,{isLoading:h||g,card:u}):B}function I(){if(f)return O.jsx("p",{className:"text-sm",children:"Oops! It seems like something went wrong. Please review your connection or filters."});if(u.type==="table"&&u.data&&u.data.length>0)return O.jsx("div",{className:"relative flex min-h-0 flex-1 grow basis-0",children:O.jsx(gM,{card:u,data:u.data})});if(o&&o.length>0){const W=o.find(Y=>Y.cardId===u.id);if(W&&W.content){const Y=W.content;return O.jsx(Y,{card:u})}}if(v)return O.jsx(y1,{cfg:v,onDatapointClick:x},b)}function F(){if(o&&o.length>0){const W=o.find(Y=>Y.cardId===u.id);if(W&&W.footer){const Y=W.footer;if(Y)return O.jsx(Y,{card:u})}}return t||null}if(!u.id)return null;const B=O.jsxs(O.Fragment,{children:[O.jsxs(sm,{className:"pb-4",children:[O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx(is,{text:u.title,onSave:W=>w(a,u.id,W),children:O.jsx(Df,{className:"text-base",children:u.title})}),(c||u.info)&&O.jsx(MZ,{card:u}),u.refreshInterval&&O.jsxs(nk,{children:[O.jsx(rk,{className:"pr-1",children:O.jsx("div",{className:Ee("h-2 w-2 rounded-full bg-green-500 transition-opacity",{"opacity-10":h||g})})}),O.jsx(N1,{side:"right",align:"center",children:O.jsx("p",{className:"text-xs",children:`Realtime (${u==null?void 0:u.refreshInterval})`})})]}),!u.refreshInterval&&(h||g)&&O.jsx(S1,{className:"h-4 w-4 animate-spin text-muted-foreground"})]}),O.jsx(is,{text:(u==null?void 0:u.description)||"",onSave:W=>_(a,u.id,W),children:O.jsxs(Sw,{children:[" ",u.description]})})]}),O.jsx(am,{className:"relative flex grow flex-col",children:I()}),O.jsx(Cw,{children:F()})]});return O.jsxs(_w,{tabIndex:-1,ref:i,role:"card-frame",onClick:k,style:{borderRadius:(Z=(K=s==null?void 0:s.chart)==null?void 0:K.options)==null?void 0:Z.borderRadius,fontFamily:(Q=(z=s==null?void 0:s.chart)==null?void 0:z.font)==null?void 0:Q.family},className:Ee("relative flex h-full flex-col rounded-sm",{"border-dashed border-foreground/50":l===e.id&&c},s==null?void 0:s.dashboardCard,n,"semaphor-card-frame"),...r,children:[O.jsx(oQ,{frame:e}),D()]})}const a_=V.forwardRef(({className:e,...t},n)=>O.jsx("textarea",{className:Ee("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}));a_.displayName="Textarea";const Ix="horizontal",Xne=["horizontal","vertical"],_M=m.forwardRef((e,t)=>{const{decorative:n,orientation:r=Ix,...o}=e,i=SM(r)?r:Ix,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return m.createElement(Qe.div,he({"data-orientation":i},a,o,{ref:t}))});_M.propTypes={orientation(e,t,n){const r=e[t],o=String(r);return r&&!SM(r)?new Error(Qne(o,n)):null}};function Qne(e,t){return`Invalid prop \`orientation\` of value \`${e}\` supplied to \`${t}\`, expected one of:
|
|
317
317
|
- horizontal
|
|
318
318
|
- vertical
|
|
@@ -422,7 +422,7 @@ You can add a description to the \`${Sc}\` by passing a \`${S5}\` component as a
|
|
|
422
422
|
|
|
423
423
|
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Sc}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
424
424
|
|
|
425
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return V.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Zpe=v5,ege=b5,P5=y5,T5=x5,D5=E5,$5=O5,A5=_5,k5=C5;const tge=Zpe,nge=ege,M5=V.forwardRef(({className:e,...t},n)=>O.jsx(P5,{className:Ee("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));M5.displayName=P5.displayName;const I5=V.forwardRef(({className:e,...t},n)=>O.jsxs(nge,{children:[O.jsx(M5,{}),O.jsx(T5,{ref:n,className:Ee("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),...t})]}));I5.displayName=T5.displayName;const N5=({className:e,...t})=>O.jsx("div",{className:Ee("flex flex-col space-y-2 text-center sm:text-left",e),...t});N5.displayName="AlertDialogHeader";const L5=({className:e,...t})=>O.jsx("div",{className:Ee("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});L5.displayName="AlertDialogFooter";const F5=V.forwardRef(({className:e,...t},n)=>O.jsx(A5,{ref:n,className:Ee("text-lg font-semibold",e),...t}));F5.displayName=A5.displayName;const j5=V.forwardRef(({className:e,...t},n)=>O.jsx(k5,{ref:n,className:Ee("text-sm text-muted-foreground",e),...t}));j5.displayName=k5.displayName;const z5=V.forwardRef(({className:e,...t},n)=>O.jsx(D5,{ref:n,className:Ee(Bd(),e),...t}));z5.displayName=D5.displayName;const B5=V.forwardRef(({className:e,...t},n)=>O.jsx($5,{ref:n,className:Ee(Bd({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));B5.displayName=$5.displayName;function rge({open:e,setOpen:t}){const n=ke(i=>i.selectedSheetId),{deleteSheet:r}=Mo();function o(){n&&(r(n),t(!1))}return O.jsx(tge,{open:e,onOpenChange:t,children:O.jsxs(I5,{children:[O.jsxs(N5,{children:[O.jsx(F5,{children:"Delete Sheet"}),O.jsx(j5,{children:"Are you sure you want to delete this sheet along with all its cards? This action cannot be undone."})]}),O.jsxs(L5,{children:[O.jsx(B5,{children:"Cancel"}),O.jsx(z5,{onClick:o,children:"Delete"})]})]})})}function V5(){var b,x;const[e,t]=m.useState(!1),n=ke(w=>{var _;return(_=w.dashboard)==null?void 0:_.sheets}),{showAssistant:r}=ma(),o=m.useRef(null),[i,s]=m.useState(!1),a=ke(w=>w.isDashboardEditing),l=ke(w=>w.themeStyle);ke(w=>w.isVisualEditing);const c=ke(w=>w.selectedSheetId),{setSelectedSheetId:u,setSheetTitle:f,addSheet:h}=Mo();if(!n)return null;function g(w){var _,S;w?((_=o.current)==null||_.resize(35),s(!0)):(s(!1),(S=o.current)==null||S.resize(0))}function v(){const w={id:la(),title:"New Sheet"};h(w)}return O.jsxs(MD,{role:"dashboard-tabs-container",className:Ee("relative flex grow",l==null?void 0:l.dashboardTabsContainer),onValueChange:w=>{u(w)},value:c||n[0].id,children:[O.jsxs(LN,{direction:"horizontal",children:[O.jsx(rw,{children:O.jsxs("div",{style:{},children:[(n.length>1||a)&&O.jsxs(Tw,{role:"tab-list",className:"flex h-11 items-center justify-start gap-2 rounded-none bg-transparent px-2.5 py-3",children:[n==null?void 0:n.map(w=>{var _,S;return O.jsx(is,{text:w.title,onSave:R=>f(w.id,R),children:O.jsxs(Dw,{style:{borderRadius:(S=(_=l==null?void 0:l.chart)==null?void 0:_.options)==null?void 0:S.borderRadius},onClick:()=>u(w.id),className:"flex items-center gap-1 rounded-none border px-2 py-1",value:w.id,children:[w.title,a&&c===w.id&&n.length>1&&O.jsx(Pm,{className:"ml-1 size-3",onClick:()=>t(!0)})]})},w.id)}),a&&O.jsx("div",{style:{borderRadius:(x=(b=l==null?void 0:l.chart)==null?void 0:b.options)==null?void 0:x.borderRadius},className:"flex h-7 items-center justify-center border-none bg-muted p-2 hover:cursor-pointer dark:border-l-background",onClick:v,children:O.jsx(C1,{className:"size-3"})})]}),n==null?void 0:n.map(w=>O.jsx($w,{className:Ee("mt-0",{"bg-muted":(l==null?void 0:l.canvasTheme)==="muted"||!(l!=null&&l.canvasTheme)}),value:w.id,children:O.jsx(Sae,{})},w.id))]})}),r===!0&&O.jsxs(O.Fragment,{children:[O.jsx(Fhe,{open:i,onTabClick:g,withHandle:!0}),O.jsx(rw,{onResize:w=>{w<1?s(!1):i||s(!0)},defaultSize:0,ref:o,children:O.jsx(vhe,{})})]})]}),O.jsx(rge,{open:e,setOpen:t})]})}function H5({children:e}){return O.jsx(gB,{defaultTheme:"system",storageKey:"vite-ui-theme",children:O.jsx(RJ,{delayDuration:0,children:e})})}function W5(e){return O.jsx(lk,{dashboardProps:e,children:O.jsx(H5,{children:O.jsx(_D,{...e,children:O.jsx(V5,{})})})})}const U5=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(ige);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(sw,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(sw,he({},r,{ref:t}),n)});U5.displayName="Slot";const sw=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...sge(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});sw.displayName="SlotClone";const oge=({children:e})=>m.createElement(m.Fragment,null,e);function ige(e){return m.isValidElement(e)&&e.type===oge}function sge(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const aw=["Enter"," "],age=["ArrowDown","PageUp","Home"],q5=["ArrowUp","PageDown","End"],lge=[...age,...q5],cge={ltr:[...aw,"ArrowRight"],rtl:[...aw,"ArrowLeft"]},uge={ltr:["ArrowLeft"],rtl:["ArrowRight"]},av="Menu",[df,dge,fge]=lm(av),[Al,G5]=Zn(av,[fge,Ti,ou]),oS=Ti(),Y5=ou(),[hge,kl]=Al(av),[pge,Zf]=Al(av),gge=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,a=oS(t),[l,c]=m.useState(null),u=m.useRef(!1),f=Ln(i),h=_l(o);return m.useEffect(()=>{const g=()=>{u.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>u.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),m.createElement(zf,a,m.createElement(hge,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:c},m.createElement(pge,{scope:t,onClose:m.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:h,modal:s},r)))},K5=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=oS(n);return m.createElement(Bf,he({},o,r,{ref:t}))}),X5="MenuPortal",[mge,Q5]=Al(X5,{forceMount:void 0}),vge=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=kl(X5,t);return m.createElement(mge,{scope:t,forceMount:n},m.createElement(er,{present:n||i.open},m.createElement(A1,{asChild:!0,container:o},r)))},Qo="MenuContent",[bge,iS]=Al(Qo),yge=m.forwardRef((e,t)=>{const n=Q5(Qo,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=kl(Qo,e.__scopeMenu),s=Zf(Qo,e.__scopeMenu);return m.createElement(df.Provider,{scope:e.__scopeMenu},m.createElement(er,{present:r||i.open},m.createElement(df.Slot,{scope:e.__scopeMenu},s.modal?m.createElement(xge,he({},o,{ref:t})):m.createElement(wge,he({},o,{ref:t})))))}),xge=m.forwardRef((e,t)=>{const n=kl(Qo,e.__scopeMenu),r=m.useRef(null),o=_t(t,r);return m.useEffect(()=>{const i=r.current;if(i)return Nm(i)},[]),m.createElement(sS,he({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Me(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))}),wge=m.forwardRef((e,t)=>{const n=kl(Qo,e.__scopeMenu);return m.createElement(sS,he({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))}),sS=m.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:g,disableOutsideScroll:v,...b}=e,x=kl(Qo,n),w=Zf(Qo,n),_=oS(n),S=Y5(n),R=dge(n),[C,P]=m.useState(null),A=m.useRef(null),k=_t(t,A,x.onContentChange),D=m.useRef(0),I=m.useRef(""),F=m.useRef(0),B=m.useRef(null),K=m.useRef("right"),Z=m.useRef(0),z=v?t_:m.Fragment,Q=v?{as:U5,allowPinchZoom:!0}:void 0,W=oe=>{var $,H;const J=I.current+oe,N=R().filter(te=>!te.disabled),ce=document.activeElement,le=($=N.find(te=>te.ref.current===ce))===null||$===void 0?void 0:$.textValue,de=N.map(te=>te.textValue),pe=zge(de,J,le),ie=(H=N.find(te=>te.textValue===pe))===null||H===void 0?void 0:H.ref.current;(function te(ae){I.current=ae,window.clearTimeout(D.current),ae!==""&&(D.current=window.setTimeout(()=>te(""),1e3))})(J),ie&&setTimeout(()=>ie.focus())};m.useEffect(()=>()=>window.clearTimeout(D.current),[]),Q1();const Y=m.useCallback(oe=>{var $,H;return K.current===(($=B.current)===null||$===void 0?void 0:$.side)&&Vge(oe,(H=B.current)===null||H===void 0?void 0:H.area)},[]);return m.createElement(bge,{scope:n,searchRef:I,onItemEnter:m.useCallback(oe=>{Y(oe)&&oe.preventDefault()},[Y]),onItemLeave:m.useCallback(oe=>{var $;Y(oe)||(($=A.current)===null||$===void 0||$.focus(),P(null))},[Y]),onTriggerLeave:m.useCallback(oe=>{Y(oe)&&oe.preventDefault()},[Y]),pointerGraceTimerRef:F,onPointerGraceIntentChange:m.useCallback(oe=>{B.current=oe},[])},m.createElement(z,Q,m.createElement(J1,{asChild:!0,trapped:o,onMountAutoFocus:Me(i,oe=>{var $;oe.preventDefault(),($=A.current)===null||$===void 0||$.focus()}),onUnmountAutoFocus:s},m.createElement(Ff,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:g},m.createElement(Rw,he({asChild:!0},S,{dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:P,onEntryFocus:Me(l,oe=>{w.isUsingKeyboardRef.current||oe.preventDefault()})}),m.createElement(Vf,he({role:"menu","aria-orientation":"vertical","data-state":nL(x.open),"data-radix-menu-content":"",dir:w.dir},_,b,{ref:k,style:{outline:"none",...b.style},onKeyDown:Me(b.onKeyDown,oe=>{const H=oe.target.closest("[data-radix-menu-content]")===oe.currentTarget,J=oe.ctrlKey||oe.altKey||oe.metaKey,N=oe.key.length===1;H&&(oe.key==="Tab"&&oe.preventDefault(),!J&&N&&W(oe.key));const ce=A.current;if(oe.target!==ce||!lge.includes(oe.key))return;oe.preventDefault();const de=R().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);q5.includes(oe.key)&&de.reverse(),Fge(de)}),onBlur:Me(e.onBlur,oe=>{oe.currentTarget.contains(oe.target)||(window.clearTimeout(D.current),I.current="")}),onPointerMove:Me(e.onPointerMove,ff(oe=>{const $=oe.target,H=Z.current!==oe.clientX;if(oe.currentTarget.contains($)&&H){const J=oe.clientX>Z.current?"right":"left";K.current=J,Z.current=oe.clientX}}))})))))))}),_ge=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Qe.div,he({role:"group"},r,{ref:t}))}),Sge=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Qe.div,he({},r,{ref:t}))}),lw="MenuItem",C2="menu.itemSelect",aS=m.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=m.useRef(null),s=Zf(lw,e.__scopeMenu),a=iS(lw,e.__scopeMenu),l=_t(t,i),c=m.useRef(!1),u=()=>{const f=i.current;if(!n&&f){const h=new CustomEvent(C2,{bubbles:!0,cancelable:!0});f.addEventListener(C2,g=>r==null?void 0:r(g),{once:!0}),CD(f,h),h.defaultPrevented?c.current=!1:s.onClose()}};return m.createElement(J5,he({},o,{ref:l,disabled:n,onClick:Me(e.onClick,u),onPointerDown:f=>{var h;(h=e.onPointerDown)===null||h===void 0||h.call(e,f),c.current=!0},onPointerUp:Me(e.onPointerUp,f=>{var h;c.current||(h=f.currentTarget)===null||h===void 0||h.click()}),onKeyDown:Me(e.onKeyDown,f=>{const h=a.searchRef.current!=="";n||h&&f.key===" "||aw.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})}))}),J5=m.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=iS(lw,n),a=Y5(n),l=m.useRef(null),c=_t(t,l),[u,f]=m.useState(!1),[h,g]=m.useState("");return m.useEffect(()=>{const v=l.current;if(v){var b;g(((b=v.textContent)!==null&&b!==void 0?b:"").trim())}},[i.children]),m.createElement(df.ItemSlot,{scope:n,disabled:r,textValue:o??h},m.createElement(Ow,he({asChild:!0},a,{focusable:!r}),m.createElement(Qe.div,he({role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},i,{ref:c,onPointerMove:Me(e.onPointerMove,ff(v=>{r?s.onItemLeave(v):(s.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus())})),onPointerLeave:Me(e.onPointerLeave,ff(v=>s.onItemLeave(v))),onFocus:Me(e.onFocus,()=>f(!0)),onBlur:Me(e.onBlur,()=>f(!1))}))))}),Cge=m.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return m.createElement(eL,{scope:e.__scopeMenu,checked:n},m.createElement(aS,he({role:"menuitemcheckbox","aria-checked":Xg(n)?"mixed":n},o,{ref:t,"data-state":lS(n),onSelect:Me(o.onSelect,()=>r==null?void 0:r(Xg(n)?!0:!n),{checkForDefaultPrevented:!1})})))}),Ege="MenuRadioGroup",[Rge,Oge]=Al(Ege,{value:void 0,onValueChange:()=>{}}),Pge=m.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=Ln(r);return m.createElement(Rge,{scope:e.__scopeMenu,value:n,onValueChange:i},m.createElement(_ge,he({},o,{ref:t})))}),Tge="MenuRadioItem",Dge=m.forwardRef((e,t)=>{const{value:n,...r}=e,o=Oge(Tge,e.__scopeMenu),i=n===o.value;return m.createElement(eL,{scope:e.__scopeMenu,checked:i},m.createElement(aS,he({role:"menuitemradio","aria-checked":i},r,{ref:t,"data-state":lS(i),onSelect:Me(r.onSelect,()=>{var s;return(s=o.onValueChange)===null||s===void 0?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})))}),Z5="MenuItemIndicator",[eL,$ge]=Al(Z5,{checked:!1}),Age=m.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=$ge(Z5,n);return m.createElement(er,{present:r||Xg(i.checked)||i.checked===!0},m.createElement(Qe.span,he({},o,{ref:t,"data-state":lS(i.checked)})))}),kge=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Qe.div,he({role:"separator","aria-orientation":"horizontal"},r,{ref:t}))}),Mge="MenuSub",[wye,tL]=Al(Mge),Vp="MenuSubTrigger",Ige=m.forwardRef((e,t)=>{const n=kl(Vp,e.__scopeMenu),r=Zf(Vp,e.__scopeMenu),o=tL(Vp,e.__scopeMenu),i=iS(Vp,e.__scopeMenu),s=m.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:e.__scopeMenu},u=m.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return m.useEffect(()=>u,[u]),m.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),l(null)}},[a,l]),m.createElement(K5,he({asChild:!0},c),m.createElement(J5,he({id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":nL(n.open)},e,{ref:cs(t,o.onTriggerChange),onClick:f=>{var h;(h=e.onClick)===null||h===void 0||h.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Me(e.onPointerMove,ff(f=>{i.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:Me(e.onPointerLeave,ff(f=>{var h;u();const g=(h=n.content)===null||h===void 0?void 0:h.getBoundingClientRect();if(g){var v;const b=(v=n.content)===null||v===void 0?void 0:v.dataset.side,x=b==="right",w=x?-5:5,_=g[x?"left":"right"],S=g[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+w,y:f.clientY},{x:_,y:g.top},{x:S,y:g.top},{x:S,y:g.bottom},{x:_,y:g.bottom}],side:b}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(f),f.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Me(e.onKeyDown,f=>{const h=i.searchRef.current!=="";if(!(e.disabled||h&&f.key===" ")&&cge[r.dir].includes(f.key)){var g;n.onOpenChange(!0),(g=n.content)===null||g===void 0||g.focus(),f.preventDefault()}})})))}),Nge="MenuSubContent",Lge=m.forwardRef((e,t)=>{const n=Q5(Qo,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=kl(Qo,e.__scopeMenu),s=Zf(Qo,e.__scopeMenu),a=tL(Nge,e.__scopeMenu),l=m.useRef(null),c=_t(t,l);return m.createElement(df.Provider,{scope:e.__scopeMenu},m.createElement(er,{present:r||i.open},m.createElement(df.Slot,{scope:e.__scopeMenu},m.createElement(sS,he({id:a.contentId,"aria-labelledby":a.triggerId},o,{ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var f;s.isUsingKeyboardRef.current&&((f=l.current)===null||f===void 0||f.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Me(e.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Me(e.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:Me(e.onKeyDown,u=>{const f=u.currentTarget.contains(u.target),h=uge[s.dir].includes(u.key);if(f&&h){var g;i.onOpenChange(!1),(g=a.trigger)===null||g===void 0||g.focus(),u.preventDefault()}})})))))});function nL(e){return e?"open":"closed"}function Xg(e){return e==="indeterminate"}function lS(e){return Xg(e)?"indeterminate":e?"checked":"unchecked"}function Fge(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function jge(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function zge(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=jge(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function Bge(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function Vge(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Bge(n,t)}function ff(e){return t=>t.pointerType==="mouse"?e(t):void 0}const Hge=gge,Wge=K5,Uge=vge,qge=yge,Gge=Sge,Yge=aS,Kge=Cge,Xge=Pge,Qge=Dge,Jge=Age,Zge=kge,eme=Ige,tme=Lge,rL="DropdownMenu",[nme,_ye]=Zn(rL,[G5]),ho=G5(),[rme,oL]=nme(rL),ome=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=e,l=ho(t),c=m.useRef(null),[u=!1,f]=xr({prop:o,defaultProp:i,onChange:s});return m.createElement(rme,{scope:t,triggerId:Jo(),triggerRef:c,contentId:Jo(),open:u,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(h=>!h),[f]),modal:a},m.createElement(Hge,he({},l,{open:u,onOpenChange:f,dir:r,modal:a}),n))},ime="DropdownMenuTrigger",sme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=oL(ime,n),s=ho(n);return m.createElement(Wge,he({asChild:!0},s),m.createElement(Qe.button,he({type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r},o,{ref:cs(t,i.triggerRef),onPointerDown:Me(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:Me(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})))}),ame=e=>{const{__scopeDropdownMenu:t,...n}=e,r=ho(t);return m.createElement(Uge,he({},r,n))},lme="DropdownMenuContent",cme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=oL(lme,n),i=ho(n),s=m.useRef(!1);return m.createElement(qge,he({id:o.contentId,"aria-labelledby":o.triggerId},i,r,{ref:t,onCloseAutoFocus:Me(e.onCloseAutoFocus,a=>{var l;s.current||(l=o.triggerRef.current)===null||l===void 0||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:Me(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!o.modal||u)&&(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)"}}))}),ume=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Gge,he({},o,r,{ref:t}))}),dme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Yge,he({},o,r,{ref:t}))}),fme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Kge,he({},o,r,{ref:t}))}),hme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Xge,he({},o,r,{ref:t}))}),pme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Qge,he({},o,r,{ref:t}))}),gme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Jge,he({},o,r,{ref:t}))}),mme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Zge,he({},o,r,{ref:t}))}),vme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(eme,he({},o,r,{ref:t}))}),bme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(tme,he({},o,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)"}}))}),yme=ome,xme=sme,wme=ame,iL=cme,sL=ume,aL=dme,lL=fme,_me=hme,cL=pme,uL=gme,dL=mme,fL=vme,hL=bme,Sme=yme,Cme=xme,Eme=_me,Rme=V.forwardRef(({className:e,inset:t,children:n,...r},o)=>O.jsxs(fL,{ref:o,className:Ee("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,O.jsx(_1,{className:"ml-auto h-4 w-4"})]}));Rme.displayName=fL.displayName;const Ome=V.forwardRef(({className:e,...t},n)=>O.jsx(hL,{ref:n,className:Ee("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}));Ome.displayName=hL.displayName;const pL=V.forwardRef(({className:e,sideOffset:t=4,...n},r)=>O.jsx(wme,{children:O.jsx(iL,{ref:r,sideOffset:t,className:Ee("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})}));pL.displayName=iL.displayName;const Pme=V.forwardRef(({className:e,inset:t,...n},r)=>O.jsx(aL,{ref:r,className:Ee("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}));Pme.displayName=aL.displayName;const Tme=V.forwardRef(({className:e,children:t,checked:n,...r},o)=>O.jsxs(lL,{ref:o,className:Ee("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:[O.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:O.jsx(uL,{children:O.jsx(Lf,{className:"h-4 w-4"})})}),t]}));Tme.displayName=lL.displayName;const gL=V.forwardRef(({className:e,children:t,...n},r)=>O.jsxs(cL,{ref:r,className:Ee("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:[O.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:O.jsx(uL,{children:O.jsx(MA,{className:"h-2 w-2 fill-current"})})}),t]}));gL.displayName=cL.displayName;const mL=V.forwardRef(({className:e,inset:t,...n},r)=>O.jsx(sL,{ref:r,className:Ee("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));mL.displayName=sL.displayName;const vL=V.forwardRef(({className:e,...t},n)=>O.jsx(dL,{ref:n,className:Ee("-mx-1 my-1 h-px bg-muted",e),...t}));vL.displayName=dL.displayName;function Dme(e){var t;return{...e,sheets:(t=e==null?void 0:e.sheets)==null?void 0:t.map(n=>{var r;return{...n,frames:(r=n.frames)==null?void 0:r.map(o=>{var i;return{...o,cards:(i=o.cards)==null?void 0:i.map(s=>bL(s))}})}})}}function bL(e){var t,n,r,o;return{...e,cfg:{...e.cfg,data:{...(t=e.cfg)==null?void 0:t.data,labels:[],datasets:(o=(r=(n=e.cfg)==null?void 0:n.data)==null?void 0:r.datasets)==null?void 0:o.map(i=>({...i,data:[]}))}},customCfg:$me(e.customCfg),data:[]}}function $me(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 yL(e){return`semaphor:bookmark:${e}`}const Ame=h5,kme=p5,Mme=g5,xL=V.forwardRef(({className:e,...t},n)=>O.jsx(Z_,{ref:n,className:Ee("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}));xL.displayName=Z_.displayName;const wL=V.forwardRef(({className:e,children:t,...n},r)=>O.jsxs(Mme,{children:[O.jsx(xL,{}),O.jsxs(eS,{ref:r,className:Ee("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,O.jsxs(rS,{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:[O.jsx(Pm,{className:"h-4 w-4"}),O.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));wL.displayName=eS.displayName;const _L=({className:e,...t})=>O.jsx("div",{className:Ee("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});_L.displayName="DialogHeader";const SL=({className:e,...t})=>O.jsx("div",{className:Ee("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});SL.displayName="DialogFooter";const CL=V.forwardRef(({className:e,...t},n)=>O.jsx(tS,{ref:n,className:Ee("text-lg font-semibold leading-none tracking-tight",e),...t}));CL.displayName=tS.displayName;const EL=V.forwardRef(({className:e,...t},n)=>O.jsx(nS,{ref:n,className:Ee("text-sm text-muted-foreground",e),...t}));EL.displayName=nS.displayName;const RL="Checkbox",[Ime,Sye]=Zn(RL),[Nme,Lme]=Ime(RL),Fme=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,...u}=e,[f,h]=m.useState(null),g=_t(t,S=>h(S)),v=m.useRef(!1),b=f?!!f.closest("form"):!0,[x=!1,w]=xr({prop:o,defaultProp:i,onChange:c}),_=m.useRef(x);return m.useEffect(()=>{const S=f==null?void 0:f.form;if(S){const R=()=>w(_.current);return S.addEventListener("reset",R),()=>S.removeEventListener("reset",R)}},[f,w]),m.createElement(Nme,{scope:n,state:x,disabled:a},m.createElement(Qe.button,he({type:"button",role:"checkbox","aria-checked":dl(x)?"mixed":x,"aria-required":s,"data-state":OL(x),"data-disabled":a?"":void 0,disabled:a,value:l},u,{ref:g,onKeyDown:Me(e.onKeyDown,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Me(e.onClick,S=>{w(R=>dl(R)?!0:!R),b&&(v.current=S.isPropagationStopped(),v.current||S.stopPropagation())})})),b&&m.createElement(Bme,{control:f,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,style:{transform:"translateX(-100%)"}}))}),jme="CheckboxIndicator",zme=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=Lme(jme,n);return m.createElement(er,{present:r||dl(i.state)||i.state===!0},m.createElement(Qe.span,he({"data-state":OL(i.state),"data-disabled":i.disabled?"":void 0},o,{ref:t,style:{pointerEvents:"none",...e.style}})))}),Bme=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=m.useRef(null),s=Im(n),a=$m(t);return m.useEffect(()=>{const l=i.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});l.indeterminate=dl(n),f.call(l,dl(n)?!1:n),l.dispatchEvent(h)}},[s,n,r]),m.createElement("input",he({type:"checkbox","aria-hidden":!0,defaultChecked:dl(n)?!1:n},o,{tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function dl(e){return e==="indeterminate"}function OL(e){return dl(e)?"indeterminate":e?"checked":"unchecked"}const PL=Fme,Vme=zme,TL=V.forwardRef(({className:e,...t},n)=>O.jsx(PL,{ref:n,className:Ee("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:O.jsx(Vme,{className:Ee("flex items-center justify-center text-current"),children:O.jsx(Lf,{className:"h-4 w-4"})})}));TL.displayName=PL.displayName;const DL=m.forwardRef(({className:e,...t},n)=>O.jsx("div",{role:"editor-panel",ref:n,className:Ee("flex grow h-full",e),...t}));DL.displayName="EditorPanel";const $L=m.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee(" flex flex-col space-y-2 w-[270px]",e),...t}));$L.displayName="EditorAside";const AL=m.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee(" grow",e),...t}));AL.displayName="EditorMain";function Hme(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function R2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?E2(Object(n),!0).forEach(function(r){Hme(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Wme(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function Ume(e,t){if(e==null)return{};var n=Wme(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function qme(e,t){return Gme(e)||Yme(e,t)||Kme(e,t)||Xme()}function Gme(e){if(Array.isArray(e))return e}function Yme(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,o=!1,i=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){o=!0,i=l}finally{try{!r&&s.return!=null&&s.return()}finally{if(o)throw i}}return n}}function Kme(e,t){if(e){if(typeof e=="string")return O2(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 O2(e,t)}}function O2(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 Xme(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
425
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return V.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Zpe=v5,ege=b5,P5=y5,T5=x5,D5=E5,$5=O5,A5=_5,k5=C5;const tge=Zpe,nge=ege,M5=V.forwardRef(({className:e,...t},n)=>O.jsx(P5,{className:Ee("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));M5.displayName=P5.displayName;const I5=V.forwardRef(({className:e,...t},n)=>O.jsx(nge,{children:O.jsxs("div",{id:"semaphor-scope",children:[O.jsx(M5,{}),O.jsx(T5,{ref:n,className:Ee("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),...t})]})}));I5.displayName=T5.displayName;const N5=({className:e,...t})=>O.jsx("div",{className:Ee("flex flex-col space-y-2 text-center sm:text-left",e),...t});N5.displayName="AlertDialogHeader";const L5=({className:e,...t})=>O.jsx("div",{className:Ee("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});L5.displayName="AlertDialogFooter";const F5=V.forwardRef(({className:e,...t},n)=>O.jsx(A5,{ref:n,className:Ee("text-lg font-semibold",e),...t}));F5.displayName=A5.displayName;const j5=V.forwardRef(({className:e,...t},n)=>O.jsx(k5,{ref:n,className:Ee("text-sm text-muted-foreground",e),...t}));j5.displayName=k5.displayName;const z5=V.forwardRef(({className:e,...t},n)=>O.jsx(D5,{ref:n,className:Ee(Bd(),e),...t}));z5.displayName=D5.displayName;const B5=V.forwardRef(({className:e,...t},n)=>O.jsx($5,{ref:n,className:Ee(Bd({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));B5.displayName=$5.displayName;function rge({open:e,setOpen:t}){const n=ke(i=>i.selectedSheetId),{deleteSheet:r}=Mo();function o(){n&&(r(n),t(!1))}return O.jsx(tge,{open:e,onOpenChange:t,children:O.jsxs(I5,{children:[O.jsxs(N5,{children:[O.jsx(F5,{children:"Delete Sheet"}),O.jsx(j5,{children:"Are you sure you want to delete this sheet along with all its cards? This action cannot be undone."})]}),O.jsxs(L5,{children:[O.jsx(B5,{children:"Cancel"}),O.jsx(z5,{onClick:o,children:"Delete"})]})]})})}function V5(){var b,x;const[e,t]=m.useState(!1),n=ke(w=>{var _;return(_=w.dashboard)==null?void 0:_.sheets}),{showAssistant:r}=ma(),o=m.useRef(null),[i,s]=m.useState(!1),a=ke(w=>w.isDashboardEditing),l=ke(w=>w.themeStyle);ke(w=>w.isVisualEditing);const c=ke(w=>w.selectedSheetId),{setSelectedSheetId:u,setSheetTitle:f,addSheet:h}=Mo();if(!n)return null;function g(w){var _,S;w?((_=o.current)==null||_.resize(35),s(!0)):(s(!1),(S=o.current)==null||S.resize(0))}function v(){const w={id:la(),title:"New Sheet"};h(w)}return O.jsxs(MD,{role:"dashboard-tabs-container",className:Ee("relative flex grow",l==null?void 0:l.dashboardTabsContainer),onValueChange:w=>{u(w)},value:c||n[0].id,children:[O.jsxs(LN,{direction:"horizontal",children:[O.jsx(rw,{children:O.jsxs("div",{style:{},children:[(n.length>1||a)&&O.jsxs(Tw,{role:"tab-list",className:"flex h-11 items-center justify-start gap-2 rounded-none bg-transparent px-2.5 py-3",children:[n==null?void 0:n.map(w=>{var _,S;return O.jsx(is,{text:w.title,onSave:R=>f(w.id,R),children:O.jsxs(Dw,{style:{borderRadius:(S=(_=l==null?void 0:l.chart)==null?void 0:_.options)==null?void 0:S.borderRadius},onClick:()=>u(w.id),className:"flex items-center gap-1 rounded-none border px-2 py-1",value:w.id,children:[w.title,a&&c===w.id&&n.length>1&&O.jsx(Pm,{className:"ml-1 size-3",onClick:()=>t(!0)})]})},w.id)}),a&&O.jsx("div",{style:{borderRadius:(x=(b=l==null?void 0:l.chart)==null?void 0:b.options)==null?void 0:x.borderRadius},className:"flex h-7 items-center justify-center border-none bg-muted p-2 hover:cursor-pointer dark:border-l-background",onClick:v,children:O.jsx(C1,{className:"size-3"})})]}),n==null?void 0:n.map(w=>O.jsx($w,{className:Ee("mt-0",{"bg-muted":(l==null?void 0:l.canvasTheme)==="muted"||!(l!=null&&l.canvasTheme)}),value:w.id,children:O.jsx(Sae,{})},w.id))]})}),r===!0&&O.jsxs(O.Fragment,{children:[O.jsx(Fhe,{open:i,onTabClick:g,withHandle:!0}),O.jsx(rw,{onResize:w=>{w<1?s(!1):i||s(!0)},defaultSize:0,ref:o,children:O.jsx(vhe,{})})]})]}),O.jsx(rge,{open:e,setOpen:t})]})}function H5({children:e}){return O.jsx(gB,{defaultTheme:"system",storageKey:"vite-ui-theme",children:O.jsx(RJ,{delayDuration:0,children:e})})}function W5(e){return O.jsx(lk,{dashboardProps:e,children:O.jsx(H5,{children:O.jsx(_D,{...e,children:O.jsx(V5,{})})})})}const U5=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(ige);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(sw,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(sw,he({},r,{ref:t}),n)});U5.displayName="Slot";const sw=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...sge(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});sw.displayName="SlotClone";const oge=({children:e})=>m.createElement(m.Fragment,null,e);function ige(e){return m.isValidElement(e)&&e.type===oge}function sge(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const aw=["Enter"," "],age=["ArrowDown","PageUp","Home"],q5=["ArrowUp","PageDown","End"],lge=[...age,...q5],cge={ltr:[...aw,"ArrowRight"],rtl:[...aw,"ArrowLeft"]},uge={ltr:["ArrowLeft"],rtl:["ArrowRight"]},av="Menu",[df,dge,fge]=lm(av),[Al,G5]=Zn(av,[fge,Ti,ou]),oS=Ti(),Y5=ou(),[hge,kl]=Al(av),[pge,Zf]=Al(av),gge=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,a=oS(t),[l,c]=m.useState(null),u=m.useRef(!1),f=Ln(i),h=_l(o);return m.useEffect(()=>{const g=()=>{u.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>u.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),m.createElement(zf,a,m.createElement(hge,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:c},m.createElement(pge,{scope:t,onClose:m.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:h,modal:s},r)))},K5=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=oS(n);return m.createElement(Bf,he({},o,r,{ref:t}))}),X5="MenuPortal",[mge,Q5]=Al(X5,{forceMount:void 0}),vge=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=kl(X5,t);return m.createElement(mge,{scope:t,forceMount:n},m.createElement(er,{present:n||i.open},m.createElement(A1,{asChild:!0,container:o},r)))},Qo="MenuContent",[bge,iS]=Al(Qo),yge=m.forwardRef((e,t)=>{const n=Q5(Qo,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=kl(Qo,e.__scopeMenu),s=Zf(Qo,e.__scopeMenu);return m.createElement(df.Provider,{scope:e.__scopeMenu},m.createElement(er,{present:r||i.open},m.createElement(df.Slot,{scope:e.__scopeMenu},s.modal?m.createElement(xge,he({},o,{ref:t})):m.createElement(wge,he({},o,{ref:t})))))}),xge=m.forwardRef((e,t)=>{const n=kl(Qo,e.__scopeMenu),r=m.useRef(null),o=_t(t,r);return m.useEffect(()=>{const i=r.current;if(i)return Nm(i)},[]),m.createElement(sS,he({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Me(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))}),wge=m.forwardRef((e,t)=>{const n=kl(Qo,e.__scopeMenu);return m.createElement(sS,he({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))}),sS=m.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:g,disableOutsideScroll:v,...b}=e,x=kl(Qo,n),w=Zf(Qo,n),_=oS(n),S=Y5(n),R=dge(n),[C,P]=m.useState(null),A=m.useRef(null),k=_t(t,A,x.onContentChange),D=m.useRef(0),I=m.useRef(""),F=m.useRef(0),B=m.useRef(null),K=m.useRef("right"),Z=m.useRef(0),z=v?t_:m.Fragment,Q=v?{as:U5,allowPinchZoom:!0}:void 0,W=oe=>{var $,H;const J=I.current+oe,N=R().filter(te=>!te.disabled),ce=document.activeElement,le=($=N.find(te=>te.ref.current===ce))===null||$===void 0?void 0:$.textValue,de=N.map(te=>te.textValue),pe=zge(de,J,le),ie=(H=N.find(te=>te.textValue===pe))===null||H===void 0?void 0:H.ref.current;(function te(ae){I.current=ae,window.clearTimeout(D.current),ae!==""&&(D.current=window.setTimeout(()=>te(""),1e3))})(J),ie&&setTimeout(()=>ie.focus())};m.useEffect(()=>()=>window.clearTimeout(D.current),[]),Q1();const Y=m.useCallback(oe=>{var $,H;return K.current===(($=B.current)===null||$===void 0?void 0:$.side)&&Vge(oe,(H=B.current)===null||H===void 0?void 0:H.area)},[]);return m.createElement(bge,{scope:n,searchRef:I,onItemEnter:m.useCallback(oe=>{Y(oe)&&oe.preventDefault()},[Y]),onItemLeave:m.useCallback(oe=>{var $;Y(oe)||(($=A.current)===null||$===void 0||$.focus(),P(null))},[Y]),onTriggerLeave:m.useCallback(oe=>{Y(oe)&&oe.preventDefault()},[Y]),pointerGraceTimerRef:F,onPointerGraceIntentChange:m.useCallback(oe=>{B.current=oe},[])},m.createElement(z,Q,m.createElement(J1,{asChild:!0,trapped:o,onMountAutoFocus:Me(i,oe=>{var $;oe.preventDefault(),($=A.current)===null||$===void 0||$.focus()}),onUnmountAutoFocus:s},m.createElement(Ff,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:g},m.createElement(Rw,he({asChild:!0},S,{dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:P,onEntryFocus:Me(l,oe=>{w.isUsingKeyboardRef.current||oe.preventDefault()})}),m.createElement(Vf,he({role:"menu","aria-orientation":"vertical","data-state":nL(x.open),"data-radix-menu-content":"",dir:w.dir},_,b,{ref:k,style:{outline:"none",...b.style},onKeyDown:Me(b.onKeyDown,oe=>{const H=oe.target.closest("[data-radix-menu-content]")===oe.currentTarget,J=oe.ctrlKey||oe.altKey||oe.metaKey,N=oe.key.length===1;H&&(oe.key==="Tab"&&oe.preventDefault(),!J&&N&&W(oe.key));const ce=A.current;if(oe.target!==ce||!lge.includes(oe.key))return;oe.preventDefault();const de=R().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);q5.includes(oe.key)&&de.reverse(),Fge(de)}),onBlur:Me(e.onBlur,oe=>{oe.currentTarget.contains(oe.target)||(window.clearTimeout(D.current),I.current="")}),onPointerMove:Me(e.onPointerMove,ff(oe=>{const $=oe.target,H=Z.current!==oe.clientX;if(oe.currentTarget.contains($)&&H){const J=oe.clientX>Z.current?"right":"left";K.current=J,Z.current=oe.clientX}}))})))))))}),_ge=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Qe.div,he({role:"group"},r,{ref:t}))}),Sge=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Qe.div,he({},r,{ref:t}))}),lw="MenuItem",C2="menu.itemSelect",aS=m.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=m.useRef(null),s=Zf(lw,e.__scopeMenu),a=iS(lw,e.__scopeMenu),l=_t(t,i),c=m.useRef(!1),u=()=>{const f=i.current;if(!n&&f){const h=new CustomEvent(C2,{bubbles:!0,cancelable:!0});f.addEventListener(C2,g=>r==null?void 0:r(g),{once:!0}),CD(f,h),h.defaultPrevented?c.current=!1:s.onClose()}};return m.createElement(J5,he({},o,{ref:l,disabled:n,onClick:Me(e.onClick,u),onPointerDown:f=>{var h;(h=e.onPointerDown)===null||h===void 0||h.call(e,f),c.current=!0},onPointerUp:Me(e.onPointerUp,f=>{var h;c.current||(h=f.currentTarget)===null||h===void 0||h.click()}),onKeyDown:Me(e.onKeyDown,f=>{const h=a.searchRef.current!=="";n||h&&f.key===" "||aw.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})}))}),J5=m.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=iS(lw,n),a=Y5(n),l=m.useRef(null),c=_t(t,l),[u,f]=m.useState(!1),[h,g]=m.useState("");return m.useEffect(()=>{const v=l.current;if(v){var b;g(((b=v.textContent)!==null&&b!==void 0?b:"").trim())}},[i.children]),m.createElement(df.ItemSlot,{scope:n,disabled:r,textValue:o??h},m.createElement(Ow,he({asChild:!0},a,{focusable:!r}),m.createElement(Qe.div,he({role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},i,{ref:c,onPointerMove:Me(e.onPointerMove,ff(v=>{r?s.onItemLeave(v):(s.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus())})),onPointerLeave:Me(e.onPointerLeave,ff(v=>s.onItemLeave(v))),onFocus:Me(e.onFocus,()=>f(!0)),onBlur:Me(e.onBlur,()=>f(!1))}))))}),Cge=m.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return m.createElement(eL,{scope:e.__scopeMenu,checked:n},m.createElement(aS,he({role:"menuitemcheckbox","aria-checked":Xg(n)?"mixed":n},o,{ref:t,"data-state":lS(n),onSelect:Me(o.onSelect,()=>r==null?void 0:r(Xg(n)?!0:!n),{checkForDefaultPrevented:!1})})))}),Ege="MenuRadioGroup",[Rge,Oge]=Al(Ege,{value:void 0,onValueChange:()=>{}}),Pge=m.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=Ln(r);return m.createElement(Rge,{scope:e.__scopeMenu,value:n,onValueChange:i},m.createElement(_ge,he({},o,{ref:t})))}),Tge="MenuRadioItem",Dge=m.forwardRef((e,t)=>{const{value:n,...r}=e,o=Oge(Tge,e.__scopeMenu),i=n===o.value;return m.createElement(eL,{scope:e.__scopeMenu,checked:i},m.createElement(aS,he({role:"menuitemradio","aria-checked":i},r,{ref:t,"data-state":lS(i),onSelect:Me(r.onSelect,()=>{var s;return(s=o.onValueChange)===null||s===void 0?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})))}),Z5="MenuItemIndicator",[eL,$ge]=Al(Z5,{checked:!1}),Age=m.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=$ge(Z5,n);return m.createElement(er,{present:r||Xg(i.checked)||i.checked===!0},m.createElement(Qe.span,he({},o,{ref:t,"data-state":lS(i.checked)})))}),kge=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Qe.div,he({role:"separator","aria-orientation":"horizontal"},r,{ref:t}))}),Mge="MenuSub",[wye,tL]=Al(Mge),Vp="MenuSubTrigger",Ige=m.forwardRef((e,t)=>{const n=kl(Vp,e.__scopeMenu),r=Zf(Vp,e.__scopeMenu),o=tL(Vp,e.__scopeMenu),i=iS(Vp,e.__scopeMenu),s=m.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:e.__scopeMenu},u=m.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return m.useEffect(()=>u,[u]),m.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),l(null)}},[a,l]),m.createElement(K5,he({asChild:!0},c),m.createElement(J5,he({id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":nL(n.open)},e,{ref:cs(t,o.onTriggerChange),onClick:f=>{var h;(h=e.onClick)===null||h===void 0||h.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Me(e.onPointerMove,ff(f=>{i.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:Me(e.onPointerLeave,ff(f=>{var h;u();const g=(h=n.content)===null||h===void 0?void 0:h.getBoundingClientRect();if(g){var v;const b=(v=n.content)===null||v===void 0?void 0:v.dataset.side,x=b==="right",w=x?-5:5,_=g[x?"left":"right"],S=g[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+w,y:f.clientY},{x:_,y:g.top},{x:S,y:g.top},{x:S,y:g.bottom},{x:_,y:g.bottom}],side:b}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(f),f.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Me(e.onKeyDown,f=>{const h=i.searchRef.current!=="";if(!(e.disabled||h&&f.key===" ")&&cge[r.dir].includes(f.key)){var g;n.onOpenChange(!0),(g=n.content)===null||g===void 0||g.focus(),f.preventDefault()}})})))}),Nge="MenuSubContent",Lge=m.forwardRef((e,t)=>{const n=Q5(Qo,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=kl(Qo,e.__scopeMenu),s=Zf(Qo,e.__scopeMenu),a=tL(Nge,e.__scopeMenu),l=m.useRef(null),c=_t(t,l);return m.createElement(df.Provider,{scope:e.__scopeMenu},m.createElement(er,{present:r||i.open},m.createElement(df.Slot,{scope:e.__scopeMenu},m.createElement(sS,he({id:a.contentId,"aria-labelledby":a.triggerId},o,{ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var f;s.isUsingKeyboardRef.current&&((f=l.current)===null||f===void 0||f.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Me(e.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Me(e.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:Me(e.onKeyDown,u=>{const f=u.currentTarget.contains(u.target),h=uge[s.dir].includes(u.key);if(f&&h){var g;i.onOpenChange(!1),(g=a.trigger)===null||g===void 0||g.focus(),u.preventDefault()}})})))))});function nL(e){return e?"open":"closed"}function Xg(e){return e==="indeterminate"}function lS(e){return Xg(e)?"indeterminate":e?"checked":"unchecked"}function Fge(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function jge(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function zge(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=jge(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function Bge(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function Vge(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Bge(n,t)}function ff(e){return t=>t.pointerType==="mouse"?e(t):void 0}const Hge=gge,Wge=K5,Uge=vge,qge=yge,Gge=Sge,Yge=aS,Kge=Cge,Xge=Pge,Qge=Dge,Jge=Age,Zge=kge,eme=Ige,tme=Lge,rL="DropdownMenu",[nme,_ye]=Zn(rL,[G5]),ho=G5(),[rme,oL]=nme(rL),ome=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=e,l=ho(t),c=m.useRef(null),[u=!1,f]=xr({prop:o,defaultProp:i,onChange:s});return m.createElement(rme,{scope:t,triggerId:Jo(),triggerRef:c,contentId:Jo(),open:u,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(h=>!h),[f]),modal:a},m.createElement(Hge,he({},l,{open:u,onOpenChange:f,dir:r,modal:a}),n))},ime="DropdownMenuTrigger",sme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=oL(ime,n),s=ho(n);return m.createElement(Wge,he({asChild:!0},s),m.createElement(Qe.button,he({type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r},o,{ref:cs(t,i.triggerRef),onPointerDown:Me(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:Me(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})))}),ame=e=>{const{__scopeDropdownMenu:t,...n}=e,r=ho(t);return m.createElement(Uge,he({},r,n))},lme="DropdownMenuContent",cme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=oL(lme,n),i=ho(n),s=m.useRef(!1);return m.createElement(qge,he({id:o.contentId,"aria-labelledby":o.triggerId},i,r,{ref:t,onCloseAutoFocus:Me(e.onCloseAutoFocus,a=>{var l;s.current||(l=o.triggerRef.current)===null||l===void 0||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:Me(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!o.modal||u)&&(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)"}}))}),ume=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Gge,he({},o,r,{ref:t}))}),dme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Yge,he({},o,r,{ref:t}))}),fme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Kge,he({},o,r,{ref:t}))}),hme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Xge,he({},o,r,{ref:t}))}),pme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Qge,he({},o,r,{ref:t}))}),gme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Jge,he({},o,r,{ref:t}))}),mme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Zge,he({},o,r,{ref:t}))}),vme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(eme,he({},o,r,{ref:t}))}),bme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(tme,he({},o,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)"}}))}),yme=ome,xme=sme,wme=ame,iL=cme,sL=ume,aL=dme,lL=fme,_me=hme,cL=pme,uL=gme,dL=mme,fL=vme,hL=bme,Sme=yme,Cme=xme,Eme=_me,Rme=V.forwardRef(({className:e,inset:t,children:n,...r},o)=>O.jsxs(fL,{ref:o,className:Ee("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,O.jsx(_1,{className:"ml-auto h-4 w-4"})]}));Rme.displayName=fL.displayName;const Ome=V.forwardRef(({className:e,...t},n)=>O.jsx(hL,{ref:n,className:Ee("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}));Ome.displayName=hL.displayName;const pL=V.forwardRef(({className:e,sideOffset:t=4,...n},r)=>O.jsx(wme,{children:O.jsx("div",{id:"semaphor-scope",children:O.jsx(iL,{ref:r,sideOffset:t,className:Ee("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})})}));pL.displayName=iL.displayName;const Pme=V.forwardRef(({className:e,inset:t,...n},r)=>O.jsx(aL,{ref:r,className:Ee("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}));Pme.displayName=aL.displayName;const Tme=V.forwardRef(({className:e,children:t,checked:n,...r},o)=>O.jsxs(lL,{ref:o,className:Ee("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:[O.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:O.jsx(uL,{children:O.jsx(Lf,{className:"h-4 w-4"})})}),t]}));Tme.displayName=lL.displayName;const gL=V.forwardRef(({className:e,children:t,...n},r)=>O.jsxs(cL,{ref:r,className:Ee("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:[O.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:O.jsx(uL,{children:O.jsx(MA,{className:"h-2 w-2 fill-current"})})}),t]}));gL.displayName=cL.displayName;const mL=V.forwardRef(({className:e,inset:t,...n},r)=>O.jsx(sL,{ref:r,className:Ee("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));mL.displayName=sL.displayName;const vL=V.forwardRef(({className:e,...t},n)=>O.jsx(dL,{ref:n,className:Ee("-mx-1 my-1 h-px bg-muted",e),...t}));vL.displayName=dL.displayName;function Dme(e){var t;return{...e,sheets:(t=e==null?void 0:e.sheets)==null?void 0:t.map(n=>{var r;return{...n,frames:(r=n.frames)==null?void 0:r.map(o=>{var i;return{...o,cards:(i=o.cards)==null?void 0:i.map(s=>bL(s))}})}})}}function bL(e){var t,n,r,o;return{...e,cfg:{...e.cfg,data:{...(t=e.cfg)==null?void 0:t.data,labels:[],datasets:(o=(r=(n=e.cfg)==null?void 0:n.data)==null?void 0:r.datasets)==null?void 0:o.map(i=>({...i,data:[]}))}},customCfg:$me(e.customCfg),data:[]}}function $me(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 yL(e){return`semaphor:bookmark:${e}`}const Ame=h5,kme=p5,Mme=g5,xL=V.forwardRef(({className:e,...t},n)=>O.jsx(Z_,{ref:n,className:Ee("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}));xL.displayName=Z_.displayName;const wL=V.forwardRef(({className:e,children:t,...n},r)=>O.jsx(Mme,{children:O.jsxs("div",{id:"semaphor-scope",children:[O.jsx(xL,{}),O.jsxs(eS,{ref:r,className:Ee("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,O.jsxs(rS,{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:[O.jsx(Pm,{className:"h-4 w-4"}),O.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}));wL.displayName=eS.displayName;const _L=({className:e,...t})=>O.jsx("div",{className:Ee("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});_L.displayName="DialogHeader";const SL=({className:e,...t})=>O.jsx("div",{className:Ee("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});SL.displayName="DialogFooter";const CL=V.forwardRef(({className:e,...t},n)=>O.jsx(tS,{ref:n,className:Ee("text-lg font-semibold leading-none tracking-tight",e),...t}));CL.displayName=tS.displayName;const EL=V.forwardRef(({className:e,...t},n)=>O.jsx(nS,{ref:n,className:Ee("text-sm text-muted-foreground",e),...t}));EL.displayName=nS.displayName;const RL="Checkbox",[Ime,Sye]=Zn(RL),[Nme,Lme]=Ime(RL),Fme=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,...u}=e,[f,h]=m.useState(null),g=_t(t,S=>h(S)),v=m.useRef(!1),b=f?!!f.closest("form"):!0,[x=!1,w]=xr({prop:o,defaultProp:i,onChange:c}),_=m.useRef(x);return m.useEffect(()=>{const S=f==null?void 0:f.form;if(S){const R=()=>w(_.current);return S.addEventListener("reset",R),()=>S.removeEventListener("reset",R)}},[f,w]),m.createElement(Nme,{scope:n,state:x,disabled:a},m.createElement(Qe.button,he({type:"button",role:"checkbox","aria-checked":dl(x)?"mixed":x,"aria-required":s,"data-state":OL(x),"data-disabled":a?"":void 0,disabled:a,value:l},u,{ref:g,onKeyDown:Me(e.onKeyDown,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Me(e.onClick,S=>{w(R=>dl(R)?!0:!R),b&&(v.current=S.isPropagationStopped(),v.current||S.stopPropagation())})})),b&&m.createElement(Bme,{control:f,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,style:{transform:"translateX(-100%)"}}))}),jme="CheckboxIndicator",zme=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=Lme(jme,n);return m.createElement(er,{present:r||dl(i.state)||i.state===!0},m.createElement(Qe.span,he({"data-state":OL(i.state),"data-disabled":i.disabled?"":void 0},o,{ref:t,style:{pointerEvents:"none",...e.style}})))}),Bme=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=m.useRef(null),s=Im(n),a=$m(t);return m.useEffect(()=>{const l=i.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});l.indeterminate=dl(n),f.call(l,dl(n)?!1:n),l.dispatchEvent(h)}},[s,n,r]),m.createElement("input",he({type:"checkbox","aria-hidden":!0,defaultChecked:dl(n)?!1:n},o,{tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function dl(e){return e==="indeterminate"}function OL(e){return dl(e)?"indeterminate":e?"checked":"unchecked"}const PL=Fme,Vme=zme,TL=V.forwardRef(({className:e,...t},n)=>O.jsx(PL,{ref:n,className:Ee("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:O.jsx(Vme,{className:Ee("flex items-center justify-center text-current"),children:O.jsx(Lf,{className:"h-4 w-4"})})}));TL.displayName=PL.displayName;const DL=m.forwardRef(({className:e,...t},n)=>O.jsx("div",{role:"editor-panel",ref:n,className:Ee("flex grow h-full",e),...t}));DL.displayName="EditorPanel";const $L=m.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee(" flex flex-col space-y-2 w-[270px]",e),...t}));$L.displayName="EditorAside";const AL=m.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee(" grow",e),...t}));AL.displayName="EditorMain";function Hme(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function R2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?E2(Object(n),!0).forEach(function(r){Hme(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Wme(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function Ume(e,t){if(e==null)return{};var n=Wme(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function qme(e,t){return Gme(e)||Yme(e,t)||Kme(e,t)||Xme()}function Gme(e){if(Array.isArray(e))return e}function Yme(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,o=!1,i=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){o=!0,i=l}finally{try{!r&&s.return!=null&&s.return()}finally{if(o)throw i}}return n}}function Kme(e,t){if(e){if(typeof e=="string")return O2(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 O2(e,t)}}function O2(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 Xme(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
426
426
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qme(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function T2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?P2(Object(n),!0).forEach(function(r){Qme(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Jme(){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(o,i){return i(o)},r)}}function ld(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];return t.apply(n,[].concat(o,a))}}}function Qg(e){return{}.toString.call(e).includes("Object")}function Zme(e){return!Object.keys(e).length}function hf(e){return typeof e=="function"}function eve(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function tve(e,t){return Qg(t)||ia("changeType"),Object.keys(t).some(function(n){return!eve(e,n)})&&ia("changeField"),t}function nve(e){hf(e)||ia("selectorType")}function rve(e){hf(e)||Qg(e)||ia("handlerType"),Qg(e)&&Object.values(e).some(function(t){return!hf(t)})&&ia("handlersType")}function ove(e){e||ia("initialIsRequired"),Qg(e)||ia("initialType"),Zme(e)&&ia("initialContent")}function ive(e,t){throw new Error(e[t]||e.default)}var sve={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"},ia=ld(ive)(sve),Hp={changes:tve,selector:nve,handler:rve,initial:ove};function ave(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Hp.initial(e),Hp.handler(t);var n={current:e},r=ld(uve)(n,t),o=ld(cve)(n),i=ld(Hp.changes)(e),s=ld(lve)(n);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(u){return u};return Hp.selector(c),c(n.current)}function l(c){Jme(r,o,i,s)(c)}return[a,l]}function lve(e,t){return hf(t)?t(e.current):t}function cve(e,t){return e.current=T2(T2({},e.current),t),t}function uve(e,t,n){return hf(t)?t(e.current):Object.keys(n).forEach(function(r){var o;return(o=t[r])===null||o===void 0?void 0:o.call(t,e.current[r])}),n}var dve={create:ave},fve={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function hve(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];return t.apply(n,[].concat(o,a))}}}function pve(e){return{}.toString.call(e).includes("Object")}function gve(e){return e||D2("configIsRequired"),pve(e)||D2("configType"),e.urls?(mve(),{paths:{vs:e.urls.monacoBase}}):e}function mve(){console.warn(kL.deprecation)}function vve(e,t){throw new Error(e[t]||e.default)}var kL={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!
|
|
427
427
|
You are using deprecated way of configuration.
|
|
428
428
|
|