react-semaphor 0.1.398 → 0.1.399
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/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +2 -2
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +2 -2
- package/dist/chunks/analyze-result-contract-CUO5QmqV.js +1797 -0
- package/dist/chunks/analyze-result-contract-OqFtOCpZ.js +1 -0
- package/dist/chunks/{calendar-preferences-dialog-49fcEPXS.js → calendar-preferences-dialog-9SvYDLp6.js} +3 -3
- package/dist/chunks/{calendar-preferences-dialog-DwLeBLy2.js → calendar-preferences-dialog-B3fnFtJt.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-cgPKz1yX.js → dashboard-briefing-launcher-APVyc9al.js} +4 -4
- package/dist/chunks/{dashboard-briefing-launcher-CgkSKkZR.js → dashboard-briefing-launcher-D3R4R7ww.js} +1 -1
- package/dist/chunks/{dashboard-controls-VMFm3OP4.js → dashboard-controls-CHDQlMZ9.js} +5 -5
- package/dist/chunks/{dashboard-controls-D12ZSUP_.js → dashboard-controls-v7jslCXR.js} +1 -1
- package/dist/chunks/{dashboard-json-C-GG5yC7.js → dashboard-json-DF_syvRu.js} +3 -3
- package/dist/chunks/{dashboard-json-CvK0oI24.js → dashboard-json-L1Qo5xcX.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-B5KB7dx4.js → edit-dashboard-visual-DwfIWUe-.js} +4 -4
- package/dist/chunks/{edit-dashboard-visual-ql99faTz.js → edit-dashboard-visual-qdruQruO.js} +1 -1
- package/dist/chunks/{index-CQmKDEbe.js → index-BdVymLVq.js} +5 -5
- package/dist/chunks/{index-DXCBPLDu.js → index-DH7hOGQl.js} +2 -2
- package/dist/chunks/{switch-BXQAlSuW.js → switch-BiU6-YSY.js} +1 -1
- package/dist/chunks/{switch-B79Hn4Qh.js → switch-CYG3dY8r.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-Bw5LRkf9.js → use-create-flow-overlay-state-CwUkhLBL.js} +3 -3
- package/dist/chunks/{use-create-flow-overlay-state-7MFN3PWX.js → use-create-flow-overlay-state-qe7DHQKr.js} +1 -1
- package/dist/chunks/{validators-4EGCWWga.js → validators-B1Mgdr3T.js} +279 -242
- package/dist/chunks/{validators-CPtkrola.js → validators-DFOX0tYY.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +1 -1
- package/dist/dashboard-authoring/index.js +2 -2
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +2 -2
- package/dist/data-app-sdk/index.cjs +2 -2
- package/dist/data-app-sdk/index.js +3 -2
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +20 -12
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +101 -2
- package/dist/types/dashboard-assistant.d.ts +14 -0
- package/dist/types/dashboard-authoring.d.ts +6 -0
- package/dist/types/data-app-builder.d.ts +6 -0
- package/dist/types/data-app-sdk-adapters.d.ts +7 -0
- package/dist/types/data-app-sdk-validation.d.ts +15 -0
- package/dist/types/data-app-sdk.d.ts +18 -0
- package/dist/types/main.d.ts +6 -0
- package/package.json +1 -1
- package/dist/chunks/analyze-result-contract-C9Gv2_qW.js +0 -1585
- package/dist/chunks/analyze-result-contract-Zgg-Bbpj.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var She=Object.defineProperty;var Q3=e=>{throw TypeError(e)};var Che=(e,t,n)=>t in e?She(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ye=(e,t,n)=>Che(e,typeof t!="symbol"?t+"":t,n),Gj=(e,t,n)=>t.has(e)||Q3("Cannot "+n);var fe=(e,t,n)=>(Gj(e,t,"read from private field"),n?n.call(e):t.get(e)),It=(e,t,n)=>t.has(e)?Q3("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),dt=(e,t,n,r)=>(Gj(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Ht=(e,t,n)=>(Gj(e,t,"access private method"),n);var Qv=(e,t,n,r)=>({set _(s){dt(e,t,s,n)},get _(){return fe(e,t,r)}});const l=require("react/jsx-runtime"),S=require("react"),br=require("react-dom"),p=require("./switch-
|
|
1
|
+
"use strict";var She=Object.defineProperty;var Q3=e=>{throw TypeError(e)};var Che=(e,t,n)=>t in e?She(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ye=(e,t,n)=>Che(e,typeof t!="symbol"?t+"":t,n),Gj=(e,t,n)=>t.has(e)||Q3("Cannot "+n);var fe=(e,t,n)=>(Gj(e,t,"read from private field"),n?n.call(e):t.get(e)),It=(e,t,n)=>t.has(e)?Q3("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),dt=(e,t,n,r)=>(Gj(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Ht=(e,t,n)=>(Gj(e,t,"access private method"),n);var Qv=(e,t,n,r)=>({set _(s){dt(e,t,s,n)},get _(){return fe(e,t,r)}});const l=require("react/jsx-runtime"),S=require("react"),br=require("react-dom"),p=require("./switch-CYG3dY8r.js"),je=require("./x-B6ghREd2.js");require("./analyze-result-contract-OqFtOCpZ.js");const kc=require("./index-DRlMUglg.js"),Nhe=require("react-dom/client"),Pt=require("./search-DNCejM7Z.js"),khe=require("../types/index.cjs"),$n=require("./date-formatter-B4EBSe9C.js"),hn=require("./index-D7KJindZ.js"),So=require("./normalize-dashboard-for-dirty-check-BXRUMVb2.js"),lr=require("./common-types-C73-Ud1-.js"),_he=require("./catalog-field-grounding-Bnx-3tE0.js"),jhe=require("./source-identity-uMaUe036.js"),fq=require("../dashboard-assistant/index.cjs"),Ihe=require("./contracts-CtB2VONT.js"),Ehe=require("../layouts/index.cjs");function AR(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const J3=AR(l),Q=AR(S),LD=AR(br),RR=`import pandas as pd
|
|
2
2
|
df = pd.DataFrame(data) # 'data' contains the query result
|
|
3
3
|
result = df.to_dict('records') # must return 'result' as [dict] type
|
|
4
4
|
`;function The(e,t){const n=+hn.toDate(e);return hn.constructFrom(e,n+t)}function O1(e,t){return The(e,t*hn.millisecondsInHour)}function Dhe(e){return hn.toDate(e).getMonth()}function Mhe(e){return hn.toDate(e).getFullYear()}function L1(e,t){const r=Fhe(e);let s;if(r.date){const c=Ohe(r.date,2);s=Lhe(c.restDateString,c.year)}if(!s||isNaN(s.getTime()))return new Date(NaN);const o=s.getTime();let i=0,a;if(r.time&&(i=$he(r.time),isNaN(i)))return new Date(NaN);if(r.timezone){if(a=zhe(r.timezone),isNaN(a))return new Date(NaN)}else{const c=new Date(o+i),u=new Date(0);return u.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),u.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),u}return new Date(o+i+a)}const Jv={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Ahe=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Rhe=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Phe=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Fhe(e){const t={},n=e.split(Jv.dateTimeDelimiter);let r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],Jv.timeZoneDelimiter.test(t.date)&&(t.date=e.split(Jv.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){const s=Jv.timezone.exec(r);s?(t.time=r.replace(s[1],""),t.timezone=s[1]):t.time=r}return t}function Ohe(e,t){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:NaN,restDateString:""};const s=r[1]?parseInt(r[1]):null,o=r[2]?parseInt(r[2]):null;return{year:o===null?s:o*100,restDateString:e.slice((r[1]||r[2]).length)}}function Lhe(e,t){if(t===null)return new Date(NaN);const n=e.match(Ahe);if(!n)return new Date(NaN);const r=!!n[4],s=Jg(n[1]),o=Jg(n[2])-1,i=Jg(n[3]),a=Jg(n[4]),c=Jg(n[5])-1;if(r)return qhe(t,a,c)?Bhe(t,a,c):new Date(NaN);{const u=new Date(0);return!Hhe(t,o,i)||!Uhe(t,s)?new Date(NaN):(u.setUTCFullYear(t,o,Math.max(s,i)),u)}}function Jg(e){return e?parseInt(e):1}function $he(e){const t=e.match(Rhe);if(!t)return NaN;const n=Yj(t[1]),r=Yj(t[2]),s=Yj(t[3]);return Whe(n,r,s)?n*hn.millisecondsInHour+r*hn.millisecondsInMinute+s*1e3:NaN}function Yj(e){return e&&parseFloat(e.replace(",","."))||0}function zhe(e){if(e==="Z")return 0;const t=e.match(Phe);if(!t)return 0;const n=t[1]==="+"?-1:1,r=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return Ghe(r,s)?n*(r*hn.millisecondsInHour+s*hn.millisecondsInMinute):NaN}function Bhe(e,t,n){const r=new Date(0);r.setUTCFullYear(e,0,4);const s=r.getUTCDay()||7,o=(t-1)*7+n+1-s;return r.setUTCDate(r.getUTCDate()+o),r}const Vhe=[31,null,31,30,31,30,31,31,30,31,30,31];function hq(e){return e%400===0||e%4===0&&e%100!==0}function Hhe(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Vhe[t]||(hq(e)?29:28))}function Uhe(e,t){return t>=1&&t<=(hq(e)?366:365)}function qhe(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function Whe(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function Ghe(e,t){return t>=0&&t<=59}var $1={exports:{}};$1.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",s=800,o=16,i=9007199254740991,a="[object Arguments]",c="[object Array]",u="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",h="[object Error]",m="[object Function]",g="[object GeneratorFunction]",b="[object Map]",x="[object Number]",y="[object Null]",w="[object Object]",v="[object Proxy]",C="[object RegExp]",N="[object Set]",k="[object String]",_="[object Undefined]",j="[object WeakMap]",E="[object ArrayBuffer]",I="[object DataView]",T="[object Float32Array]",D="[object Float64Array]",R="[object Int8Array]",F="[object Int16Array]",A="[object Int32Array]",U="[object Uint8Array]",$="[object Uint8ClampedArray]",q="[object Uint16Array]",W="[object Uint32Array]",O=/[\\^$.*+?()[\]{}|]/g,Z=/^\[object .+?Constructor\]$/,Y=/^(?:0|[1-9]\d*)$/,M={};M[T]=M[D]=M[R]=M[F]=M[A]=M[U]=M[$]=M[q]=M[W]=!0,M[a]=M[c]=M[E]=M[d]=M[I]=M[f]=M[h]=M[m]=M[b]=M[x]=M[w]=M[C]=M[N]=M[k]=M[j]=!1;var K=typeof p.commonjsGlobal=="object"&&p.commonjsGlobal&&p.commonjsGlobal.Object===Object&&p.commonjsGlobal,L=typeof self=="object"&&self&&self.Object===Object&&self,z=K||L||Function("return this")(),B=t&&!t.nodeType&&t,V=B&&!0&&e&&!e.nodeType&&e,P=V&&V.exports===B,H=P&&K.process,G=function(){try{var ae=V&&V.require&&V.require("util").types;return ae||H&&H.binding&&H.binding("util")}catch{}}(),X=G&&G.isTypedArray;function ne(ae,_e,Pe){switch(Pe.length){case 0:return ae.call(_e);case 1:return ae.call(_e,Pe[0]);case 2:return ae.call(_e,Pe[0],Pe[1]);case 3:return ae.call(_e,Pe[0],Pe[1],Pe[2])}return ae.apply(_e,Pe)}function de(ae,_e){for(var Pe=-1,Et=Array(ae);++Pe<ae;)Et[Pe]=_e(Pe);return Et}function he(ae){return function(_e){return ae(_e)}}function pe(ae,_e){return ae==null?void 0:ae[_e]}function xe(ae,_e){return function(Pe){return ae(_e(Pe))}}var se=Array.prototype,ge=Function.prototype,ie=Object.prototype,De=z["__core-js_shared__"],re=ge.toString,me=ie.hasOwnProperty,ve=function(){var ae=/[^.]+$/.exec(De&&De.keys&&De.keys.IE_PROTO||"");return ae?"Symbol(src)_1."+ae:""}(),J=ie.toString,ee=re.call(Object),te=RegExp("^"+re.call(me).replace(O,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ue=P?z.Buffer:void 0,le=z.Symbol,ke=z.Uint8Array;ue&&ue.allocUnsafe;var Se=xe(Object.getPrototypeOf,Object),oe=Object.create,Ie=ie.propertyIsEnumerable,Ne=se.splice,Le=le?le.toStringTag:void 0,Ye=function(){try{var ae=Or(Object,"defineProperty");return ae({},"",{}),ae}catch{}}(),$e=ue?ue.isBuffer:void 0,Ve=Math.max,Ze=Date.now,Ce=Or(z,"Map"),et=Or(Object,"create"),Fe=function(){function ae(){}return function(_e){if(!Cd(_e))return{};if(oe)return oe(_e);ae.prototype=_e;var Pe=new ae;return ae.prototype=void 0,Pe}}();function Ue(ae){var _e=-1,Pe=ae==null?0:ae.length;for(this.clear();++_e<Pe;){var Et=ae[_e];this.set(Et[0],Et[1])}}function nt(){this.__data__=et?et(null):{},this.size=0}function Re(ae){var _e=this.has(ae)&&delete this.__data__[ae];return this.size-=_e?1:0,_e}function Ee(ae){var _e=this.__data__;if(et){var Pe=_e[ae];return Pe===r?void 0:Pe}return me.call(_e,ae)?_e[ae]:void 0}function Ge(ae){var _e=this.__data__;return et?_e[ae]!==void 0:me.call(_e,ae)}function yt(ae,_e){var Pe=this.__data__;return this.size+=this.has(ae)?0:1,Pe[ae]=et&&_e===void 0?r:_e,this}Ue.prototype.clear=nt,Ue.prototype.delete=Re,Ue.prototype.get=Ee,Ue.prototype.has=Ge,Ue.prototype.set=yt;function xt(ae){var _e=-1,Pe=ae==null?0:ae.length;for(this.clear();++_e<Pe;){var Et=ae[_e];this.set(Et[0],Et[1])}}function ft(){this.__data__=[],this.size=0}function wt(ae){var _e=this.__data__,Pe=ht(_e,ae);if(Pe<0)return!1;var Et=_e.length-1;return Pe==Et?_e.pop():Ne.call(_e,Pe,1),--this.size,!0}function ot(ae){var _e=this.__data__,Pe=ht(_e,ae);return Pe<0?void 0:_e[Pe][1]}function Mt(ae){return ht(this.__data__,ae)>-1}function Te(ae,_e){var Pe=this.__data__,Et=ht(Pe,ae);return Et<0?(++this.size,Pe.push([ae,_e])):Pe[Et][1]=_e,this}xt.prototype.clear=ft,xt.prototype.delete=wt,xt.prototype.get=ot,xt.prototype.has=Mt,xt.prototype.set=Te;function Xe(ae){var _e=-1,Pe=ae==null?0:ae.length;for(this.clear();++_e<Pe;){var Et=ae[_e];this.set(Et[0],Et[1])}}function Je(){this.size=0,this.__data__={hash:new Ue,map:new(Ce||xt),string:new Ue}}function rt(ae){var _e=Xt(this,ae).delete(ae);return this.size-=_e?1:0,_e}function vt(ae){return Xt(this,ae).get(ae)}function Lt(ae){return Xt(this,ae).has(ae)}function Rt(ae,_e){var Pe=Xt(this,ae),Et=Pe.size;return Pe.set(ae,_e),this.size+=Pe.size==Et?0:1,this}Xe.prototype.clear=Je,Xe.prototype.delete=rt,Xe.prototype.get=vt,Xe.prototype.has=Lt,Xe.prototype.set=Rt;function mn(ae){var _e=this.__data__=new xt(ae);this.size=_e.size}function ze(){this.__data__=new xt,this.size=0}function qe(ae){var _e=this.__data__,Pe=_e.delete(ae);return this.size=_e.size,Pe}function ct(ae){return this.__data__.get(ae)}function Nt(ae){return this.__data__.has(ae)}function kt(ae,_e){var Pe=this.__data__;if(Pe instanceof xt){var Et=Pe.__data__;if(!Ce||Et.length<n-1)return Et.push([ae,_e]),this.size=++Pe.size,this;Pe=this.__data__=new Xe(Et)}return Pe.set(ae,_e),this.size=Pe.size,this}mn.prototype.clear=ze,mn.prototype.delete=qe,mn.prototype.get=ct,mn.prototype.has=Nt,mn.prototype.set=kt;function at(ae,_e){var Pe=Mr(ae),Et=!Pe&&Ln(ae),In=!Pe&&!Et&&Sd(ae),ir=!Pe&&!Et&&!In&&Y3(ae),Ir=Pe||Et||In||ir,Bn=Ir?de(ae.length,String):[],Er=Bn.length;for(var ea in ae)Ir&&(ea=="length"||In&&(ea=="offset"||ea=="parent")||ir&&(ea=="buffer"||ea=="byteLength"||ea=="byteOffset")||El(ea,Er))||Bn.push(ea);return Bn}function ce(ae,_e,Pe){(Pe!==void 0&&!or(ae[_e],Pe)||Pe===void 0&&!(_e in ae))&&Dt(ae,_e,Pe)}function Be(ae,_e,Pe){var Et=ae[_e];(!(me.call(ae,_e)&&or(Et,Pe))||Pe===void 0&&!(_e in ae))&&Dt(ae,_e,Pe)}function ht(ae,_e){for(var Pe=ae.length;Pe--;)if(or(ae[Pe][0],_e))return Pe;return-1}function Dt(ae,_e,Pe){_e=="__proto__"&&Ye?Ye(ae,_e,{configurable:!0,enumerable:!0,value:Pe,writable:!0}):ae[_e]=Pe}var $t=_t();function be(ae){return ae==null?ae===void 0?_:y:Le&&Le in Object(ae)?Si(ae):Xv(ae)}function we(ae){return Xg(ae)&&be(ae)==a}function He(ae){if(!Cd(ae)||Kv(ae))return!1;var _e=Kg(ae)?te:Z;return _e.test(Zt(ae))}function pt(ae){return Xg(ae)&&Zg(ae.length)&&!!M[be(ae)]}function zt(ae){if(!Cd(ae))return Zv(ae);var _e=Yg(ae),Pe=[];for(var Et in ae)Et=="constructor"&&(_e||!me.call(ae,Et))||Pe.push(Et);return Pe}function jt(ae,_e,Pe,Et,In){ae!==_e&&$t(_e,function(ir,Ir){if(In||(In=new mn),Cd(ir))Fn(ae,_e,Ir,Pe,jt,Et,In);else{var Bn=Et?Et(Gt(ae,Ir),ir,Ir+"",ae,_e,In):void 0;Bn===void 0&&(Bn=ir),ce(ae,Ir,Bn)}},K3)}function Fn(ae,_e,Pe,Et,In,ir,Ir){var Bn=Gt(ae,Pe),Er=Gt(_e,Pe),ea=Ir.get(Er);if(ea){ce(ae,Pe,ea);return}var Zo=ir?ir(Bn,Er,Pe+"",ae,_e,Ir):void 0,Qg=Zo===void 0;if(Qg){var qj=Mr(Er),Wj=!qj&&Sd(Er),X3=!qj&&!Wj&&Y3(Er);Zo=Er,qj||Wj||X3?Mr(Bn)?Zo=Bn:js(Bn)?Zo=Oe(Bn):Wj?(Qg=!1,Zo=wi(Er)):X3?(Qg=!1,Zo=Il(Er)):Zo=[]:bhe(Er)||Ln(Er)?(Zo=Bn,Ln(Bn)?Zo=xhe(Bn):(!Cd(Bn)||Kg(Bn))&&(Zo=qh(Er))):Qg=!1}Qg&&(Ir.set(Er,Zo),In(Zo,Er,Et,ir,Ir),Ir.delete(Er)),ce(ae,Pe,Zo)}function On(ae,_e){return pn(Me(ae,_e,Z3),ae+"")}var jr=Ye?function(ae,_e){return Ye(ae,"toString",{configurable:!0,enumerable:!1,value:vhe(_e),writable:!0})}:Z3;function wi(ae,_e){return ae.slice()}function Eo(ae){var _e=new ae.constructor(ae.byteLength);return new ke(_e).set(new ke(ae)),_e}function Il(ae,_e){var Pe=Eo(ae.buffer);return new ae.constructor(Pe,ae.byteOffset,ae.length)}function Oe(ae,_e){var Pe=-1,Et=ae.length;for(_e||(_e=Array(Et));++Pe<Et;)_e[Pe]=ae[Pe];return _e}function it(ae,_e,Pe,Et){var In=!Pe;Pe||(Pe={});for(var ir=-1,Ir=_e.length;++ir<Ir;){var Bn=_e[ir],Er=void 0;Er===void 0&&(Er=ae[Bn]),In?Dt(Pe,Bn,Er):Be(Pe,Bn,Er)}return Pe}function St(ae){return On(function(_e,Pe){var Et=-1,In=Pe.length,ir=In>1?Pe[In-1]:void 0,Ir=In>2?Pe[2]:void 0;for(ir=ae.length>3&&typeof ir=="function"?(In--,ir):void 0,Ir&&Wh(Pe[0],Pe[1],Ir)&&(ir=In<3?void 0:ir,In=1),_e=Object(_e);++Et<In;){var Bn=Pe[Et];Bn&&ae(_e,Bn,Et,ir)}return _e})}function _t(ae){return function(_e,Pe,Et){for(var In=-1,ir=Object(_e),Ir=Et(_e),Bn=Ir.length;Bn--;){var Er=Ir[++In];if(Pe(ir[Er],Er,ir)===!1)break}return _e}}function Xt(ae,_e){var Pe=ae.__data__;return Bc(_e)?Pe[typeof _e=="string"?"string":"hash"]:Pe.map}function Or(ae,_e){var Pe=pe(ae,_e);return He(Pe)?Pe:void 0}function Si(ae){var _e=me.call(ae,Le),Pe=ae[Le];try{ae[Le]=void 0;var Et=!0}catch{}var In=J.call(ae);return Et&&(_e?ae[Le]=Pe:delete ae[Le]),In}function qh(ae){return typeof ae.constructor=="function"&&!Yg(ae)?Fe(Se(ae)):{}}function El(ae,_e){var Pe=typeof ae;return _e=_e??i,!!_e&&(Pe=="number"||Pe!="symbol"&&Y.test(ae))&&ae>-1&&ae%1==0&&ae<_e}function Wh(ae,_e,Pe){if(!Cd(Pe))return!1;var Et=typeof _e;return(Et=="number"?mr(Pe)&&El(_e,Pe.length):Et=="string"&&_e in Pe)?or(Pe[_e],ae):!1}function Bc(ae){var _e=typeof ae;return _e=="string"||_e=="number"||_e=="symbol"||_e=="boolean"?ae!=="__proto__":ae===null}function Kv(ae){return!!ve&&ve in ae}function Yg(ae){var _e=ae&&ae.constructor,Pe=typeof _e=="function"&&_e.prototype||ie;return ae===Pe}function Zv(ae){var _e=[];if(ae!=null)for(var Pe in Object(ae))_e.push(Pe);return _e}function Xv(ae){return J.call(ae)}function Me(ae,_e,Pe){return _e=Ve(_e===void 0?ae.length-1:_e,0),function(){for(var Et=arguments,In=-1,ir=Ve(Et.length-_e,0),Ir=Array(ir);++In<ir;)Ir[In]=Et[_e+In];In=-1;for(var Bn=Array(_e+1);++In<_e;)Bn[In]=Et[In];return Bn[_e]=Pe(Ir),ne(ae,this,Bn)}}function Gt(ae,_e){if(!(_e==="constructor"&&typeof ae[_e]=="function")&&_e!="__proto__")return ae[_e]}var pn=en(jr);function en(ae){var _e=0,Pe=0;return function(){var Et=Ze(),In=o-(Et-Pe);if(Pe=Et,In>0){if(++_e>=s)return arguments[0]}else _e=0;return ae.apply(void 0,arguments)}}function Zt(ae){if(ae!=null){try{return re.call(ae)}catch{}try{return ae+""}catch{}}return""}function or(ae,_e){return ae===_e||ae!==ae&&_e!==_e}var Ln=we(function(){return arguments}())?we:function(ae){return Xg(ae)&&me.call(ae,"callee")&&!Ie.call(ae,"callee")},Mr=Array.isArray;function mr(ae){return ae!=null&&Zg(ae.length)&&!Kg(ae)}function js(ae){return Xg(ae)&&mr(ae)}var Sd=$e||whe;function Kg(ae){if(!Cd(ae))return!1;var _e=be(ae);return _e==m||_e==g||_e==u||_e==v}function Zg(ae){return typeof ae=="number"&&ae>-1&&ae%1==0&&ae<=i}function Cd(ae){var _e=typeof ae;return ae!=null&&(_e=="object"||_e=="function")}function Xg(ae){return ae!=null&&typeof ae=="object"}function bhe(ae){if(!Xg(ae)||be(ae)!=w)return!1;var _e=Se(ae);if(_e===null)return!0;var Pe=me.call(_e,"constructor")&&_e.constructor;return typeof Pe=="function"&&Pe instanceof Pe&&re.call(Pe)==ee}var Y3=X?he(X):pt;function xhe(ae){return it(ae,K3(ae))}function K3(ae){return mr(ae)?at(ae):zt(ae)}var yhe=St(function(ae,_e,Pe){jt(ae,_e,Pe)});function vhe(ae){return function(){return ae}}function Z3(ae){return ae}function whe(){return!1}e.exports=yhe})($1,$1.exports);var Yhe=$1.exports;const dl=p.getDefaultExportFromCjs(Yhe),Khe={theme:"system",setTheme:()=>null},mq=S.createContext(Khe);function z1(e,t="system"){return Zhe(e)?e:t}function Zhe(e){return e==="light"||e==="dark"||e==="system"}const PR=()=>{const e=S.useContext(mq);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},pq=(e,t)=>{const n={};if(e===null||t===null)return t;const r=new Set([...Object.keys(e),...Object.keys(t)]);for(const s of r){if(!(s in e)&&s in t){n[s]=t[s];continue}if(s in e&&!(s in t)){n[s]=void 0;continue}const o=e[s],i=t[s];if(!$D(o,i))if(Array.isArray(o)&&Array.isArray(i))n[s]=i;else if(e$(o)&&e$(i)){const a=pq(o,i);Object.keys(a).length>0&&(n[s]=a)}else n[s]=i}return n},$D=(e,t)=>{if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,o)=>$D(s,t[o]));const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(s=>$D(e[s],t[s]))}return!1},e$=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),$o=e=>{if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e);if(Array.isArray(e))return e.map(n=>$o(n));const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=$o(e[n]));return t},gq="__semaphorAuthoredFontFamily";var QU,JU;const Xhe=(JU=(QU=p.DEFAULT_STYLE.default.chart)==null?void 0:QU.font)==null?void 0:JU.family,Qhe=new Set([Xhe,"Open Sans, Arial, sans-serif",'"Open Sans", Arial, sans-serif'].filter(Boolean));function Jhe(e,t){if(!e)return t?{family:t}:void 0;const{[gq]:n,...r}=e,s=eme(r.family,t,!!n);return{...r,...s?{family:s}:void 0}}function eme(e,t,n=!1){return n&&e||e&&!tme(e)?e:t||e}function tme(e){return Qhe.has(e.trim())}function nme(e,t){if(!t)return e;const n={...e,font:Ii(e.font,t)},r=ome(e.plugins,t);r&&(n.plugins=r);const s=ime(e.scales,t);return s&&(n.scales=s),n}function rme(e,t){return!e||!t?e:e.map(n=>{if(!n||typeof n!="object")return n;const r=n,s=r.datalabels;return!s||typeof s!="object"?n:{...r,datalabels:{...s,font:Ii(s.font,t)}}})}function sme(e,t){if(!e||typeof e!="object"||!t)return e;const n=e.datasets;return Array.isArray(n)?{...e,datasets:rme(n,t)}:e}function ome(e,t){var n;return e&&{...e,title:e.title?{...e.title,font:Ii(e.title.font,t)}:e.title,subtitle:e.subtitle?{...e.subtitle,font:Ii(e.subtitle.font,t)}:e.subtitle,legend:e.legend?{...e.legend,labels:e.legend.labels?{...e.legend.labels,font:Ii(e.legend.labels.font,t)}:e.legend.labels}:e.legend,tooltip:e.tooltip?{...e.tooltip,titleFont:Ii(e.tooltip.titleFont,t),bodyFont:Ii(e.tooltip.bodyFont,t),footerFont:Ii(e.tooltip.footerFont,t)}:e.tooltip,datalabels:e.datalabels?{...e.datalabels,font:Ii((n=e.datalabels)==null?void 0:n.font,t)}:e.datalabels}}function ime(e,t){return e&&Object.entries(e).reduce((n,[r,s])=>{if(!s||typeof s!="object")return n[r]=s,n;const o=s;return n[r]={...o,ticks:o.ticks?{...o.ticks,font:Ii(o.ticks.font,t)}:o.ticks,title:o.title?{...o.title,font:Ii(o.title.font,t)}:o.title,pointLabels:o.pointLabels?{...o.pointLabels,font:Ii(o.pointLabels.font,t)}:o.pointLabels},n},{})}function Ii(e,t){return typeof e=="function"?e:{...t,...e&&typeof e=="object"?e:{}}}function ame(e,t){const n=$o(e??{}),r=lme(t);if(!r)return n;const s=dl(n,r);return dme(s,r),s}function lme(e){var h,m,g,b;const t=(h=e.scheme.components)==null?void 0:h.chart,n=kc.SEMAPHOR_DEFAULT_APPEARANCE_SPEC.schemes[e.mode],r=(m=n.components)==null?void 0:m.chart,s=(g=n.tokens)==null?void 0:g.typography,o={};ume(t==null?void 0:t.palette,r==null?void 0:r.palette)&&(o.dataset={backgroundColor:[...t.palette],borderColor:[...t.palette]});const i=(b=e.scheme.tokens)==null?void 0:b.typography,a=Gh(i==null?void 0:i.fontFamily,s==null?void 0:s.fontFamily),c=Gh(i==null?void 0:i.baseFontSize,s==null?void 0:s.baseFontSize);if(a||c!==void 0){const x={...a?{family:a}:void 0,...c!==void 0?{size:c}:void 0};a&&(x[gq]=!0),o.font=x}const u=Gh(t==null?void 0:t.gridColor,r==null?void 0:r.gridColor),d=Gh(t==null?void 0:t.axisColor,r==null?void 0:r.axisColor)??Gh(t==null?void 0:t.foreground,r==null?void 0:r.foreground);(u||d)&&(o.options={scales:{x:Kj({gridColor:u,axisColor:d}),y:Kj({gridColor:u,axisColor:d}),y2:Kj({gridColor:u,axisColor:d}),r:cme({gridColor:u,axisColor:d})}});const f=Gh(t==null?void 0:t.foreground,r==null?void 0:r.foreground);return f&&(o.options=dl(o.options??{},{plugins:{legend:{labels:{color:f}}}})),Object.keys(o).length>0?{chart:o}:void 0}function Kj({gridColor:e,axisColor:t}){return{...e?{grid:{color:e}}:void 0,...t?{ticks:{color:t},title:{color:t}}:void 0}}function cme({gridColor:e,axisColor:t}){return{...e?{grid:{color:e},angleLines:{color:e}}:void 0,...t?{ticks:{color:t},title:{color:t},pointLabels:{color:t}}:void 0}}function ume(e,t){return e!=null&&e.length?!(t!=null&&t.length)||e.length!==t.length?!0:e.some((n,r)=>n!==t[r]):!1}function Gh(e,t){return e!==void 0&&e!==t?e:void 0}function dme(e,t){var r;const n=(r=t.chart)==null?void 0:r.dataset;n&&(e.chart=e.chart??{},e.chart.dataset=e.chart.dataset??{},Array.isArray(n.backgroundColor)&&(e.chart.dataset.backgroundColor=[...n.backgroundColor]),Array.isArray(n.borderColor)&&(e.chart.dataset.borderColor=[...n.borderColor]))}var yh=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(){}},fme={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Wa,mf,eq,hme=(eq=class{constructor(){It(this,Wa,fme);It(this,mf,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&fe(this,mf)&&e!==fe(this,Wa)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:fe(this,Wa),provider:e}),dt(this,Wa,e),process.env.NODE_ENV!=="production"&&dt(this,mf,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&dt(this,mf,!0),fe(this,Wa).setTimeout(e,t)}clearTimeout(e){fe(this,Wa).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&dt(this,mf,!0),fe(this,Wa).setInterval(e,t)}clearInterval(e){fe(this,Wa).clearInterval(e)}},Wa=new WeakMap,mf=new WeakMap,eq),nf=new hme;function mme(e){setTimeout(e,0)}var Hf=typeof window>"u"||"Deno"in globalThis;function Ks(){}function pme(e,t){return typeof e=="function"?e(t):e}function zD(e){return typeof e=="number"&&e>=0&&e!==1/0}function bq(e,t){return Math.max(e+(t||0)-Date.now(),0)}function yu(e,t){return typeof e=="function"?e(t):e}function Ei(e,t){return typeof e=="function"?e(t):e}function t$(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:o,queryKey:i,stale:a}=e;if(i){if(r){if(t.queryHash!==FR(i,t.options))return!1}else if(!ty(t.queryKey,i))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||o&&!o(t))}function n$(e,t){const{exact:n,status:r,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Uf(t.options.mutationKey)!==Uf(o))return!1}else if(!ty(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function FR(e,t){return((t==null?void 0:t.queryKeyHashFn)||Uf)(e)}function Uf(e){return JSON.stringify(e,(t,n)=>BD(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function ty(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>ty(e[n],t[n])):!1}var gme=Object.prototype.hasOwnProperty;function B1(e,t){if(e===t)return e;const n=r$(e)&&r$(t);if(!n&&!(BD(e)&&BD(t)))return t;const s=(n?e:Object.keys(e)).length,o=n?t:Object.keys(t),i=o.length,a=n?new Array(i):{};let c=0;for(let u=0;u<i;u++){const d=n?u:o[u],f=e[d],h=t[d];if(f===h){a[d]=f,(n?u<s:gme.call(e,d))&&c++;continue}if(f===null||h===null||typeof f!="object"||typeof h!="object"){a[d]=h;continue}const m=B1(f,h);a[d]=m,m===f&&c++}return s===i&&c===s?e:a}function ny(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function r$(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function BD(e){if(!s$(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!s$(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function s$(e){return Object.prototype.toString.call(e)==="[object Object]"}function bme(e){return new Promise(t=>{nf.setTimeout(t,e)})}function VD(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return B1(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return B1(e,t)}return t}function xme(e){return e}function yme(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function vme(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var V1=Symbol();function xq(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===V1&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===V1?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function yq(e,t){return typeof e=="function"?e(...t):!!e}var pf,Qc,Qm,tq,wme=(tq=class extends yh{constructor(){super();It(this,pf);It(this,Qc);It(this,Qm);dt(this,Qm,t=>{if(!Hf&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){fe(this,Qc)||this.setEventListener(fe(this,Qm))}onUnsubscribe(){var t;this.hasListeners()||((t=fe(this,Qc))==null||t.call(this),dt(this,Qc,void 0))}setEventListener(t){var n;dt(this,Qm,t),(n=fe(this,Qc))==null||n.call(this),dt(this,Qc,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){fe(this,pf)!==t&&(dt(this,pf,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof fe(this,pf)=="boolean"?fe(this,pf):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},pf=new WeakMap,Qc=new WeakMap,Qm=new WeakMap,tq),OR=new wme;function HD(){let e,t;const n=new Promise((s,o)=>{e=s,t=o});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var Sme=mme;function Cme(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=Sme;const o=a=>{t?e.push(a):s(()=>{n(a)})},i=()=>{const a=e;e=[],a.length&&s(()=>{r(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||i()}return c},batchCalls:a=>(...c)=>{o(()=>{a(...c)})},schedule:o,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{s=a}}}var Pr=Cme(),Jm,Jc,ep,nq,Nme=(nq=class extends yh{constructor(){super();It(this,Jm,!0);It(this,Jc);It(this,ep);dt(this,ep,t=>{if(!Hf&&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(){fe(this,Jc)||this.setEventListener(fe(this,ep))}onUnsubscribe(){var t;this.hasListeners()||((t=fe(this,Jc))==null||t.call(this),dt(this,Jc,void 0))}setEventListener(t){var n;dt(this,ep,t),(n=fe(this,Jc))==null||n.call(this),dt(this,Jc,t(this.setOnline.bind(this)))}setOnline(t){fe(this,Jm)!==t&&(dt(this,Jm,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return fe(this,Jm)}},Jm=new WeakMap,Jc=new WeakMap,ep=new WeakMap,nq),H1=new Nme;function kme(e){return Math.min(1e3*2**e,3e4)}function vq(e){return(e??"online")==="online"?H1.isOnline():!0}var UD=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function wq(e){let t=!1,n=0,r;const s=HD(),o=()=>s.status!=="pending",i=b=>{var x;if(!o()){const y=new UD(b);h(y),(x=e.onCancel)==null||x.call(e,y)}},a=()=>{t=!0},c=()=>{t=!1},u=()=>OR.isFocused()&&(e.networkMode==="always"||H1.isOnline())&&e.canRun(),d=()=>vq(e.networkMode)&&e.canRun(),f=b=>{o()||(r==null||r(),s.resolve(b))},h=b=>{o()||(r==null||r(),s.reject(b))},m=()=>new Promise(b=>{var x;r=y=>{(o()||u())&&b(y)},(x=e.onPause)==null||x.call(e)}).then(()=>{var b;r=void 0,o()||(b=e.onContinue)==null||b.call(e)}),g=()=>{if(o())return;let b;const x=n===0?e.initialPromise:void 0;try{b=x??e.fn()}catch(y){b=Promise.reject(y)}Promise.resolve(b).then(f).catch(y=>{var k;if(o())return;const w=e.retry??(Hf?0:3),v=e.retryDelay??kme,C=typeof v=="function"?v(n,y):v,N=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,y);if(t||!N){h(y);return}n++,(k=e.onFail)==null||k.call(e,n,y),bme(C).then(()=>u()?void 0:m()).then(()=>{t?h(y):g()})})};return{promise:s,status:()=>s.status,cancel:i,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?g():m().then(g),s)}}var gf,rq,Sq=(rq=class{constructor(){It(this,gf)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),zD(this.gcTime)&&dt(this,gf,nf.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Hf?1/0:5*60*1e3))}clearGcTimeout(){fe(this,gf)&&(nf.clearTimeout(fe(this,gf)),dt(this,gf,void 0))}},gf=new WeakMap,rq),bf,tp,_i,xf,hs,b0,yf,oa,Rl,sq,_me=(sq=class extends Sq{constructor(t){super();It(this,oa);It(this,bf);It(this,tp);It(this,_i);It(this,xf);It(this,hs);It(this,b0);It(this,yf);dt(this,yf,!1),dt(this,b0,t.defaultOptions),this.setOptions(t.options),this.observers=[],dt(this,xf,t.client),dt(this,_i,fe(this,xf).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,dt(this,bf,i$(this.options)),this.state=t.state??fe(this,bf),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=fe(this,hs))==null?void 0:t.promise}setOptions(t){if(this.options={...fe(this,b0),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=i$(this.options);n.data!==void 0&&(this.setState(o$(n.data,n.dataUpdatedAt)),dt(this,bf,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&fe(this,_i).remove(this)}setData(t,n){const r=VD(this.state.data,t,this.options);return Ht(this,oa,Rl).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Ht(this,oa,Rl).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=fe(this,hs))==null?void 0:r.promise;return(s=fe(this,hs))==null||s.cancel(t),n?n.then(Ks).catch(Ks):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(fe(this,bf))}isActive(){return this.observers.some(t=>Ei(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===V1||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>yu(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!bq(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=fe(this,hs))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=fe(this,hs))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),fe(this,_i).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(fe(this,hs)&&(fe(this,yf)?fe(this,hs).cancel({revert:!0}):fe(this,hs).cancelRetry()),this.scheduleGc()),fe(this,_i).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ht(this,oa,Rl).call(this,{type:"invalidate"})}async fetch(t,n){var c,u,d,f,h,m,g,b,x,y,w,v;if(this.state.fetchStatus!=="idle"&&((c=fe(this,hs))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(fe(this,hs))return fe(this,hs).continueRetry(),fe(this,hs).promise}if(t&&this.setOptions(t),!this.options.queryFn){const C=this.observers.find(N=>N.options.queryFn);C&&this.setOptions(C.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,s=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(dt(this,yf,!0),r.signal)})},o=()=>{const C=xq(this.options,n),k=(()=>{const _={client:fe(this,xf),queryKey:this.queryKey,meta:this.meta};return s(_),_})();return dt(this,yf,!1),this.options.persister?this.options.persister(C,k,this):C(k)},a=(()=>{const C={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:fe(this,xf),state:this.state,fetchFn:o};return s(C),C})();(u=this.options.behavior)==null||u.onFetch(a,this),dt(this,tp,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&Ht(this,oa,Rl).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),dt(this,hs,wq({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:C=>{C instanceof UD&&C.revert&&this.setState({...fe(this,tp),fetchStatus:"idle"}),r.abort()},onFail:(C,N)=>{Ht(this,oa,Rl).call(this,{type:"failed",failureCount:C,error:N})},onPause:()=>{Ht(this,oa,Rl).call(this,{type:"pause"})},onContinue:()=>{Ht(this,oa,Rl).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const C=await fe(this,hs).start();if(C===void 0)throw 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}`),new Error(`${this.queryHash} data is undefined`);return this.setData(C),(m=(h=fe(this,_i).config).onSuccess)==null||m.call(h,C,this),(b=(g=fe(this,_i).config).onSettled)==null||b.call(g,C,this.state.error,this),C}catch(C){if(C instanceof UD){if(C.silent)return fe(this,hs).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw Ht(this,oa,Rl).call(this,{type:"error",error:C}),(y=(x=fe(this,_i).config).onError)==null||y.call(x,C,this),(v=(w=fe(this,_i).config).onSettled)==null||v.call(w,this.state.data,C,this),C}finally{this.scheduleGc()}}},bf=new WeakMap,tp=new WeakMap,_i=new WeakMap,xf=new WeakMap,hs=new WeakMap,b0=new WeakMap,yf=new WeakMap,oa=new WeakSet,Rl=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,...Cq(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...o$(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return dt(this,tp,t.manual?s:void 0),s;case"error":const o=t.error;return{...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),Pr.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),fe(this,_i).notify({query:this,type:"updated",action:t})})},sq);function Cq(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:vq(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function o$(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function i$(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,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 Fo,Nn,x0,bo,vf,np,Ul,eu,y0,rp,sp,wf,Sf,tu,op,Zn,Vb,qD,WD,GD,YD,KD,ZD,XD,Nq,oq,LR=(oq=class extends yh{constructor(t,n){super();It(this,Zn);It(this,Fo);It(this,Nn);It(this,x0);It(this,bo);It(this,vf);It(this,np);It(this,Ul);It(this,eu);It(this,y0);It(this,rp);It(this,sp);It(this,wf);It(this,Sf);It(this,tu);It(this,op,new Set);this.options=n,dt(this,Fo,t),dt(this,eu,null),dt(this,Ul,HD()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(fe(this,Nn).addObserver(this),a$(fe(this,Nn),this.options)?Ht(this,Zn,Vb).call(this):this.updateResult(),Ht(this,Zn,YD).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return QD(fe(this,Nn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return QD(fe(this,Nn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ht(this,Zn,KD).call(this),Ht(this,Zn,ZD).call(this),fe(this,Nn).removeObserver(this)}setOptions(t){const n=this.options,r=fe(this,Nn);if(this.options=fe(this,Fo).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ei(this.options.enabled,fe(this,Nn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ht(this,Zn,XD).call(this),fe(this,Nn).setOptions(this.options),n._defaulted&&!ny(this.options,n)&&fe(this,Fo).getQueryCache().notify({type:"observerOptionsUpdated",query:fe(this,Nn),observer:this});const s=this.hasListeners();s&&l$(fe(this,Nn),r,this.options,n)&&Ht(this,Zn,Vb).call(this),this.updateResult(),s&&(fe(this,Nn)!==r||Ei(this.options.enabled,fe(this,Nn))!==Ei(n.enabled,fe(this,Nn))||yu(this.options.staleTime,fe(this,Nn))!==yu(n.staleTime,fe(this,Nn)))&&Ht(this,Zn,qD).call(this);const o=Ht(this,Zn,WD).call(this);s&&(fe(this,Nn)!==r||Ei(this.options.enabled,fe(this,Nn))!==Ei(n.enabled,fe(this,Nn))||o!==fe(this,tu))&&Ht(this,Zn,GD).call(this,o)}getOptimisticResult(t){const n=fe(this,Fo).getQueryCache().build(fe(this,Fo),t),r=this.createResult(n,t);return Ime(this,r)&&(dt(this,bo,r),dt(this,np,this.options),dt(this,vf,fe(this,Nn).state)),r}getCurrentResult(){return fe(this,bo)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&fe(this,Ul).status==="pending"&&fe(this,Ul).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){fe(this,op).add(t)}getCurrentQuery(){return fe(this,Nn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=fe(this,Fo).defaultQueryOptions(t),r=fe(this,Fo).getQueryCache().build(fe(this,Fo),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Ht(this,Zn,Vb).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),fe(this,bo)))}createResult(t,n){var E;const r=fe(this,Nn),s=this.options,o=fe(this,bo),i=fe(this,vf),a=fe(this,np),u=t!==r?t.state:fe(this,x0),{state:d}=t;let f={...d},h=!1,m;if(n._optimisticResults){const I=this.hasListeners(),T=!I&&a$(t,n),D=I&&l$(t,r,n,s);(T||D)&&(f={...f,...Cq(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:b,status:x}=f;m=f.data;let y=!1;if(n.placeholderData!==void 0&&m===void 0&&x==="pending"){let I;o!=null&&o.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(I=o.data,y=!0):I=typeof n.placeholderData=="function"?n.placeholderData((E=fe(this,sp))==null?void 0:E.state.data,fe(this,sp)):n.placeholderData,I!==void 0&&(x="success",m=VD(o==null?void 0:o.data,I,n),h=!0)}if(n.select&&m!==void 0&&!y)if(o&&m===(i==null?void 0:i.data)&&n.select===fe(this,y0))m=fe(this,rp);else try{dt(this,y0,n.select),m=n.select(m),m=VD(o==null?void 0:o.data,m,n),dt(this,rp,m),dt(this,eu,null)}catch(I){dt(this,eu,I)}fe(this,eu)&&(g=fe(this,eu),m=fe(this,rp),b=Date.now(),x="error");const w=f.fetchStatus==="fetching",v=x==="pending",C=x==="error",N=v&&w,k=m!==void 0,j={status:x,fetchStatus:f.fetchStatus,isPending:v,isSuccess:x==="success",isError:C,isInitialLoading:N,isLoading:N,data:m,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:b,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:w,isRefetching:w&&!v,isLoadingError:C&&!k,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:C&&k,isStale:$R(t,n),refetch:this.refetch,promise:fe(this,Ul),isEnabled:Ei(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const I=R=>{j.status==="error"?R.reject(j.error):j.data!==void 0&&R.resolve(j.data)},T=()=>{const R=dt(this,Ul,j.promise=HD());I(R)},D=fe(this,Ul);switch(D.status){case"pending":t.queryHash===r.queryHash&&I(D);break;case"fulfilled":(j.status==="error"||j.data!==D.value)&&T();break;case"rejected":(j.status!=="error"||j.error!==D.reason)&&T();break}}return j}updateResult(){const t=fe(this,bo),n=this.createResult(fe(this,Nn),this.options);if(dt(this,vf,fe(this,Nn).state),dt(this,np,this.options),fe(this,vf).data!==void 0&&dt(this,sp,fe(this,Nn)),ny(n,t))return;dt(this,bo,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!fe(this,op).size)return!0;const i=new Set(o??fe(this,op));return this.options.throwOnError&&i.add("error"),Object.keys(fe(this,bo)).some(a=>{const c=a;return fe(this,bo)[c]!==t[c]&&i.has(c)})};Ht(this,Zn,Nq).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ht(this,Zn,YD).call(this)}},Fo=new WeakMap,Nn=new WeakMap,x0=new WeakMap,bo=new WeakMap,vf=new WeakMap,np=new WeakMap,Ul=new WeakMap,eu=new WeakMap,y0=new WeakMap,rp=new WeakMap,sp=new WeakMap,wf=new WeakMap,Sf=new WeakMap,tu=new WeakMap,op=new WeakMap,Zn=new WeakSet,Vb=function(t){Ht(this,Zn,XD).call(this);let n=fe(this,Nn).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ks)),n},qD=function(){Ht(this,Zn,KD).call(this);const t=yu(this.options.staleTime,fe(this,Nn));if(Hf||fe(this,bo).isStale||!zD(t))return;const r=bq(fe(this,bo).dataUpdatedAt,t)+1;dt(this,wf,nf.setTimeout(()=>{fe(this,bo).isStale||this.updateResult()},r))},WD=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(fe(this,Nn)):this.options.refetchInterval)??!1},GD=function(t){Ht(this,Zn,ZD).call(this),dt(this,tu,t),!(Hf||Ei(this.options.enabled,fe(this,Nn))===!1||!zD(fe(this,tu))||fe(this,tu)===0)&&dt(this,Sf,nf.setInterval(()=>{(this.options.refetchIntervalInBackground||OR.isFocused())&&Ht(this,Zn,Vb).call(this)},fe(this,tu)))},YD=function(){Ht(this,Zn,qD).call(this),Ht(this,Zn,GD).call(this,Ht(this,Zn,WD).call(this))},KD=function(){fe(this,wf)&&(nf.clearTimeout(fe(this,wf)),dt(this,wf,void 0))},ZD=function(){fe(this,Sf)&&(nf.clearInterval(fe(this,Sf)),dt(this,Sf,void 0))},XD=function(){const t=fe(this,Fo).getQueryCache().build(fe(this,Fo),this.options);if(t===fe(this,Nn))return;const n=fe(this,Nn);dt(this,Nn,t),dt(this,x0,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Nq=function(t){Pr.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(fe(this,bo))}),fe(this,Fo).getQueryCache().notify({query:fe(this,Nn),type:"observerResultsUpdated"})})},oq);function jme(e,t){return Ei(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function a$(e,t){return jme(e,t)||e.state.data!==void 0&&QD(e,t,t.refetchOnMount)}function QD(e,t,n){if(Ei(t.enabled,e)!==!1&&yu(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&$R(e,t)}return!1}function l$(e,t,n,r){return(e!==t||Ei(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&$R(e,n)}function $R(e,t){return Ei(t.enabled,e)!==!1&&e.isStaleByTime(yu(t.staleTime,e))}function Ime(e,t){return!ny(e.getCurrentResult(),t)}function c$(e){return{onFetch:(t,n)=>{var d,f,h,m,g;const r=t.options,s=(h=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,o=((m=t.state.data)==null?void 0:m.pages)||[],i=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let b=!1;const x=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(t.signal.aborted?b=!0:t.signal.addEventListener("abort",()=>{b=!0}),t.signal)})},y=xq(t.options,t.fetchOptions),w=async(v,C,N)=>{if(b)return Promise.reject();if(C==null&&v.pages.length)return Promise.resolve(v);const _=(()=>{const T={client:t.client,queryKey:t.queryKey,pageParam:C,direction:N?"backward":"forward",meta:t.options.meta};return x(T),T})(),j=await y(_),{maxPages:E}=t.options,I=N?vme:yme;return{pages:I(v.pages,j,E),pageParams:I(v.pageParams,C,E)}};if(s&&o.length){const v=s==="backward",C=v?Eme:u$,N={pages:o,pageParams:i},k=C(r,N);a=await w(N,k,v)}else{const v=e??o.length;do{const C=c===0?i[0]??r.initialPageParam:u$(r,a);if(c>0&&C==null)break;a=await w(a,C),c++}while(c<v)}return a};t.options.persister?t.fetchFn=()=>{var b,x;return(x=(b=t.options).persister)==null?void 0:x.call(b,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function u$(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Eme(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var v0,Ga,xo,Cf,Ya,Wc,iq,Tme=(iq=class extends Sq{constructor(t){super();It(this,Ya);It(this,v0);It(this,Ga);It(this,xo);It(this,Cf);dt(this,v0,t.client),this.mutationId=t.mutationId,dt(this,xo,t.mutationCache),dt(this,Ga,[]),this.state=t.state||kq(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){fe(this,Ga).includes(t)||(fe(this,Ga).push(t),this.clearGcTimeout(),fe(this,xo).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){dt(this,Ga,fe(this,Ga).filter(n=>n!==t)),this.scheduleGc(),fe(this,xo).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){fe(this,Ga).length||(this.state.status==="pending"?this.scheduleGc():fe(this,xo).remove(this))}continue(){var t;return((t=fe(this,Cf))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,a,c,u,d,f,h,m,g,b,x,y,w,v,C,N,k,_,j,E;const n=()=>{Ht(this,Ya,Wc).call(this,{type:"continue"})},r={client:fe(this,v0),meta:this.options.meta,mutationKey:this.options.mutationKey};dt(this,Cf,wq({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(I,T)=>{Ht(this,Ya,Wc).call(this,{type:"failed",failureCount:I,error:T})},onPause:()=>{Ht(this,Ya,Wc).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>fe(this,xo).canRun(this)}));const s=this.state.status==="pending",o=!fe(this,Cf).canStart();try{if(s)n();else{Ht(this,Ya,Wc).call(this,{type:"pending",variables:t,isPaused:o}),await((a=(i=fe(this,xo).config).onMutate)==null?void 0:a.call(i,t,this,r));const T=await((u=(c=this.options).onMutate)==null?void 0:u.call(c,t,r));T!==this.state.context&&Ht(this,Ya,Wc).call(this,{type:"pending",context:T,variables:t,isPaused:o})}const I=await fe(this,Cf).start();return await((f=(d=fe(this,xo).config).onSuccess)==null?void 0:f.call(d,I,t,this.state.context,this,r)),await((m=(h=this.options).onSuccess)==null?void 0:m.call(h,I,t,this.state.context,r)),await((b=(g=fe(this,xo).config).onSettled)==null?void 0:b.call(g,I,null,this.state.variables,this.state.context,this,r)),await((y=(x=this.options).onSettled)==null?void 0:y.call(x,I,null,t,this.state.context,r)),Ht(this,Ya,Wc).call(this,{type:"success",data:I}),I}catch(I){try{throw await((v=(w=fe(this,xo).config).onError)==null?void 0:v.call(w,I,t,this.state.context,this,r)),await((N=(C=this.options).onError)==null?void 0:N.call(C,I,t,this.state.context,r)),await((_=(k=fe(this,xo).config).onSettled)==null?void 0:_.call(k,void 0,I,this.state.variables,this.state.context,this,r)),await((E=(j=this.options).onSettled)==null?void 0:E.call(j,void 0,I,t,this.state.context,r)),I}finally{Ht(this,Ya,Wc).call(this,{type:"error",error:I})}}finally{fe(this,xo).runNext(this)}}},v0=new WeakMap,Ga=new WeakMap,xo=new WeakMap,Cf=new WeakMap,Ya=new WeakSet,Wc=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:t.isPaused,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),Pr.batch(()=>{fe(this,Ga).forEach(r=>{r.onMutationUpdate(t)}),fe(this,xo).notify({mutation:this,type:"updated",action:t})})},iq);function kq(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ql,ia,w0,aq,Dme=(aq=class extends yh{constructor(t={}){super();It(this,ql);It(this,ia);It(this,w0);this.config=t,dt(this,ql,new Set),dt(this,ia,new Map),dt(this,w0,0)}build(t,n,r){const s=new Tme({client:t,mutationCache:this,mutationId:++Qv(this,w0)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){fe(this,ql).add(t);const n=ew(t);if(typeof n=="string"){const r=fe(this,ia).get(n);r?r.push(t):fe(this,ia).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(fe(this,ql).delete(t)){const n=ew(t);if(typeof n=="string"){const r=fe(this,ia).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&fe(this,ia).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=ew(t);if(typeof n=="string"){const r=fe(this,ia).get(n),s=r==null?void 0:r.find(o=>o.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=ew(t);if(typeof n=="string"){const s=(r=fe(this,ia).get(n))==null?void 0:r.find(o=>o!==t&&o.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Pr.batch(()=>{fe(this,ql).forEach(t=>{this.notify({type:"removed",mutation:t})}),fe(this,ql).clear(),fe(this,ia).clear()})}getAll(){return Array.from(fe(this,ql))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>n$(n,r))}findAll(t={}){return this.getAll().filter(n=>n$(t,n))}notify(t){Pr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Pr.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ks))))}},ql=new WeakMap,ia=new WeakMap,w0=new WeakMap,aq);function ew(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Wl,nu,Oo,Gl,xc,YS,JD,lq,Mme=(lq=class extends yh{constructor(n,r){super();It(this,xc);It(this,Wl);It(this,nu);It(this,Oo);It(this,Gl);dt(this,Wl,n),this.setOptions(r),this.bindMethods(),Ht(this,xc,YS).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const r=this.options;this.options=fe(this,Wl).defaultMutationOptions(n),ny(this.options,r)||fe(this,Wl).getMutationCache().notify({type:"observerOptionsUpdated",mutation:fe(this,Oo),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Uf(r.mutationKey)!==Uf(this.options.mutationKey)?this.reset():((s=fe(this,Oo))==null?void 0:s.state.status)==="pending"&&fe(this,Oo).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=fe(this,Oo))==null||n.removeObserver(this)}onMutationUpdate(n){Ht(this,xc,YS).call(this),Ht(this,xc,JD).call(this,n)}getCurrentResult(){return fe(this,nu)}reset(){var n;(n=fe(this,Oo))==null||n.removeObserver(this),dt(this,Oo,void 0),Ht(this,xc,YS).call(this),Ht(this,xc,JD).call(this)}mutate(n,r){var s;return dt(this,Gl,r),(s=fe(this,Oo))==null||s.removeObserver(this),dt(this,Oo,fe(this,Wl).getMutationCache().build(fe(this,Wl),this.options)),fe(this,Oo).addObserver(this),fe(this,Oo).execute(n)}},Wl=new WeakMap,nu=new WeakMap,Oo=new WeakMap,Gl=new WeakMap,xc=new WeakSet,YS=function(){var r;const n=((r=fe(this,Oo))==null?void 0:r.state)??kq();dt(this,nu,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},JD=function(n){Pr.batch(()=>{var r,s,o,i,a,c,u,d;if(fe(this,Gl)&&this.hasListeners()){const f=fe(this,nu).variables,h=fe(this,nu).context,m={client:fe(this,Wl),meta:this.options.meta,mutationKey:this.options.mutationKey};(n==null?void 0:n.type)==="success"?((s=(r=fe(this,Gl)).onSuccess)==null||s.call(r,n.data,f,h,m),(i=(o=fe(this,Gl)).onSettled)==null||i.call(o,n.data,null,f,h,m)):(n==null?void 0:n.type)==="error"&&((c=(a=fe(this,Gl)).onError)==null||c.call(a,n.error,f,h,m),(d=(u=fe(this,Gl)).onSettled)==null||d.call(u,void 0,n.error,f,h,m))}this.listeners.forEach(f=>{f(fe(this,nu))})})},lq);function d$(e,t){const n=new Set(t);return e.filter(r=>!n.has(r))}function Ame(e,t,n){const r=e.slice(0);return r[t]=n,r}var Nf,ni,ip,ap,ji,ru,S0,C0,N0,Hs,e2,t2,n2,r2,s2,cq,Rme=(cq=class extends yh{constructor(t,n,r){super();It(this,Hs);It(this,Nf);It(this,ni);It(this,ip);It(this,ap);It(this,ji);It(this,ru);It(this,S0);It(this,C0);It(this,N0,[]);dt(this,Nf,t),dt(this,ap,r),dt(this,ip,[]),dt(this,ji,[]),dt(this,ni,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&fe(this,ji).forEach(t=>{t.subscribe(n=>{Ht(this,Hs,r2).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,fe(this,ji).forEach(t=>{t.destroy()})}setQueries(t,n){if(dt(this,ip,t),dt(this,ap,n),process.env.NODE_ENV!=="production"){const r=t.map(s=>fe(this,Nf).defaultQueryOptions(s).queryHash);new Set(r).size!==r.length&&console.warn("[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior.")}Pr.batch(()=>{const r=fe(this,ji),s=Ht(this,Hs,n2).call(this,fe(this,ip));dt(this,N0,s),s.forEach(f=>f.observer.setOptions(f.defaultedQueryOptions));const o=s.map(f=>f.observer),i=o.map(f=>f.getCurrentResult()),a=r.length!==o.length,c=o.some((f,h)=>f!==r[h]),u=a||c,d=u?!0:i.some((f,h)=>{const m=fe(this,ni)[h];return!m||!ny(f,m)});!u&&!d||(u&&dt(this,ji,o),dt(this,ni,i),this.hasListeners()&&(u&&(d$(r,o).forEach(f=>{f.destroy()}),d$(o,r).forEach(f=>{f.subscribe(h=>{Ht(this,Hs,r2).call(this,f,h)})})),Ht(this,Hs,s2).call(this)))})}getCurrentResult(){return fe(this,ni)}getQueries(){return fe(this,ji).map(t=>t.getCurrentQuery())}getObservers(){return fe(this,ji)}getOptimisticResult(t,n){const r=Ht(this,Hs,n2).call(this,t),s=r.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions));return[s,o=>Ht(this,Hs,t2).call(this,o??s,n),()=>Ht(this,Hs,e2).call(this,s,r)]}},Nf=new WeakMap,ni=new WeakMap,ip=new WeakMap,ap=new WeakMap,ji=new WeakMap,ru=new WeakMap,S0=new WeakMap,C0=new WeakMap,N0=new WeakMap,Hs=new WeakSet,e2=function(t,n){return n.map((r,s)=>{const o=t[s];return r.defaultedQueryOptions.notifyOnChangeProps?o:r.observer.trackResult(o,i=>{n.forEach(a=>{a.observer.trackProp(i)})})})},t2=function(t,n){return n?((!fe(this,ru)||fe(this,ni)!==fe(this,C0)||n!==fe(this,S0))&&(dt(this,S0,n),dt(this,C0,fe(this,ni)),dt(this,ru,B1(fe(this,ru),n(t)))),fe(this,ru)):t},n2=function(t){const n=new Map;fe(this,ji).forEach(s=>{const o=s.options.queryHash;if(!o)return;const i=n.get(o);i?i.push(s):n.set(o,[s])});const r=[];return t.forEach(s=>{var c;const o=fe(this,Nf).defaultQueryOptions(s),a=((c=n.get(o.queryHash))==null?void 0:c.shift())??new LR(fe(this,Nf),o);r.push({defaultedQueryOptions:o,observer:a})}),r},r2=function(t,n){const r=fe(this,ji).indexOf(t);r!==-1&&(dt(this,ni,Ame(fe(this,ni),r,n)),Ht(this,Hs,s2).call(this))},s2=function(){var t;if(this.hasListeners()){const n=fe(this,ru),r=Ht(this,Hs,e2).call(this,fe(this,ni),fe(this,N0)),s=Ht(this,Hs,t2).call(this,r,(t=fe(this,ap))==null?void 0:t.combine);n!==s&&Pr.batch(()=>{this.listeners.forEach(o=>{o(fe(this,ni))})})}},cq),Ka,uq,_q=(uq=class extends yh{constructor(t={}){super();It(this,Ka);this.config=t,dt(this,Ka,new Map)}build(t,n,r){const s=n.queryKey,o=n.queryHash??FR(s,n);let i=this.get(o);return i||(i=new _me({client:t,queryKey:s,queryHash:o,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(i)),i}add(t){fe(this,Ka).has(t.queryHash)||(fe(this,Ka).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=fe(this,Ka).get(t.queryHash);n&&(t.destroy(),n===t&&fe(this,Ka).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Pr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return fe(this,Ka).get(t)}getAll(){return[...fe(this,Ka).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>t$(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>t$(t,r)):n}notify(t){Pr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Pr.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Pr.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ka=new WeakMap,uq),zr,su,ou,lp,cp,iu,up,dp,dq,Pme=(dq=class{constructor(e={}){It(this,zr);It(this,su);It(this,ou);It(this,lp);It(this,cp);It(this,iu);It(this,up);It(this,dp);dt(this,zr,e.queryCache||new _q),dt(this,su,e.mutationCache||new Dme),dt(this,ou,e.defaultOptions||{}),dt(this,lp,new Map),dt(this,cp,new Map),dt(this,iu,0)}mount(){Qv(this,iu)._++,fe(this,iu)===1&&(dt(this,up,OR.subscribe(async e=>{e&&(await this.resumePausedMutations(),fe(this,zr).onFocus())})),dt(this,dp,H1.subscribe(async e=>{e&&(await this.resumePausedMutations(),fe(this,zr).onOnline())})))}unmount(){var e,t;Qv(this,iu)._--,fe(this,iu)===0&&((e=fe(this,up))==null||e.call(this),dt(this,up,void 0),(t=fe(this,dp))==null||t.call(this),dt(this,dp,void 0))}isFetching(e){return fe(this,zr).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return fe(this,su).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=fe(this,zr).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=fe(this,zr).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(yu(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return fe(this,zr).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=fe(this,zr).get(r.queryHash),o=s==null?void 0:s.state.data,i=pme(t,o);if(i!==void 0)return fe(this,zr).build(this,r).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Pr.batch(()=>fe(this,zr).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=fe(this,zr).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=fe(this,zr);Pr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=fe(this,zr);return Pr.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Pr.batch(()=>fe(this,zr).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ks).catch(Ks)}invalidateQueries(e,t={}){return Pr.batch(()=>(fe(this,zr).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Pr.batch(()=>fe(this,zr).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(Ks)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(Ks)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=fe(this,zr).build(this,t);return n.isStaleByTime(yu(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ks).catch(Ks)}fetchInfiniteQuery(e){return e.behavior=c$(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ks).catch(Ks)}ensureInfiniteQueryData(e){return e.behavior=c$(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return H1.isOnline()?fe(this,su).resumePausedMutations():Promise.resolve()}getQueryCache(){return fe(this,zr)}getMutationCache(){return fe(this,su)}getDefaultOptions(){return fe(this,ou)}setDefaultOptions(e){dt(this,ou,e)}setQueryDefaults(e,t){fe(this,lp).set(Uf(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...fe(this,lp).values()],n={};return t.forEach(r=>{ty(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){fe(this,cp).set(Uf(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...fe(this,cp).values()],n={};return t.forEach(r=>{ty(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...fe(this,ou).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=FR(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===V1&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...fe(this,ou).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){fe(this,zr).clear(),fe(this,su).clear()}},zr=new WeakMap,su=new WeakMap,ou=new WeakMap,lp=new WeakMap,cp=new WeakMap,iu=new WeakMap,up=new WeakMap,dp=new WeakMap,dq),zR=Q.createContext(void 0),Xr=e=>{const t=Q.useContext(zR);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Fme=({client:e,children:t})=>(Q.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(zR.Provider,{value:e,children:t})),jq=Q.createContext(!1),Iq=()=>Q.useContext(jq);jq.Provider;function Ome(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Lme=Q.createContext(Ome()),Eq=()=>Q.useContext(Lme),Tq=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Dq=e=>{Q.useEffect(()=>{e.clearReset()},[e])},Mq=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||yq(n,[e.error,r])),Aq=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Rq=(e,t)=>e.isLoading&&e.isFetching&&!t,o2=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,U1=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Wp({queries:e,...t},n){const r=Xr(),s=Iq(),o=Eq(),i=Q.useMemo(()=>e.map(b=>{const x=r.defaultQueryOptions(b);return x._optimisticResults=s?"isRestoring":"optimistic",x}),[e,r,s]);i.forEach(b=>{Aq(b),Tq(b,o)}),Dq(o);const[a]=Q.useState(()=>new Rme(r,i,t)),[c,u,d]=a.getOptimisticResult(i,t.combine),f=!s&&t.subscribed!==!1;Q.useSyncExternalStore(Q.useCallback(b=>f?a.subscribe(Pr.batchCalls(b)):Ks,[a,f]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),Q.useEffect(()=>{a.setQueries(i,t)},[i,t,a]);const m=c.some((b,x)=>o2(i[x],b))?c.flatMap((b,x)=>{const y=i[x];if(y){const w=new LR(r,y);if(o2(y,b))return U1(y,w,o);Rq(b,s)&&U1(y,w,o)}return[]}):[];if(m.length>0)throw Promise.all(m);const g=c.find((b,x)=>{const y=i[x];return y&&Mq({result:b,errorResetBoundary:o,throwOnError:y.throwOnError,query:r.getQueryCache().get(y.queryHash),suspense:y.suspense})});if(g!=null&&g.error)throw g.error;return u(d())}function $me(e,t,n){var f,h,m,g,b;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=Iq(),s=Eq(),o=Xr(),i=o.defaultQueryOptions(e);(h=(f=o.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||h.call(f,i),process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),i._optimisticResults=r?"isRestoring":"optimistic",Aq(i),Tq(i,s),Dq(s);const a=!o.getQueryCache().get(i.queryHash),[c]=Q.useState(()=>new t(o,i)),u=c.getOptimisticResult(i),d=!r&&e.subscribed!==!1;if(Q.useSyncExternalStore(Q.useCallback(x=>{const y=d?c.subscribe(Pr.batchCalls(x)):Ks;return c.updateResult(),y},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),Q.useEffect(()=>{c.setOptions(i)},[i,c]),o2(i,u))throw U1(i,c,s);if(Mq({result:u,errorResetBoundary:s,throwOnError:i.throwOnError,query:o.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw u.error;if((g=(m=o.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||g.call(m,i,u),i.experimental_prefetchInRender&&!Hf&&Rq(u,r)){const x=a?U1(i,c,s):(b=o.getQueryCache().get(i.queryHash))==null?void 0:b.promise;x==null||x.catch(Ks).finally(()=>{c.updateResult()})}return i.notifyOnChangeProps?u:c.trackResult(u)}function An(e,t){return $me(e,LR)}function zme(e,t){const n=Xr(),r=n.getQueryCache();return Q.useSyncExternalStore(Q.useCallback(s=>r.subscribe(Pr.batchCalls(s)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}function so(e,t){const n=Xr(),[r]=Q.useState(()=>new Mme(n,e));Q.useEffect(()=>{r.setOptions(e)},[r,e]);const s=Q.useSyncExternalStore(Q.useCallback(i=>r.subscribe(Pr.batchCalls(i)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=Q.useCallback((i,a)=>{r.mutate(i,a).catch(Ks)},[r]);if(s.error&&yq(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}function Bme(){const e=S.useContext(zR);if(e&&e.isSemaphorClient)return e}function Pq({children:e}){const{setIsSessionExpired:t}=p.useDashboardActions(),n=Bme(),[r]=S.useState(()=>{const s=new Pme({queryCache:new _q({onError:o=>{o instanceof Error?(console.error(`Something went wrong: ${o.message}`),o.message==="invalid token"&&t(!0)):console.error("Something went wrong:",o)}}),defaultOptions:{queries:{gcTime:36e5,staleTime:3e5,refetchOnWindowFocus:!1,retry:!1}}});return s.isSemaphorClient=!0,s});return n?l.jsx(l.Fragment,{children:e}):l.jsx(Fme,{client:r,children:e})}const Vme={id:"",authToken:void 0,tokenProps:{}},k0=S.createContext(Vme),BR=({children:e,dashboardProps:t})=>{const n=S.useMemo(()=>{let r={};const s=t.authToken;return s&&(r=je.jwtDecode(s.accessToken)),{...t,tokenProps:r}},[t]);return l.jsx(Pq,{children:l.jsx(k0.Provider,{value:n,children:e})})};function mt(){const e=S.useContext(k0);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}const Ls=p.create()(p.immer(e=>({initialDashboard:null,selectedDashboard:null,selectedVisual:null,lastSelectedDashboard:null,lastSelectedVisual:null,showHub:!1,actions:{setInitialDashboard:t=>{e(n=>{n.initialDashboard=t})},selectDashboard:t=>{e(n=>{var r;((r=n.selectedDashboard)==null?void 0:r.id)!==t.id&&(n.lastSelectedDashboard=n.selectedDashboard,n.selectedDashboard=t),n.showHub=!1})},updateSelectedDashboard:t=>{e(n=>{n.selectedDashboard=t})},selectVisual:t=>{e(n=>{n.lastSelectedVisual=n.selectedVisual,n.selectedVisual=t})},clearSelectedDashboard:()=>{e(t=>{t.lastSelectedDashboard=t.selectedDashboard,t.selectedDashboard=null,t.showHub=!0})},clearSelectedVisual:()=>{e(t=>{t.lastSelectedVisual=t.selectedVisual,t.selectedVisual=null})},setShowHub:t=>{e(n=>{n.showHub=t})}}}))),Hme=()=>Ls(e=>e.selectedVisual),vh=()=>Ls(e=>e.actions);function _0(){const{authToken:e,version:t,tokenProps:n,id:r}=mt(),s=Ls(g=>g.selectedDashboard),o=Ls(g=>g.showHub),i=p.useDashboardStore(g=>g.selectedLensId),a=Ume({showHub:o,selectedDashboardId:s==null?void 0:s.id,dashboardId:r,tokenDashboardId:n==null?void 0:n.dashboard_id});function c(){return!(!(e!=null&&e.accessToken)||!a)}const{data:u,isLoading:d,isFetching:f,isError:h,refetch:m}=An({queryKey:["dashboard",i,e==null?void 0:e.accessToken,a],queryFn:()=>p.getDashboard(n.apiServiceUrl,e==null?void 0:e.accessToken,{lensId:i,version:t,dashboardId:a}),enabled:c()});return{data:u,isLoading:d,isFetching:f,isError:h,refetch:m,dashboardIdToFetch:a}}function Ume({showHub:e,selectedDashboardId:t,dashboardId:n,tokenDashboardId:r}){return e?null:t||n||r||null}function qme(){const{authToken:e}=mt(),t=p.useDashboardStore(r=>r.authToken),{setAuthToken:n}=p.useDashboardActions();return S.useEffect(()=>{const r=e==null?void 0:e.accessToken,s=t==null?void 0:t.accessToken;e&&r!==s&&n(e)},[e,t,n]),e}function Fq(e){const t=S.useCallback(o=>`semaphor-default-sheet-${o}`,[]),n=S.useCallback(()=>{if(!e)return null;try{const o=t(e);return localStorage.getItem(o)}catch(o){return console.error("Error reading default sheet preference:",o),null}},[e,t]),r=S.useCallback(o=>{if(!(!e||!o))try{const i=t(e);localStorage.setItem(i,o)}catch(i){console.error("Error saving default sheet preference:",i)}},[e,t]),s=S.useCallback(()=>{if(e)try{const o=t(e);localStorage.removeItem(o)}catch(o){console.error("Error clearing default sheet preference:",o)}},[e,t]);return{getDefaultSheetId:n,setDefaultSheetId:r,clearDefaultSheetId:s}}function Wme(e,t){if(!e||typeof e!="object"||!("kind"in e))return e;switch(e.kind){case"manual":return{kind:"manual",...t!=null&&t.includePresentation?{options:e.options.map(n=>({value:n.value,label:n.label,presentation:n.presentation}))}:{optionValues:e.options.map(n=>n.value).sort()}};case"dataset_values":return{kind:"dataset_values",fieldId:e.fieldId,connectionId:e.connectionId||""};case"field_allowlist":return{kind:"field_allowlist",fieldIds:[...e.fieldIds].sort()};case"metric_allowlist":return{kind:"metric_allowlist",metricIds:[...e.metricIds].sort()};case"sql_query":return{kind:"sql_query",connectionId:e.connectionId,sql:e.sql,valueColumn:e.valueColumn,labelColumn:e.labelColumn};default:return e}}function Gme(e,t){return{id:e.id,scope:e.scope,type:e.type,source:Wme(e.source,t),initialValueStrategy:e.initialValueStrategy,defaultValue:e.defaultValue,requiredAtExecution:e.requiredAtExecution,...t!=null&&t.includePresentation?{label:e.label,helpText:e.helpText,hidden:e.hidden,locked:e.locked,placement:e.placement,showLabel:e.showLabel,toolbarWidth:e.toolbarWidth}:{}}}function Yme(e){return e.target==="sql_param"?e:{...e,mapping:Object.fromEntries(Object.entries(e.mapping).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>[t,n&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.entries(n).sort(([r],[s])=>r.localeCompare(s))):n]))}}function f$(e=[],t){return[...e].map(n=>Gme(n,t)).sort((n,r)=>n.id.localeCompare(r.id)||n.scope.localeCompare(r.scope)||n.type.localeCompare(r.type))}function Kme(e=[]){return[...e].map(Yme).sort((t,n)=>So.stableSerialize(t).localeCompare(So.stableSerialize(n)))}function i2(e,t){return e?So.stableSerialize({controlDefinitions:f$(e.controlDefinitions,t),cardControlDefinitions:f$(e.cardControlDefinitions,t),controlBindings:Kme(e.controlBindings)}):"__none__"}function Zj(e,t){return e&&t.has(e)?e:null}function Zme({selectedSheetId:e,preservedSelectedSheetId:t,defaultSheetId:n,sheets:r}){var o;const s=new Set((r||[]).map(i=>i.id).filter(i=>typeof i=="string"));return Zj(e,s)||Zj(t,s)||Zj(n,s)||((o=r==null?void 0:r[0])==null?void 0:o.id)||null}function Oq(e){const t=e.trim().split(/[^A-Za-z0-9]+/).filter(Boolean).map(r=>r.toLowerCase());if(!t.length)return"input";const n=t.map((r,s)=>s===0?r:m$(r)).join("");return/^[A-Za-z]/.test(n)?n:`input${m$(n)}`}function VR(e,t){const n=Oq(e);return Lq(n,t)}function j0(e){const n=e.trim().replace(/^\{\{\s*/,"").replace(/\s*\}\}$/,"").replace(/[^A-Za-z0-9_]+/g,"_").replace(/_+/g,"_").replace(/^_+|_+$/g,"");return n?/^[A-Za-z]/.test(n)?n:`input_${n}`:"input"}function Eu(e,t){return Lq(j0(e),t)}function Lq(e,t){const n=new Set(t.map(s=>s.variableName).filter(s=>!!s));if(!n.has(e))return e;let r=2;for(;n.has(`${e}${r}`);)r+=1;return`${e}${r}`}function HR(e){return p.getDataType(e.dataType)==="date"?["label","start","end","range"]:["label","value"]}function UR(e){return Qme(e)?["label","value"]:["value"]}function h$(e){return e.kind==="filter"?`filter:${e.filter.id}`:`control:${e.control.id}`}function Xme(e){return{placement:e.hide||e.displayMode==="canvas"?"hidden":"toolbar",...e.toolbarWidth?{widthPx:e.toolbarWidth}:{}}}function $q(e){return{placement:e.hidden?"hidden":e.placement||(e.scope==="card"?"card_header":"toolbar"),...e.toolbarWidth?{widthPx:e.toolbarWidth}:{}}}function q1(e){return!!e.compatibility}function Qme(e){return e.type==="enum"||e.type==="multi_enum"||e.type==="field_selector"||e.type==="metric_selector"||e.type==="aggregation_selector"||e.type==="grain_selector"}function m$(e){return e&&e[0].toUpperCase()+e.slice(1)}function Jme(e){var i,a;const t=[...e.inputs||[]],n=new Set(t.map(c=>c.id)),r=new Set((e.sheets||[]).filter(c=>c.kind==="document").map(c=>c.id));let s=!1;for(const c of e.sheets||[])if(!(c.kind!=="document"||!((a=(i=c.document)==null?void 0:i.inputs)!=null&&a.length)))for(const u of c.document.inputs)n.has(u.id)||(t.push(epe(u,c.id)),n.add(u.id),s=!0);const o=t.map(c=>{if(c.kind==="filter"&&p$(c,r)&&c.filter.variableName!==c.variableName)return s=!0,{...c,filter:{...c.filter,variableName:c.variableName}};if(c.kind!=="control"||!p$(c,r))return c;const u=Eu(c.control.id||c.variableName,t.filter(d=>d.id!==c.id));return c.variableName===u&&c.control.id===u?c:(s=!0,{...c,variableName:u,control:{...c.control,id:u}})});return s?{...e,inputs:o}:e}function epe(e,t){const n={id:e.id,label:e.label,variableName:e.variableName,description:e.description,requiredAtExecution:e.requiredAtExecution,scope:{kind:"sheets",sheetIds:[t]},runtimeScope:"perSheet",presentation:{placement:"toolbar"},exports:e.exports,compatibility:{source:"documentInput",sheetId:t,inputId:e.id}};return e.kind==="filter"?{...n,kind:"filter",filter:e.filter}:{...n,kind:"control",control:e.control}}function p$(e,t){var n;switch(e.scope.kind){case"allSheets":return!((n=e.scope.sheetKinds)!=null&&n.length)||e.scope.sheetKinds.includes("document");case"sheets":return e.scope.sheetIds.some(r=>t.has(r));case"documentSections":return t.has(e.scope.sheetId);default:return!1}}function tpe(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function npe(e,t){const n=tpe(e);return n==="dark"?dl({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function g$(e,t,n){return ame(npe(e,t),n)}function rpe(e){return So.stableSerialize({hasExplicitDefaultControlValues:e!==void 0,values:e??null})}function spe(e,t){const{controlContractOverrides:n,cardId:r}=t;if(!n||(n.controlDefinitions!==void 0&&(e.controls=n.controlDefinitions),typeof r!="string"||r.trim().length===0))return e;const s=p.findCardById(e,r);return s&&(n.cardControlDefinitions!==void 0&&(s.controls=n.cardControlDefinitions),n.controlBindings!==void 0&&(s.controlBindings=n.controlBindings)),e}function ope(e,t){const n=S.useRef({key:t,value:e});return n.current.key!==t&&(n.current={key:t,value:e}),n.current.value}function ipe({customStyle:e,currentTheme:t,onSave:n,onEvent:r,defaultFilterValues:s,defaultControlValues:o,controlContractOverrides:i,dashboardInputExecutionSnapshot:a,type:c,cardId:u,selectedSheetId:d,onFilterValuesChange:f}){var ge,ie,De,re,me;const{authToken:h,tokenProps:m}=mt();qme();const g=p.useDashboardStore(ve=>ve.selectedLensId),b=p.useDashboardStore(ve=>ve.relaodToken),{data:x,isLoading:y,isFetching:w,isError:v,refetch:C,dashboardIdToFetch:N}=_0(),k=((ie=(ge=m==null?void 0:m.params)==null?void 0:ge.calendarContext)==null?void 0:ie.tz)||((De=m==null?void 0:m.params)==null?void 0:De.timezone)||Intl.DateTimeFormat().resolvedOptions().timeZone,_=(re=x==null?void 0:x.dashboard)==null?void 0:re.id,{getDefaultSheetId:j,clearDefaultSheetId:E}=Fq(_),[I,T]=S.useState(s||[]),D=S.useRef(null),R=S.useRef(null),F=rpe(o),A=i2(i),U=i2(i,{includePresentation:!0}),$=S.useRef(o);$.current=o;const q=S.useRef(F);q.current=F;const W=ope(i,U),O=S.useRef(null),Z=S.useRef(!1),Y=S.useRef({dashboardId:null,defaultControlValuesKey:F,controlContractOverridesKey:A}),{setTheme:M}=PR(),{compiledAppearance:K}=p.useAppearance(),L=p.useDashboardStore(ve=>ve.dashboard.globalStyle),z=S.useMemo(()=>x!=null&&x.dashboard?Jme(spe($o(x.dashboard),{controlContractOverrides:W,cardId:u})):void 0,[x==null?void 0:x.dashboard,W,c,u]),{setDashboardWithFilterValues:B,hydrateRuntimeControlValues:V,setStyle:P,setOnSaveFunction:H,setLenses:G,setSelectedLensId:X,setInlineFilterValuesMap:ne}=p.useDashboardActions();p.useDashboardStore(ve=>ve.actions.setCustomCards);const de=p.useDashboardStore(ve=>ve.filterValues),he=p.useDashboardStore(ve=>ve.actions.setThemeStyle),pe=p.useDashboardStore(ve=>ve.actions.setDashboardTheme),xe=p.useDashboardStore(ve=>ve.actions.setOnEvent);S.useEffect(()=>{const ve=R.current;ve&&ve!==N&&p.storeEvents.emit("dashboard:unload"),R.current=N},[N]),S.useEffect(()=>{b&&C()},[C,b]),S.useEffect(()=>{var ee;const ve=((ee=x==null?void 0:x.dashboard)==null?void 0:ee.id)||null,J=D.current;ve&&ve!==J&&p.storeEvents.emit("dashboard:load"),D.current=ve},[(me=x==null?void 0:x.dashboard)==null?void 0:me.id]),S.useEffect(()=>{pe(K.mode)},[K.mode,pe]),S.useEffect(()=>{t&&M(t)},[t,M]);const se=S.useCallback(()=>{const ve=$o(p.DEFAULT_STYLE),J=dl(ve,L);if(e){const ee=dl(J,e),te=g$(K.mode,ee,K);he(te),P(ee)}else{const ee=g$(K.mode,J,K);he(ee),P(p.DEFAULT_STYLE)}},[K,e,L,he,P]);return S.useEffect(()=>{x&&x.dashboard&&se()},[K.mode,e,L,se,x]),S.useEffect(()=>{var Fe,Ue,nt,Re;function ve(Ee,Ge){const yt=Ee.filters||[],xt=[];for(const ft of Ge){const wt=yt.find(ot=>ot.id===ft.filterId);wt&&xt.push({filterId:ft.filterId,name:wt.column,operation:ft.operation,valueType:p.getFilterValueType(wt),values:ft.values,dataType:wt.dataType,fieldMeta:wt.fieldMeta,semanticContext:wt.semanticContext})}return xt}if(!x||!z)return;const J=z,{filterValues:ee,defaultLensId:te,lenses:ue}=x;function le(){if(ee&&(ee==null?void 0:ee.length)>0)return ee;const Ge=[...p.buildFilterValuesFromDefaults(J.filters,k)];if(J.defaultFilterValues&&J.defaultFilterValues.length>0)for(const ft of J.defaultFilterValues){const wt=Ge.findIndex(ot=>ot.filterId===ft.filterId);wt>=0?Ge[wt]=ft:Ge.push(ft)}const yt=ve(J,I||[]),xt=[...Ge];for(const ft of yt){const wt=xt.findIndex(ot=>ot.filterId===ft.filterId);wt>=0?xt[wt]=ft:xt.push(ft)}return xt}const ke=p.useDashboardStore.getState(),Se=O.current===z.id&&((Fe=ke.dashboard)==null?void 0:Fe.id)===z.id,oe=le(),Ie=Se?p.resolveSameDashboardFilterValues({previousFilters:(Ue=ke.dashboard)==null?void 0:Ue.filters,nextFilters:J.filters,currentFilterValues:ke.filterValues,defaultFilterValues:oe}):oe,Ne=p.computeInlineFilterDefaults(J,k),Le=Se&&Y.current.controlContractOverridesKey===A?p.flattenRuntimeControlValues({dashboardValues:ke.controlValues,cardValuesMap:ke.cardControlValuesMap}):$.current,Ye=ke.selectedSheetId;let $e=j(),Ve=Ye;Ve&&((nt=z==null?void 0:z.sheets)!=null&&nt.some(Ge=>Ge.id===Ve)||(Ve=null)),$e&&((Re=z==null?void 0:z.sheets)!=null&&Re.some(Ge=>Ge.id===$e)||(E(),$e=null));const Ze=Zme({selectedSheetId:d,preservedSelectedSheetId:Ve,defaultSheetId:$e,sheets:z==null?void 0:z.sheets}),Ce=!!a,et=!Ce&&Z.current;B(J,Ie||[],Le,{selectedSheetId:Ze,...x!=null&&x.semanticExecutionPayload?{semanticExecutionPayload:x.semanticExecutionPayload}:{},...a?{dashboardInputValues:a.dashboardInputValues,dashboardInputValuesAreAuthoritative:!0}:et?{dashboardInputValues:{},dashboardInputValuesAreAuthoritative:!1}:{}}),Z.current=Ce,O.current=z.id,Y.current.dashboardId!==z.id&&(Y.current={dashboardId:z.id,defaultControlValuesKey:q.current,controlContractOverridesKey:A}),ne(Ne),ue&&G(ue),te&&X(te)},[x,k,g,G,B,X,ne,I,d,j,E,A,a,z]),S.useEffect(()=>{if(!(z!=null&&z.id))return;const ve=Y.current;if(ve.dashboardId!==z.id){Y.current={dashboardId:z.id,defaultControlValuesKey:F,controlContractOverridesKey:A};return}ve.defaultControlValuesKey===F&&ve.controlContractOverridesKey===A||(V(z,$.current),Y.current={dashboardId:z.id,defaultControlValuesKey:F,controlContractOverridesKey:A})},[z,F,A,V]),S.useEffect(()=>{f&&de&&f(de)},[de,f]),S.useEffect(()=>{n&&H(n),r&&xe(r)},[n,H,r,xe]),{isFetching:w,isLoading:y,isError:v}}const ry=Q.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:p.cn("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));ry.displayName="Card";const qR=Q.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:p.cn("flex flex-col space-y-1.5 p-6",e),...t}));qR.displayName="CardHeader";const Gp=Q.forwardRef(({className:e,...t},n)=>l.jsx("h3",{ref:n,className:p.cn("text-2xl font-semibold leading-none tracking-tight",e),...t}));Gp.displayName="CardTitle";const ape=Q.forwardRef(({className:e,...t},n)=>l.jsx("p",{ref:n,className:p.cn("text-sm text-muted-foreground",e),...t}));ape.displayName="CardDescription";const WR=Q.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:p.cn("px-6 pt-0",e),...t}));WR.displayName="CardContent";const zq=Q.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:p.cn("flex items-center p-6 pt-0",e),...t}));zq.displayName="CardFooter";/**
|
|
@@ -1343,4 +1343,4 @@ prismjs/prism.js:
|
|
|
1343
1343
|
More info: ${s.docs}`:"",a=typeof s.message=="string"&&s.message.trim()?s.message.trim():typeof s.error=="string"&&s.error.trim()?s.error.trim():null;if(a){const c=o?` (code: ${o})`:"",u=o==="insufficient_quota"||a.toLowerCase().includes("quota")?`
|
|
1344
1344
|
|
|
1345
1345
|
Semaphor supports bring-your-own OpenAI API keys. Add yours in Settings or drop a note to support@semaphor.cloud and we’ll help you get set up.`:"";return`${a}${c}${i}${u}`}return null};if(typeof e=="string"){const r=e.trim();if(!r)return"Something went wrong.";try{const s=JSON.parse(r),o=t(s);if(o)return o}catch{}return r}const n=t(e);if(n)return n;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function U3({errorMessage:e}){return l.jsxs("div",{className:"flex items-start gap-2 rounded-control border border-red-300 bg-red-50/60 p-2 text-[12px] text-red-700 dark:border-red-900/60 dark:bg-red-950/20 dark:text-red-300",children:[l.jsx(Bi,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),l.jsx("span",{className:"whitespace-pre-wrap break-words leading-[1.55]",children:R0t(e)})]})}function P0t({error:e,resetErrorBoundary:t}){return l.jsxs("div",{className:"my-3 space-y-2 rounded-control border border-border/60 bg-muted/20 p-2.5",children:[l.jsx(U3,{errorMessage:e==null?void 0:e.message}),l.jsx("button",{type:"button",className:"text-[11px] font-medium text-muted-foreground underline underline-offset-2 hover:text-foreground",onClick:t,children:"Try again"})]})}function F0t({text:e,files:t}){return l.jsxs(zfe,{who:"You",children:[e&&l.jsx("div",{className:"whitespace-pre-line text-[13px] leading-[1.55] text-foreground",children:e}),t&&t.length>0&&l.jsx("div",{className:"flex flex-wrap gap-2 pt-0.5",children:t.map(n=>l.jsx(Rdt,{file:n},n.id))})]})}function O0t({text:e}){const t=e.split("|"),n=t[0],r=t[1]||"{}",s=JSON.parse(r);return l.jsxs("div",{className:"space-y-1 text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"font-bold",children:"System Message:"})," ",n]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("span",{className:"font-mono text-xs",children:"Scope:"}),l.jsx(Qdt,{children:JSON.stringify(s,null,2)})]})]})}function Bfe(e,t){return!e||e.role!=="assistant"?!1:(e.parts??[]).some(r=>{if(!r)return!1;switch(r.type){case"text":return typeof r.text=="string"&&r.text.trim().length>0;case"reasoning":return typeof r.text=="string"&&r.text.trim().length>0||r.state==="streaming";case"error":return!0;default:return typeof r.type=="string"&&(r.type.startsWith("tool-")||r.type==="dynamic-tool")?H3(r,t):!1}})}function WU(){return l.jsx("span",{className:"relative grid h-2 w-2 shrink-0 place-items-center",children:l.jsx("span",{className:"absolute inset-0 animate-pulse rounded-full bg-muted-foreground/70"})})}function L0t({status:e,errorMessage:t,activeToolText:n}){return n?l.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-muted-foreground",children:[l.jsx(WU,{}),l.jsx("span",{children:n})]}):e==="submitted"||e==="streaming"?l.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-muted-foreground",children:[l.jsx(WU,{}),l.jsx("span",{children:e==="submitted"?"Thinking":"Generating"})]}):e==="error"?l.jsx(U3,{errorMessage:t}):null}function $0t(e){var t;return e?(t=[...e].reverse().find(n=>{var r;return n.role==="assistant"&&((r=n.parts)==null?void 0:r.some(s=>s.type==="text"&&typeof s.text=="string"&&s.text.trim().length>0))}))==null?void 0:t.id:void 0}function z0t({message:e,messageIndex:t,messages:n,showTools:r=!1,onAddToDashboard:s,showSystemMessage:o=!1,handleRun:i,onQuickReply:a,disableQuickReplies:c=!1}){var y,w,v,C;const u=$0t(n),d=e.id===u;if(e.role==="user"){const N=((y=e.parts)==null?void 0:y.filter(E=>E.type==="text"))||[],k=((w=e.parts)==null?void 0:w.filter(E=>E.type==="file"))||[],_=N.map(E=>E.text).join(`
|
|
1346
|
-
`).trim(),j=k.map((E,I)=>{var R,F;let T="",D;if((R=E.url)!=null&&R.startsWith("data:")){const A=E.url.match(/data:[^;]+;base64,(.+)/);A&&(T=A[1],(F=E.mediaType)!=null&&F.startsWith("image/")&&(D=E.url))}return{id:`${e.id||t}-file-${I}`,name:E.filename||`File ${I+1}`,size:0,type:E.mediaType||"application/octet-stream",data:T,preview:D}});return l.jsx(F0t,{text:_||void 0,files:j.length>0?j:void 0})}const f=((v=e.parts)==null?void 0:v.filter(N=>N.type==="reasoning"))||[],h=f.length>0,m=f.some(N=>N.state==="streaming"),g=f.filter(N=>N.text&&N.text.trim().length>0),b=h&&(g.length>0||m)?l.jsxs(Sc,{className:"space-y-2",defaultOpen:!1,children:[l.jsx(Cc,{asChild:!0,children:l.jsxs("button",{type:"button",className:"group inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground",children:[l.jsx(Pt.ChevronRight,{className:"h-3 w-3 transition-transform duration-200 group-data-[state=open]:rotate-90"}),l.jsx("span",{className:m?"animate-pulse":"",children:m?"Reasoning":"Show reasoning"}),g.length>1&&l.jsxs("span",{className:"font-mono tabular-nums text-muted-foreground/70",children:["(",g.length," steps)"]})]})}),l.jsx(Nc,{children:l.jsx("ol",{className:"space-y-2 border-l border-border/60 pl-3",children:g.map((N,k)=>l.jsxs("li",{className:"relative",children:[l.jsx("span",{className:"absolute -left-[15px] top-[3px] grid h-4 w-4 place-items-center rounded-full bg-muted font-mono text-[9px] text-muted-foreground",children:k+1}),l.jsx(LU,{className:"text-[12px] leading-[1.55] text-muted-foreground",text:N.text})]},`${e.id||t}-reasoning-${k}`))})})]},`${e.id||t}-reasoning`):null,x=(C=e.parts)==null?void 0:C.map((N,k)=>{var j;const _=`${e.id||t}-${k}`;switch(N.type){case"text":{const E=typeof N.text=="string"?N.text:JSON.stringify(N.text??"",null,2);if(e.role==="assistant"){const{cleanedText:I,quickReplies:T}=M0t(E),D=I.trim().length>0;return l.jsxs("div",{className:"space-y-2.5",children:[D&&l.jsx(LU,{text:I,handleRun:i,onAddToDashboard:s,messageId:e.id,messages:n}),T.length>0&&a&&d&&l.jsxs("div",{className:"space-y-1.5",children:[T.length>=3&&l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Suggested next steps"}),l.jsx("div",{className:"flex flex-wrap gap-1",children:T.map(({label:R,value:F},A)=>l.jsxs(p.Tooltip,{children:[l.jsx(p.TooltipTrigger,{asChild:!0,children:l.jsx(p.Button,{size:"sm",variant:"outline",className:"h-6 max-w-[220px] rounded-control border-border/60 bg-background px-2 text-[11px] font-normal text-foreground/85 transition-colors hover:border-border hover:bg-muted/40 hover:text-foreground disabled:opacity-50",disabled:c,onClick:()=>a(F),children:l.jsx("span",{className:"truncate",children:R})})}),l.jsx(p.TooltipContent,{side:"top",align:"center",children:l.jsx("p",{className:"max-w-xs text-xs",children:F})})]},`${_}-qr-${A}`))})]})]},_)}return e.role==="system"&&o?l.jsx(O0t,{text:E},_):null}case"error":{const E=N,I=E.errorText??E.error??E.message;return l.jsx("div",{className:"my-4",children:l.jsx(U3,{errorMessage:I})},_)}case"reasoning":return null;default:return((j=N.type)!=null&&j.startsWith("tool-")||N.type==="dynamic-tool")&&H3(N,r)?l.jsx(ka,{FallbackComponent:({error:E,resetErrorBoundary:I})=>l.jsx(P0t,{error:E,resetErrorBoundary:I}),children:l.jsx(j0t,{part:N,idx:_,messageId:e.id,showTools:r,onAddToDashboard:s,messages:n})},_):null}});return e.role==="assistant"?Bfe(e,r)?l.jsxs(zfe,{who:"Assistant",className:"space-y-2",children:[b,x]}):null:l.jsxs("div",{className:"space-y-2",children:[b,x]})}const B0t=8,V0t=24,H0t=20;function U0t(e,t,n,r){return e==="error"&&t?!0:r?!1:!!(n||e==="submitted"||e==="streaming")}function Vfe({messages:e,showTools:t=!1,showSystemMessage:n=!1,handleRun:r,onAddToDashboard:s,onQuickReply:o,disableQuickReplies:i=!1,status:a,errorMessage:c,activeToolText:u,className:d,rowContentClassName:f,statusClassName:h,latestButtonClassName:m,scrollToEndSignal:g=0}){const b=S.useRef(null),x=S.useRef(null),y=S.useRef(e.length),w=S.useRef(!1),v=S.useRef(null),C=S.useRef(!1),N=S.useRef(g),[k,_]=S.useState(!0),[j,E]=S.useState(0),[I,T]=S.useState(V0t);N.current!==g&&(N.current=g,C.current=!0);const D=e[e.length-1],R=Bfe(D,t),F=U0t(a,c,u,R),A=u_({count:e.length,getScrollElement:()=>b.current,estimateSize:W=>{const O=e[W];return(O==null?void 0:O.role)==="user"?88:180},getItemKey:W=>{const O=e[W];return(O==null?void 0:O.id)||`message-${W}`},anchorTo:"end",followOnAppend:!0,scrollEndThreshold:B0t,overscan:6,gap:20,paddingEnd:F?I+H0t:0,useAnimationFrameWithResizeObserver:!0,onChange:W=>{const O=W.isAtEnd();_(Z=>Z===O?Z:O),O&&E(0)}}),U=S.useCallback((W="smooth")=>{v.current!==null&&cancelAnimationFrame(v.current),v.current=requestAnimationFrame(()=>{v.current=null,A.scrollToEnd({behavior:W})}),E(0),_(!0)},[A]);S.useLayoutEffect(()=>{w.current||(w.current=!0,U("auto"))},[U]),S.useLayoutEffect(()=>{C.current&&(C.current=!1,U("auto"))},[e.length,g,U]),S.useEffect(()=>{const W=y.current;y.current=e.length,e.length>W&&!A.isAtEnd()&&E(O=>O+e.length-W),e.length===0&&(E(0),_(!0),w.current=!1,C.current=!1)},[e.length,A]);const $=A.getVirtualItems(),q=A.getTotalSize();return S.useEffect(()=>()=>{v.current!==null&&cancelAnimationFrame(v.current)},[]),S.useLayoutEffect(()=>{const W=x.current;if(!W||!F)return;const O=()=>{const Y=Math.ceil(W.getBoundingClientRect().height);Y>0&&T(M=>M===Y?M:Y)};if(O(),typeof ResizeObserver>"u")return;const Z=new ResizeObserver(O);return Z.observe(W),()=>Z.disconnect()},[F,a,c,u]),l.jsxs(l.Fragment,{children:[l.jsx(Ea,{"data-role":"assistant-virtualized-scroll-area",ref:b,className:p.cn("min-h-0 min-w-0 flex-1 basis-0",d),children:l.jsxs("div",{className:"relative w-full",style:{height:q},children:[$.map(W=>{const O=e[W.index];return O?l.jsx("div",{ref:A.measureElement,"data-index":W.index,className:"absolute left-0 top-0 w-full",style:{transform:`translateY(${W.start}px)`},children:l.jsx("div",{className:p.cn("min-w-0",f),children:l.jsx(z0t,{message:O,messageIndex:W.index,messages:e,showTools:t,showSystemMessage:n,handleRun:r,onAddToDashboard:s,onQuickReply:o,disableQuickReplies:i})})},W.key):null}),F&&l.jsx("div",{ref:x,className:p.cn("absolute left-0 top-0 w-full",h),style:{transform:`translateY(${Math.max(q-I,0)}px)`},children:l.jsx("div",{className:p.cn("min-w-0",f),children:l.jsx(L0t,{status:a,errorMessage:c,activeToolText:u})})})]})}),!k&&l.jsxs("button",{type:"button",onClick:()=>U("smooth"),"aria-label":"Scroll to latest",className:p.cn("absolute right-4 z-10 inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-background px-2.5 text-[11px] text-foreground shadow-[0_1px_2px_rgba(0,0,0,0.08)] transition-colors hover:bg-muted/40",m),children:[l.jsx(gs,{className:"h-3 w-3"}),"Latest",j>0&&l.jsx("span",{className:"grid h-4 min-w-[16px] place-items-center rounded-full bg-foreground px-1 font-mono text-[9px] tabular-nums text-background",children:j>9?"9+":j})]})]})}function q0t(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return"";const t=e;return(typeof t.userSql=="string"?t.userSql:"")||(typeof t.sourceSql=="string"?t.sourceSql:"")||(typeof t.sql=="string"?t.sql:"")}const W0t=[{title:"Show top 3 insights",subtitle:"from this dataset"},{title:"Create a bar chart for",subtitle:"sales by product category"}];function G0t({open:e,setOpen:t,isFullscreen:n,onFullscreenChange:r,fullscreenContainer:s}){const[o,i]=S.useState(!1),[a,c]=S.useState(p.isDevEnv),[u,d]=S.useState(!1),[f,h]=S.useState("auto"),[m,g]=S.useState(!1),[b,x]=S.useState(!1),[y,w]=S.useState(0),v=n??b,{isLocalDev:C,isConsoleMode:N}=Yp(),k=C||N||a,_=S.useRef(null);p.useDashboardStore(le=>le.dashboard.aiScopeTables),p.useDashboardStore(le=>le.isDashboardEditing);const j=p.useDashboardStore(le=>le.selectedSheetId),{setDataSource:E}=p.useEditorActions(),{setSelectedFrameId:I,setIsDashboardEditing:T}=p.useDashboardActions(),D=lL(),{clearAssistantMessageContexts:R}=p.useAIActions(),{clearQueue:F}=p.useQueueActions(),{clearFileAttachments:A,getFileAttachments:U}=p.useFileActions(),$=p.useFileAttachments("dashboard"),q=p.useEditorStore(le=>le.card.dataSource),{assistantProfile:W}=Kue(),O=p.useDashboardStore(le=>le.handleOpenAssistantProfile),{selectedEntities:Z,applyDashboardDefaultEntities:Y}=Q_("dashboard"),{sendMessage:M,isLoading:K,messages:L,setMessages:z,status:B,stop:V,errorMessage:P,clearError:H}=hdt({dynamicVisualMode:f}),G=S.useCallback(()=>{w(le=>le+1)},[]),X=S.useCallback(le=>{r==null||r(le),n===void 0&&x(le)},[n,r]),ne=S.useCallback(()=>{X(!v)},[v,X]);S.useEffect(()=>{if(!v)return;function le(ke){ke.key==="Escape"&&X(!1)}return window.addEventListener("keydown",le),()=>{window.removeEventListener("keydown",le)}},[v,X]);const[de,he]=S.useState(""),pe=le=>{he(le.target.value)};async function xe({sql:le,cardTitle:ke,connectionId:Se,cardType:oe,python:Ie,cardConfig:Ne,dataSource:Le,customVisualPreferences:Ye,visualizationMode:$e,dynamicCardPreferences:Ve}){if(!j)return;const Ze=$e==="dynamic",Ce=p.hasValidCardConfig(Ne),et=Se||(Le==null?void 0:Le.connectionId)||"",Fe=Le?{...Le,connectionId:et||Le.connectionId,connectionType:Le.connectionType||"",mode:Le.mode||"database",selectedEntities:Le.selectedEntities||[]}:et?{connectionId:et,connectionType:"",mode:"database",selectedEntities:[]}:Up,nt=!(Ce&&(!Ze||(Ve==null?void 0:Ve.provenance)==="card-config"||(Ve==null?void 0:Ve.provenance)==="query_spec")),Re=nt?q0t(le):"",Ee=nt?Ie:"",Ge={id:p.v4(),title:ke||"Title",preferences:{onClickFilter:[{columnIndex:0,expression:""}],chartOptions:{indexAxis:oe==="horizontalBar"?"y":"x"},...Ze&&{displayOptions:{showChrome:!1,allowScroll:!1}}},type:oe,sql:Re,python:Ee,dataSource:Fe,config:Ne,connectionId:et,visualizationMode:$e,dynamicCardPreferences:Ve,customCardPreferences:Ye?{url:Ye.url,componentName:Ye.componentName,pluginChartType:Ye.pluginChartType,settings:Ye.settings,type:"component"}:void 0},yt={id:p.v4(),cards:[Ge],activeCardId:Ge.id};try{await D(j,yt,"end"),T(!0),I(yt.id)}catch(xt){console.error("Failed to add assistant visual to dashboard:",xt),tt.error(xt instanceof Error?xt.message:"Failed to prepare semantic metadata for the new visual")}}const se=le=>{le.preventDefault();const ke=de.trim();if(!ke&&$.length===0)return;const Se=[];ke&&Se.push({type:"text",text:ke}),$.forEach(oe=>{oe.data&&Se.push({type:"file",mediaType:oe.type,filename:oe.name,url:`data:${oe.type};base64,${oe.data}`})}),M({role:"user",parts:Se}),he(""),A("dashboard"),G()};S.useEffect(()=>{var le;e&&((le=_.current)==null||le.focus())},[e]),fde({assistantType:"dashboard",status:B,isLoading:K,sendMessage:M});const{hasActiveTools:ge,activeToolText:ie}=hde(L);function De(le){const ke={role:"user",parts:[{type:"text",text:le.title+" "+le.subtitle}]};M(ke),G()}function re(le){M({role:"user",parts:[{type:"text",text:le}]}),G()}function me(le){M({role:"user",parts:[{type:"text",text:le}]}),G()}const ve=S.useCallback(async()=>{const le=JSON.stringify(L??[],null,2);try{if(typeof navigator>"u"||!navigator.clipboard)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(le),tt.success("Conversation copied")}catch(ke){console.error("Failed to copy conversation",ke),tt.error("Unable to copy conversation")}},[L]),J=(de==null?void 0:de.length)===0&&(L==null?void 0:L.filter(le=>le.role==="user").length)===0;function ee(){return l.jsx("div",{"data-role":"header",className:"flex items-center gap-2",children:l.jsx("span",{className:"text-[13px] font-medium text-foreground",children:"Assistant"})})}function te(){return l.jsxs(zs,{children:[l.jsx(Bs,{asChild:!0,children:l.jsx(cc,{className:"h-7 p-2 text-muted-foreground hover:text-foreground",children:l.jsx(Sh,{className:"size-3.5"})})}),l.jsxs(ks,{align:"end",children:[l.jsx(da,{children:"Options"}),l.jsx(Ui,{}),l.jsx(Kc,{checked:o,onCheckedChange:i,children:"Token Usage"}),l.jsx(Kc,{checked:a,onCheckedChange:c,children:"Tool Invocations"}),l.jsx(Kc,{checked:u,onCheckedChange:d,children:"System Message"}),(C||N)&&l.jsxs(l.Fragment,{children:[l.jsx(Ui,{}),l.jsx(da,{children:"Dynamic Visuals"}),l.jsx(Kc,{checked:f==="auto",onCheckedChange:()=>h("auto"),children:"Auto"}),l.jsx(Kc,{checked:f==="force",onCheckedChange:()=>h("force"),children:"Force Dynamic"}),l.jsx(Kc,{checked:f==="off",onCheckedChange:()=>h("off"),children:"Disable Dynamic"})]})]})]})}const ue=l.jsxs("div",{"data-role":"dashboard-assistant",className:p.cn("relative flex h-full grow flex-col break-words bg-background",v&&"rounded-card border border-border/60 shadow-xl"),children:[l.jsxs("header",{"data-role":"header-section",className:"flex h-10 shrink-0 items-center gap-2 border-b border-border/60 px-3",children:[ee(),O&&l.jsxs("button",{type:"button",onClick:O,className:"inline-flex h-6 items-center gap-1 rounded-[4px] border border-border/60 bg-muted/40 px-1.5 text-[11px] text-muted-foreground transition-colors hover:border-border hover:text-foreground",title:"Edit assistant profile",children:[l.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground/60"}),l.jsx("span",{className:"max-w-[180px] truncate",children:(W==null?void 0:W.name)||"Default profile"})]}),l.jsxs("div",{"data-role":"header-actions",className:"ml-auto flex items-center gap-0.5",children:[N&&te(),k&&l.jsx(p.Button,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-[11px] text-muted-foreground hover:text-foreground",onClick:ve,children:"Copy Conversation"}),l.jsx(cc,{className:"grid h-6 w-6 place-items-center rounded-[4px] p-0 text-muted-foreground hover:bg-muted hover:text-foreground",tooltip:v?"Exit fullscreen":"Expand",onClick:ne,children:v?l.jsx(Pt.Minimize2,{className:"h-3.5 w-3.5"}):l.jsx(Pt.Maximize2,{className:"h-3.5 w-3.5"})}),l.jsx(cc,{className:"grid h-6 w-6 place-items-center rounded-[4px] p-0 text-muted-foreground hover:bg-muted hover:text-foreground",tooltip:"New chat",onClick:()=>{const le=L.filter(ke=>ke.role==="assistant").map(ke=>ke.id).filter(ke=>!!ke);z([]),F("dashboard"),H(),R(le)},children:l.jsx(XR,{className:"h-3.5 w-3.5"})}),l.jsx(cc,{className:"grid h-6 w-6 place-items-center rounded-[4px] p-0 text-muted-foreground hover:bg-muted hover:text-foreground",tooltip:"Close",onClick:()=>{t(!1)},children:l.jsx(je.X,{className:"h-3.5 w-3.5"})})]})]}),l.jsx(Vfe,{messages:L,showTools:a,showSystemMessage:u,onAddToDashboard:xe,onQuickReply:me,disableQuickReplies:K,status:B,errorMessage:P,activeToolText:K&&ge?ie:void 0,className:p.cn(v?"px-6 py-5":"px-3 py-3"),rowContentClassName:p.cn(v&&"mx-auto w-full max-w-[680px]"),latestButtonClassName:e?"bottom-[148px]":"hidden",scrollToEndSignal:y}),l.jsxs("div",{className:"shrink-0 space-y-2 border-t border-border/60 px-3 pb-3 pt-2",children:[!W&&J&&l.jsx(Ice,{onClick:De,placeholders:W0t}),J&&W&&l.jsx(Zue,{seedQuestions:W.seedQuestions||[],handleSeedQuestionClick:re}),l.jsx(dde,{assistantType:"dashboard"}),l.jsx(S3,{ref:_,setInput:he,stop:V,input:de,handleInputChange:pe,handleSubmit:le=>{se(le)},isLoading:K,status:B,assistantType:"dashboard",onFocus:()=>{}})]}),l.jsx(w3,{incomingSelectedEntities:Z,open:m,onOpenChange:g,dataSource:q||Up,dialogMode:"aiContext",saveAsDashboardDefault:!0,onSaveSelectedEntities:le=>Y()})]});return v&&s?br.createPortal(l.jsx(Ag,{className:"pointer-events-auto absolute inset-0 z-50 flex bg-background/95 px-4 pb-4 pt-[calc(var(--app-header-height,15px)+0.5rem)] backdrop-blur-sm",children:l.jsx("div",{className:"flex h-full w-full",children:ue})}),s):ue}function Y0t(e){const t=e.current,{getSelectedFrame:n,setSelectedFrameId:r}=p.useDashboardActions(),s=rie(),o=p.useDashboardStore(d=>d.dashboard.sheets),a=p.useDashboardStore(d=>d.selectedSheetId)??(o==null?void 0:o[0].id),c=p.useDashboardStore(d=>d.isDashboardEditing),u=p.useDashboardStore(d=>d.isVisualEditing);S.useEffect(()=>{if(!c||u)return;async function d(m){if(K0t(m.target))return;const g=m.ctrlKey||m.metaKey;g&&m.key==="c"?(await f(),tt.success("Card copied to clipboard"),m.preventDefault()):g&&m.key==="v"&&(await h(),m.preventDefault())}async function f(){try{const m=n();m&&await navigator.clipboard.writeText(JSON.stringify(m))}catch(m){console.error("Failed to copy text:",m)}}async function h(){if(!a)return null;try{const m=await navigator.clipboard.readText(),g=Z0t(m);if(g!=null&&g.id){const b=eie(g),x=b.cards.findIndex(y=>y.id===b.activeCardId);x!==-1&&(b.cards[x].title=`${b.cards[x].title} (Copy)`),await s(a,b),r(b.id),tt.success("Card pasted from clipboard")}return m}catch(m){return console.error("Failed to paste text:",m),null}}return t==null||t.addEventListener("keydown",d),()=>t==null?void 0:t.removeEventListener("keydown",d)},[s,n,r,a,c,u,t])}function K0t(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;const t=e.closest("[contenteditable]");return t&&t.getAttribute("contenteditable")!=="false"?!0:!!e.closest('input, textarea, select, [role="textbox"]')}function Z0t(e){try{const t=JSON.parse(e);return t&&typeof t=="object"&&typeof t.id=="string"&&Array.isArray(t.cards)?t:null}catch{return null}}function X0t(e,t){switch(e.interactionMode){case"drillToDetail":Q0t(e,t);break;case"drillThrough":J0t(e,t);break;case"drillToURL":evt(e);break;case"inlineDrill":console.warn("Inline drill execution not yet implemented");break;case"clickFilter":case"drillDown":case"dynamicDrill":break;default:console.warn("Unknown interaction mode:",e.interactionMode)}}function Q0t(e,t){var c;const{targetInsightId:n,contextMode:r,displayMode:s,filterGroups:o}=e;if(!n){console.warn("drillToDetail event missing targetInsightId");return}const i=r||"full";let a=[];switch(i){case"interactionFilters":a=o.flatMap(u=>u.filters);break;case"full":{const u=((c=t.getCurrentFilters)==null?void 0:c.call(t))||[],d=o.flatMap(f=>f.filters);a=[...u,...d];break}case"none":default:a=[];break}s==="replace-card"?t.replaceCardContent({cardId:e.sourceCardId,insightId:n,filters:a,contextMode:r}):t.openInsightModal({insightId:n,filters:a,contextMode:r})}function J0t(e,t){var u,d;const{targetDashboardId:n,contextMode:r="interactionFilters",filterGroups:s,sourceCardId:o}=e;if(!n){console.warn("[DrillThrough] Event missing targetDashboardId. This interaction needs to be reconfigured with a target dashboard.",e);return}const i=s.flatMap(f=>f.filters),a=((u=t.getCurrentDashboardId)==null?void 0:u.call(t))||"",c=(d=t.getCurrentDashboardTitle)==null?void 0:d.call(t);t.setGlobalDrillContext&&t.setGlobalDrillContext({filters:i,contextMode:r,sourceDashboardId:a,sourceDashboardTitle:c,targetDashboardId:n}),t.setPendingDrillThrough&&t.setPendingDrillThrough({targetDashboardId:n,sourceDashboardId:a,sourceDashboardTitle:c,filters:i,contextMode:r})}function evt(e){const{url:t}=e;if(!t){console.warn("drillToURL event missing url");return}try{new URL(t)}catch(n){console.error("Invalid URL:",t,n);return}window.open(t,"_blank","noopener,noreferrer")}function tvt({open:e,onOpenChange:t,insightId:n,filters:r,filterDefinitions:s,contextMode:o,cardTitle:i,cardDescription:a}){return l.jsx(_o,{open:e,onOpenChange:t,children:l.jsxs(ao,{className:"max-h-[90vh] max-w-[90vw] p-6",children:[l.jsxs(Zi,{children:[l.jsx(lo,{children:i||"Insight Detail"}),l.jsx(Go,{children:a||"View detailed insight data with applied filters"})]}),l.jsx(iie,{filters:r,filterDefinitions:s,contextMode:o}),l.jsx("div",{className:"h-[400px] flex-1 overflow-auto",children:n?l.jsx(vie,{insightId:n,filters:r,contextMode:o}):l.jsx("div",{className:"flex items-center justify-center p-12 text-muted-foreground",children:"No insight selected"})})]})})}function nvt(){const e=p.useInteractionStore(C=>C.interactionStates),t=p.useInteractionStore(C=>C.setInteractionState),n=p.useInteractionStore(C=>C.clearLastInteractionEvent),r=p.useInteractionStore(C=>C.replaceCardWithInsight),s=p.useInteractionStore(C=>C.setPendingDrillThrough),o=p.useInteractionStore(C=>C.pendingDrillThrough),i=p.useInteractionStore(C=>C.clearPendingDrillThrough),{setSelectedSheetId:a,navigateWithDrill:c}=p.useDashboardActions(),{selectDashboard:u}=vh(),d=p.useDashboardStore(C=>C.dashboard),f=p.useDashboardStore(C=>C.filterValues),{data:h,isLoading:m}=EG((o==null?void 0:o.targetDashboardId)||"",{enabled:!!(o!=null&&o.targetDashboardId)}),[g,b]=S.useState({open:!1,insightId:""}),x=wie(g.insightId,{enabled:g.open&&!!g.insightId}),y=S.useRef(new Set),w=S.useMemo(()=>({setSelectedSheetId:a,openInsightModal:({insightId:C,filters:N,contextMode:k})=>{b({open:!0,insightId:C,filters:N,filterDefinitions:(d==null?void 0:d.filters)||[],contextMode:k})},replaceCardContent:({cardId:C,insightId:N,filters:k,contextMode:_})=>{r(C,N,k,_)},getCurrentFilters:()=>f||[],navigateWithDrill:c,getCurrentDashboardId:()=>(d==null?void 0:d.id)||"",getCurrentDashboardTitle:()=>d==null?void 0:d.title,setPendingDrillThrough:s,setGlobalDrillContext:({filters:C,contextMode:N,sourceDashboardId:k,sourceDashboardTitle:_,targetDashboardId:j})=>{const E={filters:C},I={sourceCardId:p.DRILL_CONTEXT_CARD_ID,interactionMode:"clickFilter",filterGroups:[E]},T={...p.createInitialInteractionState(),appliedClickFilters:[I],contextMode:N,sourceDashboardId:k,sourceDashboardTitle:_,targetDashboardId:j};t(p.DRILL_CONTEXT_CARD_ID,T)}}),[a,r,f,c,d,s,t]);S.useEffect(()=>{Object.entries(e).forEach(([C,N])=>{if(N!=null&&N.lastInteractionEvent){const k=N.lastInteractionEvent,_=`${C}-${k.interactionMode}-${k.sourceCardId}-${Date.now()}`;if(y.current.has(_))return;y.current.add(_);try{X0t(k,w)}catch(j){console.error("Error executing interaction event:",j)}finally{n(C),setTimeout(()=>{y.current.delete(_)},5e3)}}})},[e,n,w]),S.useEffect(()=>{if(!(!o||!h||m))try{u(h),c(o.targetDashboardId,o.sourceDashboardId,o.sourceDashboardTitle,o.filters,o.contextMode),i()}catch(C){console.error("[DrillThrough] Error during automatic navigation:",C),i()}},[o,h,m,u,c,i]);const v=()=>{b({open:!1,insightId:""})};return l.jsxs(l.Fragment,{children:[l.jsx(tvt,{open:g.open,onOpenChange:v,insightId:g.insightId,filters:g.filters,filterDefinitions:g.filterDefinitions,contextMode:g.contextMode,cardTitle:x.title,cardDescription:x.description}),o&&m&&l.jsx("div",{className:"fixed inset-0 z-[51] flex items-center justify-center bg-background/80 backdrop-blur-sm",children:l.jsxs("div",{className:"flex flex-col items-center gap-2.5 rounded-[6px] border border-border/60 bg-background px-4 py-3 shadow-sm",children:[l.jsx(p.LoaderCircle,{className:"h-5 w-5 animate-spin text-muted-foreground/60"}),l.jsx("div",{className:"text-[12px] text-muted-foreground",children:"Loading dashboard..."})]})})]})}function rvt(e){return e.length===0?"":e.map(t=>{const n=t.field.label||t.field.name,r=t.operator,s=svt(t.value);return r==="="?`${n} = ${s}`:`${n} ${r} ${s}`}).join(", ")}function svt(e){return e==null?"null":Array.isArray(e)?e.join(", "):typeof e=="object"&&e.toString?e.toString():String(e)}function ovt(e){return e?`Back to ${e}`:"Back"}function ivt(){var y,w,v,C,N;const e=p.useInteractionStore(k=>k.interactionStates[p.DRILL_CONTEXT_CARD_ID]),t=p.useDashboardStore(k=>k.actions.goBackFromDrill),n=p.useDashboardStore(k=>k.actions.clearDrillContext),{selectDashboard:r}=vh(),[s,o]=S.useState({x:16,y:16}),[i,a]=S.useState(!1),c=S.useRef({x:0,y:0});S.useEffect(()=>{if(!i)return;const k=j=>{o({x:j.clientX-c.current.x,y:j.clientY-c.current.y})},_=()=>{a(!1)};return document.addEventListener("mousemove",k),document.addEventListener("mouseup",_),()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",_)}},[i]);const u=e==null?void 0:e.sourceDashboardId,d=e==null?void 0:e.sourceDashboardTitle,f=((C=(v=(w=(y=e==null?void 0:e.appliedClickFilters)==null?void 0:y[0])==null?void 0:w.filterGroups)==null?void 0:v[0])==null?void 0:C.filters)||[],h=u?{id:u,title:d||"Previous Dashboard",description:"",isPrivate:!1,isPublic:!1,version:"",createdBy:null,createdByTenantUser:"",tenantId:"",projectId:"",createdAt:"",updatedAt:"",lastModified:"",lastModifiedBy:"",createdByUser:null,createdByTenantUserRel:{name:"",email:""},permissions:{canEdit:!0,canShare:!0,canDelete:!0},ownership:{status:"private",isOwner:!0,sharedCount:0,createdBy:{type:"user",userId:"",name:"",email:""}}}:null;if(!e||!((N=e.appliedClickFilters)!=null&&N.length))return null;const m=()=>{if(!h){console.warn("[DrillBack] No source dashboard in context");return}try{t(),r(h)}catch(k){console.error("[DrillBack] Error during back navigation:",k)}},g=()=>{n()},b=k=>{k.target.closest("button")||(a(!0),c.current={x:k.clientX-s.x,y:k.clientY-s.y})};rvt(f);const x=ovt(d);return l.jsx("div",{className:"fixed z-50 max-w-md",style:{left:0,top:0,transform:`translate(${s.x}px, ${s.y}px)`,transition:i?"none":void 0},children:l.jsxs("div",{className:"select-none rounded-lg border bg-background/95 p-3 shadow-lg backdrop-blur-sm",onMouseDown:b,style:{cursor:i?"grabbing":"grab"},children:[l.jsxs("div",{className:"mb-3 flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Viewing:"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:f.map((k,_)=>{const j=k.field.label||k.field.name,E=String(k.value);return l.jsxs(cs,{variant:"secondary",className:"pointer-events-none text-xs",children:[j," = ",E]},_)})})]}),l.jsx(p.Button,{variant:"ghost",size:"sm",onClick:g,className:"h-6 w-6 cursor-pointer p-0",title:"Clear drill context",children:l.jsx(je.X,{className:"h-3 w-3"})})]}),l.jsx("div",{className:"flex items-center gap-2 border-t pt-2",children:l.jsxs(p.Button,{variant:"secondary",size:"sm",onClick:m,disabled:!h,className:"w-full cursor-pointer",children:[l.jsx(I0,{className:"mr-2 h-4 w-4"}),x]})})]})})}function avt(e,t){return typeof e=="boolean"?e:typeof t=="boolean"?t:!1}function lvt({filter:e,isEditing:t=!1,disabled:n=!1,storageOptions:r,settingsVariant:s,filterQueryContext:o,inputVariableName:i,reservedInputVariableNames:a,onUpdateFilter:c,onRemoveFilter:u}){const{attributes:d,listeners:f,setNodeRef:h,transform:m,transition:g,isDragging:b}=zg({id:`filter:${e.id}`,disabled:n||!t}),x={transform:bi.Translate.toString(m),transition:g,opacity:b?.5:1,zIndex:b?10:void 0};return l.jsx("div",{ref:h,style:x,...d,children:l.jsx(V5,{filter:e,isEditing:t,dragListeners:t?f:void 0,storageOptions:r,settingsVariant:s,filterQueryContext:o,inputVariableName:i,reservedInputVariableNames:a,onUpdateFilter:c,onRemoveFilter:u})})}const GU="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",cvt=[];function Hfe({open:e,onOpenChange:t}){var L,z,B;const[n,r]=S.useState(!1),[s,o]=S.useState(!1),[i,a]=S.useState({sheetSelection:"current",protectPdf:!1,password:""}),c=p.useDashboardStore(V=>{var P;return(P=V.dashboard)==null?void 0:P.sheets}),u=p.useDashboardStore(V=>V.dashboard),d=p.useDashboardStore(V=>V.dashboardInputValues),f=p.useDashboardStore(V=>V.filterValues),h=p.useDashboardStore(V=>V.controlValues),m=p.useDashboardStore(V=>V.inlineFilterValuesMap),g=p.useDashboardStore(V=>V.cardControlValuesMap),b=p.useDashboardStore(V=>V.selectedSheetId),x=p.useDashboardStore(V=>V.selectedSheetId?V.documentInputRuntimeBySheetId[V.selectedSheetId]:void 0),y=p.useDashboardStore(V=>V.isDownloadingPdf),{authToken:w,tokenProps:v}=mt(),C=c==null?void 0:c.find(V=>V.id===b),N=S.useMemo(()=>p.getDashboardExportSheets(c),[c]),k=p.isDocumentSheet(C),_=k&&C?C.document:void 0,j=S.useMemo(()=>k&&C?Bv(u,C.id):[],[C,k,u]),E=j.length>0,I=S.useMemo(()=>k&&C?rce(u,C.id):!1,[C,k,u]),T=S.useMemo(()=>E?j.map(Vv):(_==null?void 0:_.inputs)||cvt,[_,j,E]),D=((z=(L=v==null?void 0:v.params)==null?void 0:L.calendarContext)==null?void 0:z.tz)||((B=v==null?void 0:v.params)==null?void 0:B.timezone)||(typeof Intl<"u"?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0),R=S.useMemo(()=>rle(T),[T]),F=S.useMemo(()=>tle(T,D),[T,D]),A=S.useMemo(()=>nle(T),[T]),U=x?x.filterValuesByInputId:F,$=x?x.controlValuesByInputId:A,q=S.useMemo(()=>k?I&&C&&_?lZ({dashboard:u,sheetId:C.id,sheetKind:"document",sectionIds:_.sections.map(V=>V.id),mode:"document",runtimeValues:{dashboardInputValues:d,filterValues:f,controlValues:h,inlineFilterValuesMap:m,cardControlValuesMap:g},timezone:D}):ile(T,U,$,R,R):[],[_,T,C,k,u,g,h,f,m,d,$,U,R,D,I]),W=!!C,O=N.length>0,Z=((c==null?void 0:c.length)||0)>1||k,Y=i.sheetSelection==="current"&&(!W||k&&q.length>0)||i.sheetSelection==="all"&&!O;S.useEffect(()=>{e&&i.sheetSelection==="all"&&!O&&a(V=>({...V,sheetSelection:"current"}))},[O,e,i.sheetSelection]);const M=()=>{a({sheetSelection:"current",protectPdf:!1,password:""}),r(!1),t(!1)};async function K(){if(y){tt.error("A PDF export is already in progress");return}if(i.protectPdf&&!i.password){tt.error("Please enter a password to protect the PDF");return}if(i.sheetSelection==="current"&&!W){tt.error("No sheet is selected to export");return}if(i.sheetSelection==="all"&&!O){tt.error("No dashboard sheets are available to export");return}o(!0);const V=i.sheetSelection==="current"&&k,P=V?i.protectPdf?"Generating protected document PDF... may take up to 60 seconds":"Generating document PDF... may take up to 60 seconds":i.sheetSelection==="all"?"Generating PDF for all dashboard sheets... This may take a while.":i.protectPdf?"Generating protected PDF... may take up to 60 seconds":"Generating PDF... may take up to 60 seconds",H=tt.loading(P);try{if(V){if(!_||!C)throw new Error("Selected document sheet is missing document data");if(q.length>0){tt.dismiss(H),tt.error(`Set ${q.join(", ")} before exporting`);return}const X=new Date().toISOString(),ne=I?uZ({dashboard:u,sheetId:C.id,sheetKind:"document",sectionIds:_.sections.map(de=>de.id),mode:"document",runtimeValues:{dashboardInputValues:d,filterValues:f,controlValues:h,inlineFilterValuesMap:m,cardControlValuesMap:g},generatedAt:X,timezone:D}).snapshot:void 0;await aF(v.apiServiceUrl,w,{sheetId:C.id,title:C.title||"Document",pageSize:_.page.size,orientation:_.page.orientation,timezone:D,password:i.protectPdf?i.password:void 0,inputSnapshot:ne,...ne?{}:{inputValues:{sheetId:C.id,filterValuesByInputId:U,controlValuesByInputId:$,generatedAt:X}}})}else{const X=LJ();await bZ(v.apiServiceUrl,w,i.protectPdf?i.password:void 0,i.sheetSelection,X)}tt.dismiss(H);const G=V?i.protectPdf?"Protected document PDF downloaded successfully!":"Document PDF downloaded successfully!":i.sheetSelection==="all"?"Dashboard sheets PDF downloaded successfully!":i.protectPdf?"Protected PDF downloaded successfully!":"PDF downloaded successfully!";tt.success(G,{duration:2e3}),M()}catch(G){tt.dismiss(H),tt.error("Failed to download PDF",{description:Rk(G,"Please try again or contact support."),descriptionClassName:Ak,closeButton:!0,duration:1/0,richColors:!0}),console.error("PDF download error:",G)}finally{o(!1)}}return l.jsx(_o,{open:e,onOpenChange:V=>{if(!V){M();return}t(!0)},children:l.jsxs(ao,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[l.jsxs(Zi,{children:[l.jsx(lo,{className:"text-[15px]",children:k?"Export document":"Export dashboard"}),l.jsx(Go,{className:"text-[13px] leading-5",children:k?"Export this document sheet as a PDF document.":"Export this dashboard as a PDF document."})]}),l.jsxs("div",{className:"space-y-4 py-1",children:[Z&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(p.Label,{className:GU,children:"Export scope"}),l.jsxs(Sa,{value:i.sheetSelection,onValueChange:V=>a({...i,sheetSelection:V}),className:"gap-1.5",children:[l.jsxs(p.Label,{htmlFor:"scope-current",className:p.cn("flex cursor-pointer items-center gap-2 rounded-control px-1 py-1 text-[13px] font-normal hover:bg-muted/50",!W&&"cursor-not-allowed opacity-50 hover:bg-transparent"),children:[l.jsx(Ss,{value:"current",id:"scope-current",disabled:!W}),k?"This document":"This sheet"," (",(C==null?void 0:C.title)||"Current",")"]}),l.jsxs(p.Label,{htmlFor:"scope-all",className:p.cn("flex cursor-pointer items-center gap-2 rounded-control px-1 py-1 text-[13px] font-normal hover:bg-muted/50",!O&&"cursor-not-allowed opacity-50 hover:bg-transparent"),children:[l.jsx(Ss,{value:"all",id:"scope-all",disabled:!O}),"Dashboard sheets (",N.length," ",N.length===1?"sheet":"sheets",")"]})]}),k&&l.jsx("p",{className:"text-[12px] leading-5 text-muted-foreground",children:q.length>0?`Set ${q.join(", ")} before exporting this document.`:'"Dashboard sheets" includes dashboard sheets only. Choose "This document" to export the selected document.'})]}),l.jsx(p.Separator,{className:"bg-border/60"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(p.Label,{htmlFor:"protect-pdf",className:"flex cursor-pointer items-center gap-2 text-[13px] font-normal",children:[l.jsx(Rn,{id:"protect-pdf",checked:i.protectPdf,onCheckedChange:V=>{a({...i,protectPdf:V,password:V?i.password:""}),V||r(!1)}}),l.jsx(QN,{className:"h-3.5 w-3.5 text-muted-foreground"}),"Password protect PDF"]}),i.protectPdf&&l.jsxs("div",{className:"ml-6 space-y-1.5",children:[l.jsx(p.Label,{htmlFor:"pdf-password",className:GU,children:"Password"}),l.jsxs("div",{className:"relative",children:[l.jsx(p.Input,{id:"pdf-password",size:"xs",type:n?"text":"password",value:i.password,onChange:V=>a({...i,password:V.target.value}),placeholder:"Enter password",className:"pr-8",onKeyDown:V=>{V.key==="Enter"&&i.password&&K()}}),l.jsx("button",{type:"button",className:"absolute right-1 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-control text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>r(!n),"aria-label":n?"Hide password":"Show password",children:n?l.jsx(XN,{className:"h-3.5 w-3.5"}):l.jsx(Pt.Eye,{className:"h-3.5 w-3.5"})})]}),l.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Recipients will need this password to open the PDF."})]})]})]}),l.jsxs(Ic,{children:[l.jsx(p.Button,{variant:"outline",size:"xs",onClick:M,disabled:s,children:"Cancel"}),l.jsx(p.Button,{size:"xs",onClick:K,disabled:s||y||Y,children:s?l.jsxs(l.Fragment,{children:[l.jsx(p.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Exporting…"]}):l.jsxs(l.Fragment,{children:[l.jsx(_c,{className:"h-3.5 w-3.5"}),"Export"]})})]})]})})}function Ufe({iconClassName:e,open:t,onOpenChange:n}){const[r,s]=S.useState(!1),o=t!==void 0,i=o?t:r,a=u=>{o||s(u),n==null||n(u)},c=p.useDashboardStore(u=>u.isDownloadingPdf);return l.jsxs(l.Fragment,{children:[o?null:l.jsx(p.Button,{variant:"ghost",size:"sm",className:"h-7 p-2",disabled:c,onClick:()=>a(!0),children:l.jsx(_c,{className:p.cn("size-4",e)})}),l.jsx(Hfe,{open:i,onOpenChange:a})]})}function YU(e,t,n){const r=new Set(t),s=[...n];return e.map(o=>r.has(o.id)?s.shift()??o.id:o.id)}function uvt({control:e,value:t,isEditing:n=!1,onChange:r}){const{attributes:s,listeners:o,setNodeRef:i,transform:a,transition:c,isDragging:u}=zg({id:`control:${e.id}`,disabled:!n}),d={transform:bi.Translate.toString(a),transition:c,opacity:u?.5:1,zIndex:u?10:void 0};return l.jsx("div",{ref:i,style:d,...s,children:l.jsx(vle,{control:e,value:t,isEditing:n,dragListeners:n?o:void 0,onChange:r})})}function KU(e){var t;return(((t=e.values)==null?void 0:t.length)??0)>0||e.operation==="is null"||e.operation==="is not null"}function ZU(e,t){return[...e.map(n=>`filter:${n.id}`),...t.map(n=>`control:${n.id}`)]}function dvt(e,t,n){const r=new Set([...t.map(a=>`filter:${a.id}`),...n.map(a=>`control:${a.id}`)]);if(!(e!=null&&e.length))return ZU(t,n);const s=e.filter(a=>r.has(a)),o=new Set(s),i=ZU(t,n).filter(a=>!o.has(a));return[...s,...i]}function fvt(e,t){return p.getDashboardCardEntries({sheets:e.sheets||[]}).filter(n=>n.sheet.id===t).map(n=>n.card.id)}function hvt(e){return xp(e.dashboardInput,{sheetId:e.selectedSheetId,sheetKind:"dashboard"})?!0:e.dashboardInput.scope.kind!=="cards"?!1:e.selectedSheetCardIds.some(t=>xp(e.dashboardInput,{sheetId:e.selectedSheetId,cardId:t,sheetKind:"dashboard"}))}function XU(e){var t;return((t=e.compatibility)==null?void 0:t.source)!=="dashboardFilter"}function mvt(e){const t={sheetId:e.selectedSheetId},n=p.getDashboardInputRuntimeSlot(e.dashboardInputValues,e.dashboardInput,t);if(n)return n;const r=p.getDashboardInputRuntimeSlot(e.defaultInputValues,e.dashboardInput,t);return r||p.getBackingDefaultSlot(e.dashboardInput)}function pvt(e){return qfe(e).filter(t=>{var n,r;return t.filter.hide||t.filter.location==="frame"?!1:((n=t.compatibility)==null?void 0:n.source)==="dashboardFilter"?!0:(((r=t.presentation)==null?void 0:r.placement)||"toolbar")==="toolbar"})}function qfe(e){if(!e.selectedSheetId)return[];const t=e.selectedSheetId,n=fvt(e.dashboard,t);return kK(_k({dashboard:e.dashboard}).allInputs).filter(r=>!(r.kind!=="filter"||!hvt({dashboardInput:r,selectedSheetId:t,selectedSheetCardIds:n})))}function gvt(e,t){return"toolbar"}function bvt(){const e=Tc("interactive"),t=p.useDashboardStore(z=>z.selectedSheetId),n=p.useDashboardStore(z=>z.dashboard.filters),r=p.useDashboardStore(z=>z.dashboard.filterLayout),s=p.useDashboardStore(z=>z.isDashboardEditing),o=p.useDashboardStore(z=>z.controlValues),i=p.useDashboardStore(z=>z.filterValues);p.useDashboardStore(z=>z.filteringCards);const a=p.useDashboardStore(z=>z.inlineFilterValuesMap),c=p.useDashboardStore(z=>z.dashboardInputValues),u=p.useInteractionStore(z=>z.clearAllClickFilters),d=p.useInteractionStore(z=>Object.entries(z.interactionStates).reduce((B,[V,P])=>{var H;return V===p.DRILL_CONTEXT_CARD_ID?B:B+(((H=P.appliedClickFilters)==null?void 0:H.length)??0)},0)),f=p.useDashboardStore(z=>z.actions.removeCardInlineFilterValue),{reorderFilters:h,clearDashboardInputSlot:m,reorderDashboardControls:g,removeDashboardInput:b,setControlValue:x,setFilterLayout:y,setFilterValues:w,setFilteringCards:v,upsertDashboardInput:C}=p.useDashboardActions(),N=nj(Bp(Lg,{activationConstraint:{distance:5}})),k=p.useDashboardStore(z=>z.dashboard),_=pvt({dashboard:k,selectedSheetId:t}).filter(z=>gvt(z.filter)==="toolbar"),j=qfe({dashboard:k,selectedSheetId:t}),E=_.map(z=>z.filter),I=new Map(_.map(z=>[`filter:${z.filter.id}`,z])),T=NYe(k),D=T.filter(z=>!z.hidden&&Ky(z)==="toolbar"),R=T.filter(z=>!z.hidden&&Ky(z)==="advanced"),F=dvt(r==null?void 0:r.toolbarItemOrder,E,D),A=new Map(E.map(z=>[`filter:${z.id}`,z])),U=new Map(D.map(z=>[`control:${z.id}`,z]));function $(z){const{active:B,over:V}=z;if(!V||B.id===V.id)return;const P=String(B.id),H=String(V.id),G=F.findIndex(ge=>ge===P),X=F.findIndex(ge=>ge===H);if(G===-1||X===-1)return;const ne=$g(F,G,X);y({toolbarItemOrder:ne});const de=new Set((n||[]).map(ge=>ge.id)),he=F.filter(ge=>ge.startsWith("filter:")).map(ge=>ge.replace("filter:","")).filter(ge=>de.has(ge)),pe=ne.filter(ge=>ge.startsWith("filter:")).map(ge=>ge.replace("filter:","")).filter(ge=>de.has(ge)),xe=F.filter(ge=>ge.startsWith("control:")).map(ge=>ge.replace("control:","")),se=ne.filter(ge=>ge.startsWith("control:")).map(ge=>ge.replace("control:",""));h(YU(n||[],he,pe)),g(YU(k.controls||[],xe,se))}const q=(r==null?void 0:r.toolbarWrap)??!1,W=(r==null?void 0:r.showDownloadButton)??!1,O=(i==null?void 0:i.filter(z=>KU(z)).length)??0,Z=j.filter(XU),Y=Z.filter(z=>{const B=mvt({dashboardInput:z,dashboardInputValues:c,defaultInputValues:k.defaultInputValues,selectedSheetId:t});return(B==null?void 0:B.status)==="set"&&B.value.kind==="filter"&&KU(B.value.filterValue)}).length,M=a?Object.values(a).reduce((z,B)=>z+((B==null?void 0:B.length)??0),0):0,K=O+Y+M+d,L=()=>{w([]),Z.forEach(z=>{m(z,{sheetId:t})}),v([]),u(),a&&Object.entries(a).forEach(([z,B])=>{B==null||B.forEach(V=>{f(z,V.filterId)})})};return!E.length&&!D.length&&!R.length&&!W&&K===0?null:l.jsx("div",{className:"z-20 border-b border-border/60 bg-background/95 px-3 py-2 backdrop-blur supports-[backdrop-filter]:bg-background/85",style:e.containerStyle,role:"toolbar","aria-label":"Dashboard filters and controls",children:l.jsx(Pv,{sensors:N,collisionDetection:Mv,onDragEnd:$,children:l.jsxs("div",{className:p.cn("flex items-center",q?"flex-wrap":"w-0 min-w-full overflow-x-auto"),children:[l.jsx(Fv,{items:F,strategy:bL,children:l.jsx(QA,{className:"gap-3 pr-0",wrap:q,children:F.map(z=>{const B=A.get(z);if(B){const P=I.get(z),H=P&&XU(P);return l.jsx(lvt,{filter:B,isEditing:s,storageOptions:H?{storageTarget:"dashboardInput",dashboardInput:P,sheetId:t??void 0}:void 0,inputVariableName:H?P.variableName:void 0,onUpdateFilter:H?(G,X)=>{C({...P,variableName:(X==null?void 0:X.variableName)||P.variableName,filter:G})}:void 0,onRemoveFilter:H?()=>{w((i||[]).filter(G=>G.filterId!==B.id)),b(P.id)}:void 0},z)}const V=U.get(z);return V?l.jsx(uvt,{control:V,value:o==null?void 0:o[V.id],isEditing:s,onChange:P=>x(V.id,P)},z):null})})}),R.length>0&&l.jsx(pie,{title:"",controls:R,values:o,onChange:(z,B)=>x(z.id,B),immediatePlacement:"toolbar",advancedLabel:"More controls"}),K>0&&l.jsxs("button",{type:"button",onClick:L,"aria-label":"Clear all filters",className:"ml-auto inline-flex h-7 shrink-0 items-center gap-1 rounded-control px-2 text-[12px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:[l.jsx(je.X,{className:"h-3 w-3"}),"Clear all",l.jsx("span",{className:"rounded-[3px] bg-muted px-1 text-[10px] tabular-nums text-muted-foreground",children:K})]}),W&&l.jsx("div",{className:p.cn(K>0?"ml-1.5":"ml-auto"),children:l.jsx(Ufe,{})})]})})})}function Wfe(){var me,ve;const{showAssistant:e,tokenProps:t,renderMode:n}=mt(),r=avt((me=t.config)==null?void 0:me.showDashboardAssistant,e),{preferences:s}=Yp(),o=(ve=s==null?void 0:s.cardDisplay)==null?void 0:ve.mode,i=Dh(o),a=WK({displayMode:o,renderMode:n}),c=S.useRef(null),u=S.useRef(null),[d,f]=S.useState(!1),{handleDragStart:h,isDraggingRef:m,getStyle:g,getPositionClasses:b}=eot({initialPosition:"bottom-right"}),x=kf(J=>J.setFullscreen),y=kf(J=>J.setPanelOpen),w=kf(J=>J.setContainer),v=MY("dashboard"),C=AY(),N=RY("dashboard"),k=v.isOpen,_=C==="dashboard",j=p.useDashboardStore(J=>J.isVisualEditing),E=p.useDashboardStore(J=>J.themeStyle),I=Dc(),T=p.useDashboardStore(J=>{var ee;return(ee=J.dashboard)==null?void 0:ee.sheets}),D=p.useDashboardStore(J=>J.showFilters),R=p.useDashboardStore(J=>J.isDashboardEditing),F=p.useDashboardStore(J=>J.selectedSheetId),A=T==null?void 0:T.find(J=>J.id===F),U=p.useDashboardStore(J=>{var ee,te,ue;return(ue=(te=(ee=J.dashboard)==null?void 0:ee.sheets)==null?void 0:te.find(le=>le.id===J.selectedSheetId))==null?void 0:ue.kind}),$=p.useDashboardStore(J=>{var ee,te;return((te=(ee=J.dashboard)==null?void 0:ee.summary)==null?void 0:te.position)||"top"}),q=U==="document",W=p.useDashboardStore(J=>{var ee;return(ee=J.dashboard)==null?void 0:ee.id}),{getDefaultSheetId:O,setDefaultSheetId:Z,clearDefaultSheetId:Y}=Fq(W),[M,K]=S.useState(null),{setSelectedSheetId:L,setSheetTitle:z,addSheet:B,setSheets:V}=p.useDashboardActions();Y0t(u);const{setActiveAssistantType:P}=p.useAIActions();S.useEffect(()=>{if(W){const J=O();K(J)}},[W,O]),S.useEffect(()=>{k?P("dashboard"):C==="dashboard"&&x(null)},[k,P,C,x]),S.useEffect(()=>{var J;k||(J=c.current)==null||J.resize(0)},[k]);function H(J){var ee,te;J?((ee=c.current)==null||ee.resize(40),y("dashboard",!0),x("dashboard"),P("dashboard")):(y("dashboard",!1),x(null),(te=c.current)==null||te.resize(0),P(null))}function G(J="dashboard"){const ee={id:p.v4(),title:J==="document"?"New Document":"New Sheet",...J==="document"?{kind:J,document:p.createDefaultDocumentDefinition()}:{}};B(ee),L(ee.id)}function X(J,ee){if(!W)return;M===J?(Y(),K(null),tt.success("Default sheet cleared")):(Z(J),K(J),tt.success(`"${ee}" set as default sheet`))}function ne(J){var ee;J<1?(y("dashboard",!1),x(null),P(null),(ee=c.current)==null||ee.resize(0)):(k||y("dashboard",!0),P("dashboard"))}function de(){return(E==null?void 0:E.canvasTheme)==="muted"||!(E!=null&&E.canvasTheme)?"hsl(var(--semaphor-muted))":(E==null?void 0:E.canvasTheme)==="clear"?"":E==null?void 0:E.canvasTheme}const he=(J,ee)=>{J.dataTransfer.setData("tabIndex",ee.toString())},pe=J=>{J.preventDefault()},xe=(J,ee)=>{const te=J.dataTransfer.getData("tabIndex");if(te===ee.toString())return;const ue=Array.from(T||[]),[le]=ue.splice(parseInt(te),1);ue.splice(ee,0,le),V(ue)},se=r===!0&&!i&&!k&&!j&&!D;function ge(){if(T&&T.length>1||R)return l.jsx("div",{className:"relative flex w-full items-stretch border-b border-border",children:l.jsxs("div",{className:"relative min-w-0 flex-1",children:[l.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 left-0 z-10 w-4 bg-gradient-to-r from-background to-transparent"}),l.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 right-0 z-10 w-4 bg-gradient-to-l from-background to-transparent"}),l.jsxs(p.TabsList,{role:"tab-list",className:"flex w-0 min-w-full items-stretch justify-start overflow-x-auto rounded-none bg-transparent p-0 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[T==null?void 0:T.map((J,ee)=>{const te=F===J.id,ue=M===J.id;return l.jsxs(p.TabsTrigger,{draggable:!0,onDragStart:le=>he(le,ee),onDragOver:pe,onDrop:le=>xe(le,ee),onClick:()=>L(J.id),className:p.cn("group relative inline-flex h-9 shrink-0 items-center gap-1.5 rounded-none bg-transparent px-3 py-0 text-[12px] font-medium text-muted-foreground transition-colors hover:bg-transparent hover:text-foreground data-[state=active]:bg-transparent data-[state=active]:text-foreground data-[state=active]:shadow-none","after:pointer-events-none after:absolute after:inset-x-2 after:-bottom-px after:h-0.5 after:bg-transparent data-[state=active]:after:bg-foreground"),value:J.id,children:[J.kind==="document"&&l.jsx(di,{className:"h-3 w-3 text-muted-foreground"}),l.jsx(cN,{enabled:R&&te,text:J.title,onSave:le=>z(J.id,le),children:J.title},J.id),l.jsx("span",{role:"button",tabIndex:0,"aria-label":ue?"Clear default sheet":"Set as default sheet",title:ue?"Clear default sheet":"Set as default sheet",onClick:le=>{le.stopPropagation(),X(J.id,J.title||"Sheet")},onKeyDown:le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),le.stopPropagation(),X(J.id,J.title||"Sheet"))},className:p.cn("inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-[3px] transition-opacity hover:bg-muted focus:outline-none focus-visible:ring-1 focus-visible:ring-foreground",te||ue?"opacity-100":"opacity-0 group-hover:opacity-100"),children:l.jsx(vW,{className:p.cn("h-3 w-3 transition-colors",ue?"fill-current text-amber-500":"text-muted-foreground")})}),R&&te&&T.length>1&&l.jsx("span",{role:"button",tabIndex:0,"aria-label":"Delete sheet",className:"inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-[3px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-foreground",onClick:le=>{le.stopPropagation(),f(!0)},onKeyDown:le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),le.stopPropagation(),f(!0))},children:l.jsx(je.X,{className:"h-3 w-3"})})]},J.id)}),R&&l.jsxs(zs,{children:[l.jsx(Bs,{asChild:!0,children:l.jsxs("button",{type:"button","aria-label":"Add sheet",className:"ml-1 inline-flex h-9 shrink-0 items-center gap-1 px-3 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[l.jsx(_r,{className:"h-3 w-3"}),"Sheet"]})}),l.jsxs(ks,{align:"start",className:"w-48",children:[l.jsxs(Sn,{onSelect:()=>G("dashboard"),children:[l.jsx(Gf,{className:"h-4 w-4 text-muted-foreground"}),"Dashboard sheet"]}),l.jsxs(Sn,{onSelect:()=>G("document"),children:[l.jsx(di,{className:"h-4 w-4 text-muted-foreground"}),"Document"]})]})]})]})]})})}function ie(){return l.jsx("div",{ref:u,style:{},className:"h-full min-h-0 grow",children:T==null?void 0:T.map(J=>l.jsx(p.TabsContent,{style:{backgroundColor:de(),...I.dashboardCanvasStyle},className:p.cn("mt-0 h-full min-h-0",{}),value:J.id,children:l.jsx(U7,{sheet:J})},J.id))})}function De(){return l.jsxs(p.Tabs,{"data-role":"dashboard-tabs-container",className:p.cn("relative flex h-full flex-col",E==null?void 0:E.dashboardTabsContainer),onValueChange:J=>{L(J)},value:F||void 0,children:[ge(),$==="top"&&!q&&l.jsx(MA,{}),F&&!q&&l.jsx(bvt,{}),q?l.jsx("div",{"data-role":"dashboard-tabs-content",className:"min-h-0 flex-1 grow basis-0 overflow-hidden",children:ie()}):l.jsx(Ea,{"data-role":"dashboard-tabs-content",className:"flex-1 grow basis-0 overflow-y-auto",children:ie()}),$==="bottom"&&!q&&l.jsx(MA,{}),l.jsx(tot,{open:d,setOpen:f})]})}const re=S.useCallback(J=>{w("dashboard",J)},[w]);return T?a&&F&&!q?l.jsxs("div",{"data-document-render-error":"true",className:"bg-white p-8 text-sm text-zinc-700",children:['Requested document sheet "',F,'" was not found or is not a document sheet in the loaded dashboard.']}):a&&q&&A?l.jsx("div",{"data-role":"dashboard-document-print-content",className:"min-h-0 overflow-visible bg-white",children:l.jsx(U7,{sheet:A})}):l.jsxs(l.Fragment,{children:[l.jsx(nvt,{}),l.jsx(ivt,{}),l.jsxs("div",{className:"relative flex-1 basis-0 overflow-hidden",children:[l.jsxs(jce,{className:p.cn("flex-1 basis-0 overflow-y-auto transition-opacity",_&&"pointer-events-none opacity-0"),direction:"horizontal",children:[l.jsx(rR,{children:De()}),r===!0&&l.jsxs(l.Fragment,{children:[l.jsx(Jst,{open:k,onTabClick:H,withHandle:!0,disabled:!k}),l.jsx(rR,{className:"flex grow","data-role":"dashboard-assistant-panel",onResize:ne,defaultSize:k?40:0,ref:c,children:l.jsx("div",{className:"grow overflow-y-auto",children:l.jsx(G0t,{open:k,setOpen:H,isFullscreen:_,onFullscreenChange:J=>x(J?"dashboard":null),fullscreenContainer:N})})})]})]}),l.jsx("div",{ref:re,className:p.cn("absolute inset-0",!_&&"pointer-events-none")}),se&&l.jsx("div",{className:p.cn("absolute z-50 transition-all duration-300 ease-in-out",b().horizontal,b().vertical),style:g(),children:l.jsx(p.Button,{size:"sm",variant:"outline",className:"h-12 w-12 cursor-grab rounded-full border-border bg-background p-0 shadow-lg hover:bg-muted active:cursor-grabbing",onClick:()=>{m.current||H(!0)},onMouseDown:h,onTouchStart:h,title:"Open Assistant (drag to move)",children:l.jsx(kpe,{className:"h-5 w-5"})})})]})]}):null}const Gfe=S.forwardRef(({appearance:e,organizationAppearance:t,tokenAppearance:n,reactAppearance:r,resolvedAppearance:s,children:o,className:i,style:a,...c},u)=>{const d=S.useId(),f=S.useMemo(()=>xvt(d),[d]),{theme:h}=PR(),m=yvt(h),g=S.useMemo(()=>s??kc.resolveAppearance({organizationAppearance:t,tokenAppearance:n,reactAppearance:r??e}),[e,t,r,s,n]),b=S.useMemo(()=>p.compileAppearance({spec:g,systemMode:m}),[g,m]),x=S.useMemo(()=>p.createAppearanceContextValue(f,b),[b,f]);return l.jsx(p.AppearanceContext.Provider,{value:x,children:l.jsx(Ag,{...c,ref:u,className:i,style:a,children:o})})});Gfe.displayName="AppearanceProvider";function xvt(e){return`semaphor-appearance-${e.replace(/[^a-zA-Z0-9_-]/g,"")}`}function yvt(e){const t=z1(e),[n,r]=S.useState(()=>vvt());return S.useEffect(()=>{var i,a;if(t!=="system"||typeof window>"u")return;const s=(i=window.matchMedia)==null?void 0:i.call(window,"(prefers-color-scheme: dark)");if(!s)return;const o=()=>{r(s.matches?"dark":"light")};return o(),typeof s.addEventListener=="function"?(s.addEventListener("change",o),()=>s.removeEventListener("change",o)):((a=s.addListener)==null||a.call(s,o),()=>{var c;return(c=s.removeListener)==null?void 0:c.call(s,o)})},[t]),t==="system"?n:t}function vvt(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}const Yfe=S.createContext({openBrandStudioPreview:()=>{}}),wvt=Yfe.Provider;function Svt(){return S.useContext(Yfe)}function Cvt({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const s=z1(t),[o,i]=S.useState(()=>Nvt(n)||s),a=S.useCallback(u=>{const d=z1(u);kvt(n,d),i(d)},[n]),c=S.useMemo(()=>({theme:o,setTheme:a}),[o,a]);return l.jsx(mq.Provider,{...r,value:c,children:e})}function Nvt(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=z1(t,"system");return n===t?n:null}catch{return null}}function kvt(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}}const _vt=S.lazy(()=>Promise.resolve().then(()=>require("../brand-studio/index.cjs")).then(e=>({default:e.BrandStudioEditor})));function q3({appearance:e,children:t}){var T,D;const{authToken:n,id:r,tokenProps:s}=mt(),o=_0(),i=(T=o.data)==null?void 0:T.organizationAppearance,a=(D=s.config)==null?void 0:D.appearance,[c,u]=S.useState(!1),[d,f]=S.useState(null),[h,m]=S.useState(null),[g,b]=S.useState(null),[x,y]=S.useState(null),w=`${s.apiServiceUrl??""}:${(n==null?void 0:n.accessToken)??""}`,v=An({queryKey:NG({resourceType:Zr.DASHBOARD,apiServiceUrl:s.apiServiceUrl,accessToken:n==null?void 0:n.accessToken}),queryFn:async()=>p.getRequest(`${s.apiServiceUrl}/management/v1/dashboards`,(n==null?void 0:n.accessToken)||""),select:R=>(R==null?void 0:R.organizationAppearance)??null,enabled:!o.dashboardIdToFetch&&i===void 0&&!!(n!=null&&n.accessToken)});S.useEffect(()=>{i!==void 0&&y({scopeKey:w,appearance:i})},[i,w]),S.useEffect(()=>{v.data!==void 0&&y({scopeKey:w,appearance:v.data})},[v.data,w]);const C=(x==null?void 0:x.scopeKey)===w?x.appearance:null,N=i!==void 0?i:v.data!==void 0?v.data:C,k=S.useMemo(()=>kc.resolveAppearance({organizationAppearance:N,tokenAppearance:a,reactAppearance:e}),[e,N,a]),_=S.useCallback(()=>{f(g??h??k),u(!0)},[g,h,k]),j=S.useCallback(()=>{u(!1)},[]);S.useEffect(()=>{f(null),m(null),b(null),u(!1)},[r]);const E=S.useMemo(()=>({openBrandStudioPreview:_}),[_]),I=g??h??e;return l.jsx(Cvt,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(wvt,{value:E,children:l.jsx(Gfe,{organizationAppearance:N,tokenAppearance:a,reactAppearance:I,style:{height:"100%",width:"100%"},children:l.jsxs(p.TooltipProvider,{delayDuration:0,children:[t,c&&l.jsx("aside",{"aria-label":"Brand Studio","aria-modal":"false",role:"dialog",className:"fixed bottom-0 right-0 top-0 z-50 flex w-[min(520px,100vw)] flex-col border-l border-border bg-background text-foreground shadow-sm",children:l.jsx(S.Suspense,{fallback:l.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Loading Brand Studio..."}),children:l.jsx(_vt,{appearance:d,onDraftChange:b,onSave:R=>{m(R),b(R),f(R)},onCancel:j})})})]})})})})}function Kfe({children:e,preferences:t}){const{currentUser:n}=Ki(),r=S.useMemo(()=>{var s,o;return{preferences:t||{},isLocalDev:((s=t==null?void 0:t.uiMode)==null?void 0:s.developer)||!1,isConsoleMode:((o=t==null?void 0:t.uiMode)==null?void 0:o.console)||!1}},[t]);return l.jsx(wG.Provider,{value:r,children:l.jsx(Z_,{displayPreferences:t==null?void 0:t.cardDisplay,currentUser:n,children:e})})}function jvt(e=2e3,t=500){const n=zme(),[r,s]=S.useState(!1),[o,i]=S.useState(!1),a=S.useRef(null);return S.useEffect(()=>{const c=setTimeout(()=>s(!0),e);return()=>clearTimeout(c)},[e]),S.useEffect(()=>{if(r){if(n>0){i(!1),a.current&&(clearTimeout(a.current),a.current=null);return}return a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{i(!0)},t),()=>{a.current&&clearTimeout(a.current)}}},[r,n,t]),o}function W3({delayMs:e=2e3,quietMs:t=500,componentType:n,componentId:r}){const s=jvt(e,t);return S.useEffect(()=>(s&&(window.__SEMAPHOR_READY__={ready:!0,type:n,componentId:r||null,timestamp:Date.now()}),()=>{window.__SEMAPHOR_READY__={ready:!1,type:n,componentId:r||null,timestamp:Date.now()}}),[s,n,r]),l.jsx("div",{id:"idle-check","aria-hidden":"true",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},children:s?"ready":""})}function Zfe(e){if(typeof window>"u")return null;const{preferences:t}=e;return l.jsx(ka,{FallbackComponent:Y_,children:l.jsxs(BR,{dashboardProps:e,children:[l.jsx(W3,{componentType:"dashboard",componentId:e.id}),l.jsx(q3,{appearance:e.appearance,children:l.jsx(Kfe,{preferences:t,children:l.jsx("main",{className:"flex h-full flex-col",children:l.jsx(xP,{...e,type:"dashboard",children:l.jsx(Wfe,{})})})})})]})})}function Ivt(e=[]){const t=S.useRef(null),n=S.useRef(null),r=S.useRef(null),[s,o]=S.useState(),i=S.useCallback(()=>{var m,g,b;const a=((m=t.current)==null?void 0:m.clientWidth)??0,c=((g=r.current)==null?void 0:g.offsetWidth)??0,u=((b=n.current)==null?void 0:b.offsetWidth)??0,f=a-c-u-8,h=Math.max(f,0);o(x=>x===h?x:h)},[]);return S.useEffect(()=>{const a=t.current;if(!a||typeof ResizeObserver>"u")return;const c=new ResizeObserver(()=>i());return c.observe(a),i(),()=>c.disconnect()},[i,...e]),{headerRef:t,leftActionsRef:n,rightActionsRef:r,titleMaxWidth:s,updateAvailableWidth:i}}function Evt({filter:e}){var g;const t=p.useDashboardStore(b=>b.isDashboardEditing),{preferences:n}=Yp(),r=Dh((g=n==null?void 0:n.cardDisplay)==null?void 0:g.mode),s=p.useDashboardStore(b=>b.filterValues),o=s==null?void 0:s.some(b=>b.filterId===e.id),{removeFilterValues:i,removeFilter:a,updateFilter:c}=p.useDashboardActions(),{headerRef:u,leftActionsRef:d,rightActionsRef:f,titleMaxWidth:h,updateAvailableWidth:m}=Ivt([t,o,r]);return S.useEffect(()=>{m()},[e.title,m]),l.jsxs("div",{ref:u,className:"group mb-1 flex h-5 items-center justify-between",children:[l.jsxs("div",{className:"flex grow items-center gap-2 min-w-0",children:[l.jsx("div",{className:"min-w-0 flex-1",style:h!==void 0?{maxWidth:h}:void 0,children:l.jsx(p.Label,{className:"my-1 block w-full text-sm",children:l.jsx(Ho,{value:e.title||e.column,onSave:b=>c({...e,title:b}),isEditable:t,placeholder:"Filter",displayClassName:"text-sm truncate",inputClassName:"text-sm"})})}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",ref:d,children:[t&&l.jsx(B5,{filter:e,isEditing:t}),t&&l.jsx("button",{onClick:()=>{i(e.id),a(e.id)},className:"text-muted-foreground hover:text-foreground",children:l.jsx(je.X,{className:"size-3.5"})})]})]}),l.jsx("div",{className:"hidden",ref:f})]})}function Tvt(){const e=p.useDashboardStore(r=>r.dashboard.filters),t=p.useDashboardStore(r=>r.theme),n=e==null?void 0:e.filter(r=>r.hide);return n!=null&&n.length?l.jsx("div",{className:p.cn("mb-1 flex items-center gap-2 border-y px-0.5 pb-0.5",{"bg-[repeating-linear-gradient(45deg,_#ffffff_0_3px,_#f3f3f3_3px_6px)]":t==="light","bg-[repeating-linear-gradient(45deg,_#18171d_0_3px,_#272729_3px_6px)]":t==="dark"}),children:n==null?void 0:n.map(r=>l.jsxs("div",{className:"flex min-w-[250px] max-w-fit flex-col gap-1 p-2",children:[l.jsx(Evt,{filter:r}),l.jsx(B_,{filter:r})]},r.id))}):null}function Dvt(){var i;const e=p.useDashboardStore(a=>a.dashboard),t=p.useDashboardStore(a=>a.selectedSheetId),n=p.useDashboardStore(a=>a.isVisualEditing),r=p.useDashboardStore(a=>a.isDashboardEditing),s=(i=e.sheets)==null?void 0:i.find(a=>a.id===t),o=p.isDocumentSheet(s);return l.jsx("div",{role:"dashboard-plus-main",className:p.cn("",{"max-h-0 overflow-hidden":n,"flex min-h-0 grow basis-0 overflow-hidden":!n}),children:l.jsxs("section",{className:"flex min-h-0 grow basis-0 flex-col overflow-hidden",children:[r&&!o&&l.jsx(Tvt,{}),l.jsx(Wfe,{})]})})}const Mvt=S.lazy(()=>Promise.resolve().then(()=>require("./dashboard-controls-D12ZSUP_.js"))),Avt=S.lazy(()=>Promise.resolve().then(()=>require("./edit-dashboard-visual-ql99faTz.js"))),Rvt=S.lazy(()=>Promise.resolve().then(()=>require("./dashboard-json-CvK0oI24.js")));function Pvt({showControls:e=!1,showFooter:t=!0,...n}){const r=p.useDashboardStore(a=>a.isVisualEditing),s=p.useDashboardStore(a=>a.showDashboardJSON),{appearance:o,preferences:i}=n;return l.jsx(ka,{FallbackComponent:Y_,children:l.jsxs(BR,{dashboardProps:n,children:[l.jsx(W3,{componentType:"surfboard",componentId:n.id}),l.jsxs(q3,{appearance:o,children:[l.jsx(Dbe,{toastOptions:{classNames:{toast:"max-w-[calc(100vw-2rem)] overflow-x-hidden !items-start [--toast-close-button-end:0.5rem] [--toast-close-button-start:auto] [--toast-close-button-transform:translate(0,0)] sm:max-w-[44rem]",content:"min-w-0 flex-1",icon:"mt-0.5 shrink-0",title:"max-w-full break-words pr-8",description:"max-w-full break-words",closeButton:"!top-2 h-6 w-6 rounded-md border-border bg-background text-muted-foreground hover:bg-muted hover:text-foreground"}}}),l.jsxs(Kfe,{preferences:i,children:[s&&l.jsx(S.Suspense,{fallback:null,children:l.jsx(Rvt,{})}),l.jsxs("main",{className:"relative flex h-full w-full flex-col overflow-hidden",children:[e&&l.jsx(S.Suspense,{fallback:null,children:l.jsx(Mvt,{})}),l.jsx("div",{className:"flex grow overflow-hidden",children:l.jsx("div",{className:"flex min-w-0 flex-1",children:l.jsxs(xP,{...n,type:"dashboard",children:[r&&l.jsx(S.Suspense,{fallback:null,children:l.jsx(Avt,{})}),l.jsx(Dvt,{})]})})})]})]})]})]})})}var Fvt=Object.defineProperty,Ovt=(e,t,n)=>t in e?Fvt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qS=(e,t,n)=>Ovt(e,typeof t!="symbol"?t+"":t,n);const Lvt={stringify:e=>e?"true":"false",parse:e=>/^[ty1-9]/i.test(e)},$vt={stringify:e=>e.name,parse:(e,t,n)=>{const r=(()=>{if(typeof window<"u"&&e in window)return window[e];if(typeof global<"u"&&e in global)return global[e]})();return typeof r=="function"?r.bind(n):void 0}},zvt={stringify:e=>JSON.stringify(e),parse:e=>JSON.parse(e)};function Bvt(e){return e.replace(/([a-z0-9])([A-Z])/g,(t,n,r)=>`${n}-${r.toLowerCase()}`)}function Xfe(e){return e.replace(/[-:]([a-z])/g,(t,n)=>`${n.toUpperCase()}`)}const Vvt={stringify:e=>e.name,parse:(e,t,n)=>{const r=(()=>{const s=Xfe(t);if(typeof n<"u"&&s in n.container)return n.container[s]})();return typeof r=="function"?r.bind(n):void 0}},Hvt={stringify:e=>`${e}`,parse:e=>parseFloat(e)},Uvt={stringify:e=>e,parse:e=>e},OD={string:Uvt,number:Hvt,boolean:Lvt,function:$vt,method:Vvt,json:zvt},Bb=Symbol.for("r2wc.render"),WS=Symbol.for("r2wc.connected"),Od=Symbol.for("r2wc.context"),Qo=Symbol.for("r2wc.props");function qvt(e,t,n){var r,s,o;t.props||(t.props=e.propTypes?Object.keys(e.propTypes):[]),t.events||(t.events=[]);const i=Array.isArray(t.props)?t.props.slice():Object.keys(t.props),a=Array.isArray(t.events)?t.events.slice():Object.keys(t.events),c={},u={},d={},f={};for(const m of i){c[m]=Array.isArray(t.props)?"string":t.props[m];const g=Bvt(m);d[m]=g,f[g]=m}for(const m of a)u[m]=Array.isArray(t.events)?{}:t.events[m];class h extends HTMLElement{constructor(){super(),qS(this,o,!0),qS(this,s),qS(this,r,{}),qS(this,"container"),t.shadow?this.container=this.attachShadow({mode:t.shadow}):this.container=this,this[Qo].container=this.container;for(const g of i){const b=d[g],x=this.getAttribute(b),y=c[g],w=y?OD[y]:null;if(y==="method"){const v=Xfe(b);Object.defineProperty(this[Qo].container,v,{enumerable:!0,configurable:!0,get(){return this[Qo][v]},set(C){this[Qo][v]=C,this[Bb]()}}),this[Qo][g]=w.parse(x,b,this)}w!=null&&w.parse&&x&&(this[Qo][g]=w.parse(x,b,this))}for(const g of a)this[Qo][g]=b=>{const x=g.replace(/^on/,"").toLowerCase();this.dispatchEvent(new CustomEvent(x,{detail:b,...u[g]}))}}static get observedAttributes(){return Object.keys(f)}connectedCallback(){this[WS]=!0,this[Bb]()}disconnectedCallback(){this[WS]=!1,this[Od]&&n.unmount(this[Od]),delete this[Od]}attributeChangedCallback(g,b,x){const y=f[g],w=c[y],v=w?OD[w]:null;y in c&&v!=null&&v.parse&&x&&(this[Qo][y]=v.parse(x,g,this),this[Bb]())}[(o=WS,s=Od,r=Qo,Bb)](){this[WS]&&(this[Od]?n.update(this[Od],this[Qo]):this[Od]=n.mount(this.container,e,this[Qo]))}}for(const m of i){const g=d[m],b=c[m];Object.defineProperty(h.prototype,m,{enumerable:!0,configurable:!0,get(){return this[Qo][m]},set(x){this[Qo][m]=x;const y=b?OD[b]:null;if(y!=null&&y.stringify){const w=y.stringify(x,g,this);this.getAttribute(g)!==w&&this.setAttribute(g,w)}else this[Bb]()}})}return h}function Wvt(e,t,n){const r=Nhe.createRoot(e),s=S.createElement(t,n);return r.render(s),{root:r,ReactComponent:t}}function Gvt({root:e,ReactComponent:t},n){const r=S.createElement(t,n);e.render(r)}function Yvt({root:e}){e.unmount()}function Kvt(e,t={}){return qvt(e,t,{mount:Wvt,update:Gvt,unmount:Yvt})}const Zvt={id:"string",version:"string",authToken:"json",placeholders:"json",defaultFilterValues:"json",defaultControlValues:"json",controlContractOverrides:"json",documentInputValues:"json",dashboardInputExecutionSnapshot:"json",renderMode:"string",currentTheme:"string",customCards:"json",customStyle:"json",appearance:"json",onChartElementClicked:"function",onFilterValuesChange:"function",onEvent:"function",onSave:"function",LoadingComponent:"function",ErrorComponent:"function",showAssistant:"boolean",showBriefings:"boolean",selectedSheetId:"string",eventHandlers:"json",preferences:"json"},Xvt=Kvt(Zfe,{props:Zvt}),Qvt=S.memo(function({context:t="editor"}={}){return l.jsxs("div",{"data-content":"fields-section",className:"flex h-full grow flex-col items-center overflow-hidden",children:[" ",l.jsx(BL,{context:t})," "]})}),Qfe=new Set(["askForMoreInfo","getAvailableChartTypes","getChartSQLSyntax","getDomainRelationships","getTableColumns","getUserSql","validateCardConfigFormat"]),Jvt=new Set(["createChartFromSql","createForecast","generateQueryConfig","getChartDataFromCardConfig","getChartDataFromSqlAndPython","getForecastDataFromSqlAndPython"]),ewt=Array.from(Qfe).join(", "),twt=3,nwt="Self-heal",rwt=new Set(["SQL_PARSE_ERROR","SQL_EXPLAIN_ERROR"]);function swt({card:e}){var W,O,Z,Y,M;const[t,n]=S.useState({}),{authToken:r}=mt(),s=p.getTokenParams(r==null?void 0:r.accessToken),{compiledAppearance:o}=p.useAppearance(),i=S.useMemo(()=>Cv(o),[o]),a=p.useEditorStore(K=>K.frame),c=p.useEditorStore(K=>K.inlineFilterValuesMap[e.id]),u=p.useEditorStore(K=>K.actions.setCardInlineFilterValue),d=p.useEditorStore(K=>K.actions.removeCardInlineFilterValue),f=e,{getCard:h,manifest:m}=$h(((W=f.customCardPreferences)==null?void 0:W.url)||""),g=(O=m==null?void 0:m.visuals)==null?void 0:O.find(K=>{var L;return K.name===((L=f.customCardPreferences)==null?void 0:L.componentName)}),b=Nv(f,g)??"single",x=S.useMemo(()=>W5({frame:a,configCard:f,isMultiInputVisual:b==="multiple"}),[a,f,b]),y=S.useMemo(()=>{const K=x.findIndex(L=>(L==null?void 0:L.id)===e.id);return K<0?-1:qy(e,K)},[x,e]),w=S.useMemo(()=>b!=="multiple"||y<0?e.type:Ym(e,y,g==null?void 0:g.slots)??e.type,[b,y,e,g==null?void 0:g.slots]),v=S.useMemo(()=>b==="multiple"?{...e,connectionId:void 0,dataSource:void 0,sql:"",python:"",config:void 0,queryConfig:void 0}:w!==e.type?{...e,type:w}:e,[e,w,b]),{data:C}=Dk(v),N=p.useInteractionStore(K=>K.interactionStates),k=p.useDashboardStore(K=>{var L;return(L=K.dashboard)==null?void 0:L.id}),_=p.useDashboardStore(K=>K.dashboard.filters),j=p.useDashboardStore(K=>K.filterValues),E=p.useDashboardStore(K=>K.selectedSheetId),I=S.useMemo(()=>H5({card:e,sheetId:E||"",inlineFilterValues:c,setInlineFilterValue:K=>u(e.id,K),removeInlineFilterValue:K=>d(e.id,K)}),[e,E,c,u,d]),{cardFilters:T,cardFilterValues:D}=S.useMemo(()=>z0({card:e,interactionStates:N,currentDashboardId:k,filters:_,filterValues:j,selectedSheetId:E}),[e,N,k,_,j,E]),R=S.useCallback((K,L)=>{const z=Y5(L);n(B=>({...B,[K]:z}))},[]),F=(Z=f.customCardPreferences)==null?void 0:Z.componentName,A=F?h(F):null,U=aN((Y=f.customCardPreferences)==null?void 0:Y.settings,f),$=S.useMemo(()=>q5(x),[x]),q=S.useMemo(()=>$.map((K,L)=>Ym(K,L,g==null?void 0:g.slots)),[$,g==null?void 0:g.slots]);return F?l.jsx("div",{className:"semaphor-custom mb-3 flex grow basis-0 flex-col space-y-2 overflow-y-auto",children:l.jsxs(S.Suspense,{fallback:l.jsx(l.Fragment,{}),children:[A&&b==="single"&&l.jsx(A,{editing:!0,params:s,theme:i,settings:U,cardMetadata:Aoe({card:e,dataMetadata:C==null?void 0:C.metadata}),onDataChange:R,data:(C==null?void 0:C.records)||[],filters:T,filterValues:[...D||[],...c||[]],inlineFilters:I}),A&&b==="multiple"&&l.jsxs(l.Fragment,{children:[x.map((K,L)=>{if(!K)return null;const z=qy(K,L),B=Ym(K,z,g==null?void 0:g.slots);return l.jsx(p5,{onDataChange:R,card:K,effectiveCardType:B},`${K.id}-${z}`)}),l.jsx("div",{className:"flex flex-col gap-2",children:l.jsx(A,{editing:!0,onDataChange:R,...K5({configCard:f,slotOrderedCards:$,slotTypes:q,multiInputData:t,params:s,theme:i,chartSettings:U,filters:T,filterValues:[...D||[],...c||[]],inlineFilters:I})})})]})]},(M=f.customCardPreferences)==null?void 0:M.componentName)}):null}const owt=S.memo(swt,(e,t)=>{var n,r,s,o,i,a,c,u;return e.card.id===t.card.id&&e.card.inlineFilters===t.card.inlineFilters&&((n=e.card.customCardPreferences)==null?void 0:n.settings)===((r=t.card.customCardPreferences)==null?void 0:r.settings)&&((s=e.card.customCardPreferences)==null?void 0:s.slotSettings)===((o=t.card.customCardPreferences)==null?void 0:o.slotSettings)&&((i=e.card.customCardPreferences)==null?void 0:i.url)===((a=t.card.customCardPreferences)==null?void 0:a.url)&&((c=e.card.customCardPreferences)==null?void 0:c.componentName)===((u=t.card.customCardPreferences)==null?void 0:u.componentName)}),iwt=p.create()(p.persist((e,t)=>({starredCharts:[],isStarred:(n,r)=>t().starredCharts.some(s=>s.type===n&&s.id===r),toggleStar:n=>{e(r=>{const s=r.starredCharts.findIndex(o=>o.type===n.type&&o.id===n.id);return s>=0?{starredCharts:r.starredCharts.filter((o,i)=>i!==s)}:{starredCharts:[...r.starredCharts,n]}})},getStarredChart:(n,r)=>t().starredCharts.find(s=>s.type===n&&s.id===r)}),{name:"semaphor-starred-charts"}));var Jfe=["PageUp","PageDown"],ehe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],the={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Gg="Slider",[TR,awt,lwt]=p.createCollection(Gg),[nhe]=p.createContextScope(Gg,[lwt]),[cwt,Uj]=nhe(Gg),rhe=Q.forwardRef((e,t)=>{const{name:n,min:r=0,max:s=100,step:o=1,orientation:i="horizontal",disabled:a=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:m=!1,form:g,...b}=e,x=Q.useRef(new Set),y=Q.useRef(0),v=i==="horizontal"?uwt:dwt,[C=[],N]=p.useControllableState({prop:d,defaultProp:u,onChange:T=>{var R;(R=[...x.current][y.current])==null||R.focus(),f(T)}}),k=Q.useRef(C);function _(T){const D=gwt(C,T);I(T,D)}function j(T){I(T,y.current)}function E(){const T=k.current[y.current];C[y.current]!==T&&h(C)}function I(T,D,{commit:R}={commit:!1}){const F=vwt(o),A=wwt(Math.round((T-r)/o)*o+r,F),U=p.clamp(A,[r,s]);N(($=[])=>{const q=mwt($,U,D);if(ywt(q,c*o)){y.current=q.indexOf(U);const W=String(q)!==String($);return W&&R&&h(q),W?q:$}else return $})}return l.jsx(cwt,{scope:e.__scopeSlider,name:n,disabled:a,min:r,max:s,valueIndexToChangeRef:y,thumbs:x.current,values:C,orientation:i,form:g,children:l.jsx(TR.Provider,{scope:e.__scopeSlider,children:l.jsx(TR.Slot,{scope:e.__scopeSlider,children:l.jsx(v,{"aria-disabled":a,"data-disabled":a?"":void 0,...b,ref:t,onPointerDown:p.composeEventHandlers(b.onPointerDown,()=>{a||(k.current=C)}),min:r,max:s,inverted:m,onSlideStart:a?void 0:_,onSlideMove:a?void 0:j,onSlideEnd:a?void 0:E,onHomeKeyDown:()=>!a&&I(r,0,{commit:!0}),onEndKeyDown:()=>!a&&I(s,C.length-1,{commit:!0}),onStepKeyDown:({event:T,direction:D})=>{if(!a){const A=Jfe.includes(T.key)||T.shiftKey&&ehe.includes(T.key)?10:1,U=y.current,$=C[U],q=o*A*D;I($+q,U,{commit:!0})}}})})})})});rhe.displayName=Gg;var[she,ohe]=nhe(Gg,{startEdge:"left",endEdge:"right",size:"width",direction:1}),uwt=Q.forwardRef((e,t)=>{const{min:n,max:r,dir:s,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:c,onStepKeyDown:u,...d}=e,[f,h]=Q.useState(null),m=p.useComposedRefs(t,v=>h(v)),g=Q.useRef(void 0),b=p.useDirection(s),x=b==="ltr",y=x&&!o||!x&&o;function w(v){const C=g.current||f.getBoundingClientRect(),N=[0,C.width],_=G3(N,y?[n,r]:[r,n]);return g.current=C,_(v-C.left)}return l.jsx(she,{scope:e.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:l.jsx(ihe,{dir:b,"data-orientation":"horizontal",...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:v=>{const C=w(v.clientX);i==null||i(C)},onSlideMove:v=>{const C=w(v.clientX);a==null||a(C)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:v=>{const N=the[y?"from-left":"from-right"].includes(v.key);u==null||u({event:v,direction:N?-1:1})}})})}),dwt=Q.forwardRef((e,t)=>{const{min:n,max:r,inverted:s,onSlideStart:o,onSlideMove:i,onSlideEnd:a,onStepKeyDown:c,...u}=e,d=Q.useRef(null),f=p.useComposedRefs(t,d),h=Q.useRef(void 0),m=!s;function g(b){const x=h.current||d.current.getBoundingClientRect(),y=[0,x.height],v=G3(y,m?[r,n]:[n,r]);return h.current=x,v(b-x.top)}return l.jsx(she,{scope:e.__scopeSlider,startEdge:m?"bottom":"top",endEdge:m?"top":"bottom",size:"height",direction:m?1:-1,children:l.jsx(ihe,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:b=>{const x=g(b.clientY);o==null||o(x)},onSlideMove:b=>{const x=g(b.clientY);i==null||i(x)},onSlideEnd:()=>{h.current=void 0,a==null||a()},onStepKeyDown:b=>{const y=the[m?"from-bottom":"from-top"].includes(b.key);c==null||c({event:b,direction:y?-1:1})}})})}),ihe=Q.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:o,onHomeKeyDown:i,onEndKeyDown:a,onStepKeyDown:c,...u}=e,d=Uj(Gg,n);return l.jsx(p.Primitive.span,{...u,ref:t,onKeyDown:p.composeEventHandlers(e.onKeyDown,f=>{f.key==="Home"?(i(f),f.preventDefault()):f.key==="End"?(a(f),f.preventDefault()):Jfe.concat(ehe).includes(f.key)&&(c(f),f.preventDefault())}),onPointerDown:p.composeEventHandlers(e.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:p.composeEventHandlers(e.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&s(f)}),onPointerUp:p.composeEventHandlers(e.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),o(f))})})}),ahe="SliderTrack",lhe=Q.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=Uj(ahe,n);return l.jsx(p.Primitive.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:t})});lhe.displayName=ahe;var DR="SliderRange",che=Q.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=Uj(DR,n),o=ohe(DR,n),i=Q.useRef(null),a=p.useComposedRefs(t,i),c=s.values.length,u=s.values.map(h=>fhe(h,s.min,s.max)),d=c>1?Math.min(...u):0,f=100-Math.max(...u);return l.jsx(p.Primitive.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:a,style:{...e.style,[o.startEdge]:d+"%",[o.endEdge]:f+"%"}})});che.displayName=DR;var MR="SliderThumb",uhe=Q.forwardRef((e,t)=>{const n=awt(e.__scopeSlider),[r,s]=Q.useState(null),o=p.useComposedRefs(t,a=>s(a)),i=Q.useMemo(()=>r?n().findIndex(a=>a.ref.current===r):-1,[n,r]);return l.jsx(fwt,{...e,ref:o,index:i})}),fwt=Q.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:s,...o}=e,i=Uj(MR,n),a=ohe(MR,n),[c,u]=Q.useState(null),d=p.useComposedRefs(t,w=>u(w)),f=c?i.form||!!c.closest("form"):!0,h=p.useSize(c),m=i.values[r],g=m===void 0?0:fhe(m,i.min,i.max),b=pwt(r,i.values.length),x=h==null?void 0:h[a.size],y=x?bwt(x,g,a.direction):0;return Q.useEffect(()=>{if(c)return i.thumbs.add(c),()=>{i.thumbs.delete(c)}},[c,i.thumbs]),l.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${g}% + ${y}px)`},children:[l.jsx(TR.ItemSlot,{scope:e.__scopeSlider,children:l.jsx(p.Primitive.span,{role:"slider","aria-label":e["aria-label"]||b,"aria-valuemin":i.min,"aria-valuenow":m,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...o,ref:d,style:m===void 0?{display:"none"}:e.style,onFocus:p.composeEventHandlers(e.onFocus,()=>{i.valueIndexToChangeRef.current=r})})}),f&&l.jsx(dhe,{name:s??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:m},r)]})});uhe.displayName=MR;var hwt="RadioBubbleInput",dhe=Q.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const s=Q.useRef(null),o=p.useComposedRefs(s,r),i=p.usePrevious(t);return Q.useEffect(()=>{const a=s.current;if(!a)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const f=new Event("input",{bubbles:!0});d.call(a,t),a.dispatchEvent(f)}},[i,t]),l.jsx(p.Primitive.input,{style:{display:"none"},...n,ref:o,defaultValue:t})});dhe.displayName=hwt;function mwt(e=[],t,n){const r=[...e];return r[n]=t,r.sort((s,o)=>s-o)}function fhe(e,t,n){const o=100/(n-t)*(e-t);return p.clamp(o,[0,100])}function pwt(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function gwt(e,t){if(e.length===1)return 0;const n=e.map(s=>Math.abs(s-t)),r=Math.min(...n);return n.indexOf(r)}function bwt(e,t,n){const r=e/2,o=G3([0,50],[0,r]);return(r-o(t)*n)*n}function xwt(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function ywt(e,t){if(t>0){const n=xwt(e);return Math.min(...n)>=t}return!0}function G3(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function vwt(e){return(String(e).split(".")[1]||"").length}function wwt(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var hhe=rhe,Swt=lhe,Cwt=che,Nwt=uhe;const mhe=Q.forwardRef(({className:e,...t},n)=>l.jsxs(hhe,{ref:n,className:p.cn("relative flex w-full touch-none select-none items-center",e),...t,children:[l.jsx(Swt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:l.jsx(Cwt,{className:"absolute h-full bg-primary"})}),l.jsx(Nwt,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background 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"})]}));mhe.displayName=hhe.displayName;const phe=["SUN","MON","TUE","WED","THU","FRI","SAT"],kwt=phe.reduce((e,t,n)=>({...e,[t]:n}),{}),Ll={repeats:"weekly",hour:9,minute:0,weekdays:[1,2,3,4,5],isCustom:!1};function _wt(e){if(!e||!e.trim())return{...Ll};const t=e.trim(),r=(t.startsWith("cron(")&&t.endsWith(")")?t.slice(5,-1):t).trim().split(/\s+/);if(r.length<5||r.length>6)return{...Ll,isCustom:!0};const[s,o,i,a,c]=r,u=Number(s),d=Number(o);if(!Number.isInteger(u)||u<0||u>59||!Number.isInteger(d)||d<0||d>23)return{...Ll,isCustom:!0};if(i==="*"&&(c==="?"||c==="*"))return{...Ll,repeats:"daily",hour:d,minute:u};if(i==="?"&&c!=="?"&&c!=="*"){const h=c.split(",").map(m=>m.toUpperCase()).map(m=>kwt[m]).filter(m=>typeof m=="number");if(h.length>0)return{...Ll,repeats:"weekly",hour:d,minute:u,weekdays:h}}return i==="1,15"&&(c==="?"||c==="*")?{...Ll,repeats:"biweekly",hour:d,minute:u}:i==="1"&&(c==="?"||c==="*")?{...Ll,repeats:"monthly",hour:d,minute:u}:{...Ll,hour:d,minute:u,isCustom:!0}}function jwt(e){const t=e.minute,n=e.hour;switch(e.repeats){case"daily":return`cron(${t} ${n} * * ? *)`;case"weekly":{const r=e.weekdays.length>0?e.weekdays.slice().sort((s,o)=>s-o).map(s=>phe[s]).join(","):"MON";return`cron(${t} ${n} ? * ${r} *)`}case"biweekly":return`cron(${t} ${n} 1,15 * ? *)`;case"monthly":return`cron(${t} ${n} 1 * ? *)`}}function ghe(e,t){const n=e<12?"AM":"PM",r=e%12===0?12:e%12,s=t.toString().padStart(2,"0");return`${r}:${s} ${n}`}function Iwt(e){return!e||e==="UTC"?"UTC":(e.split("/").pop()??e).replace(/_/g," ")}function Ewt(e){if(e.length===7)return"every day";const t=e.slice().sort((s,o)=>s-o);if(t.length===5&&t.every(s=>s>=1&&s<=5))return"weekdays";const r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return t.map(s=>r[s]).join(", ")}function Twt(e,t,n,r){const s=ghe(e.hour,e.minute),o=Iwt(t);let i;if(e.isCustom)i=`Custom schedule · ${s} ${o}`;else switch(e.repeats){case"daily":i=`Daily at ${s} ${o}`;break;case"weekly":i=`Weekly · ${Ewt(e.weekdays)} at ${s} ${o}`;break;case"biweekly":i=`Every two weeks (1st and 15th) at ${s} ${o}`;break;case"monthly":i=`Monthly on the 1st at ${s} ${o}`;break}const a=[];return n&&n!=="Today"&&a.push(`from ${n}`),r&&a.push(`until ${r}`),a.length>0?`${i}, ${a.join(" ")}`:i}const Dwt=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Singapore","Asia/Tokyo","Australia/Sydney"];exports.Accordion=AL;exports.AccordionContent=r0;exports.AccordionItem=t0;exports.AccordionTrigger=n0;exports.AddDataPicker=w3;exports.AggregateTable=g_;exports.Alert=dF;exports.AlertDescription=fF;exports.AlertDialog=kh;exports.AlertDialogAction=ad;exports.AlertDialogCancel=ld;exports.AlertDialogContent=nd;exports.AlertDialogDescription=id;exports.AlertDialogFooter=sd;exports.AlertDialogHeader=rd;exports.AlertDialogTitle=od;exports.AlertDialogTrigger=Xxe;exports.AlertTitle=BZ;exports.ArrowDown=gs;exports.ArrowDownIcon=Eqe;exports.ArrowLeft=I0;exports.ArrowRight=ZN;exports.ArrowUp=As;exports.ArrowUpIcon=Dqe;exports.AssistantContextEntityControls=pR;exports.AssistantVirtualizedMessages=Vfe;exports.AtSign=Bq;exports.AxisConfigurator=rg;exports.Badge=cs;exports.Bell=KS;exports.BookType=Hq;exports.BulletChartIcon=Rfe;exports.COMMON_TIMEZONES=Dwt;exports.CSS=bi;exports.CalculatedFieldEditor=qae;exports.Calculator=qq;exports.Calendar=ii;exports.Calendar$1=S1;exports.CalendarRange=Wq;exports.Card=ry;exports.CardContent=WR;exports.CardHeader=qR;exports.CardSummary=$A;exports.CardTitle=Gp;exports.ChartArea=a2;exports.ChartColumnIncreasing=Gq;exports.ChartColumnStacked=Yq;exports.ChartJsVisual=pv;exports.ChartLine=Kq;exports.ChartNoAxesGantt=Xq;exports.ChartPie=Qq;exports.ChartScatter=Jq;exports.ChatInputWithContext=S3;exports.Checkbox=Rn;exports.ChevronLeft=wh;exports.ChevronsUpDown=nW;exports.Circle=GR;exports.CircleAlert=qf;exports.CircleCheck=rW;exports.CircleHelp=sW;exports.Clock=YR;exports.CodeHighlighter=Vf;exports.CodeXml=ZS;exports.Collapsible=Sc;exports.CollapsibleContent=Nc;exports.CollapsibleTrigger=Cc;exports.ColorField=Ai;exports.Command=aj;exports.CommandEmpty=cj;exports.CommandGroup=uj;exports.CommandInput=wL;exports.CommandItem=dj;exports.CommandList=lj;exports.CommandSeparator=dae;exports.ComparisonMetadataBadge=fee;exports.Container=xP;exports.ControlDefaultValueEditor=hle;exports.ControlDefinitionOptionsEditor=fle;exports.ControlIdInput=lle;exports.ControlVisibilitySettings=Vet;exports.Copy=Tu;exports.CopyButton=Iu;exports.CopyPlus=c2;exports.Cross2Icon=Pqe;exports.CustomFilterPopover=B5;exports.CustomScrollArea=Ea;exports.DEFAULT_HEATMAP_CUSTOM_RANGE=mJ;exports.DEFAULT_SCHEDULE_VM=Ll;exports.Dashboard=Zfe;exports.DashboardCard=bie;exports.DashboardCreateDialogBase=XG;exports.DashboardExportDialog=Hfe;exports.DashboardPlus=Pvt;exports.DashboardWC=Xvt;exports.DataTableConditionalFormattingSettings=tce;exports.DataTablePagination=o_;exports.Database=zi;exports.DateRangePicker=w5;exports.DefaultChatTransport=h3;exports.Dialog=_o;exports.DialogContent=ao;exports.DialogDescription=Go;exports.DialogFooter=Ic;exports.DialogHeader=Zi;exports.DialogTitle=lo;exports.DialogTrigger=YG;exports.DisplayPreferencesProvider=Z_;exports.DndContext=Pv;exports.Donut=oW;exports.Download=_c;exports.DownloadPdf=Ufe;exports.DragOverlay=Xie;exports.DropdownMenu=zs;exports.DropdownMenuCheckboxItem=Kc;exports.DropdownMenuContent=ks;exports.DropdownMenuItem=Sn;exports.DropdownMenuLabel=da;exports.DropdownMenuRadioGroup=sbe;exports.DropdownMenuRadioItem=vG;exports.DropdownMenuSeparator=Ui;exports.DropdownMenuSub=cP;exports.DropdownMenuSubContent=sk;exports.DropdownMenuSubTrigger=rk;exports.DropdownMenuTrigger=Bs;exports.EMPTY_DATA_SOURCE=Up;exports.Editable=cN;exports.EditableText=Ho;exports.EditorCustomVisual=owt;exports.Ellipsis=ui;exports.EllipsisVertical=Sh;exports.ErrorBoundary=ka;exports.ExportError=ug;exports.ExternalLink=hp;exports.EyeOff=XN;exports.Fallback=Y_;exports.FallbackVisual=Gy;exports.FeedbackCategory=ed;exports.FeedbackDialog=g0;exports.FieldsList=BL;exports.FieldsSection=Qvt;exports.FileCode=iW;exports.FileSpreadsheet=aW;exports.FileText=di;exports.Filter=Wf;exports.FilterComponent=B_;exports.FilterInfo=PA;exports.FilterableFieldsPanel=Gae;exports.Globe=Ch;exports.Grid3x3=u2;exports.GripVertical=jc;exports.HEATMAP_PRESET_PALETTES=gM;exports.Hash=lW;exports.House=cW;exports.HoverCard=dg;exports.HoverCardContent=Bu;exports.HoverCardTrigger=fg;exports.INLINE_ALLOWED_READ_ONLY_TOOLS=Qfe;exports.INLINE_ALLOWED_TOOL_LIST=ewt;exports.INLINE_BLOCKED_MUTATING_TOOLS=Jvt;exports.IconButton=cc;exports.IconForFieldType=E1;exports.InfoHover=cL;exports.InlineFilterBar=aie;exports.KPICard=Yu;exports.KeyboardSensor=Av;exports.Layers=E0;exports.LayoutDashboard=Gf;exports.Link=KR;exports.LoadingDots=Hu;exports.Lock=QN;exports.MAX_SELF_HEAL_ATTEMPTS=twt;exports.Map=fW;exports.Markdown=Zde;exports.MatrixTableVisual=p_;exports.MdStackedLineChart=Mfe;exports.MultiInputEmptyRenderer=p5;exports.PYTHON_DEFAULT_CODE=RR;exports.PanelResizeHandle=Ij;exports.Paperclip=hW;exports.PenLine=d2;exports.Pencil=f2;exports.PendingMessagesDisplay=dde;exports.PersistedDynamicVisual=K_;exports.PiChartPolar=Ife;exports.Pin=pW;exports.PinOff=mW;exports.PivotTableTanstack=Mg;exports.Placeholders=Ice;exports.Play=gW;exports.Plus=_r;exports.PointerSensor=Lg;exports.Progress=y3;exports.RECOVERABLE_SQL_ERROR_CODES=rwt;exports.Radar=bW;exports.RadioGroup=Sa;exports.RadioGroupItem=Ss;exports.RefreshCw=Yf;exports.ResizableHandle=Qst;exports.ResizablePanel=rR;exports.ResizablePanelGroup=jce;exports.ResourceEditDialog=IY;exports.ResourceType=Zr;exports.SELF_HEAL_TIMELINE_STEP=nwt;exports.SeedQuestions=Zue;exports.SemaphorContext=k0;exports.SemaphorContextProvider=BR;exports.SemaphorQueryClient=Pq;exports.SemaphorReadyIndicator=W3;exports.SemaphorStyleWrapper=Ag;exports.Send=xW;exports.Settings=ZR;exports.Settings2=T0;exports.Share2=yW;exports.ShareDialog=jY;exports.Sheet=eee;exports.SheetContent=fO;exports.SheetDescription=mO;exports.SheetHeader=nee;exports.SheetTitle=hO;exports.SheetTrigger=HPe;exports.Slider=mhe;exports.SortableContext=Fv;exports.Sparkles=W1;exports.Square=QR;exports.SquarePen=XR;exports.Star=vW;exports.StructuralParticipantSelector=cle;exports.SummaryCard=MA;exports.TABLE_PRESENTATION_DEFAULT_STYLE=_u;exports.TABLE_PRESENTATION_DEFAULT_TOTALS_STYLE=Fi;exports.TableBody=zu;exports.TableCell=Mn;exports.TableColumnVisibilitySettings=Hle;exports.TableHead=ts;exports.TableHeader=Ph;exports.TablePresentationSettings=qle;exports.TableRow=Sr;exports.TableSkeleton=uL;exports.TableVisual=Vu;exports.TbChartBubble=Efe;exports.TbChartFunnel=Tfe;exports.TbChartTreemap=Dfe;exports.TextCard=Op;exports.Textarea=jh;exports.TiSortNumerically=Afe;exports.Toggle=W_;exports.Tornado=wW;exports.Trash2=fl;exports.TreePalm=eP;exports.TrendingUp=SW;exports.TriangleAlert=Bi;exports.TypeGlyph=Iv;exports.UXProvider=q3;exports.User=CW;exports.Users=ek;exports.applyFilterOverridesToDashboardInputSlots=aZ;exports.areContextEntitiesEqual=Jn;exports.areEntitiesJoined=yJ;exports.arrayMove=$g;exports.buildCardControlUsageById=Uet;exports.buildCustomCardTheme=Cv;exports.buildDashboardCardExecutionSnapshot=iZ;exports.buildDashboardControlUsageById=Het;exports.buildDashboardExecutionSnapshot=oF;exports.buildDashboardInputExecutionSnapshot=vu;exports.buildDashboardSheetsInputExecutionSnapshot=cZ;exports.buildDashboardStructuralParticipantIdsByControlId=gle;exports.buildFilterFieldMeta=jL;exports.buildFilterSemanticContext=IL;exports.buildInlineFilterNodes=H5;exports.buildMultiInputCustomVisualProps=K5;exports.buildScheduleExpr=jwt;exports.buildSchedulePreview=Twt;exports.buildSlotOrderedCards=q5;exports.calculateContextAwareFilters=z0;exports.calculateFieldState=rO;exports.canUserAccessVisuals=r0e;exports.canUserCreateDashboards=DY;exports.canUserEdit=e0e;exports.canUserManageDashboards=n0e;exports.canUserManageGroups=s0e;exports.canUserUseFilters=t0e;exports.cancelExport=MRe;exports.chartSupportsDataLabels=dQ;exports.chartSupportsLegend=cQ;exports.chartTypes=Hj;exports.cleanupKpiMetricComparisonMode=yae;exports.cloneDeep=$o;exports.cloneLinkedFrameWithSourceMapping=GGe;exports.closestCenter=Mv;exports.commitSharedCalculatedFields=Wd;exports.createAssistantConversationId=Im;exports.createAssistantRequestId=Yue;exports.createCardsFromSlots=lWe;exports.createChartConfig=cg;exports.createDashboardControlInputFromControl=$rt;exports.createDefaultGlobalDateFilter=d1e;exports.createExport=$J;exports.createUniqueDashboardInputVariableNameFromName=Eu;exports.dedup=Gut;exports.doesStoredFilterMatchField=Vp;exports.downloadDocumentPdf=aF;exports.downloadPdf=bZ;exports.extractSqlParamReferences=wse;exports.extractTableMetadata=_L;exports.fieldAlreadyExists=wJ;exports.findCustomVisualConfigCard=G5;exports.findDashboardFrameById=n1e;exports.flexRender=Bo;exports.formatDisplayFormula=FQe;exports.formatFileSize=PRe;exports.formatFilterLine=HZ;exports.formatTimeLabel=ghe;exports.getAutoDetectedChartIcon=c0t;exports.getChartGridStyle=PNe;exports.getChartIconByType=u0t;exports.getColorForValue=A2;exports.getConfigSlotExpectedType=aWe;exports.getCoreRowModel=n_;exports.getCustomVisualInputCards=W5;exports.getDateFormatOptionsForGranularity=Jy;exports.getDefaultAxisConfig=P2;exports.getDefaultChartColors=Mh;exports.getDefaultDataLabelsConfig=Q0;exports.getDefaultExportFormat=iX;exports.getDefaultFilterSql=_5;exports.getDefaultLegendConfig=zF;exports.getDefaultRunningTotalPartitionByFieldIds=Yx;exports.getDocumentSectionEditorCard=vet;exports.getDocumentSheetDashboardInputs=Bv;exports.getDownloadUrl=DRe;exports.getEffectiveCardTypeForSlot=Ym;exports.getEntityIcon=zN;exports.getErrorMessage=Fue;exports.getExportStatus=TRe;exports.getExports=ERe;exports.getExpressionFieldKind=Zu;exports.getFieldExpressionAnnotation=EL;exports.getFilterCount=mN;exports.getGlobalDateFilter=Xp;exports.getGlobalDateFilterCoverage=f1e;exports.getGranularityOptionsForFieldType=GL;exports.getKeys=cr;exports.getMatrixVisualLoadingState=m_;exports.getMetricDisplayLabel=XAe;exports.getNewField=_J;exports.getObjectDiff=pq;exports.getPaginationRowModel=r_;exports.getRoleBasedDisplayOverrides=TY;exports.getRunningTotalOrderByCandidates=oQe;exports.getSelectedDateFilterColumn=Cse;exports.getSheetScopedFilterValues=cy;exports.getSlotDefinitionForIndex=U5;exports.getSlotExpectedChartType=U_;exports.getSlotIndexForCard=qy;exports.getSortedRowModel=QJ;exports.getSupportedExportFormats=oX;exports.getTableConditionalFormattingColumnOptions=Kle;exports.getTableOutputColumnOptions=Zle;exports.getTablePageSizeOptions=FJ;exports.handleAggregationChange=FA;exports.handleAggregationLabelChange=oie;exports.hasFlatTableTotalsBehavior=iCe;exports.hasMatrixResultData=nv;exports.horizontalListSortingStrategy=bL;exports.isCalculatedFilterField=e0;exports.isCardSummaryVisibleOnCard=Z5;exports.isCustomVisualConfigCard=TA;exports.isDefaultColor=pCe;exports.isEligibleFlatTableTotalsCard=Qp;exports.isExportComplete=RRe;exports.isExportInProgress=ARe;exports.isInAiScopeArray=Wut;exports.isManagedCalculatedExpressionField=xa;exports.isMetricTransformEnabled=rQe;exports.isPromiseLike=mR;exports.isSubtotalEnabledAggregateTable=kL;exports.isSupportedDocumentTableCardType=wet;exports.lastAssistantMessageIsCompleteWithToolCalls=Mue;exports.merge=dl;exports.mergeAxisConfig=F2;exports.normalizeConditionalFormatting=QP;exports.normalizeContextFormatMode=KZ;exports.normalizeDashboardInputVariableName=j0;exports.normalizeMultiInputPayload=Y5;exports.parseScheduleExpr=_wt;exports.pivotData=q0;exports.prepareFeedbackData=Vj;exports.purify=uA;exports.reindexSlotCards=iWe;exports.remarkGfm=Nfe;exports.removeFromScopeArray=Yut;exports.resolveDashboardInputContext=Nl;exports.resolveDomainCalculatedFieldForEdit=DJe;exports.resolveMultiInputType=Nv;exports.resolveMultiInputTypeFromVisual=cWe;exports.resolveTablePageSize=Jk;exports.resolveTablePresentationStyle=SO;exports.sanitizeAIScope=Pue;exports.saveCalculatedFieldToCardScope=YA;exports.saveCalculatedFieldToSharedScope=Wae;exports.saveCalculatedFieldToSheetScope=KA;exports.seedSemanticMetricFormatDefaults=wae;exports.setTableColumnVisibility=VJ;exports.setupEditorWithCard=Mk;exports.showAllTableColumns=$Re;exports.showJoinRequiredNotification=vJ;exports.sortByColumnsToSortState=See;exports.sortStateToSortByColumns=Cee;exports.sortableKeyboardCoordinates=yL;exports.supportsMetricTransformForMetric=vae;exports.supportsTableConditionalFormatting=Wle;exports.toEntityArray=ba;exports.ue=tt;exports.useActiveExports=f0e;exports.useActiveToolStatus=hde;exports.useAddFrameWithFreshSemanticExecutionPayload=lL;exports.useAddNewFrame=jie;exports.useAssistantContainer=RY;exports.useAssistantContextEntities=Q_;exports.useAssistantLayoutStore=kf;exports.useAssistantPanel=MY;exports.useAssistantProfile=Kue;exports.useAutoSubmitQueue=fde;exports.useBrandStudioPreview=Svt;exports.useCard=cRe;exports.useCardFilterValues=IJ;exports.useCardSummary=X5;exports.useChat=Rue;exports.useColumns=SL;exports.useCreateVisualWithFrame=exe;exports.useCurrentUserInfo=Ki;exports.useCustomVisual=$h;exports.useCustomVisualsQuery=z5;exports.useDashboardAppearance=Dc;exports.useDashboardById=EG;exports.useDashboardPreferences=Yp;exports.useDashboardQuery=_0;exports.useDashboardStructuralParticipants=ble;exports.useDashboardSummary=Voe;exports.useDataColumns=Cae;exports.useDateFilterHook=z9e;exports.useDebounce=Vx;exports.useDefaultDashboardMutation=SG;exports.useDisplayPreferences=Cl;exports.useDroppable=Zie;exports.useEditorAside=fj;exports.useEditorCardQuery=Dk;exports.useEnsureReactGlobals=Zre;exports.useExportActions=PY;exports.useExportStore=fk;exports.useFieldManagement=Sae;exports.useFilterableFields=gae;exports.useFullscreenAssistant=AY;exports.useGroupMembers=nye;exports.useGroups=yY;exports.useHasDashboardId=FY;exports.useInProgressExportsCount=h0e;exports.useJoinabilityMap=NL;exports.useManagementActions=vh;exports.useManagementStore=Ls;exports.useMutation=so;exports.usePivotTableConfig=Rh;exports.usePluginQuery=Ioe;exports.useQuery=An;exports.useQueryClient=Xr;exports.useReactTable=s_;exports.useResolveExistingFrameSemanticExecutionPayload=XGe;exports.useResourceManagement=dP;exports.useResourceUpdateState=TG;exports.useScopedFields=pae;exports.useSelectedVisual=Hme;exports.useSemaphorContext=mt;exports.useSensor=Bp;exports.useSensors=nj;exports.useSortable=zg;exports.useStarredChartsStore=iwt;exports.useSurfaceAppearance=Tc;exports.useTableQueryState=hee;exports.useTextFilterHook=X9e;exports.useTheme=PR;exports.useTopoJson=ev;exports.useUnifiedUsers=gP;exports.useUpdateResource=kG;exports.useUpdateVisualMutation=txe;exports.useUserPreferences=QG;exports.useVisualById=ik;exports.useVisualManagement=Jbe;exports.validateFieldForChartType=xae;exports.verticalListSortingStrategy=xL;
|
|
1346
|
+
`).trim(),j=k.map((E,I)=>{var R,F;let T="",D;if((R=E.url)!=null&&R.startsWith("data:")){const A=E.url.match(/data:[^;]+;base64,(.+)/);A&&(T=A[1],(F=E.mediaType)!=null&&F.startsWith("image/")&&(D=E.url))}return{id:`${e.id||t}-file-${I}`,name:E.filename||`File ${I+1}`,size:0,type:E.mediaType||"application/octet-stream",data:T,preview:D}});return l.jsx(F0t,{text:_||void 0,files:j.length>0?j:void 0})}const f=((v=e.parts)==null?void 0:v.filter(N=>N.type==="reasoning"))||[],h=f.length>0,m=f.some(N=>N.state==="streaming"),g=f.filter(N=>N.text&&N.text.trim().length>0),b=h&&(g.length>0||m)?l.jsxs(Sc,{className:"space-y-2",defaultOpen:!1,children:[l.jsx(Cc,{asChild:!0,children:l.jsxs("button",{type:"button",className:"group inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground",children:[l.jsx(Pt.ChevronRight,{className:"h-3 w-3 transition-transform duration-200 group-data-[state=open]:rotate-90"}),l.jsx("span",{className:m?"animate-pulse":"",children:m?"Reasoning":"Show reasoning"}),g.length>1&&l.jsxs("span",{className:"font-mono tabular-nums text-muted-foreground/70",children:["(",g.length," steps)"]})]})}),l.jsx(Nc,{children:l.jsx("ol",{className:"space-y-2 border-l border-border/60 pl-3",children:g.map((N,k)=>l.jsxs("li",{className:"relative",children:[l.jsx("span",{className:"absolute -left-[15px] top-[3px] grid h-4 w-4 place-items-center rounded-full bg-muted font-mono text-[9px] text-muted-foreground",children:k+1}),l.jsx(LU,{className:"text-[12px] leading-[1.55] text-muted-foreground",text:N.text})]},`${e.id||t}-reasoning-${k}`))})})]},`${e.id||t}-reasoning`):null,x=(C=e.parts)==null?void 0:C.map((N,k)=>{var j;const _=`${e.id||t}-${k}`;switch(N.type){case"text":{const E=typeof N.text=="string"?N.text:JSON.stringify(N.text??"",null,2);if(e.role==="assistant"){const{cleanedText:I,quickReplies:T}=M0t(E),D=I.trim().length>0;return l.jsxs("div",{className:"space-y-2.5",children:[D&&l.jsx(LU,{text:I,handleRun:i,onAddToDashboard:s,messageId:e.id,messages:n}),T.length>0&&a&&d&&l.jsxs("div",{className:"space-y-1.5",children:[T.length>=3&&l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Suggested next steps"}),l.jsx("div",{className:"flex flex-wrap gap-1",children:T.map(({label:R,value:F},A)=>l.jsxs(p.Tooltip,{children:[l.jsx(p.TooltipTrigger,{asChild:!0,children:l.jsx(p.Button,{size:"sm",variant:"outline",className:"h-6 max-w-[220px] rounded-control border-border/60 bg-background px-2 text-[11px] font-normal text-foreground/85 transition-colors hover:border-border hover:bg-muted/40 hover:text-foreground disabled:opacity-50",disabled:c,onClick:()=>a(F),children:l.jsx("span",{className:"truncate",children:R})})}),l.jsx(p.TooltipContent,{side:"top",align:"center",children:l.jsx("p",{className:"max-w-xs text-xs",children:F})})]},`${_}-qr-${A}`))})]})]},_)}return e.role==="system"&&o?l.jsx(O0t,{text:E},_):null}case"error":{const E=N,I=E.errorText??E.error??E.message;return l.jsx("div",{className:"my-4",children:l.jsx(U3,{errorMessage:I})},_)}case"reasoning":return null;default:return((j=N.type)!=null&&j.startsWith("tool-")||N.type==="dynamic-tool")&&H3(N,r)?l.jsx(ka,{FallbackComponent:({error:E,resetErrorBoundary:I})=>l.jsx(P0t,{error:E,resetErrorBoundary:I}),children:l.jsx(j0t,{part:N,idx:_,messageId:e.id,showTools:r,onAddToDashboard:s,messages:n})},_):null}});return e.role==="assistant"?Bfe(e,r)?l.jsxs(zfe,{who:"Assistant",className:"space-y-2",children:[b,x]}):null:l.jsxs("div",{className:"space-y-2",children:[b,x]})}const B0t=8,V0t=24,H0t=20;function U0t(e,t,n,r){return e==="error"&&t?!0:r?!1:!!(n||e==="submitted"||e==="streaming")}function Vfe({messages:e,showTools:t=!1,showSystemMessage:n=!1,handleRun:r,onAddToDashboard:s,onQuickReply:o,disableQuickReplies:i=!1,status:a,errorMessage:c,activeToolText:u,className:d,rowContentClassName:f,statusClassName:h,latestButtonClassName:m,scrollToEndSignal:g=0}){const b=S.useRef(null),x=S.useRef(null),y=S.useRef(e.length),w=S.useRef(!1),v=S.useRef(null),C=S.useRef(!1),N=S.useRef(g),[k,_]=S.useState(!0),[j,E]=S.useState(0),[I,T]=S.useState(V0t);N.current!==g&&(N.current=g,C.current=!0);const D=e[e.length-1],R=Bfe(D,t),F=U0t(a,c,u,R),A=u_({count:e.length,getScrollElement:()=>b.current,estimateSize:W=>{const O=e[W];return(O==null?void 0:O.role)==="user"?88:180},getItemKey:W=>{const O=e[W];return(O==null?void 0:O.id)||`message-${W}`},anchorTo:"end",followOnAppend:!0,scrollEndThreshold:B0t,overscan:6,gap:20,paddingEnd:F?I+H0t:0,useAnimationFrameWithResizeObserver:!0,onChange:W=>{const O=W.isAtEnd();_(Z=>Z===O?Z:O),O&&E(0)}}),U=S.useCallback((W="smooth")=>{v.current!==null&&cancelAnimationFrame(v.current),v.current=requestAnimationFrame(()=>{v.current=null,A.scrollToEnd({behavior:W})}),E(0),_(!0)},[A]);S.useLayoutEffect(()=>{w.current||(w.current=!0,U("auto"))},[U]),S.useLayoutEffect(()=>{C.current&&(C.current=!1,U("auto"))},[e.length,g,U]),S.useEffect(()=>{const W=y.current;y.current=e.length,e.length>W&&!A.isAtEnd()&&E(O=>O+e.length-W),e.length===0&&(E(0),_(!0),w.current=!1,C.current=!1)},[e.length,A]);const $=A.getVirtualItems(),q=A.getTotalSize();return S.useEffect(()=>()=>{v.current!==null&&cancelAnimationFrame(v.current)},[]),S.useLayoutEffect(()=>{const W=x.current;if(!W||!F)return;const O=()=>{const Y=Math.ceil(W.getBoundingClientRect().height);Y>0&&T(M=>M===Y?M:Y)};if(O(),typeof ResizeObserver>"u")return;const Z=new ResizeObserver(O);return Z.observe(W),()=>Z.disconnect()},[F,a,c,u]),l.jsxs(l.Fragment,{children:[l.jsx(Ea,{"data-role":"assistant-virtualized-scroll-area",ref:b,className:p.cn("min-h-0 min-w-0 flex-1 basis-0",d),children:l.jsxs("div",{className:"relative w-full",style:{height:q},children:[$.map(W=>{const O=e[W.index];return O?l.jsx("div",{ref:A.measureElement,"data-index":W.index,className:"absolute left-0 top-0 w-full",style:{transform:`translateY(${W.start}px)`},children:l.jsx("div",{className:p.cn("min-w-0",f),children:l.jsx(z0t,{message:O,messageIndex:W.index,messages:e,showTools:t,showSystemMessage:n,handleRun:r,onAddToDashboard:s,onQuickReply:o,disableQuickReplies:i})})},W.key):null}),F&&l.jsx("div",{ref:x,className:p.cn("absolute left-0 top-0 w-full",h),style:{transform:`translateY(${Math.max(q-I,0)}px)`},children:l.jsx("div",{className:p.cn("min-w-0",f),children:l.jsx(L0t,{status:a,errorMessage:c,activeToolText:u})})})]})}),!k&&l.jsxs("button",{type:"button",onClick:()=>U("smooth"),"aria-label":"Scroll to latest",className:p.cn("absolute right-4 z-10 inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-background px-2.5 text-[11px] text-foreground shadow-[0_1px_2px_rgba(0,0,0,0.08)] transition-colors hover:bg-muted/40",m),children:[l.jsx(gs,{className:"h-3 w-3"}),"Latest",j>0&&l.jsx("span",{className:"grid h-4 min-w-[16px] place-items-center rounded-full bg-foreground px-1 font-mono text-[9px] tabular-nums text-background",children:j>9?"9+":j})]})]})}function q0t(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return"";const t=e;return(typeof t.userSql=="string"?t.userSql:"")||(typeof t.sourceSql=="string"?t.sourceSql:"")||(typeof t.sql=="string"?t.sql:"")}const W0t=[{title:"Show top 3 insights",subtitle:"from this dataset"},{title:"Create a bar chart for",subtitle:"sales by product category"}];function G0t({open:e,setOpen:t,isFullscreen:n,onFullscreenChange:r,fullscreenContainer:s}){const[o,i]=S.useState(!1),[a,c]=S.useState(p.isDevEnv),[u,d]=S.useState(!1),[f,h]=S.useState("auto"),[m,g]=S.useState(!1),[b,x]=S.useState(!1),[y,w]=S.useState(0),v=n??b,{isLocalDev:C,isConsoleMode:N}=Yp(),k=C||N||a,_=S.useRef(null);p.useDashboardStore(le=>le.dashboard.aiScopeTables),p.useDashboardStore(le=>le.isDashboardEditing);const j=p.useDashboardStore(le=>le.selectedSheetId),{setDataSource:E}=p.useEditorActions(),{setSelectedFrameId:I,setIsDashboardEditing:T}=p.useDashboardActions(),D=lL(),{clearAssistantMessageContexts:R}=p.useAIActions(),{clearQueue:F}=p.useQueueActions(),{clearFileAttachments:A,getFileAttachments:U}=p.useFileActions(),$=p.useFileAttachments("dashboard"),q=p.useEditorStore(le=>le.card.dataSource),{assistantProfile:W}=Kue(),O=p.useDashboardStore(le=>le.handleOpenAssistantProfile),{selectedEntities:Z,applyDashboardDefaultEntities:Y}=Q_("dashboard"),{sendMessage:M,isLoading:K,messages:L,setMessages:z,status:B,stop:V,errorMessage:P,clearError:H}=hdt({dynamicVisualMode:f}),G=S.useCallback(()=>{w(le=>le+1)},[]),X=S.useCallback(le=>{r==null||r(le),n===void 0&&x(le)},[n,r]),ne=S.useCallback(()=>{X(!v)},[v,X]);S.useEffect(()=>{if(!v)return;function le(ke){ke.key==="Escape"&&X(!1)}return window.addEventListener("keydown",le),()=>{window.removeEventListener("keydown",le)}},[v,X]);const[de,he]=S.useState(""),pe=le=>{he(le.target.value)};async function xe({sql:le,cardTitle:ke,connectionId:Se,cardType:oe,python:Ie,cardConfig:Ne,dataSource:Le,customVisualPreferences:Ye,visualizationMode:$e,dynamicCardPreferences:Ve}){if(!j)return;const Ze=$e==="dynamic",Ce=p.hasValidCardConfig(Ne),et=Se||(Le==null?void 0:Le.connectionId)||"",Fe=Le?{...Le,connectionId:et||Le.connectionId,connectionType:Le.connectionType||"",mode:Le.mode||"database",selectedEntities:Le.selectedEntities||[]}:et?{connectionId:et,connectionType:"",mode:"database",selectedEntities:[]}:Up,nt=!(Ce&&(!Ze||(Ve==null?void 0:Ve.provenance)==="card-config"||(Ve==null?void 0:Ve.provenance)==="query_spec")),Re=nt?q0t(le):"",Ee=nt?Ie:"",Ge={id:p.v4(),title:ke||"Title",preferences:{onClickFilter:[{columnIndex:0,expression:""}],chartOptions:{indexAxis:oe==="horizontalBar"?"y":"x"},...Ze&&{displayOptions:{showChrome:!1,allowScroll:!1}}},type:oe,sql:Re,python:Ee,dataSource:Fe,config:Ne,connectionId:et,visualizationMode:$e,dynamicCardPreferences:Ve,customCardPreferences:Ye?{url:Ye.url,componentName:Ye.componentName,pluginChartType:Ye.pluginChartType,settings:Ye.settings,type:"component"}:void 0},yt={id:p.v4(),cards:[Ge],activeCardId:Ge.id};try{await D(j,yt,"end"),T(!0),I(yt.id)}catch(xt){console.error("Failed to add assistant visual to dashboard:",xt),tt.error(xt instanceof Error?xt.message:"Failed to prepare semantic metadata for the new visual")}}const se=le=>{le.preventDefault();const ke=de.trim();if(!ke&&$.length===0)return;const Se=[];ke&&Se.push({type:"text",text:ke}),$.forEach(oe=>{oe.data&&Se.push({type:"file",mediaType:oe.type,filename:oe.name,url:`data:${oe.type};base64,${oe.data}`})}),M({role:"user",parts:Se}),he(""),A("dashboard"),G()};S.useEffect(()=>{var le;e&&((le=_.current)==null||le.focus())},[e]),fde({assistantType:"dashboard",status:B,isLoading:K,sendMessage:M});const{hasActiveTools:ge,activeToolText:ie}=hde(L);function De(le){const ke={role:"user",parts:[{type:"text",text:le.title+" "+le.subtitle}]};M(ke),G()}function re(le){M({role:"user",parts:[{type:"text",text:le}]}),G()}function me(le){M({role:"user",parts:[{type:"text",text:le}]}),G()}const ve=S.useCallback(async()=>{const le=JSON.stringify(L??[],null,2);try{if(typeof navigator>"u"||!navigator.clipboard)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(le),tt.success("Conversation copied")}catch(ke){console.error("Failed to copy conversation",ke),tt.error("Unable to copy conversation")}},[L]),J=(de==null?void 0:de.length)===0&&(L==null?void 0:L.filter(le=>le.role==="user").length)===0;function ee(){return l.jsx("div",{"data-role":"header",className:"flex items-center gap-2",children:l.jsx("span",{className:"text-[13px] font-medium text-foreground",children:"Assistant"})})}function te(){return l.jsxs(zs,{children:[l.jsx(Bs,{asChild:!0,children:l.jsx(cc,{className:"h-7 p-2 text-muted-foreground hover:text-foreground",children:l.jsx(Sh,{className:"size-3.5"})})}),l.jsxs(ks,{align:"end",children:[l.jsx(da,{children:"Options"}),l.jsx(Ui,{}),l.jsx(Kc,{checked:o,onCheckedChange:i,children:"Token Usage"}),l.jsx(Kc,{checked:a,onCheckedChange:c,children:"Tool Invocations"}),l.jsx(Kc,{checked:u,onCheckedChange:d,children:"System Message"}),(C||N)&&l.jsxs(l.Fragment,{children:[l.jsx(Ui,{}),l.jsx(da,{children:"Dynamic Visuals"}),l.jsx(Kc,{checked:f==="auto",onCheckedChange:()=>h("auto"),children:"Auto"}),l.jsx(Kc,{checked:f==="force",onCheckedChange:()=>h("force"),children:"Force Dynamic"}),l.jsx(Kc,{checked:f==="off",onCheckedChange:()=>h("off"),children:"Disable Dynamic"})]})]})]})}const ue=l.jsxs("div",{"data-role":"dashboard-assistant",className:p.cn("relative flex h-full grow flex-col break-words bg-background",v&&"rounded-card border border-border/60 shadow-xl"),children:[l.jsxs("header",{"data-role":"header-section",className:"flex h-10 shrink-0 items-center gap-2 border-b border-border/60 px-3",children:[ee(),O&&l.jsxs("button",{type:"button",onClick:O,className:"inline-flex h-6 items-center gap-1 rounded-[4px] border border-border/60 bg-muted/40 px-1.5 text-[11px] text-muted-foreground transition-colors hover:border-border hover:text-foreground",title:"Edit assistant profile",children:[l.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground/60"}),l.jsx("span",{className:"max-w-[180px] truncate",children:(W==null?void 0:W.name)||"Default profile"})]}),l.jsxs("div",{"data-role":"header-actions",className:"ml-auto flex items-center gap-0.5",children:[N&&te(),k&&l.jsx(p.Button,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-[11px] text-muted-foreground hover:text-foreground",onClick:ve,children:"Copy Conversation"}),l.jsx(cc,{className:"grid h-6 w-6 place-items-center rounded-[4px] p-0 text-muted-foreground hover:bg-muted hover:text-foreground",tooltip:v?"Exit fullscreen":"Expand",onClick:ne,children:v?l.jsx(Pt.Minimize2,{className:"h-3.5 w-3.5"}):l.jsx(Pt.Maximize2,{className:"h-3.5 w-3.5"})}),l.jsx(cc,{className:"grid h-6 w-6 place-items-center rounded-[4px] p-0 text-muted-foreground hover:bg-muted hover:text-foreground",tooltip:"New chat",onClick:()=>{const le=L.filter(ke=>ke.role==="assistant").map(ke=>ke.id).filter(ke=>!!ke);z([]),F("dashboard"),H(),R(le)},children:l.jsx(XR,{className:"h-3.5 w-3.5"})}),l.jsx(cc,{className:"grid h-6 w-6 place-items-center rounded-[4px] p-0 text-muted-foreground hover:bg-muted hover:text-foreground",tooltip:"Close",onClick:()=>{t(!1)},children:l.jsx(je.X,{className:"h-3.5 w-3.5"})})]})]}),l.jsx(Vfe,{messages:L,showTools:a,showSystemMessage:u,onAddToDashboard:xe,onQuickReply:me,disableQuickReplies:K,status:B,errorMessage:P,activeToolText:K&&ge?ie:void 0,className:p.cn(v?"px-6 py-5":"px-3 py-3"),rowContentClassName:p.cn(v&&"mx-auto w-full max-w-[680px]"),latestButtonClassName:e?"bottom-[148px]":"hidden",scrollToEndSignal:y}),l.jsxs("div",{className:"shrink-0 space-y-2 border-t border-border/60 px-3 pb-3 pt-2",children:[!W&&J&&l.jsx(Ice,{onClick:De,placeholders:W0t}),J&&W&&l.jsx(Zue,{seedQuestions:W.seedQuestions||[],handleSeedQuestionClick:re}),l.jsx(dde,{assistantType:"dashboard"}),l.jsx(S3,{ref:_,setInput:he,stop:V,input:de,handleInputChange:pe,handleSubmit:le=>{se(le)},isLoading:K,status:B,assistantType:"dashboard",onFocus:()=>{}})]}),l.jsx(w3,{incomingSelectedEntities:Z,open:m,onOpenChange:g,dataSource:q||Up,dialogMode:"aiContext",saveAsDashboardDefault:!0,onSaveSelectedEntities:le=>Y()})]});return v&&s?br.createPortal(l.jsx(Ag,{className:"pointer-events-auto absolute inset-0 z-50 flex bg-background/95 px-4 pb-4 pt-[calc(var(--app-header-height,15px)+0.5rem)] backdrop-blur-sm",children:l.jsx("div",{className:"flex h-full w-full",children:ue})}),s):ue}function Y0t(e){const t=e.current,{getSelectedFrame:n,setSelectedFrameId:r}=p.useDashboardActions(),s=rie(),o=p.useDashboardStore(d=>d.dashboard.sheets),a=p.useDashboardStore(d=>d.selectedSheetId)??(o==null?void 0:o[0].id),c=p.useDashboardStore(d=>d.isDashboardEditing),u=p.useDashboardStore(d=>d.isVisualEditing);S.useEffect(()=>{if(!c||u)return;async function d(m){if(K0t(m.target))return;const g=m.ctrlKey||m.metaKey;g&&m.key==="c"?(await f(),tt.success("Card copied to clipboard"),m.preventDefault()):g&&m.key==="v"&&(await h(),m.preventDefault())}async function f(){try{const m=n();m&&await navigator.clipboard.writeText(JSON.stringify(m))}catch(m){console.error("Failed to copy text:",m)}}async function h(){if(!a)return null;try{const m=await navigator.clipboard.readText(),g=Z0t(m);if(g!=null&&g.id){const b=eie(g),x=b.cards.findIndex(y=>y.id===b.activeCardId);x!==-1&&(b.cards[x].title=`${b.cards[x].title} (Copy)`),await s(a,b),r(b.id),tt.success("Card pasted from clipboard")}return m}catch(m){return console.error("Failed to paste text:",m),null}}return t==null||t.addEventListener("keydown",d),()=>t==null?void 0:t.removeEventListener("keydown",d)},[s,n,r,a,c,u,t])}function K0t(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;const t=e.closest("[contenteditable]");return t&&t.getAttribute("contenteditable")!=="false"?!0:!!e.closest('input, textarea, select, [role="textbox"]')}function Z0t(e){try{const t=JSON.parse(e);return t&&typeof t=="object"&&typeof t.id=="string"&&Array.isArray(t.cards)?t:null}catch{return null}}function X0t(e,t){switch(e.interactionMode){case"drillToDetail":Q0t(e,t);break;case"drillThrough":J0t(e,t);break;case"drillToURL":evt(e);break;case"inlineDrill":console.warn("Inline drill execution not yet implemented");break;case"clickFilter":case"drillDown":case"dynamicDrill":break;default:console.warn("Unknown interaction mode:",e.interactionMode)}}function Q0t(e,t){var c;const{targetInsightId:n,contextMode:r,displayMode:s,filterGroups:o}=e;if(!n){console.warn("drillToDetail event missing targetInsightId");return}const i=r||"full";let a=[];switch(i){case"interactionFilters":a=o.flatMap(u=>u.filters);break;case"full":{const u=((c=t.getCurrentFilters)==null?void 0:c.call(t))||[],d=o.flatMap(f=>f.filters);a=[...u,...d];break}case"none":default:a=[];break}s==="replace-card"?t.replaceCardContent({cardId:e.sourceCardId,insightId:n,filters:a,contextMode:r}):t.openInsightModal({insightId:n,filters:a,contextMode:r})}function J0t(e,t){var u,d;const{targetDashboardId:n,contextMode:r="interactionFilters",filterGroups:s,sourceCardId:o}=e;if(!n){console.warn("[DrillThrough] Event missing targetDashboardId. This interaction needs to be reconfigured with a target dashboard.",e);return}const i=s.flatMap(f=>f.filters),a=((u=t.getCurrentDashboardId)==null?void 0:u.call(t))||"",c=(d=t.getCurrentDashboardTitle)==null?void 0:d.call(t);t.setGlobalDrillContext&&t.setGlobalDrillContext({filters:i,contextMode:r,sourceDashboardId:a,sourceDashboardTitle:c,targetDashboardId:n}),t.setPendingDrillThrough&&t.setPendingDrillThrough({targetDashboardId:n,sourceDashboardId:a,sourceDashboardTitle:c,filters:i,contextMode:r})}function evt(e){const{url:t}=e;if(!t){console.warn("drillToURL event missing url");return}try{new URL(t)}catch(n){console.error("Invalid URL:",t,n);return}window.open(t,"_blank","noopener,noreferrer")}function tvt({open:e,onOpenChange:t,insightId:n,filters:r,filterDefinitions:s,contextMode:o,cardTitle:i,cardDescription:a}){return l.jsx(_o,{open:e,onOpenChange:t,children:l.jsxs(ao,{className:"max-h-[90vh] max-w-[90vw] p-6",children:[l.jsxs(Zi,{children:[l.jsx(lo,{children:i||"Insight Detail"}),l.jsx(Go,{children:a||"View detailed insight data with applied filters"})]}),l.jsx(iie,{filters:r,filterDefinitions:s,contextMode:o}),l.jsx("div",{className:"h-[400px] flex-1 overflow-auto",children:n?l.jsx(vie,{insightId:n,filters:r,contextMode:o}):l.jsx("div",{className:"flex items-center justify-center p-12 text-muted-foreground",children:"No insight selected"})})]})})}function nvt(){const e=p.useInteractionStore(C=>C.interactionStates),t=p.useInteractionStore(C=>C.setInteractionState),n=p.useInteractionStore(C=>C.clearLastInteractionEvent),r=p.useInteractionStore(C=>C.replaceCardWithInsight),s=p.useInteractionStore(C=>C.setPendingDrillThrough),o=p.useInteractionStore(C=>C.pendingDrillThrough),i=p.useInteractionStore(C=>C.clearPendingDrillThrough),{setSelectedSheetId:a,navigateWithDrill:c}=p.useDashboardActions(),{selectDashboard:u}=vh(),d=p.useDashboardStore(C=>C.dashboard),f=p.useDashboardStore(C=>C.filterValues),{data:h,isLoading:m}=EG((o==null?void 0:o.targetDashboardId)||"",{enabled:!!(o!=null&&o.targetDashboardId)}),[g,b]=S.useState({open:!1,insightId:""}),x=wie(g.insightId,{enabled:g.open&&!!g.insightId}),y=S.useRef(new Set),w=S.useMemo(()=>({setSelectedSheetId:a,openInsightModal:({insightId:C,filters:N,contextMode:k})=>{b({open:!0,insightId:C,filters:N,filterDefinitions:(d==null?void 0:d.filters)||[],contextMode:k})},replaceCardContent:({cardId:C,insightId:N,filters:k,contextMode:_})=>{r(C,N,k,_)},getCurrentFilters:()=>f||[],navigateWithDrill:c,getCurrentDashboardId:()=>(d==null?void 0:d.id)||"",getCurrentDashboardTitle:()=>d==null?void 0:d.title,setPendingDrillThrough:s,setGlobalDrillContext:({filters:C,contextMode:N,sourceDashboardId:k,sourceDashboardTitle:_,targetDashboardId:j})=>{const E={filters:C},I={sourceCardId:p.DRILL_CONTEXT_CARD_ID,interactionMode:"clickFilter",filterGroups:[E]},T={...p.createInitialInteractionState(),appliedClickFilters:[I],contextMode:N,sourceDashboardId:k,sourceDashboardTitle:_,targetDashboardId:j};t(p.DRILL_CONTEXT_CARD_ID,T)}}),[a,r,f,c,d,s,t]);S.useEffect(()=>{Object.entries(e).forEach(([C,N])=>{if(N!=null&&N.lastInteractionEvent){const k=N.lastInteractionEvent,_=`${C}-${k.interactionMode}-${k.sourceCardId}-${Date.now()}`;if(y.current.has(_))return;y.current.add(_);try{X0t(k,w)}catch(j){console.error("Error executing interaction event:",j)}finally{n(C),setTimeout(()=>{y.current.delete(_)},5e3)}}})},[e,n,w]),S.useEffect(()=>{if(!(!o||!h||m))try{u(h),c(o.targetDashboardId,o.sourceDashboardId,o.sourceDashboardTitle,o.filters,o.contextMode),i()}catch(C){console.error("[DrillThrough] Error during automatic navigation:",C),i()}},[o,h,m,u,c,i]);const v=()=>{b({open:!1,insightId:""})};return l.jsxs(l.Fragment,{children:[l.jsx(tvt,{open:g.open,onOpenChange:v,insightId:g.insightId,filters:g.filters,filterDefinitions:g.filterDefinitions,contextMode:g.contextMode,cardTitle:x.title,cardDescription:x.description}),o&&m&&l.jsx("div",{className:"fixed inset-0 z-[51] flex items-center justify-center bg-background/80 backdrop-blur-sm",children:l.jsxs("div",{className:"flex flex-col items-center gap-2.5 rounded-[6px] border border-border/60 bg-background px-4 py-3 shadow-sm",children:[l.jsx(p.LoaderCircle,{className:"h-5 w-5 animate-spin text-muted-foreground/60"}),l.jsx("div",{className:"text-[12px] text-muted-foreground",children:"Loading dashboard..."})]})})]})}function rvt(e){return e.length===0?"":e.map(t=>{const n=t.field.label||t.field.name,r=t.operator,s=svt(t.value);return r==="="?`${n} = ${s}`:`${n} ${r} ${s}`}).join(", ")}function svt(e){return e==null?"null":Array.isArray(e)?e.join(", "):typeof e=="object"&&e.toString?e.toString():String(e)}function ovt(e){return e?`Back to ${e}`:"Back"}function ivt(){var y,w,v,C,N;const e=p.useInteractionStore(k=>k.interactionStates[p.DRILL_CONTEXT_CARD_ID]),t=p.useDashboardStore(k=>k.actions.goBackFromDrill),n=p.useDashboardStore(k=>k.actions.clearDrillContext),{selectDashboard:r}=vh(),[s,o]=S.useState({x:16,y:16}),[i,a]=S.useState(!1),c=S.useRef({x:0,y:0});S.useEffect(()=>{if(!i)return;const k=j=>{o({x:j.clientX-c.current.x,y:j.clientY-c.current.y})},_=()=>{a(!1)};return document.addEventListener("mousemove",k),document.addEventListener("mouseup",_),()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",_)}},[i]);const u=e==null?void 0:e.sourceDashboardId,d=e==null?void 0:e.sourceDashboardTitle,f=((C=(v=(w=(y=e==null?void 0:e.appliedClickFilters)==null?void 0:y[0])==null?void 0:w.filterGroups)==null?void 0:v[0])==null?void 0:C.filters)||[],h=u?{id:u,title:d||"Previous Dashboard",description:"",isPrivate:!1,isPublic:!1,version:"",createdBy:null,createdByTenantUser:"",tenantId:"",projectId:"",createdAt:"",updatedAt:"",lastModified:"",lastModifiedBy:"",createdByUser:null,createdByTenantUserRel:{name:"",email:""},permissions:{canEdit:!0,canShare:!0,canDelete:!0},ownership:{status:"private",isOwner:!0,sharedCount:0,createdBy:{type:"user",userId:"",name:"",email:""}}}:null;if(!e||!((N=e.appliedClickFilters)!=null&&N.length))return null;const m=()=>{if(!h){console.warn("[DrillBack] No source dashboard in context");return}try{t(),r(h)}catch(k){console.error("[DrillBack] Error during back navigation:",k)}},g=()=>{n()},b=k=>{k.target.closest("button")||(a(!0),c.current={x:k.clientX-s.x,y:k.clientY-s.y})};rvt(f);const x=ovt(d);return l.jsx("div",{className:"fixed z-50 max-w-md",style:{left:0,top:0,transform:`translate(${s.x}px, ${s.y}px)`,transition:i?"none":void 0},children:l.jsxs("div",{className:"select-none rounded-lg border bg-background/95 p-3 shadow-lg backdrop-blur-sm",onMouseDown:b,style:{cursor:i?"grabbing":"grab"},children:[l.jsxs("div",{className:"mb-3 flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Viewing:"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:f.map((k,_)=>{const j=k.field.label||k.field.name,E=String(k.value);return l.jsxs(cs,{variant:"secondary",className:"pointer-events-none text-xs",children:[j," = ",E]},_)})})]}),l.jsx(p.Button,{variant:"ghost",size:"sm",onClick:g,className:"h-6 w-6 cursor-pointer p-0",title:"Clear drill context",children:l.jsx(je.X,{className:"h-3 w-3"})})]}),l.jsx("div",{className:"flex items-center gap-2 border-t pt-2",children:l.jsxs(p.Button,{variant:"secondary",size:"sm",onClick:m,disabled:!h,className:"w-full cursor-pointer",children:[l.jsx(I0,{className:"mr-2 h-4 w-4"}),x]})})]})})}function avt(e,t){return typeof e=="boolean"?e:typeof t=="boolean"?t:!1}function lvt({filter:e,isEditing:t=!1,disabled:n=!1,storageOptions:r,settingsVariant:s,filterQueryContext:o,inputVariableName:i,reservedInputVariableNames:a,onUpdateFilter:c,onRemoveFilter:u}){const{attributes:d,listeners:f,setNodeRef:h,transform:m,transition:g,isDragging:b}=zg({id:`filter:${e.id}`,disabled:n||!t}),x={transform:bi.Translate.toString(m),transition:g,opacity:b?.5:1,zIndex:b?10:void 0};return l.jsx("div",{ref:h,style:x,...d,children:l.jsx(V5,{filter:e,isEditing:t,dragListeners:t?f:void 0,storageOptions:r,settingsVariant:s,filterQueryContext:o,inputVariableName:i,reservedInputVariableNames:a,onUpdateFilter:c,onRemoveFilter:u})})}const GU="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",cvt=[];function Hfe({open:e,onOpenChange:t}){var L,z,B;const[n,r]=S.useState(!1),[s,o]=S.useState(!1),[i,a]=S.useState({sheetSelection:"current",protectPdf:!1,password:""}),c=p.useDashboardStore(V=>{var P;return(P=V.dashboard)==null?void 0:P.sheets}),u=p.useDashboardStore(V=>V.dashboard),d=p.useDashboardStore(V=>V.dashboardInputValues),f=p.useDashboardStore(V=>V.filterValues),h=p.useDashboardStore(V=>V.controlValues),m=p.useDashboardStore(V=>V.inlineFilterValuesMap),g=p.useDashboardStore(V=>V.cardControlValuesMap),b=p.useDashboardStore(V=>V.selectedSheetId),x=p.useDashboardStore(V=>V.selectedSheetId?V.documentInputRuntimeBySheetId[V.selectedSheetId]:void 0),y=p.useDashboardStore(V=>V.isDownloadingPdf),{authToken:w,tokenProps:v}=mt(),C=c==null?void 0:c.find(V=>V.id===b),N=S.useMemo(()=>p.getDashboardExportSheets(c),[c]),k=p.isDocumentSheet(C),_=k&&C?C.document:void 0,j=S.useMemo(()=>k&&C?Bv(u,C.id):[],[C,k,u]),E=j.length>0,I=S.useMemo(()=>k&&C?rce(u,C.id):!1,[C,k,u]),T=S.useMemo(()=>E?j.map(Vv):(_==null?void 0:_.inputs)||cvt,[_,j,E]),D=((z=(L=v==null?void 0:v.params)==null?void 0:L.calendarContext)==null?void 0:z.tz)||((B=v==null?void 0:v.params)==null?void 0:B.timezone)||(typeof Intl<"u"?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0),R=S.useMemo(()=>rle(T),[T]),F=S.useMemo(()=>tle(T,D),[T,D]),A=S.useMemo(()=>nle(T),[T]),U=x?x.filterValuesByInputId:F,$=x?x.controlValuesByInputId:A,q=S.useMemo(()=>k?I&&C&&_?lZ({dashboard:u,sheetId:C.id,sheetKind:"document",sectionIds:_.sections.map(V=>V.id),mode:"document",runtimeValues:{dashboardInputValues:d,filterValues:f,controlValues:h,inlineFilterValuesMap:m,cardControlValuesMap:g},timezone:D}):ile(T,U,$,R,R):[],[_,T,C,k,u,g,h,f,m,d,$,U,R,D,I]),W=!!C,O=N.length>0,Z=((c==null?void 0:c.length)||0)>1||k,Y=i.sheetSelection==="current"&&(!W||k&&q.length>0)||i.sheetSelection==="all"&&!O;S.useEffect(()=>{e&&i.sheetSelection==="all"&&!O&&a(V=>({...V,sheetSelection:"current"}))},[O,e,i.sheetSelection]);const M=()=>{a({sheetSelection:"current",protectPdf:!1,password:""}),r(!1),t(!1)};async function K(){if(y){tt.error("A PDF export is already in progress");return}if(i.protectPdf&&!i.password){tt.error("Please enter a password to protect the PDF");return}if(i.sheetSelection==="current"&&!W){tt.error("No sheet is selected to export");return}if(i.sheetSelection==="all"&&!O){tt.error("No dashboard sheets are available to export");return}o(!0);const V=i.sheetSelection==="current"&&k,P=V?i.protectPdf?"Generating protected document PDF... may take up to 60 seconds":"Generating document PDF... may take up to 60 seconds":i.sheetSelection==="all"?"Generating PDF for all dashboard sheets... This may take a while.":i.protectPdf?"Generating protected PDF... may take up to 60 seconds":"Generating PDF... may take up to 60 seconds",H=tt.loading(P);try{if(V){if(!_||!C)throw new Error("Selected document sheet is missing document data");if(q.length>0){tt.dismiss(H),tt.error(`Set ${q.join(", ")} before exporting`);return}const X=new Date().toISOString(),ne=I?uZ({dashboard:u,sheetId:C.id,sheetKind:"document",sectionIds:_.sections.map(de=>de.id),mode:"document",runtimeValues:{dashboardInputValues:d,filterValues:f,controlValues:h,inlineFilterValuesMap:m,cardControlValuesMap:g},generatedAt:X,timezone:D}).snapshot:void 0;await aF(v.apiServiceUrl,w,{sheetId:C.id,title:C.title||"Document",pageSize:_.page.size,orientation:_.page.orientation,timezone:D,password:i.protectPdf?i.password:void 0,inputSnapshot:ne,...ne?{}:{inputValues:{sheetId:C.id,filterValuesByInputId:U,controlValuesByInputId:$,generatedAt:X}}})}else{const X=LJ();await bZ(v.apiServiceUrl,w,i.protectPdf?i.password:void 0,i.sheetSelection,X)}tt.dismiss(H);const G=V?i.protectPdf?"Protected document PDF downloaded successfully!":"Document PDF downloaded successfully!":i.sheetSelection==="all"?"Dashboard sheets PDF downloaded successfully!":i.protectPdf?"Protected PDF downloaded successfully!":"PDF downloaded successfully!";tt.success(G,{duration:2e3}),M()}catch(G){tt.dismiss(H),tt.error("Failed to download PDF",{description:Rk(G,"Please try again or contact support."),descriptionClassName:Ak,closeButton:!0,duration:1/0,richColors:!0}),console.error("PDF download error:",G)}finally{o(!1)}}return l.jsx(_o,{open:e,onOpenChange:V=>{if(!V){M();return}t(!0)},children:l.jsxs(ao,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[l.jsxs(Zi,{children:[l.jsx(lo,{className:"text-[15px]",children:k?"Export document":"Export dashboard"}),l.jsx(Go,{className:"text-[13px] leading-5",children:k?"Export this document sheet as a PDF document.":"Export this dashboard as a PDF document."})]}),l.jsxs("div",{className:"space-y-4 py-1",children:[Z&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(p.Label,{className:GU,children:"Export scope"}),l.jsxs(Sa,{value:i.sheetSelection,onValueChange:V=>a({...i,sheetSelection:V}),className:"gap-1.5",children:[l.jsxs(p.Label,{htmlFor:"scope-current",className:p.cn("flex cursor-pointer items-center gap-2 rounded-control px-1 py-1 text-[13px] font-normal hover:bg-muted/50",!W&&"cursor-not-allowed opacity-50 hover:bg-transparent"),children:[l.jsx(Ss,{value:"current",id:"scope-current",disabled:!W}),k?"This document":"This sheet"," (",(C==null?void 0:C.title)||"Current",")"]}),l.jsxs(p.Label,{htmlFor:"scope-all",className:p.cn("flex cursor-pointer items-center gap-2 rounded-control px-1 py-1 text-[13px] font-normal hover:bg-muted/50",!O&&"cursor-not-allowed opacity-50 hover:bg-transparent"),children:[l.jsx(Ss,{value:"all",id:"scope-all",disabled:!O}),"Dashboard sheets (",N.length," ",N.length===1?"sheet":"sheets",")"]})]}),k&&l.jsx("p",{className:"text-[12px] leading-5 text-muted-foreground",children:q.length>0?`Set ${q.join(", ")} before exporting this document.`:'"Dashboard sheets" includes dashboard sheets only. Choose "This document" to export the selected document.'})]}),l.jsx(p.Separator,{className:"bg-border/60"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(p.Label,{htmlFor:"protect-pdf",className:"flex cursor-pointer items-center gap-2 text-[13px] font-normal",children:[l.jsx(Rn,{id:"protect-pdf",checked:i.protectPdf,onCheckedChange:V=>{a({...i,protectPdf:V,password:V?i.password:""}),V||r(!1)}}),l.jsx(QN,{className:"h-3.5 w-3.5 text-muted-foreground"}),"Password protect PDF"]}),i.protectPdf&&l.jsxs("div",{className:"ml-6 space-y-1.5",children:[l.jsx(p.Label,{htmlFor:"pdf-password",className:GU,children:"Password"}),l.jsxs("div",{className:"relative",children:[l.jsx(p.Input,{id:"pdf-password",size:"xs",type:n?"text":"password",value:i.password,onChange:V=>a({...i,password:V.target.value}),placeholder:"Enter password",className:"pr-8",onKeyDown:V=>{V.key==="Enter"&&i.password&&K()}}),l.jsx("button",{type:"button",className:"absolute right-1 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-control text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>r(!n),"aria-label":n?"Hide password":"Show password",children:n?l.jsx(XN,{className:"h-3.5 w-3.5"}):l.jsx(Pt.Eye,{className:"h-3.5 w-3.5"})})]}),l.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Recipients will need this password to open the PDF."})]})]})]}),l.jsxs(Ic,{children:[l.jsx(p.Button,{variant:"outline",size:"xs",onClick:M,disabled:s,children:"Cancel"}),l.jsx(p.Button,{size:"xs",onClick:K,disabled:s||y||Y,children:s?l.jsxs(l.Fragment,{children:[l.jsx(p.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Exporting…"]}):l.jsxs(l.Fragment,{children:[l.jsx(_c,{className:"h-3.5 w-3.5"}),"Export"]})})]})]})})}function Ufe({iconClassName:e,open:t,onOpenChange:n}){const[r,s]=S.useState(!1),o=t!==void 0,i=o?t:r,a=u=>{o||s(u),n==null||n(u)},c=p.useDashboardStore(u=>u.isDownloadingPdf);return l.jsxs(l.Fragment,{children:[o?null:l.jsx(p.Button,{variant:"ghost",size:"sm",className:"h-7 p-2",disabled:c,onClick:()=>a(!0),children:l.jsx(_c,{className:p.cn("size-4",e)})}),l.jsx(Hfe,{open:i,onOpenChange:a})]})}function YU(e,t,n){const r=new Set(t),s=[...n];return e.map(o=>r.has(o.id)?s.shift()??o.id:o.id)}function uvt({control:e,value:t,isEditing:n=!1,onChange:r}){const{attributes:s,listeners:o,setNodeRef:i,transform:a,transition:c,isDragging:u}=zg({id:`control:${e.id}`,disabled:!n}),d={transform:bi.Translate.toString(a),transition:c,opacity:u?.5:1,zIndex:u?10:void 0};return l.jsx("div",{ref:i,style:d,...s,children:l.jsx(vle,{control:e,value:t,isEditing:n,dragListeners:n?o:void 0,onChange:r})})}function KU(e){var t;return(((t=e.values)==null?void 0:t.length)??0)>0||e.operation==="is null"||e.operation==="is not null"}function ZU(e,t){return[...e.map(n=>`filter:${n.id}`),...t.map(n=>`control:${n.id}`)]}function dvt(e,t,n){const r=new Set([...t.map(a=>`filter:${a.id}`),...n.map(a=>`control:${a.id}`)]);if(!(e!=null&&e.length))return ZU(t,n);const s=e.filter(a=>r.has(a)),o=new Set(s),i=ZU(t,n).filter(a=>!o.has(a));return[...s,...i]}function fvt(e,t){return p.getDashboardCardEntries({sheets:e.sheets||[]}).filter(n=>n.sheet.id===t).map(n=>n.card.id)}function hvt(e){return xp(e.dashboardInput,{sheetId:e.selectedSheetId,sheetKind:"dashboard"})?!0:e.dashboardInput.scope.kind!=="cards"?!1:e.selectedSheetCardIds.some(t=>xp(e.dashboardInput,{sheetId:e.selectedSheetId,cardId:t,sheetKind:"dashboard"}))}function XU(e){var t;return((t=e.compatibility)==null?void 0:t.source)!=="dashboardFilter"}function mvt(e){const t={sheetId:e.selectedSheetId},n=p.getDashboardInputRuntimeSlot(e.dashboardInputValues,e.dashboardInput,t);if(n)return n;const r=p.getDashboardInputRuntimeSlot(e.defaultInputValues,e.dashboardInput,t);return r||p.getBackingDefaultSlot(e.dashboardInput)}function pvt(e){return qfe(e).filter(t=>{var n,r;return t.filter.hide||t.filter.location==="frame"?!1:((n=t.compatibility)==null?void 0:n.source)==="dashboardFilter"?!0:(((r=t.presentation)==null?void 0:r.placement)||"toolbar")==="toolbar"})}function qfe(e){if(!e.selectedSheetId)return[];const t=e.selectedSheetId,n=fvt(e.dashboard,t);return kK(_k({dashboard:e.dashboard}).allInputs).filter(r=>!(r.kind!=="filter"||!hvt({dashboardInput:r,selectedSheetId:t,selectedSheetCardIds:n})))}function gvt(e,t){return"toolbar"}function bvt(){const e=Tc("interactive"),t=p.useDashboardStore(z=>z.selectedSheetId),n=p.useDashboardStore(z=>z.dashboard.filters),r=p.useDashboardStore(z=>z.dashboard.filterLayout),s=p.useDashboardStore(z=>z.isDashboardEditing),o=p.useDashboardStore(z=>z.controlValues),i=p.useDashboardStore(z=>z.filterValues);p.useDashboardStore(z=>z.filteringCards);const a=p.useDashboardStore(z=>z.inlineFilterValuesMap),c=p.useDashboardStore(z=>z.dashboardInputValues),u=p.useInteractionStore(z=>z.clearAllClickFilters),d=p.useInteractionStore(z=>Object.entries(z.interactionStates).reduce((B,[V,P])=>{var H;return V===p.DRILL_CONTEXT_CARD_ID?B:B+(((H=P.appliedClickFilters)==null?void 0:H.length)??0)},0)),f=p.useDashboardStore(z=>z.actions.removeCardInlineFilterValue),{reorderFilters:h,clearDashboardInputSlot:m,reorderDashboardControls:g,removeDashboardInput:b,setControlValue:x,setFilterLayout:y,setFilterValues:w,setFilteringCards:v,upsertDashboardInput:C}=p.useDashboardActions(),N=nj(Bp(Lg,{activationConstraint:{distance:5}})),k=p.useDashboardStore(z=>z.dashboard),_=pvt({dashboard:k,selectedSheetId:t}).filter(z=>gvt(z.filter)==="toolbar"),j=qfe({dashboard:k,selectedSheetId:t}),E=_.map(z=>z.filter),I=new Map(_.map(z=>[`filter:${z.filter.id}`,z])),T=NYe(k),D=T.filter(z=>!z.hidden&&Ky(z)==="toolbar"),R=T.filter(z=>!z.hidden&&Ky(z)==="advanced"),F=dvt(r==null?void 0:r.toolbarItemOrder,E,D),A=new Map(E.map(z=>[`filter:${z.id}`,z])),U=new Map(D.map(z=>[`control:${z.id}`,z]));function $(z){const{active:B,over:V}=z;if(!V||B.id===V.id)return;const P=String(B.id),H=String(V.id),G=F.findIndex(ge=>ge===P),X=F.findIndex(ge=>ge===H);if(G===-1||X===-1)return;const ne=$g(F,G,X);y({toolbarItemOrder:ne});const de=new Set((n||[]).map(ge=>ge.id)),he=F.filter(ge=>ge.startsWith("filter:")).map(ge=>ge.replace("filter:","")).filter(ge=>de.has(ge)),pe=ne.filter(ge=>ge.startsWith("filter:")).map(ge=>ge.replace("filter:","")).filter(ge=>de.has(ge)),xe=F.filter(ge=>ge.startsWith("control:")).map(ge=>ge.replace("control:","")),se=ne.filter(ge=>ge.startsWith("control:")).map(ge=>ge.replace("control:",""));h(YU(n||[],he,pe)),g(YU(k.controls||[],xe,se))}const q=(r==null?void 0:r.toolbarWrap)??!1,W=(r==null?void 0:r.showDownloadButton)??!1,O=(i==null?void 0:i.filter(z=>KU(z)).length)??0,Z=j.filter(XU),Y=Z.filter(z=>{const B=mvt({dashboardInput:z,dashboardInputValues:c,defaultInputValues:k.defaultInputValues,selectedSheetId:t});return(B==null?void 0:B.status)==="set"&&B.value.kind==="filter"&&KU(B.value.filterValue)}).length,M=a?Object.values(a).reduce((z,B)=>z+((B==null?void 0:B.length)??0),0):0,K=O+Y+M+d,L=()=>{w([]),Z.forEach(z=>{m(z,{sheetId:t})}),v([]),u(),a&&Object.entries(a).forEach(([z,B])=>{B==null||B.forEach(V=>{f(z,V.filterId)})})};return!E.length&&!D.length&&!R.length&&!W&&K===0?null:l.jsx("div",{className:"z-20 border-b border-border/60 bg-background/95 px-3 py-2 backdrop-blur supports-[backdrop-filter]:bg-background/85",style:e.containerStyle,role:"toolbar","aria-label":"Dashboard filters and controls",children:l.jsx(Pv,{sensors:N,collisionDetection:Mv,onDragEnd:$,children:l.jsxs("div",{className:p.cn("flex items-center",q?"flex-wrap":"w-0 min-w-full overflow-x-auto"),children:[l.jsx(Fv,{items:F,strategy:bL,children:l.jsx(QA,{className:"gap-3 pr-0",wrap:q,children:F.map(z=>{const B=A.get(z);if(B){const P=I.get(z),H=P&&XU(P);return l.jsx(lvt,{filter:B,isEditing:s,storageOptions:H?{storageTarget:"dashboardInput",dashboardInput:P,sheetId:t??void 0}:void 0,inputVariableName:H?P.variableName:void 0,onUpdateFilter:H?(G,X)=>{C({...P,variableName:(X==null?void 0:X.variableName)||P.variableName,filter:G})}:void 0,onRemoveFilter:H?()=>{w((i||[]).filter(G=>G.filterId!==B.id)),b(P.id)}:void 0},z)}const V=U.get(z);return V?l.jsx(uvt,{control:V,value:o==null?void 0:o[V.id],isEditing:s,onChange:P=>x(V.id,P)},z):null})})}),R.length>0&&l.jsx(pie,{title:"",controls:R,values:o,onChange:(z,B)=>x(z.id,B),immediatePlacement:"toolbar",advancedLabel:"More controls"}),K>0&&l.jsxs("button",{type:"button",onClick:L,"aria-label":"Clear all filters",className:"ml-auto inline-flex h-7 shrink-0 items-center gap-1 rounded-control px-2 text-[12px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:[l.jsx(je.X,{className:"h-3 w-3"}),"Clear all",l.jsx("span",{className:"rounded-[3px] bg-muted px-1 text-[10px] tabular-nums text-muted-foreground",children:K})]}),W&&l.jsx("div",{className:p.cn(K>0?"ml-1.5":"ml-auto"),children:l.jsx(Ufe,{})})]})})})}function Wfe(){var me,ve;const{showAssistant:e,tokenProps:t,renderMode:n}=mt(),r=avt((me=t.config)==null?void 0:me.showDashboardAssistant,e),{preferences:s}=Yp(),o=(ve=s==null?void 0:s.cardDisplay)==null?void 0:ve.mode,i=Dh(o),a=WK({displayMode:o,renderMode:n}),c=S.useRef(null),u=S.useRef(null),[d,f]=S.useState(!1),{handleDragStart:h,isDraggingRef:m,getStyle:g,getPositionClasses:b}=eot({initialPosition:"bottom-right"}),x=kf(J=>J.setFullscreen),y=kf(J=>J.setPanelOpen),w=kf(J=>J.setContainer),v=MY("dashboard"),C=AY(),N=RY("dashboard"),k=v.isOpen,_=C==="dashboard",j=p.useDashboardStore(J=>J.isVisualEditing),E=p.useDashboardStore(J=>J.themeStyle),I=Dc(),T=p.useDashboardStore(J=>{var ee;return(ee=J.dashboard)==null?void 0:ee.sheets}),D=p.useDashboardStore(J=>J.showFilters),R=p.useDashboardStore(J=>J.isDashboardEditing),F=p.useDashboardStore(J=>J.selectedSheetId),A=T==null?void 0:T.find(J=>J.id===F),U=p.useDashboardStore(J=>{var ee,te,ue;return(ue=(te=(ee=J.dashboard)==null?void 0:ee.sheets)==null?void 0:te.find(le=>le.id===J.selectedSheetId))==null?void 0:ue.kind}),$=p.useDashboardStore(J=>{var ee,te;return((te=(ee=J.dashboard)==null?void 0:ee.summary)==null?void 0:te.position)||"top"}),q=U==="document",W=p.useDashboardStore(J=>{var ee;return(ee=J.dashboard)==null?void 0:ee.id}),{getDefaultSheetId:O,setDefaultSheetId:Z,clearDefaultSheetId:Y}=Fq(W),[M,K]=S.useState(null),{setSelectedSheetId:L,setSheetTitle:z,addSheet:B,setSheets:V}=p.useDashboardActions();Y0t(u);const{setActiveAssistantType:P}=p.useAIActions();S.useEffect(()=>{if(W){const J=O();K(J)}},[W,O]),S.useEffect(()=>{k?P("dashboard"):C==="dashboard"&&x(null)},[k,P,C,x]),S.useEffect(()=>{var J;k||(J=c.current)==null||J.resize(0)},[k]);function H(J){var ee,te;J?((ee=c.current)==null||ee.resize(40),y("dashboard",!0),x("dashboard"),P("dashboard")):(y("dashboard",!1),x(null),(te=c.current)==null||te.resize(0),P(null))}function G(J="dashboard"){const ee={id:p.v4(),title:J==="document"?"New Document":"New Sheet",...J==="document"?{kind:J,document:p.createDefaultDocumentDefinition()}:{}};B(ee),L(ee.id)}function X(J,ee){if(!W)return;M===J?(Y(),K(null),tt.success("Default sheet cleared")):(Z(J),K(J),tt.success(`"${ee}" set as default sheet`))}function ne(J){var ee;J<1?(y("dashboard",!1),x(null),P(null),(ee=c.current)==null||ee.resize(0)):(k||y("dashboard",!0),P("dashboard"))}function de(){return(E==null?void 0:E.canvasTheme)==="muted"||!(E!=null&&E.canvasTheme)?"hsl(var(--semaphor-muted))":(E==null?void 0:E.canvasTheme)==="clear"?"":E==null?void 0:E.canvasTheme}const he=(J,ee)=>{J.dataTransfer.setData("tabIndex",ee.toString())},pe=J=>{J.preventDefault()},xe=(J,ee)=>{const te=J.dataTransfer.getData("tabIndex");if(te===ee.toString())return;const ue=Array.from(T||[]),[le]=ue.splice(parseInt(te),1);ue.splice(ee,0,le),V(ue)},se=r===!0&&!i&&!k&&!j&&!D;function ge(){if(T&&T.length>1||R)return l.jsx("div",{className:"relative flex w-full items-stretch border-b border-border",children:l.jsxs("div",{className:"relative min-w-0 flex-1",children:[l.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 left-0 z-10 w-4 bg-gradient-to-r from-background to-transparent"}),l.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 right-0 z-10 w-4 bg-gradient-to-l from-background to-transparent"}),l.jsxs(p.TabsList,{role:"tab-list",className:"flex w-0 min-w-full items-stretch justify-start overflow-x-auto rounded-none bg-transparent p-0 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[T==null?void 0:T.map((J,ee)=>{const te=F===J.id,ue=M===J.id;return l.jsxs(p.TabsTrigger,{draggable:!0,onDragStart:le=>he(le,ee),onDragOver:pe,onDrop:le=>xe(le,ee),onClick:()=>L(J.id),className:p.cn("group relative inline-flex h-9 shrink-0 items-center gap-1.5 rounded-none bg-transparent px-3 py-0 text-[12px] font-medium text-muted-foreground transition-colors hover:bg-transparent hover:text-foreground data-[state=active]:bg-transparent data-[state=active]:text-foreground data-[state=active]:shadow-none","after:pointer-events-none after:absolute after:inset-x-2 after:-bottom-px after:h-0.5 after:bg-transparent data-[state=active]:after:bg-foreground"),value:J.id,children:[J.kind==="document"&&l.jsx(di,{className:"h-3 w-3 text-muted-foreground"}),l.jsx(cN,{enabled:R&&te,text:J.title,onSave:le=>z(J.id,le),children:J.title},J.id),l.jsx("span",{role:"button",tabIndex:0,"aria-label":ue?"Clear default sheet":"Set as default sheet",title:ue?"Clear default sheet":"Set as default sheet",onClick:le=>{le.stopPropagation(),X(J.id,J.title||"Sheet")},onKeyDown:le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),le.stopPropagation(),X(J.id,J.title||"Sheet"))},className:p.cn("inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-[3px] transition-opacity hover:bg-muted focus:outline-none focus-visible:ring-1 focus-visible:ring-foreground",te||ue?"opacity-100":"opacity-0 group-hover:opacity-100"),children:l.jsx(vW,{className:p.cn("h-3 w-3 transition-colors",ue?"fill-current text-amber-500":"text-muted-foreground")})}),R&&te&&T.length>1&&l.jsx("span",{role:"button",tabIndex:0,"aria-label":"Delete sheet",className:"inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-[3px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-foreground",onClick:le=>{le.stopPropagation(),f(!0)},onKeyDown:le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),le.stopPropagation(),f(!0))},children:l.jsx(je.X,{className:"h-3 w-3"})})]},J.id)}),R&&l.jsxs(zs,{children:[l.jsx(Bs,{asChild:!0,children:l.jsxs("button",{type:"button","aria-label":"Add sheet",className:"ml-1 inline-flex h-9 shrink-0 items-center gap-1 px-3 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[l.jsx(_r,{className:"h-3 w-3"}),"Sheet"]})}),l.jsxs(ks,{align:"start",className:"w-48",children:[l.jsxs(Sn,{onSelect:()=>G("dashboard"),children:[l.jsx(Gf,{className:"h-4 w-4 text-muted-foreground"}),"Dashboard sheet"]}),l.jsxs(Sn,{onSelect:()=>G("document"),children:[l.jsx(di,{className:"h-4 w-4 text-muted-foreground"}),"Document"]})]})]})]})]})})}function ie(){return l.jsx("div",{ref:u,style:{},className:"h-full min-h-0 grow",children:T==null?void 0:T.map(J=>l.jsx(p.TabsContent,{style:{backgroundColor:de(),...I.dashboardCanvasStyle},className:p.cn("mt-0 h-full min-h-0",{}),value:J.id,children:l.jsx(U7,{sheet:J})},J.id))})}function De(){return l.jsxs(p.Tabs,{"data-role":"dashboard-tabs-container",className:p.cn("relative flex h-full flex-col",E==null?void 0:E.dashboardTabsContainer),onValueChange:J=>{L(J)},value:F||void 0,children:[ge(),$==="top"&&!q&&l.jsx(MA,{}),F&&!q&&l.jsx(bvt,{}),q?l.jsx("div",{"data-role":"dashboard-tabs-content",className:"min-h-0 flex-1 grow basis-0 overflow-hidden",children:ie()}):l.jsx(Ea,{"data-role":"dashboard-tabs-content",className:"flex-1 grow basis-0 overflow-y-auto",children:ie()}),$==="bottom"&&!q&&l.jsx(MA,{}),l.jsx(tot,{open:d,setOpen:f})]})}const re=S.useCallback(J=>{w("dashboard",J)},[w]);return T?a&&F&&!q?l.jsxs("div",{"data-document-render-error":"true",className:"bg-white p-8 text-sm text-zinc-700",children:['Requested document sheet "',F,'" was not found or is not a document sheet in the loaded dashboard.']}):a&&q&&A?l.jsx("div",{"data-role":"dashboard-document-print-content",className:"min-h-0 overflow-visible bg-white",children:l.jsx(U7,{sheet:A})}):l.jsxs(l.Fragment,{children:[l.jsx(nvt,{}),l.jsx(ivt,{}),l.jsxs("div",{className:"relative flex-1 basis-0 overflow-hidden",children:[l.jsxs(jce,{className:p.cn("flex-1 basis-0 overflow-y-auto transition-opacity",_&&"pointer-events-none opacity-0"),direction:"horizontal",children:[l.jsx(rR,{children:De()}),r===!0&&l.jsxs(l.Fragment,{children:[l.jsx(Jst,{open:k,onTabClick:H,withHandle:!0,disabled:!k}),l.jsx(rR,{className:"flex grow","data-role":"dashboard-assistant-panel",onResize:ne,defaultSize:k?40:0,ref:c,children:l.jsx("div",{className:"grow overflow-y-auto",children:l.jsx(G0t,{open:k,setOpen:H,isFullscreen:_,onFullscreenChange:J=>x(J?"dashboard":null),fullscreenContainer:N})})})]})]}),l.jsx("div",{ref:re,className:p.cn("absolute inset-0",!_&&"pointer-events-none")}),se&&l.jsx("div",{className:p.cn("absolute z-50 transition-all duration-300 ease-in-out",b().horizontal,b().vertical),style:g(),children:l.jsx(p.Button,{size:"sm",variant:"outline",className:"h-12 w-12 cursor-grab rounded-full border-border bg-background p-0 shadow-lg hover:bg-muted active:cursor-grabbing",onClick:()=>{m.current||H(!0)},onMouseDown:h,onTouchStart:h,title:"Open Assistant (drag to move)",children:l.jsx(kpe,{className:"h-5 w-5"})})})]})]}):null}const Gfe=S.forwardRef(({appearance:e,organizationAppearance:t,tokenAppearance:n,reactAppearance:r,resolvedAppearance:s,children:o,className:i,style:a,...c},u)=>{const d=S.useId(),f=S.useMemo(()=>xvt(d),[d]),{theme:h}=PR(),m=yvt(h),g=S.useMemo(()=>s??kc.resolveAppearance({organizationAppearance:t,tokenAppearance:n,reactAppearance:r??e}),[e,t,r,s,n]),b=S.useMemo(()=>p.compileAppearance({spec:g,systemMode:m}),[g,m]),x=S.useMemo(()=>p.createAppearanceContextValue(f,b),[b,f]);return l.jsx(p.AppearanceContext.Provider,{value:x,children:l.jsx(Ag,{...c,ref:u,className:i,style:a,children:o})})});Gfe.displayName="AppearanceProvider";function xvt(e){return`semaphor-appearance-${e.replace(/[^a-zA-Z0-9_-]/g,"")}`}function yvt(e){const t=z1(e),[n,r]=S.useState(()=>vvt());return S.useEffect(()=>{var i,a;if(t!=="system"||typeof window>"u")return;const s=(i=window.matchMedia)==null?void 0:i.call(window,"(prefers-color-scheme: dark)");if(!s)return;const o=()=>{r(s.matches?"dark":"light")};return o(),typeof s.addEventListener=="function"?(s.addEventListener("change",o),()=>s.removeEventListener("change",o)):((a=s.addListener)==null||a.call(s,o),()=>{var c;return(c=s.removeListener)==null?void 0:c.call(s,o)})},[t]),t==="system"?n:t}function vvt(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}const Yfe=S.createContext({openBrandStudioPreview:()=>{}}),wvt=Yfe.Provider;function Svt(){return S.useContext(Yfe)}function Cvt({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const s=z1(t),[o,i]=S.useState(()=>Nvt(n)||s),a=S.useCallback(u=>{const d=z1(u);kvt(n,d),i(d)},[n]),c=S.useMemo(()=>({theme:o,setTheme:a}),[o,a]);return l.jsx(mq.Provider,{...r,value:c,children:e})}function Nvt(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=z1(t,"system");return n===t?n:null}catch{return null}}function kvt(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}}const _vt=S.lazy(()=>Promise.resolve().then(()=>require("../brand-studio/index.cjs")).then(e=>({default:e.BrandStudioEditor})));function q3({appearance:e,children:t}){var T,D;const{authToken:n,id:r,tokenProps:s}=mt(),o=_0(),i=(T=o.data)==null?void 0:T.organizationAppearance,a=(D=s.config)==null?void 0:D.appearance,[c,u]=S.useState(!1),[d,f]=S.useState(null),[h,m]=S.useState(null),[g,b]=S.useState(null),[x,y]=S.useState(null),w=`${s.apiServiceUrl??""}:${(n==null?void 0:n.accessToken)??""}`,v=An({queryKey:NG({resourceType:Zr.DASHBOARD,apiServiceUrl:s.apiServiceUrl,accessToken:n==null?void 0:n.accessToken}),queryFn:async()=>p.getRequest(`${s.apiServiceUrl}/management/v1/dashboards`,(n==null?void 0:n.accessToken)||""),select:R=>(R==null?void 0:R.organizationAppearance)??null,enabled:!o.dashboardIdToFetch&&i===void 0&&!!(n!=null&&n.accessToken)});S.useEffect(()=>{i!==void 0&&y({scopeKey:w,appearance:i})},[i,w]),S.useEffect(()=>{v.data!==void 0&&y({scopeKey:w,appearance:v.data})},[v.data,w]);const C=(x==null?void 0:x.scopeKey)===w?x.appearance:null,N=i!==void 0?i:v.data!==void 0?v.data:C,k=S.useMemo(()=>kc.resolveAppearance({organizationAppearance:N,tokenAppearance:a,reactAppearance:e}),[e,N,a]),_=S.useCallback(()=>{f(g??h??k),u(!0)},[g,h,k]),j=S.useCallback(()=>{u(!1)},[]);S.useEffect(()=>{f(null),m(null),b(null),u(!1)},[r]);const E=S.useMemo(()=>({openBrandStudioPreview:_}),[_]),I=g??h??e;return l.jsx(Cvt,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(wvt,{value:E,children:l.jsx(Gfe,{organizationAppearance:N,tokenAppearance:a,reactAppearance:I,style:{height:"100%",width:"100%"},children:l.jsxs(p.TooltipProvider,{delayDuration:0,children:[t,c&&l.jsx("aside",{"aria-label":"Brand Studio","aria-modal":"false",role:"dialog",className:"fixed bottom-0 right-0 top-0 z-50 flex w-[min(520px,100vw)] flex-col border-l border-border bg-background text-foreground shadow-sm",children:l.jsx(S.Suspense,{fallback:l.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Loading Brand Studio..."}),children:l.jsx(_vt,{appearance:d,onDraftChange:b,onSave:R=>{m(R),b(R),f(R)},onCancel:j})})})]})})})})}function Kfe({children:e,preferences:t}){const{currentUser:n}=Ki(),r=S.useMemo(()=>{var s,o;return{preferences:t||{},isLocalDev:((s=t==null?void 0:t.uiMode)==null?void 0:s.developer)||!1,isConsoleMode:((o=t==null?void 0:t.uiMode)==null?void 0:o.console)||!1}},[t]);return l.jsx(wG.Provider,{value:r,children:l.jsx(Z_,{displayPreferences:t==null?void 0:t.cardDisplay,currentUser:n,children:e})})}function jvt(e=2e3,t=500){const n=zme(),[r,s]=S.useState(!1),[o,i]=S.useState(!1),a=S.useRef(null);return S.useEffect(()=>{const c=setTimeout(()=>s(!0),e);return()=>clearTimeout(c)},[e]),S.useEffect(()=>{if(r){if(n>0){i(!1),a.current&&(clearTimeout(a.current),a.current=null);return}return a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{i(!0)},t),()=>{a.current&&clearTimeout(a.current)}}},[r,n,t]),o}function W3({delayMs:e=2e3,quietMs:t=500,componentType:n,componentId:r}){const s=jvt(e,t);return S.useEffect(()=>(s&&(window.__SEMAPHOR_READY__={ready:!0,type:n,componentId:r||null,timestamp:Date.now()}),()=>{window.__SEMAPHOR_READY__={ready:!1,type:n,componentId:r||null,timestamp:Date.now()}}),[s,n,r]),l.jsx("div",{id:"idle-check","aria-hidden":"true",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},children:s?"ready":""})}function Zfe(e){if(typeof window>"u")return null;const{preferences:t}=e;return l.jsx(ka,{FallbackComponent:Y_,children:l.jsxs(BR,{dashboardProps:e,children:[l.jsx(W3,{componentType:"dashboard",componentId:e.id}),l.jsx(q3,{appearance:e.appearance,children:l.jsx(Kfe,{preferences:t,children:l.jsx("main",{className:"flex h-full flex-col",children:l.jsx(xP,{...e,type:"dashboard",children:l.jsx(Wfe,{})})})})})]})})}function Ivt(e=[]){const t=S.useRef(null),n=S.useRef(null),r=S.useRef(null),[s,o]=S.useState(),i=S.useCallback(()=>{var m,g,b;const a=((m=t.current)==null?void 0:m.clientWidth)??0,c=((g=r.current)==null?void 0:g.offsetWidth)??0,u=((b=n.current)==null?void 0:b.offsetWidth)??0,f=a-c-u-8,h=Math.max(f,0);o(x=>x===h?x:h)},[]);return S.useEffect(()=>{const a=t.current;if(!a||typeof ResizeObserver>"u")return;const c=new ResizeObserver(()=>i());return c.observe(a),i(),()=>c.disconnect()},[i,...e]),{headerRef:t,leftActionsRef:n,rightActionsRef:r,titleMaxWidth:s,updateAvailableWidth:i}}function Evt({filter:e}){var g;const t=p.useDashboardStore(b=>b.isDashboardEditing),{preferences:n}=Yp(),r=Dh((g=n==null?void 0:n.cardDisplay)==null?void 0:g.mode),s=p.useDashboardStore(b=>b.filterValues),o=s==null?void 0:s.some(b=>b.filterId===e.id),{removeFilterValues:i,removeFilter:a,updateFilter:c}=p.useDashboardActions(),{headerRef:u,leftActionsRef:d,rightActionsRef:f,titleMaxWidth:h,updateAvailableWidth:m}=Ivt([t,o,r]);return S.useEffect(()=>{m()},[e.title,m]),l.jsxs("div",{ref:u,className:"group mb-1 flex h-5 items-center justify-between",children:[l.jsxs("div",{className:"flex grow items-center gap-2 min-w-0",children:[l.jsx("div",{className:"min-w-0 flex-1",style:h!==void 0?{maxWidth:h}:void 0,children:l.jsx(p.Label,{className:"my-1 block w-full text-sm",children:l.jsx(Ho,{value:e.title||e.column,onSave:b=>c({...e,title:b}),isEditable:t,placeholder:"Filter",displayClassName:"text-sm truncate",inputClassName:"text-sm"})})}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",ref:d,children:[t&&l.jsx(B5,{filter:e,isEditing:t}),t&&l.jsx("button",{onClick:()=>{i(e.id),a(e.id)},className:"text-muted-foreground hover:text-foreground",children:l.jsx(je.X,{className:"size-3.5"})})]})]}),l.jsx("div",{className:"hidden",ref:f})]})}function Tvt(){const e=p.useDashboardStore(r=>r.dashboard.filters),t=p.useDashboardStore(r=>r.theme),n=e==null?void 0:e.filter(r=>r.hide);return n!=null&&n.length?l.jsx("div",{className:p.cn("mb-1 flex items-center gap-2 border-y px-0.5 pb-0.5",{"bg-[repeating-linear-gradient(45deg,_#ffffff_0_3px,_#f3f3f3_3px_6px)]":t==="light","bg-[repeating-linear-gradient(45deg,_#18171d_0_3px,_#272729_3px_6px)]":t==="dark"}),children:n==null?void 0:n.map(r=>l.jsxs("div",{className:"flex min-w-[250px] max-w-fit flex-col gap-1 p-2",children:[l.jsx(Evt,{filter:r}),l.jsx(B_,{filter:r})]},r.id))}):null}function Dvt(){var i;const e=p.useDashboardStore(a=>a.dashboard),t=p.useDashboardStore(a=>a.selectedSheetId),n=p.useDashboardStore(a=>a.isVisualEditing),r=p.useDashboardStore(a=>a.isDashboardEditing),s=(i=e.sheets)==null?void 0:i.find(a=>a.id===t),o=p.isDocumentSheet(s);return l.jsx("div",{role:"dashboard-plus-main",className:p.cn("",{"max-h-0 overflow-hidden":n,"flex min-h-0 grow basis-0 overflow-hidden":!n}),children:l.jsxs("section",{className:"flex min-h-0 grow basis-0 flex-col overflow-hidden",children:[r&&!o&&l.jsx(Tvt,{}),l.jsx(Wfe,{})]})})}const Mvt=S.lazy(()=>Promise.resolve().then(()=>require("./dashboard-controls-v7jslCXR.js"))),Avt=S.lazy(()=>Promise.resolve().then(()=>require("./edit-dashboard-visual-qdruQruO.js"))),Rvt=S.lazy(()=>Promise.resolve().then(()=>require("./dashboard-json-L1Qo5xcX.js")));function Pvt({showControls:e=!1,showFooter:t=!0,...n}){const r=p.useDashboardStore(a=>a.isVisualEditing),s=p.useDashboardStore(a=>a.showDashboardJSON),{appearance:o,preferences:i}=n;return l.jsx(ka,{FallbackComponent:Y_,children:l.jsxs(BR,{dashboardProps:n,children:[l.jsx(W3,{componentType:"surfboard",componentId:n.id}),l.jsxs(q3,{appearance:o,children:[l.jsx(Dbe,{toastOptions:{classNames:{toast:"max-w-[calc(100vw-2rem)] overflow-x-hidden !items-start [--toast-close-button-end:0.5rem] [--toast-close-button-start:auto] [--toast-close-button-transform:translate(0,0)] sm:max-w-[44rem]",content:"min-w-0 flex-1",icon:"mt-0.5 shrink-0",title:"max-w-full break-words pr-8",description:"max-w-full break-words",closeButton:"!top-2 h-6 w-6 rounded-md border-border bg-background text-muted-foreground hover:bg-muted hover:text-foreground"}}}),l.jsxs(Kfe,{preferences:i,children:[s&&l.jsx(S.Suspense,{fallback:null,children:l.jsx(Rvt,{})}),l.jsxs("main",{className:"relative flex h-full w-full flex-col overflow-hidden",children:[e&&l.jsx(S.Suspense,{fallback:null,children:l.jsx(Mvt,{})}),l.jsx("div",{className:"flex grow overflow-hidden",children:l.jsx("div",{className:"flex min-w-0 flex-1",children:l.jsxs(xP,{...n,type:"dashboard",children:[r&&l.jsx(S.Suspense,{fallback:null,children:l.jsx(Avt,{})}),l.jsx(Dvt,{})]})})})]})]})]})]})})}var Fvt=Object.defineProperty,Ovt=(e,t,n)=>t in e?Fvt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qS=(e,t,n)=>Ovt(e,typeof t!="symbol"?t+"":t,n);const Lvt={stringify:e=>e?"true":"false",parse:e=>/^[ty1-9]/i.test(e)},$vt={stringify:e=>e.name,parse:(e,t,n)=>{const r=(()=>{if(typeof window<"u"&&e in window)return window[e];if(typeof global<"u"&&e in global)return global[e]})();return typeof r=="function"?r.bind(n):void 0}},zvt={stringify:e=>JSON.stringify(e),parse:e=>JSON.parse(e)};function Bvt(e){return e.replace(/([a-z0-9])([A-Z])/g,(t,n,r)=>`${n}-${r.toLowerCase()}`)}function Xfe(e){return e.replace(/[-:]([a-z])/g,(t,n)=>`${n.toUpperCase()}`)}const Vvt={stringify:e=>e.name,parse:(e,t,n)=>{const r=(()=>{const s=Xfe(t);if(typeof n<"u"&&s in n.container)return n.container[s]})();return typeof r=="function"?r.bind(n):void 0}},Hvt={stringify:e=>`${e}`,parse:e=>parseFloat(e)},Uvt={stringify:e=>e,parse:e=>e},OD={string:Uvt,number:Hvt,boolean:Lvt,function:$vt,method:Vvt,json:zvt},Bb=Symbol.for("r2wc.render"),WS=Symbol.for("r2wc.connected"),Od=Symbol.for("r2wc.context"),Qo=Symbol.for("r2wc.props");function qvt(e,t,n){var r,s,o;t.props||(t.props=e.propTypes?Object.keys(e.propTypes):[]),t.events||(t.events=[]);const i=Array.isArray(t.props)?t.props.slice():Object.keys(t.props),a=Array.isArray(t.events)?t.events.slice():Object.keys(t.events),c={},u={},d={},f={};for(const m of i){c[m]=Array.isArray(t.props)?"string":t.props[m];const g=Bvt(m);d[m]=g,f[g]=m}for(const m of a)u[m]=Array.isArray(t.events)?{}:t.events[m];class h extends HTMLElement{constructor(){super(),qS(this,o,!0),qS(this,s),qS(this,r,{}),qS(this,"container"),t.shadow?this.container=this.attachShadow({mode:t.shadow}):this.container=this,this[Qo].container=this.container;for(const g of i){const b=d[g],x=this.getAttribute(b),y=c[g],w=y?OD[y]:null;if(y==="method"){const v=Xfe(b);Object.defineProperty(this[Qo].container,v,{enumerable:!0,configurable:!0,get(){return this[Qo][v]},set(C){this[Qo][v]=C,this[Bb]()}}),this[Qo][g]=w.parse(x,b,this)}w!=null&&w.parse&&x&&(this[Qo][g]=w.parse(x,b,this))}for(const g of a)this[Qo][g]=b=>{const x=g.replace(/^on/,"").toLowerCase();this.dispatchEvent(new CustomEvent(x,{detail:b,...u[g]}))}}static get observedAttributes(){return Object.keys(f)}connectedCallback(){this[WS]=!0,this[Bb]()}disconnectedCallback(){this[WS]=!1,this[Od]&&n.unmount(this[Od]),delete this[Od]}attributeChangedCallback(g,b,x){const y=f[g],w=c[y],v=w?OD[w]:null;y in c&&v!=null&&v.parse&&x&&(this[Qo][y]=v.parse(x,g,this),this[Bb]())}[(o=WS,s=Od,r=Qo,Bb)](){this[WS]&&(this[Od]?n.update(this[Od],this[Qo]):this[Od]=n.mount(this.container,e,this[Qo]))}}for(const m of i){const g=d[m],b=c[m];Object.defineProperty(h.prototype,m,{enumerable:!0,configurable:!0,get(){return this[Qo][m]},set(x){this[Qo][m]=x;const y=b?OD[b]:null;if(y!=null&&y.stringify){const w=y.stringify(x,g,this);this.getAttribute(g)!==w&&this.setAttribute(g,w)}else this[Bb]()}})}return h}function Wvt(e,t,n){const r=Nhe.createRoot(e),s=S.createElement(t,n);return r.render(s),{root:r,ReactComponent:t}}function Gvt({root:e,ReactComponent:t},n){const r=S.createElement(t,n);e.render(r)}function Yvt({root:e}){e.unmount()}function Kvt(e,t={}){return qvt(e,t,{mount:Wvt,update:Gvt,unmount:Yvt})}const Zvt={id:"string",version:"string",authToken:"json",placeholders:"json",defaultFilterValues:"json",defaultControlValues:"json",controlContractOverrides:"json",documentInputValues:"json",dashboardInputExecutionSnapshot:"json",renderMode:"string",currentTheme:"string",customCards:"json",customStyle:"json",appearance:"json",onChartElementClicked:"function",onFilterValuesChange:"function",onEvent:"function",onSave:"function",LoadingComponent:"function",ErrorComponent:"function",showAssistant:"boolean",showBriefings:"boolean",selectedSheetId:"string",eventHandlers:"json",preferences:"json"},Xvt=Kvt(Zfe,{props:Zvt}),Qvt=S.memo(function({context:t="editor"}={}){return l.jsxs("div",{"data-content":"fields-section",className:"flex h-full grow flex-col items-center overflow-hidden",children:[" ",l.jsx(BL,{context:t})," "]})}),Qfe=new Set(["askForMoreInfo","getAvailableChartTypes","getChartSQLSyntax","getDomainRelationships","getTableColumns","getUserSql","validateCardConfigFormat"]),Jvt=new Set(["createChartFromSql","createForecast","generateQueryConfig","getChartDataFromCardConfig","getChartDataFromSqlAndPython","getForecastDataFromSqlAndPython"]),ewt=Array.from(Qfe).join(", "),twt=3,nwt="Self-heal",rwt=new Set(["SQL_PARSE_ERROR","SQL_EXPLAIN_ERROR"]);function swt({card:e}){var W,O,Z,Y,M;const[t,n]=S.useState({}),{authToken:r}=mt(),s=p.getTokenParams(r==null?void 0:r.accessToken),{compiledAppearance:o}=p.useAppearance(),i=S.useMemo(()=>Cv(o),[o]),a=p.useEditorStore(K=>K.frame),c=p.useEditorStore(K=>K.inlineFilterValuesMap[e.id]),u=p.useEditorStore(K=>K.actions.setCardInlineFilterValue),d=p.useEditorStore(K=>K.actions.removeCardInlineFilterValue),f=e,{getCard:h,manifest:m}=$h(((W=f.customCardPreferences)==null?void 0:W.url)||""),g=(O=m==null?void 0:m.visuals)==null?void 0:O.find(K=>{var L;return K.name===((L=f.customCardPreferences)==null?void 0:L.componentName)}),b=Nv(f,g)??"single",x=S.useMemo(()=>W5({frame:a,configCard:f,isMultiInputVisual:b==="multiple"}),[a,f,b]),y=S.useMemo(()=>{const K=x.findIndex(L=>(L==null?void 0:L.id)===e.id);return K<0?-1:qy(e,K)},[x,e]),w=S.useMemo(()=>b!=="multiple"||y<0?e.type:Ym(e,y,g==null?void 0:g.slots)??e.type,[b,y,e,g==null?void 0:g.slots]),v=S.useMemo(()=>b==="multiple"?{...e,connectionId:void 0,dataSource:void 0,sql:"",python:"",config:void 0,queryConfig:void 0}:w!==e.type?{...e,type:w}:e,[e,w,b]),{data:C}=Dk(v),N=p.useInteractionStore(K=>K.interactionStates),k=p.useDashboardStore(K=>{var L;return(L=K.dashboard)==null?void 0:L.id}),_=p.useDashboardStore(K=>K.dashboard.filters),j=p.useDashboardStore(K=>K.filterValues),E=p.useDashboardStore(K=>K.selectedSheetId),I=S.useMemo(()=>H5({card:e,sheetId:E||"",inlineFilterValues:c,setInlineFilterValue:K=>u(e.id,K),removeInlineFilterValue:K=>d(e.id,K)}),[e,E,c,u,d]),{cardFilters:T,cardFilterValues:D}=S.useMemo(()=>z0({card:e,interactionStates:N,currentDashboardId:k,filters:_,filterValues:j,selectedSheetId:E}),[e,N,k,_,j,E]),R=S.useCallback((K,L)=>{const z=Y5(L);n(B=>({...B,[K]:z}))},[]),F=(Z=f.customCardPreferences)==null?void 0:Z.componentName,A=F?h(F):null,U=aN((Y=f.customCardPreferences)==null?void 0:Y.settings,f),$=S.useMemo(()=>q5(x),[x]),q=S.useMemo(()=>$.map((K,L)=>Ym(K,L,g==null?void 0:g.slots)),[$,g==null?void 0:g.slots]);return F?l.jsx("div",{className:"semaphor-custom mb-3 flex grow basis-0 flex-col space-y-2 overflow-y-auto",children:l.jsxs(S.Suspense,{fallback:l.jsx(l.Fragment,{}),children:[A&&b==="single"&&l.jsx(A,{editing:!0,params:s,theme:i,settings:U,cardMetadata:Aoe({card:e,dataMetadata:C==null?void 0:C.metadata}),onDataChange:R,data:(C==null?void 0:C.records)||[],filters:T,filterValues:[...D||[],...c||[]],inlineFilters:I}),A&&b==="multiple"&&l.jsxs(l.Fragment,{children:[x.map((K,L)=>{if(!K)return null;const z=qy(K,L),B=Ym(K,z,g==null?void 0:g.slots);return l.jsx(p5,{onDataChange:R,card:K,effectiveCardType:B},`${K.id}-${z}`)}),l.jsx("div",{className:"flex flex-col gap-2",children:l.jsx(A,{editing:!0,onDataChange:R,...K5({configCard:f,slotOrderedCards:$,slotTypes:q,multiInputData:t,params:s,theme:i,chartSettings:U,filters:T,filterValues:[...D||[],...c||[]],inlineFilters:I})})})]})]},(M=f.customCardPreferences)==null?void 0:M.componentName)}):null}const owt=S.memo(swt,(e,t)=>{var n,r,s,o,i,a,c,u;return e.card.id===t.card.id&&e.card.inlineFilters===t.card.inlineFilters&&((n=e.card.customCardPreferences)==null?void 0:n.settings)===((r=t.card.customCardPreferences)==null?void 0:r.settings)&&((s=e.card.customCardPreferences)==null?void 0:s.slotSettings)===((o=t.card.customCardPreferences)==null?void 0:o.slotSettings)&&((i=e.card.customCardPreferences)==null?void 0:i.url)===((a=t.card.customCardPreferences)==null?void 0:a.url)&&((c=e.card.customCardPreferences)==null?void 0:c.componentName)===((u=t.card.customCardPreferences)==null?void 0:u.componentName)}),iwt=p.create()(p.persist((e,t)=>({starredCharts:[],isStarred:(n,r)=>t().starredCharts.some(s=>s.type===n&&s.id===r),toggleStar:n=>{e(r=>{const s=r.starredCharts.findIndex(o=>o.type===n.type&&o.id===n.id);return s>=0?{starredCharts:r.starredCharts.filter((o,i)=>i!==s)}:{starredCharts:[...r.starredCharts,n]}})},getStarredChart:(n,r)=>t().starredCharts.find(s=>s.type===n&&s.id===r)}),{name:"semaphor-starred-charts"}));var Jfe=["PageUp","PageDown"],ehe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],the={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Gg="Slider",[TR,awt,lwt]=p.createCollection(Gg),[nhe]=p.createContextScope(Gg,[lwt]),[cwt,Uj]=nhe(Gg),rhe=Q.forwardRef((e,t)=>{const{name:n,min:r=0,max:s=100,step:o=1,orientation:i="horizontal",disabled:a=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:m=!1,form:g,...b}=e,x=Q.useRef(new Set),y=Q.useRef(0),v=i==="horizontal"?uwt:dwt,[C=[],N]=p.useControllableState({prop:d,defaultProp:u,onChange:T=>{var R;(R=[...x.current][y.current])==null||R.focus(),f(T)}}),k=Q.useRef(C);function _(T){const D=gwt(C,T);I(T,D)}function j(T){I(T,y.current)}function E(){const T=k.current[y.current];C[y.current]!==T&&h(C)}function I(T,D,{commit:R}={commit:!1}){const F=vwt(o),A=wwt(Math.round((T-r)/o)*o+r,F),U=p.clamp(A,[r,s]);N(($=[])=>{const q=mwt($,U,D);if(ywt(q,c*o)){y.current=q.indexOf(U);const W=String(q)!==String($);return W&&R&&h(q),W?q:$}else return $})}return l.jsx(cwt,{scope:e.__scopeSlider,name:n,disabled:a,min:r,max:s,valueIndexToChangeRef:y,thumbs:x.current,values:C,orientation:i,form:g,children:l.jsx(TR.Provider,{scope:e.__scopeSlider,children:l.jsx(TR.Slot,{scope:e.__scopeSlider,children:l.jsx(v,{"aria-disabled":a,"data-disabled":a?"":void 0,...b,ref:t,onPointerDown:p.composeEventHandlers(b.onPointerDown,()=>{a||(k.current=C)}),min:r,max:s,inverted:m,onSlideStart:a?void 0:_,onSlideMove:a?void 0:j,onSlideEnd:a?void 0:E,onHomeKeyDown:()=>!a&&I(r,0,{commit:!0}),onEndKeyDown:()=>!a&&I(s,C.length-1,{commit:!0}),onStepKeyDown:({event:T,direction:D})=>{if(!a){const A=Jfe.includes(T.key)||T.shiftKey&&ehe.includes(T.key)?10:1,U=y.current,$=C[U],q=o*A*D;I($+q,U,{commit:!0})}}})})})})});rhe.displayName=Gg;var[she,ohe]=nhe(Gg,{startEdge:"left",endEdge:"right",size:"width",direction:1}),uwt=Q.forwardRef((e,t)=>{const{min:n,max:r,dir:s,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:c,onStepKeyDown:u,...d}=e,[f,h]=Q.useState(null),m=p.useComposedRefs(t,v=>h(v)),g=Q.useRef(void 0),b=p.useDirection(s),x=b==="ltr",y=x&&!o||!x&&o;function w(v){const C=g.current||f.getBoundingClientRect(),N=[0,C.width],_=G3(N,y?[n,r]:[r,n]);return g.current=C,_(v-C.left)}return l.jsx(she,{scope:e.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:l.jsx(ihe,{dir:b,"data-orientation":"horizontal",...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:v=>{const C=w(v.clientX);i==null||i(C)},onSlideMove:v=>{const C=w(v.clientX);a==null||a(C)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:v=>{const N=the[y?"from-left":"from-right"].includes(v.key);u==null||u({event:v,direction:N?-1:1})}})})}),dwt=Q.forwardRef((e,t)=>{const{min:n,max:r,inverted:s,onSlideStart:o,onSlideMove:i,onSlideEnd:a,onStepKeyDown:c,...u}=e,d=Q.useRef(null),f=p.useComposedRefs(t,d),h=Q.useRef(void 0),m=!s;function g(b){const x=h.current||d.current.getBoundingClientRect(),y=[0,x.height],v=G3(y,m?[r,n]:[n,r]);return h.current=x,v(b-x.top)}return l.jsx(she,{scope:e.__scopeSlider,startEdge:m?"bottom":"top",endEdge:m?"top":"bottom",size:"height",direction:m?1:-1,children:l.jsx(ihe,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:b=>{const x=g(b.clientY);o==null||o(x)},onSlideMove:b=>{const x=g(b.clientY);i==null||i(x)},onSlideEnd:()=>{h.current=void 0,a==null||a()},onStepKeyDown:b=>{const y=the[m?"from-bottom":"from-top"].includes(b.key);c==null||c({event:b,direction:y?-1:1})}})})}),ihe=Q.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:o,onHomeKeyDown:i,onEndKeyDown:a,onStepKeyDown:c,...u}=e,d=Uj(Gg,n);return l.jsx(p.Primitive.span,{...u,ref:t,onKeyDown:p.composeEventHandlers(e.onKeyDown,f=>{f.key==="Home"?(i(f),f.preventDefault()):f.key==="End"?(a(f),f.preventDefault()):Jfe.concat(ehe).includes(f.key)&&(c(f),f.preventDefault())}),onPointerDown:p.composeEventHandlers(e.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:p.composeEventHandlers(e.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&s(f)}),onPointerUp:p.composeEventHandlers(e.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),o(f))})})}),ahe="SliderTrack",lhe=Q.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=Uj(ahe,n);return l.jsx(p.Primitive.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:t})});lhe.displayName=ahe;var DR="SliderRange",che=Q.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=Uj(DR,n),o=ohe(DR,n),i=Q.useRef(null),a=p.useComposedRefs(t,i),c=s.values.length,u=s.values.map(h=>fhe(h,s.min,s.max)),d=c>1?Math.min(...u):0,f=100-Math.max(...u);return l.jsx(p.Primitive.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:a,style:{...e.style,[o.startEdge]:d+"%",[o.endEdge]:f+"%"}})});che.displayName=DR;var MR="SliderThumb",uhe=Q.forwardRef((e,t)=>{const n=awt(e.__scopeSlider),[r,s]=Q.useState(null),o=p.useComposedRefs(t,a=>s(a)),i=Q.useMemo(()=>r?n().findIndex(a=>a.ref.current===r):-1,[n,r]);return l.jsx(fwt,{...e,ref:o,index:i})}),fwt=Q.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:s,...o}=e,i=Uj(MR,n),a=ohe(MR,n),[c,u]=Q.useState(null),d=p.useComposedRefs(t,w=>u(w)),f=c?i.form||!!c.closest("form"):!0,h=p.useSize(c),m=i.values[r],g=m===void 0?0:fhe(m,i.min,i.max),b=pwt(r,i.values.length),x=h==null?void 0:h[a.size],y=x?bwt(x,g,a.direction):0;return Q.useEffect(()=>{if(c)return i.thumbs.add(c),()=>{i.thumbs.delete(c)}},[c,i.thumbs]),l.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${g}% + ${y}px)`},children:[l.jsx(TR.ItemSlot,{scope:e.__scopeSlider,children:l.jsx(p.Primitive.span,{role:"slider","aria-label":e["aria-label"]||b,"aria-valuemin":i.min,"aria-valuenow":m,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...o,ref:d,style:m===void 0?{display:"none"}:e.style,onFocus:p.composeEventHandlers(e.onFocus,()=>{i.valueIndexToChangeRef.current=r})})}),f&&l.jsx(dhe,{name:s??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:m},r)]})});uhe.displayName=MR;var hwt="RadioBubbleInput",dhe=Q.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const s=Q.useRef(null),o=p.useComposedRefs(s,r),i=p.usePrevious(t);return Q.useEffect(()=>{const a=s.current;if(!a)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const f=new Event("input",{bubbles:!0});d.call(a,t),a.dispatchEvent(f)}},[i,t]),l.jsx(p.Primitive.input,{style:{display:"none"},...n,ref:o,defaultValue:t})});dhe.displayName=hwt;function mwt(e=[],t,n){const r=[...e];return r[n]=t,r.sort((s,o)=>s-o)}function fhe(e,t,n){const o=100/(n-t)*(e-t);return p.clamp(o,[0,100])}function pwt(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function gwt(e,t){if(e.length===1)return 0;const n=e.map(s=>Math.abs(s-t)),r=Math.min(...n);return n.indexOf(r)}function bwt(e,t,n){const r=e/2,o=G3([0,50],[0,r]);return(r-o(t)*n)*n}function xwt(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function ywt(e,t){if(t>0){const n=xwt(e);return Math.min(...n)>=t}return!0}function G3(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function vwt(e){return(String(e).split(".")[1]||"").length}function wwt(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var hhe=rhe,Swt=lhe,Cwt=che,Nwt=uhe;const mhe=Q.forwardRef(({className:e,...t},n)=>l.jsxs(hhe,{ref:n,className:p.cn("relative flex w-full touch-none select-none items-center",e),...t,children:[l.jsx(Swt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:l.jsx(Cwt,{className:"absolute h-full bg-primary"})}),l.jsx(Nwt,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background 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"})]}));mhe.displayName=hhe.displayName;const phe=["SUN","MON","TUE","WED","THU","FRI","SAT"],kwt=phe.reduce((e,t,n)=>({...e,[t]:n}),{}),Ll={repeats:"weekly",hour:9,minute:0,weekdays:[1,2,3,4,5],isCustom:!1};function _wt(e){if(!e||!e.trim())return{...Ll};const t=e.trim(),r=(t.startsWith("cron(")&&t.endsWith(")")?t.slice(5,-1):t).trim().split(/\s+/);if(r.length<5||r.length>6)return{...Ll,isCustom:!0};const[s,o,i,a,c]=r,u=Number(s),d=Number(o);if(!Number.isInteger(u)||u<0||u>59||!Number.isInteger(d)||d<0||d>23)return{...Ll,isCustom:!0};if(i==="*"&&(c==="?"||c==="*"))return{...Ll,repeats:"daily",hour:d,minute:u};if(i==="?"&&c!=="?"&&c!=="*"){const h=c.split(",").map(m=>m.toUpperCase()).map(m=>kwt[m]).filter(m=>typeof m=="number");if(h.length>0)return{...Ll,repeats:"weekly",hour:d,minute:u,weekdays:h}}return i==="1,15"&&(c==="?"||c==="*")?{...Ll,repeats:"biweekly",hour:d,minute:u}:i==="1"&&(c==="?"||c==="*")?{...Ll,repeats:"monthly",hour:d,minute:u}:{...Ll,hour:d,minute:u,isCustom:!0}}function jwt(e){const t=e.minute,n=e.hour;switch(e.repeats){case"daily":return`cron(${t} ${n} * * ? *)`;case"weekly":{const r=e.weekdays.length>0?e.weekdays.slice().sort((s,o)=>s-o).map(s=>phe[s]).join(","):"MON";return`cron(${t} ${n} ? * ${r} *)`}case"biweekly":return`cron(${t} ${n} 1,15 * ? *)`;case"monthly":return`cron(${t} ${n} 1 * ? *)`}}function ghe(e,t){const n=e<12?"AM":"PM",r=e%12===0?12:e%12,s=t.toString().padStart(2,"0");return`${r}:${s} ${n}`}function Iwt(e){return!e||e==="UTC"?"UTC":(e.split("/").pop()??e).replace(/_/g," ")}function Ewt(e){if(e.length===7)return"every day";const t=e.slice().sort((s,o)=>s-o);if(t.length===5&&t.every(s=>s>=1&&s<=5))return"weekdays";const r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return t.map(s=>r[s]).join(", ")}function Twt(e,t,n,r){const s=ghe(e.hour,e.minute),o=Iwt(t);let i;if(e.isCustom)i=`Custom schedule · ${s} ${o}`;else switch(e.repeats){case"daily":i=`Daily at ${s} ${o}`;break;case"weekly":i=`Weekly · ${Ewt(e.weekdays)} at ${s} ${o}`;break;case"biweekly":i=`Every two weeks (1st and 15th) at ${s} ${o}`;break;case"monthly":i=`Monthly on the 1st at ${s} ${o}`;break}const a=[];return n&&n!=="Today"&&a.push(`from ${n}`),r&&a.push(`until ${r}`),a.length>0?`${i}, ${a.join(" ")}`:i}const Dwt=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Singapore","Asia/Tokyo","Australia/Sydney"];exports.Accordion=AL;exports.AccordionContent=r0;exports.AccordionItem=t0;exports.AccordionTrigger=n0;exports.AddDataPicker=w3;exports.AggregateTable=g_;exports.Alert=dF;exports.AlertDescription=fF;exports.AlertDialog=kh;exports.AlertDialogAction=ad;exports.AlertDialogCancel=ld;exports.AlertDialogContent=nd;exports.AlertDialogDescription=id;exports.AlertDialogFooter=sd;exports.AlertDialogHeader=rd;exports.AlertDialogTitle=od;exports.AlertDialogTrigger=Xxe;exports.AlertTitle=BZ;exports.ArrowDown=gs;exports.ArrowDownIcon=Eqe;exports.ArrowLeft=I0;exports.ArrowRight=ZN;exports.ArrowUp=As;exports.ArrowUpIcon=Dqe;exports.AssistantContextEntityControls=pR;exports.AssistantVirtualizedMessages=Vfe;exports.AtSign=Bq;exports.AxisConfigurator=rg;exports.Badge=cs;exports.Bell=KS;exports.BookType=Hq;exports.BulletChartIcon=Rfe;exports.COMMON_TIMEZONES=Dwt;exports.CSS=bi;exports.CalculatedFieldEditor=qae;exports.Calculator=qq;exports.Calendar=ii;exports.Calendar$1=S1;exports.CalendarRange=Wq;exports.Card=ry;exports.CardContent=WR;exports.CardHeader=qR;exports.CardSummary=$A;exports.CardTitle=Gp;exports.ChartArea=a2;exports.ChartColumnIncreasing=Gq;exports.ChartColumnStacked=Yq;exports.ChartJsVisual=pv;exports.ChartLine=Kq;exports.ChartNoAxesGantt=Xq;exports.ChartPie=Qq;exports.ChartScatter=Jq;exports.ChatInputWithContext=S3;exports.Checkbox=Rn;exports.ChevronLeft=wh;exports.ChevronsUpDown=nW;exports.Circle=GR;exports.CircleAlert=qf;exports.CircleCheck=rW;exports.CircleHelp=sW;exports.Clock=YR;exports.CodeHighlighter=Vf;exports.CodeXml=ZS;exports.Collapsible=Sc;exports.CollapsibleContent=Nc;exports.CollapsibleTrigger=Cc;exports.ColorField=Ai;exports.Command=aj;exports.CommandEmpty=cj;exports.CommandGroup=uj;exports.CommandInput=wL;exports.CommandItem=dj;exports.CommandList=lj;exports.CommandSeparator=dae;exports.ComparisonMetadataBadge=fee;exports.Container=xP;exports.ControlDefaultValueEditor=hle;exports.ControlDefinitionOptionsEditor=fle;exports.ControlIdInput=lle;exports.ControlVisibilitySettings=Vet;exports.Copy=Tu;exports.CopyButton=Iu;exports.CopyPlus=c2;exports.Cross2Icon=Pqe;exports.CustomFilterPopover=B5;exports.CustomScrollArea=Ea;exports.DEFAULT_HEATMAP_CUSTOM_RANGE=mJ;exports.DEFAULT_SCHEDULE_VM=Ll;exports.Dashboard=Zfe;exports.DashboardCard=bie;exports.DashboardCreateDialogBase=XG;exports.DashboardExportDialog=Hfe;exports.DashboardPlus=Pvt;exports.DashboardWC=Xvt;exports.DataTableConditionalFormattingSettings=tce;exports.DataTablePagination=o_;exports.Database=zi;exports.DateRangePicker=w5;exports.DefaultChatTransport=h3;exports.Dialog=_o;exports.DialogContent=ao;exports.DialogDescription=Go;exports.DialogFooter=Ic;exports.DialogHeader=Zi;exports.DialogTitle=lo;exports.DialogTrigger=YG;exports.DisplayPreferencesProvider=Z_;exports.DndContext=Pv;exports.Donut=oW;exports.Download=_c;exports.DownloadPdf=Ufe;exports.DragOverlay=Xie;exports.DropdownMenu=zs;exports.DropdownMenuCheckboxItem=Kc;exports.DropdownMenuContent=ks;exports.DropdownMenuItem=Sn;exports.DropdownMenuLabel=da;exports.DropdownMenuRadioGroup=sbe;exports.DropdownMenuRadioItem=vG;exports.DropdownMenuSeparator=Ui;exports.DropdownMenuSub=cP;exports.DropdownMenuSubContent=sk;exports.DropdownMenuSubTrigger=rk;exports.DropdownMenuTrigger=Bs;exports.EMPTY_DATA_SOURCE=Up;exports.Editable=cN;exports.EditableText=Ho;exports.EditorCustomVisual=owt;exports.Ellipsis=ui;exports.EllipsisVertical=Sh;exports.ErrorBoundary=ka;exports.ExportError=ug;exports.ExternalLink=hp;exports.EyeOff=XN;exports.Fallback=Y_;exports.FallbackVisual=Gy;exports.FeedbackCategory=ed;exports.FeedbackDialog=g0;exports.FieldsList=BL;exports.FieldsSection=Qvt;exports.FileCode=iW;exports.FileSpreadsheet=aW;exports.FileText=di;exports.Filter=Wf;exports.FilterComponent=B_;exports.FilterInfo=PA;exports.FilterableFieldsPanel=Gae;exports.Globe=Ch;exports.Grid3x3=u2;exports.GripVertical=jc;exports.HEATMAP_PRESET_PALETTES=gM;exports.Hash=lW;exports.House=cW;exports.HoverCard=dg;exports.HoverCardContent=Bu;exports.HoverCardTrigger=fg;exports.INLINE_ALLOWED_READ_ONLY_TOOLS=Qfe;exports.INLINE_ALLOWED_TOOL_LIST=ewt;exports.INLINE_BLOCKED_MUTATING_TOOLS=Jvt;exports.IconButton=cc;exports.IconForFieldType=E1;exports.InfoHover=cL;exports.InlineFilterBar=aie;exports.KPICard=Yu;exports.KeyboardSensor=Av;exports.Layers=E0;exports.LayoutDashboard=Gf;exports.Link=KR;exports.LoadingDots=Hu;exports.Lock=QN;exports.MAX_SELF_HEAL_ATTEMPTS=twt;exports.Map=fW;exports.Markdown=Zde;exports.MatrixTableVisual=p_;exports.MdStackedLineChart=Mfe;exports.MultiInputEmptyRenderer=p5;exports.PYTHON_DEFAULT_CODE=RR;exports.PanelResizeHandle=Ij;exports.Paperclip=hW;exports.PenLine=d2;exports.Pencil=f2;exports.PendingMessagesDisplay=dde;exports.PersistedDynamicVisual=K_;exports.PiChartPolar=Ife;exports.Pin=pW;exports.PinOff=mW;exports.PivotTableTanstack=Mg;exports.Placeholders=Ice;exports.Play=gW;exports.Plus=_r;exports.PointerSensor=Lg;exports.Progress=y3;exports.RECOVERABLE_SQL_ERROR_CODES=rwt;exports.Radar=bW;exports.RadioGroup=Sa;exports.RadioGroupItem=Ss;exports.RefreshCw=Yf;exports.ResizableHandle=Qst;exports.ResizablePanel=rR;exports.ResizablePanelGroup=jce;exports.ResourceEditDialog=IY;exports.ResourceType=Zr;exports.SELF_HEAL_TIMELINE_STEP=nwt;exports.SeedQuestions=Zue;exports.SemaphorContext=k0;exports.SemaphorContextProvider=BR;exports.SemaphorQueryClient=Pq;exports.SemaphorReadyIndicator=W3;exports.SemaphorStyleWrapper=Ag;exports.Send=xW;exports.Settings=ZR;exports.Settings2=T0;exports.Share2=yW;exports.ShareDialog=jY;exports.Sheet=eee;exports.SheetContent=fO;exports.SheetDescription=mO;exports.SheetHeader=nee;exports.SheetTitle=hO;exports.SheetTrigger=HPe;exports.Slider=mhe;exports.SortableContext=Fv;exports.Sparkles=W1;exports.Square=QR;exports.SquarePen=XR;exports.Star=vW;exports.StructuralParticipantSelector=cle;exports.SummaryCard=MA;exports.TABLE_PRESENTATION_DEFAULT_STYLE=_u;exports.TABLE_PRESENTATION_DEFAULT_TOTALS_STYLE=Fi;exports.TableBody=zu;exports.TableCell=Mn;exports.TableColumnVisibilitySettings=Hle;exports.TableHead=ts;exports.TableHeader=Ph;exports.TablePresentationSettings=qle;exports.TableRow=Sr;exports.TableSkeleton=uL;exports.TableVisual=Vu;exports.TbChartBubble=Efe;exports.TbChartFunnel=Tfe;exports.TbChartTreemap=Dfe;exports.TextCard=Op;exports.Textarea=jh;exports.TiSortNumerically=Afe;exports.Toggle=W_;exports.Tornado=wW;exports.Trash2=fl;exports.TreePalm=eP;exports.TrendingUp=SW;exports.TriangleAlert=Bi;exports.TypeGlyph=Iv;exports.UXProvider=q3;exports.User=CW;exports.Users=ek;exports.applyFilterOverridesToDashboardInputSlots=aZ;exports.areContextEntitiesEqual=Jn;exports.areEntitiesJoined=yJ;exports.arrayMove=$g;exports.buildCardControlUsageById=Uet;exports.buildCustomCardTheme=Cv;exports.buildDashboardCardExecutionSnapshot=iZ;exports.buildDashboardControlUsageById=Het;exports.buildDashboardExecutionSnapshot=oF;exports.buildDashboardInputExecutionSnapshot=vu;exports.buildDashboardSheetsInputExecutionSnapshot=cZ;exports.buildDashboardStructuralParticipantIdsByControlId=gle;exports.buildFilterFieldMeta=jL;exports.buildFilterSemanticContext=IL;exports.buildInlineFilterNodes=H5;exports.buildMultiInputCustomVisualProps=K5;exports.buildScheduleExpr=jwt;exports.buildSchedulePreview=Twt;exports.buildSlotOrderedCards=q5;exports.calculateContextAwareFilters=z0;exports.calculateFieldState=rO;exports.canUserAccessVisuals=r0e;exports.canUserCreateDashboards=DY;exports.canUserEdit=e0e;exports.canUserManageDashboards=n0e;exports.canUserManageGroups=s0e;exports.canUserUseFilters=t0e;exports.cancelExport=MRe;exports.chartSupportsDataLabels=dQ;exports.chartSupportsLegend=cQ;exports.chartTypes=Hj;exports.cleanupKpiMetricComparisonMode=yae;exports.cloneDeep=$o;exports.cloneLinkedFrameWithSourceMapping=GGe;exports.closestCenter=Mv;exports.commitSharedCalculatedFields=Wd;exports.createAssistantConversationId=Im;exports.createAssistantRequestId=Yue;exports.createCardsFromSlots=lWe;exports.createChartConfig=cg;exports.createDashboardControlInputFromControl=$rt;exports.createDefaultGlobalDateFilter=d1e;exports.createExport=$J;exports.createUniqueDashboardInputVariableNameFromName=Eu;exports.dedup=Gut;exports.doesStoredFilterMatchField=Vp;exports.downloadDocumentPdf=aF;exports.downloadPdf=bZ;exports.extractSqlParamReferences=wse;exports.extractTableMetadata=_L;exports.fieldAlreadyExists=wJ;exports.findCustomVisualConfigCard=G5;exports.findDashboardFrameById=n1e;exports.flexRender=Bo;exports.formatDisplayFormula=FQe;exports.formatFileSize=PRe;exports.formatFilterLine=HZ;exports.formatTimeLabel=ghe;exports.getAutoDetectedChartIcon=c0t;exports.getChartGridStyle=PNe;exports.getChartIconByType=u0t;exports.getColorForValue=A2;exports.getConfigSlotExpectedType=aWe;exports.getCoreRowModel=n_;exports.getCustomVisualInputCards=W5;exports.getDateFormatOptionsForGranularity=Jy;exports.getDefaultAxisConfig=P2;exports.getDefaultChartColors=Mh;exports.getDefaultDataLabelsConfig=Q0;exports.getDefaultExportFormat=iX;exports.getDefaultFilterSql=_5;exports.getDefaultLegendConfig=zF;exports.getDefaultRunningTotalPartitionByFieldIds=Yx;exports.getDocumentSectionEditorCard=vet;exports.getDocumentSheetDashboardInputs=Bv;exports.getDownloadUrl=DRe;exports.getEffectiveCardTypeForSlot=Ym;exports.getEntityIcon=zN;exports.getErrorMessage=Fue;exports.getExportStatus=TRe;exports.getExports=ERe;exports.getExpressionFieldKind=Zu;exports.getFieldExpressionAnnotation=EL;exports.getFilterCount=mN;exports.getGlobalDateFilter=Xp;exports.getGlobalDateFilterCoverage=f1e;exports.getGranularityOptionsForFieldType=GL;exports.getKeys=cr;exports.getMatrixVisualLoadingState=m_;exports.getMetricDisplayLabel=XAe;exports.getNewField=_J;exports.getObjectDiff=pq;exports.getPaginationRowModel=r_;exports.getRoleBasedDisplayOverrides=TY;exports.getRunningTotalOrderByCandidates=oQe;exports.getSelectedDateFilterColumn=Cse;exports.getSheetScopedFilterValues=cy;exports.getSlotDefinitionForIndex=U5;exports.getSlotExpectedChartType=U_;exports.getSlotIndexForCard=qy;exports.getSortedRowModel=QJ;exports.getSupportedExportFormats=oX;exports.getTableConditionalFormattingColumnOptions=Kle;exports.getTableOutputColumnOptions=Zle;exports.getTablePageSizeOptions=FJ;exports.handleAggregationChange=FA;exports.handleAggregationLabelChange=oie;exports.hasFlatTableTotalsBehavior=iCe;exports.hasMatrixResultData=nv;exports.horizontalListSortingStrategy=bL;exports.isCalculatedFilterField=e0;exports.isCardSummaryVisibleOnCard=Z5;exports.isCustomVisualConfigCard=TA;exports.isDefaultColor=pCe;exports.isEligibleFlatTableTotalsCard=Qp;exports.isExportComplete=RRe;exports.isExportInProgress=ARe;exports.isInAiScopeArray=Wut;exports.isManagedCalculatedExpressionField=xa;exports.isMetricTransformEnabled=rQe;exports.isPromiseLike=mR;exports.isSubtotalEnabledAggregateTable=kL;exports.isSupportedDocumentTableCardType=wet;exports.lastAssistantMessageIsCompleteWithToolCalls=Mue;exports.merge=dl;exports.mergeAxisConfig=F2;exports.normalizeConditionalFormatting=QP;exports.normalizeContextFormatMode=KZ;exports.normalizeDashboardInputVariableName=j0;exports.normalizeMultiInputPayload=Y5;exports.parseScheduleExpr=_wt;exports.pivotData=q0;exports.prepareFeedbackData=Vj;exports.purify=uA;exports.reindexSlotCards=iWe;exports.remarkGfm=Nfe;exports.removeFromScopeArray=Yut;exports.resolveDashboardInputContext=Nl;exports.resolveDomainCalculatedFieldForEdit=DJe;exports.resolveMultiInputType=Nv;exports.resolveMultiInputTypeFromVisual=cWe;exports.resolveTablePageSize=Jk;exports.resolveTablePresentationStyle=SO;exports.sanitizeAIScope=Pue;exports.saveCalculatedFieldToCardScope=YA;exports.saveCalculatedFieldToSharedScope=Wae;exports.saveCalculatedFieldToSheetScope=KA;exports.seedSemanticMetricFormatDefaults=wae;exports.setTableColumnVisibility=VJ;exports.setupEditorWithCard=Mk;exports.showAllTableColumns=$Re;exports.showJoinRequiredNotification=vJ;exports.sortByColumnsToSortState=See;exports.sortStateToSortByColumns=Cee;exports.sortableKeyboardCoordinates=yL;exports.supportsMetricTransformForMetric=vae;exports.supportsTableConditionalFormatting=Wle;exports.toEntityArray=ba;exports.ue=tt;exports.useActiveExports=f0e;exports.useActiveToolStatus=hde;exports.useAddFrameWithFreshSemanticExecutionPayload=lL;exports.useAddNewFrame=jie;exports.useAssistantContainer=RY;exports.useAssistantContextEntities=Q_;exports.useAssistantLayoutStore=kf;exports.useAssistantPanel=MY;exports.useAssistantProfile=Kue;exports.useAutoSubmitQueue=fde;exports.useBrandStudioPreview=Svt;exports.useCard=cRe;exports.useCardFilterValues=IJ;exports.useCardSummary=X5;exports.useChat=Rue;exports.useColumns=SL;exports.useCreateVisualWithFrame=exe;exports.useCurrentUserInfo=Ki;exports.useCustomVisual=$h;exports.useCustomVisualsQuery=z5;exports.useDashboardAppearance=Dc;exports.useDashboardById=EG;exports.useDashboardPreferences=Yp;exports.useDashboardQuery=_0;exports.useDashboardStructuralParticipants=ble;exports.useDashboardSummary=Voe;exports.useDataColumns=Cae;exports.useDateFilterHook=z9e;exports.useDebounce=Vx;exports.useDefaultDashboardMutation=SG;exports.useDisplayPreferences=Cl;exports.useDroppable=Zie;exports.useEditorAside=fj;exports.useEditorCardQuery=Dk;exports.useEnsureReactGlobals=Zre;exports.useExportActions=PY;exports.useExportStore=fk;exports.useFieldManagement=Sae;exports.useFilterableFields=gae;exports.useFullscreenAssistant=AY;exports.useGroupMembers=nye;exports.useGroups=yY;exports.useHasDashboardId=FY;exports.useInProgressExportsCount=h0e;exports.useJoinabilityMap=NL;exports.useManagementActions=vh;exports.useManagementStore=Ls;exports.useMutation=so;exports.usePivotTableConfig=Rh;exports.usePluginQuery=Ioe;exports.useQuery=An;exports.useQueryClient=Xr;exports.useReactTable=s_;exports.useResolveExistingFrameSemanticExecutionPayload=XGe;exports.useResourceManagement=dP;exports.useResourceUpdateState=TG;exports.useScopedFields=pae;exports.useSelectedVisual=Hme;exports.useSemaphorContext=mt;exports.useSensor=Bp;exports.useSensors=nj;exports.useSortable=zg;exports.useStarredChartsStore=iwt;exports.useSurfaceAppearance=Tc;exports.useTableQueryState=hee;exports.useTextFilterHook=X9e;exports.useTheme=PR;exports.useTopoJson=ev;exports.useUnifiedUsers=gP;exports.useUpdateResource=kG;exports.useUpdateVisualMutation=txe;exports.useUserPreferences=QG;exports.useVisualById=ik;exports.useVisualManagement=Jbe;exports.validateFieldForChartType=xae;exports.verticalListSortingStrategy=xL;
|