@kong-ui-public/dashboard-renderer 10.2.2 → 10.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
- (function(Q,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue"),require("@kong-ui-public/analytics-utilities"),require("@kong/icons"),require("@kong-ui-public/analytics-chart"),require("swrv"),require("@kong-ui-public/analytics-metric-provider"),require("ag-grid-vue3"),require("ag-grid-community"),require("@kong-ui-public/i18n"),require("@kong-ui-public/analytics-config-store"),require("@kong/kongponents"),require("vue-echarts"),require("echarts/core"),require("echarts/renderers"),require("echarts/components"),require("echarts/charts"),require("axios"),require("@kong-ui-public/analytics-geo-map")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/analytics-utilities","@kong/icons","@kong-ui-public/analytics-chart","swrv","@kong-ui-public/analytics-metric-provider","ag-grid-vue3","ag-grid-community","@kong-ui-public/i18n","@kong-ui-public/analytics-config-store","@kong/kongponents","vue-echarts","echarts/core","echarts/renderers","echarts/components","echarts/charts","axios","@kong-ui-public/analytics-geo-map"],s):(Q=typeof globalThis<"u"?globalThis:Q||self,s(Q["kong-ui-public-dashboard-renderer"]={},Q.Vue,Q["kong-ui-public-analytics-utilities"],Q.KongIcons,Q["kong-ui-public-analytics-chart"],Q.swrv,Q["kong-ui-public-analytics-metric-provider"],Q.AgGridVue,Q.agGridCommunity,Q["kong-ui-public-i18n"],Q["kong-ui-public-analytics-config-store"],Q.Kongponents,Q.VueECharts,Q.echarts,Q.echarts,Q.echarts,Q.echarts,Q.axios,Q["kong-ui-public-analytics-geo-map"]))})(this,(function(Q,s,ie,se,be,oi,ai,Hn,Xe,lt,we,Gn,$n,Tt,Fn,ct,li,Fg,ci){"use strict";const Wn=n=>{const e=n.length;let t=5381;for(let i=0;i<e;i++)t=t*33^n.charCodeAt(i);return t>>>0},Vn="#0044f4",ui="#6c7489",Yn="#d60027",Xn="#ffc400",jn="#bee2ff",Qn="#8fc1ff",Zn="#5f9aff",Jn="#306fff",er="#b5ffee",tr="#00fabe",ir="#00d6a4",nr="#00a17b",rr="#007d60",sr="#005944",or="#b5ffee",ar="#00fabe",lr="#b5ffee",cr="#00a17b",ur="#fff296",dr="#ffe04b",hr="#ffc400",fr="#b37600",mr="#995c00",pr="#804400",gr="#fff296",_r="#ffe04b",yr="#ffc2b3",Rr="#ff9877",Cr="#ff723c",Er="#f75008",Or="#d13500",br="#a31f00",wr="#ffc2b3",Tr="#ff9877",vr="#ff723c",Sr="#f75008",xr="#d13500",Ir="#a31f00",Dr="#ffc2b3",kr="#ff9877",Nr="#ff723c",Ar="#f75008",Lr="#d13500",Ur="#a31f00",Kr="#ffc2b3",Mr="#ff9877",Br="#ff723c",zr="#f75008",Pr="#d13500",qr="#a31f00",Hr="#ffc2b3",Gr="#ff9877",$r="#ff723c",Fr="#f75008",Wr="#d13500",Vr="#ffabab",Yr="#ff7272",Xr="#ff3954",jr="#f50045",Qr="#d60027",Zr="#ad000e",Jr="#ffabab",es="#ff7272",ts="#ff3954",is="#f50045",ns="#d60027",rs="#eefaff",ss="#ecfffb",os="#fffce0",as="#fff1ef",ls="#ffe5e5",cs="#5f9aff",us="#00d6a4",ds="#ffc400",hs="#ff723c",fs="#ff3954",ms={100:jn,101:Qn,102:Zn,103:Jn,200:er,201:tr,202:ir,203:nr,204:rr,205:sr,206:or,207:ar,208:lr,226:cr,300:ur,301:dr,302:hr,303:fr,304:mr,305:pr,307:gr,308:_r,400:yr,401:Rr,402:Cr,403:Er,404:Or,405:br,406:wr,407:Tr,408:vr,409:Sr,410:xr,411:Ir,412:Dr,413:kr,414:Nr,415:Ar,416:Lr,417:Ur,418:Kr,421:Mr,422:Br,423:zr,424:Pr,425:qr,426:Hr,428:Gr,429:$r,431:Fr,451:Wr,500:Vr,501:Yr,502:Xr,503:jr,504:Qr,505:Zr,506:Jr,507:es,508:ts,510:is,511:ns},ps={100:rs,200:ss,300:os,400:as,500:ls},di={"1XX":cs,"2XX":us,"3XX":ds,"4XX":hs,"5XX":fs},gs={error:Yn,warning:Xn,empty:"#9DA99D",neutral:ui,____OTHER____:Vn},vt=["#0076F4","#00819D","#00A17B","#8A50FF","#FF3C99","#FF6D3C","#B3A100"],St=["#5485BA","#087D96","#3D8776","#7654BA","#A1406F","#BF5430","#B5A72C"],_s=n=>Wn(n),ys=({theme:n="light"}={})=>n==="dark"?St:vt,hi=({discriminator:n,theme:e="light"})=>{const t=Math.abs(Math.floor(n));return e==="dark"?St[t%St.length]:vt[t%vt.length]},je=({state:n})=>gs[n]??ui,Rs=({statusCode:n})=>{const e=typeof n=="number"?n:Number.parseInt(n,10),t=`${e}`,i=`${Math.floor(e/100)*100}`;return ms[t]??ps[i]??je({state:"neutral"})},Cs=({group:n})=>di[n]?di[n]:je({state:"neutral"}),Es=({discriminator:n=void 0,state:e=void 0,dimension:t=void 0,dimensionValue:i=void 0,metric:r=void 0,coordinator:o=void 0,order:a=void 0,chartUuid:l=void 0,customDimensionColors:d=void 0})=>{let c="light";if(s.hasInjectionContext()&&(c=s.inject("app:konnectColorMode",s.computed(()=>"light")).value),e!==void 0)return je({state:e});if(i!==void 0&&d!==void 0&&d[i])return d[i];if(i&&["empty","____OTHER____"].includes(i))return je({state:i});if(t!==void 0&&i!==void 0){if(t==="status_code")return Rs({statusCode:i});if(t==="status_code_grouped")return Cs({group:i})}if(n!==void 0)return hi({discriminator:n,theme:c});if(t||i||r){const u=`${t??""}${i??""}${r??""}`,h=o?o.resolveDiscriminator({name:u,order:a,chartUuid:l,theme:c}):_s(u);return hi({discriminator:h,theme:c})}return je({state:"neutral"})},Os="__no_chart__";function bs(){const n=new Map,e=new Map,t=new Map,i=o=>{e.set(o,(e.get(o)??0)+1)},r=(o,a)=>{let l=-1,d=1/0;for(let c=0;c<o;c++){if(a.has(c))continue;const u=e.get(c)??0;u<d&&(l=c,d=u)}return l!==-1?l:o<1?0:r(o,new Set)};return{resolveDiscriminator:({name:o,order:a,chartUuid:l,theme:d})=>{const c=l??Os,u=a??null,h=ys({theme:d});let f;if(n.has(o))f=n.get(o);else{const p=new Set,C=t.get(c);u!==null&&C?.order!==null&&C?.order!==void 0&&u===C.order+1&&p.add(C.index);const E=h.length;f=r(E,p),n.set(o,f),i(f)}return t.set(c,{order:u,index:f}),f},reset:()=>{n.clear(),e.clear(),t.clear()}}}function ws(){const n=s.ref(null),e=s.ref(null),t=s.ref(null),i=s.ref(null),r=s.ref(null),o=300,a=300,l=10,d=bs(),c=({chartUuid:h,timestamp:f=null,dimension:p=null,dimensionValue:C=null,metric:E=null})=>{n.value=h,e.value=f,t.value=p,i.value=C,r.value=E},u=({chartUuid:h})=>{n.value===h&&(n.value=null,e.value=null,t.value=null,i.value=null,r.value=null)};return{activate:c,activeChart:s.readonly(n),activeDimension:s.readonly(t),activeDimensionValue:s.readonly(i),activeMetric:s.readonly(r),activeTimestamp:s.readonly(e),deactivate:u,DIMENSION_DEBOUNCE_MS:o,METRIC_DEBOUNCE_MS:a,TIMESTAMP_DEBOUNCE_MS:l,color:d}}const Ts={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},vs=(n,e,t)=>{let i;const r=Ts[n];return typeof r=="string"?i=r:e===1?i=r.one:i=r.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+i:i+" ago":i};function xt(n){return(e={})=>{const t=e.width?String(e.width):n.defaultWidth;return n.formats[t]||n.formats[n.defaultWidth]}}const Ss={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},xs={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Is={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Ds={date:xt({formats:Ss,defaultWidth:"full"}),time:xt({formats:xs,defaultWidth:"full"}),dateTime:xt({formats:Is,defaultWidth:"full"})},ks={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ns=(n,e,t,i)=>ks[n];function Qe(n){return(e,t)=>{const i=t?.context?String(t.context):"standalone";let r;if(i==="formatting"&&n.formattingValues){const a=n.defaultFormattingWidth||n.defaultWidth,l=t?.width?String(t.width):a;r=n.formattingValues[l]||n.formattingValues[a]}else{const a=n.defaultWidth,l=t?.width?String(t.width):n.defaultWidth;r=n.values[l]||n.values[a]}const o=n.argumentCallback?n.argumentCallback(e):e;return r[o]}}const As={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Ls={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Us={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Ks={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Ms={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Bs={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},zs={ordinalNumber:(n,e)=>{const t=Number(n),i=t%100;if(i>20||i<10)switch(i%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},era:Qe({values:As,defaultWidth:"wide"}),quarter:Qe({values:Ls,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Qe({values:Us,defaultWidth:"wide"}),day:Qe({values:Ks,defaultWidth:"wide"}),dayPeriod:Qe({values:Ms,defaultWidth:"wide",formattingValues:Bs,defaultFormattingWidth:"wide"})};function Ze(n){return(e,t={})=>{const i=t.width,r=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],o=e.match(r);if(!o)return null;const a=o[0],l=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],d=Array.isArray(l)?qs(l,h=>h.test(a)):Ps(l,h=>h.test(a));let c;c=n.valueCallback?n.valueCallback(d):d,c=t.valueCallback?t.valueCallback(c):c;const u=e.slice(a.length);return{value:c,rest:u}}}function Ps(n,e){for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&e(n[t]))return t}function qs(n,e){for(let t=0;t<n.length;t++)if(e(n[t]))return t}function Hs(n){return(e,t={})=>{const i=e.match(n.matchPattern);if(!i)return null;const r=i[0],o=e.match(n.parsePattern);if(!o)return null;let a=n.valueCallback?n.valueCallback(o[0]):o[0];a=t.valueCallback?t.valueCallback(a):a;const l=e.slice(r.length);return{value:a,rest:l}}}const Gs=/^(\d+)(th|st|nd|rd)?/i,$s=/\d+/i,Fs={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Ws={any:[/^b/i,/^(a|c)/i]},Vs={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Ys={any:[/1/i,/2/i,/3/i,/4/i]},Xs={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},js={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Qs={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Zs={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Js={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},eo={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},to={ordinalNumber:Hs({matchPattern:Gs,parsePattern:$s,valueCallback:n=>parseInt(n,10)}),era:Ze({matchPatterns:Fs,defaultMatchWidth:"wide",parsePatterns:Ws,defaultParseWidth:"any"}),quarter:Ze({matchPatterns:Vs,defaultMatchWidth:"wide",parsePatterns:Ys,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Ze({matchPatterns:Xs,defaultMatchWidth:"wide",parsePatterns:js,defaultParseWidth:"any"}),day:Ze({matchPatterns:Qs,defaultMatchWidth:"wide",parsePatterns:Zs,defaultParseWidth:"any"}),dayPeriod:Ze({matchPatterns:Js,defaultMatchWidth:"any",parsePatterns:eo,defaultParseWidth:"any"})},io={code:"en-US",formatDistance:vs,formatLong:Ds,formatRelative:Ns,localize:zs,match:to,options:{weekStartsOn:0,firstWeekContainsDate:1}};let no={};function Je(){return no}const fi=6048e5,ro=864e5,mi=Symbol.for("constructDateFrom");function Ke(n,e){return typeof n=="function"?n(e):n&&typeof n=="object"&&mi in n?n[mi](e):n instanceof Date?new n.constructor(e):new Date(e)}function Te(n,e){return Ke(e||n,n)}function pi(n){const e=Te(n),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+n-+t}function so(n,...e){const t=Ke.bind(null,e.find(i=>typeof i=="object"));return e.map(t)}function gi(n,e){const t=Te(n,e?.in);return t.setHours(0,0,0,0),t}function oo(n,e,t){const[i,r]=so(t?.in,n,e),o=gi(i),a=gi(r),l=+o-pi(o),d=+a-pi(a);return Math.round((l-d)/ro)}function ao(n,e){const t=Te(n,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function lo(n,e){const t=Te(n,e?.in);return oo(t,ao(t))+1}function et(n,e){const t=Je(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,r=Te(n,e?.in),o=r.getDay(),a=(o<i?7:0)+o-i;return r.setDate(r.getDate()-a),r.setHours(0,0,0,0),r}function ut(n,e){return et(n,{...e,weekStartsOn:1})}function _i(n,e){const t=Te(n,e?.in),i=t.getFullYear(),r=Ke(t,0);r.setFullYear(i+1,0,4),r.setHours(0,0,0,0);const o=ut(r),a=Ke(t,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const l=ut(a);return t.getTime()>=o.getTime()?i+1:t.getTime()>=l.getTime()?i:i-1}function co(n,e){const t=_i(n,e),i=Ke(n,0);return i.setFullYear(t,0,4),i.setHours(0,0,0,0),ut(i)}function uo(n,e){const t=Te(n,e?.in),i=+ut(t)-+co(t);return Math.round(i/fi)+1}function yi(n,e){const t=Te(n,e?.in),i=t.getFullYear(),r=Je(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=Ke(e?.in||n,0);a.setFullYear(i+1,0,o),a.setHours(0,0,0,0);const l=et(a,e),d=Ke(e?.in||n,0);d.setFullYear(i,0,o),d.setHours(0,0,0,0);const c=et(d,e);return+t>=+l?i+1:+t>=+c?i:i-1}function ho(n,e){const t=Je(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,r=yi(n,e),o=Ke(e?.in||n,0);return o.setFullYear(r,0,i),o.setHours(0,0,0,0),et(o,e)}function fo(n,e){const t=Te(n,e?.in),i=+et(t,e)-+ho(t,e);return Math.round(i/fi)+1}function oe(n,e){const t=n<0?"-":"",i=Math.abs(n).toString().padStart(e,"0");return t+i}const Me={y(n,e){const t=n.getFullYear(),i=t>0?t:1-t;return oe(e==="yy"?i%100:i,e.length)},M(n,e){const t=n.getMonth();return e==="M"?String(t+1):oe(t+1,2)},d(n,e){return oe(n.getDate(),e.length)},a(n,e){const t=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];default:return t==="am"?"a.m.":"p.m."}},h(n,e){return oe(n.getHours()%12||12,e.length)},H(n,e){return oe(n.getHours(),e.length)},m(n,e){return oe(n.getMinutes(),e.length)},s(n,e){return oe(n.getSeconds(),e.length)},S(n,e){const t=e.length,i=n.getMilliseconds(),r=Math.trunc(i*Math.pow(10,t-3));return oe(r,e.length)}},Fe={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ri={G:function(n,e,t){const i=n.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(i,{width:"abbreviated"});case"GGGGG":return t.era(i,{width:"narrow"});default:return t.era(i,{width:"wide"})}},y:function(n,e,t){if(e==="yo"){const i=n.getFullYear(),r=i>0?i:1-i;return t.ordinalNumber(r,{unit:"year"})}return Me.y(n,e)},Y:function(n,e,t,i){const r=yi(n,i),o=r>0?r:1-r;if(e==="YY"){const a=o%100;return oe(a,2)}return e==="Yo"?t.ordinalNumber(o,{unit:"year"}):oe(o,e.length)},R:function(n,e){const t=_i(n);return oe(t,e.length)},u:function(n,e){const t=n.getFullYear();return oe(t,e.length)},Q:function(n,e,t){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"Q":return String(i);case"QQ":return oe(i,2);case"Qo":return t.ordinalNumber(i,{unit:"quarter"});case"QQQ":return t.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(i,{width:"narrow",context:"formatting"});default:return t.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,e,t){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"q":return String(i);case"qq":return oe(i,2);case"qo":return t.ordinalNumber(i,{unit:"quarter"});case"qqq":return t.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(i,{width:"narrow",context:"standalone"});default:return t.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,e,t){const i=n.getMonth();switch(e){case"M":case"MM":return Me.M(n,e);case"Mo":return t.ordinalNumber(i+1,{unit:"month"});case"MMM":return t.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(i,{width:"narrow",context:"formatting"});default:return t.month(i,{width:"wide",context:"formatting"})}},L:function(n,e,t){const i=n.getMonth();switch(e){case"L":return String(i+1);case"LL":return oe(i+1,2);case"Lo":return t.ordinalNumber(i+1,{unit:"month"});case"LLL":return t.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(i,{width:"narrow",context:"standalone"});default:return t.month(i,{width:"wide",context:"standalone"})}},w:function(n,e,t,i){const r=fo(n,i);return e==="wo"?t.ordinalNumber(r,{unit:"week"}):oe(r,e.length)},I:function(n,e,t){const i=uo(n);return e==="Io"?t.ordinalNumber(i,{unit:"week"}):oe(i,e.length)},d:function(n,e,t){return e==="do"?t.ordinalNumber(n.getDate(),{unit:"date"}):Me.d(n,e)},D:function(n,e,t){const i=lo(n);return e==="Do"?t.ordinalNumber(i,{unit:"dayOfYear"}):oe(i,e.length)},E:function(n,e,t){const i=n.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(i,{width:"short",context:"formatting"});default:return t.day(i,{width:"wide",context:"formatting"})}},e:function(n,e,t,i){const r=n.getDay(),o=(r-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return oe(o,2);case"eo":return t.ordinalNumber(o,{unit:"day"});case"eee":return t.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(r,{width:"short",context:"formatting"});default:return t.day(r,{width:"wide",context:"formatting"})}},c:function(n,e,t,i){const r=n.getDay(),o=(r-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return oe(o,e.length);case"co":return t.ordinalNumber(o,{unit:"day"});case"ccc":return t.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(r,{width:"narrow",context:"standalone"});case"cccccc":return t.day(r,{width:"short",context:"standalone"});default:return t.day(r,{width:"wide",context:"standalone"})}},i:function(n,e,t){const i=n.getDay(),r=i===0?7:i;switch(e){case"i":return String(r);case"ii":return oe(r,e.length);case"io":return t.ordinalNumber(r,{unit:"day"});case"iii":return t.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(i,{width:"short",context:"formatting"});default:return t.day(i,{width:"wide",context:"formatting"})}},a:function(n,e,t){const r=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(r,{width:"narrow",context:"formatting"});default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(n,e,t){const i=n.getHours();let r;switch(i===12?r=Fe.noon:i===0?r=Fe.midnight:r=i/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(r,{width:"narrow",context:"formatting"});default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(n,e,t){const i=n.getHours();let r;switch(i>=17?r=Fe.evening:i>=12?r=Fe.afternoon:i>=4?r=Fe.morning:r=Fe.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(r,{width:"narrow",context:"formatting"});default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(n,e,t){if(e==="ho"){let i=n.getHours()%12;return i===0&&(i=12),t.ordinalNumber(i,{unit:"hour"})}return Me.h(n,e)},H:function(n,e,t){return e==="Ho"?t.ordinalNumber(n.getHours(),{unit:"hour"}):Me.H(n,e)},K:function(n,e,t){const i=n.getHours()%12;return e==="Ko"?t.ordinalNumber(i,{unit:"hour"}):oe(i,e.length)},k:function(n,e,t){let i=n.getHours();return i===0&&(i=24),e==="ko"?t.ordinalNumber(i,{unit:"hour"}):oe(i,e.length)},m:function(n,e,t){return e==="mo"?t.ordinalNumber(n.getMinutes(),{unit:"minute"}):Me.m(n,e)},s:function(n,e,t){return e==="so"?t.ordinalNumber(n.getSeconds(),{unit:"second"}):Me.s(n,e)},S:function(n,e){return Me.S(n,e)},X:function(n,e,t){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return Ei(i);case"XXXX":case"XX":return Pe(i);default:return Pe(i,":")}},x:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"x":return Ei(i);case"xxxx":case"xx":return Pe(i);default:return Pe(i,":")}},O:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Ci(i,":");default:return"GMT"+Pe(i,":")}},z:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Ci(i,":");default:return"GMT"+Pe(i,":")}},t:function(n,e,t){const i=Math.trunc(+n/1e3);return oe(i,e.length)},T:function(n,e,t){return oe(+n,e.length)}};function Ci(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),r=Math.trunc(i/60),o=i%60;return o===0?t+String(r):t+String(r)+e+oe(o,2)}function Ei(n,e){return n%60===0?(n>0?"-":"+")+oe(Math.abs(n)/60,2):Pe(n,e)}function Pe(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),r=oe(Math.trunc(i/60),2),o=oe(i%60,2);return t+r+e+o}const Oi=(n,e)=>{switch(n){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},bi=(n,e)=>{switch(n){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},mo={p:bi,P:(n,e)=>{const t=n.match(/(P+)(p+)?/)||[],i=t[1],r=t[2];if(!r)return Oi(n,e);let o;switch(i){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;default:o=e.dateTime({width:"full"});break}return o.replace("{{date}}",Oi(i,e)).replace("{{time}}",bi(r,e))}},po=/^D+$/,go=/^Y+$/,_o=["D","DD","YY","YYYY"];function yo(n){return po.test(n)}function Ro(n){return go.test(n)}function Co(n,e,t){const i=Eo(n,e,t);if(console.warn(i),_o.includes(n))throw new RangeError(i)}function Eo(n,e,t){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${e}\`) for formatting ${i} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function Oo(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function bo(n){return!(!Oo(n)&&typeof n!="number"||isNaN(+Te(n)))}const wo=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,To=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,vo=/^'([^]*?)'?$/,So=/''/g,xo=/[a-zA-Z]/;function Io(n,e,t){const i=Je(),r=t?.locale??i.locale??io,o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,l=Te(n,t?.in);if(!bo(l))throw new RangeError("Invalid time value");let d=e.match(To).map(u=>{const h=u[0];if(h==="p"||h==="P"){const f=mo[h];return f(u,r.formatLong)}return u}).join("").match(wo).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const h=u[0];if(h==="'")return{isToken:!1,value:Do(u)};if(Ri[h])return{isToken:!0,value:u};if(h.match(xo))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:u}});r.localize.preprocessor&&(d=r.localize.preprocessor(l,d));const c={firstWeekContainsDate:o,weekStartsOn:a,locale:r};return d.map(u=>{if(!u.isToken)return u.value;const h=u.value;(!t?.useAdditionalWeekYearTokens&&Ro(h)||!t?.useAdditionalDayOfYearTokens&&yo(h))&&Co(h,e,String(n));const f=Ri[h[0]];return f(l,h,r.localize,c)}).join("")}function Do(n){const e=n.match(vo);return e?e[1].replace(So,"'"):n}function ko(){return Object.assign({},Je())}function wi(n,e,t){const i=ko(),r=Lo(n,t.timeZone,t.locale??i.locale);return"formatToParts"in r?No(r,e):Ao(r,e)}function No(n,e){const t=n.formatToParts(e);for(let i=t.length-1;i>=0;--i)if(t[i].type==="timeZoneName")return t[i].value}function Ao(n,e){const t=n.format(e).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(t);return i?i[0].substr(1):""}function Lo(n,e,t){return new Intl.DateTimeFormat(t?[t.code,"en-US"]:void 0,{timeZone:e,timeZoneName:n})}function Uo(n,e){const t=Po(e);return"formatToParts"in t?Mo(t,n):Bo(t,n)}const Ko={year:0,month:1,day:2,hour:3,minute:4,second:5};function Mo(n,e){try{const t=n.formatToParts(e),i=[];for(let r=0;r<t.length;r++){const o=Ko[t[r].type];o!==void 0&&(i[o]=parseInt(t[r].value,10))}return i}catch(t){if(t instanceof RangeError)return[NaN];throw t}}function Bo(n,e){const t=n.format(e),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(t);return[parseInt(i[3],10),parseInt(i[1],10),parseInt(i[2],10),parseInt(i[4],10),parseInt(i[5],10),parseInt(i[6],10)]}const It={},Ti=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),zo=Ti==="06/25/2014, 00:00:00"||Ti==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";function Po(n){return It[n]||(It[n]=zo?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),It[n]}function vi(n,e,t,i,r,o,a){const l=new Date(0);return l.setUTCFullYear(n,e,t),l.setUTCHours(i,r,o,a),l}const Si=36e5,qo=6e4,Dt={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function kt(n,e,t){if(!n)return 0;let i=Dt.timezoneZ.exec(n);if(i)return 0;let r,o;if(i=Dt.timezoneHH.exec(n),i)return r=parseInt(i[1],10),xi(r)?-(r*Si):NaN;if(i=Dt.timezoneHHMM.exec(n),i){r=parseInt(i[2],10);const a=parseInt(i[3],10);return xi(r,a)?(o=Math.abs(r)*Si+a*qo,i[1]==="+"?-o:o):NaN}if($o(n)){e=new Date(e||Date.now());const a=t?e:Ho(e),l=Nt(a,n);return-(t?l:Go(e,l,n))}return NaN}function Ho(n){return vi(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())}function Nt(n,e){const t=Uo(n,e),i=vi(t[0],t[1]-1,t[2],t[3]%24,t[4],t[5],0).getTime();let r=n.getTime();const o=r%1e3;return r-=o>=0?o:1e3+o,i-r}function Go(n,e,t){let r=n.getTime()-e;const o=Nt(new Date(r),t);if(e===o)return e;r-=o-e;const a=Nt(new Date(r),t);return o===a?o:Math.max(o,a)}function xi(n,e){return-23<=n&&n<=23&&(e==null||0<=e&&e<=59)}const Ii={};function $o(n){if(Ii[n])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:n}),Ii[n]=!0,!0}catch{return!1}}const Fo=60*1e3,Wo={X:function(n,e,t){const i=At(t.timeZone,n);if(i===0)return"Z";switch(e){case"X":return Di(i);case"XXXX":case"XX":return We(i);default:return We(i,":")}},x:function(n,e,t){const i=At(t.timeZone,n);switch(e){case"x":return Di(i);case"xxxx":case"xx":return We(i);default:return We(i,":")}},O:function(n,e,t){const i=At(t.timeZone,n);switch(e){case"O":case"OO":case"OOO":return"GMT"+Vo(i,":");default:return"GMT"+We(i,":")}},z:function(n,e,t){switch(e){case"z":case"zz":case"zzz":return wi("short",n,t);default:return wi("long",n,t)}}};function At(n,e){const t=n?kt(n,e,!0)/Fo:e?.getTimezoneOffset()??0;if(Number.isNaN(t))throw new RangeError("Invalid time zone specified: "+n);return t}function dt(n,e){const t=n<0?"-":"";let i=Math.abs(n).toString();for(;i.length<e;)i="0"+i;return t+i}function We(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),r=dt(Math.floor(i/60),2),o=dt(Math.floor(i%60),2);return t+r+e+o}function Di(n,e){return n%60===0?(n>0?"-":"+")+dt(Math.abs(n)/60,2):We(n,e)}function Vo(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),r=Math.floor(i/60),o=i%60;return o===0?t+String(r):t+String(r)+e+dt(o,2)}function ki(n){const e=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return e.setUTCFullYear(n.getFullYear()),+n-+e}const Yo=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Lt=36e5,Ni=6e4,Xo=2,ge={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Yo};function Ai(n,e={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(n===null)return new Date(NaN);const t=e.additionalDigits==null?Xo:Number(e.additionalDigits);if(t!==2&&t!==1&&t!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]")return new Date(n.getTime());if(typeof n=="number"||Object.prototype.toString.call(n)==="[object Number]")return new Date(n);if(Object.prototype.toString.call(n)!=="[object String]")return new Date(NaN);const i=jo(n),{year:r,restDateString:o}=Qo(i.date,t),a=Zo(o,r);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const l=a.getTime();let d=0,c;if(i.time&&(d=Jo(i.time),d===null||isNaN(d)))return new Date(NaN);if(i.timeZone||e.timeZone){if(c=kt(i.timeZone||e.timeZone,new Date(l+d)),isNaN(c))return new Date(NaN)}else c=ki(new Date(l+d)),c=ki(new Date(l+d+c));return new Date(l+d+c)}else return new Date(NaN)}function jo(n){const e={};let t=ge.dateTimePattern.exec(n),i;if(t?(e.date=t[1],i=t[3]):(t=ge.datePattern.exec(n),t?(e.date=t[1],i=t[2]):(e.date=null,i=n)),i){const r=ge.timeZone.exec(i);r?(e.time=i.replace(r[1],""),e.timeZone=r[1].trim()):e.time=i}return e}function Qo(n,e){if(n){const t=ge.YYY[e],i=ge.YYYYY[e];let r=ge.YYYY.exec(n)||i.exec(n);if(r){const o=r[1];return{year:parseInt(o,10),restDateString:n.slice(o.length)}}if(r=ge.YY.exec(n)||t.exec(n),r){const o=r[1];return{year:parseInt(o,10)*100,restDateString:n.slice(o.length)}}}return{year:null}}function Zo(n,e){if(e===null)return null;let t,i,r;if(!n||!n.length)return t=new Date(0),t.setUTCFullYear(e),t;let o=ge.MM.exec(n);if(o)return t=new Date(0),i=parseInt(o[1],10)-1,Ki(e,i)?(t.setUTCFullYear(e,i),t):new Date(NaN);if(o=ge.DDD.exec(n),o){t=new Date(0);const a=parseInt(o[1],10);return ia(e,a)?(t.setUTCFullYear(e,0,a),t):new Date(NaN)}if(o=ge.MMDD.exec(n),o){t=new Date(0),i=parseInt(o[1],10)-1;const a=parseInt(o[2],10);return Ki(e,i,a)?(t.setUTCFullYear(e,i,a),t):new Date(NaN)}if(o=ge.Www.exec(n),o)return r=parseInt(o[1],10)-1,Mi(r)?Li(e,r):new Date(NaN);if(o=ge.WwwD.exec(n),o){r=parseInt(o[1],10)-1;const a=parseInt(o[2],10)-1;return Mi(r,a)?Li(e,r,a):new Date(NaN)}return null}function Jo(n){let e,t,i=ge.HH.exec(n);if(i)return e=parseFloat(i[1].replace(",",".")),Ut(e)?e%24*Lt:NaN;if(i=ge.HHMM.exec(n),i)return e=parseInt(i[1],10),t=parseFloat(i[2].replace(",",".")),Ut(e,t)?e%24*Lt+t*Ni:NaN;if(i=ge.HHMMSS.exec(n),i){e=parseInt(i[1],10),t=parseInt(i[2],10);const r=parseFloat(i[3].replace(",","."));return Ut(e,t,r)?e%24*Lt+t*Ni+r*1e3:NaN}return null}function Li(n,e,t){e=e||0,t=t||0;const i=new Date(0);i.setUTCFullYear(n,0,4);const r=i.getUTCDay()||7,o=e*7+t+1-r;return i.setUTCDate(i.getUTCDate()+o),i}const ea=[31,28,31,30,31,30,31,31,30,31,30,31],ta=[31,29,31,30,31,30,31,31,30,31,30,31];function Ui(n){return n%400===0||n%4===0&&n%100!==0}function Ki(n,e,t){if(e<0||e>11)return!1;if(t!=null){if(t<1)return!1;const i=Ui(n);if(i&&t>ta[e]||!i&&t>ea[e])return!1}return!0}function ia(n,e){if(e<1)return!1;const t=Ui(n);return!(t&&e>366||!t&&e>365)}function Mi(n,e){return!(n<0||n>52||e!=null&&(e<0||e>6))}function Ut(n,e,t){return!(n<0||n>=25||e!=null&&(e<0||e>=60)||t!=null&&(t<0||t>=60))}const na=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Kt(n,e,t={}){e=String(e);const i=e.match(na);if(i){const r=Ai(t.originalDate||n,t);e=i.reduce(function(o,a){if(a[0]==="'")return o;const l=o.indexOf(a),d=o[l-1]==="'",c=o.replace(a,"'"+Wo[a[0]](r,a,t)+"'");return d?c.substring(0,l-1)+c.substring(l+1):c},e)}return Io(n,e,t)}function ra(n,e,t){n=Ai(n,t);const i=kt(e,n,!0),r=new Date(n.getTime()-i),o=new Date(0);return o.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),o.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),o}function sa(n,e,t,i){return i={...i,timeZone:e,originalDate:n},Kt(ra(n,e,{timeZone:i.timeZone}),t,i)}const Mt="#6c7489",oa="768px",Bi="12px",aa="16px",zi="20px",Pi="32px",la="12px",qi="20px";var ht=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ca(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ft={exports:{}},ua=ft.exports,Hi;function da(){return Hi||(Hi=1,(function(n,e){(function(t,i){i()})(ua,function(){function t(c,u){return typeof u>"u"?u={autoBom:!1}:typeof u!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type)?new Blob(["\uFEFF",c],{type:c.type}):c}function i(c,u,h){var f=new XMLHttpRequest;f.open("GET",c),f.responseType="blob",f.onload=function(){d(f.response,u,h)},f.onerror=function(){console.error("could not download file")},f.send()}function r(c){var u=new XMLHttpRequest;u.open("HEAD",c,!1);try{u.send()}catch{}return 200<=u.status&&299>=u.status}function o(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var u=document.createEvent("MouseEvents");u.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(u)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ht=="object"&&ht.global===ht?ht:void 0,l=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),d=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!l?function(c,u,h){var f=a.URL||a.webkitURL,p=document.createElement("a");u=u||c.name||"download",p.download=u,p.rel="noopener",typeof c=="string"?(p.href=c,p.origin===location.origin?o(p):r(p.href)?i(c,u,h):o(p,p.target="_blank")):(p.href=f.createObjectURL(c),setTimeout(function(){f.revokeObjectURL(p.href)},4e4),setTimeout(function(){o(p)},0))}:"msSaveOrOpenBlob"in navigator?function(c,u,h){if(u=u||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(t(c,h),u);else if(r(c))i(c,u,h);else{var f=document.createElement("a");f.href=c,f.target="_blank",setTimeout(function(){o(f)})}}:function(c,u,h,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof c=="string")return i(c,u,h);var p=c.type==="application/octet-stream",C=/constructor/i.test(a.HTMLElement)||a.safari,E=/CriOS\/[\d]+/.test(navigator.userAgent);if((E||p&&C||l)&&typeof FileReader<"u"){var R=new FileReader;R.onloadend=function(){var w=R.result;w=E?w:w.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=w:location=w,f=null},R.readAsDataURL(c)}else{var I=a.URL||a.webkitURL,D=I.createObjectURL(c);f?f.location=D:location.href=D,f=null,setTimeout(function(){I.revokeObjectURL(D)},4e4)}});a.saveAs=d.saveAs=d,n.exports=d})})(ft)),ft.exports}var ha=da(),mt={exports:{}};var fa=mt.exports,Gi;function ma(){return Gi||(Gi=1,(function(n,e){((t,i)=>{n.exports=i()})(fa,function t(){var i=typeof self<"u"?self:typeof window<"u"?window:i!==void 0?i:{},r=!i.document&&!!i.postMessage,o=i.IS_PAPA_WORKER||!1,a={},l=0,d={};function c(m){return m.charCodeAt(0)===65279?m.slice(1):m}function u(m){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(g){var _=S(g);_.chunkSize=parseInt(_.chunkSize),g.step||g.chunk||(_.chunkSize=null),this._handle=new E(_),(this._handle.streamer=this)._config=_}).call(this,m),this.parseChunk=function(g,_){var v=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<v){let q=this._config.newline;q||(x=this._config.quoteChar||'"',q=this._handle.guessLineEndings(g,x)),g=[...g.split(q).slice(v)].join(q)}this.isFirstChunk&&K(this._config.beforeFirstChunk)&&(x=this._config.beforeFirstChunk(g))!==void 0&&(g=x),this.isFirstChunk=!1,this._halted=!1;var v=this._partialLine+g,x=(this._partialLine="",this._handle.parse(v,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(g=x.meta.cursor,v=(this._finished||(this._partialLine=v.substring(g-this._baseIndex),this._baseIndex=g),x&&x.data&&(this._rowCount+=x.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)i.postMessage({results:x,workerId:d.WORKER_ID,finished:v});else if(K(this._config.chunk)&&!_){if(this._config.chunk(x,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=x=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(x.data),this._completeResults.errors=this._completeResults.errors.concat(x.errors),this._completeResults.meta=x.meta),this._completed||!v||!K(this._config.complete)||x&&x.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),v||x&&x.meta.paused||this._nextChunk(),x}this._halted=!0},this._sendError=function(g){K(this._config.error)?this._config.error(g):o&&this._config.error&&i.postMessage({workerId:d.WORKER_ID,error:g,finished:!1})}}function h(m){var g;(m=m||{}).chunkSize||(m.chunkSize=d.RemoteChunkSize),u.call(this,m),this._nextChunk=r?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(_){this._input=_,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(g=new XMLHttpRequest,this._config.withCredentials&&(g.withCredentials=this._config.withCredentials),r||(g.onload=U(this._chunkLoaded,this),g.onerror=U(this._chunkError,this)),g.ontimeout=U(this._chunkTimeout,this),g.open(this._config.downloadRequestBody?"POST":"GET",this._input,!r),this._config.downloadTimeout&&!r&&(g.timeout=this._config.downloadTimeout),this._config.downloadRequestHeaders){var _,v=this._config.downloadRequestHeaders;for(_ in v)g.setRequestHeader(_,v[_])}var x;this._config.chunkSize&&(x=this._start+this._config.chunkSize-1,g.setRequestHeader("Range","bytes="+this._start+"-"+x));try{g.send(this._config.downloadRequestBody)}catch(q){this._chunkError(q.message)}r&&g.status===0&&this._chunkError()}},this._chunkLoaded=function(){g.readyState===4&&(g.status<200||400<=g.status?this._chunkError():(this._start+=this._config.chunkSize||g.responseText.length,this._finished=!this._config.chunkSize||this._start>=(_=>(_=_.getResponseHeader("Content-Range"))!==null?parseInt(_.substring(_.lastIndexOf("/")+1)):-1)(g),this.parseChunk(g.responseText)))},this._chunkError=function(_){_=g.statusText||_,this._sendError(new Error(_))},this._chunkTimeout=function(){this._chunkError("Request timed out after "+this._config.downloadTimeout+"ms")}}function f(m){(m=m||{}).chunkSize||(m.chunkSize=d.LocalChunkSize),u.call(this,m);var g,_,v=typeof FileReader<"u";this.stream=function(x){this._input=x,_=x.slice||x.webkitSlice||x.mozSlice,v?((g=new FileReader).onload=U(this._chunkLoaded,this),g.onerror=U(this._chunkError,this)):g=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var x=this._input,q=(this._config.chunkSize&&(q=Math.min(this._start+this._config.chunkSize,this._input.size),x=_.call(x,this._start,q)),g.readAsText(x,this._config.encoding));v||this._chunkLoaded({target:{result:q}})},this._chunkLoaded=function(x){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(x.target.result)},this._chunkError=function(){this._sendError(g.error)}}function p(m){var g;u.call(this,m=m||{}),this.stream=function(_){return g=_,this._nextChunk()},this._nextChunk=function(){var _,v;if(!this._finished)return _=this._config.chunkSize,g=_?(v=g.substring(0,_),g.substring(_)):(v=g,""),this._finished=!g,this.parseChunk(v)}}function C(m){u.call(this,m=m||{});var g=[],_=!0,v=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(x){this._input=x,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){v&&g.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),g.length?this.parseChunk(g.shift()):_=!0},this._streamData=U(function(x){try{g.push(typeof x=="string"?x:x.toString(this._config.encoding)),_&&(_=!1,this._checkIsFinished(),this.parseChunk(g.shift()))}catch(q){this._streamError(q)}},this),this._streamError=U(function(x){this._streamCleanUp(),this._sendError(x)},this),this._streamEnd=U(function(){this._streamCleanUp(),v=!0,this._streamData("")},this),this._streamCleanUp=U(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function E(m){var g,_,v,x,q=Math.pow(2,53),P=-q,W=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,j=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,F=this,b=0,T=0,A=!1,k=!1,z=[],N={data:[],errors:[],meta:{}};function ae(L){return m.skipEmptyLines==="greedy"?L.join("").trim()==="":L.length===1&&L[0].length===0}function ne(){if(N&&v&&(H("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+d.DefaultDelimiter+"'"),v=!1),m.skipEmptyLines&&(N.data=N.data.filter(function(M){return!ae(M)})),ce()){let M=function(J){z.push(J)};if(N)if(Array.isArray(N.data[0])){for(var L=0;ce()&&L<N.data.length;L++)N.data[L].forEach(M);N.data.splice(0,1)}else N.data.forEach(M)}function B(M,J){for(var de=m.header?{}:[],ee=0;ee<M.length;ee++){var re=ee,Z=M[ee],Z=((Re,X)=>(ue=>(m.dynamicTypingFunction&&m.dynamicTyping[ue]===void 0&&(m.dynamicTyping[ue]=m.dynamicTypingFunction(ue)),(m.dynamicTyping[ue]||m.dynamicTyping)===!0))(Re)?X==="true"||X==="TRUE"||X!=="false"&&X!=="FALSE"&&((ue=>{if(W.test(ue)&&(ue=parseFloat(ue),P<ue&&ue<q))return 1})(X)?parseFloat(X):j.test(X)?new Date(X):X===""?null:X):X)(re=m.header?ee>=z.length?"__parsed_extra":z[ee]:re,Z=m.transform?m.transform(Z,re):Z);re==="__parsed_extra"?(de[re]=de[re]||[],de[re].push(Z)):de[re]=Z}return m.header&&(ee>z.length?H("FieldMismatch","TooManyFields","Too many fields: expected "+z.length+" fields but parsed "+ee,T+J):ee<z.length&&H("FieldMismatch","TooFewFields","Too few fields: expected "+z.length+" fields but parsed "+ee,T+J)),de}var Y;N&&(m.header||m.dynamicTyping||m.transform)&&(Y=1,!N.data.length||Array.isArray(N.data[0])?(N.data=N.data.map(B),Y=N.data.length):N.data=B(N.data,0),m.header&&N.meta&&(N.meta.fields=z),T+=Y)}function ce(){return m.header&&z.length===0}function H(L,B,Y,M){L={type:L,code:B,message:Y},M!==void 0&&(L.row=M),N.errors.push(L)}K(m.step)&&(x=m.step,m.step=function(L){N=L,ce()?ne():(ne(),N.data.length!==0&&(b+=L.data.length,m.preview&&b>m.preview?_.abort():(N.data=N.data[0],x(N,F))))}),this.parse=function(L,B,Y){var M=m.quoteChar||'"',M=(m.newline||(m.newline=this.guessLineEndings(L,M)),v=!1,m.delimiter?K(m.delimiter)&&(m.delimiter=m.delimiter(L),N.meta.delimiter=m.delimiter):((M=((J,de,ee,re,Z)=>{var Re,X,ue,Ae;Z=Z||[","," ","|",";",d.RECORD_SEP,d.UNIT_SEP];for(var Le=0;Le<Z.length;Le++){for(var Ce,qe=Z[Le],fe=0,Ee=0,he=0,pe=(ue=void 0,new I({comments:re,delimiter:qe,newline:de,preview:10}).parse(J)),Ie=0;Ie<pe.data.length;Ie++)ee&&ae(pe.data[Ie])?he++:(Ce=pe.data[Ie].length,Ee+=Ce,ue===void 0?ue=Ce:0<Ce&&(fe+=Math.abs(Ce-ue),ue=Ce));0<pe.data.length&&(Ee/=pe.data.length-he),1.99<Ee&&(X===void 0||fe<X||fe===X&&Ae<Ee)&&(X=fe,Re=qe,Ae=Ee)}return{successful:!!(m.delimiter=Re),bestDelimiter:Re}})(L,m.newline,m.skipEmptyLines,m.comments,m.delimitersToGuess)).successful?m.delimiter=M.bestDelimiter:(v=!0,m.delimiter=d.DefaultDelimiter),N.meta.delimiter=m.delimiter),S(m));return M.header=ce(),m.preview&&m.header&&M.preview++,g=L,_=new I(M),N=_.parse(g,B,Y),ne(),A?{meta:{paused:!0}}:N||{meta:{paused:!1}}},this.paused=function(){return A},this.pause=function(){A=!0,_.abort(),g=K(m.chunk)?"":g.substring(_.getCharIndex())},this.resume=function(){F.streamer._halted?(A=!1,F.streamer.parseChunk(g,!0)):setTimeout(F.resume,3)},this.aborted=function(){return k},this.abort=function(){k=!0,_.abort(),N.meta.aborted=!0,K(m.complete)&&m.complete(N),g=""},this.guessLineEndings=function(J,M){J=J.substring(0,1048576);var M=new RegExp(R(M)+"([^]*?)"+R(M),"gm"),Y=(J=J.replace(M,"")).split("\r"),M=J.split(`
1
+ (function(Q,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue"),require("@kong-ui-public/analytics-utilities"),require("@kong/icons"),require("@kong-ui-public/analytics-chart"),require("swrv"),require("@kong-ui-public/analytics-metric-provider"),require("ag-grid-vue3"),require("ag-grid-community"),require("@kong-ui-public/i18n"),require("@kong-ui-public/analytics-config-store"),require("@kong/kongponents"),require("vue-echarts"),require("echarts/core"),require("echarts/renderers"),require("echarts/components"),require("echarts/charts"),require("axios"),require("@kong-ui-public/analytics-geo-map")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/analytics-utilities","@kong/icons","@kong-ui-public/analytics-chart","swrv","@kong-ui-public/analytics-metric-provider","ag-grid-vue3","ag-grid-community","@kong-ui-public/i18n","@kong-ui-public/analytics-config-store","@kong/kongponents","vue-echarts","echarts/core","echarts/renderers","echarts/components","echarts/charts","axios","@kong-ui-public/analytics-geo-map"],s):(Q=typeof globalThis<"u"?globalThis:Q||self,s(Q["kong-ui-public-dashboard-renderer"]={},Q.Vue,Q["kong-ui-public-analytics-utilities"],Q.KongIcons,Q["kong-ui-public-analytics-chart"],Q.swrv,Q["kong-ui-public-analytics-metric-provider"],Q.AgGridVue,Q.agGridCommunity,Q["kong-ui-public-i18n"],Q["kong-ui-public-analytics-config-store"],Q.Kongponents,Q.VueECharts,Q.echarts,Q.echarts,Q.echarts,Q.echarts,Q.axios,Q["kong-ui-public-analytics-geo-map"]))})(this,(function(Q,s,ie,se,Ce,oi,ai,Hn,Xe,lt,we,Gn,$n,Tt,Fn,ct,li,jg,ci){"use strict";const Wn=n=>{const e=n.length;let t=5381;for(let i=0;i<e;i++)t=t*33^n.charCodeAt(i);return t>>>0},Vn="#0044f4",ui="#6c7489",Yn="#d60027",Xn="#ffc400",jn="#bee2ff",Qn="#8fc1ff",Zn="#5f9aff",Jn="#306fff",er="#b5ffee",tr="#00fabe",ir="#00d6a4",nr="#00a17b",rr="#007d60",sr="#005944",or="#b5ffee",ar="#00fabe",lr="#b5ffee",cr="#00a17b",ur="#fff296",dr="#ffe04b",hr="#ffc400",fr="#b37600",mr="#995c00",pr="#804400",gr="#fff296",_r="#ffe04b",yr="#ffc2b3",Rr="#ff9877",Cr="#ff723c",Er="#f75008",Or="#d13500",br="#a31f00",wr="#ffc2b3",Tr="#ff9877",vr="#ff723c",Sr="#f75008",xr="#d13500",Ir="#a31f00",Dr="#ffc2b3",kr="#ff9877",Nr="#ff723c",Ar="#f75008",Lr="#d13500",Ur="#a31f00",Kr="#ffc2b3",Mr="#ff9877",Br="#ff723c",zr="#f75008",Pr="#d13500",qr="#a31f00",Hr="#ffc2b3",Gr="#ff9877",$r="#ff723c",Fr="#f75008",Wr="#d13500",Vr="#ffabab",Yr="#ff7272",Xr="#ff3954",jr="#f50045",Qr="#d60027",Zr="#ad000e",Jr="#ffabab",es="#ff7272",ts="#ff3954",is="#f50045",ns="#d60027",rs="#eefaff",ss="#ecfffb",os="#fffce0",as="#fff1ef",ls="#ffe5e5",cs="#5f9aff",us="#00d6a4",ds="#ffc400",hs="#ff723c",fs="#ff3954",ms={100:jn,101:Qn,102:Zn,103:Jn,200:er,201:tr,202:ir,203:nr,204:rr,205:sr,206:or,207:ar,208:lr,226:cr,300:ur,301:dr,302:hr,303:fr,304:mr,305:pr,307:gr,308:_r,400:yr,401:Rr,402:Cr,403:Er,404:Or,405:br,406:wr,407:Tr,408:vr,409:Sr,410:xr,411:Ir,412:Dr,413:kr,414:Nr,415:Ar,416:Lr,417:Ur,418:Kr,421:Mr,422:Br,423:zr,424:Pr,425:qr,426:Hr,428:Gr,429:$r,431:Fr,451:Wr,500:Vr,501:Yr,502:Xr,503:jr,504:Qr,505:Zr,506:Jr,507:es,508:ts,510:is,511:ns},ps={100:rs,200:ss,300:os,400:as,500:ls},di={"1XX":cs,"2XX":us,"3XX":ds,"4XX":hs,"5XX":fs},gs={error:Yn,warning:Xn,empty:"#9DA99D",neutral:ui,____OTHER____:Vn},vt=["#0076F4","#00819D","#00A17B","#8A50FF","#FF3C99","#FF6D3C","#B3A100"],St=["#5485BA","#087D96","#3D8776","#7654BA","#A1406F","#BF5430","#B5A72C"],_s=n=>Wn(n),ys=({theme:n="light"}={})=>n==="dark"?St:vt,hi=({discriminator:n,theme:e="light"})=>{const t=Math.abs(Math.floor(n));return e==="dark"?St[t%St.length]:vt[t%vt.length]},je=({state:n})=>gs[n]??ui,Rs=({statusCode:n})=>{const e=typeof n=="number"?n:Number.parseInt(n,10),t=`${e}`,i=`${Math.floor(e/100)*100}`;return ms[t]??ps[i]??je({state:"neutral"})},Cs=({group:n})=>di[n]?di[n]:je({state:"neutral"}),Es=({discriminator:n=void 0,state:e=void 0,dimension:t=void 0,dimensionValue:i=void 0,metric:r=void 0,coordinator:o=void 0,order:a=void 0,chartUuid:l=void 0,customDimensionColors:d=void 0})=>{let c="light";if(s.hasInjectionContext()&&(c=s.inject("app:konnectColorMode",s.computed(()=>"light")).value),e!==void 0)return je({state:e});if(i!==void 0&&d!==void 0&&d[i])return d[i];if(i&&["empty","____OTHER____"].includes(i))return je({state:i});if(t!==void 0&&i!==void 0){if(t==="status_code")return Rs({statusCode:i});if(t==="status_code_grouped")return Cs({group:i})}if(n!==void 0)return hi({discriminator:n,theme:c});if(t||i||r){const u=`${t??""}${i??""}${r??""}`,h=o?o.resolveDiscriminator({name:u,order:a,chartUuid:l,theme:c}):_s(u);return hi({discriminator:h,theme:c})}return je({state:"neutral"})},Os="__no_chart__";function bs(){const n=new Map,e=new Map,t=new Map,i=o=>{e.set(o,(e.get(o)??0)+1)},r=(o,a)=>{let l=-1,d=1/0;for(let c=0;c<o;c++){if(a.has(c))continue;const u=e.get(c)??0;u<d&&(l=c,d=u)}return l!==-1?l:o<1?0:r(o,new Set)};return{resolveDiscriminator:({name:o,order:a,chartUuid:l,theme:d})=>{const c=l??Os,u=a??null,h=ys({theme:d});let f;if(n.has(o))f=n.get(o);else{const g=new Set,R=t.get(c);u!==null&&R?.order!==null&&R?.order!==void 0&&u===R.order+1&&g.add(R.index);const E=h.length;f=r(E,g),n.set(o,f),i(f)}return t.set(c,{order:u,index:f}),f},reset:()=>{n.clear(),e.clear(),t.clear()}}}function ws(){const n=s.ref(null),e=s.ref(null),t=s.ref(null),i=s.ref(null),r=s.ref(null),o=300,a=300,l=10,d=bs(),c=({chartUuid:h,timestamp:f=null,dimension:g=null,dimensionValue:R=null,metric:E=null})=>{n.value=h,e.value=f,t.value=g,i.value=R,r.value=E},u=({chartUuid:h})=>{n.value===h&&(n.value=null,e.value=null,t.value=null,i.value=null,r.value=null)};return{activate:c,activeChart:s.readonly(n),activeDimension:s.readonly(t),activeDimensionValue:s.readonly(i),activeMetric:s.readonly(r),activeTimestamp:s.readonly(e),deactivate:u,DIMENSION_DEBOUNCE_MS:o,METRIC_DEBOUNCE_MS:a,TIMESTAMP_DEBOUNCE_MS:l,color:d}}const Ts={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},vs=(n,e,t)=>{let i;const r=Ts[n];return typeof r=="string"?i=r:e===1?i=r.one:i=r.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+i:i+" ago":i};function xt(n){return(e={})=>{const t=e.width?String(e.width):n.defaultWidth;return n.formats[t]||n.formats[n.defaultWidth]}}const Ss={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},xs={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Is={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Ds={date:xt({formats:Ss,defaultWidth:"full"}),time:xt({formats:xs,defaultWidth:"full"}),dateTime:xt({formats:Is,defaultWidth:"full"})},ks={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ns=(n,e,t,i)=>ks[n];function Qe(n){return(e,t)=>{const i=t?.context?String(t.context):"standalone";let r;if(i==="formatting"&&n.formattingValues){const a=n.defaultFormattingWidth||n.defaultWidth,l=t?.width?String(t.width):a;r=n.formattingValues[l]||n.formattingValues[a]}else{const a=n.defaultWidth,l=t?.width?String(t.width):n.defaultWidth;r=n.values[l]||n.values[a]}const o=n.argumentCallback?n.argumentCallback(e):e;return r[o]}}const As={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Ls={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Us={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Ks={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Ms={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Bs={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},zs={ordinalNumber:(n,e)=>{const t=Number(n),i=t%100;if(i>20||i<10)switch(i%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},era:Qe({values:As,defaultWidth:"wide"}),quarter:Qe({values:Ls,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Qe({values:Us,defaultWidth:"wide"}),day:Qe({values:Ks,defaultWidth:"wide"}),dayPeriod:Qe({values:Ms,defaultWidth:"wide",formattingValues:Bs,defaultFormattingWidth:"wide"})};function Ze(n){return(e,t={})=>{const i=t.width,r=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],o=e.match(r);if(!o)return null;const a=o[0],l=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],d=Array.isArray(l)?qs(l,h=>h.test(a)):Ps(l,h=>h.test(a));let c;c=n.valueCallback?n.valueCallback(d):d,c=t.valueCallback?t.valueCallback(c):c;const u=e.slice(a.length);return{value:c,rest:u}}}function Ps(n,e){for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&e(n[t]))return t}function qs(n,e){for(let t=0;t<n.length;t++)if(e(n[t]))return t}function Hs(n){return(e,t={})=>{const i=e.match(n.matchPattern);if(!i)return null;const r=i[0],o=e.match(n.parsePattern);if(!o)return null;let a=n.valueCallback?n.valueCallback(o[0]):o[0];a=t.valueCallback?t.valueCallback(a):a;const l=e.slice(r.length);return{value:a,rest:l}}}const Gs=/^(\d+)(th|st|nd|rd)?/i,$s=/\d+/i,Fs={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Ws={any:[/^b/i,/^(a|c)/i]},Vs={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Ys={any:[/1/i,/2/i,/3/i,/4/i]},Xs={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},js={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Qs={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Zs={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Js={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},eo={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},to={ordinalNumber:Hs({matchPattern:Gs,parsePattern:$s,valueCallback:n=>parseInt(n,10)}),era:Ze({matchPatterns:Fs,defaultMatchWidth:"wide",parsePatterns:Ws,defaultParseWidth:"any"}),quarter:Ze({matchPatterns:Vs,defaultMatchWidth:"wide",parsePatterns:Ys,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Ze({matchPatterns:Xs,defaultMatchWidth:"wide",parsePatterns:js,defaultParseWidth:"any"}),day:Ze({matchPatterns:Qs,defaultMatchWidth:"wide",parsePatterns:Zs,defaultParseWidth:"any"}),dayPeriod:Ze({matchPatterns:Js,defaultMatchWidth:"any",parsePatterns:eo,defaultParseWidth:"any"})},io={code:"en-US",formatDistance:vs,formatLong:Ds,formatRelative:Ns,localize:zs,match:to,options:{weekStartsOn:0,firstWeekContainsDate:1}};let no={};function Je(){return no}const fi=6048e5,ro=864e5,mi=Symbol.for("constructDateFrom");function Ke(n,e){return typeof n=="function"?n(e):n&&typeof n=="object"&&mi in n?n[mi](e):n instanceof Date?new n.constructor(e):new Date(e)}function Te(n,e){return Ke(e||n,n)}function pi(n){const e=Te(n),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+n-+t}function so(n,...e){const t=Ke.bind(null,e.find(i=>typeof i=="object"));return e.map(t)}function gi(n,e){const t=Te(n,e?.in);return t.setHours(0,0,0,0),t}function oo(n,e,t){const[i,r]=so(t?.in,n,e),o=gi(i),a=gi(r),l=+o-pi(o),d=+a-pi(a);return Math.round((l-d)/ro)}function ao(n,e){const t=Te(n,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function lo(n,e){const t=Te(n,e?.in);return oo(t,ao(t))+1}function et(n,e){const t=Je(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,r=Te(n,e?.in),o=r.getDay(),a=(o<i?7:0)+o-i;return r.setDate(r.getDate()-a),r.setHours(0,0,0,0),r}function ut(n,e){return et(n,{...e,weekStartsOn:1})}function _i(n,e){const t=Te(n,e?.in),i=t.getFullYear(),r=Ke(t,0);r.setFullYear(i+1,0,4),r.setHours(0,0,0,0);const o=ut(r),a=Ke(t,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const l=ut(a);return t.getTime()>=o.getTime()?i+1:t.getTime()>=l.getTime()?i:i-1}function co(n,e){const t=_i(n,e),i=Ke(n,0);return i.setFullYear(t,0,4),i.setHours(0,0,0,0),ut(i)}function uo(n,e){const t=Te(n,e?.in),i=+ut(t)-+co(t);return Math.round(i/fi)+1}function yi(n,e){const t=Te(n,e?.in),i=t.getFullYear(),r=Je(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=Ke(e?.in||n,0);a.setFullYear(i+1,0,o),a.setHours(0,0,0,0);const l=et(a,e),d=Ke(e?.in||n,0);d.setFullYear(i,0,o),d.setHours(0,0,0,0);const c=et(d,e);return+t>=+l?i+1:+t>=+c?i:i-1}function ho(n,e){const t=Je(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,r=yi(n,e),o=Ke(e?.in||n,0);return o.setFullYear(r,0,i),o.setHours(0,0,0,0),et(o,e)}function fo(n,e){const t=Te(n,e?.in),i=+et(t,e)-+ho(t,e);return Math.round(i/fi)+1}function oe(n,e){const t=n<0?"-":"",i=Math.abs(n).toString().padStart(e,"0");return t+i}const Me={y(n,e){const t=n.getFullYear(),i=t>0?t:1-t;return oe(e==="yy"?i%100:i,e.length)},M(n,e){const t=n.getMonth();return e==="M"?String(t+1):oe(t+1,2)},d(n,e){return oe(n.getDate(),e.length)},a(n,e){const t=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];default:return t==="am"?"a.m.":"p.m."}},h(n,e){return oe(n.getHours()%12||12,e.length)},H(n,e){return oe(n.getHours(),e.length)},m(n,e){return oe(n.getMinutes(),e.length)},s(n,e){return oe(n.getSeconds(),e.length)},S(n,e){const t=e.length,i=n.getMilliseconds(),r=Math.trunc(i*Math.pow(10,t-3));return oe(r,e.length)}},Fe={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ri={G:function(n,e,t){const i=n.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(i,{width:"abbreviated"});case"GGGGG":return t.era(i,{width:"narrow"});default:return t.era(i,{width:"wide"})}},y:function(n,e,t){if(e==="yo"){const i=n.getFullYear(),r=i>0?i:1-i;return t.ordinalNumber(r,{unit:"year"})}return Me.y(n,e)},Y:function(n,e,t,i){const r=yi(n,i),o=r>0?r:1-r;if(e==="YY"){const a=o%100;return oe(a,2)}return e==="Yo"?t.ordinalNumber(o,{unit:"year"}):oe(o,e.length)},R:function(n,e){const t=_i(n);return oe(t,e.length)},u:function(n,e){const t=n.getFullYear();return oe(t,e.length)},Q:function(n,e,t){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"Q":return String(i);case"QQ":return oe(i,2);case"Qo":return t.ordinalNumber(i,{unit:"quarter"});case"QQQ":return t.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(i,{width:"narrow",context:"formatting"});default:return t.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,e,t){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"q":return String(i);case"qq":return oe(i,2);case"qo":return t.ordinalNumber(i,{unit:"quarter"});case"qqq":return t.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(i,{width:"narrow",context:"standalone"});default:return t.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,e,t){const i=n.getMonth();switch(e){case"M":case"MM":return Me.M(n,e);case"Mo":return t.ordinalNumber(i+1,{unit:"month"});case"MMM":return t.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(i,{width:"narrow",context:"formatting"});default:return t.month(i,{width:"wide",context:"formatting"})}},L:function(n,e,t){const i=n.getMonth();switch(e){case"L":return String(i+1);case"LL":return oe(i+1,2);case"Lo":return t.ordinalNumber(i+1,{unit:"month"});case"LLL":return t.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(i,{width:"narrow",context:"standalone"});default:return t.month(i,{width:"wide",context:"standalone"})}},w:function(n,e,t,i){const r=fo(n,i);return e==="wo"?t.ordinalNumber(r,{unit:"week"}):oe(r,e.length)},I:function(n,e,t){const i=uo(n);return e==="Io"?t.ordinalNumber(i,{unit:"week"}):oe(i,e.length)},d:function(n,e,t){return e==="do"?t.ordinalNumber(n.getDate(),{unit:"date"}):Me.d(n,e)},D:function(n,e,t){const i=lo(n);return e==="Do"?t.ordinalNumber(i,{unit:"dayOfYear"}):oe(i,e.length)},E:function(n,e,t){const i=n.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(i,{width:"short",context:"formatting"});default:return t.day(i,{width:"wide",context:"formatting"})}},e:function(n,e,t,i){const r=n.getDay(),o=(r-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return oe(o,2);case"eo":return t.ordinalNumber(o,{unit:"day"});case"eee":return t.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(r,{width:"short",context:"formatting"});default:return t.day(r,{width:"wide",context:"formatting"})}},c:function(n,e,t,i){const r=n.getDay(),o=(r-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return oe(o,e.length);case"co":return t.ordinalNumber(o,{unit:"day"});case"ccc":return t.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(r,{width:"narrow",context:"standalone"});case"cccccc":return t.day(r,{width:"short",context:"standalone"});default:return t.day(r,{width:"wide",context:"standalone"})}},i:function(n,e,t){const i=n.getDay(),r=i===0?7:i;switch(e){case"i":return String(r);case"ii":return oe(r,e.length);case"io":return t.ordinalNumber(r,{unit:"day"});case"iii":return t.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(i,{width:"short",context:"formatting"});default:return t.day(i,{width:"wide",context:"formatting"})}},a:function(n,e,t){const r=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(r,{width:"narrow",context:"formatting"});default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(n,e,t){const i=n.getHours();let r;switch(i===12?r=Fe.noon:i===0?r=Fe.midnight:r=i/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(r,{width:"narrow",context:"formatting"});default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(n,e,t){const i=n.getHours();let r;switch(i>=17?r=Fe.evening:i>=12?r=Fe.afternoon:i>=4?r=Fe.morning:r=Fe.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(r,{width:"narrow",context:"formatting"});default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(n,e,t){if(e==="ho"){let i=n.getHours()%12;return i===0&&(i=12),t.ordinalNumber(i,{unit:"hour"})}return Me.h(n,e)},H:function(n,e,t){return e==="Ho"?t.ordinalNumber(n.getHours(),{unit:"hour"}):Me.H(n,e)},K:function(n,e,t){const i=n.getHours()%12;return e==="Ko"?t.ordinalNumber(i,{unit:"hour"}):oe(i,e.length)},k:function(n,e,t){let i=n.getHours();return i===0&&(i=24),e==="ko"?t.ordinalNumber(i,{unit:"hour"}):oe(i,e.length)},m:function(n,e,t){return e==="mo"?t.ordinalNumber(n.getMinutes(),{unit:"minute"}):Me.m(n,e)},s:function(n,e,t){return e==="so"?t.ordinalNumber(n.getSeconds(),{unit:"second"}):Me.s(n,e)},S:function(n,e){return Me.S(n,e)},X:function(n,e,t){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return Ei(i);case"XXXX":case"XX":return Pe(i);default:return Pe(i,":")}},x:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"x":return Ei(i);case"xxxx":case"xx":return Pe(i);default:return Pe(i,":")}},O:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Ci(i,":");default:return"GMT"+Pe(i,":")}},z:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Ci(i,":");default:return"GMT"+Pe(i,":")}},t:function(n,e,t){const i=Math.trunc(+n/1e3);return oe(i,e.length)},T:function(n,e,t){return oe(+n,e.length)}};function Ci(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),r=Math.trunc(i/60),o=i%60;return o===0?t+String(r):t+String(r)+e+oe(o,2)}function Ei(n,e){return n%60===0?(n>0?"-":"+")+oe(Math.abs(n)/60,2):Pe(n,e)}function Pe(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),r=oe(Math.trunc(i/60),2),o=oe(i%60,2);return t+r+e+o}const Oi=(n,e)=>{switch(n){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},bi=(n,e)=>{switch(n){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},mo={p:bi,P:(n,e)=>{const t=n.match(/(P+)(p+)?/)||[],i=t[1],r=t[2];if(!r)return Oi(n,e);let o;switch(i){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;default:o=e.dateTime({width:"full"});break}return o.replace("{{date}}",Oi(i,e)).replace("{{time}}",bi(r,e))}},po=/^D+$/,go=/^Y+$/,_o=["D","DD","YY","YYYY"];function yo(n){return po.test(n)}function Ro(n){return go.test(n)}function Co(n,e,t){const i=Eo(n,e,t);if(console.warn(i),_o.includes(n))throw new RangeError(i)}function Eo(n,e,t){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${e}\`) for formatting ${i} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function Oo(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function bo(n){return!(!Oo(n)&&typeof n!="number"||isNaN(+Te(n)))}const wo=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,To=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,vo=/^'([^]*?)'?$/,So=/''/g,xo=/[a-zA-Z]/;function Io(n,e,t){const i=Je(),r=t?.locale??i.locale??io,o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,l=Te(n,t?.in);if(!bo(l))throw new RangeError("Invalid time value");let d=e.match(To).map(u=>{const h=u[0];if(h==="p"||h==="P"){const f=mo[h];return f(u,r.formatLong)}return u}).join("").match(wo).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const h=u[0];if(h==="'")return{isToken:!1,value:Do(u)};if(Ri[h])return{isToken:!0,value:u};if(h.match(xo))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:u}});r.localize.preprocessor&&(d=r.localize.preprocessor(l,d));const c={firstWeekContainsDate:o,weekStartsOn:a,locale:r};return d.map(u=>{if(!u.isToken)return u.value;const h=u.value;(!t?.useAdditionalWeekYearTokens&&Ro(h)||!t?.useAdditionalDayOfYearTokens&&yo(h))&&Co(h,e,String(n));const f=Ri[h[0]];return f(l,h,r.localize,c)}).join("")}function Do(n){const e=n.match(vo);return e?e[1].replace(So,"'"):n}function ko(){return Object.assign({},Je())}function wi(n,e,t){const i=ko(),r=Lo(n,t.timeZone,t.locale??i.locale);return"formatToParts"in r?No(r,e):Ao(r,e)}function No(n,e){const t=n.formatToParts(e);for(let i=t.length-1;i>=0;--i)if(t[i].type==="timeZoneName")return t[i].value}function Ao(n,e){const t=n.format(e).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(t);return i?i[0].substr(1):""}function Lo(n,e,t){return new Intl.DateTimeFormat(t?[t.code,"en-US"]:void 0,{timeZone:e,timeZoneName:n})}function Uo(n,e){const t=Po(e);return"formatToParts"in t?Mo(t,n):Bo(t,n)}const Ko={year:0,month:1,day:2,hour:3,minute:4,second:5};function Mo(n,e){try{const t=n.formatToParts(e),i=[];for(let r=0;r<t.length;r++){const o=Ko[t[r].type];o!==void 0&&(i[o]=parseInt(t[r].value,10))}return i}catch(t){if(t instanceof RangeError)return[NaN];throw t}}function Bo(n,e){const t=n.format(e),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(t);return[parseInt(i[3],10),parseInt(i[1],10),parseInt(i[2],10),parseInt(i[4],10),parseInt(i[5],10),parseInt(i[6],10)]}const It={},Ti=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),zo=Ti==="06/25/2014, 00:00:00"||Ti==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";function Po(n){return It[n]||(It[n]=zo?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),It[n]}function vi(n,e,t,i,r,o,a){const l=new Date(0);return l.setUTCFullYear(n,e,t),l.setUTCHours(i,r,o,a),l}const Si=36e5,qo=6e4,Dt={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function kt(n,e,t){if(!n)return 0;let i=Dt.timezoneZ.exec(n);if(i)return 0;let r,o;if(i=Dt.timezoneHH.exec(n),i)return r=parseInt(i[1],10),xi(r)?-(r*Si):NaN;if(i=Dt.timezoneHHMM.exec(n),i){r=parseInt(i[2],10);const a=parseInt(i[3],10);return xi(r,a)?(o=Math.abs(r)*Si+a*qo,i[1]==="+"?-o:o):NaN}if($o(n)){e=new Date(e||Date.now());const a=t?e:Ho(e),l=Nt(a,n);return-(t?l:Go(e,l,n))}return NaN}function Ho(n){return vi(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())}function Nt(n,e){const t=Uo(n,e),i=vi(t[0],t[1]-1,t[2],t[3]%24,t[4],t[5],0).getTime();let r=n.getTime();const o=r%1e3;return r-=o>=0?o:1e3+o,i-r}function Go(n,e,t){let r=n.getTime()-e;const o=Nt(new Date(r),t);if(e===o)return e;r-=o-e;const a=Nt(new Date(r),t);return o===a?o:Math.max(o,a)}function xi(n,e){return-23<=n&&n<=23&&(e==null||0<=e&&e<=59)}const Ii={};function $o(n){if(Ii[n])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:n}),Ii[n]=!0,!0}catch{return!1}}const Fo=60*1e3,Wo={X:function(n,e,t){const i=At(t.timeZone,n);if(i===0)return"Z";switch(e){case"X":return Di(i);case"XXXX":case"XX":return We(i);default:return We(i,":")}},x:function(n,e,t){const i=At(t.timeZone,n);switch(e){case"x":return Di(i);case"xxxx":case"xx":return We(i);default:return We(i,":")}},O:function(n,e,t){const i=At(t.timeZone,n);switch(e){case"O":case"OO":case"OOO":return"GMT"+Vo(i,":");default:return"GMT"+We(i,":")}},z:function(n,e,t){switch(e){case"z":case"zz":case"zzz":return wi("short",n,t);default:return wi("long",n,t)}}};function At(n,e){const t=n?kt(n,e,!0)/Fo:e?.getTimezoneOffset()??0;if(Number.isNaN(t))throw new RangeError("Invalid time zone specified: "+n);return t}function dt(n,e){const t=n<0?"-":"";let i=Math.abs(n).toString();for(;i.length<e;)i="0"+i;return t+i}function We(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),r=dt(Math.floor(i/60),2),o=dt(Math.floor(i%60),2);return t+r+e+o}function Di(n,e){return n%60===0?(n>0?"-":"+")+dt(Math.abs(n)/60,2):We(n,e)}function Vo(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),r=Math.floor(i/60),o=i%60;return o===0?t+String(r):t+String(r)+e+dt(o,2)}function ki(n){const e=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return e.setUTCFullYear(n.getFullYear()),+n-+e}const Yo=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Lt=36e5,Ni=6e4,Xo=2,ge={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Yo};function Ai(n,e={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(n===null)return new Date(NaN);const t=e.additionalDigits==null?Xo:Number(e.additionalDigits);if(t!==2&&t!==1&&t!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]")return new Date(n.getTime());if(typeof n=="number"||Object.prototype.toString.call(n)==="[object Number]")return new Date(n);if(Object.prototype.toString.call(n)!=="[object String]")return new Date(NaN);const i=jo(n),{year:r,restDateString:o}=Qo(i.date,t),a=Zo(o,r);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const l=a.getTime();let d=0,c;if(i.time&&(d=Jo(i.time),d===null||isNaN(d)))return new Date(NaN);if(i.timeZone||e.timeZone){if(c=kt(i.timeZone||e.timeZone,new Date(l+d)),isNaN(c))return new Date(NaN)}else c=ki(new Date(l+d)),c=ki(new Date(l+d+c));return new Date(l+d+c)}else return new Date(NaN)}function jo(n){const e={};let t=ge.dateTimePattern.exec(n),i;if(t?(e.date=t[1],i=t[3]):(t=ge.datePattern.exec(n),t?(e.date=t[1],i=t[2]):(e.date=null,i=n)),i){const r=ge.timeZone.exec(i);r?(e.time=i.replace(r[1],""),e.timeZone=r[1].trim()):e.time=i}return e}function Qo(n,e){if(n){const t=ge.YYY[e],i=ge.YYYYY[e];let r=ge.YYYY.exec(n)||i.exec(n);if(r){const o=r[1];return{year:parseInt(o,10),restDateString:n.slice(o.length)}}if(r=ge.YY.exec(n)||t.exec(n),r){const o=r[1];return{year:parseInt(o,10)*100,restDateString:n.slice(o.length)}}}return{year:null}}function Zo(n,e){if(e===null)return null;let t,i,r;if(!n||!n.length)return t=new Date(0),t.setUTCFullYear(e),t;let o=ge.MM.exec(n);if(o)return t=new Date(0),i=parseInt(o[1],10)-1,Ki(e,i)?(t.setUTCFullYear(e,i),t):new Date(NaN);if(o=ge.DDD.exec(n),o){t=new Date(0);const a=parseInt(o[1],10);return ia(e,a)?(t.setUTCFullYear(e,0,a),t):new Date(NaN)}if(o=ge.MMDD.exec(n),o){t=new Date(0),i=parseInt(o[1],10)-1;const a=parseInt(o[2],10);return Ki(e,i,a)?(t.setUTCFullYear(e,i,a),t):new Date(NaN)}if(o=ge.Www.exec(n),o)return r=parseInt(o[1],10)-1,Mi(r)?Li(e,r):new Date(NaN);if(o=ge.WwwD.exec(n),o){r=parseInt(o[1],10)-1;const a=parseInt(o[2],10)-1;return Mi(r,a)?Li(e,r,a):new Date(NaN)}return null}function Jo(n){let e,t,i=ge.HH.exec(n);if(i)return e=parseFloat(i[1].replace(",",".")),Ut(e)?e%24*Lt:NaN;if(i=ge.HHMM.exec(n),i)return e=parseInt(i[1],10),t=parseFloat(i[2].replace(",",".")),Ut(e,t)?e%24*Lt+t*Ni:NaN;if(i=ge.HHMMSS.exec(n),i){e=parseInt(i[1],10),t=parseInt(i[2],10);const r=parseFloat(i[3].replace(",","."));return Ut(e,t,r)?e%24*Lt+t*Ni+r*1e3:NaN}return null}function Li(n,e,t){e=e||0,t=t||0;const i=new Date(0);i.setUTCFullYear(n,0,4);const r=i.getUTCDay()||7,o=e*7+t+1-r;return i.setUTCDate(i.getUTCDate()+o),i}const ea=[31,28,31,30,31,30,31,31,30,31,30,31],ta=[31,29,31,30,31,30,31,31,30,31,30,31];function Ui(n){return n%400===0||n%4===0&&n%100!==0}function Ki(n,e,t){if(e<0||e>11)return!1;if(t!=null){if(t<1)return!1;const i=Ui(n);if(i&&t>ta[e]||!i&&t>ea[e])return!1}return!0}function ia(n,e){if(e<1)return!1;const t=Ui(n);return!(t&&e>366||!t&&e>365)}function Mi(n,e){return!(n<0||n>52||e!=null&&(e<0||e>6))}function Ut(n,e,t){return!(n<0||n>=25||e!=null&&(e<0||e>=60)||t!=null&&(t<0||t>=60))}const na=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Kt(n,e,t={}){e=String(e);const i=e.match(na);if(i){const r=Ai(t.originalDate||n,t);e=i.reduce(function(o,a){if(a[0]==="'")return o;const l=o.indexOf(a),d=o[l-1]==="'",c=o.replace(a,"'"+Wo[a[0]](r,a,t)+"'");return d?c.substring(0,l-1)+c.substring(l+1):c},e)}return Io(n,e,t)}function ra(n,e,t){n=Ai(n,t);const i=kt(e,n,!0),r=new Date(n.getTime()-i),o=new Date(0);return o.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),o.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),o}function sa(n,e,t,i){return i={...i,timeZone:e,originalDate:n},Kt(ra(n,e,{timeZone:i.timeZone}),t,i)}const Mt="#6c7489",oa="768px",Bi="12px",aa="16px",zi="20px",Pi="32px",la="12px",qi="20px";var ht=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ca(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ft={exports:{}},ua=ft.exports,Hi;function da(){return Hi||(Hi=1,(function(n,e){(function(t,i){i()})(ua,function(){function t(c,u){return typeof u>"u"?u={autoBom:!1}:typeof u!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type)?new Blob(["\uFEFF",c],{type:c.type}):c}function i(c,u,h){var f=new XMLHttpRequest;f.open("GET",c),f.responseType="blob",f.onload=function(){d(f.response,u,h)},f.onerror=function(){console.error("could not download file")},f.send()}function r(c){var u=new XMLHttpRequest;u.open("HEAD",c,!1);try{u.send()}catch{}return 200<=u.status&&299>=u.status}function o(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var u=document.createEvent("MouseEvents");u.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(u)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof ht=="object"&&ht.global===ht?ht:void 0,l=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),d=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!l?function(c,u,h){var f=a.URL||a.webkitURL,g=document.createElement("a");u=u||c.name||"download",g.download=u,g.rel="noopener",typeof c=="string"?(g.href=c,g.origin===location.origin?o(g):r(g.href)?i(c,u,h):o(g,g.target="_blank")):(g.href=f.createObjectURL(c),setTimeout(function(){f.revokeObjectURL(g.href)},4e4),setTimeout(function(){o(g)},0))}:"msSaveOrOpenBlob"in navigator?function(c,u,h){if(u=u||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(t(c,h),u);else if(r(c))i(c,u,h);else{var f=document.createElement("a");f.href=c,f.target="_blank",setTimeout(function(){o(f)})}}:function(c,u,h,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof c=="string")return i(c,u,h);var g=c.type==="application/octet-stream",R=/constructor/i.test(a.HTMLElement)||a.safari,E=/CriOS\/[\d]+/.test(navigator.userAgent);if((E||g&&R||l)&&typeof FileReader<"u"){var C=new FileReader;C.onloadend=function(){var I=C.result;I=E?I:I.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=I:location=I,f=null},C.readAsDataURL(c)}else{var v=a.URL||a.webkitURL,k=v.createObjectURL(c);f?f.location=k:location.href=k,f=null,setTimeout(function(){v.revokeObjectURL(k)},4e4)}});a.saveAs=d.saveAs=d,n.exports=d})})(ft)),ft.exports}var ha=da(),mt={exports:{}};var fa=mt.exports,Gi;function ma(){return Gi||(Gi=1,(function(n,e){((t,i)=>{n.exports=i()})(fa,function t(){var i=typeof self<"u"?self:typeof window<"u"?window:i!==void 0?i:{},r=!i.document&&!!i.postMessage,o=i.IS_PAPA_WORKER||!1,a={},l=0,d={};function c(m){return m.charCodeAt(0)===65279?m.slice(1):m}function u(m){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(p){var _=x(p);_.chunkSize=parseInt(_.chunkSize),p.step||p.chunk||(_.chunkSize=null),this._handle=new E(_),(this._handle.streamer=this)._config=_}).call(this,m),this.parseChunk=function(p,_){var T=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<T){let q=this._config.newline;q||(S=this._config.quoteChar||'"',q=this._handle.guessLineEndings(p,S)),p=[...p.split(q).slice(T)].join(q)}this.isFirstChunk&&U(this._config.beforeFirstChunk)&&(S=this._config.beforeFirstChunk(p))!==void 0&&(p=S),this.isFirstChunk=!1,this._halted=!1;var T=this._partialLine+p,S=(this._partialLine="",this._handle.parse(T,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(p=S.meta.cursor,T=(this._finished||(this._partialLine=T.substring(p-this._baseIndex),this._baseIndex=p),S&&S.data&&(this._rowCount+=S.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)i.postMessage({results:S,workerId:d.WORKER_ID,finished:T});else if(U(this._config.chunk)&&!_){if(this._config.chunk(S,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=S=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(S.data),this._completeResults.errors=this._completeResults.errors.concat(S.errors),this._completeResults.meta=S.meta),this._completed||!T||!U(this._config.complete)||S&&S.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),T||S&&S.meta.paused||this._nextChunk(),S}this._halted=!0},this._sendError=function(p){U(this._config.error)?this._config.error(p):o&&this._config.error&&i.postMessage({workerId:d.WORKER_ID,error:p,finished:!1})}}function h(m){var p;(m=m||{}).chunkSize||(m.chunkSize=d.RemoteChunkSize),u.call(this,m),this._nextChunk=r?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(_){this._input=_,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(p=new XMLHttpRequest,this._config.withCredentials&&(p.withCredentials=this._config.withCredentials),r||(p.onload=D(this._chunkLoaded,this),p.onerror=D(this._chunkError,this)),p.ontimeout=D(this._chunkTimeout,this),p.open(this._config.downloadRequestBody?"POST":"GET",this._input,!r),this._config.downloadTimeout&&!r&&(p.timeout=this._config.downloadTimeout),this._config.downloadRequestHeaders){var _,T=this._config.downloadRequestHeaders;for(_ in T)p.setRequestHeader(_,T[_])}var S;this._config.chunkSize&&(S=this._start+this._config.chunkSize-1,p.setRequestHeader("Range","bytes="+this._start+"-"+S));try{p.send(this._config.downloadRequestBody)}catch(q){this._chunkError(q.message)}r&&p.status===0&&this._chunkError()}},this._chunkLoaded=function(){p.readyState===4&&(p.status<200||400<=p.status?this._chunkError():(this._start+=this._config.chunkSize||p.responseText.length,this._finished=!this._config.chunkSize||this._start>=(_=>(_=_.getResponseHeader("Content-Range"))!==null?parseInt(_.substring(_.lastIndexOf("/")+1)):-1)(p),this.parseChunk(p.responseText)))},this._chunkError=function(_){_=p.statusText||_,this._sendError(new Error(_))},this._chunkTimeout=function(){this._chunkError("Request timed out after "+this._config.downloadTimeout+"ms")}}function f(m){(m=m||{}).chunkSize||(m.chunkSize=d.LocalChunkSize),u.call(this,m);var p,_,T=typeof FileReader<"u";this.stream=function(S){this._input=S,_=S.slice||S.webkitSlice||S.mozSlice,T?((p=new FileReader).onload=D(this._chunkLoaded,this),p.onerror=D(this._chunkError,this)):p=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var S=this._input,q=(this._config.chunkSize&&(q=Math.min(this._start+this._config.chunkSize,this._input.size),S=_.call(S,this._start,q)),p.readAsText(S,this._config.encoding));T||this._chunkLoaded({target:{result:q}})},this._chunkLoaded=function(S){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(S.target.result)},this._chunkError=function(){this._sendError(p.error)}}function g(m){var p;u.call(this,m=m||{}),this.stream=function(_){return p=_,this._nextChunk()},this._nextChunk=function(){var _,T;if(!this._finished)return _=this._config.chunkSize,p=_?(T=p.substring(0,_),p.substring(_)):(T=p,""),this._finished=!p,this.parseChunk(T)}}function R(m){u.call(this,m=m||{});var p=[],_=!0,T=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(S){this._input=S,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){T&&p.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),p.length?this.parseChunk(p.shift()):_=!0},this._streamData=D(function(S){try{p.push(typeof S=="string"?S:S.toString(this._config.encoding)),_&&(_=!1,this._checkIsFinished(),this.parseChunk(p.shift()))}catch(q){this._streamError(q)}},this),this._streamError=D(function(S){this._streamCleanUp(),this._sendError(S)},this),this._streamEnd=D(function(){this._streamCleanUp(),T=!0,this._streamData("")},this),this._streamCleanUp=D(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function E(m){var p,_,T,S,q=Math.pow(2,53),P=-q,W=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,j=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,F=this,b=0,w=0,L=!1,N=!1,z=[],A={data:[],errors:[],meta:{}};function ae(K){return m.skipEmptyLines==="greedy"?K.join("").trim()==="":K.length===1&&K[0].length===0}function ne(){if(A&&T&&(H("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+d.DefaultDelimiter+"'"),T=!1),m.skipEmptyLines&&(A.data=A.data.filter(function(M){return!ae(M)})),ce()){let M=function(J){z.push(J)};if(A)if(Array.isArray(A.data[0])){for(var K=0;ce()&&K<A.data.length;K++)A.data[K].forEach(M);A.data.splice(0,1)}else A.data.forEach(M)}function B(M,J){for(var de=m.header?{}:[],ee=0;ee<M.length;ee++){var re=ee,Z=M[ee],Z=((Re,X)=>(ue=>(m.dynamicTypingFunction&&m.dynamicTyping[ue]===void 0&&(m.dynamicTyping[ue]=m.dynamicTypingFunction(ue)),(m.dynamicTyping[ue]||m.dynamicTyping)===!0))(Re)?X==="true"||X==="TRUE"||X!=="false"&&X!=="FALSE"&&((ue=>{if(W.test(ue)&&(ue=parseFloat(ue),P<ue&&ue<q))return 1})(X)?parseFloat(X):j.test(X)?new Date(X):X===""?null:X):X)(re=m.header?ee>=z.length?"__parsed_extra":z[ee]:re,Z=m.transform?m.transform(Z,re):Z);re==="__parsed_extra"?(de[re]=de[re]||[],de[re].push(Z)):de[re]=Z}return m.header&&(ee>z.length?H("FieldMismatch","TooManyFields","Too many fields: expected "+z.length+" fields but parsed "+ee,w+J):ee<z.length&&H("FieldMismatch","TooFewFields","Too few fields: expected "+z.length+" fields but parsed "+ee,w+J)),de}var Y;A&&(m.header||m.dynamicTyping||m.transform)&&(Y=1,!A.data.length||Array.isArray(A.data[0])?(A.data=A.data.map(B),Y=A.data.length):A.data=B(A.data,0),m.header&&A.meta&&(A.meta.fields=z),w+=Y)}function ce(){return m.header&&z.length===0}function H(K,B,Y,M){K={type:K,code:B,message:Y},M!==void 0&&(K.row=M),A.errors.push(K)}U(m.step)&&(S=m.step,m.step=function(K){A=K,ce()?ne():(ne(),A.data.length!==0&&(b+=K.data.length,m.preview&&b>m.preview?_.abort():(A.data=A.data[0],S(A,F))))}),this.parse=function(K,B,Y){var M=m.quoteChar||'"',M=(m.newline||(m.newline=this.guessLineEndings(K,M)),T=!1,m.delimiter?U(m.delimiter)&&(m.delimiter=m.delimiter(K),A.meta.delimiter=m.delimiter):((M=((J,de,ee,re,Z)=>{var Re,X,ue,Ae;Z=Z||[","," ","|",";",d.RECORD_SEP,d.UNIT_SEP];for(var Le=0;Le<Z.length;Le++){for(var Ee,qe=Z[Le],fe=0,Oe=0,he=0,pe=(ue=void 0,new v({comments:re,delimiter:qe,newline:de,preview:10}).parse(J)),Ie=0;Ie<pe.data.length;Ie++)ee&&ae(pe.data[Ie])?he++:(Ee=pe.data[Ie].length,Oe+=Ee,ue===void 0?ue=Ee:0<Ee&&(fe+=Math.abs(Ee-ue),ue=Ee));0<pe.data.length&&(Oe/=pe.data.length-he),1.99<Oe&&(X===void 0||fe<X||fe===X&&Ae<Oe)&&(X=fe,Re=qe,Ae=Oe)}return{successful:!!(m.delimiter=Re),bestDelimiter:Re}})(K,m.newline,m.skipEmptyLines,m.comments,m.delimitersToGuess)).successful?m.delimiter=M.bestDelimiter:(T=!0,m.delimiter=d.DefaultDelimiter),A.meta.delimiter=m.delimiter),x(m));return M.header=ce(),m.preview&&m.header&&M.preview++,p=K,_=new v(M),A=_.parse(p,B,Y),ne(),L?{meta:{paused:!0}}:A||{meta:{paused:!1}}},this.paused=function(){return L},this.pause=function(){L=!0,_.abort(),p=U(m.chunk)?"":p.substring(_.getCharIndex())},this.resume=function(){F.streamer._halted?(L=!1,F.streamer.parseChunk(p,!0)):setTimeout(F.resume,3)},this.aborted=function(){return N},this.abort=function(){N=!0,_.abort(),A.meta.aborted=!0,U(m.complete)&&m.complete(A),p=""},this.guessLineEndings=function(J,M){J=J.substring(0,1048576);var M=new RegExp(C(M)+"([^]*?)"+C(M),"gm"),Y=(J=J.replace(M,"")).split("\r"),M=J.split(`
2
2
  `),J=1<M.length&&M[0].length<Y[0].length;if(Y.length===1||J)return`
3
3
  `;for(var de=0,ee=0;ee<Y.length;ee++)Y[ee][0]===`
4
4
  `&&de++;return de>=Y.length/2?`\r
5
- `:"\r"}}function R(m){return m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function I(m){var g=(m=m||{}).delimiter,_=m.newline,v=m.comments,x=m.step,q=m.preview,P=m.fastMode,W=null,j=!1,F=m.quoteChar==null?'"':m.quoteChar,b=F;if(m.escapeChar!==void 0&&(b=m.escapeChar),(typeof g!="string"||-1<d.BAD_DELIMITERS.indexOf(g))&&(g=","),v===g)throw new Error("Comment character same as delimiter");v===!0?v="#":(typeof v!="string"||-1<d.BAD_DELIMITERS.indexOf(v))&&(v=!1),_!==`
5
+ `:"\r"}}function C(m){return m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function v(m){var p=(m=m||{}).delimiter,_=m.newline,T=m.comments,S=m.step,q=m.preview,P=m.fastMode,W=null,j=!1,F=m.quoteChar==null?'"':m.quoteChar,b=F;if(m.escapeChar!==void 0&&(b=m.escapeChar),(typeof p!="string"||-1<d.BAD_DELIMITERS.indexOf(p))&&(p=","),T===p)throw new Error("Comment character same as delimiter");T===!0?T="#":(typeof T!="string"||-1<d.BAD_DELIMITERS.indexOf(T))&&(T=!1),_!==`
6
6
  `&&_!=="\r"&&_!==`\r
7
7
  `&&(_=`
8
- `);var T=0,A=!1;this.parse=function(k,z,N){if(typeof k!="string")throw new Error("Input must be a string");var ae=k.length,ne=g.length,ce=_.length,H=v.length,L=K(x),B=[],Y=[],M=[],J=T=0;if(!k)return fe();if(P||P!==!1&&k.indexOf(F)===-1){for(var de=k.split(_),ee=0;ee<de.length;ee++){if(M=de[ee],T+=M.length,ee!==de.length-1)T+=_.length;else if(N)return fe();if(!v||M.substring(0,H)!==v){if(L){if(B=[],Ae(M.split(g)),Ee(),A)return fe()}else Ae(M.split(g));if(q&&q<=ee)return B=B.slice(0,q),fe(!0)}}return fe()}for(var re=k.indexOf(g,T),Z=k.indexOf(_,T),Re=new RegExp(R(b)+R(F),"g"),X=k.indexOf(F,T);;)if(k[T]===F)for(X=T,T++;;){if((X=k.indexOf(F,X+1))===-1)return N||Y.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:B.length,index:T}),Ce();if(X===ae-1)return Ce(k.substring(T,X).replace(Re,F));if(F===b&&k[X+1]===b)X++;else if(F===b||X===0||k[X-1]!==b){re!==-1&&re<X+1&&(re=k.indexOf(g,X+1));var ue=Le((Z=Z!==-1&&Z<X+1?k.indexOf(_,X+1):Z)===-1?re:Math.min(re,Z));if(k.substr(X+1+ue,ne)===g){M.push(k.substring(T,X).replace(Re,F)),k[T=X+1+ue+ne]!==F&&(X=k.indexOf(F,T)),re=k.indexOf(g,T),Z=k.indexOf(_,T);break}if(ue=Le(Z),k.substring(X+1+ue,X+1+ue+ce)===_){if(M.push(k.substring(T,X).replace(Re,F)),qe(X+1+ue+ce),re=k.indexOf(g,T),X=k.indexOf(F,T),L&&(Ee(),A))return fe();if(q&&B.length>=q)return fe(!0);break}Y.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:B.length,index:T}),X++}}else if(v&&M.length===0&&k.substring(T,T+H)===v){if(Z===-1)return fe();T=Z+ce,Z=k.indexOf(_,T),re=k.indexOf(g,T)}else if(re!==-1&&(re<Z||Z===-1))M.push(k.substring(T,re)),T=re+ne,re=k.indexOf(g,T);else{if(Z===-1)break;if(M.push(k.substring(T,Z)),qe(Z+ce),L&&(Ee(),A))return fe();if(q&&B.length>=q)return fe(!0)}return Ce();function Ae(he){B.push(he),J=T}function Le(he){var pe=0;return pe=he!==-1&&(he=k.substring(X+1,he))&&he.trim()===""?he.length:pe}function Ce(he){return N||(he===void 0&&(he=k.substring(T)),M.push(he),T=ae,Ae(M),L&&Ee()),fe()}function qe(he){T=he,Ae(M),M=[],Z=k.indexOf(_,T)}function fe(he){if(m.header&&!z&&B.length&&!j){var pe=B[0],Ie=Object.create(null),at=new Set(pe);let bt=!1;for(let Ue=0;Ue<pe.length;Ue++){let Oe=c(pe[Ue]);if(Ie[Oe=K(m.transformHeader)?m.transformHeader(Oe,Ue):Oe]){let He,wt=Ie[Oe];for(;He=Oe+"_"+wt,wt++,at.has(He););at.add(He),pe[Ue]=He,Ie[Oe]++,bt=!0,(W=W===null?{}:W)[He]=Oe}else Ie[Oe]=1,pe[Ue]=Oe;at.add(Oe)}bt&&console.warn("Duplicate headers found and renamed."),j=!0}return{data:B,errors:Y,meta:{delimiter:g,linebreak:_,aborted:A,truncated:!!he,cursor:J+(z||0),renamedHeaders:W}}}function Ee(){x(fe()),B=[],Y=[]}},this.abort=function(){A=!0},this.getCharIndex=function(){return T}}function D(m){var g=m.data,_=a[g.workerId],v=!1;if(g.error)_.userError(g.error,g.file);else if(g.results&&g.results.data){var x={abort:function(){v=!0,w(g.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:O,resume:O};if(K(_.userStep)){for(var q=0;q<g.results.data.length&&(_.userStep({data:g.results.data[q],errors:g.results.errors,meta:g.results.meta},x),!v);q++);delete g.results}else K(_.userChunk)&&(_.userChunk(g.results,x,g.file),delete g.results)}g.finished&&!v&&w(g.workerId,g.results)}function w(m,g){var _=a[m];K(_.userComplete)&&_.userComplete(g),_.terminate(),delete a[m]}function O(){throw new Error("Not implemented.")}function S(m){if(typeof m!="object"||m===null)return m;var g,_=Array.isArray(m)?[]:{};for(g in m)_[g]=S(m[g]);return _}function U(m,g){return function(){m.apply(g,arguments)}}function K(m){return typeof m=="function"}return d.parse=function(m,g){var _=(g=g||{}).dynamicTyping||!1;if(K(_)&&(g.dynamicTypingFunction=_,_={}),g.dynamicTyping=_,g.transform=!!K(g.transform)&&g.transform,g.downloadTimeout!==void 0){var _=parseInt(g.downloadTimeout);if(isNaN(_))throw new Error("Config downloadTimeout value ("+g.downloadTimeout+") not parsable by parseInt(val).");g.downloadTimeout=_}if(!g.worker||!d.WORKERS_SUPPORTED)return _=null,d.NODE_STREAM_INPUT,typeof m=="string"?(m=c(m),_=new(g.download?h:p)(g)):m.readable===!0&&K(m.read)&&K(m.on)?_=new C(g):(i.File&&m instanceof File||m instanceof Object)&&(_=new f(g)),_.stream(m);(_=(()=>{var v;return!!d.WORKERS_SUPPORTED&&(v=(()=>{var x=i.URL||i.webkitURL||null,q=t.toString();return d.BLOB_URL||(d.BLOB_URL=x.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",q,")();"],{type:"text/javascript"})))})(),(v=new i.Worker(v)).onmessage=D,v.id=l++,a[v.id]=v)})()).userStep=g.step,_.userChunk=g.chunk,_.userComplete=g.complete,_.userError=g.error,g.step=K(g.step),g.chunk=K(g.chunk),g.complete=K(g.complete),g.error=K(g.error),delete g.worker,_.postMessage({input:m,config:g,workerId:_.id})},d.unparse=function(m,g){var _=!1,v=!0,x=",",q=`\r
9
- `,P='"',W=P+P,j=!1,F=null,b=!1,T=((()=>{if(typeof g=="object"){if(typeof g.delimiter!="string"||d.BAD_DELIMITERS.filter(function(z){return g.delimiter.indexOf(z)!==-1}).length||(x=g.delimiter),typeof g.quotes!="boolean"&&typeof g.quotes!="function"&&!Array.isArray(g.quotes)||(_=g.quotes),typeof g.skipEmptyLines!="boolean"&&typeof g.skipEmptyLines!="string"||(j=g.skipEmptyLines),typeof g.newline=="string"&&(q=g.newline),typeof g.quoteChar=="string"&&(P=g.quoteChar,W=P+P),typeof g.header=="boolean"&&(v=g.header),Array.isArray(g.columns)){if(g.columns.length===0)throw new Error("Option columns is empty");F=g.columns}g.escapeChar!==void 0&&(W=g.escapeChar+P),g.escapeFormulae instanceof RegExp?b=g.escapeFormulae:typeof g.escapeFormulae=="boolean"&&g.escapeFormulae&&(b=/^[=+\-@\t\r].*$/)}})(),new RegExp(R(P),"g"));if(typeof m=="string"&&(m=JSON.parse(m)),Array.isArray(m)){if(!m.length||Array.isArray(m[0]))return A(null,m,j);if(typeof m[0]=="object")return A(F||Object.keys(m[0]),m,j)}else if(typeof m=="object")return typeof m.data=="string"&&(m.data=JSON.parse(m.data)),Array.isArray(m.data)&&(m.fields||(m.fields=m.meta&&m.meta.fields||F),m.fields||(m.fields=Array.isArray(m.data[0])?m.fields:typeof m.data[0]=="object"?Object.keys(m.data[0]):[]),Array.isArray(m.data[0])||typeof m.data[0]=="object"||(m.data=[m.data])),A(m.fields||[],m.data||[],j);throw new Error("Unable to serialize unrecognized input");function A(z,N,ae){var ne="",ce=(typeof z=="string"&&(z=JSON.parse(z)),typeof N=="string"&&(N=JSON.parse(N)),Array.isArray(z)&&0<z.length),H=!Array.isArray(N[0]);if(ce&&v){for(var L=0;L<z.length;L++)0<L&&(ne+=x),ne+=k(z[L],L);0<N.length&&(ne+=q)}for(var B=0;B<N.length;B++){var Y=(ce?z:N[B]).length,M=!1,J=ce?Object.keys(N[B]).length===0:N[B].length===0;if(ae&&!ce&&(M=ae==="greedy"?N[B].join("").trim()==="":N[B].length===1&&N[B][0].length===0),ae==="greedy"&&ce){for(var de=[],ee=0;ee<Y;ee++){var re=H?z[ee]:ee;de.push(N[B][re])}M=de.join("").trim()===""}if(!M){for(var Z=0;Z<Y;Z++){0<Z&&!J&&(ne+=x);var Re=ce&&H?z[Z]:Z;ne+=k(N[B][Re],Z)}B<N.length-1&&(!ae||0<Y&&!J)&&(ne+=q)}}return ne}function k(z,N){var ae,ne,ce;return z==null?"":z.constructor===Date?isNaN(z.getTime())?"":z.toISOString():(ce=!1,b&&typeof z=="string"&&b.test(z)&&(z="'"+z,ce=!0),ne=(ae=z.toString()).replace(T,W),(ce=ce||_===!0||typeof _=="function"&&_(z,N)||Array.isArray(_)&&_[N]||((H,L)=>{for(var B=0;B<L.length;B++)if(-1<H.indexOf(L[B]))return!0;return!1})(ne,d.BAD_DELIMITERS)||-1<ne.indexOf(x)||-1<ae.indexOf(P)||ne.charAt(0)===" "||ne.charAt(ne.length-1)===" ")?P+ne+P:ne)}},d.RECORD_SEP="",d.UNIT_SEP="",d.BYTE_ORDER_MARK="\uFEFF",d.BAD_DELIMITERS=["\r",`
10
- `,'"',d.BYTE_ORDER_MARK],d.WORKERS_SUPPORTED=!r&&!!i.Worker,d.NODE_STREAM_INPUT=1,d.LocalChunkSize=10485760,d.RemoteChunkSize=5242880,d.DefaultDelimiter=",",d.Parser=I,d.ParserHandle=E,d.NetworkStreamer=h,d.FileStreamer=f,d.StringStreamer=p,d.ReadableStreamStreamer=C,o&&(i.onmessage=function(m){m=m.data,d.WORKER_ID===void 0&&m&&(d.WORKER_ID=m.workerId),typeof m.input=="string"?i.postMessage({workerId:d.WORKER_ID,results:d.parse(m.input,m.config),finished:!0}):(i.File&&m.input instanceof File||m.input instanceof Object)&&(m=d.parse(m.input,m.config))&&i.postMessage({workerId:d.WORKER_ID,results:m,finished:!0})}),(h.prototype=Object.create(u.prototype)).constructor=h,(f.prototype=Object.create(u.prototype)).constructor=f,(p.prototype=Object.create(p.prototype)).constructor=p,(C.prototype=Object.create(u.prototype)).constructor=C,d})})(mt)),mt.exports}var pa=ma(),Ve=(n=>(n.String="string",n.Number="number",n.Boolean="boolean",n.Object="object",n.Undefined="undefined",n))(Ve||{});const ga=["id"],_a=s.defineComponent({__name:"VueJsonCsv",props:{data:{type:Array,required:!0},fields:{type:Array,required:!1,default:null},labels:{type:Object,required:!1,default:null},filename:{type:String,default:"report-data.csv"},delimiter:{type:String,default:",",required:!1},separatorExcel:{type:Boolean,default:!1},encoding:{type:String,default:"utf-8"},testing:{type:Boolean,required:!1,default:!1}},emits:["export-started","export-finished"],setup(n,{emit:e}){const t=e,i=n,r=s.computed(()=>`export_${new Date().getTime()}`),o=s.computed(()=>{const u=d();return u.length?u:null}),a=()=>{const u=i.labels;if(typeof i.fields!==Ve.Object)throw new Error("Labels needs to be a object containing key / value pairs.");return u!==null&&typeof u===Ve.Object?h=>Object.fromEntries(Object.entries(h).map(([f,p])=>[u[f]||f,p])):h=>h},l=()=>{const u=i.fields;if(typeof i.fields!==Ve.Object&&!Array.isArray(u))throw new Error("Fields needs to be an array of strings.");return Array.isArray(u)?h=>Object.fromEntries(u.filter(f=>f in h).map(f=>[f,h[f]])):h=>h},d=()=>{if(typeof i.fields===Ve.Undefined&&typeof i.labels===Ve.Undefined)return i.data;const u=a(),h=l();return i.data.map(f=>u(h(f)))},c=()=>{if(!o.value){console.warn("No data to export");return}t("export-started",o.value);let u=pa.unparse(o.value,Object.assign({delimiter:i.delimiter,encoding:i.encoding}));if(i.separatorExcel&&(u="SEP="+i.delimiter+`\r
11
- `+u),i.encoding==="utf-8"&&(u="\uFEFF"+u),t("export-finished",i.filename),!i.testing){const h=new Blob([u],{type:"text/csv;charset="+i.encoding});ha.saveAs(h,i.filename)}};return(u,h)=>(s.openBlock(),s.createElementBlock("div",{id:r.value,"data-testid":"export-csv",onClick:c},[s.renderSlot(u.$slots,"default",{},()=>[s.createTextVNode("Download "+s.toDisplayString(n.filename),1)])],8,ga))}}),ya=s.defineComponent({__name:"DownloadCsv",props:{rows:{},headers:{},filename:{}},setup(n){const e=n,t=s.computed(()=>Object.keys(e.headers));return(i,r)=>(s.openBlock(),s.createElementBlock("div",null,[s.createVNode(_a,{data:n.rows,fields:t.value,filename:n.filename,labels:n.headers},{default:s.withCtx(()=>[s.renderSlot(i.$slots,"default")]),_:3},8,["data","fields","filename","labels"])]))}}),Ra={renderer:{not_configured:{title:"Chart is not fully configured",description:"Begin by choosing at least one metric"},noQueryBridge:"No query bridge provided. Unable to render dashboard.",unexpectedError:"An unexpected error has occurred.",trendRange:{"24h":"Last 24-hour summary","7d":"Last 7-day summary","30d":"Last 30-day summary"},edit:"Edit",duplicateTile:"Duplicate",exit_fullscreen:"Exit fullscreen",fullscreen:"Fullscreen",remove:"Remove",delete:"Delete",as_of_today:"As of today",noDataAvailable:{title:"No data in the current time frame",description:"Once there is traffic, it will display here"},treemapUnsupported:{title:"This query can't be shown as a treemap",description:"Treemaps need a count or total metric, such as requests or tokens, and no time dimension"}},pdfExport:{branding:"Kong Konnect",generated:"Generated {timestamp}",dashboardNote:"For a live, interactive experience, open this dashboard in Konnect",pageOf:"{page} / {total}"},csvExport:{defaultFilename:"Chart export",exportAsCsv:"Export as CSV",dataError:"Error loading data",noDataRange:"No data in selected range",noDataRetry:"Please adjust the time period and try again",timeRangeSelected:"selected",exportPreview:"Export preview",exportTimeRange:"Time range",exportAsOf:"As of {time}",exportDescription:"Exports a CSV of the data represented in the chart.",maximumRecordAmount:"The number of groups is limited to {value}",previewRows:"Previewing {rowsMax} of {rowsTotal} row{plural}",downloadButton:"Export",cancelButton:"Cancel",UtcOffset:"UTC offset",Timestamp:"Timestamp"},chartLabels:{control_plane:"Control plane",data_plane_node_version:"Data plane node version",env:"Environment",gateway_service:"Gateway service",hostname:"Hostname",plugin:"Plugin",plugin_name:"Plugin name",plugin_scope:"Plugin scope",region:"Region",request_count:"Request count",route:"Route",status_code:"Status code",team:"Team",name:"Name",latencies_response_ms:"Response latency",latencies_upstream_ms:"Upstream latency",latencies_kong_gateway_ms:"Kong latency",latencies_kong_internal_ms:"Kong internal latency",request_body_size:"Request size",response_body_size:"Response size",response_header_content_length:"Content length",ai:{cost:"Cost",costCaching:"Caching cost",promptTokens:"Prompt tokens",completionTokens:"Completion tokens",totalTokens:"Total tokens",llmLatency:"LLM latency",fetchLatency:"Fetch latency",embeddingsLatency:"Embeddings latency"},mcp:{latency:"MCP latency",response_body_size:"MCP response size"},a2a:{latency:"A2A latency",response_body_size:"A2A response size"},ai_gateway:"AI gateway",ai_gateway_agent:"AI gateway agent",ai_gateway_consumer:"AI gateway consumer",ai_gateway_consumer_group:"AI gateway consumer group",ai_gateway_data_plane_node:"AI gateway data plane node",ai_gateway_mcp_server:"AI gateway MCP server",ai_gateway_model:"AI gateway model",ai_gateway_version:"AI gateway version",ai_count:"LLM request count",ai_plugin:"AI plugin",ai_provider:"Provider",ai_request_model:"Request model",ai_response_model:"Response model",error_rate:"Error rate",request_per_minute:"Requests per minute",requests_per_minute:"Requests per minute",response_latency_average:"Response latency (avg)",response_latency_p99:"Response latency (p99)",response_latency_p95:"Response latency (p95)",response_latency_p50:"Response latency (p50)",kong_latency_average:"Kong latency (avg)",kong_latency_p99:"Kong latency (p99)",kong_latency_p95:"Kong latency (p95)",kong_latency_p50:"Kong latency (p50)",kong_internal_latency_average:"Kong internal latency (avg)",kong_internal_latency_p99:"Kong internal latency (p99)",kong_internal_latency_p95:"Kong internal latency (p95)",kong_internal_latency_p50:"Kong internal latency (p50)",llm_cache_status:"Cache status",llm_embeddings_model:"Embeddings model",llm_embeddings_provider:"Embeddings provider",upstream_latency_average:"Upstream latency (avg)",upstream_latency_p99:"Upstream latency (p99)",upstream_latency_p95:"Upstream latency (p95)",upstream_latency_p50:"Upstream latency (p50)",response_size_p99:"Response size (p99)",response_size_p95:"Response size (p95)",response_size_p50:"Response size (p50)",response_size_average:"Response size (avg)",response_size_sum:"Response size (sum)",response_source:"Response source",request_size_p99:"Request size (p99)",request_size_p95:"Request size (p95)",request_size_p50:"Request size (p50)",request_size_average:"Request size (avg)",request_size_sum:"Request size (sum)",total_tokens_per_minute:"Total tokens per minute",control_plane_group:"Control plane group",consumer:"Consumer",consumer_group:"Consumer group",country_code:"Country",country:"Country",data_plane_node:"Data plane node",api_package:"API package",api_product:"API product",api_product_version:"API product version",portal:"Portal",realm:"Realm",runtime_group:"Runtime group",application:"Application",status_code_grouped:"Status code (grouped)",upstream_status_code:"Upstream status code",upstream_status_code_grouped:"Upstream status code group",time:"Time",Service:"Service",ServiceVersion:"Service version",Route:"Route",Application:"Application",RuntimeGroup:"Runtime group",GatewayService:"Gateway service",StatusCode:"Status code",CodeClass:"Status code (grouped)",Time:"Time",API_PRODUCT:"Api product",API_PRODUCT_VERSION:"API product version",RUNTIME_GROUP:"Runtime group",GATEWAY_SERVICE:"Gateway service",ROUTE:"Route",APPLICATION:"Application",STATUS_CODE:"Status code",STATUS_CODE_GROUPED:"Status code (grouped)",TIME:"Time",ORGANIZATION:"Organization",TotalRequests:"Request count",RequestsPerMinute:"Requests per minute",LatencyP99:"Response latency (p99)",LatencyP95:"Response latency (p95)",LatencyP50:"Response latency (p50)",LatencyAverage:"Response latency (avg)",UpstreamLatencyP99:"Upstream latency (p99)",UpstreamLatencyP95:"Upstream latency (p95)",UpstreamLatencyP50:"Upstream latency (p50)",UpstreamLatencyAverage:"Upstream latency (avg)",KongLatencyP99:"Kong latency (p99)",KongLatencyP95:"Kong latency (p95)",KongLatencyP50:"Kong latency (p50)",KongLatencyAverage:"Kong latency (avg)",ResponseSizeP99:"Response size (p99)",ResponseSizeP95:"Response size (p95)",ResponseSizeP50:"Response size (p50)",RequestSizeP99:"Request size (p99)",RequestSizeP95:"Request size (p95)",RequestSizeP50:"Request size (p50)",SuccessfulRequests:"Successful requests",SUCCESS:"Successful requests",FailedRequests:"Failed requests",FAILURE:"Failed requests","5XX":"5xx","4XX":"4xx","3XX":"3xx","2XX":"2xx","1XX":"1xx",REQUEST_COUNT:"Request count",REQUEST_PER_MINUTE:"Requests per minute",RESPONSE_LATENCY_P99:"Response latency",RESPONSE_LATENCY_P95:"Response latency",RESPONSE_LATENCY_P50:"Response latency",RESPONSE_SIZE_P99:"Response size (p99)",RESPONSE_SIZE_P95:"Response size (p95)",RESPONSE_SIZE_P50:"Response size (p50)",REQUEST_SIZE_P99:"Request size (p99)",REQUEST_SIZE_P95:"Request size (p95)",REQUEST_SIZE_P50:"Request size (p50)",CONTROL_PLANE:"Control plane",____OTHER____:"Others",ai_request_count:"Request count",total_tokens:"Total token count",prompt_tokens:"Prompt token count",completion_tokens:"Completion token count",share_of_requests:"Share of requests",cost:"Costs",cost_per_request_average:"Request cost (avg per million)",llm_cache_embeddings_latency_average:"Embeddings latency (avg)",llm_cache_fetch_latency_average:"Fetch latency (avg)",llm_latency_average:"LLM latency (avg)",llm_latency_p50:"LLM latency (p50)",llm_latency_p95:"LLM latency (p95)",llm_latency_p99:"LLM latency (p99)",time_to_first_token_average:"Time to first token (avg)",time_to_first_token_p99:"Time to first token (p99)",time_to_first_token_p95:"Time to first token (p95)",time_to_first_token_p50:"Time to first token (p50)",time_per_token_average:"Time per token (avg)",time_per_token_p99:"Time per token (p99)",time_per_token_p95:"Time per token (p95)",time_per_token_p50:"Time per token (p50)","threshold-warning":"Warning threshold: {value}","threshold-error":"Error threshold: {value}","thatreshold-neutral":"Alert threshold: {value}",api:"API",vulnerability_count:"Vulnerability count",a2a_latency_average:"A2A latency (avg)",a2a_response_size_sum:"A2A response size (sum)",a2a_context_id:"A2A context ID",a2a_error:"A2A error",a2a_method:"A2A method",a2a_task_id:"A2A task ID",active_agents:"Active agents",mcp_error:"MCP error",mcp_method:"MCP method",mcp_latency_average:"MCP latency (avg)",mcp_latency_p99:"MCP latency (p99)",mcp_latency_p95:"MCP latency (p95)",mcp_latency_p50:"MCP latency (p50)",mcp_response_size_sum:"MCP response size (sum)",mcp_session_id:"MCP session ID",mcp_tool_name:"MCP tool name",mcp_response_body_size_sum:"MCP response size (sum)",control_plane_count:"Control plane count",service_count:"Gateway service count","record_bytes:sum":"Record size (sum)","record_count:sum":"Record count (sum)","request_count:sum":"Request count (sum)",route_count:"Route count",consumer_count:"Consumer count",plugin_count:"Plugin count",node_count:"Data plane node count",oidc_credential:"OIDC credential",principal:"Principal",principal_group:"Principal group",virtual_cluster_id:"Virtual cluster",backend_cluster_id:"Backend cluster",listener_id:"Listener",principal_name:"Principal name",principal_type:"Principal type",request_type:"Request type",topic_name:"Topic name",partition_index:"Partition index",api_key:"API key",data_plane_group:"Data plane group",managed_cache:"Managed cache",network:"Network",provider:"Provider",provider_region:"Provider region",cache_eviction_rate:"Cache eviction rate",cache_expiration_rate:"Cache expiration rate",cache_items_average:"Cache items (avg)",cache_memory_utilization_max:"Cache memory utilization (max)",cache_status:"Cache status",cache_hit_rate:"Cache hit rate",share_of_cost:"Share of cost"},chartUnits:{ms:"ms",bytes:"Byte{plural}",count:"request{plural}","count/minute":"rpm",requests:"request{plural}","token count":"token{plural}","tokens/minute":"tpm","%":"%","ops/minute":"ops/minute"},topNTable:{nameLabel:"Name",defaultEmptyStateTitle:"No data to display",defaultErrorStateTitle:"Something went wrong",errors:{meta:"Error: response must contain 'meta'",display:"Error: 'display' response incorrectly formatted (must have at least one key)",metricNames:"Error: 'metricNames' response incorrectly formatted (must have at least one entry)"}},jumpToExplore:"Explore",jumpToRequests:"View requests",unsupported_time_range_badge:"Limited timeframe",unsupported_time_range_warning:"The selected timeframe exceeds what this datasource supports, so this tile is limited to the maximum supported timeframe.",query_aged_out_warning:"This tile was configured with {savedGranularity} granularity, which is no longer available. It now shows {currentGranularity} data, the closest available granularity.",granularities:{daily:"1 day",fiveMinutely:"5 minutes",hourly:"1 hour",minutely:"1 minute",tenMinutely:"10 minutes",tenSecondly:"10 seconds",thirtyMinutely:"30 minutes",thirtySecondly:"30 seconds",twelveHourly:"12 hours",twoHourly:"2 hours",weekly:"1 week",unknown:"Unknown"}};function pt(){const n=lt.createI18n("en-us",Ra);return{i18n:n,i18nT:lt.i18nTComponent(n)}}const tt=170,Bt=6,it=20,ve="analytics-query-provider",$i="analytics-dashboard-coordinator",zt="{entity-id}",Fi="{cp-id}",Wi="{timeframe}",Vi=30*1e3,Yi=3e5,Xi=36e5;function Ca(){const n=s.inject(ve);return{evaluateFeatureFlag:(t,i)=>typeof n?.evaluateFeatureFlagFn!="function"?i:n.evaluateFeatureFlagFn(t,i)}}var Pt={exports:{}},ji;function Ea(){return ji||(ji=1,(function(n){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function r(d,c,u){this.fn=d,this.context=c,this.once=u||!1}function o(d,c,u,h,f){if(typeof u!="function")throw new TypeError("The listener must be a function");var p=new r(u,h||d,f),C=t?t+c:c;return d._events[C]?d._events[C].fn?d._events[C]=[d._events[C],p]:d._events[C].push(p):(d._events[C]=p,d._eventsCount++),d}function a(d,c){--d._eventsCount===0?d._events=new i:delete d._events[c]}function l(){this._events=new i,this._eventsCount=0}l.prototype.eventNames=function(){var c=[],u,h;if(this._eventsCount===0)return c;for(h in u=this._events)e.call(u,h)&&c.push(t?h.slice(1):h);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},l.prototype.listeners=function(c){var u=t?t+c:c,h=this._events[u];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,p=h.length,C=new Array(p);f<p;f++)C[f]=h[f].fn;return C},l.prototype.listenerCount=function(c){var u=t?t+c:c,h=this._events[u];return h?h.fn?1:h.length:0},l.prototype.emit=function(c,u,h,f,p,C){var E=t?t+c:c;if(!this._events[E])return!1;var R=this._events[E],I=arguments.length,D,w;if(R.fn){switch(R.once&&this.removeListener(c,R.fn,void 0,!0),I){case 1:return R.fn.call(R.context),!0;case 2:return R.fn.call(R.context,u),!0;case 3:return R.fn.call(R.context,u,h),!0;case 4:return R.fn.call(R.context,u,h,f),!0;case 5:return R.fn.call(R.context,u,h,f,p),!0;case 6:return R.fn.call(R.context,u,h,f,p,C),!0}for(w=1,D=new Array(I-1);w<I;w++)D[w-1]=arguments[w];R.fn.apply(R.context,D)}else{var O=R.length,S;for(w=0;w<O;w++)switch(R[w].once&&this.removeListener(c,R[w].fn,void 0,!0),I){case 1:R[w].fn.call(R[w].context);break;case 2:R[w].fn.call(R[w].context,u);break;case 3:R[w].fn.call(R[w].context,u,h);break;case 4:R[w].fn.call(R[w].context,u,h,f);break;default:if(!D)for(S=1,D=new Array(I-1);S<I;S++)D[S-1]=arguments[S];R[w].fn.apply(R[w].context,D)}}return!0},l.prototype.on=function(c,u,h){return o(this,c,u,h,!1)},l.prototype.once=function(c,u,h){return o(this,c,u,h,!0)},l.prototype.removeListener=function(c,u,h,f){var p=t?t+c:c;if(!this._events[p])return this;if(!u)return a(this,p),this;var C=this._events[p];if(C.fn)C.fn===u&&(!f||C.once)&&(!h||C.context===h)&&a(this,p);else{for(var E=0,R=[],I=C.length;E<I;E++)(C[E].fn!==u||f&&!C[E].once||h&&C[E].context!==h)&&R.push(C[E]);R.length?this._events[p]=R.length===1?R[0]:R:a(this,p)}return this},l.prototype.removeAllListeners=function(c){var u;return c?(u=t?t+c:c,this._events[u]&&a(this,u)):(this._events=new i,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=t,l.EventEmitter=l,n.exports=l})(Pt)),Pt.exports}var Oa=Ea();const ba=ca(Oa);class qt extends Error{name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,qt)}}const Qi=n=>n.reason??new DOMException("This operation was aborted.","AbortError");function wa(n,e){const{milliseconds:t,fallback:i,message:r,customTimers:o={setTimeout,clearTimeout},signal:a}=e;let l,d;const u=new Promise((h,f)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(a?.aborted){f(Qi(a));return}if(a&&(d=()=>{f(Qi(a))},a.addEventListener("abort",d,{once:!0})),n.then(h,f),t===Number.POSITIVE_INFINITY)return;const p=new qt;l=o.setTimeout.call(void 0,()=>{if(i){try{h(i())}catch(C){f(C)}return}typeof n.cancel=="function"&&n.cancel(),r===!1?h():r instanceof Error?f(r):(p.message=r??`Promise timed out after ${t} milliseconds`,f(p))},t)}).finally(()=>{u.clear(),d&&a&&a.removeEventListener("abort",d)});return u.clear=()=>{o.clearTimeout.call(void 0,l),l=void 0},u}function Ta(n,e,t){let i=0,r=n.length;for(;r>0;){const o=Math.trunc(r/2);let a=i+o;t(n[a],e)<=0?(i=++a,r-=o+1):r=o}return i}const va=100;class Zi{#t=[];#e=0;enqueue(e,t){const{priority:i=0,id:r}=t??{},{size:o}=this,a={priority:i,id:r,run:e};if(o===0){this.#t.length=0,this.#e=0,this.#t.push(a);return}if(this.#t.at(-1).priority>=i){this.#t.push(a);return}this.#s();const l=Ta(this.#t,a,(d,c)=>c.priority-d.priority);this.#t.splice(l,0,a)}setPriority(e,t){const i=this.#t.findIndex((o,a)=>a>=this.#e&&o.id===e);if(i===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);const[r]=this.#t.splice(i,1);this.enqueue(r.run,{priority:t,id:e})}remove(e){const t=this.#t.findIndex((i,r)=>r<this.#e?!1:typeof e=="string"?i.id===e:i.run===e);t!==-1&&this.#t.splice(t,1)}dequeue(){if(this.#e===this.#t.length)return;const e=this.#t[this.#e];return this.#e++,this.#e===this.#t.length?(this.#t.length=0,this.#e=0):this.#e>va&&this.#e>this.#t.length/2&&this.#s(),e?.run}filter(e){const t=[];for(let i=this.#e;i<this.#t.length;i++){const r=this.#t[i];r.priority===e.priority&&t.push(r.run)}return t}get size(){return this.#t.length-this.#e}#s(){this.#e!==0&&(this.#t.splice(0,this.#e),this.#e=0)}}class Sa extends ba{#t;#e;#s=0;#f;#p=!1;#R=!1;#c;#C=0;#l;#u;#a;#o=[];#r=0;#i;#v;#n=0;#g;#d;#N=1n;#_=new Map;#E=new Set;timeout;constructor(e){if(super(),e={carryoverIntervalCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:Zi,strict:!1,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);if(e.strict&&e.interval===0)throw new TypeError("The `strict` option requires a non-zero `interval`");if(e.strict&&e.intervalCap===Number.POSITIVE_INFINITY)throw new TypeError("The `strict` option requires a finite `intervalCap`");if(this.#t=e.carryoverIntervalCount??e.carryoverConcurrencyCount??!1,this.#e=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#f=e.intervalCap,this.#c=e.interval,this.#a=e.strict,this.#i=new e.queueClass,this.#v=e.queueClass,this.concurrency=e.concurrency,e.timeout!==void 0&&!(Number.isFinite(e.timeout)&&e.timeout>0))throw new TypeError(`Expected \`timeout\` to be a positive finite number, got \`${e.timeout}\` (${typeof e.timeout})`);this.timeout=e.timeout,this.#d=e.autoStart===!1,this.#P()}#O(e){for(;this.#r<this.#o.length;){const i=this.#o[this.#r];if(i!==void 0&&e-i>=this.#c)this.#r++;else break}(this.#r>100&&this.#r>this.#o.length/2||this.#r===this.#o.length)&&(this.#o=this.#o.slice(this.#r),this.#r=0)}#A(e){this.#a?this.#o.push(e):this.#s++}#L(){this.#a?this.#o.length>this.#r&&this.#o.pop():this.#s>0&&this.#s--}#b(){return this.#o.length-this.#r}get#U(){return this.#e?!0:this.#a?this.#b()<this.#f:this.#s<this.#f}get#K(){return this.#n<this.#g}#M(){this.#n--,this.#n===0&&this.emit("pendingZero"),this.#y(),this.emit("next")}#B(){this.#u=void 0,this.#D(),this.#I()}#z(e){if(this.#a){if(this.#O(e),this.#b()>=this.#f){const i=this.#o[this.#r],r=this.#c-(e-i);return this.#S(r),!0}return!1}if(this.#l===void 0){const t=this.#C-e;if(t<0)this.#s=this.#t?this.#n:0;else return this.#S(t),!0}return!1}#S(e){this.#u===void 0&&(this.#u=setTimeout(()=>{this.#B()},e))}#w(){this.#l&&(clearInterval(this.#l),this.#l=void 0)}#x(){this.#u&&(clearTimeout(this.#u),this.#u=void 0)}#y(){if(this.#i.size===0){if(this.#w(),this.emit("empty"),this.#n===0){if(this.#x(),this.#a&&this.#r>0){const t=Date.now();this.#O(t)}this.emit("idle")}return!1}let e=!1;if(!this.#d){const t=Date.now(),i=!this.#z(t);if(this.#U&&this.#K){const r=this.#i.dequeue();this.#e||(this.#A(t),this.#m()),i&&this.#I(),this.emit("active"),r(),e=!0}}return e}#I(){this.#e||this.#l!==void 0||this.#a||(this.#l=setInterval(()=>{this.#D()},this.#c),this.#C=Date.now()+this.#c)}#D(){this.#a||(this.#l!==void 0&&(this.#s===0&&this.#n===0?this.#w():this.#C=Date.now()+this.#c),this.#s=this.#t?this.#n:0),this.#T(),this.#m()}#T(){for(;this.#y(););}get concurrency(){return this.#g}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#g=e,this.#T()}setPriority(e,t){if(typeof t!="number"||!Number.isFinite(t))throw new TypeError(`Expected \`priority\` to be a finite number, got \`${t}\` (${typeof t})`);this.#i.setPriority(e,t)}async add(e,t={}){if(t={timeout:this.timeout,...t,id:t.id??(this.#N++).toString()},t.timeout!==void 0&&!(Number.isFinite(t.timeout)&&t.timeout>0))throw new TypeError(`Expected \`timeout\` to be a positive finite number, got \`${t.timeout}\` (${typeof t.timeout})`);return new Promise((i,r)=>{const o=Symbol(`task-${t.id}`);let a=()=>{};const l=async()=>{a(),this.#n++,this.#_.set(o,{id:t.id,priority:t.priority??0,startTime:Date.now(),timeout:t.timeout});let c;try{try{t.signal?.throwIfAborted()}catch(f){throw this.#q(),this.#_.delete(o),f}let u=e({signal:t.signal});if(t.timeout!==void 0&&(u=wa(Promise.resolve(u),{milliseconds:t.timeout,message:`Task timed out after ${t.timeout}ms (queue has ${this.#n} running, ${this.#i.size} waiting)`})),t.signal){const{signal:f}=t;u=Promise.race([u,new Promise((p,C)=>{c=()=>{C(f.reason)},f.addEventListener("abort",c,{once:!0})})])}const h=await u;i(h),this.emit("completed",h)}catch(u){r(u),this.emit("error",u)}finally{c&&t.signal?.removeEventListener("abort",c),this.#_.delete(o),queueMicrotask(()=>{this.#M()})}};this.#i.enqueue(l,t);const d=()=>{if(this.#i instanceof Zi){this.#i.remove(l);return}this.#i.remove?.(t.id)};if(t.signal){const{signal:c}=t,u=()=>{a(),d(),r(c.reason),this.#y(),this.emit("next")};if(a=()=>{c.removeEventListener("abort",u),this.#E.delete(a)},c.aborted){u();return}c.addEventListener("abort",u,{once:!0}),this.#E.add(a)}this.emit("add"),this.#y()})}async addAll(e,t){return Promise.all(e.map(async i=>this.add(i,t)))}start(){return this.#d?(this.#d=!1,this.#T(),this):this}pause(){this.#d=!0}clear(){for(const e of this.#E)e();this.#i=new this.#v,this.#w(),this.#k(),this.emit("empty"),this.#n===0&&(this.#x(),this.emit("idle")),this.emit("next")}async onEmpty(){this.#i.size!==0&&await this.#h("empty")}async onSizeLessThan(e){this.#i.size<e||await this.#h(["next","active"],()=>this.#i.size<e)}async onIdle(){this.#n===0&&this.#i.size===0||await this.#h("idle")}async onPendingZero(){this.#n!==0&&await this.#h("pendingZero")}async onRateLimit(){this.isRateLimited||await this.#h("rateLimit")}async onRateLimitCleared(){this.isRateLimited&&await this.#h("rateLimitCleared")}onError(){return new Promise((e,t)=>{const i=r=>{this.off("error",i),t(r)};this.on("error",i)})}async#h(e,t){const i=Array.isArray(e)?e:[e];return new Promise(r=>{const o=()=>{if(!(t&&!t())){for(const a of i)this.off(a,o);r()}};for(const a of i)this.on(a,o)})}get size(){return this.#i.size}sizeBy(e){return this.#i.filter(e).length}get pending(){return this.#n}get isPaused(){return this.#d}#P(){this.#e||(this.on("add",()=>{this.#i.size>0&&this.#m()}),this.on("next",()=>{this.#m()}))}#m(){this.#e||this.#R||(this.#R=!0,queueMicrotask(()=>{this.#R=!1,this.#k()}))}#q(){this.#e||(this.#L(),this.#m())}#k(){const e=this.#p;if(this.#e||this.#i.size===0){e&&(this.#p=!1,this.emit("rateLimitCleared"));return}let t;if(this.#a){const r=Date.now();this.#O(r),t=this.#b()}else t=this.#s;const i=t>=this.#f;i!==e&&(this.#p=i,this.emit(i?"rateLimit":"rateLimitCleared"))}get isRateLimited(){return this.#p}get isSaturated(){return this.#n===this.#g&&this.#i.size>0||this.isRateLimited&&this.#i.size>0}get runningTasks(){return[...this.#_.values()].map(e=>({...e,timeoutRemaining:e.timeout?Math.max(0,e.startTime+e.timeout-Date.now()):void 0}))}}const xa=()=>{const n=we.useAnalyticsConfigStore(),e=s.inject(ve);if(!e)return;if(e.queryFnOverride){console.warn("Detected incorrect use of useRequestQueue. This composable should not be used in nested components. Please discuss with team-data or report an issue if you feel you have a use case.");return}const t=new Sa({carryoverConcurrencyCount:!0,concurrency:n.maxParallelRequests,interval:n.requestInterval,intervalCap:n.requestIntervalCap}),i={...e,queryFnOverride:!0,queryFn:(r,o)=>t.add(()=>e.queryFn(r,o))};s.provide(ve,i)};function Ia(n){const e=`[${n.name}] ${n.message}`,t=[];return n.fix&&t.push(`fix: ${n.fix}`),n.sources?.length&&t.push(`sources: ${n.sources.join(", ")}`),n.docs&&t.push(`see: ${n.docs}`),t.length===0?e:[e,...t.map((i,r)=>`${r<t.length-1?"├▶":"╰▶"} ${i}`)].join(`
12
- `)}function Ji(n,...e){return typeof n=="function"?n(...e):n}function Da({method:n="warn",formatter:e=Ia}={}){return(t,{method:i=n}={})=>{console[i](e(t))}}const ka=Error.captureStackTrace;var Na=class qn extends Error{name;code;docs;fix;sources;get why(){return this.message}constructor(e,t=qn){super(e.why,{cause:e.cause}),this.code=this.name=e.code,this.fix=e.fix,this.docs=e.docs,this.sources=e.sources,ka?.(this,t)}toJSON(){return{name:this.name,why:this.why,fix:this.fix,docs:this.docs,sources:this.sources,cause:this.cause,stack:this.stack}}};function Aa(n,e){return typeof n=="string"?`${n}/${e.toLowerCase()}`:n?.(e)}function La(n){const e=n.reporters??[],t={},{docsBase:i}=n;for(const r of Object.keys(n.codes)){const o=n.codes[r],a=o.docs===!1?void 0:o.docs||Aa(i,r),l=(d={},c={})=>{const u=new Na({code:r,why:Ji(o.why,d),fix:Ji(o.fix,d),docs:a,cause:d.cause,sources:d.sources},l);for(const h of e)h(u,c);return u};t[r]=l}return t}const Ua=typeof window<"u",Ka=La({reporters:[Da()],codes:{PINIA_R1001:{why:'Directly pass all stores to "mapStores()" without putting them in an array. This will fail in production.',fix:"Replace mapStores([useAuthStore, useCartStore]) with mapStores(useAuthStore, useCartStore).",docs:"https://pinia.vuejs.org/cookbook/options-api.html#Giving-access-to-the-whole-store"},PINIA_R1002:{why:n=>`A getter cannot have the same name as another state property. Found "${n.name}" in store "${n.id}".`,fix:"Rename either the getter or the state property.",docs:"https://pinia.vuejs.org/core-concepts/getters.html#Accessing-other-getters"},PINIA_R1003:{why:n=>`The "state" must be a plain object. Found in store "${n.id}".`,fix:"Return a plain object, e.g. avoid state: () => new MyClass().",docs:"https://pinia.vuejs.org/core-concepts/state.html#State"},PINIA_R1004:{why:"Pinia instance not found in context. This falls back to the global activePinia, which exposes you to cross-request pollution on the server.",fix:'"useStore()" is a composable and follows the same rules: call it at the top of setup() (or another composable), or pass the pinia instance explicitly when used outside of a component.',docs:"https://pinia.vuejs.org/ssr/#Using-the-store-outside-of-setup-"},PINIA_R1005:{why:n=>`The store id changed from "${n.from}" to "${n.to}", forcing a reload.`,docs:"https://pinia.vuejs.org/cookbook/hot-module-replacement.html#HMR-Hot-Module-Replacement-"},PINIA_R1006:{why:n=>`Property "${n.key}" of store "${n.id}" is not reactive (not a ref, reactive object, or shallowRef), so storeToRefs() ignores it.`,fix:"If it should be reactive state, wrap it with ref(), reactive(), or shallowRef(). If it is an intentional non-reactive property, wrap it with markRaw() so storeToRefs() skips it explicitly.",docs:"https://pinia.vuejs.org/core-concepts/plugins.html#Adding-new-external-properties"},PINIA_R1007:{why:n=>`The same callback was passed to "$subscribe()" of store "${n.id}" more than once. Subscriptions are deduplicated, so the duplicate is ignored.`,fix:"Subscribe each callback only once. If you need to resubscribe, call the returned function to remove the previous subscription first, or create a new function.",docs:"https://pinia.vuejs.org/core-concepts/state.html#Subscribing-to-the-state"}}});let en;process.env.NODE_ENV;const tn=process.env.NODE_ENV!=="production"?Symbol("pinia"):Symbol();process.env.NODE_ENV;function Ye(n){const e=s.toRaw(n),t={};for(const i in e){const r=e[i];r?.effect?t[i]=s.computed({get:()=>n[i],set(o){n[i]=o}}):(s.isRef(r)||s.isReactive(r))&&(t[i]=s.toRef(n,i))}return t}const De=n=>n?.chart.type==="table",Ht=n=>n?.query?.datasource==="requests",Gt=n=>!!n&&!De(n)&&!Ht(n),Ma=(n,e)=>{const t=n.header_description??("description"in n.chart?n.chart.description:void 0);if(t)return t.replaceAll(Wi,e)||void 0},Ba=["basic","api_usage","llm_usage","agentic_usage","platform","platform_usage","managed_cache_usage",void 0],za=n=>Ba.includes(n);function Pa({queryBridge:n,context:e,definition:t,chartData:i}){const r=s.ref(""),o=s.ref(""),a=s.ref(void 0),l=s.ref(void 0),d=we.useAnalyticsConfigStore(),c=we.useDatasourceConfigStore(),{stripUnknownFilters:u,loading:h}=Ye(c),f=s.computed(()=>De(t.value));s.onMounted(async()=>{r.value=await n?.exploreBaseUrl?.()??"",o.value=await n?.requestsBaseUrl?.()??""});const p=s.computed(()=>d.analytics&&d.percentiles),C=s.computed(()=>{const _=t.value.chart.type;return["golden_signals","gauge"].includes(_)?!1:_==="top_n"?!!e.value.editable||!!e.value.showTileActions:!0}),E=s.computed(()=>o.value&&t.value.query&&!f.value&&t.value.query.datasource!=="llm_usage"&&t.value.query.datasource!=="managed_cache_usage"&&!ie.isPlatformDatasource(t.value.query.datasource)&&p.value&&!h.value),R=s.computed(()=>r.value&&t.value.query&&za(t.value.query.datasource)&&p.value&&!h.value),I=s.computed(()=>i.value?ie.msToGranularity(i.value.meta.granularity_ms):void 0),D=s.computed(()=>{const _=t.value,v=[...e.value.filters,..._.query.filters??[]],x="metrics"in _.query?_.query.metrics:void 0,q=_.query?.datasource??"api_usage";return u.value({datasource:q,filters:v,queryFields:x})}),w=s.computed(()=>{if(!R.value||!C.value)return"";const _=t.value;if(De(_))return g({..._.query,filters:D.value});const v=_.query.time_range||e.value.timeSpec,x=m(v,D.value);return g(x)}),O=s.computed(()=>{if(!E.value||!C.value)return"";const _=D.value,v=t.value;if(De(v))return"";const x=U(v.query.time_range||e.value.timeSpec,_);return S(x)}),S=_=>E.value?`${o.value}?q=${JSON.stringify(_)}`:"",U=(_,v)=>{const x=i.value?.meta?.start?new Date(i.value.meta.start):void 0,q=i.value?.meta?.end?new Date(i.value.meta.end):void 0;return{filter:v,timeframe:{timePeriodsKey:_.type==="relative"?_.time_range:"custom",start:_.type==="absolute"?x:void 0,end:_.type==="absolute"?q:void 0}}},K=(_,v)=>({filter:v,timeframe:{timePeriodsKey:_.type==="relative"?_.time_range:"custom",start:_.type==="absolute"?_.start:void 0,end:_.type==="absolute"?_.end:void 0}}),m=(_,v)=>{const x=t.value;if(!Gt(x))throw new Error("Cannot build a chart explore query for table or api-requests definitions");const q=[...x.query.dimensions??[]],P=[...x.query.metrics??[]];return{filters:v,metrics:P,dimensions:q,time_range:_,granularity:x.query.granularity||I.value||void 0}},g=_=>{if(!R.value)return"";const v=t.value.query.datasource&&t.value.query.datasource!=="basic"?t.value.query.datasource:"api_usage";return`${r.value}?q=${JSON.stringify(_)}&d=${v}&c=${t.value.chart.type}`};return s.watch([E,R],([_,v])=>{_&&(a.value={href:""}),v&&(l.value={href:""})}),{exploreLinkKebabMenu:w,requestsLinkKebabMenu:O,canShowKebabMenu:C,canGenerateRequestsLink:E,canGenerateExploreLink:R,requestsLinkZoomActions:a,exploreLinkZoomActions:l,buildExploreQuery:m,buildRequestsQueryZoomActions:K,buildExploreLink:g,buildRequestLink:S}}const $t=n=>n.type==="relative"?ie.TimePeriods.get(ie.TIMEFRAME_LOOKUP[n.time_range])?.timeframeLengthMs():new Date(n.end).getTime()-new Date(n.start).getTime(),qa=n=>n.reduce((e,t)=>{const i=ie.TimePeriods.get(ie.TIMEFRAME_LOOKUP[t])?.maximumTimeframeLength();return i===void 0||e&&i<=e.durationSeconds?e:{durationSeconds:i,key:t}},void 0),Ft=(n,e)=>{if(!n||!e?.length)return;const t=$t(n),i=qa(e);return t!==void 0&&i&&t>i.durationSeconds*1e3?i:void 0},Wt=(n,e)=>{const t=Ft(n,e);return!t||!n?n:n.type==="relative"?{...n,time_range:t.key}:{...n,start:new Date(new Date(n.end).getTime()-t.durationSeconds*1e3)}};function Ha(){const n=s.inject(ve),e=we.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Ye(e);let r=null;return s.onUnmounted(()=>{r?.abort()}),{issueQuery:async(a,l,d)=>{if(!n)throw new Error("Query bridge is not defined");r?.abort();const c=new AbortController;r=c,await e.isReady();const{datasource:u,limit:h,...f}=a,p=u||"basic",C=ie.isPlatformDatasource(p),E=i.value({datasource:p,filters:[...a.filters??[],...l.filters],queryFields:a.metrics}).filter(({operator:D})=>!C||!ie.requestFilterTypeEmptyV2.some(w=>w===D));let R=a.time_range;!R&&l.timeSpec?R={...l.timeSpec,tz:l.tz}:R&&!R.tz&&(R={...R,tz:l.tz}),R=Wt(R,t.value[p]?.timeRangeOptions);const I={datasource:p,query:{...f,time_range:R,filters:E,limit:d??h}};return n.queryFn(I,c)}}}const Ga="24H",$a={status_code:"response_http_status",upstream_status_code:"upstream_status"},Fa={cost:"usd",latencies_response_ms:"ms",latencies_upstream_ms:"ms",latencies_kong_gateway_ms:"ms",latencies_kong_internal_ms:"ms",request_body_size:"bytes",response_body_size:"bytes",response_header_content_length:"bytes",ai_count:"count"},Wa=n=>ie.relativeTimeRangeValuesRequestV2.includes(n),Va=n=>{const e=n?.tz?{tz:n.tz}:{};if(n?.type==="absolute")return{type:"absolute",start:n.start,end:n.end,...e};const t=n?.time_range.toUpperCase()??"";return{type:"relative",time_range:Wa(t)?t:Ga,...e}},nn=n=>$a[n]??n,Ya=n=>({metric:nn(n.metric),dimension:n.dimension?nn(n.dimension):void 0,unroll:n.unroll,metricUnit:Fa[n.metric],extraFields:n.extra_fields}),Vt="requests";function Xa(){const n=s.inject(ve),e=we.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Ye(e);let r=null;s.onUnmounted(()=>{r?.abort()});const o=(l,d)=>{const c=l.time_range??d.timeSpec;return Wt(c&&{...c,tz:c.tz??d.tz},t.value[Vt]?.timeRangeOptions)};return{issueRequestsQuery:async(l,d)=>{const c=n?.requestsQueryFn;if(!c)throw new Error("Query bridge cannot fetch request records");r?.abort();const u=new AbortController;r=u,await e.isReady();const h=i.value({datasource:Vt,filters:[...l.filters??[],...d.filters]});return ie.fetchAllRequests(c,{datasource:Vt,query:{filters:h,time_range:Va(o(l,d))}},u,{maxRecords:l.max_records})}}}function ja({context:n,globalFilters:e=s.ref([]),isFullscreen:t=s.ref(!1),preview:i=s.ref(!1)}){const r=we.useAnalyticsConfigStore(),o=we.useDatasourceConfigStore(),{loading:a}=Ye(r),{loading:l}=Ye(o),d=s.computed(()=>n.value.timeSpec?n.value.timeSpec:{type:"relative",time_range:r.defaultQueryTimeForOrg}),c=s.computed(()=>{const{tz:O}=n.value;return O||new Intl.DateTimeFormat().resolvedOptions().timeZone}),u=s.computed(()=>{const{editable:O}=n.value;return O===void 0||i.value?!1:O}),h=s.computed(()=>{const{showTileActions:O}=n.value;return i.value?!1:O===void 0?!0:O}),f=s.computed(()=>[...n.value.filters??[],...e.value]),p=s.computed(()=>{let{refreshInterval:O}=n.value;if(O===void 0&&(O=Vi),t.value){let S=!1;if(d.value.type==="relative")S=["15m","1h","6h","12h","24h"].includes(d.value.time_range);else{const m=d.value.start.getTime(),g=d.value.end.getTime();S=Math.abs(g-m)<=864e5}const U=new Date().getTime();d.value.type==="absolute"&&d.value.end.getTime()<U||d.value.type==="relative"&&["previous_week","previous_month"].includes(d.value.time_range)?O=0:S?O=Yi:O=Xi}return O}),C=s.computed(()=>({...n.value,filters:f.value,timeSpec:d.value,tz:c.value,refreshInterval:p.value,editable:u.value,showTileActions:h.value})),E=s.computed(()=>!a.value&&!l.value),R=s.computed(()=>!i.value&&!!s.getCurrentInstance()?.vnode?.props?.onTileTimeRangeZoom),I=s.computed(()=>!i.value),D=s.computed(()=>!i.value),w=s.computed(()=>({enabled:R.value,showExploreAction:I.value,showRequestsAction:D.value,showZoomInAction:R.value}));return{editable:u,enrichedContext:C,filters:f,queryReady:E,refreshInterval:p,showTileActions:h,timeSpec:d,tz:c,zoomConfiguration:w}}const Qa=6,rn=6,sn=4;function Za(n,e){const{pageWidth:t,pageHeight:i,margin:r}=e,o=r+1,a=r+e.headerHeight-3,l=i-r-rn+3,d=l+4;e.title&&(n.setFont("helvetica","bold"),n.setFontSize(11),n.setTextColor(60),n.text(e.title,r,o)),n.setFont("helvetica","normal"),n.setFontSize(8),n.setTextColor(120),n.text(e.generatedAt,t-r,o,{align:"right"}),e.subtitle&&n.text(e.subtitle,r,o+sn),n.setDrawColor(220),n.line(r,a,t-r,a),n.line(r,l,t-r,l),n.setFont("helvetica","bold"),n.setTextColor(60),n.text(e.branding,r,d);const c=n.getTextWidth(e.branding);n.setFont("helvetica","normal");const u=` ${e.dashboardNote}`;e.dashboardUrl?(n.setTextColor(0,68,204),n.textWithLink(u,r+c,d,{url:e.dashboardUrl})):(n.setTextColor(120),n.text(u,r+c,d)),n.setTextColor(120),n.text(e.pageLabel,t-r,d,{align:"right"})}function Ja(n){const e=n.querySelectorAll(".kong-ui-public-grid-layout, .grid-stack"),t=[];if(e.forEach(o=>{t.push(...o.querySelectorAll(":scope > .grid-cell:not(.empty-cell), :scope > .grid-stack-item"))}),!t.length)return[];const i=n.getBoundingClientRect().top,r=new Map;return t.forEach(o=>{const a=o.getBoundingClientRect(),l=Math.round(a.top-i),d=Math.round(a.bottom-i),c=r.get(l);r.set(l,c!==void 0?Math.max(c,d):d)}),[...r.entries()].map(([o,a])=>({top:o,bottom:a})).sort((o,a)=>o.top-a.top)}function el(n,e,t,i){if(!n.length){const a=[];let l=0;for(;l<e;){const d=Math.min(t,e-l);a.push({startY:l,height:d}),l+=d}return a}const r=[];let o=0;for(const a of n){const l=a.top*i,d=a.bottom*i;d-o>t&&(l>o?(r.push({startY:o,height:l-o}),o=l):(r.push({startY:o,height:d-o}),o=d))}return o<e&&r.push({startY:o,height:e-o}),r}function tl(n){const{i18n:e}=pt(),t=s.ref({status:"idle"});async function i(r={}){const{filename:o="dashboard-export",title:a,subtitle:l,dashboardUrl:d,orientation:c="landscape",pageSize:u="letter",margin:h=4,scale:f=2,exclude:p=[".tile-actions",".tooltip",".popover",".dropdown-popover"],output:C="download",onBeforeCapture:E,onAfterCapture:R}=r,I=n.value;if(!I){t.value={status:"error",error:new Error("Dashboard layout container not found.")};return}try{t.value={status:"preparing"},await E?.();const[{snapdom:D},{jsPDF:w}]=await Promise.all([import("@zumer/snapdom"),import("jspdf")]);t.value={status:"capturing"};const O={name:"kong-webgl-snapshot",beforeClone:()=>ie.prepareForCapture(),afterClone:()=>ie.restoreAfterCapture()},S=await D.toCanvas(I,{scale:f,exclude:p,excludeMode:"remove",embedFonts:!0,plugins:[O]}),U=Ja(I),K=I.getBoundingClientRect().width,m=K?S.width/K:f;t.value={status:"generating"};const g=new Date,_=new w({orientation:c,unit:"mm",format:u}),v=_.internal.pageSize.getWidth(),x=_.internal.pageSize.getHeight(),q=Qa+(l?sn:0),P=v-h*2,W=x-h*2-q-rn,j=S.width/P,F=W*j,b=el(U,S.height,F,m),T={title:a,subtitle:l,dashboardUrl:d,generatedAt:e.t("pdfExport.generated",{timestamp:g.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}),branding:e.t("pdfExport.branding"),dashboardNote:e.t("pdfExport.dashboardNote"),pageWidth:v,pageHeight:x,headerHeight:q,margin:h};for(let A=0;A<b.length;A++){A>0&&_.addPage();const{startY:k,height:z}=b[A],N=document.createElement("canvas");N.width=S.width,N.height=z,N.getContext("2d").drawImage(S,0,k,S.width,z,0,0,S.width,z),_.addImage(N.toDataURL("image/png"),"PNG",h,h+q,P,z/j),Za(_,{...T,pageLabel:e.t("pdfExport.pageOf",{page:String(A+1),total:String(b.length)})})}if(C==="blob"){const A=_.output("blob");return t.value={status:"complete",pageCount:b.length},A}_.save(o),t.value={status:"complete",pageCount:b.length}}catch(D){t.value={status:"error",error:D}}finally{ie.restoreAfterCapture(),await R?.()}}return{exportPdf:i,exportState:s.readonly(t)}}const il=n=>n.toLowerCase().endsWith("count")?"":n;function nl(){const{i18n:n}=pt(),{formatUnit:e}=ie.unitFormatter({i18n:n}),t=le.useFieldLabel();return i=>{const r=i.meta?.metric_names?.[0]??"",o=i.meta?.metric_units?.[r]??"";return{seriesName:t(r),valueFormatter:a=>e(a,o,{translateUnit:il})}}}const on=(n,e,t,{prefix:i="chartLabels",fallback:r=t}={})=>{const o=`${i}.${t}`;return e.get(t)||(n.te(o)?n.t(o):r)};function rl(){const{i18n:n}=pt(),e=we.useDatasourceConfigStore();return(t,i)=>on(n,e.fieldTranslationMap,t,i)}const le={useContextLinks:Pa,useDashboardContext:ja,useEvaluateFeatureFlag:Ca,useExportPdf:tl,useFieldLabel:rl,useI18n:pt,useIssueQuery:Ha,useIssueRequestsQuery:Xa,useMetricFormatter:nl,useRequestQueue:xa},sl={class:"kong-ui-public-csv-export-modal"},ol={key:0,class:"selected-range"},al={key:4,class:"text-muted",tag:"span"},an=3,ln=s.defineComponent({__name:"CsvExportModal",props:{exportState:{},filename:{},modalDescription:{default:void 0}},emits:["closeModal"],setup(n,{emit:e}){const{i18n:t}=le.useI18n(),i=le.useFieldLabel(),r=n,o=e,a=`${r.filename.replace(/\s+/g,"-").toLowerCase()}-${new Date().toISOString().slice(0,10)}.csv`,l=s.ref(1),d=s.computed(()=>p.value.rows.length),c=s.computed(()=>r.exportState.status==="success"&&!!r.exportState.chartData?.data?.length),u=s.computed(()=>{if(r.exportState.status!=="success"||!r.exportState.chartData?.meta)return"";const{start:E,end:R}=r.exportState.chartData.meta;return!E||!R?"":new Date(E).getTime()===new Date(R).getTime()?t.t("csvExport.exportAsOf",{time:ie.formatTimestamp(new Date(E),{includeTZ:!0})}):`${t.t("csvExport.exportTimeRange")}: ${ie.formatTimestamp(new Date(E))} - ${ie.formatTimestamp(new Date(R),{includeTZ:!0})}`}),h=s.computed(()=>r.exportState.status!=="success"?"":t.t("csvExport.previewRows",{rowsMax:Math.min(an,d.value),rowsTotal:d.value,plural:d.value===1?"":"s"})),f=()=>{o("closeModal")},p=s.computed(()=>{if(r.exportState.status!=="success"||!c.value||!r.exportState.chartData?.meta.metric_names)return{headers:[],rows:[],csvHeaders:{}};const E=r.exportState.chartData,R=E.data.some(U=>U.timestamp!==E.data[0].timestamp),I=E.data.map(U=>{const K=new Date(U.timestamp);return{...Object.keys(U.event).reduce((g,_)=>{if(_ in E.meta.display){const v=U.event[_],x=E.meta.display[_];g[_]=v&&x?.[v]?.name||U.event[_]}else g[_]=U.event[_];return g},{}),...R?{timestamp:Kt(K,"yyyy-MM-dd HH:mm:ss"),tzOffset:Kt(K,"XXX")}:{}}});let D=[];R&&(D=[{label:t.t("csvExport.Timestamp"),key:"timestamp"},{label:t.t("csvExport.UtcOffset"),key:"tzOffset"}]);const w="display"in r.exportState.chartData.meta&&r.exportState.chartData.meta.display?r.exportState.chartData.meta.display:{},O=[...D,...Object.keys(w).map(U=>({label:i(U),key:U})),...r.exportState.chartData.meta.metric_names.map(U=>({label:i(U),key:U}))],S=O.reduce((U,K)=>(U[K.key]=K.label,U),{});return{headers:O,csvHeaders:S,rows:I}}),C=async()=>{if(r.exportState.status!=="success")return{total:0,data:[]};const{rows:E}=p.value;return{total:Number(E.length)||0,data:E.slice(0,an)}};return s.watch(p,()=>{l.value++}),(E,R)=>{const I=s.resolveComponent("KSkeleton"),D=s.resolveComponent("KEmptyState"),w=s.resolveComponent("KTableData"),O=s.resolveComponent("KTooltip"),S=s.resolveComponent("KButton"),U=s.resolveComponent("KModal");return s.openBlock(),s.createElementBlock("div",sl,[s.createVNode(U,{class:"vitals-report","data-testid":"csv-export-modal","show-dismiss-icon":"",title:s.unref(t).t("csvExport.exportPreview"),visible:"",onCancel:f,onKeyup:s.withKeys(f,["esc"])},{default:s.withCtx(()=>[s.createElementVNode("div",null,[n.exportState.status==="success"&&c.value?(s.openBlock(),s.createElementBlock("div",ol,[s.createElementVNode("p",null,s.toDisplayString(n.modalDescription?n.modalDescription:s.unref(t).t("csvExport.exportDescription")),1),s.createElementVNode("p",null,s.toDisplayString(u.value),1)])):s.createCommentVNode("",!0),n.exportState.status==="loading"?(s.openBlock(),s.createBlock(I,{key:1,class:"chart-skeleton",type:"table"})):n.exportState.status==="success"?(s.openBlock(),s.createBlock(w,{key:2,class:"vitals-table",fetcher:C,"fetcher-cache-key":String(l.value),headers:p.value.headers,"hide-pagination":"","row-hover":!1,sortable:!1},{"empty-state":s.withCtx(()=>[s.createVNode(D,{"action-button-visible":!1},{title:s.withCtx(()=>[s.createElementVNode("h5",null,s.toDisplayString(s.unref(t).t("csvExport.noDataRange")),1)]),default:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(s.unref(t).t("csvExport.noDataRetry")),1)]),_:1})]),_:1},8,["fetcher-cache-key","headers"])):n.exportState.status==="error"?(s.openBlock(),s.createBlock(D,{key:3,"action-button-visible":!1},{title:s.withCtx(()=>[s.createElementVNode("h5",null,s.toDisplayString(s.unref(t).t("csvExport.dataError")),1)]),_:1})):s.createCommentVNode("",!0),n.exportState.status==="success"&&c.value?(s.openBlock(),s.createElementBlock("div",al,[s.createTextVNode(s.toDisplayString(h.value)+" ",1),s.createVNode(O,{class:"preview-tooltip",placement:"right",text:s.unref(t).t("csvExport.maximumRecordAmount",{value:s.unref(ie.EXPORT_RECORD_LIMIT)})},{default:s.withCtx(()=>[s.createVNode(s.unref(se.InfoIcon),{color:`var(--kui-color-text-neutral, ${s.unref(Mt)})`,size:`var(--kui-icon-size-30, ${s.unref(aa)})`},null,8,["color","size"])]),_:1},8,["text"])])):s.createCommentVNode("",!0)])]),"footer-actions":s.withCtx(()=>[s.createVNode(S,{appearance:"tertiary",class:"cancel-btn",onClick:f},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(t).t("csvExport.cancelButton")),1)]),_:1}),s.createVNode(ya,{class:"vitals-report-export-button",filename:a,headers:p.value.csvHeaders,rows:p.value.rows},{default:s.withCtx(()=>[s.createVNode(S,{appearance:"primary","data-testid":"csv-download-button",disabled:n.exportState.status!=="success"||!c.value},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(t).t("csvExport.downloadButton")),1)]),_:1},8,["disabled"])]),_:1},8,["headers","rows"])]),_:1},8,["title"])])}}});var cn=(n=>(n.VALIDATING="VALIDATING",n.VALIDATING_HAS_DATA="VALIDATING_HAS_DATA",n.PENDING="PENDING",n.SUCCESS="SUCCESS",n.SUCCESS_HAS_DATA="SUCCESS_HAS_DATA",n.ERROR="ERROR",n.STALE_IF_ERROR="STALE_IF_ERROR",n))(cn||{});const ll=n=>n?!!(Object.keys(n)?.length||n.data?.length||n.data?.data?.length||!n.data?.data&&typeof n.data=="object"&&Object.keys(n?.data).length):!1;function un(n=s.ref({}),e,t,i=ll){const r=s.ref("PENDING");return s.watchEffect(()=>{const o=i(n.value);if(n.value&&o&&t.value){r.value="VALIDATING_HAS_DATA";return}if(n.value&&t.value){r.value="VALIDATING";return}if(n.value&&e.value){r.value="STALE_IF_ERROR";return}if(n.value===void 0&&!e.value){r.value="PENDING";return}if(n.value&&!e.value&&o){r.value="SUCCESS_HAS_DATA";return}if(n.value&&!e.value){r.value="SUCCESS";return}n.value===void 0&&e&&(r.value="ERROR")}),{state:r,swrvState:cn}}const Be=s.defineComponent({__name:"QueryDataProvider",props:{context:{},limitOverride:{},query:{},queryReady:{type:Boolean},refreshCounter:{}},emits:["chart-data","query-complete"],setup(n,{emit:e}){const t=n,i=e,{i18n:r}=le.useI18n(),{issueQuery:o}=le.useIssueQuery(),a=s.inject(ve),l=()=>t.queryReady&&a?JSON.stringify([t.query,t.context,t.refreshCounter]):null,{data:d,error:c,isValidating:u}=oi(l,async()=>{const D=l();try{const w=await o(t.query,t.context,t.limitOverride);return l()!==D?void 0:(p.value=null,w)}catch(w){if(l()!==D)return;throw p.value=be.handleQueryError(w),w}finally{l()===D&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:h,swrvState:f}=un(d,c,u),p=s.ref(null),C=s.computed(()=>h.value===f.ERROR||!!p.value),E=s.computed(()=>!t.queryReady||h.value===f.PENDING),R=s.ref(),I=s.computed(()=>d.value??(t.queryReady&&h.value===f.PENDING?R.value:void 0));return s.watch([()=>d.value,()=>h.value],([D,w])=>{D&&(w==="SUCCESS_HAS_DATA"||w==="SUCCESS")&&D!==R.value&&(R.value=D,i("chart-data",D))}),(D,w)=>{const O=s.resolveComponent("KSkeleton"),S=s.resolveComponent("KEmptyState");return(E.value||!s.unref(d)&&!C.value)&&!I.value?(s.openBlock(),s.createBlock(O,{key:0,class:"chart-skeleton",type:"table"})):C.value&&!E.value?(s.openBlock(),s.createBlock(S,{key:1,"action-button-visible":!1,"data-testid":"chart-empty-state"},s.createSlots({icon:s.withCtx(()=>[p.value?.type==="forbidden"?(s.openBlock(),s.createBlock(s.unref(se.VisibilityOffIcon),{key:0})):(s.openBlock(),s.createBlock(s.unref(se.WarningOutlineIcon),{key:1}))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(p.value?.message||s.unref(r).t("renderer.unexpectedError")),1)]),_:2},[p.value?.details?{name:"default",fn:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(p.value.details),1)]),key:"0"}:void 0]),1024)):I.value?s.renderSlot(D.$slots,"default",{data:I.value},void 0,void 0,2):s.createCommentVNode("",!0)}}}),cl=s.defineComponent({__name:"SimpleChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},fitToContent:{type:Boolean}},setup(n){const e=n,t=s.computed(()=>e.chartOptions.type==="single_value"),i=s.computed(()=>e.chartOptions.type==="single_value"?{...e.chartOptions,alignX:e.chartOptions.align_x??"left",showTrend:e.query.granularity==="trend",compact:!!e.fitToContent,hideMetricName:!e.chartOptions.chart_title}:e.chartOptions);return(r,o)=>(s.openBlock(),s.createBlock(Be,{context:n.context,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter},{default:s.withCtx(({data:a})=>[s.createElementVNode("div",{class:s.normalizeClass(["analytics-chart",{"single-value":t.value,compact:t.value&&n.fitToContent}]),style:s.normalizeStyle(t.value?void 0:{height:`${n.height}px`})},[s.createVNode(s.unref(be.SimpleChart),{"chart-data":a,"chart-options":i.value,"synthetics-data-key":t.value?void 0:n.chartOptions.synthetics_data_key},null,8,["chart-data","chart-options","synthetics-data-key"])],6)]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),Se=(n,e)=>{const t=n.__vccOpts||n;for(const[i,r]of e)t[i]=r;return t},dn=Se(cl,[["__scopeId","data-v-df5d87ad"]]),ul={class:"analytics-chart"},Yt=Se(s.defineComponent({__name:"BaseAnalyticsChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},extraProps:{}},emits:["edit-tile","chart-data","zoom-time-range","view-requests","select-chart-range"],setup(n,{emit:e}){const t=n,i=e,{i18n:r}=le.useI18n(),o=s.computed(()=>({type:t.chartOptions.type,stacked:t.chartOptions.stacked??!1,chartDatasetColors:t.chartOptions.chart_dataset_colors,threshold:t.chartOptions.threshold,metricAxisMap:t.chartOptions.metric_axis_map,yAxes:t.chartOptions.y_axes&&{left:a(t.chartOptions.y_axes.left),right:a(t.chartOptions.y_axes.right)},hideTruncationWarning:t.query.limit!==void 0&&t.query.limit>0})),a=c=>c&&{title:c.title,showGrid:c.show_grid},l=()=>{i("edit-tile")},d=c=>{i("chart-data",c)};return(c,u)=>{const h=s.resolveComponent("KDropdownItem");return s.openBlock(),s.createBlock(Be,{context:n.context,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onChartData:d},{default:s.withCtx(({data:f})=>[s.createElementVNode("div",ul,[s.createVNode(s.unref(be.AnalyticsChart),s.mergeProps({"active-metric":n.activeMetric,"chart-data":f,"chart-options":o.value,"explore-link":n.exploreLink,"legend-position":"bottom","requests-link":n.requestsLink,"synthetics-data-key":n.chartOptions.synthetics_data_key,"timeseries-zoom":n.zoomConfiguration?.showZoomInAction,"tooltip-title":""},n.extraProps,{onSelectChartRange:u[0]||(u[0]=p=>i("select-chart-range",p)),onZoomTimeRange:u[1]||(u[1]=p=>i("zoom-time-range",p))}),s.createSlots({_:2},[n.context.editable?{name:"menu-items",fn:s.withCtx(()=>[s.createVNode(h,{onClick:l},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.edit")),1)]),_:1})]),key:"0"}:void 0]),1040,["active-metric","chart-data","chart-options","explore-link","requests-link","synthetics-data-key","timeseries-zoom"])])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-5e3d0a14"]]),hn=s.defineComponent({__name:"BarChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(n){return(e,t)=>(s.openBlock(),s.createBlock(Yt,{"chart-options":n.chartOptions,context:n.context,"extra-props":{showAnnotations:!1},height:n.height,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),dl={class:"analytics-chart"},hl={key:3,class:"analytics-chart"},fl=Se(s.defineComponent({__name:"ScatterChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(n,{emit:e}){const t=n,i=e,{i18n:r}=le.useI18n(),{issueRequestsQuery:o}=le.useIssueRequestsQuery(),a=s.computed(()=>t.query.datasource==="requests"),l=s.computed(()=>{const O=t.query,S=O.time_range??t.context.timeSpec,U=S?$t(S):void 0;if(!U)return O;const K=ie.finestGranularityForDuration(U);let m;return O.granularity&&ie.Granularities[O.granularity]>=ie.Granularities[K]?m=O.granularity:m=K,{...O,granularity:m}}),d=()=>a.value&&t.queryReady?JSON.stringify([t.query,t.context,t.refreshCounter]):null,c=s.ref(null),{data:u,error:h,isValidating:f}=oi(d,async()=>{const O=d(),S=t.query;try{const U=await o(S,t.context);return d()!==O?void 0:(c.value=null,be.requestsToScatterData(U,Ya(S)))}catch(U){if(d()!==O)return;throw c.value=be.handleQueryError(U),U}finally{d()===O&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:p,swrvState:C}=un(u,h,f),E=s.ref(),R=s.computed(()=>u.value??E.value);s.watch(u,O=>{O&&(E.value=O)});const I=s.computed(()=>p.value===C.ERROR||!!c.value),D=s.computed(()=>!I.value&&(!t.queryReady||p.value===C.PENDING)&&!R.value),w=s.computed(()=>({type:"scatter",chartDatasetColors:t.chartOptions.chart_dataset_colors,scatter:{percentileLines:t.chartOptions.percentile_lines?.map(O=>({percentile:O.percentile,label:O.label,borderDash:O.border_dash,color:O.color})),outlierPercentile:t.chartOptions.outlier_percentile,shadeOutlierRegion:t.chartOptions.shade_outlier_region,jitterMs:t.chartOptions.jitter_ms,pointRadius:t.chartOptions.point_radius,pointOpacity:t.chartOptions.point_opacity}}));return(O,S)=>{const U=s.resolveComponent("KSkeleton"),K=s.resolveComponent("KEmptyState");return a.value?D.value?(s.openBlock(),s.createBlock(U,{key:1,class:"chart-skeleton",type:"table"})):I.value?(s.openBlock(),s.createBlock(K,{key:2,"action-button-visible":!1,"data-testid":"scatter-chart-empty-state"},s.createSlots({icon:s.withCtx(()=>[c.value?.type==="forbidden"?(s.openBlock(),s.createBlock(s.unref(se.VisibilityOffIcon),{key:0})):(s.openBlock(),s.createBlock(s.unref(se.WarningOutlineIcon),{key:1}))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(c.value?.message||s.unref(r).t("renderer.unexpectedError")),1)]),_:2},[c.value?.details?{name:"default",fn:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(c.value.details),1)]),key:"0"}:void 0]),1024)):R.value?(s.openBlock(),s.createElementBlock("div",hl,[s.createVNode(s.unref(be.AnalyticsChart),{"chart-data":R.value,"chart-options":w.value,"legend-position":"bottom","synthetics-data-key":n.chartOptions.synthetics_data_key,"tooltip-title":""},null,8,["chart-data","chart-options","synthetics-data-key"])])):s.createCommentVNode("",!0):(s.openBlock(),s.createBlock(Be,{key:0,context:n.context,query:l.value,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onChartData:S[0]||(S[0]=m=>i("chart-data",m)),onQueryComplete:S[1]||(S[1]=m=>i("query-complete"))},{default:s.withCtx(({data:m})=>[s.createElementVNode("div",dl,[s.createVNode(s.unref(be.AnalyticsChart),{"chart-data":m,"chart-options":w.value,"legend-position":"bottom","synthetics-data-key":n.chartOptions.synthetics_data_key,"tooltip-title":""},null,8,["chart-data","chart-options","synthetics-data-key"])])]),_:1},8,["context","query","query-ready","refresh-counter"]))}}}),[["__scopeId","data-v-e823be94"]]),fn=s.defineComponent({__name:"TimeseriesChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["zoom-time-range","select-chart-range"],setup(n,{emit:e}){const t=e;return(i,r)=>(s.openBlock(),s.createBlock(Yt,{"active-metric":n.activeMetric,"chart-options":n.chartOptions,context:n.context,"explore-link":n.exploreLink,height:n.height,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,"requests-link":n.requestsLink,"zoom-configuration":n.zoomConfiguration,onSelectChartRange:r[0]||(r[0]=o=>t("select-chart-range",o)),onZoomTimeRange:r[1]||(r[1]=o=>t("zoom-time-range",o))},null,8,["active-metric","chart-options","context","explore-link","height","query","query-ready","refresh-counter","requests-link","zoom-configuration"]))}}),ml=Se(s.defineComponent({__name:"GoldenSignalsRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(n){const e=n,t=s.computed(()=>{const r=e.query?.datasource;if(r&&r!=="api_usage"&&r!=="basic")throw new Error(`Invalid datasource value: ${r}`);return{datasource:e.query?.datasource,overrideTimeRange:e.context.timeSpec,additionalFilter:e.context.filters,longCardTitles:e.chartOptions.long_card_titles,percentileLatency:e.chartOptions.percentile_latency,refreshInterval:e.context.refreshInterval,queryReady:e.queryReady,refreshCounter:e.refreshCounter}}),i=s.computed(()=>!!(e.chartOptions.chart_title||e.headerDescription));return(r,o)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["metric-card-tile-wrapper",{titled:i.value}])},[s.createVNode(s.unref(ai.MetricsProvider),s.normalizeProps(s.guardReactiveProps(t.value)),{default:s.withCtx(()=>[s.createVNode(s.unref(ai.MetricsConsumer))]),_:1},16)],2))}}),[["__scopeId","data-v-3eda5028"]]);var nt=(n=>(n.PENDING="PENDING",n.LOADING="LOADING",n.SUCCESS="SUCCESS",n.ERROR="ERROR",n))(nt||{});const pl=n=>!!n?.length;function gl(n,e,t,i=pl){const r=s.computed(()=>i(n.value)),o=s.computed(()=>{const a=n.value!==void 0,l=e.value!==void 0&&e.value!==null;return t.value?"LOADING":r.value?"SUCCESS":l?"ERROR":a?"SUCCESS":"PENDING"});return{fetchState:nt,hasData:r,state:o}}const _l=({emitState:n,fetchLifecycleState:e,hasData:t})=>{s.watch(()=>({hasData:t.value,state:e.value}),({hasData:i,state:r})=>{if(r!==nt.PENDING){if(r===nt.LOADING){n({hasData:i,state:"loading"});return}if(r===nt.ERROR){n({hasData:i,state:"error"});return}n({hasData:i,state:"success"})}})},yl=({startRow:n,endRow:e})=>{const t=e-n;return{blockIndex:t>0?Math.floor(n/t):0,pageSize:t}},Rl=({startRow:n,rowsLength:e,pageSize:t,total:i,hasMore:r})=>{if(typeof i=="number")return i;if(r!==!0&&(r===!1||e<t))return n+e},Cl=({fetcher:n,resetKey:e,sort:t})=>{const i=new Map,r=new Map,o=s.ref(0),a=s.ref(0),l=s.shallowRef(),d=s.shallowRef(),c=s.shallowRef(),u=s.ref(0),h=s.ref(!1);let f,p,C=t?.value?.sortColumnKey,E=t?.value?.sortColumnOrder;const R=P=>P===o.value&&f===n.value&&p===e?.value,I=(P,W)=>R(P)&&W===a.value&&C===t?.value?.sortColumnKey&&E===t?.value?.sortColumnOrder,D=P=>{if(!t)return!0;const W=t.value;return!W?.sortColumnKey||!W.sortColumnOrder?P.length===0:P.length===1&&P[0].colId===W.sortColumnKey&&P[0].sort===W.sortColumnOrder},w=()=>{h.value=u.value>0},O=()=>{a.value+=1,C=t?.value?.sortColumnKey,E=t?.value?.sortColumnOrder;for(const P of r.values())P.resolve(!1);i.clear(),r.clear(),d.value=void 0,c.value=void 0,u.value=0,w()},S=()=>{c.value=void 0,u.value+=1,w()},U=()=>{u.value=Math.max(0,u.value-1),w()},K=P=>{const W=r.get(P);if(W)return W;let j;const F={promise:new Promise(b=>{j=b}),resolve:b=>j(b)};return r.set(P,F),F},m=(P,W)=>{W.resolve(!1),r.get(P)===W&&r.delete(P)},g=async({blockIndex:P,currentBlockCompletion:W,datasourceId:j,requestGeneration:F})=>{if(P===0)return"ready";const b=r.get(P-1);if(!b)return m(P,W),"failed";const T=await b.promise;return I(j,F)?T?"ready":(m(P,W),"failed"):(m(P,W),"stale")},_=({blockIndex:P,currentBlockCompletion:W,getRowsParams:j,pageSize:F,result:b})=>{b.cursor!==void 0&&i.set(P,b.cursor),j.successCallback(b.data,Rl({startRow:j.startRow,rowsLength:b.data.length,pageSize:F,total:b.total,hasMore:b.hasMore})),j.startRow===0&&(d.value=b.data),W.resolve(!0)},v=({blockIndex:P,currentBlockCompletion:W,fetchError:j,getRowsParams:F})=>{c.value=j,F.failCallback(),m(P,W)},x=()=>{const P=n.value;if(!P)throw new Error("TableDataGrid requires a fetcher in infinite mode");f=P,p=e?.value;const W=o.value+1;return o.value=W,O(),{async getRows(j){if(!R(W)||!D(j.sortModel)){j.failCallback();return}const{blockIndex:F,pageSize:b}=yl({startRow:j.startRow,endRow:j.endRow});F===0&&r.has(0)&&O();const T=a.value,A=K(F);if(await g({blockIndex:F,currentBlockCompletion:A,datasourceId:W,requestGeneration:T})!=="ready"||!I(W,T)){j.failCallback(),m(F,A);return}S();try{const k=F>0?i.get(F-1):void 0,z=await P({mode:"infinite",pageSize:b,cursor:k,sort:t?.value});if(!I(W,T)){j.failCallback(),m(F,A);return}_({blockIndex:F,currentBlockCompletion:A,getRowsParams:j,pageSize:b,result:z})}catch(k){if(!I(W,T)){j.failCallback(),m(F,A);return}v({blockIndex:F,currentBlockCompletion:A,fetchError:k,getRowsParams:j})}finally{I(W,T)&&U()}}}},q=()=>{l.value=x()};return s.watch([n,()=>e?.value],()=>{q()},{immediate:!0}),s.watch([()=>t?.value?.sortColumnKey,()=>t?.value?.sortColumnOrder],()=>O()),{datasource:s.readonly(l),data:s.shallowReadonly(d),error:s.readonly(c),isFetching:s.readonly(h)}},El={title:"No Data",message:"There is no data to display."},Ol={title:"An error occurred",message:"Data cannot be displayed due to an error."},bl={emptyState:El,errorState:Ol};function mn(){const n=lt.createI18n("en-us",bl);return{i18n:n,i18nT:lt.i18nTComponent(n)}}const{i18n:wl}=mn(),pn=(n,e)=>{const t=Reflect.get(e,n.key);return n.valueFormatter?n.valueFormatter(t,e):String(t??"")},gt=n=>typeof n!="number"?null:Number.isFinite(n)?n:null,Tl=(n,e)=>n.reduce((t,i)=>{const r=gt(Reflect.get(i,e.key));return r===null?t:{sum:t.sum+r,max:Math.max(t.max,r)}},{sum:0,max:0}),vl=(n,e)=>{const t=(e??[]).filter(r=>Number.isFinite(r.value)&&n>=r.value);if(!t.length)return;const i=Math.max(...t.map(r=>r.value));return t.filter(r=>r.value===i).some(r=>r.type==="error")?"error":"warning"},Sl=(n,e,t)=>{if(n===null)return 0;const i=t==="relative"?e.sum:e.max;return i>0?Math.min(Math.max(n/i,0),1):0},xl=n=>{const e=t=>wl.formatNumber(t,{maximumFractionDigits:2});return n>0&&n<.01?`< ${e(.01)} %`:`${e(n)} %`},gn=({value:n,stats:e,header:t})=>{if(n===null||e.sum<=0)return;const i=n/e.sum*100;return t.percentageFormatter?.(i)??xl(i)},_n=(n,e)=>e!==void 0&&e.length>(n?.length??-1)?e:n,Il=({rows:n,header:e,stats:t})=>n.reduce((i,r)=>({value:_n(i.value,pn(e,r))??"",relative:e.showPercentage?_n(i.relative,gn({value:gt(Reflect.get(r,e.key)),stats:t,header:e})):void 0}),{value:""}),Dl=["data-threshold"],kl={class:"table-data-grid-cell-label-track"},Nl={class:"table-data-grid-cell-label"},Al={key:0,class:"table-data-grid-cell-relative","data-testid":"table-data-grid-cell-relative"},Ll={key:0,"aria-hidden":"true",class:"table-data-grid-cell-label table-data-grid-cell-label-sizer"},Ul=["data-text"],Kl=["data-text"],Ml=["data-threshold"],Bl=s.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(n,{expose:e}){const t=s.shallowRef(n.params),i=s.ref(null),r=s.ref(!1),o=s.computed(()=>t.value.headerDef??{key:"",label:""}),a=s.computed(()=>t.value.context?.presentation),l=s.computed(()=>t.value.context?.cells?.tooltipTarget?.value??"body"),d=s.computed(()=>t.value.valueFormatted??String(t.value.value??"")),c=s.computed(()=>t.value.value),u=s.computed(()=>gt(c.value)),h=s.computed(()=>a.value?.stats[o.value.key]),f=s.computed(()=>o.value.showPercentage&&h.value?gn({value:u.value,stats:h.value,header:o.value}):void 0),p=s.computed(()=>!!o.value.bar&&!!h.value&&(u.value!==null||c.value===null||c.value===void 0)),C=s.computed(()=>p.value&&h.value?Sl(u.value,h.value,o.value.bar)*100:0),E=s.computed(()=>p.value?a.value?.labelSizers[o.value.key]:void 0),R=s.computed(()=>o.value.thresholds?.length&&u.value!==null?vl(u.value,o.value.thresholds):void 0),I=s.computed(()=>({column:o.value,refreshCell:()=>{const _=t.value.node;_&&t.value.api.refreshCells({force:!0,rowNodes:[_]})},row:t.value.data??{},rowIndex:t.value.node?.rowIndex??0,rowValue:t.value.value,selected:t.value.node?.isSelected()??!1})),D=(_,{slots:v})=>{const x=t.value.colDef?.colId,q=t.value.context?.cells?.slots;return!x||x==="cell-icon"||!q?.[x]?v.default?.():s.h("span",{class:"table-data-grid-cell-slot-content"},s.renderSlot(q,x,I.value,()=>v.default?.()??[]))},w=()=>{const _=t.value.context?.cells?.slots;return _?.["cell-icon"]?s.renderSlot(_,"cell-icon",I.value):null};let O,S,U=!1;const K=()=>{const _=i.value;r.value=!!_&&_.scrollWidth>_.clientWidth},m=()=>{U||(S!==void 0&&cancelAnimationFrame(S),S=requestAnimationFrame(()=>{S=void 0,K()}))},g=_=>{if(O?.disconnect(),_){O?.observe(_);const v=_.closest(".ag-cell");v&&O?.observe(v)}m()};return s.onMounted(()=>{O=new ResizeObserver(m),g(i.value)}),s.watch(i,g),s.onUnmounted(()=>{U=!0,O?.disconnect(),S!==void 0&&cancelAnimationFrame(S)}),e({refresh(_){return t.value=_,s.nextTick(m),!0}}),(_,v)=>{const x=s.resolveComponent("KTooltip");return s.openBlock(),s.createElementBlock("span",{class:s.normalizeClass(["table-data-grid-cell-renderer",{"table-data-grid-cell-renderer--bar":p.value,"table-data-grid-cell-renderer--percentage":!!f.value,[`table-data-grid-cell-renderer--text-${R.value}`]:!p.value&&!!R.value}]),"data-threshold":R.value},[s.createElementVNode("span",kl,[s.createElementVNode("span",Nl,[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(w))),(s.openBlock(),s.createBlock(s.resolveDynamicComponent(D),null,{default:s.withCtx(()=>[s.createVNode(x,{class:"table-data-grid-cell-tooltip",disabled:!r.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:l.value,text:d.value},{default:s.withCtx(()=>[s.createElementVNode("span",{ref_key:"contentElement",ref:i,class:"table-data-grid-cell-content"},s.toDisplayString(d.value),513)]),_:1},8,["disabled","target","text"])]),_:1})),f.value?(s.openBlock(),s.createElementBlock("span",Al,"("+s.toDisplayString(f.value)+")",1)):s.createCommentVNode("",!0)]),E.value?(s.openBlock(),s.createElementBlock("span",Ll,[s.createElementVNode("span",{class:"table-data-grid-cell-sizer-value","data-text":E.value.value},null,8,Ul),E.value.relative?(s.openBlock(),s.createElementBlock("span",{key:0,class:"table-data-grid-cell-sizer-relative","data-text":`(${E.value.relative})`},null,8,Kl)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)]),p.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"table-data-grid-cell-bar","data-testid":"table-data-grid-cell-bar","data-threshold":R.value},[s.createElementVNode("span",{class:"table-data-grid-cell-bar-fill","data-testid":"table-data-grid-cell-bar-fill",style:s.normalizeStyle({width:`${C.value}%`})},null,4)],8,Ml)):s.createCommentVNode("",!0)],10,Dl)}}}),zl=({headers:n,slots:e,initialSort:t,mode:i,rows:r,tooltipTarget:o})=>{const a=i??"infinite",l=new Set,d=p=>!!(p.showPercentage||p.bar||p.thresholds?.length);s.watch([n,()=>r?.value],()=>{n.value.forEach(p=>{if(!d(p))return;let C;if(a==="infinite"&&(p.showPercentage||p.bar)?C="percentage and bar presentation is only supported in unpaginated mode":a==="unpaginated"&&r?.value?.some(R=>{const I=Reflect.get(R,p.key);return I!=null&&gt(I)===null})&&(C="contains non-finite or nonnumeric values; numeric presentation skips those values"),!C)return;const E=`${p.key}:${C}`;l.has(E)||(l.add(E),console.warn(`[TableDataGrid] Column "${p.key}" ${C}.`))})},{immediate:!0});const c=s.computed(()=>{if(a!=="unpaginated")return{};const p=r?.value??[];return Object.fromEntries(n.value.filter(C=>C.showPercentage||C.bar).map(C=>[C.key,Tl(p,C)]))}),u=s.computed(()=>{if(a!=="unpaginated")return{};const p=r?.value??[];return Object.fromEntries(n.value.filter(C=>C.bar).map(C=>[C.key,Il({rows:p,header:C,stats:c.value[C.key]})]))}),h=s.computed(()=>({cells:{slots:e,tooltipTarget:o},presentation:{stats:c.value,labelSizers:u.value}})),f=p=>{const C=t?.sortColumnKey===p.key;return{colId:p.key,flex:!p.width&&!p.maxWidth?1:void 0,headerName:p.label,maxWidth:p.maxWidth,minWidth:p.minWidth,sortable:p.sortable??!1,unSortIcon:p.showSortIcon,...C?{initialSort:t?.sortColumnOrder,initialSortIndex:0}:{},valueGetter:E=>E.data?.[p.key],valueFormatter:E=>E.data?pn(p,E.data):String(E.value??""),width:p.width,cellRenderer:Bl,cellRendererParams:{headerDef:p}}};return{columnDefs:s.computed(()=>n.value.map(f)),gridContext:h}},Xt=({config:n,headers:e,pageSize:t})=>{const i=new Set(e.filter(o=>o.sortable).map(o=>o.key)),r=n?.sortColumnKey&&i.has(n.sortColumnKey)?n.sortColumnKey:void 0;return{sortColumnKey:r,sortColumnOrder:r?n?.sortColumnOrder:void 0,pageSize:n?.pageSize??t,...n?.fitToContent!==void 0?{fitToContent:n.fitToContent}:{}}},yn=(n,e)=>n.sortColumnKey===e.sortColumnKey&&n.sortColumnOrder===e.sortColumnOrder&&n.pageSize===e.pageSize&&n.fitToContent===e.fitToContent,Pl=({headers:n,pageSize:e,tableConfig:t,emitSort:i,emitTableConfigUpdate:r,onExternalConfigChange:o})=>{const a=s.computed(()=>t.value?Xt({config:t.value,headers:n.value,pageSize:e.value}):void 0),l=s.ref(a.value??Xt({config:void 0,headers:n.value,pageSize:e.value}));s.watch(a,h=>{h&&!yn(h,l.value)&&(l.value=h,o?.(h))});const d=h=>{const f=Xt({config:{...l.value,...h},headers:n.value,pageSize:e.value});yn(f,l.value)||((f.sortColumnKey!==l.value.sortColumnKey||f.sortColumnOrder!==l.value.sortColumnOrder)&&i({sortColumnKey:f.sortColumnKey,sortColumnOrder:f.sortColumnOrder}),l.value=f,r(f))};s.watch(n,()=>{t.value||d({})},{deep:!0});const c=s.computed(()=>({sortColumnKey:l.value.sortColumnKey,sortColumnOrder:l.value.sortColumnOrder})),u=s.computed(()=>t.value?.pageSize??e.value);return{activeTableConfig:s.readonly(l),activeSort:c,activePageSize:u,patchTableConfig:d}},ql=({cellClick:n,headers:e,rowClick:t})=>{const i=s.computed(()=>new Set(e.value.filter(a=>a.disableRowClick).map(a=>a.key))),r=a=>{const l=a.event?.target;return l instanceof Element?l.closest(".ag-cell")?.getAttribute("col-id")??void 0:void 0},o=a=>{const l=r(a);return!!(l&&i.value.has(l))};return{onCellClick:a=>{const l=a.colDef.colId;!a.data||!l||n({columnKey:l,row:a.data,value:a.value})},onRowClick:a=>{a.data&&!o(a)&&t(a.data,a)}}},Hl=({activeSort:n,patchTableConfig:e})=>{const t=(i,r)=>{i.applyColumnState({state:r.sortColumnKey?[{colId:r.sortColumnKey,sort:r.sortColumnOrder??null,sortIndex:0}]:[],defaultState:{sort:null,sortIndex:null}})};return{onSortChanged:i=>{const r=i.api.getColumnState().filter(l=>l.sort).sort((l,d)=>(l.sortIndex??0)-(d.sortIndex??0)),o=r[r.length-1],a=o?{sortColumnKey:o.colId,sortColumnOrder:o.sort}:{sortColumnKey:void 0,sortColumnOrder:void 0};(a.sortColumnKey!==n.value.sortColumnKey||a.sortColumnOrder!==n.value.sortColumnOrder)&&e(a),r.length>1&&t(i.api,a)},applySortToGrid:t}},Gl={key:0,class:"table-error-state","data-testid":"table-error-state"},$l={key:1,class:"table-empty-state","data-testid":"table-empty-state"},Fl=s.defineComponent({__name:"TableDataGrid",props:{headers:{},error:{type:Boolean,default:!1},tableConfig:{},fetcher:{type:Function},mode:{},pageSize:{default:25},refreshKey:{type:[String,Number,Boolean]},rows:{}},emits:["grid:ready","state","row:click","cell:click","sort","update:tableConfig"],setup(n,{emit:e}){Xe.ModuleRegistry.registerModules([Xe.AllCommunityModule,Xe.ClientSideRowModelModule,Xe.InfiniteRowModelModule]);const t=n.mode??"infinite",i=e,{i18n:r}=mn(),{t:o}=r,a=s.useSlots(),l=s.shallowRef(),d=s.useTemplateRef("rootElement"),c=s.shallowRef("body"),u=()=>{const A=document.fullscreenElement;c.value=A instanceof HTMLElement&&A.contains(d.value??null)?A:"body"};s.onMounted(()=>{u(),document.addEventListener("fullscreenchange",u)}),s.onBeforeUnmount(()=>{document.removeEventListener("fullscreenchange",u)});const{activeTableConfig:h,activeSort:f,activePageSize:p,patchTableConfig:C}=Pl({headers:s.toRef(()=>n.headers),pageSize:s.toRef(()=>n.pageSize),tableConfig:s.toRef(()=>n.tableConfig),emitSort:A=>i("sort",A),emitTableConfigUpdate:A=>i("update:tableConfig",A),onExternalConfigChange:A=>{l.value&&R(l.value,A)}}),{onSortChanged:E,applySortToGrid:R}=Hl({activeSort:f,patchTableConfig:C}),I=s.computed(()=>t==="unpaginated"&&!!h.value.fitToContent),D=Xe.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:w,onRowClick:O}=ql({cellClick:A=>i("cell:click",A),headers:s.toRef(()=>n.headers),rowClick:(A,k)=>i("row:click",A,k)}),S={resizable:!1,sortable:!1,suppressMovable:!0},U=s.computed(()=>[p.value,n.refreshKey]),K=t==="infinite"?Cl({fetcher:s.toRef(()=>n.fetcher),resetKey:U,sort:f}):void 0,m=K?.datasource,g=s.computed(()=>K?K.data.value:n.rows),_=s.computed(()=>K?.isFetching.value??!1),v=s.computed(()=>n.rows?Array.from(n.rows):void 0),{columnDefs:x,gridContext:q}=zl({headers:s.toRef(()=>n.headers),mode:t,rows:v,slots:a,tooltipTarget:c,initialSort:f.value}),{fetchState:P,hasData:W,state:j}=gl(g,s.toRef(()=>K?.error.value),_),F=s.computed(()=>j.value===P.SUCCESS&&!W.value);K&&_l({emitState:A=>i("state",A),fetchLifecycleState:j,hasData:W});const b=()=>{const A=l.value;if(!A||A.isDestroyed())return;const k=f.value,z=A.getColumnState().find(N=>N.sort);z?.colId===k.sortColumnKey&&(z?.sort??void 0)===k.sortColumnOrder||R(A,k)};s.watch([l,f],b);const T=A=>{l.value=A.api,i("grid:ready",A.api)};return(A,k)=>{const z=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{ref_key:"rootElement",ref:d,class:s.normalizeClass(["kong-ui-public-table-data-grid",{"fit-to-content":I.value}]),"data-testid":"table-data-grid"},[n.error?(s.openBlock(),s.createElementBlock("div",Gl,[s.renderSlot(A.$slots,"error-state",{},()=>[s.createVNode(z,{"icon-variant":"error",message:s.unref(o)("errorState.message"),title:s.unref(o)("errorState.title")},null,8,["message","title"])],!0)])):F.value?(s.openBlock(),s.createElementBlock("div",$l,[s.renderSlot(A.$slots,"empty-state",{},()=>[s.createVNode(z,{message:s.unref(o)("emptyState.message"),title:s.unref(o)("emptyState.title")},null,8,["message","title"])],!0)])):(s.openBlock(),s.createBlock(s.unref(Hn.AgGridVue),{key:2,"cache-block-size":s.unref(t)==="infinite"?s.unref(p):void 0,class:"table-data-grid-grid","column-defs":s.unref(x),context:s.unref(q),datasource:s.unref(t)==="infinite"?s.unref(m):void 0,"default-col-def":S,"dom-layout":I.value?"autoHeight":"normal","infinite-initial-row-count":s.unref(t)==="infinite"?1:void 0,loading:_.value,"row-data":s.unref(t)==="unpaginated"?v.value:void 0,"row-model-type":s.unref(t)==="unpaginated"?"clientSide":"infinite","suppress-cell-focus":!0,"suppress-multi-sort":!0,theme:s.unref(D),onCellClicked:s.unref(w),onGridReady:T,onNewColumnsLoaded:b,onRowClicked:s.unref(O),onSortChanged:s.unref(E)},null,8,["cache-block-size","column-defs","context","datasource","dom-layout","infinite-initial-row-count","loading","row-data","row-model-type","theme","onCellClicked","onRowClicked","onSortChanged"]))],2)}}}),Wl=(n,e)=>{const t=n.__vccOpts||n;for(const[i,r]of e)t[i]=r;return t},Rn=Wl(Fl,[["__scopeId","data-v-01cd8bcd"]]),Cn=3,Vl={anthropic:se.AnthropicIcon,azure:se.AzureIcon,bedrock:se.AmazonBedrockIcon,cerebras:se.CerebrasIcon,cohere:se.CohereIcon,databricks:se.DatabricksIcon,deepseek:se.DeepseekIcon,gemini:se.GeminiIcon,huggingface:se.HuggingFaceIcon,llama2:se.MetaLlamaIcon,mistral:se.MistralIcon,moonshot:se.KimiIcon,nvidia:se.NvidiaIcon,ollama:se.OllamaIcon,openai:se.OpenAiIcon,vertex:se.GoogleVertexIcon,vllm:se.VllmIcon,xai:se.GrokIcon},jt=(n,e)=>{if(!n||!e)return;const t=e.toLowerCase();return n[e]??Object.entries(n).find(([i])=>i.toLowerCase()===t)?.[1]},Yl=({columnOptions:n,columnKey:e,rawValue:t})=>{if(!(jt(n,e)?.icon_set!=="ai_provider"||typeof t!="string"))return Vl[t.toLowerCase()]},Xl=n=>{if(n==null||n==="")return null;const e=typeof n=="number"?n:Number(n);return Number.isFinite(e)?e:null},jl=n=>n.toLocaleLowerCase().endsWith("count"),Ql=n=>{const e=Object.keys(n?.meta?.display??{}).slice(0,Cn),t=n?.meta?.metric_names??[];return(n?.data??[]).map(i=>{const r={record:i};return e.forEach(o=>{r[o]=i.event[o]}),t.forEach(o=>{r[o]=Xl(i.event[o])}),r})},Zl=({data:n,columnOptions:e,i18n:t,fieldTranslationMap:i})=>{const{formatUnit:r}=ie.unitFormatter({i18n:t}),o=n?.data??[],a=n?.meta,l=a?.display??{},d=Object.keys(l).slice(0,Cn),c=a?.metric_names??[],u=c[0],h=d.length>1,f=O=>on(t,i,O),p=(O,S)=>jt(e,O)?.label||S,C=(O,S)=>{if(jl(O)||O==="requests")return"";const U=S===1?"":"s",K=`chartUnits.${O}`;return t.messages[K]?t.formatMessage({id:K},{plural:U}):O},E=O=>{const S=U=>r(U,"%",{translateUnit:C});return O>0&&O<.01?`< ${S(.01)}`:S(O)},R=(O,S)=>{const U=O.event[S];if(U==null)return"–";const K=typeof U=="number"?U:Number(U);if(Number.isNaN(K))return"–";const m=a?.metric_units?.[S]||"count";return m==="%"?E(K):r(K,m,{approximate:["count","count/minute","token count"].includes(m),isBytes1024:!0,translateUnit:C})},I=(O,S)=>{const U=String(O.record.event[S]),K=l[S]?.[U];return{id:U,label:K?.name||"-",deleted:!!K?.deleted}},D=d.map(O=>({key:O,label:p(O,h?f(O):t.t("topNTable.nameLabel")),type:"dimension",valueFormatter:(S,U)=>I(U,O).label,sortable:!1}));c.forEach(O=>{const S=jt(e,O);D.push({key:O,label:S?.label||f(O),type:"metric",valueFormatter:(U,K)=>R(K.record,O),showPercentage:S?.value==="relative",percentageFormatter:E,bar:S?.bar==="max"?"absolute":S?.bar,thresholds:S?.thresholds,sortable:!1})});const w=o.length?a?d.some(O=>!Object.keys(l[O]||{}).length)?t.t("topNTable.errors.display"):u?"":t.t("topNTable.errors.metricNames"):t.t("topNTable.errors.meta"):"";return{headers:D,errorMessage:w,getDimension:I}},Jl={class:"fallback-entity-link","data-testid":"entity-link-parent"},En=s.defineComponent({__name:"FallbackEntityLink",props:{entityLinkData:{}},setup(n){return(e,t)=>(s.openBlock(),s.createElementBlock("div",Jl,s.toDisplayString(n.entityLinkData.label),1))}}),ec=["data-testid"],tc={key:1},ic=Se(s.defineComponent({__name:"TopNDataGrid",props:{chartOptions:{},data:{},fitToContent:{type:Boolean,default:!1},height:{}},setup(n){const e=s.inject(ve),t=we.useDatasourceConfigStore(),{i18n:i}=le.useI18n(),r=s.computed(()=>Ql(n.data)),o=s.computed(()=>Zl({data:n.data,columnOptions:n.chartOptions.column_options,i18n:i,fieldTranslationMap:t.fieldTranslationMap})),a=s.computed(()=>o.value.headers.map(E=>({...E,minWidth:E.type==="dimension"?160:E.bar?260:140}))),l=s.computed(()=>o.value.headers.filter(E=>E.type==="dimension")),d=s.computed(()=>({fitToContent:n.fitToContent})),c=s.computed(()=>n.fitToContent?{height:"auto"}:n.height===void 0?void 0:{height:`${n.height}px`}),u=(E,R)=>Yl({columnOptions:n.chartOptions.column_options,columnKey:E,rawValue:R}),h=s.defineAsyncComponent(async()=>{if(e?.fetchComponent)try{return await e.fetchComponent("EntityLink")}catch{return En}return En}),f=E=>{const R=n.chartOptions.entity_links;return R&&(R[E]||Object.entries(R).find(([I])=>I.toLowerCase()===E.toLowerCase())?.[1])||""},p=E=>f(E)||l.value[0]?.key===E&&n.chartOptions.entity_link||"",C=(E,R)=>{const I=p(R),D=String(E[R]);if(D.includes(":")){const[w,O]=D.split(":");return I.replace(Fi,w).replace(zt,O)}return I.replace(zt,D)};return(E,R)=>{const I=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{class:"top-n-data-grid","data-testid":r.value.length?"top-n-table":void 0,style:s.normalizeStyle(c.value)},[s.createVNode(s.unref(Rn),{error:!!o.value.errorMessage,headers:a.value,mode:"unpaginated",rows:r.value,"table-config":d.value},s.createSlots({"error-state":s.withCtx(()=>[s.createVNode(I,{"action-button-visible":!1,"data-testid":"chart-empty-state"},{icon:s.withCtx(()=>[s.createVNode(s.unref(se.WarningOutlineIcon))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(o.value.errorMessage),1)]),_:1})]),"empty-state":s.withCtx(()=>[s.createVNode(I,{"action-button-visible":!1,"data-testid":"top-n-empty-state",title:s.unref(i).t("topNTable.defaultEmptyStateTitle")},null,8,["title"])]),"cell-icon":s.withCtx(({column:D,rowValue:w})=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(u(D.key,w)),{class:"top-n-provider-icon","data-testid":"top-n-provider-icon",decorative:"",size:"var(--kui-icon-size-30, 16px)"}))]),_:2},[s.renderList(l.value,D=>({name:D.key,fn:s.withCtx(({row:w})=>[p(D.key)&&w[D.key]!=="empty"?(s.openBlock(),s.createBlock(s.unref(h),{key:0,class:"top-n-entity-link","entity-link-data":o.value.getDimension(w,D.key),"external-link":C(w,D.key)},null,8,["entity-link-data","external-link"])):o.value.getDimension(w,D.key).label==="empty"?(s.openBlock(),s.createElementBlock("i",tc,"empty")):s.createCommentVNode("",!0)])}))]),1032,["error","headers","rows","table-config"])],12,ec)}}}),[["__scopeId","data-v-5705b32b"]]),nc=s.defineComponent({__name:"TopNTableRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},fitToContent:{type:Boolean}},setup(n){return(e,t)=>(s.openBlock(),s.createBlock(Be,{context:n.context,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter},{default:s.withCtx(({data:i})=>[s.createVNode(ic,{"chart-options":n.chartOptions,data:i,"fit-to-content":n.fitToContent,height:n.height},null,8,["chart-options","data","fit-to-content","height"])]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),rc=s.defineComponent({__name:"TopTalkersRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["query-complete"],setup(n,{emit:e}){const t=n,i=e,r=s.computed(()=>t.chartOptions.columns.map(c=>({dimension:c.dimension,label:c.label}))),o=c=>({...t.query,dimensions:[c.dimension],filters:[...t.query.filters??[],...c.filters??[]]}),a=s.computed(()=>new Map(r.value.map((c,u)=>[c,o(t.chartOptions.columns[u])]))),l=new Set,d=c=>{l.add(c),l.size===r.value.length&&(l.clear(),i("query-complete"))};return s.watch([a,()=>t.refreshCounter],()=>l.clear()),(c,u)=>(s.openBlock(),s.createBlock(s.unref(be.TopTalkersGrid),{"column-options":n.chartOptions.column_options,columns:r.value,"size-metric":n.chartOptions.size_metric},{column:s.withCtx(({column:h})=>[s.createVNode(Be,{context:n.context,query:a.value.get(h),"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onQueryComplete:f=>d(h)},{default:s.withCtx(({data:f})=>[s.createVNode(s.unref(be.TopTalkersColumn),{"column-options":n.chartOptions.column_options,data:f,dimension:h.dimension,label:h.label,"size-metric":n.chartOptions.size_metric},null,8,["column-options","data","dimension","label","size-metric"])]),_:2},1032,["context","query","query-ready","refresh-counter","onQueryComplete"])]),_:1},8,["column-options","columns","size-metric"]))}}),sc=n=>n.records.map(e=>{const t={...e};return Object.entries(e).forEach(([i,r])=>{if(r===null)return;const o=n.meta.display?.[i]?.[String(r)]?.name;o&&(t[i]=o)}),t}),On=({columns:n,fieldLabel:e})=>n.map(t=>({key:t,label:e(t)})),oc={platform:On,platform_usage:On},bn=async({abortController:n,context:e,cursor:t,pageSize:i,query:r,onResponseColumns:o,stripUnknownFilters:a,tabularQueryFn:l})=>{if(!l)throw new Error("AnalyticsBridge.tabularQueryFn is not defined");const d=r.query,c=a({datasource:r.datasource,filters:[...d.filters??[],...e.filters],queryFields:d.entity===void 0?void 0:[d.entity]}),u=await l({datasource:r.datasource,query:{columns:d.columns,cursor:t===void 0?d.cursor:String(t),entity:d.entity,filters:c,page_size:i}},n);return u.meta.columns?.length&&o?.(u.meta.columns),{data:sc(u),cursor:u.meta.cursor,hasMore:!!u.meta.cursor}},ac={platform:bn,platform_usage:bn},lc=Se(s.defineComponent({__name:"TableDataGridRenderer",props:{query:{},context:{},queryReady:{type:Boolean},height:{},refreshCounter:{}},emits:["loading-change"],setup(n,{emit:e}){const t=n,i=e,r=s.inject(ve),o=we.useDatasourceConfigStore(),a=le.useFieldLabel(),l=new AbortController,d=s.ref([]),c=s.ref(!1),u=s.computed(()=>t.height===void 0?void 0:{height:`${t.height}px`}),h=s.computed(()=>({datasource:t.query.datasource,query:{columns:t.query.columns,cursor:t.query.cursor,entity:t.query.entity,filters:t.query.filters,page_size:t.query.page_size}})),f=s.computed(()=>JSON.stringify({refreshCounter:t.refreshCounter,query:{columns:t.query.columns,datasource:t.query.datasource,entity:t.query.entity,filters:t.query.filters,page_size:t.query.page_size},context:{filters:t.context.filters,timeSpec:t.context.timeSpec,tz:t.context.tz}}));s.onUnmounted(()=>{l.abort()});const p=s.computed(()=>oc[t.query.datasource]({columns:t.query.columns?.length?t.query.columns:d.value,fieldLabel:R=>a(R)})),C=s.computed(()=>async({cursor:R,pageSize:I})=>{try{await o.isReady();const D=ac[h.value.datasource];if(!D)throw new Error(`No table data grid fetcher found for datasource: ${h.value.datasource}`);const w=await D({abortController:l,context:t.context,cursor:R,pageSize:I,query:h.value,onResponseColumns:O=>{d.value=O},stripUnknownFilters:o.stripUnknownFilters,tabularQueryFn:r?.tabularQueryFn});return c.value=!1,w}catch(D){throw c.value=!0,D}}),E=R=>{R.state==="error"&&(c.value=!0),i("loading-change",R.state==="loading")};return(R,I)=>{const D=s.resolveComponent("KSkeleton");return s.openBlock(),s.createElementBlock("div",{class:"table-data-grid-renderer",style:s.normalizeStyle(u.value)},[n.queryReady?(s.openBlock(),s.createBlock(s.unref(Rn),{key:1,error:c.value,fetcher:C.value,headers:p.value,"page-size":n.query.page_size,"refresh-key":f.value,onState:E},null,8,["error","fetcher","headers","page-size","refresh-key"])):(s.openBlock(),s.createBlock(D,{key:0,"data-testid":"table-skeleton",type:"table"}))],4)}}}),[["__scopeId","data-v-c8caabc2"]]),cc=s.defineComponent({__name:"DonutChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(n){return(e,t)=>(s.openBlock(),s.createBlock(Yt,{"chart-options":n.chartOptions,context:n.context,height:n.height,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),uc="#ffffff",dc="#0044f4",hc="#d60027",fc="#ad000e",mc="#850000",pc="#5c0000",gc="#ff3954",_c="#ffabab",yc="#ffe5e5",Rc="#ecfcff",Cc="#6f28ff",Ec="#f1f0ff",Oc="#e0e4ea",bc="#0044f4",wc="#0030cc",Tc="#002099",vc="#001466",Sc="#5f9aff",xc="#bee2ff",Ic="#eefaff",Dc="#0d0e14",kc="#6c7489",Nc="#52596e",Ac="#3a3f51",Lc="#232633",Uc="#afb7c5",Kc="#e0e4ea",Mc="#f9fafb",Bc="rgba(13, 14, 20, 0.6)",zc="#0044f4",Pc="#0030cc",qc="#002099",Hc="#001466",Gc="#5f9aff",$c="#bee2ff",Fc="#eefaff",Wc="#007d60",Vc="#005944",Yc="#004737",Xc="#003629",jc="#00d6a4",Qc="#b5ffee",Zc="#ecfffb",Jc="rgba(0, 0, 0, 0)",eu="#995c00",tu="#804400",iu="#662d00",nu="#4d1b00",ru="#ffc400",su="#fff296",ou="#fffce0",au="#e0e4ea",lu="#0044f4",cu="#d60027",uu="#ad000e",du="#850000",hu="#5c0000",fu="#ff3954",mu="#ffabab",pu="#ffe5e5",gu="#6f28ff",_u="#e0e4ea",yu="rgba(255, 255, 255, 0.2)",Ru="#6c7489",Cu="#52596e",Eu="#3a3f51",Ou="#232633",bu="#afb7c5",wu="#e0e4ea",Tu="#f9fafb",vu="#0044f4",Su="#0030cc",xu="#002099",Iu="#001466",Du="#5f9aff",ku="#bee2ff",Nu="#eefaff",Au="rgba(0, 0, 0, 0)",Lu="#0044f4",Uu="#0d0e14",Ku="#0044f4",Mu="#d60027",Bu="#ad000e",zu="#850000",Pu="#5c0000",qu="#ff3954",Hu="#ffabab",Gu="#ffe5e5",$u="#00abd2",Fu="#d60067",Wu="#6f28ff",Vu="#5e00f5",Yu="#afb7c5",Xu="#0044f4",ju="#0030cc",Qu="#002099",Zu="#001466",Ju="#5f9aff",ed="#bee2ff",td="#eefaff",id="#ffffff",nd="#6c7489",rd="#52596e",sd="#3a3f51",od="#232633",ad="#afb7c5",ld="#e0e4ea",cd="#f9fafb",ud="#0044f4",dd="#0030cc",hd="#002099",fd="#001466",md="#5f9aff",pd="#bee2ff",gd="#eefaff",_d="#007d60",yd="#005944",Rd="#004737",Cd="#003629",Ed="#00d6a4",Od="#b5ffee",bd="#ecfffb",wd="#995c00",Td="#804400",vd="#662d00",Sd="#4d1b00",xd="#ffc400",Id="#fff296",Dd="#fffce0",kd="0.2s",Nd="0px",Ad="2px",Ld="4px",Ud="6px",Kd="8px",Md="10px",Bd="50%",zd="100px",Pd="0px",qd="1px",Hd="2px",Gd="4px",$d="640px",Fd="768px",Wd="1024px",Vd="1280px",Yd="1536px",Xd="'JetBrains Mono', Consolas, monospace",jd="'Inter', Roboto, Helvetica, sans-serif",Qt="'Inter', Roboto, Helvetica, sans-serif",Qd="10px",Zd="12px",Jd="14px",eh="16px",th="18px",ih="20px",nh="24px",rh="32px",sh="40px",oh="48px",ah="700",lh="500",ch="400",uh="600",dh="#f50045",hh="#828a9e",fh="#306fff",mh="#00a17b",ph="#ffc400",gh="10px",_h="12px",yh="16px",Rh="20px",Ch="24px",Eh="32px",Oh="40px",bh="48px",wh="normal",Th="-0.12px",vh="-0.24px",Sh="-0.32px",xh="-0.4px",Ih="-0.48px",Dh="normal",kh="12px",Nh="16px",Ah="20px",Lh="24px",Uh="28px",Kh="32px",Mh="36px",Bh="40px",zh="48px",Ph="56px",qh="#f1f0ff",Hh="#ffe5e5",Gh="#eefaff",$h="#52596e",Fh="#e0e4ea",Wh="#ecfcff",Vh="#ecfffb",Yh="#fffce0",Xh="#fff0f7",jh="#6f28ff",Qh="#5e00f5",Zh="#d60027",Jh="#ad000e",ef="#0044f4",tf="#0030cc",nf="#e0e4ea",rf="#afb7c5",sf="#52596e",of="#3a3f51",af="#00819d",lf="#00647a",cf="#007d60",uf="#005944",df="#995c00",hf="#804400",ff="#d60067",mf="#ad0053",pf="#000933",gf="rgba(255, 255, 255, 0.12)",_f="rgba(255, 255, 255, 0.12)",yf="#00fabe",Rf="rgba(255, 255, 255, 0.24)",Cf="#bee2ff",Ef="#ffffff",Of="#eefaff",bf="#00fabe",wf="0 0 0 1px rgba(255, 255, 255, 0.12) inset",Tf="4px 0 0 0 #00fabe inset",vf="0 0 0 1px rgba(255, 255, 255, 0.60) inset",Sf="0px 4px 20px 0px rgba(0, 0, 0, 0.08)",xf="0px 0px 0px 1px #e0e4ea inset",If="0px 0px 0px 1px #d60027 inset",Df="0px 0px 0px 1px #ad000e inset",kf="0px 0px 0px 1px #e0e4ea inset",Nf="0px 0px 0px 1px #0044f4 inset",Af="0px 0px 0px 1px #001466 inset",Lf="0px 0px 0px 1px #5f9aff inset",Uf="0px 0px 0px 4px rgba(0, 68, 244, 0.2)",Kf="0px",Mf="2px",Bf="4px",zf="6px",Pf="8px",qf="12px",Hf="16px",Gf="20px",$f="24px",Ff="32px",Wf="40px",Vf="48px",Yf="56px",Xf="64px",jf="80px",Qf="96px",Zf="auto",Jf="#bee2ff",em="#8fc1ff",tm="#5f9aff",im="#306fff",nm="#b5ffee",rm="#00fabe",sm="#00d6a4",om="#00a17b",am="#007d60",lm="#005944",cm="#b5ffee",um="#00fabe",dm="#b5ffee",hm="#00a17b",fm="#fff296",mm="#ffe04b",pm="#ffc400",gm="#b37600",_m="#995c00",ym="#804400",Rm="#fff296",Cm="#ffe04b",Em="#ffc2b3",Om="#ff9877",bm="#ff723c",wm="#f75008",Tm="#d13500",vm="#a31f00",Sm="#ffc2b3",xm="#ff9877",Im="#ff723c",Dm="#f75008",km="#d13500",Nm="#a31f00",Am="#ffc2b3",Lm="#ff9877",Um="#ff723c",Km="#f75008",Mm="#d13500",Bm="#a31f00",zm="#ffc2b3",Pm="#ff9877",qm="#ff723c",Hm="#f75008",Gm="#d13500",$m="#a31f00",Fm="#ffc2b3",Wm="#ff9877",Vm="#ff723c",Ym="#f75008",Xm="#d13500",jm="#ffabab",Qm="#ff7272",Zm="#ff3954",Jm="#f50045",ep="#d60027",tp="#ad000e",ip="#ffabab",np="#ff7272",rp="#ff3954",sp="#f50045",op="#d60027",ap="#eefaff",lp="#ecfffb",cp="#fffce0",up="#fff1ef",dp="#ffe5e5",hp="#5f9aff",fp="#00d6a4",mp="#ffc400",pp="#ff723c",gp="#ff3954",_p="#eefaff",yp="#ecfffb",Rp="#fffce0",Cp="#fff1ef",Ep="#ffe5e5",Op="#0044f4",bp="#007d60",wp="#995c00",Tp="#d13500",vp="#d60027",wn=Object.freeze(Object.defineProperty({__proto__:null,KUI_ANIMATION_DURATION_20:kd,KUI_BORDER_RADIUS_0:Nd,KUI_BORDER_RADIUS_10:Ad,KUI_BORDER_RADIUS_20:Ld,KUI_BORDER_RADIUS_30:Ud,KUI_BORDER_RADIUS_40:Kd,KUI_BORDER_RADIUS_50:Md,KUI_BORDER_RADIUS_CIRCLE:Bd,KUI_BORDER_RADIUS_ROUND:zd,KUI_BORDER_WIDTH_0:Pd,KUI_BORDER_WIDTH_10:qd,KUI_BORDER_WIDTH_20:Hd,KUI_BORDER_WIDTH_30:Gd,KUI_BREAKPOINT_DESKTOP:Yd,KUI_BREAKPOINT_LAPTOP:Vd,KUI_BREAKPOINT_MOBILE:$d,KUI_BREAKPOINT_PHABLET:Fd,KUI_BREAKPOINT_TABLET:Wd,KUI_COLOR_BACKGROUND:uc,KUI_COLOR_BACKGROUND_ACCENT:dc,KUI_COLOR_BACKGROUND_DANGER:hc,KUI_COLOR_BACKGROUND_DANGER_STRONG:fc,KUI_COLOR_BACKGROUND_DANGER_STRONGER:mc,KUI_COLOR_BACKGROUND_DANGER_STRONGEST:pc,KUI_COLOR_BACKGROUND_DANGER_WEAK:gc,KUI_COLOR_BACKGROUND_DANGER_WEAKER:_c,KUI_COLOR_BACKGROUND_DANGER_WEAKEST:yc,KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST:Rc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE:Cc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST:Ec,KUI_COLOR_BACKGROUND_DISABLED:Oc,KUI_COLOR_BACKGROUND_INFO:bc,KUI_COLOR_BACKGROUND_INFO_STRONG:wc,KUI_COLOR_BACKGROUND_INFO_STRONGER:Tc,KUI_COLOR_BACKGROUND_INFO_STRONGEST:vc,KUI_COLOR_BACKGROUND_INFO_WEAK:Sc,KUI_COLOR_BACKGROUND_INFO_WEAKER:xc,KUI_COLOR_BACKGROUND_INFO_WEAKEST:Ic,KUI_COLOR_BACKGROUND_INVERSE:Dc,KUI_COLOR_BACKGROUND_NEUTRAL:kc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONG:Nc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGER:Ac,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGEST:Lc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAK:Uc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKER:Kc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST:Mc,KUI_COLOR_BACKGROUND_OVERLAY:Bc,KUI_COLOR_BACKGROUND_PRIMARY:zc,KUI_COLOR_BACKGROUND_PRIMARY_STRONG:Pc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGER:qc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGEST:Hc,KUI_COLOR_BACKGROUND_PRIMARY_WEAK:Gc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKER:$c,KUI_COLOR_BACKGROUND_PRIMARY_WEAKEST:Fc,KUI_COLOR_BACKGROUND_SUCCESS:Wc,KUI_COLOR_BACKGROUND_SUCCESS_STRONG:Vc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGER:Yc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGEST:Xc,KUI_COLOR_BACKGROUND_SUCCESS_WEAK:jc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKER:Qc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKEST:Zc,KUI_COLOR_BACKGROUND_TRANSPARENT:Jc,KUI_COLOR_BACKGROUND_WARNING:eu,KUI_COLOR_BACKGROUND_WARNING_STRONG:tu,KUI_COLOR_BACKGROUND_WARNING_STRONGER:iu,KUI_COLOR_BACKGROUND_WARNING_STRONGEST:nu,KUI_COLOR_BACKGROUND_WARNING_WEAK:ru,KUI_COLOR_BACKGROUND_WARNING_WEAKER:su,KUI_COLOR_BACKGROUND_WARNING_WEAKEST:ou,KUI_COLOR_BORDER:au,KUI_COLOR_BORDER_ACCENT:lu,KUI_COLOR_BORDER_DANGER:cu,KUI_COLOR_BORDER_DANGER_STRONG:uu,KUI_COLOR_BORDER_DANGER_STRONGER:du,KUI_COLOR_BORDER_DANGER_STRONGEST:hu,KUI_COLOR_BORDER_DANGER_WEAK:fu,KUI_COLOR_BORDER_DANGER_WEAKER:mu,KUI_COLOR_BORDER_DANGER_WEAKEST:pu,KUI_COLOR_BORDER_DECORATIVE_PURPLE:gu,KUI_COLOR_BORDER_DISABLED:_u,KUI_COLOR_BORDER_INVERSE:yu,KUI_COLOR_BORDER_NEUTRAL:Ru,KUI_COLOR_BORDER_NEUTRAL_STRONG:Cu,KUI_COLOR_BORDER_NEUTRAL_STRONGER:Eu,KUI_COLOR_BORDER_NEUTRAL_STRONGEST:Ou,KUI_COLOR_BORDER_NEUTRAL_WEAK:bu,KUI_COLOR_BORDER_NEUTRAL_WEAKER:wu,KUI_COLOR_BORDER_NEUTRAL_WEAKEST:Tu,KUI_COLOR_BORDER_PRIMARY:vu,KUI_COLOR_BORDER_PRIMARY_STRONG:Su,KUI_COLOR_BORDER_PRIMARY_STRONGER:xu,KUI_COLOR_BORDER_PRIMARY_STRONGEST:Iu,KUI_COLOR_BORDER_PRIMARY_WEAK:Du,KUI_COLOR_BORDER_PRIMARY_WEAKER:ku,KUI_COLOR_BORDER_PRIMARY_WEAKEST:Nu,KUI_COLOR_BORDER_TRANSPARENT:Au,KUI_COLOR_BRAND:Lu,KUI_COLOR_TEXT:Uu,KUI_COLOR_TEXT_ACCENT:Ku,KUI_COLOR_TEXT_DANGER:Mu,KUI_COLOR_TEXT_DANGER_STRONG:Bu,KUI_COLOR_TEXT_DANGER_STRONGER:zu,KUI_COLOR_TEXT_DANGER_STRONGEST:Pu,KUI_COLOR_TEXT_DANGER_WEAK:qu,KUI_COLOR_TEXT_DANGER_WEAKER:Hu,KUI_COLOR_TEXT_DANGER_WEAKEST:Gu,KUI_COLOR_TEXT_DECORATIVE_AQUA:$u,KUI_COLOR_TEXT_DECORATIVE_PINK:Fu,KUI_COLOR_TEXT_DECORATIVE_PURPLE:Wu,KUI_COLOR_TEXT_DECORATIVE_PURPLE_STRONG:Vu,KUI_COLOR_TEXT_DISABLED:Yu,KUI_COLOR_TEXT_INFO:Xu,KUI_COLOR_TEXT_INFO_STRONG:ju,KUI_COLOR_TEXT_INFO_STRONGER:Qu,KUI_COLOR_TEXT_INFO_STRONGEST:Zu,KUI_COLOR_TEXT_INFO_WEAK:Ju,KUI_COLOR_TEXT_INFO_WEAKER:ed,KUI_COLOR_TEXT_INFO_WEAKEST:td,KUI_COLOR_TEXT_INVERSE:id,KUI_COLOR_TEXT_NEUTRAL:nd,KUI_COLOR_TEXT_NEUTRAL_STRONG:rd,KUI_COLOR_TEXT_NEUTRAL_STRONGER:sd,KUI_COLOR_TEXT_NEUTRAL_STRONGEST:od,KUI_COLOR_TEXT_NEUTRAL_WEAK:ad,KUI_COLOR_TEXT_NEUTRAL_WEAKER:ld,KUI_COLOR_TEXT_NEUTRAL_WEAKEST:cd,KUI_COLOR_TEXT_PRIMARY:ud,KUI_COLOR_TEXT_PRIMARY_STRONG:dd,KUI_COLOR_TEXT_PRIMARY_STRONGER:hd,KUI_COLOR_TEXT_PRIMARY_STRONGEST:fd,KUI_COLOR_TEXT_PRIMARY_WEAK:md,KUI_COLOR_TEXT_PRIMARY_WEAKER:pd,KUI_COLOR_TEXT_PRIMARY_WEAKEST:gd,KUI_COLOR_TEXT_SUCCESS:_d,KUI_COLOR_TEXT_SUCCESS_STRONG:yd,KUI_COLOR_TEXT_SUCCESS_STRONGER:Rd,KUI_COLOR_TEXT_SUCCESS_STRONGEST:Cd,KUI_COLOR_TEXT_SUCCESS_WEAK:Ed,KUI_COLOR_TEXT_SUCCESS_WEAKER:Od,KUI_COLOR_TEXT_SUCCESS_WEAKEST:bd,KUI_COLOR_TEXT_WARNING:wd,KUI_COLOR_TEXT_WARNING_STRONG:Td,KUI_COLOR_TEXT_WARNING_STRONGER:vd,KUI_COLOR_TEXT_WARNING_STRONGEST:Sd,KUI_COLOR_TEXT_WARNING_WEAK:xd,KUI_COLOR_TEXT_WARNING_WEAKER:Id,KUI_COLOR_TEXT_WARNING_WEAKEST:Dd,KUI_FONT_FAMILY_CODE:Xd,KUI_FONT_FAMILY_HEADING:jd,KUI_FONT_FAMILY_TEXT:Qt,KUI_FONT_SIZE_10:Qd,KUI_FONT_SIZE_100:oh,KUI_FONT_SIZE_20:Zd,KUI_FONT_SIZE_30:Jd,KUI_FONT_SIZE_40:eh,KUI_FONT_SIZE_50:th,KUI_FONT_SIZE_60:ih,KUI_FONT_SIZE_70:nh,KUI_FONT_SIZE_80:rh,KUI_FONT_SIZE_90:sh,KUI_FONT_WEIGHT_BOLD:ah,KUI_FONT_WEIGHT_MEDIUM:lh,KUI_FONT_WEIGHT_REGULAR:ch,KUI_FONT_WEIGHT_SEMIBOLD:uh,KUI_ICON_COLOR_DANGER:dh,KUI_ICON_COLOR_NEUTRAL:hh,KUI_ICON_COLOR_PRIMARY:fh,KUI_ICON_COLOR_SUCCESS:mh,KUI_ICON_COLOR_WARNING:ph,KUI_ICON_SIZE_10:gh,KUI_ICON_SIZE_20:_h,KUI_ICON_SIZE_30:yh,KUI_ICON_SIZE_40:Rh,KUI_ICON_SIZE_50:Ch,KUI_ICON_SIZE_60:Eh,KUI_ICON_SIZE_70:Oh,KUI_ICON_SIZE_80:bh,KUI_LETTER_SPACING_0:wh,KUI_LETTER_SPACING_MINUS_10:Th,KUI_LETTER_SPACING_MINUS_20:vh,KUI_LETTER_SPACING_MINUS_30:Sh,KUI_LETTER_SPACING_MINUS_40:xh,KUI_LETTER_SPACING_MINUS_50:Ih,KUI_LETTER_SPACING_NORMAL:Dh,KUI_LINE_HEIGHT_10:kh,KUI_LINE_HEIGHT_100:Ph,KUI_LINE_HEIGHT_20:Nh,KUI_LINE_HEIGHT_30:Ah,KUI_LINE_HEIGHT_40:Lh,KUI_LINE_HEIGHT_50:Uh,KUI_LINE_HEIGHT_60:Kh,KUI_LINE_HEIGHT_70:Mh,KUI_LINE_HEIGHT_80:Bh,KUI_LINE_HEIGHT_90:zh,KUI_METHOD_COLOR_BACKGROUND_CONNECT:qh,KUI_METHOD_COLOR_BACKGROUND_DELETE:Hh,KUI_METHOD_COLOR_BACKGROUND_GET:Gh,KUI_METHOD_COLOR_BACKGROUND_HEAD:$h,KUI_METHOD_COLOR_BACKGROUND_OPTIONS:Fh,KUI_METHOD_COLOR_BACKGROUND_PATCH:Wh,KUI_METHOD_COLOR_BACKGROUND_POST:Vh,KUI_METHOD_COLOR_BACKGROUND_PUT:Yh,KUI_METHOD_COLOR_BACKGROUND_TRACE:Xh,KUI_METHOD_COLOR_TEXT_CONNECT:jh,KUI_METHOD_COLOR_TEXT_CONNECT_STRONG:Qh,KUI_METHOD_COLOR_TEXT_DELETE:Zh,KUI_METHOD_COLOR_TEXT_DELETE_STRONG:Jh,KUI_METHOD_COLOR_TEXT_GET:ef,KUI_METHOD_COLOR_TEXT_GET_STRONG:tf,KUI_METHOD_COLOR_TEXT_HEAD:nf,KUI_METHOD_COLOR_TEXT_HEAD_STRONG:rf,KUI_METHOD_COLOR_TEXT_OPTIONS:sf,KUI_METHOD_COLOR_TEXT_OPTIONS_STRONG:of,KUI_METHOD_COLOR_TEXT_PATCH:af,KUI_METHOD_COLOR_TEXT_PATCH_STRONG:lf,KUI_METHOD_COLOR_TEXT_POST:cf,KUI_METHOD_COLOR_TEXT_POST_STRONG:uf,KUI_METHOD_COLOR_TEXT_PUT:df,KUI_METHOD_COLOR_TEXT_PUT_STRONG:hf,KUI_METHOD_COLOR_TEXT_TRACE:ff,KUI_METHOD_COLOR_TEXT_TRACE_STRONG:mf,KUI_NAVIGATION_COLOR_BACKGROUND:pf,KUI_NAVIGATION_COLOR_BACKGROUND_SELECTED:gf,KUI_NAVIGATION_COLOR_BORDER:_f,KUI_NAVIGATION_COLOR_BORDER_CHILD:yf,KUI_NAVIGATION_COLOR_BORDER_DIVIDER:Rf,KUI_NAVIGATION_COLOR_TEXT:Cf,KUI_NAVIGATION_COLOR_TEXT_FOCUS:Ef,KUI_NAVIGATION_COLOR_TEXT_HOVER:Of,KUI_NAVIGATION_COLOR_TEXT_SELECTED:bf,KUI_NAVIGATION_SHADOW_BORDER:wf,KUI_NAVIGATION_SHADOW_BORDER_CHILD:Tf,KUI_NAVIGATION_SHADOW_FOCUS:vf,KUI_SHADOW:Sf,KUI_SHADOW_BORDER:xf,KUI_SHADOW_BORDER_DANGER:If,KUI_SHADOW_BORDER_DANGER_STRONG:Df,KUI_SHADOW_BORDER_DISABLED:kf,KUI_SHADOW_BORDER_PRIMARY:Nf,KUI_SHADOW_BORDER_PRIMARY_STRONGEST:Af,KUI_SHADOW_BORDER_PRIMARY_WEAK:Lf,KUI_SHADOW_FOCUS:Uf,KUI_SPACE_0:Kf,KUI_SPACE_10:Mf,KUI_SPACE_100:Wf,KUI_SPACE_110:Vf,KUI_SPACE_120:Yf,KUI_SPACE_130:Xf,KUI_SPACE_140:jf,KUI_SPACE_150:Qf,KUI_SPACE_20:Bf,KUI_SPACE_30:zf,KUI_SPACE_40:Pf,KUI_SPACE_50:qf,KUI_SPACE_60:Hf,KUI_SPACE_70:Gf,KUI_SPACE_80:$f,KUI_SPACE_90:Ff,KUI_SPACE_AUTO:Zf,KUI_STATUS_COLOR_100:Jf,KUI_STATUS_COLOR_100S:hp,KUI_STATUS_COLOR_101:em,KUI_STATUS_COLOR_102:tm,KUI_STATUS_COLOR_103:im,KUI_STATUS_COLOR_1NA:ap,KUI_STATUS_COLOR_200:nm,KUI_STATUS_COLOR_200S:fp,KUI_STATUS_COLOR_201:rm,KUI_STATUS_COLOR_202:sm,KUI_STATUS_COLOR_203:om,KUI_STATUS_COLOR_204:am,KUI_STATUS_COLOR_205:lm,KUI_STATUS_COLOR_206:cm,KUI_STATUS_COLOR_207:um,KUI_STATUS_COLOR_208:dm,KUI_STATUS_COLOR_226:hm,KUI_STATUS_COLOR_2NA:lp,KUI_STATUS_COLOR_300:fm,KUI_STATUS_COLOR_300S:mp,KUI_STATUS_COLOR_301:mm,KUI_STATUS_COLOR_302:pm,KUI_STATUS_COLOR_303:gm,KUI_STATUS_COLOR_304:_m,KUI_STATUS_COLOR_305:ym,KUI_STATUS_COLOR_307:Rm,KUI_STATUS_COLOR_308:Cm,KUI_STATUS_COLOR_3NA:cp,KUI_STATUS_COLOR_400:Em,KUI_STATUS_COLOR_400S:pp,KUI_STATUS_COLOR_401:Om,KUI_STATUS_COLOR_402:bm,KUI_STATUS_COLOR_403:wm,KUI_STATUS_COLOR_404:Tm,KUI_STATUS_COLOR_405:vm,KUI_STATUS_COLOR_406:Sm,KUI_STATUS_COLOR_407:xm,KUI_STATUS_COLOR_408:Im,KUI_STATUS_COLOR_409:Dm,KUI_STATUS_COLOR_410:km,KUI_STATUS_COLOR_411:Nm,KUI_STATUS_COLOR_412:Am,KUI_STATUS_COLOR_413:Lm,KUI_STATUS_COLOR_414:Um,KUI_STATUS_COLOR_415:Km,KUI_STATUS_COLOR_416:Mm,KUI_STATUS_COLOR_417:Bm,KUI_STATUS_COLOR_418:zm,KUI_STATUS_COLOR_421:Pm,KUI_STATUS_COLOR_422:qm,KUI_STATUS_COLOR_423:Hm,KUI_STATUS_COLOR_424:Gm,KUI_STATUS_COLOR_425:$m,KUI_STATUS_COLOR_426:Fm,KUI_STATUS_COLOR_428:Wm,KUI_STATUS_COLOR_429:Vm,KUI_STATUS_COLOR_431:Ym,KUI_STATUS_COLOR_451:Xm,KUI_STATUS_COLOR_4NA:up,KUI_STATUS_COLOR_500:jm,KUI_STATUS_COLOR_500S:gp,KUI_STATUS_COLOR_501:Qm,KUI_STATUS_COLOR_502:Zm,KUI_STATUS_COLOR_503:Jm,KUI_STATUS_COLOR_504:ep,KUI_STATUS_COLOR_505:tp,KUI_STATUS_COLOR_506:ip,KUI_STATUS_COLOR_507:np,KUI_STATUS_COLOR_508:rp,KUI_STATUS_COLOR_510:sp,KUI_STATUS_COLOR_511:op,KUI_STATUS_COLOR_5NA:dp,KUI_STATUS_COLOR_BACKGROUND_100:_p,KUI_STATUS_COLOR_BACKGROUND_200:yp,KUI_STATUS_COLOR_BACKGROUND_300:Rp,KUI_STATUS_COLOR_BACKGROUND_400:Cp,KUI_STATUS_COLOR_BACKGROUND_500:Ep,KUI_STATUS_COLOR_TEXT_100:Op,KUI_STATUS_COLOR_TEXT_200:bp,KUI_STATUS_COLOR_TEXT_300:wp,KUI_STATUS_COLOR_TEXT_400:Tp,KUI_STATUS_COLOR_TEXT_500:vp},Symbol.toStringTag,{value:"Module"})),Tn=Object.keys(wn).filter(n=>n.startsWith("KUI_COLOR")),vn=n=>wn[n],Sp=n=>`--${n.toLowerCase().replaceAll("_","-")}`,Sn=()=>{if(typeof window>"u")return Object.fromEntries(Tn.map(t=>[t,vn(t)]));const n=window.getComputedStyle(document.documentElement),e=(t,i)=>n.getPropertyValue(t).trim()||i;return Object.fromEntries(Tn.map(t=>[t,e(Sp(t),vn(t))]))},Zt=n=>{const e=s.ref(Sn());if(typeof window<"u"&&typeof MutationObserver<"u"){const t=new MutationObserver(()=>{e.value=Sn()});t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-kui-theme"]}),s.getCurrentScope()&&s.onScopeDispose(()=>t.disconnect())}return e},xp=()=>typeof window>"u"?Qt:window.getComputedStyle(document.documentElement).getPropertyValue("--kui-font-family-text").trim()||Qt,Ip=n=>{const e=xp(),t={color:n.KUI_COLOR_TEXT,fontFamily:e},i={axisLabel:{color:n.KUI_COLOR_TEXT_NEUTRAL,fontFamily:e},axisLine:{lineStyle:{color:n.KUI_COLOR_BORDER}},splitLine:{lineStyle:{color:n.KUI_COLOR_BORDER}}};return{textStyle:t,categoryAxis:i,valueAxis:i,tooltip:{backgroundColor:n.KUI_COLOR_BACKGROUND,borderWidth:0,borderRadius:4,padding:0,confine:!0,extraCssText:"box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12), 0 5px 10px rgba(0, 0, 0, 0.24);",textStyle:{color:n.KUI_COLOR_TEXT,fontFamily:e}},visualMap:{textStyle:{color:n.KUI_COLOR_TEXT_NEUTRAL,fontFamily:e}},legend:{textStyle:{color:n.KUI_COLOR_TEXT_NEUTRAL,fontFamily:e}}}},Dp=n=>s.computed(()=>Ip(n.value)),kp={class:"kong-ui-public-echarts-tooltip"},Np={class:"tooltip-title"},Ap={class:"title"},Lp={key:0,class:"subtitle"},Up={class:"context"},Kp={class:"metric"},Mp={class:"tooltip-rows"},Bp={class:"display-value"},zp=s.defineComponent({__name:"ChartTooltip",props:{title:{},context:{},metric:{},rows:{}},setup(n){return(e,t)=>(s.openBlock(),s.createElementBlock("div",kp,[s.createElementVNode("div",Np,[s.createElementVNode("div",Ap,s.toDisplayString(n.title),1),n.context||n.metric?(s.openBlock(),s.createElementBlock("div",Lp,[s.createElementVNode("div",Up,s.toDisplayString(n.context),1),s.createElementVNode("div",Kp,s.toDisplayString(n.metric),1)])):s.createCommentVNode("",!0)]),s.createElementVNode("ul",Mp,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n.rows,(i,r)=>(s.openBlock(),s.createElementBlock("li",{key:`${i.label}-${r}`,class:s.normalizeClass({"extra-row":i.isExtra})},[s.createElementVNode("span",{class:"square-marker",style:s.normalizeStyle(i.isExtra?void 0:{background:i.color})},null,4),s.createElementVNode("span",{class:s.normalizeClass(["display-label",{empty:i.isSegmentEmpty}])},s.toDisplayString(i.label),3),s.createElementVNode("span",Bp,s.toDisplayString(i.value),1)],2))),128))])]))}}),xn=(n,e)=>{const t=n.__vccOpts||n;for(const[i,r]of e)t[i]=r;return t},Pp=xn(zp,[["__scopeId","data-v-ca633353"]]),Jt=n=>Array.isArray(n)?n:[n],In=(n,e)=>typeof n=="number"?e?.[n]??String(n):n,ei=(n,e,t,i)=>({color:typeof n.color=="string"?n.color:void 0,label:e,value:i?i(Number(t)):String(t??"")}),qp=n=>Array.isArray(n)?n[n.length-1]:n,Hp=n=>{const e=Jt(n),t=e[0];return{context:String(t?.axisValueLabel??t?.name??""),rows:e.map(i=>ei(i,i.seriesName??"",qp(i.value)))}},Gp=n=>{let e;return s.getCurrentScope()&&s.onScopeDispose(()=>{e&&s.render(null,e)}),t=>{const i=(n()??Hp)(t);return i?(e??=document.createElement("div"),s.render(s.h(Pp,i),e),e):""}},$p={class:"kong-ui-public-echarts"},Fp=s.defineComponent({name:"KongECharts",inheritAttrs:!1,__name:"ECharts",props:{option:{},height:{default:"400px"},tooltipContent:{type:Function}},setup(n){s.useCssVars(o=>({v1cecfeed:o.height})),Tt.use([Fn.CanvasRenderer,ct.GridComponent,ct.TooltipComponent]);const e=Zt(),t=Dp(e),i=Gp(()=>n.tooltipContent),r=s.computed(()=>({...n.option,tooltip:{...n.option?.tooltip,formatter:i}}));return(o,a)=>(s.openBlock(),s.createElementBlock("div",$p,[s.createVNode(s.unref($n),s.mergeProps({autoresize:!0,class:"chart",option:r.value,theme:s.unref(t)},o.$attrs),null,16,["option","theme"])]))}}),Dn=xn(Fp,[["__scopeId","data-v-68114d20"]]),kn=n=>typeof n=="object"&&n!==null&&!Array.isArray(n),rt=(n,...e)=>{const t={...n};for(const i of e)if(i)for(const[r,o]of Object.entries(i)){if(o===void 0)continue;const a=t[r];t[r]=kn(a)&&kn(o)?rt(a,o):o}return t},Wp=s.defineComponent({__name:"HeatmapChart",props:{data:{},xAxisLabels:{},yAxisLabels:{},seriesName:{},min:{},max:{},colorRange:{},valueFormatter:{type:Function},visibleRows:{},showValues:{type:Boolean},seriesOption:{},option:{},height:{},tooltipTitle:{}},setup(n){Tt.use([li.HeatmapChart,ct.VisualMapComponent,ct.DataZoomSliderComponent]);const e=Zt(),t=a=>{const[l]=Jt(a),[d,c,u]=l.value;return{title:n.tooltipTitle,context:In(d,n.xAxisLabels),metric:n.seriesName,rows:[ei(l,In(c,n.yAxisLabels),u,n.valueFormatter)]}},i=a=>({type:"slider",yAxisIndex:0,startValue:0,endValue:a-1,zoomLock:!0,right:10,width:8,handleSize:0,moveHandleSize:0,showDetail:!1,brushSelect:!1,showDataShadow:!1,borderColor:"transparent",backgroundColor:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST,fillerColor:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAK}),r=s.computed(()=>{const a=n.data??[],l=!!n.visibleRows&&n.visibleRows<(n.yAxisLabels?.length??0),d=n.valueFormatter?c=>n.valueFormatter(Number(c)):void 0;return{grid:{top:10,left:10,right:l?30:20,bottom:70,outerBoundsMode:"same",outerBoundsContain:"axisLabel"},xAxis:{type:"category",data:n.xAxisLabels??[],splitArea:{show:!1},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"category",data:n.yAxisLabels??[],inverse:!0,splitArea:{show:!1},axisLine:{show:!1},axisTick:{show:!1},axisLabel:{width:160,overflow:"truncate"}},visualMap:{min:n.min??0,max:n.max??a.reduce((c,[,,u])=>Math.max(c,u),1),calculable:!0,orient:"horizontal",left:"center",bottom:0,inRange:{color:n.colorRange??[e.value.KUI_COLOR_BACKGROUND_INFO_WEAKEST,e.value.KUI_COLOR_BACKGROUND_INFO_STRONG]},formatter:d},...l?{dataZoom:[i(n.visibleRows)]}:{},series:[rt({name:n.seriesName,type:"heatmap",data:a,animation:!1,label:{show:n.showValues??!1,formatter:n.valueFormatter?({value:c})=>n.valueFormatter(Number(c[2])):void 0},itemStyle:{borderColor:e.value.KUI_COLOR_BACKGROUND,borderWidth:2,borderRadius:2},emphasis:{itemStyle:{shadowBlur:5,shadowColor:e.value.KUI_COLOR_BACKGROUND_OVERLAY}}},n.seriesOption)]}}),o=s.computed(()=>rt(r.value,n.option));return(a,l)=>(s.openBlock(),s.createBlock(Dn,{height:n.height,option:o.value,"tooltip-content":t},null,8,["height","option"]))}}),Vp=s.defineComponent({__name:"TreeMapChart",props:{data:{},seriesName:{},showValues:{type:Boolean},valueFormatter:{type:Function},colorPalette:{},drillDown:{type:Boolean,default:!0},leafDepth:{},seriesOption:{},option:{},height:{},tooltipTitle:{}},setup(n){Tt.use([li.TreemapChart]);const e=Zt(),t=l=>{const[d]=Jt(l),c=d.treePathInfo??[];if(c.length===1)return;const u=c.slice(1,-1).map(({name:h})=>h);return{title:n.tooltipTitle,context:u.length?u.join(" / "):void 0,metric:n.seriesName,rows:[ei(d,d.name,Number(d.value),n.valueFormatter)]}},i=()=>[e.value.KUI_COLOR_BACKGROUND_PRIMARY_WEAK,e.value.KUI_COLOR_BACKGROUND_SUCCESS_WEAK,e.value.KUI_COLOR_BACKGROUND_WARNING_WEAK,e.value.KUI_COLOR_BACKGROUND_DANGER_WEAK,e.value.KUI_COLOR_BACKGROUND_INFO_WEAK,e.value.KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST,e.value.KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST],r=(l=[])=>l.reduce((d,c)=>Math.max(d,1+r(c.children)),0),o=s.computed(()=>({series:[rt({name:n.seriesName,type:"treemap",data:n.data??[],nodeClick:n.drillDown?"zoomToNode":!1,...n.drillDown?{scaleLimit:{min:1,max:1/0},zoomToNodeRatio:.2}:{},leafDepth:n.leafDepth??r(n.data),roam:n.drillDown,left:0,top:0,right:0,bottom:n.drillDown?40:0,visibleMin:0,breadcrumb:{show:n.drillDown,itemStyle:{color:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAK,borderColor:"transparent",borderWidth:0,borderRadius:2,textStyle:{color:e.value.KUI_COLOR_TEXT}},emphasis:{itemStyle:{color:e.value.KUI_COLOR_BACKGROUND_NEUTRAL,textStyle:{color:e.value.KUI_COLOR_TEXT}}}},levels:[{color:n.colorPalette??i(),itemStyle:{borderColor:e.value.KUI_COLOR_BACKGROUND,borderWidth:2,gapWidth:2}},{colorAlpha:[.55,1],itemStyle:{borderColor:e.value.KUI_COLOR_BACKGROUND,borderWidth:1,gapWidth:1}}],label:{show:!0,color:e.value.KUI_COLOR_TEXT,align:"center",verticalAlign:"middle",overflow:"truncate",formatter:n.showValues?({name:l,value:d})=>`${l}
13
- ${n.valueFormatter?n.valueFormatter(Number(d)):String(d)}`:void 0}},n.seriesOption)]})),a=s.computed(()=>rt(o.value,n.option));return(l,d)=>(s.openBlock(),s.createBlock(Dn,{height:n.height,option:a.value,"tooltip-content":t},null,8,["height","option"]))}}),Nn=n=>{if(n==null||typeof n=="string"&&n.trim()==="")return;const e=Number(n);return Number.isFinite(e)?e:void 0},Yp=(n,e,t)=>{if(!t.length)return n;const i=t.reduce((o,a)=>Math.min(o,a));if(i<=n)return i;const r=Math.ceil((i-n)/e);return i-r*e},Xp=(n,e,t)=>{const i=[];for(let r=n;r<e;r+=t)i.push(r);return i},jp=(n,e,t)=>{const i=o=>sa(o,t,"yyyy-MM-dd"),r=n.length>0&&i(n[0])!==i(n[n.length-1]);return n.map(o=>be.formatChartTicksByGranularity({tickValue:new Date(o),granularity:e,dayBoundaryCrossed:r,timezone:t}))},Qp=(n,e)=>{const t=n.indexOf(e);return t===-1?n.push(e)-1:t},Zp=(n,e)=>n[e]?.name??e,Jp=(n,{tz:e}={})=>{if(!n?.meta||!n.data)return;const{display:t,metric_names:i,start:r,end:o,granularity_ms:a}=n.meta,l=i?.[0],d=t&&Object.keys(t).find(I=>I!=="time");if(!l||!d||!r||!o){console.error("Cannot build heatmap chart data from this explore result. Missing metric, dimension or time range.");return}const c=a||ie.Granularities.daily,u=ie.msToGranularity(c)??"daily",h=e||Intl.DateTimeFormat().resolvedOptions().timeZone,f=n.data,p=Yp(new Date(r).getTime(),c,f.map(({timestamp:I})=>new Date(I).getTime())),C=Xp(p,new Date(o).getTime(),c),E=[],R=[];for(const{timestamp:I,event:D}of f){const w=Math.floor((new Date(I).getTime()-p)/c),O=Nn(D[l]);w<0||w>=C.length||O===void 0||R.push([w,Qp(E,String(D[d])),O])}return{data:R,xAxisLabels:jp(C,u,h),yAxisLabels:E.map(I=>Zp(t[d],I))}},eg={class:"wrapper","data-testid":"heatmap-chart"},tg=10,ig=Se(s.defineComponent({__name:"HeatmapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(n,{emit:e}){const t=n,i=e,{i18n:r}=le.useI18n(),o=le.useMetricFormatter(),a=c=>{const u=Jp(c,{tz:t.context.tz});if(u?.data.length)return{data:u.data,xAxisLabels:u.xAxisLabels,yAxisLabels:u.yAxisLabels,...o(c)}},l=new WeakMap,d=c=>(l.has(c)||l.set(c,a(c)),l.get(c));return(c,u)=>{const h=s.resolveComponent("KEmptyState");return s.openBlock(),s.createBlock(Be,{context:n.context,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onChartData:u[0]||(u[0]=f=>i("chart-data",f)),onQueryComplete:u[1]||(u[1]=f=>i("query-complete"))},{default:s.withCtx(({data:f})=>[s.createElementVNode("div",eg,[d(f)?(s.openBlock(),s.createBlock(s.unref(Wp),s.mergeProps({key:0,height:"100%","tooltip-title":n.chartOptions.chart_title??void 0,"visible-rows":tg},d(f)),null,16,["tooltip-title"])):(s.openBlock(),s.createBlock(h,{key:1,"action-button-visible":!1,"data-testid":"no-data-in-report"},{title:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.noDataAvailable.title")),1)]),default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.noDataAvailable.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-3315f2cd"]]),An=(n,e,{otherLabel:t})=>({name:e===be.OTHER_DIMENSION_ID&&t||(n?.[e]?.name??e)}),ng=(n,e,t,i)=>({...An(e,t,i),itemStyle:{color:Es({dimension:n,dimensionValue:t})}}),Ln=(n,e,t)=>{const i=n.get(e)??t();return n.set(e,i),i},ti=(n,e)=>!e.includes("time")&&(!n||ie.isMetricSupported("treemap",n)),Un=(n,e)=>{n.value=Number(n.value??0)+e},rg=(n,e,t,[i,r],o)=>{const a=new Map,l=(d,c)=>String(d[c]);for(const{event:d}of n){const c=Nn(d[e]);if(c===void 0)continue;const u=l(d,i),h=Ln(a,u,()=>({node:ng(i,t[i],u,o),children:new Map}));if(!r){Un(h.node,c);continue}const f=l(d,r),p=Ln(h.children,f,()=>An(t[r],f,o));Un(p,c)}return a},sg=(n,e={})=>{if(!n?.meta||!n.data)return;const{display:t,metric_names:i}=n.meta,r=i?.[0],o=t?Object.keys(t):[];if(!r||!o.length){console.error("Cannot build treemap chart data from this explore result. Missing metric or dimension.");return}if(!ti(r,o)){console.error("Cannot build treemap chart data from this explore result. Needs an additive metric and no time dimension.");return}return[...rg(n.data,r,t,o,e).values()].map(({node:l,children:d})=>d.size?{...l,children:[...d.values()]}:l)},og={class:"wrapper","data-testid":"treemap-chart"},ag=Se(s.defineComponent({__name:"TreemapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(n,{emit:e}){const t=n,i=e,{i18n:r}=le.useI18n(),o=le.useMetricFormatter(),a=s.computed(()=>ti(t.query.metrics?.[0],t.query.dimensions??[])),l=u=>{const h=sg(u,{otherLabel:r.t("chartLabels.____OTHER____")});if(h?.length)return{data:h,drillDown:h.some(f=>f.children?.length),...o(u)}},d=new WeakMap,c=u=>(d.has(u)||d.set(u,l(u)),d.get(u));return(u,h)=>{const f=s.resolveComponent("KEmptyState");return s.openBlock(),s.createBlock(Be,{context:n.context,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onChartData:h[0]||(h[0]=p=>i("chart-data",p)),onQueryComplete:h[1]||(h[1]=p=>i("query-complete"))},{default:s.withCtx(({data:p})=>[s.createElementVNode("div",og,[a.value?c(p)?(s.openBlock(),s.createBlock(s.unref(Vp),s.mergeProps({key:1,height:"100%","tooltip-title":n.chartOptions.chart_title??void 0},c(p)),null,16,["tooltip-title"])):(s.openBlock(),s.createBlock(f,{key:2,"action-button-visible":!1,"data-testid":"no-data-in-report"},{title:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.noDataAvailable.title")),1)]),default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.noDataAvailable.description")),1)]),_:1})):(s.openBlock(),s.createBlock(f,{key:0,"action-button-visible":!1,"data-testid":"treemap-unsupported"},{title:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.treemapUnsupported.title")),1)]),default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.treemapUnsupported.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-d818a9ae"]]),lg=["data-testid"],cg={key:0,class:"tile-header"},ug={class:"badge-container"},dg={class:"badge-text"},hg={class:"badge-text"},fg={key:0,class:"metric-selector-wrapper"},mg={key:1},pg=["data-testid"],gg=["data-testid"],_g=["data-testid"],yg={class:"delete-option"},Rg=["data-testid"],Kn=Se(s.defineComponent({__name:"DashboardTile",props:s.mergeModels({context:{},definition:{},fitToContent:{type:Boolean,default:!1},height:{default:()=>tt},hideActions:{type:Boolean,default:!1},isFullscreen:{type:Boolean},preview:{type:Boolean,default:!1},queryReady:{type:Boolean},showRefresh:{type:Boolean,default:!1},tileId:{},tileType:{default:"chart"}},{refreshCounter:{default:0},refreshCounterModifiers:{}}),emits:s.mergeModels(["chart-data","tile-loaded","edit-tile","duplicate-tile","remove-tile","tile-time-range-zoom","tile-bounds-change"],["update:refreshCounter"]),setup(n,{expose:e,emit:t}){s.useCssVars(G=>({v76398b0c:`${G.height}px`}));const i=parseInt(qi,10),r=le.useFieldLabel(),{zoomConfiguration:o}=le.useDashboardContext({context:s.computed(()=>n.context),preview:s.computed(()=>n.preview)}),a=s.useModel(n,"refreshCounter"),l=()=>{O.value=!0,a.value++},d=t,c=s.defineAsyncComponent(()=>Promise.resolve().then(()=>Gg)),u=s.inject(ve),h=we.useDatasourceConfigStore(),{datasourceConfigMap:f,stripUnknownFilters:p}=Ye(h),{i18n:C}=le.useI18n(),E=s.ref(),R=s.ref({status:"loading"}),I=s.ref(!1),D=s.ref(),w=s.ref(!1),O=s.ref(!0),S=s.computed(()=>n.definition.chart),U=s.computed(()=>S.value.type==="single_value"),K=s.computed(()=>("chart_title"in S.value?S.value.chart_title:void 0)||(U.value?ue.value:void 0)),m=s.computed(()=>n.definition.header_description),g=s.computed(()=>S.value.type==="slottable"),_=s.computed(()=>De(n.definition)||Ht(n.definition)?!1:!("allow_csv_export"in S.value)||S.value.allow_csv_export!==!1),{exploreLinkKebabMenu:v,requestsLinkKebabMenu:x,canShowKebabMenu:q,canGenerateRequestsLink:P,canGenerateExploreLink:W,requestsLinkZoomActions:j,exploreLinkZoomActions:F,buildExploreQuery:b,buildExploreLink:T,buildRequestLink:A,buildRequestsQueryZoomActions:k}=le.useContextLinks({queryBridge:u,chartData:s.readonly(E),definition:s.toRef(()=>n.definition),context:s.readonly(s.toRef(()=>n.context))}),{issueQuery:z}=le.useIssueQuery();s.watch(()=>n.definition,async(G,te)=>{await s.nextTick(),D.value&&(w.value=D.value.scrollWidth>D.value.clientWidth);try{JSON.stringify(G?.query)!==JSON.stringify(te?.query)&&(O.value=!0)}catch{}},{immediate:!0,deep:!0});const N=s.computed(()=>C.t("csvExport.defaultFilename")),ae=s.computed(()=>!!v.value||_.value||!!n.context.editable),ne=s.computed(()=>!n.hideActions&&q.value&&ae.value),ce=s.computed(()=>ne.value&&ae.value&&!n.isFullscreen),H={heatmap:ig,treemap:ag,timeseries_line:fn,timeseries_bar:fn,scatter:fl,horizontal_bar:hn,vertical_bar:hn,gauge:dn,donut:cc,golden_signals:ml,top_n:nc,top_talkers:rc,table:lc,slottable:void 0,single_value:dn,choropleth_map:c},L=s.computed(()=>({...B.value?.rendererEvents.supportsRequests?{"select-chart-range":$g}:{},...B.value?.rendererEvents.supportsZoom?{"zoom-time-range":He}:{},...B.value?.rendererEvents.supportsBounds?{"bounds-change":wt}:{},...B.value?.rendererEvents.supportsLoadingChange?{"loading-change":at}:{}})),B=s.computed(()=>{const G=H[n.definition.chart.type],te=De(n.definition),me=!!G?.emits?.includes("select-chart-range"),Ge=!!G?.emits?.includes("zoom-time-range"),ze=n.definition.chart.type==="choropleth_map",$e=!!G?.emits?.includes("loading-change"),ri={query:n.definition.query,context:n.context,queryReady:n.queryReady,height:n.height-i*2,refreshCounter:a.value,zoomConfiguration:o.value},si={chartOptions:n.definition.chart,activeMetric:Z.value,headerDescription:m.value,requestsLink:o.value.showRequestsAction?j.value:void 0,exploreLink:o.value.showExploreAction?F.value:void 0};return G&&{component:G,rendererProps:{...ri,...te?{}:si,...["top_n","single_value"].includes(n.definition.chart.type)?{fitToContent:n.fitToContent}:{}},rendererEvents:{supportsRequests:me,supportsZoom:Ge,supportsBounds:ze,supportsLoadingChange:$e}}}),Y=s.computed(()=>{if(De(n.definition))return null;const G=n.definition.query,te=G?.time_range;if(ie.isPlatformDatasource(G?.datasource)&&!G.dimensions?.includes("time"))return C.t("renderer.as_of_today");if(te?.type==="relative"){const me=ie.TimePeriods.get(ie.TIMEFRAME_LOOKUP[te.time_range]);return me?me.display:(console.warn("Did not recognize the given relative time range:",te.time_range),te.time_range)}else if(te?.type==="absolute"){const me=te.tz||"Etc/UTC";return`${ie.formatTime(te.start,{short:!0,tz:me})} - ${ie.formatTime(te.end,{short:!0,tz:me})}`}return null}),M=s.computed(()=>{const G=n.definition.query,te=G?.datasource,me=te?f.value[te]?.timeRangeOptions:void 0,ze=(G&&"time_range"in G?G.time_range:void 0)??n.context.timeSpec;return Ft(ze,me)}),J=s.computed(()=>g.value?!1:[!!K.value,ce.value,!!Y.value,M.value,!!m.value,n.showRefresh,X.value].some(Boolean)),de=s.computed(()=>E.value?ie.msToGranularity(E.value.meta.granularity_ms):void 0),ee=s.computed(()=>["timeseries_line","timeseries_bar"].includes(S.value.type)),re=s.computed(()=>E.value?.meta.metric_names??[]),Z=s.ref();s.watch(re,G=>{(!Z.value||!G.includes(Z.value))&&(Z.value=G[0])},{immediate:!0});const Re=s.computed(()=>{const G=S.value;return G.type!=="timeseries_line"?!1:re.value.some(te=>G.metric_axis_map?.[te]==="right")}),X=s.computed(()=>ee.value&&!Re.value&&(E.value?.data.length??0)>0&&re.value.length>1&&Object.keys(E.value?.meta.display??{}).length>0),ue=s.computed(()=>{const te=("metrics"in n.definition.query?n.definition.query.metrics?.[0]:void 0)??re.value[0];if(te)return r(te)}),Ae=s.computed(()=>re.value.map(G=>({value:G,label:r(G)}))),Le=s.computed(()=>{if(!Gt(n.definition)||!ee.value||!n.queryReady||O.value)return!1;const G=n.definition.query.granularity;return!G||!de.value?!1:G!==de.value}),Ce=s.computed(()=>{const G=ie.msToGranularity(E.value?.meta.granularity_ms??0)??"unknown",te=Gt(n.definition)?n.definition.query.granularity??"unknown":"unknown";return C.t("query_aged_out_warning",{currentGranularity:C.t(`granularities.${G}`),savedGranularity:C.t(`granularities.${te}`)})}),qe=s.computed(()=>{const G=[...n.context.filters,...n.definition.query.filters??[]],te="metrics"in n.definition.query?n.definition.query.metrics:void 0,me=n.definition.query.datasource??"api_usage";return p.value({datasource:me,filters:G,queryFields:te})}),fe=()=>{d("edit-tile",n.definition)},Ee=()=>{d("duplicate-tile",n.definition)},he=()=>{d("remove-tile",n.definition)},pe=G=>{E.value=G,O.value=!1,d("chart-data",G),d("tile-loaded")},Ie=()=>{O.value=!1,d("tile-loaded")},at=G=>{O.value=G,G||d("tile-loaded")},bt=()=>{I.value=!1},Ue=()=>{if(Ht(n.definition))throw new Error("Cannot export data for a tile backed by the api-requests endpoint");const G=n.definition.query.datasource?.startsWith("goap");return u?.staticConfig?.increaseCsvExportLimit!==!1&&!G?z(n.definition.query,n.context,ie.EXPORT_RECORD_LIMIT):E.value?Promise.resolve(E.value):new Promise(me=>{const Ge=s.watch(E,ze=>{ze&&(me(ze),Ge())})})},Oe=async()=>{I.value=!0,R.value={status:"loading"};try{const G=await Ue();R.value={status:"success",chartData:G}}catch(G){R.value={status:"error",error:G}}},He=G=>{const te={tileId:n.tileId.toString(),timeRange:G};d("tile-time-range-zoom",te)},wt=G=>{const te={tileId:n.tileId.toString(),bounds:G};d("tile-bounds-change",te)},$g=G=>{const te=qe.value,me=b(G,te);F.value=W.value?{href:T(me)}:void 0,j.value=P.value?{href:A(k(G,te))}:void 0};return e({getExportData:Ue}),(G,te)=>{const me=s.resolveComponent("KTooltip"),Ge=s.resolveComponent("KBadge"),ze=s.resolveComponent("KButton"),$e=s.resolveComponent("KDropdownItem"),ri=s.resolveComponent("KDropdown");return s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["tile-boundary",{editable:n.context.editable,"fit-to-content":n.fitToContent,headless:!J.value,"compact-single_value":U.value&&n.fitToContent}]),"data-testid":`tile-${n.tileId}`},[J.value&&!g.value?(s.openBlock(),s.createElementBlock("div",cg,[s.createVNode(me,{class:"title-tooltip",disabled:!w.value,"max-width":"500",text:K.value},{default:s.withCtx(()=>[s.createElementVNode("div",{ref_key:"titleRef",ref:D,class:"title"},s.toDisplayString(K.value),513)]),_:1},8,["disabled","text"]),s.createElementVNode("div",ug,[M.value?(s.openBlock(),s.createBlock(Ge,{key:0,appearance:"warning","data-testid":"unsupported-time-range-badge",tooltip:s.unref(C).t("unsupported_time_range_warning"),"tooltip-attributes":{maxWidth:"320px"}},{icon:s.withCtx(()=>[s.createVNode(s.unref(se.WarningIcon),{size:`var(--kui-icon-size-20, ${s.unref(Bi)})`},null,8,["size"])]),default:s.withCtx(()=>[s.createElementVNode("span",dg,s.toDisplayString(s.unref(C).t("unsupported_time_range_badge")),1)]),_:1},8,["tooltip"])):s.createCommentVNode("",!0),Y.value?(s.openBlock(),s.createBlock(Ge,{key:1,"data-testid":"time-range-badge",tooltip:Le.value?Ce.value:void 0,"tooltip-attributes":{maxWidth:"320px"}},s.createSlots({default:s.withCtx(()=>[s.createElementVNode("span",hg,s.toDisplayString(Y.value),1)]),_:2},[Le.value?{name:"icon",fn:s.withCtx(()=>[s.createVNode(s.unref(se.WarningIcon),{size:`var(--kui-icon-size-20, ${s.unref(Bi)})`},null,8,["size"])]),key:"0"}:void 0]),1032,["tooltip"])):s.createCommentVNode("",!0)]),X.value?(s.openBlock(),s.createElementBlock("div",fg,[s.createVNode(s.unref(Gn.KSegmentedControl),{modelValue:Z.value,"onUpdate:modelValue":te[0]||(te[0]=si=>Z.value=si),class:"metric-selector","data-testid":"metric-selector",options:Ae.value},null,8,["modelValue","options"])])):s.createCommentVNode("",!0),n.showRefresh?(s.openBlock(),s.createElementBlock("div",mg,[s.createVNode(ze,{appearance:"secondary",class:"refresh-button","data-testid":`tile-refresh-button-${n.tileId}`,disabled:O.value,icon:"",size:"small",onClick:l},{default:s.withCtx(()=>[O.value?(s.openBlock(),s.createBlock(s.unref(se.ProgressIcon),{key:0,role:"button",size:`var(--kui-icon-size-60, ${s.unref(Pi)})`,tabindex:"0"},null,8,["size"])):(s.openBlock(),s.createBlock(s.unref(se.RefreshIcon),{key:1,role:"button",size:`var(--kui-icon-size-60, ${s.unref(Pi)})`,tabindex:"0"},null,8,["size"]))]),_:1},8,["data-testid","disabled"])])):s.createCommentVNode("",!0),m.value?(s.openBlock(),s.createElementBlock("div",{key:2,class:"header-description","data-testid":`tile-description-${n.tileId}`},s.toDisplayString(m.value),9,pg)):s.createCommentVNode("",!0),ne.value?(s.openBlock(),s.createElementBlock("div",{key:3,class:"tile-actions","data-testid":`tile-actions-${n.tileId}`},[ne.value&&n.context.editable&&!n.isFullscreen?(s.openBlock(),s.createBlock(s.unref(se.EditIcon),{key:0,class:"edit-icon",color:`var(--kui-color-text-neutral, ${s.unref(Mt)})`,"data-testid":`edit-tile-${n.tileId}`,size:`var(--kui-icon-size-40, ${s.unref(zi)})`,onClick:fe},null,8,["color","data-testid","size"])):s.createCommentVNode("",!0),ne.value&&ae.value&&!n.isFullscreen?(s.openBlock(),s.createBlock(ri,{key:1,class:"dropdown","data-testid":`chart-action-menu-${n.tileId}`,"kpop-attributes":{placement:"bottom-end"}},{items:s.withCtx(()=>[s.unref(v)?(s.openBlock(),s.createBlock($e,{key:0,"data-testid":`chart-jump-to-explore-${n.tileId}`,item:{label:s.unref(C).t("jumpToExplore"),to:s.unref(v)}},null,8,["data-testid","item"])):s.createCommentVNode("",!0),!s.unref(De)(n.definition)&&s.unref(x)?(s.openBlock(),s.createBlock($e,{key:1,"data-testid":`chart-jump-to-requests-${n.tileId}`,item:{label:s.unref(C).t("jumpToRequests"),to:s.unref(x)}},null,8,["data-testid","item"])):s.createCommentVNode("",!0),_.value?(s.openBlock(),s.createBlock($e,{key:2,class:"chart-export-button","data-testid":`chart-csv-export-${n.tileId}`,onClick:Oe},{default:s.withCtx(()=>[s.createElementVNode("span",{class:"chart-export-trigger","data-testid":`csv-export-button-${n.tileId}`},s.toDisplayString(s.unref(C).t("csvExport.exportAsCsv")),9,_g)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0),n.context.editable?(s.openBlock(),s.createBlock($e,{key:3,"data-testid":`duplicate-tile-${n.tileId}`,onClick:Ee},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(C).t("renderer.duplicateTile")),1)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0),n.context.editable?(s.openBlock(),s.createBlock($e,{key:4,"data-testid":`remove-tile-${n.tileId}`,onClick:he},{default:s.withCtx(()=>[s.createElementVNode("span",yg,s.toDisplayString(s.unref(C).t("renderer.delete")),1)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0)]),default:s.withCtx(()=>[s.createVNode(s.unref(se.MoreIcon),{class:"kebab-action-menu",color:`var(--kui-color-text-neutral, ${s.unref(Mt)})`,"data-testid":`kebab-action-menu-${n.tileId}`,size:`var(--kui-icon-size-40, ${s.unref(zi)})`},null,8,["color","data-testid","size"])]),_:1},8,["data-testid"])):s.createCommentVNode("",!0)],8,gg)):s.createCommentVNode("",!0),I.value?(s.openBlock(),s.createBlock(ln,{key:4,"data-testid":`csv-export-modal-${n.tileId}`,"export-state":R.value,filename:N.value,onCloseModal:bt},null,8,["data-testid","export-state","filename"])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),s.createElementVNode("div",{class:s.normalizeClass(["tile-content",`type-${n.tileType}-${S.value.type}`]),"data-testid":`tile-content-${n.tileId}`},[B.value?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(B.value.component),s.mergeProps({key:0},B.value.rendererProps,s.toHandlers(L.value),{onChartData:pe,onQueryComplete:Ie}),null,16)):s.createCommentVNode("",!0)],10,Rg)],10,lg)}}}),[["__scopeId","data-v-1017ac1a"]]);function Cg(n,e,t,i,r){const o=(...a)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+r+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),e.apply(n,a));return o.prototype=e.prototype,o}class y{static getElements(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(i&&!isNaN(+e[0])){const o=i.getElementById(e);return o?[o]:[]}let r=t.querySelectorAll(e);return!r.length&&e[0]!=="."&&e[0]!=="#"&&(r=t.querySelectorAll("."+e),r.length||(r=t.querySelectorAll("#"+e))),Array.from(r)}return[e]}static getElement(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(!e.length)return null;if(i&&e[0]==="#")return i.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return t.querySelector(e);if(i&&!isNaN(+e[0]))return i.getElementById(e);let r=t.querySelector(e);return i&&!r&&(r=i.getElementById(e)),r||(r=t.querySelector("."+e)),r}return e}static lazyLoad(e){return e.lazyLoad||e.grid?.opts?.lazyLoad&&e.lazyLoad!==!1}static createDiv(e,t){const i=document.createElement("div");return e.forEach(r=>{r&&i.classList.add(r)}),t?.appendChild(i),i}static shouldSizeToContent(e,t=!1){return e?.grid&&(t?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,t){return!(e.y>=t.y+t.h||e.y+e.h<=t.y||e.x+e.w<=t.x||e.x>=t.x+t.w)}static isTouching(e,t){return y.isIntercepted(e,{x:t.x-.5,y:t.y-.5,w:t.w+1,h:t.h+1})}static areaIntercept(e,t){const i=e.x>t.x?e.x:t.x,r=e.x+e.w<t.x+t.w?e.x+e.w:t.x+t.w;if(r<=i)return 0;const o=e.y>t.y?e.y:t.y,a=e.y+e.h<t.y+t.h?e.y+e.h:t.y+t.h;return a<=o?0:(r-i)*(a-o)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((r,o)=>{const a=t*((r.y??1e4)-(o.y??1e4));return a===0?t*((r.x??1e4)-(o.x??1e4)):a})}static find(e,t){return t?e.find(i=>i.id===t):void 0}static createStylesheet(e,t,i){const r=document.createElement("style"),o=i?.nonce;return o&&(r.nonce=o),r.setAttribute("type","text/css"),r.setAttribute("gs-style-id",e),r.styleSheet?r.styleSheet.cssText="":r.appendChild(document.createTextNode("")),t?t.insertBefore(r,t.firstChild):(t=document.getElementsByTagName("head")[0],t.appendChild(r)),r}static removeStylesheet(e,t){const r=(t||document).querySelector("STYLE[gs-style-id="+e+"]");r&&r.parentNode&&r.remove()}static addCSSRule(e,t,i){e.textContent+=`${t} { ${i} } `}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let t,i="px";if(typeof e=="string")if(e==="auto"||e==="")t=0;else{const r=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!r)throw new Error(`Invalid height val = ${e}`);i=r[2]||"px",t=parseFloat(r[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(const r in i){if(!i.hasOwnProperty(r))return;e[r]===null||e[r]===void 0?e[r]=i[r]:typeof i[r]=="object"&&typeof e[r]=="object"&&this.defaults(e[r],i[r])}}),e}static same(e,t){if(typeof e!="object")return e==t;if(typeof e!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}static copyPos(e,t,i=!1){return t.x!==void 0&&(e.x=t.x),t.y!==void 0&&(e.y=t.y),t.w!==void 0&&(e.w=t.w),t.h!==void 0&&(e.h=t.h),i&&(t.minW&&(e.minW=t.minW),t.minH&&(e.minH=t.minH),t.maxW&&(e.maxW=t.maxW),t.maxH&&(e.maxH=t.maxH)),e}static samePos(e,t){return e&&t&&e.x===t.x&&e.y===t.y&&(e.w||1)===(t.w||1)&&(e.h||1)===(t.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,t){if(!(typeof e!="object"||typeof t!="object"))for(let i in e){const r=e[i],o=t[i];i[0]==="_"||r===o?delete e[i]:r&&typeof r=="object"&&o!==void 0&&(y.removeInternalAndSame(r,o),Object.keys(r).length||delete e[i])}}static removeInternalForSave(e,t=!0){for(let i in e)(i[0]==="_"||e[i]===null||e[i]===void 0)&&delete e[i];delete e.grid,t&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,t){let i=!1;return(...r)=>{i||(i=!0,setTimeout(()=>{e(...r),i=!1},t))}}static removePositioningStyles(e){const t=e.style;t.position&&t.removeProperty("position"),t.left&&t.removeProperty("left"),t.top&&t.removeProperty("top"),t.width&&t.removeProperty("width"),t.height&&t.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const t=getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowY)?e:this.getScrollElement(e.parentElement)}static updateScrollPosition(e,t,i){const r=e.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight;if(r.top<0||r.bottom>o){const a=r.bottom-o,l=r.top,d=this.getScrollElement(e);if(d!==null){const c=d.scrollTop;r.top<0&&i<0?e.offsetHeight>o?d.scrollTop+=i:d.scrollTop+=Math.abs(l)>Math.abs(i)?i:l:i>0&&(e.offsetHeight>o?d.scrollTop+=i:d.scrollTop+=a>i?i:a),t.top+=d.scrollTop-c}}}static updateScrollResize(e,t,i){const r=this.getScrollElement(t),o=r.clientHeight,a=r===this.getScrollElement()?0:r.getBoundingClientRect().top,l=e.clientY-a,d=l<i,c=l>o-i;d?r.scrollBy({behavior:"smooth",top:l-i}):c&&r.scrollBy({behavior:"smooth",top:i-(o-l)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const t=["parentGrid","el","grid","subGrid","engine"],i=y.clone(e);for(const r in i)i.hasOwnProperty(r)&&typeof i[r]=="object"&&r.substring(0,2)!=="__"&&!t.find(o=>o===r)&&(i[r]=y.cloneDeep(e[r]));return i}static cloneNode(e){const t=e.cloneNode(!0);return t.removeAttribute("id"),t}static appendTo(e,t){let i;typeof t=="string"?i=y.getElement(t):i=t,i&&i.appendChild(e)}static addElStyles(e,t){if(t instanceof Object)for(const i in t)t.hasOwnProperty(i)&&(Array.isArray(t[i])?t[i].forEach(r=>{e.style[i]=r}):e.style[i]=t[i])}static initEvent(e,t){const i={type:t.type},r={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:t.target?t.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(o=>i[o]=e[o]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(o=>i[o]=e[o]),{...i,...r}}static simulateMouseEvent(e,t,i){const r=e,o=new MouseEvent(t,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:r.ctrlKey??!1,altKey:r.altKey??!1,shiftKey:r.shiftKey??!1,metaKey:r.metaKey??!1,button:0,relatedTarget:e.target});(i||e.target).dispatchEvent(o)}static getValuesFromTransformedElement(e){const t=document.createElement("div");y.addElStyles(t,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(t);const i=t.getBoundingClientRect();return e.removeChild(t),t.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(e,t,i){if(!e)return;const r=e[t];e[t]=e[i],e[i]=r}static canBeRotated(e){return!(!e||e.w===e.h||e.locked||e.noResize||e.grid?.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class ke{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,t=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,t){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,r={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!r.nested&&!this.float&&this.swap(e,i))return!0;let o=t;!this._loading&&this._useEntireRowArea(e,t)&&(o={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,o,r.skip));let a=!1;const l={nested:!0,pack:!1};let d=0;for(;i=i||this.collide(e,o,r.skip);){if(d++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,{...i,y:e.y},e)||!this.collide(i,{...i,y:t.y-i.h},e))){e._skipDown=e._skipDown||t.y>e.y;const u={...t,y:i.y+i.h,...l};c=this._loading&&y.samePos(e,u)?!0:this.moveNode(e,u),(i.locked||this._loading)&&c?y.copyPos(t,e):!i.locked&&c&&r.pack&&(this._packNodes(),t.y=i.y+i.h,y.copyPos(e,t)),a=a||c}else c=this.moveNode(i,{...i,y:t.y+t.h,skip:e,...l});if(!c)return a;i=void 0}return a}collide(e,t=e,i){const r=e._id,o=i?._id;return this.nodes.find(a=>a._id!==r&&a._id!==o&&y.isIntercepted(a,t))}collideAll(e,t=e,i){const r=e._id,o=i?._id;return this.nodes.filter(a=>a._id!==r&&a._id!==o&&y.isIntercepted(a,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const r=e._rect,o={...t.rect};o.y>r.y?(o.h+=o.y-r.y,o.y=r.y):o.h+=r.y-o.y,o.x>r.x?(o.w+=o.x-r.x,o.x=r.x):o.w+=r.x-o.x;let a,l=.5;for(let d of i){if(d.locked||!d._rect)break;const c=d._rect;let u=Number.MAX_VALUE,h=Number.MAX_VALUE;r.y<c.y?u=(o.y+o.h-c.y)/c.h:r.y+r.h>c.y+c.h&&(u=(c.y+c.h-o.y)/c.h),r.x<c.x?h=(o.x+o.w-c.x)/c.w:r.x+r.w>c.x+c.w&&(h=(c.x+c.w-o.x)/c.w);const f=Math.min(h,u);f>l&&(l=f,a=d)}return t.collide=a,a}cacheRects(e,t,i,r,o,a){return this.nodes.forEach(l=>l._rect={y:l.y*t+i,x:l.x*e+a,w:l.w*e-a-r,h:l.h*t-i-o}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const o=t.x,a=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=o,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=a):(e.x=o,e.y=a),e._dirty=t._dirty=!0,!0}let r;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(r=y.isTouching(e,t)))return i();if(r!==!1){if(e.w===t.w&&e.x===t.x&&(r||(r=y.isTouching(e,t)))){if(t.y<e.y){const o=e;e=t,t=o}return i()}if(r!==!1){if(e.h===t.h&&e.y===t.y&&(r||(r=y.isTouching(e,t)))){if(t.x<e.x){const o=e;e=t,t=o}return i()}return!1}}}isAreaEmpty(e,t,i,r){const o={x:e||0,y:t||0,w:i||1,h:r||1};return!this.collide(o)}compact(e="compact",t=!0){if(this.nodes.length===0)return this;t&&this.sortNodes();const i=this.batchMode;i||this.batchUpdate();const r=this._inColumnResize;r||(this._inColumnResize=!0);const o=this.nodes;return this.nodes=[],o.forEach((a,l,d)=>{let c;a.locked||(a.autoPosition=!0,e==="list"&&l&&(c=d[l-1])),this.addNode(a,!1,c)}),r||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=y.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let t=e.y;for(;t>e._orig.y;)--t,this.collide(e,{x:e.x,y:t,w:e.w,h:e.h})||(e._dirty=!0,e.y=t)}):this.nodes.forEach((e,t)=>{if(!e.locked)for(;e.y>0;){const i=t===0?0:e.y-1;if(!(t===0||!this.collide(e,{x:e.x,y:i,w:e.w,h:e.h})))break;e._dirty=e.y!==i,e.y=i}}),this)}prepareNode(e,t){e._id=e._id??ke._idSeq++;const i=e.id;if(i){let o=1;for(;this.nodes.find(a=>a.id===e.id&&a!==e);)e.id=i+"_"+o++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const r={x:0,y:0,w:1,h:1};return y.defaults(e,r),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,y.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=r.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=r.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=r.w),isNaN(e.h)&&(e.h=r.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){const i=e._orig||y.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id&&this.findCacheLayout(e,this.defaultColumn)===-1){const o={...e};o.autoPosition||o.x===void 0?(delete o.x,delete o.y):o.x=Math.min(this.defaultColumn-1,o.x),o.w=Math.min(this.defaultColumn,o.w||1),this.cacheOneLayout(o,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(t?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(t?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),y.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!y.samePos(t,t._orig)):this.nodes.filter(t=>t._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const t=(e||[]).concat(this.getDirtyNodes());return this.onChange(t),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=y.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||y.samePos(e,e._orig)||(y.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,r){const o=r?r.y*i+(r.x+r.w):0;let a=!1;for(let l=o;!a;++l){const d=l%i,c=Math.floor(l/i);if(d+e.w>i)continue;const u={x:d,y:c,w:e.w,h:e.h};t.find(h=>y.isIntercepted(u,h))||((e.x!==d||e.y!==c)&&(e._dirty=!0),e.x=d,e.y=c,delete e.autoPosition,a=!0)}return a}addNode(e,t=!1,i){const r=this.nodes.find(a=>a._id===e._id);if(r)return r;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let o;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,o=!0),this.nodes.push(e),t&&this.addedNodes.push(e),o||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=!0,i=!1){return this.nodes.find(r=>r._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(r=>r._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,t=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(r=>r._removeDOM=!0);const i=this.nodes;return this.removedNodes=t?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(e,t);let i;const r=new ke({column:this.column,float:this.float,nodes:this.nodes.map(a=>a._id===e._id?(i={...a},i):{...a})});if(!i)return!1;const o=r.moveNode(i,t)&&r.getRow()<=Math.max(this.getRow(),this.maxRow);if(!o&&!t.resizing&&t.collide){const a=t.collide.el.gridstackNode;if(this.swap(e,a))return this._notify(),!0}return o?(r.nodes.filter(a=>a._dirty).forEach(a=>{const l=this.nodes.find(d=>d._id===a._id);l&&(y.copyPos(l,a),l._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new ke({column:this.column,float:this.float,nodes:this.nodes.map(r=>({...r}))}),i={...e};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow?(e._willFitPos=y.copyPos({},i),!0):!1}changedPosConstrain(e,t){return t.w=t.w||e.w,t.h=t.h||e.h,e.x!==t.x||e.y!==t.y?!0:(e.maxW&&(t.w=Math.min(t.w,e.maxW)),e.maxH&&(t.h=Math.min(t.h,e.maxH)),e.minW&&(t.w=Math.max(t.w,e.minW)),e.minH&&(t.h=Math.max(t.h,e.minH)),e.w!==t.w||e.h!==t.h)}moveNode(e,t){if(!e||!t)return!1;let i;t.pack===void 0&&!this.batchMode&&(i=t.pack=!0),typeof t.x!="number"&&(t.x=e.x),typeof t.y!="number"&&(t.y=e.y),typeof t.w!="number"&&(t.w=e.w),typeof t.h!="number"&&(t.h=e.h);const r=e.w!==t.w||e.h!==t.h,o=y.copyPos({},e,!0);if(y.copyPos(o,t),this.nodeBoundFix(o,r),y.copyPos(t,o),!t.forceCollide&&y.samePos(e,t))return!1;const a=y.copyPos({},e),l=this.collideAll(e,o,t.skip);let d=!0;if(l.length){const c=e._moving&&!t.nested;let u=c?this.directionCollideCoverage(e,t,l):l[0];if(c&&u&&e.grid?.opts?.subGridDynamic&&!e.grid._isTemp){const h=y.areaIntercept(t.rect,u._rect),f=y.area(t.rect),p=y.area(u._rect);h/(f<p?f:p)>.8&&(u.grid.makeSubGrid(u.el,void 0,e),u=void 0)}u?d=!this._fixCollisions(e,o,u,t):(d=!1,i&&delete t.pack)}return d&&!y.samePos(e,o)&&(e._dirty=!0,y.copyPos(e,o)),t.pack&&this._packNodes()._notify(),!y.samePos(e,a)}getRow(){return this.nodes.reduce((e,t)=>Math.max(e,t.y+t.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(t=>t._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,t){const i=this._layouts?.length,r=i&&this.column!==i-1?this._layouts[i-1]:null,o=[];return this.sortNodes(),this.nodes.forEach(a=>{const l=r?.find(c=>c._id===a._id),d={...a,...l||{}};y.removeInternalForSave(d,!e),t&&t(a,d),o.push(d)}),o}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,i)=>{if(!t||i===this.column)return this;if(i<this.column)this._layouts[i]=void 0;else{const r=i/this.column;e.forEach(o=>{if(!o._orig)return;const a=t.find(l=>l._id===o._id);a&&(a.y>=0&&o.y!==o._orig.y&&(a.y+=o.y-o._orig.y),o.x!==o._orig.x&&(a.x=Math.round(o.x*r)),o.w!==o._orig.w&&(a.w=Math.round(o.w*r)))})}}),this)}columnChanged(e,t,i="moveScale"){if(!this.nodes.length||!t||e===t)return this;const r=i==="compact"||i==="list";r&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let o=[],a=r?this.nodes:y.sort(this.nodes,-1);if(t>e&&this._layouts){const l=this._layouts[t]||[],d=this._layouts.length-1;!l.length&&e!==d&&this._layouts[d]?.length&&(e=d,this._layouts[d].forEach(c=>{const u=a.find(h=>h._id===c._id);u&&(!r&&!c.autoPosition&&(u.x=c.x??u.x,u.y=c.y??u.y),u.w=c.w??u.w,(c.x==null||c.y===void 0)&&(u.autoPosition=!0))})),l.forEach(c=>{const u=a.findIndex(h=>h._id===c._id);if(u!==-1){const h=a[u];if(r){h.w=c.w;return}(c.autoPosition||isNaN(c.x)||isNaN(c.y))&&this.findEmptyPosition(c,o),c.autoPosition||(h.x=c.x??h.x,h.y=c.y??h.y,h.w=c.w??h.w,o.push(h)),a.splice(u,1)}})}if(r)this.compact(i,!1);else{if(a.length)if(typeof i=="function")i(t,e,o,a);else{const l=r||i==="none"?1:t/e,d=i==="move"||i==="moveScale",c=i==="scale"||i==="moveScale";a.forEach(u=>{u.x=t===1?0:d?Math.round(u.x*l):Math.min(u.x,t-1),u.w=t===1||e===1?1:c?Math.round(u.w*l)||1:Math.min(u.w,t),o.push(u)}),a=[]}o=y.sort(o,-1),this._inColumnResize=!0,this.nodes=[],o.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!r),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const r=[];return e.forEach((o,a)=>{if(o._id===void 0){const l=o.id?this.nodes.find(d=>d.id===o.id):void 0;o._id=l?._id??ke._idSeq++}r[a]={x:o.x,y:o.y,w:o.w,_id:o._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=r,this}cacheOneLayout(e,t){e._id=e._id??ke._idSeq++;const i={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete i.x,delete i.y,e.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];const r=this.findCacheLayout(e,t);return r===-1?this._layouts[t].push(i):this._layouts[t][r]=i,this}findCacheLayout(e,t){return this._layouts?.[t]?.findIndex(i=>i._id===e._id)??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let t=0;t<this._layouts.length;t++){const i=this.findCacheLayout(e,t);i!==-1&&this._layouts[t].splice(i,1)}}cleanupNode(e){for(const t in e)t[0]==="_"&&t!=="_id"&&delete e[t];return this}}ke._idSeq=0;const ye={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class V{}const xe=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class Ne{}function _t(n,e){n.touches.length>1||(n.cancelable&&n.preventDefault(),y.simulateMouseEvent(n.changedTouches[0],e))}function Mn(n,e){n.cancelable&&n.preventDefault(),y.simulateMouseEvent(n,e)}function yt(n){Ne.touchHandled||(Ne.touchHandled=!0,_t(n,"mousedown"))}function Rt(n){Ne.touchHandled&&_t(n,"mousemove")}function Ct(n){if(!Ne.touchHandled)return;Ne.pointerLeaveTimeout&&(window.clearTimeout(Ne.pointerLeaveTimeout),delete Ne.pointerLeaveTimeout);const e=!!V.dragElement;_t(n,"mouseup"),e||_t(n,"click"),Ne.touchHandled=!1}function Et(n){n.pointerType!=="mouse"&&n.target.releasePointerCapture(n.pointerId)}function Bn(n){V.dragElement&&n.pointerType!=="mouse"&&Mn(n,"mouseenter")}function zn(n){V.dragElement&&n.pointerType!=="mouse"&&(Ne.pointerLeaveTimeout=window.setTimeout(()=>{delete Ne.pointerLeaveTimeout,Mn(n,"mouseleave")},10))}class Ot{constructor(e,t,i){this.host=e,this.dir=t,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const e=this.el=document.createElement("div");return e.classList.add("ui-resizable-handle"),e.classList.add(`${Ot.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),xe&&(this.el.addEventListener("touchstart",yt),this.el.addEventListener("pointerdown",Et)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),xe&&(this.el.removeEventListener("touchstart",yt),this.el.removeEventListener("pointerdown",Et)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),xe&&(this.el.addEventListener("touchmove",Rt),this.el.addEventListener("touchend",Ct)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const t=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),xe&&(this.el.removeEventListener("touchmove",Rt),this.el.removeEventListener("touchend",Ct)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){e.key==="Escape"&&(this.host.gridstackNode?.grid?.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}Ot.prefix="ui-resizable-";class ii{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,t){this._eventRegister[e]=t}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,t){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](t)}}class st extends ii{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const r=this.el.parentElement.getBoundingClientRect(),o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},a=this.temporalRect||o;return{position:{left:(a.left-r.left)*this.rectScale.x,top:(a.top-r.top)*this.rectScale.y},size:{width:a.width*this.rectScale.x,height:a.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const t=e.handles&&e.handles!==this.option.handles,i=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(r=>this.option[r]=e[r]),t&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),V.overResizeElement===this&&delete V.overResizeElement),this}_mouseOver(e){V.overResizeElement||V.dragElement||(V.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){V.overResizeElement===this&&(delete V.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Ot(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=y.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=y.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=y.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(t,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",t),this}_resizing(e,t){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,t),this._applyChange();const i=y.initEvent(e,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(e){const t=y.initEvent(e,{type:"resizestop",target:this.el});return this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),this._cleanHelper(),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=st._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,t=y.getValuesFromTransformedElement(e);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return st._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){const i=this.startEvent,r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},o=e.clientX-i.clientX,a=this.sizeToContent?0:e.clientY-i.clientY;let l,d;t.indexOf("e")>-1?r.width+=o:t.indexOf("w")>-1&&(r.width-=o,r.left+=o,l=!0),t.indexOf("s")>-1?r.height+=a:t.indexOf("n")>-1&&(r.height-=a,r.top+=a,d=!0);const c=this._constrainSize(r.width,r.height,l,d);return Math.round(r.width)!==Math.round(c.width)&&(t.indexOf("w")>-1&&(r.left+=r.width-c.width),r.width=c.width),Math.round(r.height)!==Math.round(c.height)&&(t.indexOf("n")>-1&&(r.top+=r.height-c.height),r.height=c.height),r}_constrainSize(e,t,i,r){const o=this.option,a=(i?o.maxWidthMoveLeft:o.maxWidth)||Number.MAX_SAFE_INTEGER,l=o.minWidth/this.rectScale.x||e,d=(r?o.maxHeightMoveUp:o.maxHeight)||Number.MAX_SAFE_INTEGER,c=o.minHeight/this.rectScale.y||t,u=Math.min(a,Math.max(l,e)),h=Math.min(d,Math.max(c,t));return{width:u,height:h}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const t=this.el.parentElement,{left:i,top:r}=t.getBoundingClientRect();e={left:i,top:r,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const i=this.temporalRect[t],r=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*r+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}st._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const Eg='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class ot extends ii{constructor(e,t={}){super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=t?.handle?.substring(1),r=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:r?.subGrid?[e.querySelector(t.handle)||e]:Array.from(e.querySelectorAll(t.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),xe&&(e.addEventListener("touchstart",yt),e.addEventListener("pointerdown",Et))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),xe&&(t.removeEventListener("touchstart",yt),t.removeEventListener("pointerdown",Et))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this}_mouseDown(e){if(!V.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(Eg)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete V.dragElement,delete V.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),xe&&(e.currentTarget.addEventListener("touchmove",Rt),e.currentTarget.addEventListener("touchend",Ct)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),V.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=y.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(e){const t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),V.pauseDrag){const i=Number.isInteger(V.pauseDrag)?V.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),i)}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=!0,V.dragElement=this;const i=this.el.gridstackNode?.grid;i?V.dropElement=i.el.ddElement.ddDroppable:delete V.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=y.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const r=y.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(r,this.ui()),this.triggerEvent("dragstart",r),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),xe&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Rt,!0),e.currentTarget.removeEventListener("touchend",Ct,!0)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),V.dropElement?.el===this.el.parentElement&&delete V.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const t=y.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(t),this.triggerEvent("dragstop",t),V.dropElement&&V.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete V.dragElement,delete V.dropElement,delete V.mouseHandled,e.preventDefault()}_keyEvent(e){const t=this.el.gridstackNode,i=t?.grid||V.dropElement?.el?.gridstack;if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i?.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!y.canBeRotated(t))return;t._origRotate=t._origRotate||{...t._orig},delete t._moving,i.setAnimation(!1).rotate(t.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),t._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,t.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",y.swap(t._orig,"w","h"),delete t._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=y.cloneNode(this.el)),e.parentElement||y.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=ot.originStyleProp.map(t=>this.el.style[t]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging");const t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, top",t.position="fixed",this._dragFollow(e),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null)},0),this}_removeHelperStyle(){if(this.helper.classList.remove("ui-draggable-dragging"),!this.helper?.gridstackNode?._isAboutToRemove&&this.dragElementOriginStyle){const t=this.helper,i=this.dragElementOriginStyle.transition||null;t.style.transition=this.dragElementOriginStyle.transition="none",ot.originStyleProp.forEach(r=>t.style[r]=this.dragElementOriginStyle[r]||null),setTimeout(()=>t.style.transition=i,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const t={left:0,top:0},i=this.helper.style,r=this.dragOffset;i.left=(e.clientX+r.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+r.offsetTop-t.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,t,i){let r=0,o=0;i&&(r=this.dragTransform.xOffset,o=this.dragTransform.yOffset);const a=t.getBoundingClientRect();return{left:a.left,top:a.top,offsetLeft:-e.clientX+a.left-r,offsetTop:-e.clientY+a.top-o,width:a.width*this.dragTransform.xScale,height:a.height*this.dragTransform.yScale}}ui(){const t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-t.top)*this.dragTransform.yScale,left:(i.left-t.left)*this.dragTransform.xScale}}}}ot.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class Og extends ii{constructor(e,t={}){super(),this.el=e,this.option=t,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),xe&&(this.el.addEventListener("pointerenter",Bn),this.el.addEventListener("pointerleave",zn)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),xe&&(this.el.removeEventListener("pointerenter",Bn),this.el.removeEventListener("pointerleave",zn)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this._setupAccept(),this}_mouseEnter(e){if(!V.dragElement||!this._canDrop(V.dragElement.el))return;e.preventDefault(),e.stopPropagation(),V.dropElement&&V.dropElement!==this&&V.dropElement._mouseLeave(e,!0),V.dropElement=this;const t=y.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(V.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){if(!V.dragElement||V.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const i=y.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(V.dragElement)),this.triggerEvent("dropout",i),V.dropElement===this&&(delete V.dropElement,!t)){let r,o=this.el.parentElement;for(;!r&&o;)r=o.ddElement?.ddDroppable,o=o.parentElement;r&&r._mouseEnter(e)}}drop(e){e.preventDefault();const t=y.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(V.dragElement)),this.triggerEvent("drop",t)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class ni{static init(e){return e.ddElement||(e.ddElement=new ni(e)),e.ddElement}constructor(e){this.el=e}on(e,t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,t),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new ot(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new st(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new Og(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class bg{resizable(e,t,i,r){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddResizable&&o.ddResizable[t]();else if(t==="destroy")o.ddResizable&&o.cleanResizable();else if(t==="option")o.setupResizable({[i]:r});else{const l=o.el.gridstackNode.grid;let d=o.el.getAttribute("gs-resize-handles")||l.opts.resizable.handles||"e,s,se";d==="all"&&(d="n,e,s,w,se,sw,ne,nw");const c=!l.opts.alwaysShowResizeHandle;o.setupResizable({...l.opts.resizable,handles:d,autoHide:c,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,r){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddDraggable&&o.ddDraggable[t]();else if(t==="destroy")o.ddDraggable&&o.cleanDraggable();else if(t==="option")o.setupDraggable({[i]:r});else{const a=o.el.gridstackNode.grid;o.setupDraggable({...a.opts.draggable,start:t.start,stop:t.stop,drag:t.drag})}}),this}dragIn(e,t){return this._getDDElements(e).forEach(i=>i.setupDraggable(t)),this}droppable(e,t,i,r){return typeof t.accept=="function"&&!t._accept&&(t._accept=t.accept,t.accept=o=>t._accept(o)),this._getDDElements(e,t).forEach(o=>{t==="disable"||t==="enable"?o.ddDroppable&&o.ddDroppable[t]():t==="destroy"?o.ddDroppable&&o.cleanDroppable():t==="option"?o.setupDroppable({[i]:r}):o.setupDroppable(t)}),this}isDroppable(e){return!!(e?.ddElement?.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){return!!(e?.ddElement?.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){return!!(e?.ddElement?.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(r=>r.on(t,o=>{i(o,V.dragElement?V.dragElement.el:o.target,V.dragElement?V.dragElement.helper:null)})),this}off(e,t){return this._getDDElements(e).forEach(i=>i.off(t)),this}_getDDElements(e,t){const i=e.gridstack||t!=="destroy"&&t!=="disable",r=y.getElements(e);return r.length?r.map(a=>a.ddElement||(i?ni.init(a):null)).filter(a=>a):[]}}const _e=new bg;class ${static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=$.getGridElement(t);return i?(i.gridstack||(i.gridstack=new $(i,y.cloneDeep(e))),i.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
8
+ `);var w=0,L=!1;this.parse=function(N,z,A){if(typeof N!="string")throw new Error("Input must be a string");var ae=N.length,ne=p.length,ce=_.length,H=T.length,K=U(S),B=[],Y=[],M=[],J=w=0;if(!N)return fe();if(P||P!==!1&&N.indexOf(F)===-1){for(var de=N.split(_),ee=0;ee<de.length;ee++){if(M=de[ee],w+=M.length,ee!==de.length-1)w+=_.length;else if(A)return fe();if(!T||M.substring(0,H)!==T){if(K){if(B=[],Ae(M.split(p)),Oe(),L)return fe()}else Ae(M.split(p));if(q&&q<=ee)return B=B.slice(0,q),fe(!0)}}return fe()}for(var re=N.indexOf(p,w),Z=N.indexOf(_,w),Re=new RegExp(C(b)+C(F),"g"),X=N.indexOf(F,w);;)if(N[w]===F)for(X=w,w++;;){if((X=N.indexOf(F,X+1))===-1)return A||Y.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:B.length,index:w}),Ee();if(X===ae-1)return Ee(N.substring(w,X).replace(Re,F));if(F===b&&N[X+1]===b)X++;else if(F===b||X===0||N[X-1]!==b){re!==-1&&re<X+1&&(re=N.indexOf(p,X+1));var ue=Le((Z=Z!==-1&&Z<X+1?N.indexOf(_,X+1):Z)===-1?re:Math.min(re,Z));if(N.substr(X+1+ue,ne)===p){M.push(N.substring(w,X).replace(Re,F)),N[w=X+1+ue+ne]!==F&&(X=N.indexOf(F,w)),re=N.indexOf(p,w),Z=N.indexOf(_,w);break}if(ue=Le(Z),N.substring(X+1+ue,X+1+ue+ce)===_){if(M.push(N.substring(w,X).replace(Re,F)),qe(X+1+ue+ce),re=N.indexOf(p,w),X=N.indexOf(F,w),K&&(Oe(),L))return fe();if(q&&B.length>=q)return fe(!0);break}Y.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:B.length,index:w}),X++}}else if(T&&M.length===0&&N.substring(w,w+H)===T){if(Z===-1)return fe();w=Z+ce,Z=N.indexOf(_,w),re=N.indexOf(p,w)}else if(re!==-1&&(re<Z||Z===-1))M.push(N.substring(w,re)),w=re+ne,re=N.indexOf(p,w);else{if(Z===-1)break;if(M.push(N.substring(w,Z)),qe(Z+ce),K&&(Oe(),L))return fe();if(q&&B.length>=q)return fe(!0)}return Ee();function Ae(he){B.push(he),J=w}function Le(he){var pe=0;return pe=he!==-1&&(he=N.substring(X+1,he))&&he.trim()===""?he.length:pe}function Ee(he){return A||(he===void 0&&(he=N.substring(w)),M.push(he),w=ae,Ae(M),K&&Oe()),fe()}function qe(he){w=he,Ae(M),M=[],Z=N.indexOf(_,w)}function fe(he){if(m.header&&!z&&B.length&&!j){var pe=B[0],Ie=Object.create(null),at=new Set(pe);let bt=!1;for(let Ue=0;Ue<pe.length;Ue++){let be=c(pe[Ue]);if(Ie[be=U(m.transformHeader)?m.transformHeader(be,Ue):be]){let He,wt=Ie[be];for(;He=be+"_"+wt,wt++,at.has(He););at.add(He),pe[Ue]=He,Ie[be]++,bt=!0,(W=W===null?{}:W)[He]=be}else Ie[be]=1,pe[Ue]=be;at.add(be)}bt&&console.warn("Duplicate headers found and renamed."),j=!0}return{data:B,errors:Y,meta:{delimiter:p,linebreak:_,aborted:L,truncated:!!he,cursor:J+(z||0),renamedHeaders:W}}}function Oe(){S(fe()),B=[],Y=[]}},this.abort=function(){L=!0},this.getCharIndex=function(){return w}}function k(m){var p=m.data,_=a[p.workerId],T=!1;if(p.error)_.userError(p.error,p.file);else if(p.results&&p.results.data){var S={abort:function(){T=!0,I(p.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:O,resume:O};if(U(_.userStep)){for(var q=0;q<p.results.data.length&&(_.userStep({data:p.results.data[q],errors:p.results.errors,meta:p.results.meta},S),!T);q++);delete p.results}else U(_.userChunk)&&(_.userChunk(p.results,S,p.file),delete p.results)}p.finished&&!T&&I(p.workerId,p.results)}function I(m,p){var _=a[m];U(_.userComplete)&&_.userComplete(p),_.terminate(),delete a[m]}function O(){throw new Error("Not implemented.")}function x(m){if(typeof m!="object"||m===null)return m;var p,_=Array.isArray(m)?[]:{};for(p in m)_[p]=x(m[p]);return _}function D(m,p){return function(){m.apply(p,arguments)}}function U(m){return typeof m=="function"}return d.parse=function(m,p){var _=(p=p||{}).dynamicTyping||!1;if(U(_)&&(p.dynamicTypingFunction=_,_={}),p.dynamicTyping=_,p.transform=!!U(p.transform)&&p.transform,p.downloadTimeout!==void 0){var _=parseInt(p.downloadTimeout);if(isNaN(_))throw new Error("Config downloadTimeout value ("+p.downloadTimeout+") not parsable by parseInt(val).");p.downloadTimeout=_}if(!p.worker||!d.WORKERS_SUPPORTED)return _=null,d.NODE_STREAM_INPUT,typeof m=="string"?(m=c(m),_=new(p.download?h:g)(p)):m.readable===!0&&U(m.read)&&U(m.on)?_=new R(p):(i.File&&m instanceof File||m instanceof Object)&&(_=new f(p)),_.stream(m);(_=(()=>{var T;return!!d.WORKERS_SUPPORTED&&(T=(()=>{var S=i.URL||i.webkitURL||null,q=t.toString();return d.BLOB_URL||(d.BLOB_URL=S.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",q,")();"],{type:"text/javascript"})))})(),(T=new i.Worker(T)).onmessage=k,T.id=l++,a[T.id]=T)})()).userStep=p.step,_.userChunk=p.chunk,_.userComplete=p.complete,_.userError=p.error,p.step=U(p.step),p.chunk=U(p.chunk),p.complete=U(p.complete),p.error=U(p.error),delete p.worker,_.postMessage({input:m,config:p,workerId:_.id})},d.unparse=function(m,p){var _=!1,T=!0,S=",",q=`\r
9
+ `,P='"',W=P+P,j=!1,F=null,b=!1,w=((()=>{if(typeof p=="object"){if(typeof p.delimiter!="string"||d.BAD_DELIMITERS.filter(function(z){return p.delimiter.indexOf(z)!==-1}).length||(S=p.delimiter),typeof p.quotes!="boolean"&&typeof p.quotes!="function"&&!Array.isArray(p.quotes)||(_=p.quotes),typeof p.skipEmptyLines!="boolean"&&typeof p.skipEmptyLines!="string"||(j=p.skipEmptyLines),typeof p.newline=="string"&&(q=p.newline),typeof p.quoteChar=="string"&&(P=p.quoteChar,W=P+P),typeof p.header=="boolean"&&(T=p.header),Array.isArray(p.columns)){if(p.columns.length===0)throw new Error("Option columns is empty");F=p.columns}p.escapeChar!==void 0&&(W=p.escapeChar+P),p.escapeFormulae instanceof RegExp?b=p.escapeFormulae:typeof p.escapeFormulae=="boolean"&&p.escapeFormulae&&(b=/^[=+\-@\t\r].*$/)}})(),new RegExp(C(P),"g"));if(typeof m=="string"&&(m=JSON.parse(m)),Array.isArray(m)){if(!m.length||Array.isArray(m[0]))return L(null,m,j);if(typeof m[0]=="object")return L(F||Object.keys(m[0]),m,j)}else if(typeof m=="object")return typeof m.data=="string"&&(m.data=JSON.parse(m.data)),Array.isArray(m.data)&&(m.fields||(m.fields=m.meta&&m.meta.fields||F),m.fields||(m.fields=Array.isArray(m.data[0])?m.fields:typeof m.data[0]=="object"?Object.keys(m.data[0]):[]),Array.isArray(m.data[0])||typeof m.data[0]=="object"||(m.data=[m.data])),L(m.fields||[],m.data||[],j);throw new Error("Unable to serialize unrecognized input");function L(z,A,ae){var ne="",ce=(typeof z=="string"&&(z=JSON.parse(z)),typeof A=="string"&&(A=JSON.parse(A)),Array.isArray(z)&&0<z.length),H=!Array.isArray(A[0]);if(ce&&T){for(var K=0;K<z.length;K++)0<K&&(ne+=S),ne+=N(z[K],K);0<A.length&&(ne+=q)}for(var B=0;B<A.length;B++){var Y=(ce?z:A[B]).length,M=!1,J=ce?Object.keys(A[B]).length===0:A[B].length===0;if(ae&&!ce&&(M=ae==="greedy"?A[B].join("").trim()==="":A[B].length===1&&A[B][0].length===0),ae==="greedy"&&ce){for(var de=[],ee=0;ee<Y;ee++){var re=H?z[ee]:ee;de.push(A[B][re])}M=de.join("").trim()===""}if(!M){for(var Z=0;Z<Y;Z++){0<Z&&!J&&(ne+=S);var Re=ce&&H?z[Z]:Z;ne+=N(A[B][Re],Z)}B<A.length-1&&(!ae||0<Y&&!J)&&(ne+=q)}}return ne}function N(z,A){var ae,ne,ce;return z==null?"":z.constructor===Date?isNaN(z.getTime())?"":z.toISOString():(ce=!1,b&&typeof z=="string"&&b.test(z)&&(z="'"+z,ce=!0),ne=(ae=z.toString()).replace(w,W),(ce=ce||_===!0||typeof _=="function"&&_(z,A)||Array.isArray(_)&&_[A]||((H,K)=>{for(var B=0;B<K.length;B++)if(-1<H.indexOf(K[B]))return!0;return!1})(ne,d.BAD_DELIMITERS)||-1<ne.indexOf(S)||-1<ae.indexOf(P)||ne.charAt(0)===" "||ne.charAt(ne.length-1)===" ")?P+ne+P:ne)}},d.RECORD_SEP="",d.UNIT_SEP="",d.BYTE_ORDER_MARK="\uFEFF",d.BAD_DELIMITERS=["\r",`
10
+ `,'"',d.BYTE_ORDER_MARK],d.WORKERS_SUPPORTED=!r&&!!i.Worker,d.NODE_STREAM_INPUT=1,d.LocalChunkSize=10485760,d.RemoteChunkSize=5242880,d.DefaultDelimiter=",",d.Parser=v,d.ParserHandle=E,d.NetworkStreamer=h,d.FileStreamer=f,d.StringStreamer=g,d.ReadableStreamStreamer=R,o&&(i.onmessage=function(m){m=m.data,d.WORKER_ID===void 0&&m&&(d.WORKER_ID=m.workerId),typeof m.input=="string"?i.postMessage({workerId:d.WORKER_ID,results:d.parse(m.input,m.config),finished:!0}):(i.File&&m.input instanceof File||m.input instanceof Object)&&(m=d.parse(m.input,m.config))&&i.postMessage({workerId:d.WORKER_ID,results:m,finished:!0})}),(h.prototype=Object.create(u.prototype)).constructor=h,(f.prototype=Object.create(u.prototype)).constructor=f,(g.prototype=Object.create(g.prototype)).constructor=g,(R.prototype=Object.create(u.prototype)).constructor=R,d})})(mt)),mt.exports}var pa=ma(),Ve=(n=>(n.String="string",n.Number="number",n.Boolean="boolean",n.Object="object",n.Undefined="undefined",n))(Ve||{});const ga=["id"],_a=s.defineComponent({__name:"VueJsonCsv",props:{data:{type:Array,required:!0},fields:{type:Array,required:!1,default:null},labels:{type:Object,required:!1,default:null},filename:{type:String,default:"report-data.csv"},delimiter:{type:String,default:",",required:!1},separatorExcel:{type:Boolean,default:!1},encoding:{type:String,default:"utf-8"},testing:{type:Boolean,required:!1,default:!1}},emits:["export-started","export-finished"],setup(n,{emit:e}){const t=e,i=n,r=s.computed(()=>`export_${new Date().getTime()}`),o=s.computed(()=>{const u=d();return u.length?u:null}),a=()=>{const u=i.labels;if(typeof i.fields!==Ve.Object)throw new Error("Labels needs to be a object containing key / value pairs.");return u!==null&&typeof u===Ve.Object?h=>Object.fromEntries(Object.entries(h).map(([f,g])=>[u[f]||f,g])):h=>h},l=()=>{const u=i.fields;if(typeof i.fields!==Ve.Object&&!Array.isArray(u))throw new Error("Fields needs to be an array of strings.");return Array.isArray(u)?h=>Object.fromEntries(u.filter(f=>f in h).map(f=>[f,h[f]])):h=>h},d=()=>{if(typeof i.fields===Ve.Undefined&&typeof i.labels===Ve.Undefined)return i.data;const u=a(),h=l();return i.data.map(f=>u(h(f)))},c=()=>{if(!o.value){console.warn("No data to export");return}t("export-started",o.value);let u=pa.unparse(o.value,Object.assign({delimiter:i.delimiter,encoding:i.encoding}));if(i.separatorExcel&&(u="SEP="+i.delimiter+`\r
11
+ `+u),i.encoding==="utf-8"&&(u="\uFEFF"+u),t("export-finished",i.filename),!i.testing){const h=new Blob([u],{type:"text/csv;charset="+i.encoding});ha.saveAs(h,i.filename)}};return(u,h)=>(s.openBlock(),s.createElementBlock("div",{id:r.value,"data-testid":"export-csv",onClick:c},[s.renderSlot(u.$slots,"default",{},()=>[s.createTextVNode("Download "+s.toDisplayString(n.filename),1)])],8,ga))}}),ya=s.defineComponent({__name:"DownloadCsv",props:{rows:{},headers:{},filename:{}},setup(n){const e=n,t=s.computed(()=>Object.keys(e.headers));return(i,r)=>(s.openBlock(),s.createElementBlock("div",null,[s.createVNode(_a,{data:n.rows,fields:t.value,filename:n.filename,labels:n.headers},{default:s.withCtx(()=>[s.renderSlot(i.$slots,"default")]),_:3},8,["data","fields","filename","labels"])]))}}),Ra={renderer:{not_configured:{title:"Chart is not fully configured",description:"Begin by choosing at least one metric"},noQueryBridge:"No query bridge provided. Unable to render dashboard.",unexpectedError:"An unexpected error has occurred.",trendRange:{"24h":"Last 24-hour summary","7d":"Last 7-day summary","30d":"Last 30-day summary"},edit:"Edit",duplicateTile:"Duplicate",exit_fullscreen:"Exit fullscreen",fullscreen:"Fullscreen",remove:"Remove",delete:"Delete",as_of_today:"As of today",noDataAvailable:{title:"No data in the current time frame",description:"Once there is traffic, it will display here"},treemapUnsupported:{title:"This query can't be shown as a treemap",description:"Treemaps need a count or total metric, such as requests or tokens, and no time dimension"}},pdfExport:{branding:"Kong Konnect",generated:"Generated {timestamp}",dashboardNote:"For a live, interactive experience, open this dashboard in Konnect",pageOf:"{page} / {total}"},csvExport:{defaultFilename:"Chart export",exportAsCsv:"Export as CSV",dataError:"Error loading data",noDataRange:"No data in selected range",noDataRetry:"Please adjust the time period and try again",timeRangeSelected:"selected",exportPreview:"Export preview",exportTimeRange:"Time range",exportAsOf:"As of {time}",exportDescription:"Exports a CSV of the data represented in the chart.",maximumRecordAmount:"The number of groups is limited to {value}",previewRows:"Previewing {rowsMax} of {rowsTotal} row{plural}",downloadButton:"Export",cancelButton:"Cancel",UtcOffset:"UTC offset",Timestamp:"Timestamp"},chartLabels:{control_plane:"Control plane",data_plane_node_version:"Data plane node version",env:"Environment",gateway_service:"Gateway service",hostname:"Hostname",plugin:"Plugin",plugin_name:"Plugin name",plugin_scope:"Plugin scope",region:"Region",request_count:"Request count",route:"Route",status_code:"Status code",team:"Team",name:"Name",latencies_response_ms:"Response latency",latencies_upstream_ms:"Upstream latency",latencies_kong_gateway_ms:"Kong latency",latencies_kong_internal_ms:"Kong internal latency",request_body_size:"Request size",response_body_size:"Response size",response_header_content_length:"Content length",ai:{cost:"Cost",costCaching:"Caching cost",promptTokens:"Prompt tokens",completionTokens:"Completion tokens",totalTokens:"Total tokens",llmLatency:"LLM latency",fetchLatency:"Fetch latency",embeddingsLatency:"Embeddings latency"},mcp:{latency:"MCP latency",response_body_size:"MCP response size"},a2a:{latency:"A2A latency",response_body_size:"A2A response size"},ai_gateway:"AI gateway",ai_gateway_agent:"AI gateway agent",ai_gateway_consumer:"AI gateway consumer",ai_gateway_consumer_group:"AI gateway consumer group",ai_gateway_data_plane_node:"AI gateway data plane node",ai_gateway_mcp_server:"AI gateway MCP server",ai_gateway_model:"AI gateway model",ai_gateway_version:"AI gateway version",ai_count:"LLM request count",ai_plugin:"AI plugin",ai_provider:"Provider",ai_request_model:"Request model",ai_response_model:"Response model",error_rate:"Error rate",request_per_minute:"Requests per minute",requests_per_minute:"Requests per minute",response_latency_average:"Response latency (avg)",response_latency_p99:"Response latency (p99)",response_latency_p95:"Response latency (p95)",response_latency_p50:"Response latency (p50)",kong_latency_average:"Kong latency (avg)",kong_latency_p99:"Kong latency (p99)",kong_latency_p95:"Kong latency (p95)",kong_latency_p50:"Kong latency (p50)",kong_internal_latency_average:"Kong internal latency (avg)",kong_internal_latency_p99:"Kong internal latency (p99)",kong_internal_latency_p95:"Kong internal latency (p95)",kong_internal_latency_p50:"Kong internal latency (p50)",llm_cache_status:"Cache status",llm_embeddings_model:"Embeddings model",llm_embeddings_provider:"Embeddings provider",upstream_latency_average:"Upstream latency (avg)",upstream_latency_p99:"Upstream latency (p99)",upstream_latency_p95:"Upstream latency (p95)",upstream_latency_p50:"Upstream latency (p50)",response_size_p99:"Response size (p99)",response_size_p95:"Response size (p95)",response_size_p50:"Response size (p50)",response_size_average:"Response size (avg)",response_size_sum:"Response size (sum)",response_source:"Response source",request_size_p99:"Request size (p99)",request_size_p95:"Request size (p95)",request_size_p50:"Request size (p50)",request_size_average:"Request size (avg)",request_size_sum:"Request size (sum)",total_tokens_per_minute:"Total tokens per minute",control_plane_group:"Control plane group",consumer:"Consumer",consumer_group:"Consumer group",country_code:"Country",country:"Country",data_plane_node:"Data plane node",api_package:"API package",api_product:"API product",api_product_version:"API product version",portal:"Portal",realm:"Realm",runtime_group:"Runtime group",application:"Application",status_code_grouped:"Status code (grouped)",upstream_status_code:"Upstream status code",upstream_status_code_grouped:"Upstream status code group",time:"Time",Service:"Service",ServiceVersion:"Service version",Route:"Route",Application:"Application",RuntimeGroup:"Runtime group",GatewayService:"Gateway service",StatusCode:"Status code",CodeClass:"Status code (grouped)",Time:"Time",API_PRODUCT:"Api product",API_PRODUCT_VERSION:"API product version",RUNTIME_GROUP:"Runtime group",GATEWAY_SERVICE:"Gateway service",ROUTE:"Route",APPLICATION:"Application",STATUS_CODE:"Status code",STATUS_CODE_GROUPED:"Status code (grouped)",TIME:"Time",ORGANIZATION:"Organization",TotalRequests:"Request count",RequestsPerMinute:"Requests per minute",LatencyP99:"Response latency (p99)",LatencyP95:"Response latency (p95)",LatencyP50:"Response latency (p50)",LatencyAverage:"Response latency (avg)",UpstreamLatencyP99:"Upstream latency (p99)",UpstreamLatencyP95:"Upstream latency (p95)",UpstreamLatencyP50:"Upstream latency (p50)",UpstreamLatencyAverage:"Upstream latency (avg)",KongLatencyP99:"Kong latency (p99)",KongLatencyP95:"Kong latency (p95)",KongLatencyP50:"Kong latency (p50)",KongLatencyAverage:"Kong latency (avg)",ResponseSizeP99:"Response size (p99)",ResponseSizeP95:"Response size (p95)",ResponseSizeP50:"Response size (p50)",RequestSizeP99:"Request size (p99)",RequestSizeP95:"Request size (p95)",RequestSizeP50:"Request size (p50)",SuccessfulRequests:"Successful requests",SUCCESS:"Successful requests",FailedRequests:"Failed requests",FAILURE:"Failed requests","5XX":"5xx","4XX":"4xx","3XX":"3xx","2XX":"2xx","1XX":"1xx",REQUEST_COUNT:"Request count",REQUEST_PER_MINUTE:"Requests per minute",RESPONSE_LATENCY_P99:"Response latency",RESPONSE_LATENCY_P95:"Response latency",RESPONSE_LATENCY_P50:"Response latency",RESPONSE_SIZE_P99:"Response size (p99)",RESPONSE_SIZE_P95:"Response size (p95)",RESPONSE_SIZE_P50:"Response size (p50)",REQUEST_SIZE_P99:"Request size (p99)",REQUEST_SIZE_P95:"Request size (p95)",REQUEST_SIZE_P50:"Request size (p50)",CONTROL_PLANE:"Control plane",____OTHER____:"Others",ai_request_count:"Request count",total_tokens:"Total token count",prompt_tokens:"Prompt token count",completion_tokens:"Completion token count",share_of_requests:"Share of requests",cost:"Costs",cost_per_request_average:"Request cost (avg per million)",llm_cache_embeddings_latency_average:"Embeddings latency (avg)",llm_cache_fetch_latency_average:"Fetch latency (avg)",llm_latency_average:"LLM latency (avg)",llm_latency_p50:"LLM latency (p50)",llm_latency_p95:"LLM latency (p95)",llm_latency_p99:"LLM latency (p99)",time_to_first_token_average:"Time to first token (avg)",time_to_first_token_p99:"Time to first token (p99)",time_to_first_token_p95:"Time to first token (p95)",time_to_first_token_p50:"Time to first token (p50)",time_per_token_average:"Time per token (avg)",time_per_token_p99:"Time per token (p99)",time_per_token_p95:"Time per token (p95)",time_per_token_p50:"Time per token (p50)","threshold-warning":"Warning threshold: {value}","threshold-error":"Error threshold: {value}","thatreshold-neutral":"Alert threshold: {value}",api:"API",vulnerability_count:"Vulnerability count",a2a_latency_average:"A2A latency (avg)",a2a_response_size_sum:"A2A response size (sum)",a2a_context_id:"A2A context ID",a2a_error:"A2A error",a2a_method:"A2A method",a2a_task_id:"A2A task ID",active_agents:"Active agents",mcp_error:"MCP error",mcp_method:"MCP method",mcp_latency_average:"MCP latency (avg)",mcp_latency_p99:"MCP latency (p99)",mcp_latency_p95:"MCP latency (p95)",mcp_latency_p50:"MCP latency (p50)",mcp_response_size_sum:"MCP response size (sum)",mcp_session_id:"MCP session ID",mcp_tool_name:"MCP tool name",mcp_response_body_size_sum:"MCP response size (sum)",control_plane_count:"Control plane count",service_count:"Gateway service count","record_bytes:sum":"Record size (sum)","record_count:sum":"Record count (sum)","request_count:sum":"Request count (sum)",route_count:"Route count",consumer_count:"Consumer count",plugin_count:"Plugin count",node_count:"Data plane node count",oidc_credential:"OIDC credential",principal:"Principal",principal_group:"Principal group",virtual_cluster_id:"Virtual cluster",backend_cluster_id:"Backend cluster",listener_id:"Listener",principal_name:"Principal name",principal_type:"Principal type",request_type:"Request type",topic_name:"Topic name",partition_index:"Partition index",api_key:"API key",data_plane_group:"Data plane group",managed_cache:"Managed cache",network:"Network",provider:"Provider",provider_region:"Provider region",cache_eviction_rate:"Cache eviction rate",cache_expiration_rate:"Cache expiration rate",cache_items_average:"Cache items (avg)",cache_memory_utilization_max:"Cache memory utilization (max)",cache_status:"Cache status",cache_hit_rate:"Cache hit rate",share_of_cost:"Share of cost"},chartUnits:{ms:"ms",bytes:"Byte{plural}",count:"request{plural}","count/minute":"rpm",requests:"request{plural}","token count":"token{plural}","tokens/minute":"tpm","%":"%","ops/minute":"ops/minute"},topNTable:{nameLabel:"Name",defaultEmptyStateTitle:"No data to display",defaultErrorStateTitle:"Something went wrong",errors:{meta:"Error: response must contain 'meta'",display:"Error: 'display' response incorrectly formatted (must have at least one key)",metricNames:"Error: 'metricNames' response incorrectly formatted (must have at least one entry)"}},jumpToExplore:"Explore",jumpToRequests:"View requests",unsupported_time_range_badge:"Limited timeframe",unsupported_time_range_warning:"The selected timeframe exceeds what this datasource supports, so this tile is limited to the maximum supported timeframe.",query_aged_out_warning:"This tile was configured with {savedGranularity} granularity, which is no longer available. It now shows {currentGranularity} data, the closest available granularity.",granularities:{daily:"1 day",fiveMinutely:"5 minutes",hourly:"1 hour",minutely:"1 minute",tenMinutely:"10 minutes",tenSecondly:"10 seconds",thirtyMinutely:"30 minutes",thirtySecondly:"30 seconds",twelveHourly:"12 hours",twoHourly:"2 hours",weekly:"1 week",unknown:"Unknown"}};function pt(){const n=lt.createI18n("en-us",Ra);return{i18n:n,i18nT:lt.i18nTComponent(n)}}const tt=170,Bt=6,it=20,ve="analytics-query-provider",$i="analytics-dashboard-coordinator",zt="{entity-id}",Fi="{cp-id}",Wi="{timeframe}",Vi=30*1e3,Yi=3e5,Xi=36e5;function Ca(){const n=s.inject(ve);return{evaluateFeatureFlag:(t,i)=>typeof n?.evaluateFeatureFlagFn!="function"?i:n.evaluateFeatureFlagFn(t,i)}}var Pt={exports:{}},ji;function Ea(){return ji||(ji=1,(function(n){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function r(d,c,u){this.fn=d,this.context=c,this.once=u||!1}function o(d,c,u,h,f){if(typeof u!="function")throw new TypeError("The listener must be a function");var g=new r(u,h||d,f),R=t?t+c:c;return d._events[R]?d._events[R].fn?d._events[R]=[d._events[R],g]:d._events[R].push(g):(d._events[R]=g,d._eventsCount++),d}function a(d,c){--d._eventsCount===0?d._events=new i:delete d._events[c]}function l(){this._events=new i,this._eventsCount=0}l.prototype.eventNames=function(){var c=[],u,h;if(this._eventsCount===0)return c;for(h in u=this._events)e.call(u,h)&&c.push(t?h.slice(1):h);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},l.prototype.listeners=function(c){var u=t?t+c:c,h=this._events[u];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,g=h.length,R=new Array(g);f<g;f++)R[f]=h[f].fn;return R},l.prototype.listenerCount=function(c){var u=t?t+c:c,h=this._events[u];return h?h.fn?1:h.length:0},l.prototype.emit=function(c,u,h,f,g,R){var E=t?t+c:c;if(!this._events[E])return!1;var C=this._events[E],v=arguments.length,k,I;if(C.fn){switch(C.once&&this.removeListener(c,C.fn,void 0,!0),v){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,u),!0;case 3:return C.fn.call(C.context,u,h),!0;case 4:return C.fn.call(C.context,u,h,f),!0;case 5:return C.fn.call(C.context,u,h,f,g),!0;case 6:return C.fn.call(C.context,u,h,f,g,R),!0}for(I=1,k=new Array(v-1);I<v;I++)k[I-1]=arguments[I];C.fn.apply(C.context,k)}else{var O=C.length,x;for(I=0;I<O;I++)switch(C[I].once&&this.removeListener(c,C[I].fn,void 0,!0),v){case 1:C[I].fn.call(C[I].context);break;case 2:C[I].fn.call(C[I].context,u);break;case 3:C[I].fn.call(C[I].context,u,h);break;case 4:C[I].fn.call(C[I].context,u,h,f);break;default:if(!k)for(x=1,k=new Array(v-1);x<v;x++)k[x-1]=arguments[x];C[I].fn.apply(C[I].context,k)}}return!0},l.prototype.on=function(c,u,h){return o(this,c,u,h,!1)},l.prototype.once=function(c,u,h){return o(this,c,u,h,!0)},l.prototype.removeListener=function(c,u,h,f){var g=t?t+c:c;if(!this._events[g])return this;if(!u)return a(this,g),this;var R=this._events[g];if(R.fn)R.fn===u&&(!f||R.once)&&(!h||R.context===h)&&a(this,g);else{for(var E=0,C=[],v=R.length;E<v;E++)(R[E].fn!==u||f&&!R[E].once||h&&R[E].context!==h)&&C.push(R[E]);C.length?this._events[g]=C.length===1?C[0]:C:a(this,g)}return this},l.prototype.removeAllListeners=function(c){var u;return c?(u=t?t+c:c,this._events[u]&&a(this,u)):(this._events=new i,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=t,l.EventEmitter=l,n.exports=l})(Pt)),Pt.exports}var Oa=Ea();const ba=ca(Oa);class qt extends Error{name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,qt)}}const Qi=n=>n.reason??new DOMException("This operation was aborted.","AbortError");function wa(n,e){const{milliseconds:t,fallback:i,message:r,customTimers:o={setTimeout,clearTimeout},signal:a}=e;let l,d;const u=new Promise((h,f)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(a?.aborted){f(Qi(a));return}if(a&&(d=()=>{f(Qi(a))},a.addEventListener("abort",d,{once:!0})),n.then(h,f),t===Number.POSITIVE_INFINITY)return;const g=new qt;l=o.setTimeout.call(void 0,()=>{if(i){try{h(i())}catch(R){f(R)}return}typeof n.cancel=="function"&&n.cancel(),r===!1?h():r instanceof Error?f(r):(g.message=r??`Promise timed out after ${t} milliseconds`,f(g))},t)}).finally(()=>{u.clear(),d&&a&&a.removeEventListener("abort",d)});return u.clear=()=>{o.clearTimeout.call(void 0,l),l=void 0},u}function Ta(n,e,t){let i=0,r=n.length;for(;r>0;){const o=Math.trunc(r/2);let a=i+o;t(n[a],e)<=0?(i=++a,r-=o+1):r=o}return i}const va=100;class Zi{#t=[];#e=0;enqueue(e,t){const{priority:i=0,id:r}=t??{},{size:o}=this,a={priority:i,id:r,run:e};if(o===0){this.#t.length=0,this.#e=0,this.#t.push(a);return}if(this.#t.at(-1).priority>=i){this.#t.push(a);return}this.#s();const l=Ta(this.#t,a,(d,c)=>c.priority-d.priority);this.#t.splice(l,0,a)}setPriority(e,t){const i=this.#t.findIndex((o,a)=>a>=this.#e&&o.id===e);if(i===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);const[r]=this.#t.splice(i,1);this.enqueue(r.run,{priority:t,id:e})}remove(e){const t=this.#t.findIndex((i,r)=>r<this.#e?!1:typeof e=="string"?i.id===e:i.run===e);t!==-1&&this.#t.splice(t,1)}dequeue(){if(this.#e===this.#t.length)return;const e=this.#t[this.#e];return this.#e++,this.#e===this.#t.length?(this.#t.length=0,this.#e=0):this.#e>va&&this.#e>this.#t.length/2&&this.#s(),e?.run}filter(e){const t=[];for(let i=this.#e;i<this.#t.length;i++){const r=this.#t[i];r.priority===e.priority&&t.push(r.run)}return t}get size(){return this.#t.length-this.#e}#s(){this.#e!==0&&(this.#t.splice(0,this.#e),this.#e=0)}}class Sa extends ba{#t;#e;#s=0;#f;#p=!1;#R=!1;#c;#C=0;#l;#u;#a;#o=[];#r=0;#i;#v;#n=0;#g;#d;#N=1n;#_=new Map;#E=new Set;timeout;constructor(e){if(super(),e={carryoverIntervalCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:Zi,strict:!1,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);if(e.strict&&e.interval===0)throw new TypeError("The `strict` option requires a non-zero `interval`");if(e.strict&&e.intervalCap===Number.POSITIVE_INFINITY)throw new TypeError("The `strict` option requires a finite `intervalCap`");if(this.#t=e.carryoverIntervalCount??e.carryoverConcurrencyCount??!1,this.#e=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#f=e.intervalCap,this.#c=e.interval,this.#a=e.strict,this.#i=new e.queueClass,this.#v=e.queueClass,this.concurrency=e.concurrency,e.timeout!==void 0&&!(Number.isFinite(e.timeout)&&e.timeout>0))throw new TypeError(`Expected \`timeout\` to be a positive finite number, got \`${e.timeout}\` (${typeof e.timeout})`);this.timeout=e.timeout,this.#d=e.autoStart===!1,this.#P()}#O(e){for(;this.#r<this.#o.length;){const i=this.#o[this.#r];if(i!==void 0&&e-i>=this.#c)this.#r++;else break}(this.#r>100&&this.#r>this.#o.length/2||this.#r===this.#o.length)&&(this.#o=this.#o.slice(this.#r),this.#r=0)}#A(e){this.#a?this.#o.push(e):this.#s++}#L(){this.#a?this.#o.length>this.#r&&this.#o.pop():this.#s>0&&this.#s--}#b(){return this.#o.length-this.#r}get#U(){return this.#e?!0:this.#a?this.#b()<this.#f:this.#s<this.#f}get#K(){return this.#n<this.#g}#M(){this.#n--,this.#n===0&&this.emit("pendingZero"),this.#y(),this.emit("next")}#B(){this.#u=void 0,this.#D(),this.#I()}#z(e){if(this.#a){if(this.#O(e),this.#b()>=this.#f){const i=this.#o[this.#r],r=this.#c-(e-i);return this.#S(r),!0}return!1}if(this.#l===void 0){const t=this.#C-e;if(t<0)this.#s=this.#t?this.#n:0;else return this.#S(t),!0}return!1}#S(e){this.#u===void 0&&(this.#u=setTimeout(()=>{this.#B()},e))}#w(){this.#l&&(clearInterval(this.#l),this.#l=void 0)}#x(){this.#u&&(clearTimeout(this.#u),this.#u=void 0)}#y(){if(this.#i.size===0){if(this.#w(),this.emit("empty"),this.#n===0){if(this.#x(),this.#a&&this.#r>0){const t=Date.now();this.#O(t)}this.emit("idle")}return!1}let e=!1;if(!this.#d){const t=Date.now(),i=!this.#z(t);if(this.#U&&this.#K){const r=this.#i.dequeue();this.#e||(this.#A(t),this.#m()),i&&this.#I(),this.emit("active"),r(),e=!0}}return e}#I(){this.#e||this.#l!==void 0||this.#a||(this.#l=setInterval(()=>{this.#D()},this.#c),this.#C=Date.now()+this.#c)}#D(){this.#a||(this.#l!==void 0&&(this.#s===0&&this.#n===0?this.#w():this.#C=Date.now()+this.#c),this.#s=this.#t?this.#n:0),this.#T(),this.#m()}#T(){for(;this.#y(););}get concurrency(){return this.#g}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#g=e,this.#T()}setPriority(e,t){if(typeof t!="number"||!Number.isFinite(t))throw new TypeError(`Expected \`priority\` to be a finite number, got \`${t}\` (${typeof t})`);this.#i.setPriority(e,t)}async add(e,t={}){if(t={timeout:this.timeout,...t,id:t.id??(this.#N++).toString()},t.timeout!==void 0&&!(Number.isFinite(t.timeout)&&t.timeout>0))throw new TypeError(`Expected \`timeout\` to be a positive finite number, got \`${t.timeout}\` (${typeof t.timeout})`);return new Promise((i,r)=>{const o=Symbol(`task-${t.id}`);let a=()=>{};const l=async()=>{a(),this.#n++,this.#_.set(o,{id:t.id,priority:t.priority??0,startTime:Date.now(),timeout:t.timeout});let c;try{try{t.signal?.throwIfAborted()}catch(f){throw this.#q(),this.#_.delete(o),f}let u=e({signal:t.signal});if(t.timeout!==void 0&&(u=wa(Promise.resolve(u),{milliseconds:t.timeout,message:`Task timed out after ${t.timeout}ms (queue has ${this.#n} running, ${this.#i.size} waiting)`})),t.signal){const{signal:f}=t;u=Promise.race([u,new Promise((g,R)=>{c=()=>{R(f.reason)},f.addEventListener("abort",c,{once:!0})})])}const h=await u;i(h),this.emit("completed",h)}catch(u){r(u),this.emit("error",u)}finally{c&&t.signal?.removeEventListener("abort",c),this.#_.delete(o),queueMicrotask(()=>{this.#M()})}};this.#i.enqueue(l,t);const d=()=>{if(this.#i instanceof Zi){this.#i.remove(l);return}this.#i.remove?.(t.id)};if(t.signal){const{signal:c}=t,u=()=>{a(),d(),r(c.reason),this.#y(),this.emit("next")};if(a=()=>{c.removeEventListener("abort",u),this.#E.delete(a)},c.aborted){u();return}c.addEventListener("abort",u,{once:!0}),this.#E.add(a)}this.emit("add"),this.#y()})}async addAll(e,t){return Promise.all(e.map(async i=>this.add(i,t)))}start(){return this.#d?(this.#d=!1,this.#T(),this):this}pause(){this.#d=!0}clear(){for(const e of this.#E)e();this.#i=new this.#v,this.#w(),this.#k(),this.emit("empty"),this.#n===0&&(this.#x(),this.emit("idle")),this.emit("next")}async onEmpty(){this.#i.size!==0&&await this.#h("empty")}async onSizeLessThan(e){this.#i.size<e||await this.#h(["next","active"],()=>this.#i.size<e)}async onIdle(){this.#n===0&&this.#i.size===0||await this.#h("idle")}async onPendingZero(){this.#n!==0&&await this.#h("pendingZero")}async onRateLimit(){this.isRateLimited||await this.#h("rateLimit")}async onRateLimitCleared(){this.isRateLimited&&await this.#h("rateLimitCleared")}onError(){return new Promise((e,t)=>{const i=r=>{this.off("error",i),t(r)};this.on("error",i)})}async#h(e,t){const i=Array.isArray(e)?e:[e];return new Promise(r=>{const o=()=>{if(!(t&&!t())){for(const a of i)this.off(a,o);r()}};for(const a of i)this.on(a,o)})}get size(){return this.#i.size}sizeBy(e){return this.#i.filter(e).length}get pending(){return this.#n}get isPaused(){return this.#d}#P(){this.#e||(this.on("add",()=>{this.#i.size>0&&this.#m()}),this.on("next",()=>{this.#m()}))}#m(){this.#e||this.#R||(this.#R=!0,queueMicrotask(()=>{this.#R=!1,this.#k()}))}#q(){this.#e||(this.#L(),this.#m())}#k(){const e=this.#p;if(this.#e||this.#i.size===0){e&&(this.#p=!1,this.emit("rateLimitCleared"));return}let t;if(this.#a){const r=Date.now();this.#O(r),t=this.#b()}else t=this.#s;const i=t>=this.#f;i!==e&&(this.#p=i,this.emit(i?"rateLimit":"rateLimitCleared"))}get isRateLimited(){return this.#p}get isSaturated(){return this.#n===this.#g&&this.#i.size>0||this.isRateLimited&&this.#i.size>0}get runningTasks(){return[...this.#_.values()].map(e=>({...e,timeoutRemaining:e.timeout?Math.max(0,e.startTime+e.timeout-Date.now()):void 0}))}}const xa=()=>{const n=we.useAnalyticsConfigStore(),e=s.inject(ve);if(!e)return;if(e.queryFnOverride){console.warn("Detected incorrect use of useRequestQueue. This composable should not be used in nested components. Please discuss with team-data or report an issue if you feel you have a use case.");return}const t=new Sa({carryoverConcurrencyCount:!0,concurrency:n.maxParallelRequests,interval:n.requestInterval,intervalCap:n.requestIntervalCap}),i={...e,queryFnOverride:!0,queryFn:(r,o)=>t.add(()=>e.queryFn(r,o))};s.provide(ve,i)};function Ia(n){const e=`[${n.name}] ${n.message}`,t=[];return n.fix&&t.push(`fix: ${n.fix}`),n.sources?.length&&t.push(`sources: ${n.sources.join(", ")}`),n.docs&&t.push(`see: ${n.docs}`),t.length===0?e:[e,...t.map((i,r)=>`${r<t.length-1?"├▶":"╰▶"} ${i}`)].join(`
12
+ `)}function Ji(n,...e){return typeof n=="function"?n(...e):n}function Da({method:n="warn",formatter:e=Ia}={}){return(t,{method:i=n}={})=>{console[i](e(t))}}const ka=Error.captureStackTrace;var Na=class qn extends Error{name;code;docs;fix;sources;get why(){return this.message}constructor(e,t=qn){super(e.why,{cause:e.cause}),this.code=this.name=e.code,this.fix=e.fix,this.docs=e.docs,this.sources=e.sources,ka?.(this,t)}toJSON(){return{name:this.name,why:this.why,fix:this.fix,docs:this.docs,sources:this.sources,cause:this.cause,stack:this.stack}}};function Aa(n,e){return typeof n=="string"?`${n}/${e.toLowerCase()}`:n?.(e)}function La(n){const e=n.reporters??[],t={},{docsBase:i}=n;for(const r of Object.keys(n.codes)){const o=n.codes[r],a=o.docs===!1?void 0:o.docs||Aa(i,r),l=(d={},c={})=>{const u=new Na({code:r,why:Ji(o.why,d),fix:Ji(o.fix,d),docs:a,cause:d.cause,sources:d.sources},l);for(const h of e)h(u,c);return u};t[r]=l}return t}const Ua=typeof window<"u",Ka=La({reporters:[Da()],codes:{PINIA_R1001:{why:'Directly pass all stores to "mapStores()" without putting them in an array. This will fail in production.',fix:"Replace mapStores([useAuthStore, useCartStore]) with mapStores(useAuthStore, useCartStore).",docs:"https://pinia.vuejs.org/cookbook/options-api.html#Giving-access-to-the-whole-store"},PINIA_R1002:{why:n=>`A getter cannot have the same name as another state property. Found "${n.name}" in store "${n.id}".`,fix:"Rename either the getter or the state property.",docs:"https://pinia.vuejs.org/core-concepts/getters.html#Accessing-other-getters"},PINIA_R1003:{why:n=>`The "state" must be a plain object. Found in store "${n.id}".`,fix:"Return a plain object, e.g. avoid state: () => new MyClass().",docs:"https://pinia.vuejs.org/core-concepts/state.html#State"},PINIA_R1004:{why:"Pinia instance not found in context. This falls back to the global activePinia, which exposes you to cross-request pollution on the server.",fix:'"useStore()" is a composable and follows the same rules: call it at the top of setup() (or another composable), or pass the pinia instance explicitly when used outside of a component.',docs:"https://pinia.vuejs.org/ssr/#Using-the-store-outside-of-setup-"},PINIA_R1005:{why:n=>`The store id changed from "${n.from}" to "${n.to}", forcing a reload.`,docs:"https://pinia.vuejs.org/cookbook/hot-module-replacement.html#HMR-Hot-Module-Replacement-"},PINIA_R1006:{why:n=>`Property "${n.key}" of store "${n.id}" is not reactive (not a ref, reactive object, or shallowRef), so storeToRefs() ignores it.`,fix:"If it should be reactive state, wrap it with ref(), reactive(), or shallowRef(). If it is an intentional non-reactive property, wrap it with markRaw() so storeToRefs() skips it explicitly.",docs:"https://pinia.vuejs.org/core-concepts/plugins.html#Adding-new-external-properties"},PINIA_R1007:{why:n=>`The same callback was passed to "$subscribe()" of store "${n.id}" more than once. Subscriptions are deduplicated, so the duplicate is ignored.`,fix:"Subscribe each callback only once. If you need to resubscribe, call the returned function to remove the previous subscription first, or create a new function.",docs:"https://pinia.vuejs.org/core-concepts/state.html#Subscribing-to-the-state"}}});let en;process.env.NODE_ENV;const tn=process.env.NODE_ENV!=="production"?Symbol("pinia"):Symbol();process.env.NODE_ENV;function Ye(n){const e=s.toRaw(n),t={};for(const i in e){const r=e[i];r?.effect?t[i]=s.computed({get:()=>n[i],set(o){n[i]=o}}):(s.isRef(r)||s.isReactive(r))&&(t[i]=s.toRef(n,i))}return t}const De=n=>n?.chart.type==="table",Ht=n=>n?.query?.datasource==="requests",Gt=n=>!!n&&!De(n)&&!Ht(n),Ma=(n,e)=>{const t=n.header_description??("description"in n.chart?n.chart.description:void 0);if(t)return t.replaceAll(Wi,e)||void 0},Ba=["basic","api_usage","llm_usage","agentic_usage","platform","platform_usage","managed_cache_usage",void 0],za=n=>Ba.includes(n);function Pa({queryBridge:n,context:e,definition:t,chartData:i}){const r=s.ref(""),o=s.ref(""),a=s.ref(void 0),l=s.ref(void 0),d=we.useAnalyticsConfigStore(),c=we.useDatasourceConfigStore(),{stripUnknownFilters:u,loading:h}=Ye(c),f=s.computed(()=>De(t.value));s.onMounted(async()=>{r.value=await n?.exploreBaseUrl?.()??"",o.value=await n?.requestsBaseUrl?.()??""});const g=s.computed(()=>d.analytics&&d.percentiles),R=s.computed(()=>{const _=t.value.chart.type;return["golden_signals","gauge"].includes(_)?!1:_==="top_n"?!!e.value.editable||!!e.value.showTileActions:!0}),E=s.computed(()=>o.value&&t.value.query&&!f.value&&t.value.query.datasource!=="llm_usage"&&t.value.query.datasource!=="managed_cache_usage"&&!ie.isPlatformDatasource(t.value.query.datasource)&&g.value&&!h.value),C=s.computed(()=>r.value&&t.value.query&&za(t.value.query.datasource)&&g.value&&!h.value),v=s.computed(()=>i.value?ie.msToGranularity(i.value.meta.granularity_ms):void 0),k=s.computed(()=>{const _=t.value,T=[...e.value.filters,..._.query.filters??[]],S="metrics"in _.query?_.query.metrics:void 0,q=_.query?.datasource??"api_usage";return u.value({datasource:q,filters:T,queryFields:S})}),I=s.computed(()=>{if(!C.value||!R.value)return"";const _=t.value;if(De(_))return p({..._.query,filters:k.value});const T=_.query.time_range||e.value.timeSpec,S=m(T,k.value);return p(S)}),O=s.computed(()=>{if(!E.value||!R.value)return"";const _=k.value,T=t.value;if(De(T))return"";const S=D(T.query.time_range||e.value.timeSpec,_);return x(S)}),x=_=>E.value?`${o.value}?q=${JSON.stringify(_)}`:"",D=(_,T)=>{const S=i.value?.meta?.start?new Date(i.value.meta.start):void 0,q=i.value?.meta?.end?new Date(i.value.meta.end):void 0;return{filter:T,timeframe:{timePeriodsKey:_.type==="relative"?_.time_range:"custom",start:_.type==="absolute"?S:void 0,end:_.type==="absolute"?q:void 0}}},U=(_,T)=>({filter:T,timeframe:{timePeriodsKey:_.type==="relative"?_.time_range:"custom",start:_.type==="absolute"?_.start:void 0,end:_.type==="absolute"?_.end:void 0}}),m=(_,T)=>{const S=t.value;if(!Gt(S))throw new Error("Cannot build a chart explore query for table or api-requests definitions");const q=[...S.query.dimensions??[]],P=[...S.query.metrics??[]];return{filters:T,metrics:P,dimensions:q,time_range:_,granularity:S.query.granularity||v.value||void 0}},p=_=>{if(!C.value)return"";const T=t.value.query.datasource&&t.value.query.datasource!=="basic"?t.value.query.datasource:"api_usage";return`${r.value}?q=${JSON.stringify(_)}&d=${T}&c=${t.value.chart.type}`};return s.watch([E,C],([_,T])=>{_&&(a.value={href:""}),T&&(l.value={href:""})}),{exploreLinkKebabMenu:I,requestsLinkKebabMenu:O,canShowKebabMenu:R,canGenerateRequestsLink:E,canGenerateExploreLink:C,requestsLinkZoomActions:a,exploreLinkZoomActions:l,buildExploreQuery:m,buildRequestsQueryZoomActions:U,buildExploreLink:p,buildRequestLink:x}}const $t=n=>n.type==="relative"?ie.TimePeriods.get(ie.TIMEFRAME_LOOKUP[n.time_range])?.timeframeLengthMs():new Date(n.end).getTime()-new Date(n.start).getTime(),qa=n=>n.reduce((e,t)=>{const i=ie.TimePeriods.get(ie.TIMEFRAME_LOOKUP[t])?.maximumTimeframeLength();return i===void 0||e&&i<=e.durationSeconds?e:{durationSeconds:i,key:t}},void 0),Ft=(n,e)=>{if(!n||!e?.length)return;const t=$t(n),i=qa(e);return t!==void 0&&i&&t>i.durationSeconds*1e3?i:void 0},Wt=(n,e)=>{const t=Ft(n,e);return!t||!n?n:n.type==="relative"?{...n,time_range:t.key}:{...n,start:new Date(new Date(n.end).getTime()-t.durationSeconds*1e3)}};function Ha(){const n=s.inject(ve),e=we.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Ye(e);let r=null;return s.onUnmounted(()=>{r?.abort()}),{issueQuery:async(a,l,d)=>{if(!n)throw new Error("Query bridge is not defined");r?.abort();const c=new AbortController;r=c,await e.isReady();const{datasource:u,limit:h,...f}=a,g=u||"basic",R=ie.isPlatformDatasource(g),E=i.value({datasource:g,filters:[...a.filters??[],...l.filters],queryFields:a.metrics}).filter(({operator:k})=>!R||!ie.requestFilterTypeEmptyV2.some(I=>I===k));let C=a.time_range;!C&&l.timeSpec?C={...l.timeSpec,tz:l.tz}:C&&!C.tz&&(C={...C,tz:l.tz}),C=Wt(C,t.value[g]?.timeRangeOptions);const v={datasource:g,query:{...f,time_range:C,filters:E,limit:d??h}};return n.queryFn(v,c)}}}const Ga="24H",$a={status_code:"response_http_status",upstream_status_code:"upstream_status"},Fa={cost:"usd",latencies_response_ms:"ms",latencies_upstream_ms:"ms",latencies_kong_gateway_ms:"ms",latencies_kong_internal_ms:"ms",request_body_size:"bytes",response_body_size:"bytes",response_header_content_length:"bytes",ai_count:"count"},Wa=n=>ie.relativeTimeRangeValuesRequestV2.includes(n),Va=n=>{const e=n?.tz?{tz:n.tz}:{};if(n?.type==="absolute")return{type:"absolute",start:n.start,end:n.end,...e};const t=n?.time_range.toUpperCase()??"";return{type:"relative",time_range:Wa(t)?t:Ga,...e}},nn=n=>$a[n]??n,Ya=n=>({metric:nn(n.metric),dimension:n.dimension?nn(n.dimension):void 0,unroll:n.unroll,metricUnit:Fa[n.metric],extraFields:n.extra_fields}),Vt="requests";function Xa(){const n=s.inject(ve),e=we.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Ye(e);let r=null;s.onUnmounted(()=>{r?.abort()});const o=(l,d)=>{const c=l.time_range??d.timeSpec;return Wt(c&&{...c,tz:c.tz??d.tz},t.value[Vt]?.timeRangeOptions)};return{issueRequestsQuery:async(l,d)=>{const c=n?.requestsQueryFn;if(!c)throw new Error("Query bridge cannot fetch request records");r?.abort();const u=new AbortController;r=u,await e.isReady();const h=i.value({datasource:Vt,filters:[...l.filters??[],...d.filters]});return ie.fetchAllRequests(c,{datasource:Vt,query:{filters:h,time_range:Va(o(l,d))}},u,{maxRecords:l.max_records})}}}function ja({context:n,globalFilters:e=s.ref([]),isFullscreen:t=s.ref(!1),preview:i=s.ref(!1)}){const r=we.useAnalyticsConfigStore(),o=we.useDatasourceConfigStore(),{loading:a}=Ye(r),{loading:l}=Ye(o),d=s.computed(()=>n.value.timeSpec?n.value.timeSpec:{type:"relative",time_range:r.defaultQueryTimeForOrg}),c=s.computed(()=>{const{tz:O}=n.value;return O||new Intl.DateTimeFormat().resolvedOptions().timeZone}),u=s.computed(()=>{const{editable:O}=n.value;return O===void 0||i.value?!1:O}),h=s.computed(()=>{const{showTileActions:O}=n.value;return i.value?!1:O===void 0?!0:O}),f=s.computed(()=>[...n.value.filters??[],...e.value]),g=s.computed(()=>{let{refreshInterval:O}=n.value;if(O===void 0&&(O=Vi),t.value){let x=!1;if(d.value.type==="relative")x=["15m","1h","6h","12h","24h"].includes(d.value.time_range);else{const m=d.value.start.getTime(),p=d.value.end.getTime();x=Math.abs(p-m)<=864e5}const D=new Date().getTime();d.value.type==="absolute"&&d.value.end.getTime()<D||d.value.type==="relative"&&["previous_week","previous_month"].includes(d.value.time_range)?O=0:x?O=Yi:O=Xi}return O}),R=s.computed(()=>({...n.value,filters:f.value,timeSpec:d.value,tz:c.value,refreshInterval:g.value,editable:u.value,showTileActions:h.value})),E=s.computed(()=>!a.value&&!l.value),C=s.computed(()=>!i.value&&!!s.getCurrentInstance()?.vnode?.props?.onTileTimeRangeZoom),v=s.computed(()=>!i.value),k=s.computed(()=>!i.value),I=s.computed(()=>({enabled:C.value,showExploreAction:v.value,showRequestsAction:k.value,showZoomInAction:C.value}));return{editable:u,enrichedContext:R,filters:f,queryReady:E,refreshInterval:g,showTileActions:h,timeSpec:d,tz:c,zoomConfiguration:I}}const Qa=6,rn=6,sn=4;function Za(n,e){const{pageWidth:t,pageHeight:i,margin:r}=e,o=r+1,a=r+e.headerHeight-3,l=i-r-rn+3,d=l+4;e.title&&(n.setFont("helvetica","bold"),n.setFontSize(11),n.setTextColor(60),n.text(e.title,r,o)),n.setFont("helvetica","normal"),n.setFontSize(8),n.setTextColor(120),n.text(e.generatedAt,t-r,o,{align:"right"}),e.subtitle&&n.text(e.subtitle,r,o+sn),n.setDrawColor(220),n.line(r,a,t-r,a),n.line(r,l,t-r,l),n.setFont("helvetica","bold"),n.setTextColor(60),n.text(e.branding,r,d);const c=n.getTextWidth(e.branding);n.setFont("helvetica","normal");const u=` ${e.dashboardNote}`;e.dashboardUrl?(n.setTextColor(0,68,204),n.textWithLink(u,r+c,d,{url:e.dashboardUrl})):(n.setTextColor(120),n.text(u,r+c,d)),n.setTextColor(120),n.text(e.pageLabel,t-r,d,{align:"right"})}function Ja(n){const e=n.querySelectorAll(".kong-ui-public-grid-layout, .grid-stack"),t=[];if(e.forEach(o=>{t.push(...o.querySelectorAll(":scope > .grid-cell:not(.empty-cell), :scope > .grid-stack-item"))}),!t.length)return[];const i=n.getBoundingClientRect().top,r=new Map;return t.forEach(o=>{const a=o.getBoundingClientRect(),l=Math.round(a.top-i),d=Math.round(a.bottom-i),c=r.get(l);r.set(l,c!==void 0?Math.max(c,d):d)}),[...r.entries()].map(([o,a])=>({top:o,bottom:a})).sort((o,a)=>o.top-a.top)}function el(n,e,t,i){if(!n.length){const a=[];let l=0;for(;l<e;){const d=Math.min(t,e-l);a.push({startY:l,height:d}),l+=d}return a}const r=[];let o=0;for(const a of n){const l=a.top*i,d=a.bottom*i;d-o>t&&(l>o?(r.push({startY:o,height:l-o}),o=l):(r.push({startY:o,height:d-o}),o=d))}return o<e&&r.push({startY:o,height:e-o}),r}function tl(n){const{i18n:e}=pt(),t=s.ref({status:"idle"});async function i(r={}){const{filename:o="dashboard-export",title:a,subtitle:l,dashboardUrl:d,orientation:c="landscape",pageSize:u="letter",margin:h=4,scale:f=2,exclude:g=[".tile-actions",".tooltip",".popover",".dropdown-popover"],output:R="download",onBeforeCapture:E,onAfterCapture:C}=r,v=n.value;if(!v){t.value={status:"error",error:new Error("Dashboard layout container not found.")};return}try{t.value={status:"preparing"},await E?.();const[{snapdom:k},{jsPDF:I}]=await Promise.all([import("@zumer/snapdom"),import("jspdf")]);t.value={status:"capturing"};const O={name:"kong-webgl-snapshot",beforeClone:()=>ie.prepareForCapture(),afterClone:()=>ie.restoreAfterCapture()},x=await k.toCanvas(v,{scale:f,exclude:g,excludeMode:"remove",embedFonts:!0,plugins:[O]}),D=Ja(v),U=v.getBoundingClientRect().width,m=U?x.width/U:f;t.value={status:"generating"};const p=new Date,_=new I({orientation:c,unit:"mm",format:u}),T=_.internal.pageSize.getWidth(),S=_.internal.pageSize.getHeight(),q=Qa+(l?sn:0),P=T-h*2,W=S-h*2-q-rn,j=x.width/P,F=W*j,b=el(D,x.height,F,m),w={title:a,subtitle:l,dashboardUrl:d,generatedAt:e.t("pdfExport.generated",{timestamp:p.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}),branding:e.t("pdfExport.branding"),dashboardNote:e.t("pdfExport.dashboardNote"),pageWidth:T,pageHeight:S,headerHeight:q,margin:h};for(let L=0;L<b.length;L++){L>0&&_.addPage();const{startY:N,height:z}=b[L],A=document.createElement("canvas");A.width=x.width,A.height=z,A.getContext("2d").drawImage(x,0,N,x.width,z,0,0,x.width,z),_.addImage(A.toDataURL("image/png"),"PNG",h,h+q,P,z/j),Za(_,{...w,pageLabel:e.t("pdfExport.pageOf",{page:String(L+1),total:String(b.length)})})}if(R==="blob"){const L=_.output("blob");return t.value={status:"complete",pageCount:b.length},L}_.save(o),t.value={status:"complete",pageCount:b.length}}catch(k){t.value={status:"error",error:k}}finally{ie.restoreAfterCapture(),await C?.()}}return{exportPdf:i,exportState:s.readonly(t)}}const il=n=>n.toLowerCase().endsWith("count")?"":n;function nl(){const{i18n:n}=pt(),{formatUnit:e}=ie.unitFormatter({i18n:n}),t=le.useFieldLabel();return i=>{const r=i.meta?.metric_names?.[0]??"",o=i.meta?.metric_units?.[r]??"";return{seriesName:t(r),valueFormatter:a=>e(a,o,{translateUnit:il})}}}const on=(n,e,t,{prefix:i="chartLabels",fallback:r=t}={})=>{const o=`${i}.${t}`;return e.get(t)||(n.te(o)?n.t(o):r)};function rl(){const{i18n:n}=pt(),e=we.useDatasourceConfigStore();return(t,i)=>on(n,e.fieldTranslationMap,t,i)}const le={useContextLinks:Pa,useDashboardContext:ja,useEvaluateFeatureFlag:Ca,useExportPdf:tl,useFieldLabel:rl,useI18n:pt,useIssueQuery:Ha,useIssueRequestsQuery:Xa,useMetricFormatter:nl,useRequestQueue:xa},sl={class:"kong-ui-public-csv-export-modal"},ol={key:0,class:"selected-range"},al={key:4,class:"text-muted",tag:"span"},an=3,ln=s.defineComponent({__name:"CsvExportModal",props:{exportState:{},filename:{},modalDescription:{default:void 0}},emits:["closeModal"],setup(n,{emit:e}){const{i18n:t}=le.useI18n(),i=le.useFieldLabel(),r=n,o=e,a=`${r.filename.replace(/\s+/g,"-").toLowerCase()}-${new Date().toISOString().slice(0,10)}.csv`,l=s.ref(1),d=s.computed(()=>g.value.rows.length),c=s.computed(()=>r.exportState.status==="success"&&!!r.exportState.chartData?.data?.length),u=s.computed(()=>{if(r.exportState.status!=="success"||!r.exportState.chartData?.meta)return"";const{start:E,end:C}=r.exportState.chartData.meta;return!E||!C?"":new Date(E).getTime()===new Date(C).getTime()?t.t("csvExport.exportAsOf",{time:ie.formatTimestamp(new Date(E),{includeTZ:!0})}):`${t.t("csvExport.exportTimeRange")}: ${ie.formatTimestamp(new Date(E))} - ${ie.formatTimestamp(new Date(C),{includeTZ:!0})}`}),h=s.computed(()=>r.exportState.status!=="success"?"":t.t("csvExport.previewRows",{rowsMax:Math.min(an,d.value),rowsTotal:d.value,plural:d.value===1?"":"s"})),f=()=>{o("closeModal")},g=s.computed(()=>{if(r.exportState.status!=="success"||!c.value||!r.exportState.chartData?.meta.metric_names)return{headers:[],rows:[],csvHeaders:{}};const E=r.exportState.chartData,C=E.data.some(D=>D.timestamp!==E.data[0].timestamp),v=E.data.map(D=>{const U=new Date(D.timestamp);return{...Object.keys(D.event).reduce((p,_)=>{if(_ in E.meta.display){const T=D.event[_],S=E.meta.display[_];p[_]=T&&S?.[T]?.name||D.event[_]}else p[_]=D.event[_];return p},{}),...C?{timestamp:Kt(U,"yyyy-MM-dd HH:mm:ss"),tzOffset:Kt(U,"XXX")}:{}}});let k=[];C&&(k=[{label:t.t("csvExport.Timestamp"),key:"timestamp"},{label:t.t("csvExport.UtcOffset"),key:"tzOffset"}]);const I="display"in r.exportState.chartData.meta&&r.exportState.chartData.meta.display?r.exportState.chartData.meta.display:{},O=[...k,...Object.keys(I).map(D=>({label:i(D),key:D})),...r.exportState.chartData.meta.metric_names.map(D=>({label:i(D),key:D}))],x=O.reduce((D,U)=>(D[U.key]=U.label,D),{});return{headers:O,csvHeaders:x,rows:v}}),R=async()=>{if(r.exportState.status!=="success")return{total:0,data:[]};const{rows:E}=g.value;return{total:Number(E.length)||0,data:E.slice(0,an)}};return s.watch(g,()=>{l.value++}),(E,C)=>{const v=s.resolveComponent("KSkeleton"),k=s.resolveComponent("KEmptyState"),I=s.resolveComponent("KTableData"),O=s.resolveComponent("KTooltip"),x=s.resolveComponent("KButton"),D=s.resolveComponent("KModal");return s.openBlock(),s.createElementBlock("div",sl,[s.createVNode(D,{class:"vitals-report","data-testid":"csv-export-modal","show-dismiss-icon":"",title:s.unref(t).t("csvExport.exportPreview"),visible:"",onCancel:f,onKeyup:s.withKeys(f,["esc"])},{default:s.withCtx(()=>[s.createElementVNode("div",null,[n.exportState.status==="success"&&c.value?(s.openBlock(),s.createElementBlock("div",ol,[s.createElementVNode("p",null,s.toDisplayString(n.modalDescription?n.modalDescription:s.unref(t).t("csvExport.exportDescription")),1),s.createElementVNode("p",null,s.toDisplayString(u.value),1)])):s.createCommentVNode("",!0),n.exportState.status==="loading"?(s.openBlock(),s.createBlock(v,{key:1,class:"chart-skeleton",type:"table"})):n.exportState.status==="success"?(s.openBlock(),s.createBlock(I,{key:2,class:"vitals-table",fetcher:R,"fetcher-cache-key":String(l.value),headers:g.value.headers,"hide-pagination":"","row-hover":!1,sortable:!1},{"empty-state":s.withCtx(()=>[s.createVNode(k,{"action-button-visible":!1},{title:s.withCtx(()=>[s.createElementVNode("h5",null,s.toDisplayString(s.unref(t).t("csvExport.noDataRange")),1)]),default:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(s.unref(t).t("csvExport.noDataRetry")),1)]),_:1})]),_:1},8,["fetcher-cache-key","headers"])):n.exportState.status==="error"?(s.openBlock(),s.createBlock(k,{key:3,"action-button-visible":!1},{title:s.withCtx(()=>[s.createElementVNode("h5",null,s.toDisplayString(s.unref(t).t("csvExport.dataError")),1)]),_:1})):s.createCommentVNode("",!0),n.exportState.status==="success"&&c.value?(s.openBlock(),s.createElementBlock("div",al,[s.createTextVNode(s.toDisplayString(h.value)+" ",1),s.createVNode(O,{class:"preview-tooltip",placement:"right",text:s.unref(t).t("csvExport.maximumRecordAmount",{value:s.unref(ie.EXPORT_RECORD_LIMIT)})},{default:s.withCtx(()=>[s.createVNode(s.unref(se.InfoIcon),{color:`var(--kui-color-text-neutral, ${s.unref(Mt)})`,size:`var(--kui-icon-size-30, ${s.unref(aa)})`},null,8,["color","size"])]),_:1},8,["text"])])):s.createCommentVNode("",!0)])]),"footer-actions":s.withCtx(()=>[s.createVNode(x,{appearance:"tertiary",class:"cancel-btn",onClick:f},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(t).t("csvExport.cancelButton")),1)]),_:1}),s.createVNode(ya,{class:"vitals-report-export-button",filename:a,headers:g.value.csvHeaders,rows:g.value.rows},{default:s.withCtx(()=>[s.createVNode(x,{appearance:"primary","data-testid":"csv-download-button",disabled:n.exportState.status!=="success"||!c.value},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(t).t("csvExport.downloadButton")),1)]),_:1},8,["disabled"])]),_:1},8,["headers","rows"])]),_:1},8,["title"])])}}});var cn=(n=>(n.VALIDATING="VALIDATING",n.VALIDATING_HAS_DATA="VALIDATING_HAS_DATA",n.PENDING="PENDING",n.SUCCESS="SUCCESS",n.SUCCESS_HAS_DATA="SUCCESS_HAS_DATA",n.ERROR="ERROR",n.STALE_IF_ERROR="STALE_IF_ERROR",n))(cn||{});const ll=n=>n?!!(Object.keys(n)?.length||n.data?.length||n.data?.data?.length||!n.data?.data&&typeof n.data=="object"&&Object.keys(n?.data).length):!1;function un(n=s.ref({}),e,t,i=ll){const r=s.ref("PENDING");return s.watchEffect(()=>{const o=i(n.value);if(n.value&&o&&t.value){r.value="VALIDATING_HAS_DATA";return}if(n.value&&t.value){r.value="VALIDATING";return}if(n.value&&e.value){r.value="STALE_IF_ERROR";return}if(n.value===void 0&&!e.value){r.value="PENDING";return}if(n.value&&!e.value&&o){r.value="SUCCESS_HAS_DATA";return}if(n.value&&!e.value){r.value="SUCCESS";return}n.value===void 0&&e&&(r.value="ERROR")}),{state:r,swrvState:cn}}const Be=s.defineComponent({__name:"QueryDataProvider",props:{context:{},limitOverride:{},query:{},queryReady:{type:Boolean},refreshCounter:{}},emits:["chart-data","query-complete"],setup(n,{emit:e}){const t=n,i=e,{i18n:r}=le.useI18n(),{issueQuery:o}=le.useIssueQuery(),a=s.inject(ve),l=()=>t.queryReady&&a?JSON.stringify([t.query,t.context,t.refreshCounter]):null,{data:d,error:c,isValidating:u}=oi(l,async O=>{try{const x=await o(t.query,t.context,t.limitOverride);return l()!==O?void 0:(R.value=null,{key:O,result:x})}catch(x){if(l()!==O)return;throw R.value=Ce.handleQueryError(x),x}finally{l()===O&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),h=s.computed(()=>d.value?.result),{state:f,swrvState:g}=un(d,c,u),R=s.ref(null),E=s.computed(()=>f.value===g.ERROR||!!R.value),C=s.computed(()=>!t.queryReady||f.value===g.PENDING),v=s.ref(),k=s.computed(()=>h.value??(t.queryReady&&f.value===g.PENDING?v.value:void 0)),I=s.computed(()=>!!k.value&&d.value?.key!==l());return s.watch([()=>h.value,()=>f.value],([O,x])=>{O&&(x==="SUCCESS_HAS_DATA"||x==="SUCCESS")&&O!==v.value&&(v.value=O,i("chart-data",O))}),(O,x)=>{const D=s.resolveComponent("KSkeleton"),U=s.resolveComponent("KEmptyState");return(C.value||!h.value&&!E.value)&&!k.value?(s.openBlock(),s.createBlock(D,{key:0,class:"chart-skeleton",type:"table"})):E.value&&!C.value?(s.openBlock(),s.createBlock(U,{key:1,"action-button-visible":!1,"data-testid":"chart-empty-state"},s.createSlots({icon:s.withCtx(()=>[R.value?.type==="forbidden"?(s.openBlock(),s.createBlock(s.unref(se.VisibilityOffIcon),{key:0})):(s.openBlock(),s.createBlock(s.unref(se.WarningOutlineIcon),{key:1}))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(R.value?.message||s.unref(r).t("renderer.unexpectedError")),1)]),_:2},[R.value?.details?{name:"default",fn:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(R.value.details),1)]),key:"0"}:void 0]),1024)):k.value?(s.openBlock(),s.createBlock(s.unref(Ce.LoadingOverlay),{key:2,loading:I.value},{default:s.withCtx(()=>[s.renderSlot(O.$slots,"default",{data:k.value})]),_:3},8,["loading"])):s.createCommentVNode("",!0)}}}),cl=s.defineComponent({__name:"SimpleChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},fitToContent:{type:Boolean}},setup(n){const e=n,t=s.computed(()=>e.chartOptions.type==="single_value"),i=s.computed(()=>e.chartOptions.type==="single_value"?{...e.chartOptions,alignX:e.chartOptions.align_x??"left",showTrend:e.query.granularity==="trend",compact:!!e.fitToContent,hideMetricName:!e.chartOptions.chart_title}:e.chartOptions);return(r,o)=>(s.openBlock(),s.createBlock(Be,{context:n.context,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter},{default:s.withCtx(({data:a})=>[s.createElementVNode("div",{class:s.normalizeClass(["analytics-chart",{"single-value":t.value,compact:t.value&&n.fitToContent}]),style:s.normalizeStyle(t.value?void 0:{height:`${n.height}px`})},[s.createVNode(s.unref(Ce.SimpleChart),{"chart-data":a,"chart-options":i.value,"synthetics-data-key":t.value?void 0:n.chartOptions.synthetics_data_key},null,8,["chart-data","chart-options","synthetics-data-key"])],6)]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),Se=(n,e)=>{const t=n.__vccOpts||n;for(const[i,r]of e)t[i]=r;return t},dn=Se(cl,[["__scopeId","data-v-df5d87ad"]]),ul={class:"analytics-chart"},Yt=Se(s.defineComponent({__name:"BaseAnalyticsChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},extraProps:{}},emits:["edit-tile","chart-data","zoom-time-range","view-requests","select-chart-range"],setup(n,{emit:e}){const t=n,i=e,{i18n:r}=le.useI18n(),o=s.computed(()=>({type:t.chartOptions.type,stacked:t.chartOptions.stacked??!1,chartDatasetColors:t.chartOptions.chart_dataset_colors,threshold:t.chartOptions.threshold,metricAxisMap:t.chartOptions.metric_axis_map,yAxes:t.chartOptions.y_axes&&{left:a(t.chartOptions.y_axes.left),right:a(t.chartOptions.y_axes.right)},hideTruncationWarning:t.query.limit!==void 0&&t.query.limit>0})),a=c=>c&&{title:c.title,showGrid:c.show_grid},l=()=>{i("edit-tile")},d=c=>{i("chart-data",c)};return(c,u)=>{const h=s.resolveComponent("KDropdownItem");return s.openBlock(),s.createBlock(Be,{context:n.context,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onChartData:d},{default:s.withCtx(({data:f})=>[s.createElementVNode("div",ul,[s.createVNode(s.unref(Ce.AnalyticsChart),s.mergeProps({"active-metric":n.activeMetric,"chart-data":f,"chart-options":o.value,"explore-link":n.exploreLink,"legend-position":"bottom","requests-link":n.requestsLink,"synthetics-data-key":n.chartOptions.synthetics_data_key,"timeseries-zoom":n.zoomConfiguration?.showZoomInAction,"tooltip-title":""},n.extraProps,{onSelectChartRange:u[0]||(u[0]=g=>i("select-chart-range",g)),onZoomTimeRange:u[1]||(u[1]=g=>i("zoom-time-range",g))}),s.createSlots({_:2},[n.context.editable?{name:"menu-items",fn:s.withCtx(()=>[s.createVNode(h,{onClick:l},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.edit")),1)]),_:1})]),key:"0"}:void 0]),1040,["active-metric","chart-data","chart-options","explore-link","requests-link","synthetics-data-key","timeseries-zoom"])])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-5e3d0a14"]]),hn=s.defineComponent({__name:"BarChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(n){return(e,t)=>(s.openBlock(),s.createBlock(Yt,{"chart-options":n.chartOptions,context:n.context,"extra-props":{showAnnotations:!1},height:n.height,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),dl={class:"analytics-chart"},hl={key:3,class:"analytics-chart"},fl=Se(s.defineComponent({__name:"ScatterChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(n,{emit:e}){const t=n,i=e,{i18n:r}=le.useI18n(),{issueRequestsQuery:o}=le.useIssueRequestsQuery(),a=s.computed(()=>t.query.datasource==="requests"),l=s.computed(()=>{const D=t.query,U=D.time_range??t.context.timeSpec,m=U?$t(U):void 0;if(!m)return D;const p=ie.finestGranularityForDuration(m);let _;return D.granularity&&ie.Granularities[D.granularity]>=ie.Granularities[p]?_=D.granularity:_=p,{...D,granularity:_}}),d=()=>a.value&&t.queryReady?JSON.stringify([t.query,t.context,t.refreshCounter]):null,c=s.ref(null),{data:u,error:h,isValidating:f}=oi(d,async D=>{const U=t.query;try{const m=await o(U,t.context);return d()!==D?void 0:(c.value=null,{key:D,result:Ce.requestsToScatterData(m,Ya(U))})}catch(m){if(d()!==D)return;throw c.value=Ce.handleQueryError(m),m}finally{d()===D&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),g=s.computed(()=>u.value?.result),{state:R,swrvState:E}=un(u,h,f),C=s.ref(),v=s.computed(()=>g.value??C.value);s.watch(g,D=>{D&&(C.value=D)});const k=s.computed(()=>R.value===E.ERROR||!!c.value),I=s.computed(()=>!k.value&&(!t.queryReady||R.value===E.PENDING)&&!v.value),O=s.computed(()=>!!v.value&&u.value?.key!==d()),x=s.computed(()=>({type:"scatter",chartDatasetColors:t.chartOptions.chart_dataset_colors,scatter:{percentileLines:t.chartOptions.percentile_lines?.map(D=>({percentile:D.percentile,label:D.label,borderDash:D.border_dash,color:D.color})),outlierPercentile:t.chartOptions.outlier_percentile,shadeOutlierRegion:t.chartOptions.shade_outlier_region,jitterMs:t.chartOptions.jitter_ms,pointRadius:t.chartOptions.point_radius,pointOpacity:t.chartOptions.point_opacity}}));return(D,U)=>{const m=s.resolveComponent("KSkeleton"),p=s.resolveComponent("KEmptyState");return a.value?I.value?(s.openBlock(),s.createBlock(m,{key:1,class:"chart-skeleton",type:"table"})):k.value?(s.openBlock(),s.createBlock(p,{key:2,"action-button-visible":!1,"data-testid":"scatter-chart-empty-state"},s.createSlots({icon:s.withCtx(()=>[c.value?.type==="forbidden"?(s.openBlock(),s.createBlock(s.unref(se.VisibilityOffIcon),{key:0})):(s.openBlock(),s.createBlock(s.unref(se.WarningOutlineIcon),{key:1}))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(c.value?.message||s.unref(r).t("renderer.unexpectedError")),1)]),_:2},[c.value?.details?{name:"default",fn:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(c.value.details),1)]),key:"0"}:void 0]),1024)):v.value?(s.openBlock(),s.createElementBlock("div",hl,[s.createVNode(s.unref(Ce.AnalyticsChart),{"chart-data":v.value,"chart-options":x.value,"legend-position":"bottom",loading:O.value,"synthetics-data-key":n.chartOptions.synthetics_data_key,"tooltip-title":""},null,8,["chart-data","chart-options","loading","synthetics-data-key"])])):s.createCommentVNode("",!0):(s.openBlock(),s.createBlock(Be,{key:0,context:n.context,query:l.value,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onChartData:U[0]||(U[0]=_=>i("chart-data",_)),onQueryComplete:U[1]||(U[1]=_=>i("query-complete"))},{default:s.withCtx(({data:_})=>[s.createElementVNode("div",dl,[s.createVNode(s.unref(Ce.AnalyticsChart),{"chart-data":_,"chart-options":x.value,"legend-position":"bottom","synthetics-data-key":n.chartOptions.synthetics_data_key,"tooltip-title":""},null,8,["chart-data","chart-options","synthetics-data-key"])])]),_:1},8,["context","query","query-ready","refresh-counter"]))}}}),[["__scopeId","data-v-f6f628be"]]),fn=s.defineComponent({__name:"TimeseriesChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["zoom-time-range","select-chart-range"],setup(n,{emit:e}){const t=e;return(i,r)=>(s.openBlock(),s.createBlock(Yt,{"active-metric":n.activeMetric,"chart-options":n.chartOptions,context:n.context,"explore-link":n.exploreLink,height:n.height,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,"requests-link":n.requestsLink,"zoom-configuration":n.zoomConfiguration,onSelectChartRange:r[0]||(r[0]=o=>t("select-chart-range",o)),onZoomTimeRange:r[1]||(r[1]=o=>t("zoom-time-range",o))},null,8,["active-metric","chart-options","context","explore-link","height","query","query-ready","refresh-counter","requests-link","zoom-configuration"]))}}),ml=Se(s.defineComponent({__name:"GoldenSignalsRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(n){const e=n,t=s.computed(()=>{const r=e.query?.datasource;if(r&&r!=="api_usage"&&r!=="basic")throw new Error(`Invalid datasource value: ${r}`);return{datasource:e.query?.datasource,overrideTimeRange:e.context.timeSpec,additionalFilter:e.context.filters,longCardTitles:e.chartOptions.long_card_titles,percentileLatency:e.chartOptions.percentile_latency,refreshInterval:e.context.refreshInterval,queryReady:e.queryReady,refreshCounter:e.refreshCounter}}),i=s.computed(()=>!!(e.chartOptions.chart_title||e.headerDescription));return(r,o)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["metric-card-tile-wrapper",{titled:i.value}])},[s.createVNode(s.unref(ai.MetricsProvider),s.normalizeProps(s.guardReactiveProps(t.value)),{default:s.withCtx(()=>[s.createVNode(s.unref(ai.MetricsConsumer))]),_:1},16)],2))}}),[["__scopeId","data-v-3eda5028"]]);var nt=(n=>(n.PENDING="PENDING",n.LOADING="LOADING",n.SUCCESS="SUCCESS",n.ERROR="ERROR",n))(nt||{});const pl=n=>!!n?.length;function gl(n,e,t,i=pl){const r=s.computed(()=>i(n.value)),o=s.computed(()=>{const a=n.value!==void 0,l=e.value!==void 0&&e.value!==null;return t.value?"LOADING":r.value?"SUCCESS":l?"ERROR":a?"SUCCESS":"PENDING"});return{fetchState:nt,hasData:r,state:o}}const _l=({emitState:n,fetchLifecycleState:e,hasData:t})=>{s.watch(()=>({hasData:t.value,state:e.value}),({hasData:i,state:r})=>{if(r!==nt.PENDING){if(r===nt.LOADING){n({hasData:i,state:"loading"});return}if(r===nt.ERROR){n({hasData:i,state:"error"});return}n({hasData:i,state:"success"})}})},yl=({startRow:n,endRow:e})=>{const t=e-n;return{blockIndex:t>0?Math.floor(n/t):0,pageSize:t}},Rl=({startRow:n,rowsLength:e,pageSize:t,total:i,hasMore:r})=>{if(typeof i=="number")return i;if(r!==!0&&(r===!1||e<t))return n+e},Cl=({fetcher:n,resetKey:e,sort:t})=>{const i=new Map,r=new Map,o=s.ref(0),a=s.ref(0),l=s.shallowRef(),d=s.shallowRef(),c=s.shallowRef(),u=s.ref(0),h=s.ref(!1);let f,g,R=t?.value?.sortColumnKey,E=t?.value?.sortColumnOrder;const C=P=>P===o.value&&f===n.value&&g===e?.value,v=(P,W)=>C(P)&&W===a.value&&R===t?.value?.sortColumnKey&&E===t?.value?.sortColumnOrder,k=P=>{if(!t)return!0;const W=t.value;return!W?.sortColumnKey||!W.sortColumnOrder?P.length===0:P.length===1&&P[0].colId===W.sortColumnKey&&P[0].sort===W.sortColumnOrder},I=()=>{h.value=u.value>0},O=()=>{a.value+=1,R=t?.value?.sortColumnKey,E=t?.value?.sortColumnOrder;for(const P of r.values())P.resolve(!1);i.clear(),r.clear(),d.value=void 0,c.value=void 0,u.value=0,I()},x=()=>{c.value=void 0,u.value+=1,I()},D=()=>{u.value=Math.max(0,u.value-1),I()},U=P=>{const W=r.get(P);if(W)return W;let j;const F={promise:new Promise(b=>{j=b}),resolve:b=>j(b)};return r.set(P,F),F},m=(P,W)=>{W.resolve(!1),r.get(P)===W&&r.delete(P)},p=async({blockIndex:P,currentBlockCompletion:W,datasourceId:j,requestGeneration:F})=>{if(P===0)return"ready";const b=r.get(P-1);if(!b)return m(P,W),"failed";const w=await b.promise;return v(j,F)?w?"ready":(m(P,W),"failed"):(m(P,W),"stale")},_=({blockIndex:P,currentBlockCompletion:W,getRowsParams:j,pageSize:F,result:b})=>{b.cursor!==void 0&&i.set(P,b.cursor),j.successCallback(b.data,Rl({startRow:j.startRow,rowsLength:b.data.length,pageSize:F,total:b.total,hasMore:b.hasMore})),j.startRow===0&&(d.value=b.data),W.resolve(!0)},T=({blockIndex:P,currentBlockCompletion:W,fetchError:j,getRowsParams:F})=>{c.value=j,F.failCallback(),m(P,W)},S=()=>{const P=n.value;if(!P)throw new Error("TableDataGrid requires a fetcher in infinite mode");f=P,g=e?.value;const W=o.value+1;return o.value=W,O(),{async getRows(j){if(!C(W)||!k(j.sortModel)){j.failCallback();return}const{blockIndex:F,pageSize:b}=yl({startRow:j.startRow,endRow:j.endRow});F===0&&r.has(0)&&O();const w=a.value,L=U(F);if(await p({blockIndex:F,currentBlockCompletion:L,datasourceId:W,requestGeneration:w})!=="ready"||!v(W,w)){j.failCallback(),m(F,L);return}x();try{const N=F>0?i.get(F-1):void 0,z=await P({mode:"infinite",pageSize:b,cursor:N,sort:t?.value});if(!v(W,w)){j.failCallback(),m(F,L);return}_({blockIndex:F,currentBlockCompletion:L,getRowsParams:j,pageSize:b,result:z})}catch(N){if(!v(W,w)){j.failCallback(),m(F,L);return}T({blockIndex:F,currentBlockCompletion:L,fetchError:N,getRowsParams:j})}finally{v(W,w)&&D()}}}},q=()=>{l.value=S()};return s.watch([n,()=>e?.value],()=>{q()},{immediate:!0}),s.watch([()=>t?.value?.sortColumnKey,()=>t?.value?.sortColumnOrder],()=>O()),{datasource:s.readonly(l),data:s.shallowReadonly(d),error:s.readonly(c),isFetching:s.readonly(h)}},El={title:"No Data",message:"There is no data to display."},Ol={title:"An error occurred",message:"Data cannot be displayed due to an error."},bl={emptyState:El,errorState:Ol};function mn(){const n=lt.createI18n("en-us",bl);return{i18n:n,i18nT:lt.i18nTComponent(n)}}const{i18n:wl}=mn(),pn=(n,e)=>{const t=Reflect.get(e,n.key);return n.valueFormatter?n.valueFormatter(t,e):String(t??"")},gt=n=>typeof n!="number"?null:Number.isFinite(n)?n:null,Tl=(n,e)=>n.reduce((t,i)=>{const r=gt(Reflect.get(i,e.key));return r===null?t:{sum:t.sum+r,max:Math.max(t.max,r)}},{sum:0,max:0}),vl=(n,e)=>{const t=(e??[]).filter(r=>Number.isFinite(r.value)&&n>=r.value);if(!t.length)return;const i=Math.max(...t.map(r=>r.value));return t.filter(r=>r.value===i).some(r=>r.type==="error")?"error":"warning"},Sl=(n,e,t)=>{if(n===null)return 0;const i=t==="relative"?e.sum:e.max;return i>0?Math.min(Math.max(n/i,0),1):0},xl=n=>{const e=t=>wl.formatNumber(t,{maximumFractionDigits:2});return n>0&&n<.01?`< ${e(.01)} %`:`${e(n)} %`},gn=({value:n,stats:e,header:t})=>{if(n===null||e.sum<=0)return;const i=n/e.sum*100;return t.percentageFormatter?.(i)??xl(i)},_n=(n,e)=>e!==void 0&&e.length>(n?.length??-1)?e:n,Il=({rows:n,header:e,stats:t})=>n.reduce((i,r)=>({value:_n(i.value,pn(e,r))??"",relative:e.showPercentage?_n(i.relative,gn({value:gt(Reflect.get(r,e.key)),stats:t,header:e})):void 0}),{value:""}),Dl=["data-threshold"],kl={class:"table-data-grid-cell-label-track"},Nl={class:"table-data-grid-cell-label"},Al={key:0,class:"table-data-grid-cell-relative","data-testid":"table-data-grid-cell-relative"},Ll={key:0,"aria-hidden":"true",class:"table-data-grid-cell-label table-data-grid-cell-label-sizer"},Ul=["data-text"],Kl=["data-text"],Ml=["data-threshold"],Bl=s.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(n,{expose:e}){const t=s.shallowRef(n.params),i=s.ref(null),r=s.ref(!1),o=s.computed(()=>t.value.headerDef??{key:"",label:""}),a=s.computed(()=>t.value.context?.presentation),l=s.computed(()=>t.value.context?.cells?.tooltipTarget?.value??"body"),d=s.computed(()=>t.value.valueFormatted??String(t.value.value??"")),c=s.computed(()=>t.value.value),u=s.computed(()=>gt(c.value)),h=s.computed(()=>a.value?.stats[o.value.key]),f=s.computed(()=>o.value.showPercentage&&h.value?gn({value:u.value,stats:h.value,header:o.value}):void 0),g=s.computed(()=>!!o.value.bar&&!!h.value&&(u.value!==null||c.value===null||c.value===void 0)),R=s.computed(()=>g.value&&h.value?Sl(u.value,h.value,o.value.bar)*100:0),E=s.computed(()=>g.value?a.value?.labelSizers[o.value.key]:void 0),C=s.computed(()=>o.value.thresholds?.length&&u.value!==null?vl(u.value,o.value.thresholds):void 0),v=s.computed(()=>({column:o.value,refreshCell:()=>{const _=t.value.node;_&&t.value.api.refreshCells({force:!0,rowNodes:[_]})},row:t.value.data??{},rowIndex:t.value.node?.rowIndex??0,rowValue:t.value.value,selected:t.value.node?.isSelected()??!1})),k=(_,{slots:T})=>{const S=t.value.colDef?.colId,q=t.value.context?.cells?.slots;return!S||S==="cell-icon"||!q?.[S]?T.default?.():s.h("span",{class:"table-data-grid-cell-slot-content"},s.renderSlot(q,S,v.value,()=>T.default?.()??[]))},I=()=>{const _=t.value.context?.cells?.slots;return _?.["cell-icon"]?s.renderSlot(_,"cell-icon",v.value):null};let O,x,D=!1;const U=()=>{const _=i.value;r.value=!!_&&_.scrollWidth>_.clientWidth},m=()=>{D||(x!==void 0&&cancelAnimationFrame(x),x=requestAnimationFrame(()=>{x=void 0,U()}))},p=_=>{if(O?.disconnect(),_){O?.observe(_);const T=_.closest(".ag-cell");T&&O?.observe(T)}m()};return s.onMounted(()=>{O=new ResizeObserver(m),p(i.value)}),s.watch(i,p),s.onUnmounted(()=>{D=!0,O?.disconnect(),x!==void 0&&cancelAnimationFrame(x)}),e({refresh(_){return t.value=_,s.nextTick(m),!0}}),(_,T)=>{const S=s.resolveComponent("KTooltip");return s.openBlock(),s.createElementBlock("span",{class:s.normalizeClass(["table-data-grid-cell-renderer",{"table-data-grid-cell-renderer--bar":g.value,"table-data-grid-cell-renderer--percentage":!!f.value,[`table-data-grid-cell-renderer--text-${C.value}`]:!g.value&&!!C.value}]),"data-threshold":C.value},[s.createElementVNode("span",kl,[s.createElementVNode("span",Nl,[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(I))),(s.openBlock(),s.createBlock(s.resolveDynamicComponent(k),null,{default:s.withCtx(()=>[s.createVNode(S,{class:"table-data-grid-cell-tooltip",disabled:!r.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:l.value,text:d.value},{default:s.withCtx(()=>[s.createElementVNode("span",{ref_key:"contentElement",ref:i,class:"table-data-grid-cell-content"},s.toDisplayString(d.value),513)]),_:1},8,["disabled","target","text"])]),_:1})),f.value?(s.openBlock(),s.createElementBlock("span",Al,"("+s.toDisplayString(f.value)+")",1)):s.createCommentVNode("",!0)]),E.value?(s.openBlock(),s.createElementBlock("span",Ll,[s.createElementVNode("span",{class:"table-data-grid-cell-sizer-value","data-text":E.value.value},null,8,Ul),E.value.relative?(s.openBlock(),s.createElementBlock("span",{key:0,class:"table-data-grid-cell-sizer-relative","data-text":`(${E.value.relative})`},null,8,Kl)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)]),g.value?(s.openBlock(),s.createElementBlock("span",{key:0,class:"table-data-grid-cell-bar","data-testid":"table-data-grid-cell-bar","data-threshold":C.value},[s.createElementVNode("span",{class:"table-data-grid-cell-bar-fill","data-testid":"table-data-grid-cell-bar-fill",style:s.normalizeStyle({width:`${R.value}%`})},null,4)],8,Ml)):s.createCommentVNode("",!0)],10,Dl)}}}),zl=({headers:n,slots:e,initialSort:t,mode:i,rows:r,tooltipTarget:o})=>{const a=i??"infinite",l=new Set,d=g=>!!(g.showPercentage||g.bar||g.thresholds?.length);s.watch([n,()=>r?.value],()=>{n.value.forEach(g=>{if(!d(g))return;let R;if(a==="infinite"&&(g.showPercentage||g.bar)?R="percentage and bar presentation is only supported in unpaginated mode":a==="unpaginated"&&r?.value?.some(C=>{const v=Reflect.get(C,g.key);return v!=null&&gt(v)===null})&&(R="contains non-finite or nonnumeric values; numeric presentation skips those values"),!R)return;const E=`${g.key}:${R}`;l.has(E)||(l.add(E),console.warn(`[TableDataGrid] Column "${g.key}" ${R}.`))})},{immediate:!0});const c=s.computed(()=>{if(a!=="unpaginated")return{};const g=r?.value??[];return Object.fromEntries(n.value.filter(R=>R.showPercentage||R.bar).map(R=>[R.key,Tl(g,R)]))}),u=s.computed(()=>{if(a!=="unpaginated")return{};const g=r?.value??[];return Object.fromEntries(n.value.filter(R=>R.bar).map(R=>[R.key,Il({rows:g,header:R,stats:c.value[R.key]})]))}),h=s.computed(()=>({cells:{slots:e,tooltipTarget:o},presentation:{stats:c.value,labelSizers:u.value}})),f=g=>{const R=t?.sortColumnKey===g.key;return{colId:g.key,flex:!g.width&&!g.maxWidth?1:void 0,headerName:g.label,maxWidth:g.maxWidth,minWidth:g.minWidth,sortable:g.sortable??!1,unSortIcon:g.showSortIcon,...R?{initialSort:t?.sortColumnOrder,initialSortIndex:0}:{},valueGetter:E=>E.data?.[g.key],valueFormatter:E=>E.data?pn(g,E.data):String(E.value??""),width:g.width,cellRenderer:Bl,cellRendererParams:{headerDef:g}}};return{columnDefs:s.computed(()=>n.value.map(f)),gridContext:h}},Xt=({config:n,headers:e,pageSize:t})=>{const i=new Set(e.filter(o=>o.sortable).map(o=>o.key)),r=n?.sortColumnKey&&i.has(n.sortColumnKey)?n.sortColumnKey:void 0;return{sortColumnKey:r,sortColumnOrder:r?n?.sortColumnOrder:void 0,pageSize:n?.pageSize??t,...n?.fitToContent!==void 0?{fitToContent:n.fitToContent}:{}}},yn=(n,e)=>n.sortColumnKey===e.sortColumnKey&&n.sortColumnOrder===e.sortColumnOrder&&n.pageSize===e.pageSize&&n.fitToContent===e.fitToContent,Pl=({headers:n,pageSize:e,tableConfig:t,emitSort:i,emitTableConfigUpdate:r,onExternalConfigChange:o})=>{const a=s.computed(()=>t.value?Xt({config:t.value,headers:n.value,pageSize:e.value}):void 0),l=s.ref(a.value??Xt({config:void 0,headers:n.value,pageSize:e.value}));s.watch(a,h=>{h&&!yn(h,l.value)&&(l.value=h,o?.(h))});const d=h=>{const f=Xt({config:{...l.value,...h},headers:n.value,pageSize:e.value});yn(f,l.value)||((f.sortColumnKey!==l.value.sortColumnKey||f.sortColumnOrder!==l.value.sortColumnOrder)&&i({sortColumnKey:f.sortColumnKey,sortColumnOrder:f.sortColumnOrder}),l.value=f,r(f))};s.watch(n,()=>{t.value||d({})},{deep:!0});const c=s.computed(()=>({sortColumnKey:l.value.sortColumnKey,sortColumnOrder:l.value.sortColumnOrder})),u=s.computed(()=>t.value?.pageSize??e.value);return{activeTableConfig:s.readonly(l),activeSort:c,activePageSize:u,patchTableConfig:d}},ql=({cellClick:n,headers:e,rowClick:t})=>{const i=s.computed(()=>new Set(e.value.filter(a=>a.disableRowClick).map(a=>a.key))),r=a=>{const l=a.event?.target;return l instanceof Element?l.closest(".ag-cell")?.getAttribute("col-id")??void 0:void 0},o=a=>{const l=r(a);return!!(l&&i.value.has(l))};return{onCellClick:a=>{const l=a.colDef.colId;!a.data||!l||n({columnKey:l,row:a.data,value:a.value})},onRowClick:a=>{a.data&&!o(a)&&t(a.data,a)}}},Hl=({activeSort:n,patchTableConfig:e})=>{const t=(i,r)=>{i.applyColumnState({state:r.sortColumnKey?[{colId:r.sortColumnKey,sort:r.sortColumnOrder??null,sortIndex:0}]:[],defaultState:{sort:null,sortIndex:null}})};return{onSortChanged:i=>{const r=i.api.getColumnState().filter(l=>l.sort).sort((l,d)=>(l.sortIndex??0)-(d.sortIndex??0)),o=r[r.length-1],a=o?{sortColumnKey:o.colId,sortColumnOrder:o.sort}:{sortColumnKey:void 0,sortColumnOrder:void 0};(a.sortColumnKey!==n.value.sortColumnKey||a.sortColumnOrder!==n.value.sortColumnOrder)&&e(a),r.length>1&&t(i.api,a)},applySortToGrid:t}},Gl={key:0,class:"table-error-state","data-testid":"table-error-state"},$l={key:1,class:"table-empty-state","data-testid":"table-empty-state"},Fl=s.defineComponent({__name:"TableDataGrid",props:{headers:{},error:{type:Boolean,default:!1},tableConfig:{},fetcher:{type:Function},mode:{},pageSize:{default:25},refreshKey:{type:[String,Number,Boolean]},rows:{}},emits:["grid:ready","state","row:click","cell:click","sort","update:tableConfig"],setup(n,{emit:e}){Xe.ModuleRegistry.registerModules([Xe.AllCommunityModule,Xe.ClientSideRowModelModule,Xe.InfiniteRowModelModule]);const t=n.mode??"infinite",i=e,{i18n:r}=mn(),{t:o}=r,a=s.useSlots(),l=s.shallowRef(),d=s.useTemplateRef("rootElement"),c=s.shallowRef("body"),u=()=>{const L=document.fullscreenElement;c.value=L instanceof HTMLElement&&L.contains(d.value??null)?L:"body"};s.onMounted(()=>{u(),document.addEventListener("fullscreenchange",u)}),s.onBeforeUnmount(()=>{document.removeEventListener("fullscreenchange",u)});const{activeTableConfig:h,activeSort:f,activePageSize:g,patchTableConfig:R}=Pl({headers:s.toRef(()=>n.headers),pageSize:s.toRef(()=>n.pageSize),tableConfig:s.toRef(()=>n.tableConfig),emitSort:L=>i("sort",L),emitTableConfigUpdate:L=>i("update:tableConfig",L),onExternalConfigChange:L=>{l.value&&C(l.value,L)}}),{onSortChanged:E,applySortToGrid:C}=Hl({activeSort:f,patchTableConfig:R}),v=s.computed(()=>t==="unpaginated"&&!!h.value.fitToContent),k=Xe.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:I,onRowClick:O}=ql({cellClick:L=>i("cell:click",L),headers:s.toRef(()=>n.headers),rowClick:(L,N)=>i("row:click",L,N)}),x={resizable:!1,sortable:!1,suppressMovable:!0},D=s.computed(()=>[g.value,n.refreshKey]),U=t==="infinite"?Cl({fetcher:s.toRef(()=>n.fetcher),resetKey:D,sort:f}):void 0,m=U?.datasource,p=s.computed(()=>U?U.data.value:n.rows),_=s.computed(()=>U?.isFetching.value??!1),T=s.computed(()=>n.rows?Array.from(n.rows):void 0),{columnDefs:S,gridContext:q}=zl({headers:s.toRef(()=>n.headers),mode:t,rows:T,slots:a,tooltipTarget:c,initialSort:f.value}),{fetchState:P,hasData:W,state:j}=gl(p,s.toRef(()=>U?.error.value),_),F=s.computed(()=>j.value===P.SUCCESS&&!W.value);U&&_l({emitState:L=>i("state",L),fetchLifecycleState:j,hasData:W});const b=()=>{const L=l.value;if(!L||L.isDestroyed())return;const N=f.value,z=L.getColumnState().find(A=>A.sort);z?.colId===N.sortColumnKey&&(z?.sort??void 0)===N.sortColumnOrder||C(L,N)};s.watch([l,f],b);const w=L=>{l.value=L.api,i("grid:ready",L.api)};return(L,N)=>{const z=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{ref_key:"rootElement",ref:d,class:s.normalizeClass(["kong-ui-public-table-data-grid",{"fit-to-content":v.value}]),"data-testid":"table-data-grid"},[n.error?(s.openBlock(),s.createElementBlock("div",Gl,[s.renderSlot(L.$slots,"error-state",{},()=>[s.createVNode(z,{"icon-variant":"error",message:s.unref(o)("errorState.message"),title:s.unref(o)("errorState.title")},null,8,["message","title"])],!0)])):F.value?(s.openBlock(),s.createElementBlock("div",$l,[s.renderSlot(L.$slots,"empty-state",{},()=>[s.createVNode(z,{message:s.unref(o)("emptyState.message"),title:s.unref(o)("emptyState.title")},null,8,["message","title"])],!0)])):(s.openBlock(),s.createBlock(s.unref(Hn.AgGridVue),{key:2,"cache-block-size":s.unref(t)==="infinite"?s.unref(g):void 0,class:"table-data-grid-grid","column-defs":s.unref(S),context:s.unref(q),datasource:s.unref(t)==="infinite"?s.unref(m):void 0,"default-col-def":x,"dom-layout":v.value?"autoHeight":"normal","infinite-initial-row-count":s.unref(t)==="infinite"?1:void 0,loading:_.value,"row-data":s.unref(t)==="unpaginated"?T.value:void 0,"row-model-type":s.unref(t)==="unpaginated"?"clientSide":"infinite","suppress-cell-focus":!0,"suppress-multi-sort":!0,theme:s.unref(k),onCellClicked:s.unref(I),onGridReady:w,onNewColumnsLoaded:b,onRowClicked:s.unref(O),onSortChanged:s.unref(E)},null,8,["cache-block-size","column-defs","context","datasource","dom-layout","infinite-initial-row-count","loading","row-data","row-model-type","theme","onCellClicked","onRowClicked","onSortChanged"]))],2)}}}),Wl=(n,e)=>{const t=n.__vccOpts||n;for(const[i,r]of e)t[i]=r;return t},Rn=Wl(Fl,[["__scopeId","data-v-01cd8bcd"]]),Cn=3,Vl={anthropic:se.AnthropicIcon,azure:se.AzureIcon,bedrock:se.AmazonBedrockIcon,cerebras:se.CerebrasIcon,cohere:se.CohereIcon,databricks:se.DatabricksIcon,deepseek:se.DeepseekIcon,gemini:se.GeminiIcon,huggingface:se.HuggingFaceIcon,llama2:se.MetaLlamaIcon,mistral:se.MistralIcon,moonshot:se.KimiIcon,nvidia:se.NvidiaIcon,ollama:se.OllamaIcon,openai:se.OpenAiIcon,vertex:se.GoogleVertexIcon,vllm:se.VllmIcon,xai:se.GrokIcon},jt=(n,e)=>{if(!n||!e)return;const t=e.toLowerCase();return n[e]??Object.entries(n).find(([i])=>i.toLowerCase()===t)?.[1]},Yl=({columnOptions:n,columnKey:e,rawValue:t})=>{if(!(jt(n,e)?.icon_set!=="ai_provider"||typeof t!="string"))return Vl[t.toLowerCase()]},Xl=n=>{if(n==null||n==="")return null;const e=typeof n=="number"?n:Number(n);return Number.isFinite(e)?e:null},jl=n=>n.toLocaleLowerCase().endsWith("count"),Ql=n=>{const e=Object.keys(n?.meta?.display??{}).slice(0,Cn),t=n?.meta?.metric_names??[];return(n?.data??[]).map(i=>{const r={record:i};return e.forEach(o=>{r[o]=i.event[o]}),t.forEach(o=>{r[o]=Xl(i.event[o])}),r})},Zl=({data:n,columnOptions:e,i18n:t,fieldTranslationMap:i})=>{const{formatUnit:r}=ie.unitFormatter({i18n:t}),o=n?.data??[],a=n?.meta,l=a?.display??{},d=Object.keys(l).slice(0,Cn),c=a?.metric_names??[],u=c[0],h=d.length>1,f=O=>on(t,i,O),g=(O,x)=>jt(e,O)?.label||x,R=(O,x)=>{if(jl(O)||O==="requests")return"";const D=x===1?"":"s",U=`chartUnits.${O}`;return t.messages[U]?t.formatMessage({id:U},{plural:D}):O},E=O=>{const x=D=>r(D,"%",{translateUnit:R});return O>0&&O<.01?`< ${x(.01)}`:x(O)},C=(O,x)=>{const D=O.event[x];if(D==null)return"–";const U=typeof D=="number"?D:Number(D);if(Number.isNaN(U))return"–";const m=a?.metric_units?.[x]||"count";return m==="%"?E(U):r(U,m,{approximate:["count","count/minute","token count"].includes(m),isBytes1024:!0,translateUnit:R})},v=(O,x)=>{const D=String(O.record.event[x]),U=l[x]?.[D];return{id:D,label:U?.name||"-",deleted:!!U?.deleted}},k=d.map(O=>({key:O,label:g(O,h?f(O):t.t("topNTable.nameLabel")),type:"dimension",valueFormatter:(x,D)=>v(D,O).label,sortable:!1}));c.forEach(O=>{const x=jt(e,O);k.push({key:O,label:x?.label||f(O),type:"metric",valueFormatter:(D,U)=>C(U.record,O),showPercentage:x?.value==="relative",percentageFormatter:E,bar:x?.bar==="max"?"absolute":x?.bar,thresholds:x?.thresholds,sortable:!1})});const I=o.length?a?d.some(O=>!Object.keys(l[O]||{}).length)?t.t("topNTable.errors.display"):u?"":t.t("topNTable.errors.metricNames"):t.t("topNTable.errors.meta"):"";return{headers:k,errorMessage:I,getDimension:v}},Jl={class:"fallback-entity-link","data-testid":"entity-link-parent"},En=s.defineComponent({__name:"FallbackEntityLink",props:{entityLinkData:{}},setup(n){return(e,t)=>(s.openBlock(),s.createElementBlock("div",Jl,s.toDisplayString(n.entityLinkData.label),1))}}),ec=["data-testid"],tc={key:1},ic=Se(s.defineComponent({__name:"TopNDataGrid",props:{chartOptions:{},data:{},fitToContent:{type:Boolean,default:!1},height:{}},setup(n){const e=s.inject(ve),t=we.useDatasourceConfigStore(),{i18n:i}=le.useI18n(),r=s.computed(()=>Ql(n.data)),o=s.computed(()=>Zl({data:n.data,columnOptions:n.chartOptions.column_options,i18n:i,fieldTranslationMap:t.fieldTranslationMap})),a=s.computed(()=>o.value.headers.map(E=>({...E,minWidth:E.type==="dimension"?160:E.bar?260:140}))),l=s.computed(()=>o.value.headers.filter(E=>E.type==="dimension")),d=s.computed(()=>({fitToContent:n.fitToContent})),c=s.computed(()=>n.fitToContent?{height:"auto"}:n.height===void 0?void 0:{height:`${n.height}px`}),u=(E,C)=>Yl({columnOptions:n.chartOptions.column_options,columnKey:E,rawValue:C}),h=s.defineAsyncComponent(async()=>{if(e?.fetchComponent)try{return await e.fetchComponent("EntityLink")}catch{return En}return En}),f=E=>{const C=n.chartOptions.entity_links;return C&&(C[E]||Object.entries(C).find(([v])=>v.toLowerCase()===E.toLowerCase())?.[1])||""},g=E=>f(E)||l.value[0]?.key===E&&n.chartOptions.entity_link||"",R=(E,C)=>{const v=g(C),k=String(E[C]);if(k.includes(":")){const[I,O]=k.split(":");return v.replace(Fi,I).replace(zt,O)}return v.replace(zt,k)};return(E,C)=>{const v=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{class:"top-n-data-grid","data-testid":r.value.length?"top-n-table":void 0,style:s.normalizeStyle(c.value)},[s.createVNode(s.unref(Rn),{error:!!o.value.errorMessage,headers:a.value,mode:"unpaginated",rows:r.value,"table-config":d.value},s.createSlots({"error-state":s.withCtx(()=>[s.createVNode(v,{"action-button-visible":!1,"data-testid":"chart-empty-state"},{icon:s.withCtx(()=>[s.createVNode(s.unref(se.WarningOutlineIcon))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(o.value.errorMessage),1)]),_:1})]),"empty-state":s.withCtx(()=>[s.createVNode(v,{"action-button-visible":!1,"data-testid":"top-n-empty-state",title:s.unref(i).t("topNTable.defaultEmptyStateTitle")},null,8,["title"])]),"cell-icon":s.withCtx(({column:k,rowValue:I})=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(u(k.key,I)),{class:"top-n-provider-icon","data-testid":"top-n-provider-icon",decorative:"",size:"var(--kui-icon-size-30, 16px)"}))]),_:2},[s.renderList(l.value,k=>({name:k.key,fn:s.withCtx(({row:I})=>[g(k.key)&&I[k.key]!=="empty"?(s.openBlock(),s.createBlock(s.unref(h),{key:0,class:"top-n-entity-link","entity-link-data":o.value.getDimension(I,k.key),"external-link":R(I,k.key)},null,8,["entity-link-data","external-link"])):o.value.getDimension(I,k.key).label==="empty"?(s.openBlock(),s.createElementBlock("i",tc,"empty")):s.createCommentVNode("",!0)])}))]),1032,["error","headers","rows","table-config"])],12,ec)}}}),[["__scopeId","data-v-5705b32b"]]),nc=s.defineComponent({__name:"TopNTableRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},fitToContent:{type:Boolean}},setup(n){return(e,t)=>(s.openBlock(),s.createBlock(Be,{context:n.context,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter},{default:s.withCtx(({data:i})=>[s.createVNode(ic,{"chart-options":n.chartOptions,data:i,"fit-to-content":n.fitToContent,height:n.height},null,8,["chart-options","data","fit-to-content","height"])]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),rc=s.defineComponent({__name:"TopTalkersRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["query-complete"],setup(n,{emit:e}){const t=n,i=e,r=s.computed(()=>t.chartOptions.columns.map(c=>({dimension:c.dimension,label:c.label}))),o=c=>({...t.query,dimensions:[c.dimension],filters:[...t.query.filters??[],...c.filters??[]]}),a=s.computed(()=>new Map(r.value.map((c,u)=>[c,o(t.chartOptions.columns[u])]))),l=new Set,d=c=>{l.add(c),l.size===r.value.length&&(l.clear(),i("query-complete"))};return s.watch([a,()=>t.refreshCounter],()=>l.clear()),(c,u)=>(s.openBlock(),s.createBlock(s.unref(Ce.TopTalkersGrid),{"column-options":n.chartOptions.column_options,columns:r.value,"size-metric":n.chartOptions.size_metric},{column:s.withCtx(({column:h})=>[s.createVNode(Be,{context:n.context,query:a.value.get(h),"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onQueryComplete:f=>d(h)},{default:s.withCtx(({data:f})=>[s.createVNode(s.unref(Ce.TopTalkersColumn),{"column-options":n.chartOptions.column_options,data:f,dimension:h.dimension,label:h.label,"size-metric":n.chartOptions.size_metric},null,8,["column-options","data","dimension","label","size-metric"])]),_:2},1032,["context","query","query-ready","refresh-counter","onQueryComplete"])]),_:1},8,["column-options","columns","size-metric"]))}}),sc=n=>n.records.map(e=>{const t={...e};return Object.entries(e).forEach(([i,r])=>{if(r===null)return;const o=n.meta.display?.[i]?.[String(r)]?.name;o&&(t[i]=o)}),t}),On=({columns:n,fieldLabel:e})=>n.map(t=>({key:t,label:e(t)})),oc={platform:On,platform_usage:On},bn=async({abortController:n,context:e,cursor:t,pageSize:i,query:r,onResponseColumns:o,stripUnknownFilters:a,tabularQueryFn:l})=>{if(!l)throw new Error("AnalyticsBridge.tabularQueryFn is not defined");const d=r.query,c=a({datasource:r.datasource,filters:[...d.filters??[],...e.filters],queryFields:d.entity===void 0?void 0:[d.entity]}),u=await l({datasource:r.datasource,query:{columns:d.columns,cursor:t===void 0?d.cursor:String(t),entity:d.entity,filters:c,page_size:i}},n);return u.meta.columns?.length&&o?.(u.meta.columns),{data:sc(u),cursor:u.meta.cursor,hasMore:!!u.meta.cursor}},ac={platform:bn,platform_usage:bn},lc=Se(s.defineComponent({__name:"TableDataGridRenderer",props:{query:{},context:{},queryReady:{type:Boolean},height:{},refreshCounter:{}},emits:["loading-change"],setup(n,{emit:e}){const t=n,i=e,r=s.inject(ve),o=we.useDatasourceConfigStore(),a=le.useFieldLabel(),l=new AbortController,d=s.ref([]),c=s.ref(!1),u=s.computed(()=>t.height===void 0?void 0:{height:`${t.height}px`}),h=s.computed(()=>({datasource:t.query.datasource,query:{columns:t.query.columns,cursor:t.query.cursor,entity:t.query.entity,filters:t.query.filters,page_size:t.query.page_size}})),f=s.computed(()=>JSON.stringify({refreshCounter:t.refreshCounter,query:{columns:t.query.columns,datasource:t.query.datasource,entity:t.query.entity,filters:t.query.filters,page_size:t.query.page_size},context:{filters:t.context.filters,timeSpec:t.context.timeSpec,tz:t.context.tz}}));s.onUnmounted(()=>{l.abort()});const g=s.computed(()=>oc[t.query.datasource]({columns:t.query.columns?.length?t.query.columns:d.value,fieldLabel:C=>a(C)})),R=s.computed(()=>async({cursor:C,pageSize:v})=>{try{await o.isReady();const k=ac[h.value.datasource];if(!k)throw new Error(`No table data grid fetcher found for datasource: ${h.value.datasource}`);const I=await k({abortController:l,context:t.context,cursor:C,pageSize:v,query:h.value,onResponseColumns:O=>{d.value=O},stripUnknownFilters:o.stripUnknownFilters,tabularQueryFn:r?.tabularQueryFn});return c.value=!1,I}catch(k){throw c.value=!0,k}}),E=C=>{C.state==="error"&&(c.value=!0),i("loading-change",C.state==="loading")};return(C,v)=>{const k=s.resolveComponent("KSkeleton");return s.openBlock(),s.createElementBlock("div",{class:"table-data-grid-renderer",style:s.normalizeStyle(u.value)},[n.queryReady?(s.openBlock(),s.createBlock(s.unref(Rn),{key:1,error:c.value,fetcher:R.value,headers:g.value,"page-size":n.query.page_size,"refresh-key":f.value,onState:E},null,8,["error","fetcher","headers","page-size","refresh-key"])):(s.openBlock(),s.createBlock(k,{key:0,"data-testid":"table-skeleton",type:"table"}))],4)}}}),[["__scopeId","data-v-c8caabc2"]]),cc=s.defineComponent({__name:"DonutChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(n){return(e,t)=>(s.openBlock(),s.createBlock(Yt,{"chart-options":n.chartOptions,context:n.context,height:n.height,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),uc="#ffffff",dc="#0044f4",hc="#d60027",fc="#ad000e",mc="#850000",pc="#5c0000",gc="#ff3954",_c="#ffabab",yc="#ffe5e5",Rc="#ecfcff",Cc="#6f28ff",Ec="#f1f0ff",Oc="#e0e4ea",bc="#0044f4",wc="#0030cc",Tc="#002099",vc="#001466",Sc="#5f9aff",xc="#bee2ff",Ic="#eefaff",Dc="#0d0e14",kc="#6c7489",Nc="#52596e",Ac="#3a3f51",Lc="#232633",Uc="#afb7c5",Kc="#e0e4ea",Mc="#f9fafb",Bc="rgba(13, 14, 20, 0.6)",zc="#0044f4",Pc="#0030cc",qc="#002099",Hc="#001466",Gc="#5f9aff",$c="#bee2ff",Fc="#eefaff",Wc="#007d60",Vc="#005944",Yc="#004737",Xc="#003629",jc="#00d6a4",Qc="#b5ffee",Zc="#ecfffb",Jc="rgba(0, 0, 0, 0)",eu="#995c00",tu="#804400",iu="#662d00",nu="#4d1b00",ru="#ffc400",su="#fff296",ou="#fffce0",au="#e0e4ea",lu="#0044f4",cu="#d60027",uu="#ad000e",du="#850000",hu="#5c0000",fu="#ff3954",mu="#ffabab",pu="#ffe5e5",gu="#6f28ff",_u="#e0e4ea",yu="rgba(255, 255, 255, 0.2)",Ru="#6c7489",Cu="#52596e",Eu="#3a3f51",Ou="#232633",bu="#afb7c5",wu="#e0e4ea",Tu="#f9fafb",vu="#0044f4",Su="#0030cc",xu="#002099",Iu="#001466",Du="#5f9aff",ku="#bee2ff",Nu="#eefaff",Au="rgba(0, 0, 0, 0)",Lu="#0044f4",Uu="#0d0e14",Ku="#0044f4",Mu="#d60027",Bu="#ad000e",zu="#850000",Pu="#5c0000",qu="#ff3954",Hu="#ffabab",Gu="#ffe5e5",$u="#00abd2",Fu="#d60067",Wu="#6f28ff",Vu="#5e00f5",Yu="#afb7c5",Xu="#0044f4",ju="#0030cc",Qu="#002099",Zu="#001466",Ju="#5f9aff",ed="#bee2ff",td="#eefaff",id="#ffffff",nd="#6c7489",rd="#52596e",sd="#3a3f51",od="#232633",ad="#afb7c5",ld="#e0e4ea",cd="#f9fafb",ud="#0044f4",dd="#0030cc",hd="#002099",fd="#001466",md="#5f9aff",pd="#bee2ff",gd="#eefaff",_d="#007d60",yd="#005944",Rd="#004737",Cd="#003629",Ed="#00d6a4",Od="#b5ffee",bd="#ecfffb",wd="#995c00",Td="#804400",vd="#662d00",Sd="#4d1b00",xd="#ffc400",Id="#fff296",Dd="#fffce0",kd="0.2s",Nd="0px",Ad="2px",Ld="4px",Ud="6px",Kd="8px",Md="10px",Bd="12px",zd="16px",Pd="20px",qd="24px",Hd="32px",Gd="50%",$d="100px",Fd="0px",Wd="1px",Vd="2px",Yd="4px",Xd="640px",jd="768px",Qd="1024px",Zd="1280px",Jd="1536px",eh="'JetBrains Mono', Consolas, monospace",th="'Inter', Roboto, Helvetica, sans-serif",Qt="'Inter', Roboto, Helvetica, sans-serif",ih="10px",nh="12px",rh="14px",sh="16px",oh="18px",ah="20px",lh="24px",ch="32px",uh="40px",dh="48px",hh="700",fh="500",mh="400",ph="600",gh="#f50045",_h="#828a9e",yh="#306fff",Rh="#00a17b",Ch="#ffc400",Eh="10px",Oh="12px",bh="16px",wh="20px",Th="24px",vh="32px",Sh="40px",xh="48px",Ih="normal",Dh="-0.12px",kh="-0.24px",Nh="-0.32px",Ah="-0.4px",Lh="-0.48px",Uh="normal",Kh="12px",Mh="16px",Bh="20px",zh="24px",Ph="28px",qh="32px",Hh="36px",Gh="40px",$h="48px",Fh="56px",Wh="#f1f0ff",Vh="#ffe5e5",Yh="#eefaff",Xh="#52596e",jh="#e0e4ea",Qh="#ecfcff",Zh="#ecfffb",Jh="#fffce0",ef="#fff0f7",tf="#6f28ff",nf="#5e00f5",rf="#d60027",sf="#ad000e",of="#0044f4",af="#0030cc",lf="#e0e4ea",cf="#afb7c5",uf="#52596e",df="#3a3f51",hf="#00819d",ff="#00647a",mf="#007d60",pf="#005944",gf="#995c00",_f="#804400",yf="#d60067",Rf="#ad0053",Cf="#000933",Ef="rgba(255, 255, 255, 0.12)",Of="rgba(255, 255, 255, 0.12)",bf="#00fabe",wf="rgba(255, 255, 255, 0.24)",Tf="#bee2ff",vf="#ffffff",Sf="#eefaff",xf="#00fabe",If="0 0 0 1px rgba(255, 255, 255, 0.12) inset",Df="4px 0 0 0 #00fabe inset",kf="0 0 0 1px rgba(255, 255, 255, 0.60) inset",Nf="0px 4px 20px 0px rgba(0, 0, 0, 0.08)",Af="0px 0px 0px 1px #e0e4ea inset",Lf="0px 0px 0px 1px #d60027 inset",Uf="0px 0px 0px 1px #ad000e inset",Kf="0px 0px 0px 1px #e0e4ea inset",Mf="0px 0px 0px 1px #0044f4 inset",Bf="0px 0px 0px 1px #001466 inset",zf="0px 0px 0px 1px #5f9aff inset",Pf="0px 0px 0px 4px rgba(0, 68, 244, 0.2)",qf="0px",Hf="2px",Gf="4px",$f="6px",Ff="8px",Wf="12px",Vf="16px",Yf="20px",Xf="24px",jf="32px",Qf="40px",Zf="48px",Jf="56px",em="64px",tm="80px",im="96px",nm="auto",rm="#bee2ff",sm="#8fc1ff",om="#5f9aff",am="#306fff",lm="#b5ffee",cm="#00fabe",um="#00d6a4",dm="#00a17b",hm="#007d60",fm="#005944",mm="#b5ffee",pm="#00fabe",gm="#b5ffee",_m="#00a17b",ym="#fff296",Rm="#ffe04b",Cm="#ffc400",Em="#b37600",Om="#995c00",bm="#804400",wm="#fff296",Tm="#ffe04b",vm="#ffc2b3",Sm="#ff9877",xm="#ff723c",Im="#f75008",Dm="#d13500",km="#a31f00",Nm="#ffc2b3",Am="#ff9877",Lm="#ff723c",Um="#f75008",Km="#d13500",Mm="#a31f00",Bm="#ffc2b3",zm="#ff9877",Pm="#ff723c",qm="#f75008",Hm="#d13500",Gm="#a31f00",$m="#ffc2b3",Fm="#ff9877",Wm="#ff723c",Vm="#f75008",Ym="#d13500",Xm="#a31f00",jm="#ffc2b3",Qm="#ff9877",Zm="#ff723c",Jm="#f75008",ep="#d13500",tp="#ffabab",ip="#ff7272",np="#ff3954",rp="#f50045",sp="#d60027",op="#ad000e",ap="#ffabab",lp="#ff7272",cp="#ff3954",up="#f50045",dp="#d60027",hp="#eefaff",fp="#ecfffb",mp="#fffce0",pp="#fff1ef",gp="#ffe5e5",_p="#5f9aff",yp="#00d6a4",Rp="#ffc400",Cp="#ff723c",Ep="#ff3954",Op="#eefaff",bp="#ecfffb",wp="#fffce0",Tp="#fff1ef",vp="#ffe5e5",Sp="#0044f4",xp="#007d60",Ip="#995c00",Dp="#d13500",kp="#d60027",wn=Object.freeze(Object.defineProperty({__proto__:null,KUI_ANIMATION_DURATION_20:kd,KUI_BORDER_RADIUS_0:Nd,KUI_BORDER_RADIUS_10:Ad,KUI_BORDER_RADIUS_100:Hd,KUI_BORDER_RADIUS_20:Ld,KUI_BORDER_RADIUS_30:Ud,KUI_BORDER_RADIUS_40:Kd,KUI_BORDER_RADIUS_50:Md,KUI_BORDER_RADIUS_60:Bd,KUI_BORDER_RADIUS_70:zd,KUI_BORDER_RADIUS_80:Pd,KUI_BORDER_RADIUS_90:qd,KUI_BORDER_RADIUS_CIRCLE:Gd,KUI_BORDER_RADIUS_ROUND:$d,KUI_BORDER_WIDTH_0:Fd,KUI_BORDER_WIDTH_10:Wd,KUI_BORDER_WIDTH_20:Vd,KUI_BORDER_WIDTH_30:Yd,KUI_BREAKPOINT_DESKTOP:Jd,KUI_BREAKPOINT_LAPTOP:Zd,KUI_BREAKPOINT_MOBILE:Xd,KUI_BREAKPOINT_PHABLET:jd,KUI_BREAKPOINT_TABLET:Qd,KUI_COLOR_BACKGROUND:uc,KUI_COLOR_BACKGROUND_ACCENT:dc,KUI_COLOR_BACKGROUND_DANGER:hc,KUI_COLOR_BACKGROUND_DANGER_STRONG:fc,KUI_COLOR_BACKGROUND_DANGER_STRONGER:mc,KUI_COLOR_BACKGROUND_DANGER_STRONGEST:pc,KUI_COLOR_BACKGROUND_DANGER_WEAK:gc,KUI_COLOR_BACKGROUND_DANGER_WEAKER:_c,KUI_COLOR_BACKGROUND_DANGER_WEAKEST:yc,KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST:Rc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE:Cc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST:Ec,KUI_COLOR_BACKGROUND_DISABLED:Oc,KUI_COLOR_BACKGROUND_INFO:bc,KUI_COLOR_BACKGROUND_INFO_STRONG:wc,KUI_COLOR_BACKGROUND_INFO_STRONGER:Tc,KUI_COLOR_BACKGROUND_INFO_STRONGEST:vc,KUI_COLOR_BACKGROUND_INFO_WEAK:Sc,KUI_COLOR_BACKGROUND_INFO_WEAKER:xc,KUI_COLOR_BACKGROUND_INFO_WEAKEST:Ic,KUI_COLOR_BACKGROUND_INVERSE:Dc,KUI_COLOR_BACKGROUND_NEUTRAL:kc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONG:Nc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGER:Ac,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGEST:Lc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAK:Uc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKER:Kc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST:Mc,KUI_COLOR_BACKGROUND_OVERLAY:Bc,KUI_COLOR_BACKGROUND_PRIMARY:zc,KUI_COLOR_BACKGROUND_PRIMARY_STRONG:Pc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGER:qc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGEST:Hc,KUI_COLOR_BACKGROUND_PRIMARY_WEAK:Gc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKER:$c,KUI_COLOR_BACKGROUND_PRIMARY_WEAKEST:Fc,KUI_COLOR_BACKGROUND_SUCCESS:Wc,KUI_COLOR_BACKGROUND_SUCCESS_STRONG:Vc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGER:Yc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGEST:Xc,KUI_COLOR_BACKGROUND_SUCCESS_WEAK:jc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKER:Qc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKEST:Zc,KUI_COLOR_BACKGROUND_TRANSPARENT:Jc,KUI_COLOR_BACKGROUND_WARNING:eu,KUI_COLOR_BACKGROUND_WARNING_STRONG:tu,KUI_COLOR_BACKGROUND_WARNING_STRONGER:iu,KUI_COLOR_BACKGROUND_WARNING_STRONGEST:nu,KUI_COLOR_BACKGROUND_WARNING_WEAK:ru,KUI_COLOR_BACKGROUND_WARNING_WEAKER:su,KUI_COLOR_BACKGROUND_WARNING_WEAKEST:ou,KUI_COLOR_BORDER:au,KUI_COLOR_BORDER_ACCENT:lu,KUI_COLOR_BORDER_DANGER:cu,KUI_COLOR_BORDER_DANGER_STRONG:uu,KUI_COLOR_BORDER_DANGER_STRONGER:du,KUI_COLOR_BORDER_DANGER_STRONGEST:hu,KUI_COLOR_BORDER_DANGER_WEAK:fu,KUI_COLOR_BORDER_DANGER_WEAKER:mu,KUI_COLOR_BORDER_DANGER_WEAKEST:pu,KUI_COLOR_BORDER_DECORATIVE_PURPLE:gu,KUI_COLOR_BORDER_DISABLED:_u,KUI_COLOR_BORDER_INVERSE:yu,KUI_COLOR_BORDER_NEUTRAL:Ru,KUI_COLOR_BORDER_NEUTRAL_STRONG:Cu,KUI_COLOR_BORDER_NEUTRAL_STRONGER:Eu,KUI_COLOR_BORDER_NEUTRAL_STRONGEST:Ou,KUI_COLOR_BORDER_NEUTRAL_WEAK:bu,KUI_COLOR_BORDER_NEUTRAL_WEAKER:wu,KUI_COLOR_BORDER_NEUTRAL_WEAKEST:Tu,KUI_COLOR_BORDER_PRIMARY:vu,KUI_COLOR_BORDER_PRIMARY_STRONG:Su,KUI_COLOR_BORDER_PRIMARY_STRONGER:xu,KUI_COLOR_BORDER_PRIMARY_STRONGEST:Iu,KUI_COLOR_BORDER_PRIMARY_WEAK:Du,KUI_COLOR_BORDER_PRIMARY_WEAKER:ku,KUI_COLOR_BORDER_PRIMARY_WEAKEST:Nu,KUI_COLOR_BORDER_TRANSPARENT:Au,KUI_COLOR_BRAND:Lu,KUI_COLOR_TEXT:Uu,KUI_COLOR_TEXT_ACCENT:Ku,KUI_COLOR_TEXT_DANGER:Mu,KUI_COLOR_TEXT_DANGER_STRONG:Bu,KUI_COLOR_TEXT_DANGER_STRONGER:zu,KUI_COLOR_TEXT_DANGER_STRONGEST:Pu,KUI_COLOR_TEXT_DANGER_WEAK:qu,KUI_COLOR_TEXT_DANGER_WEAKER:Hu,KUI_COLOR_TEXT_DANGER_WEAKEST:Gu,KUI_COLOR_TEXT_DECORATIVE_AQUA:$u,KUI_COLOR_TEXT_DECORATIVE_PINK:Fu,KUI_COLOR_TEXT_DECORATIVE_PURPLE:Wu,KUI_COLOR_TEXT_DECORATIVE_PURPLE_STRONG:Vu,KUI_COLOR_TEXT_DISABLED:Yu,KUI_COLOR_TEXT_INFO:Xu,KUI_COLOR_TEXT_INFO_STRONG:ju,KUI_COLOR_TEXT_INFO_STRONGER:Qu,KUI_COLOR_TEXT_INFO_STRONGEST:Zu,KUI_COLOR_TEXT_INFO_WEAK:Ju,KUI_COLOR_TEXT_INFO_WEAKER:ed,KUI_COLOR_TEXT_INFO_WEAKEST:td,KUI_COLOR_TEXT_INVERSE:id,KUI_COLOR_TEXT_NEUTRAL:nd,KUI_COLOR_TEXT_NEUTRAL_STRONG:rd,KUI_COLOR_TEXT_NEUTRAL_STRONGER:sd,KUI_COLOR_TEXT_NEUTRAL_STRONGEST:od,KUI_COLOR_TEXT_NEUTRAL_WEAK:ad,KUI_COLOR_TEXT_NEUTRAL_WEAKER:ld,KUI_COLOR_TEXT_NEUTRAL_WEAKEST:cd,KUI_COLOR_TEXT_PRIMARY:ud,KUI_COLOR_TEXT_PRIMARY_STRONG:dd,KUI_COLOR_TEXT_PRIMARY_STRONGER:hd,KUI_COLOR_TEXT_PRIMARY_STRONGEST:fd,KUI_COLOR_TEXT_PRIMARY_WEAK:md,KUI_COLOR_TEXT_PRIMARY_WEAKER:pd,KUI_COLOR_TEXT_PRIMARY_WEAKEST:gd,KUI_COLOR_TEXT_SUCCESS:_d,KUI_COLOR_TEXT_SUCCESS_STRONG:yd,KUI_COLOR_TEXT_SUCCESS_STRONGER:Rd,KUI_COLOR_TEXT_SUCCESS_STRONGEST:Cd,KUI_COLOR_TEXT_SUCCESS_WEAK:Ed,KUI_COLOR_TEXT_SUCCESS_WEAKER:Od,KUI_COLOR_TEXT_SUCCESS_WEAKEST:bd,KUI_COLOR_TEXT_WARNING:wd,KUI_COLOR_TEXT_WARNING_STRONG:Td,KUI_COLOR_TEXT_WARNING_STRONGER:vd,KUI_COLOR_TEXT_WARNING_STRONGEST:Sd,KUI_COLOR_TEXT_WARNING_WEAK:xd,KUI_COLOR_TEXT_WARNING_WEAKER:Id,KUI_COLOR_TEXT_WARNING_WEAKEST:Dd,KUI_FONT_FAMILY_CODE:eh,KUI_FONT_FAMILY_HEADING:th,KUI_FONT_FAMILY_TEXT:Qt,KUI_FONT_SIZE_10:ih,KUI_FONT_SIZE_100:dh,KUI_FONT_SIZE_20:nh,KUI_FONT_SIZE_30:rh,KUI_FONT_SIZE_40:sh,KUI_FONT_SIZE_50:oh,KUI_FONT_SIZE_60:ah,KUI_FONT_SIZE_70:lh,KUI_FONT_SIZE_80:ch,KUI_FONT_SIZE_90:uh,KUI_FONT_WEIGHT_BOLD:hh,KUI_FONT_WEIGHT_MEDIUM:fh,KUI_FONT_WEIGHT_REGULAR:mh,KUI_FONT_WEIGHT_SEMIBOLD:ph,KUI_ICON_COLOR_DANGER:gh,KUI_ICON_COLOR_NEUTRAL:_h,KUI_ICON_COLOR_PRIMARY:yh,KUI_ICON_COLOR_SUCCESS:Rh,KUI_ICON_COLOR_WARNING:Ch,KUI_ICON_SIZE_10:Eh,KUI_ICON_SIZE_20:Oh,KUI_ICON_SIZE_30:bh,KUI_ICON_SIZE_40:wh,KUI_ICON_SIZE_50:Th,KUI_ICON_SIZE_60:vh,KUI_ICON_SIZE_70:Sh,KUI_ICON_SIZE_80:xh,KUI_LETTER_SPACING_0:Ih,KUI_LETTER_SPACING_MINUS_10:Dh,KUI_LETTER_SPACING_MINUS_20:kh,KUI_LETTER_SPACING_MINUS_30:Nh,KUI_LETTER_SPACING_MINUS_40:Ah,KUI_LETTER_SPACING_MINUS_50:Lh,KUI_LETTER_SPACING_NORMAL:Uh,KUI_LINE_HEIGHT_10:Kh,KUI_LINE_HEIGHT_100:Fh,KUI_LINE_HEIGHT_20:Mh,KUI_LINE_HEIGHT_30:Bh,KUI_LINE_HEIGHT_40:zh,KUI_LINE_HEIGHT_50:Ph,KUI_LINE_HEIGHT_60:qh,KUI_LINE_HEIGHT_70:Hh,KUI_LINE_HEIGHT_80:Gh,KUI_LINE_HEIGHT_90:$h,KUI_METHOD_COLOR_BACKGROUND_CONNECT:Wh,KUI_METHOD_COLOR_BACKGROUND_DELETE:Vh,KUI_METHOD_COLOR_BACKGROUND_GET:Yh,KUI_METHOD_COLOR_BACKGROUND_HEAD:Xh,KUI_METHOD_COLOR_BACKGROUND_OPTIONS:jh,KUI_METHOD_COLOR_BACKGROUND_PATCH:Qh,KUI_METHOD_COLOR_BACKGROUND_POST:Zh,KUI_METHOD_COLOR_BACKGROUND_PUT:Jh,KUI_METHOD_COLOR_BACKGROUND_TRACE:ef,KUI_METHOD_COLOR_TEXT_CONNECT:tf,KUI_METHOD_COLOR_TEXT_CONNECT_STRONG:nf,KUI_METHOD_COLOR_TEXT_DELETE:rf,KUI_METHOD_COLOR_TEXT_DELETE_STRONG:sf,KUI_METHOD_COLOR_TEXT_GET:of,KUI_METHOD_COLOR_TEXT_GET_STRONG:af,KUI_METHOD_COLOR_TEXT_HEAD:lf,KUI_METHOD_COLOR_TEXT_HEAD_STRONG:cf,KUI_METHOD_COLOR_TEXT_OPTIONS:uf,KUI_METHOD_COLOR_TEXT_OPTIONS_STRONG:df,KUI_METHOD_COLOR_TEXT_PATCH:hf,KUI_METHOD_COLOR_TEXT_PATCH_STRONG:ff,KUI_METHOD_COLOR_TEXT_POST:mf,KUI_METHOD_COLOR_TEXT_POST_STRONG:pf,KUI_METHOD_COLOR_TEXT_PUT:gf,KUI_METHOD_COLOR_TEXT_PUT_STRONG:_f,KUI_METHOD_COLOR_TEXT_TRACE:yf,KUI_METHOD_COLOR_TEXT_TRACE_STRONG:Rf,KUI_NAVIGATION_COLOR_BACKGROUND:Cf,KUI_NAVIGATION_COLOR_BACKGROUND_SELECTED:Ef,KUI_NAVIGATION_COLOR_BORDER:Of,KUI_NAVIGATION_COLOR_BORDER_CHILD:bf,KUI_NAVIGATION_COLOR_BORDER_DIVIDER:wf,KUI_NAVIGATION_COLOR_TEXT:Tf,KUI_NAVIGATION_COLOR_TEXT_FOCUS:vf,KUI_NAVIGATION_COLOR_TEXT_HOVER:Sf,KUI_NAVIGATION_COLOR_TEXT_SELECTED:xf,KUI_NAVIGATION_SHADOW_BORDER:If,KUI_NAVIGATION_SHADOW_BORDER_CHILD:Df,KUI_NAVIGATION_SHADOW_FOCUS:kf,KUI_SHADOW:Nf,KUI_SHADOW_BORDER:Af,KUI_SHADOW_BORDER_DANGER:Lf,KUI_SHADOW_BORDER_DANGER_STRONG:Uf,KUI_SHADOW_BORDER_DISABLED:Kf,KUI_SHADOW_BORDER_PRIMARY:Mf,KUI_SHADOW_BORDER_PRIMARY_STRONGEST:Bf,KUI_SHADOW_BORDER_PRIMARY_WEAK:zf,KUI_SHADOW_FOCUS:Pf,KUI_SPACE_0:qf,KUI_SPACE_10:Hf,KUI_SPACE_100:Qf,KUI_SPACE_110:Zf,KUI_SPACE_120:Jf,KUI_SPACE_130:em,KUI_SPACE_140:tm,KUI_SPACE_150:im,KUI_SPACE_20:Gf,KUI_SPACE_30:$f,KUI_SPACE_40:Ff,KUI_SPACE_50:Wf,KUI_SPACE_60:Vf,KUI_SPACE_70:Yf,KUI_SPACE_80:Xf,KUI_SPACE_90:jf,KUI_SPACE_AUTO:nm,KUI_STATUS_COLOR_100:rm,KUI_STATUS_COLOR_100S:_p,KUI_STATUS_COLOR_101:sm,KUI_STATUS_COLOR_102:om,KUI_STATUS_COLOR_103:am,KUI_STATUS_COLOR_1NA:hp,KUI_STATUS_COLOR_200:lm,KUI_STATUS_COLOR_200S:yp,KUI_STATUS_COLOR_201:cm,KUI_STATUS_COLOR_202:um,KUI_STATUS_COLOR_203:dm,KUI_STATUS_COLOR_204:hm,KUI_STATUS_COLOR_205:fm,KUI_STATUS_COLOR_206:mm,KUI_STATUS_COLOR_207:pm,KUI_STATUS_COLOR_208:gm,KUI_STATUS_COLOR_226:_m,KUI_STATUS_COLOR_2NA:fp,KUI_STATUS_COLOR_300:ym,KUI_STATUS_COLOR_300S:Rp,KUI_STATUS_COLOR_301:Rm,KUI_STATUS_COLOR_302:Cm,KUI_STATUS_COLOR_303:Em,KUI_STATUS_COLOR_304:Om,KUI_STATUS_COLOR_305:bm,KUI_STATUS_COLOR_307:wm,KUI_STATUS_COLOR_308:Tm,KUI_STATUS_COLOR_3NA:mp,KUI_STATUS_COLOR_400:vm,KUI_STATUS_COLOR_400S:Cp,KUI_STATUS_COLOR_401:Sm,KUI_STATUS_COLOR_402:xm,KUI_STATUS_COLOR_403:Im,KUI_STATUS_COLOR_404:Dm,KUI_STATUS_COLOR_405:km,KUI_STATUS_COLOR_406:Nm,KUI_STATUS_COLOR_407:Am,KUI_STATUS_COLOR_408:Lm,KUI_STATUS_COLOR_409:Um,KUI_STATUS_COLOR_410:Km,KUI_STATUS_COLOR_411:Mm,KUI_STATUS_COLOR_412:Bm,KUI_STATUS_COLOR_413:zm,KUI_STATUS_COLOR_414:Pm,KUI_STATUS_COLOR_415:qm,KUI_STATUS_COLOR_416:Hm,KUI_STATUS_COLOR_417:Gm,KUI_STATUS_COLOR_418:$m,KUI_STATUS_COLOR_421:Fm,KUI_STATUS_COLOR_422:Wm,KUI_STATUS_COLOR_423:Vm,KUI_STATUS_COLOR_424:Ym,KUI_STATUS_COLOR_425:Xm,KUI_STATUS_COLOR_426:jm,KUI_STATUS_COLOR_428:Qm,KUI_STATUS_COLOR_429:Zm,KUI_STATUS_COLOR_431:Jm,KUI_STATUS_COLOR_451:ep,KUI_STATUS_COLOR_4NA:pp,KUI_STATUS_COLOR_500:tp,KUI_STATUS_COLOR_500S:Ep,KUI_STATUS_COLOR_501:ip,KUI_STATUS_COLOR_502:np,KUI_STATUS_COLOR_503:rp,KUI_STATUS_COLOR_504:sp,KUI_STATUS_COLOR_505:op,KUI_STATUS_COLOR_506:ap,KUI_STATUS_COLOR_507:lp,KUI_STATUS_COLOR_508:cp,KUI_STATUS_COLOR_510:up,KUI_STATUS_COLOR_511:dp,KUI_STATUS_COLOR_5NA:gp,KUI_STATUS_COLOR_BACKGROUND_100:Op,KUI_STATUS_COLOR_BACKGROUND_200:bp,KUI_STATUS_COLOR_BACKGROUND_300:wp,KUI_STATUS_COLOR_BACKGROUND_400:Tp,KUI_STATUS_COLOR_BACKGROUND_500:vp,KUI_STATUS_COLOR_TEXT_100:Sp,KUI_STATUS_COLOR_TEXT_200:xp,KUI_STATUS_COLOR_TEXT_300:Ip,KUI_STATUS_COLOR_TEXT_400:Dp,KUI_STATUS_COLOR_TEXT_500:kp},Symbol.toStringTag,{value:"Module"})),Tn=Object.keys(wn).filter(n=>n.startsWith("KUI_COLOR")),vn=n=>wn[n],Np=n=>`--${n.toLowerCase().replaceAll("_","-")}`,Sn=()=>{if(typeof window>"u")return Object.fromEntries(Tn.map(t=>[t,vn(t)]));const n=window.getComputedStyle(document.documentElement),e=(t,i)=>n.getPropertyValue(t).trim()||i;return Object.fromEntries(Tn.map(t=>[t,e(Np(t),vn(t))]))},Zt=n=>{const e=s.ref(Sn());if(typeof window<"u"&&typeof MutationObserver<"u"){const t=new MutationObserver(()=>{e.value=Sn()});t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-kui-theme"]}),s.getCurrentScope()&&s.onScopeDispose(()=>t.disconnect())}return e},Ap=()=>typeof window>"u"?Qt:window.getComputedStyle(document.documentElement).getPropertyValue("--kui-font-family-text").trim()||Qt,Lp=n=>{const e=Ap(),t={color:n.KUI_COLOR_TEXT,fontFamily:e},i={axisLabel:{color:n.KUI_COLOR_TEXT_NEUTRAL,fontFamily:e},axisLine:{lineStyle:{color:n.KUI_COLOR_BORDER}},splitLine:{lineStyle:{color:n.KUI_COLOR_BORDER}}};return{textStyle:t,categoryAxis:i,valueAxis:i,tooltip:{backgroundColor:n.KUI_COLOR_BACKGROUND,borderWidth:0,borderRadius:4,padding:0,confine:!0,extraCssText:"box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12), 0 5px 10px rgba(0, 0, 0, 0.24);",textStyle:{color:n.KUI_COLOR_TEXT,fontFamily:e}},visualMap:{textStyle:{color:n.KUI_COLOR_TEXT_NEUTRAL,fontFamily:e}},legend:{textStyle:{color:n.KUI_COLOR_TEXT_NEUTRAL,fontFamily:e}}}},Up=n=>s.computed(()=>Lp(n.value)),Kp={class:"kong-ui-public-echarts-tooltip"},Mp={class:"tooltip-title"},Bp={class:"title"},zp={key:0,class:"subtitle"},Pp={class:"context"},qp={class:"metric"},Hp={class:"tooltip-rows"},Gp={class:"display-value"},$p=s.defineComponent({__name:"ChartTooltip",props:{title:{},context:{},metric:{},rows:{}},setup(n){return(e,t)=>(s.openBlock(),s.createElementBlock("div",Kp,[s.createElementVNode("div",Mp,[s.createElementVNode("div",Bp,s.toDisplayString(n.title),1),n.context||n.metric?(s.openBlock(),s.createElementBlock("div",zp,[s.createElementVNode("div",Pp,s.toDisplayString(n.context),1),s.createElementVNode("div",qp,s.toDisplayString(n.metric),1)])):s.createCommentVNode("",!0)]),s.createElementVNode("ul",Hp,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n.rows,(i,r)=>(s.openBlock(),s.createElementBlock("li",{key:`${i.label}-${r}`,class:s.normalizeClass({"extra-row":i.isExtra})},[s.createElementVNode("span",{class:"square-marker",style:s.normalizeStyle(i.isExtra?void 0:{background:i.color})},null,4),s.createElementVNode("span",{class:s.normalizeClass(["display-label",{empty:i.isSegmentEmpty}])},s.toDisplayString(i.label),3),s.createElementVNode("span",Gp,s.toDisplayString(i.value),1)],2))),128))])]))}}),xn=(n,e)=>{const t=n.__vccOpts||n;for(const[i,r]of e)t[i]=r;return t},Fp=xn($p,[["__scopeId","data-v-ca633353"]]),Jt=n=>Array.isArray(n)?n:[n],In=(n,e)=>typeof n=="number"?e?.[n]??String(n):n,ei=(n,e,t,i)=>({color:typeof n.color=="string"?n.color:void 0,label:e,value:i?i(Number(t)):String(t??"")}),Wp=n=>Array.isArray(n)?n[n.length-1]:n,Vp=n=>{const e=Jt(n),t=e[0];return{context:String(t?.axisValueLabel??t?.name??""),rows:e.map(i=>ei(i,i.seriesName??"",Wp(i.value)))}},Yp=n=>{let e;return s.getCurrentScope()&&s.onScopeDispose(()=>{e&&s.render(null,e)}),t=>{const i=(n()??Vp)(t);return i?(e??=document.createElement("div"),s.render(s.h(Fp,i),e),e):""}},Xp={class:"kong-ui-public-echarts"},jp=s.defineComponent({name:"KongECharts",inheritAttrs:!1,__name:"ECharts",props:{option:{},height:{default:"400px"},tooltipContent:{type:Function}},setup(n){s.useCssVars(o=>({v1cecfeed:o.height})),Tt.use([Fn.CanvasRenderer,ct.GridComponent,ct.TooltipComponent]);const e=Zt(),t=Up(e),i=Yp(()=>n.tooltipContent),r=s.computed(()=>({...n.option,tooltip:{...n.option?.tooltip,formatter:i}}));return(o,a)=>(s.openBlock(),s.createElementBlock("div",Xp,[s.createVNode(s.unref($n),s.mergeProps({autoresize:!0,class:"chart",option:r.value,theme:s.unref(t)},o.$attrs),null,16,["option","theme"])]))}}),Dn=xn(jp,[["__scopeId","data-v-68114d20"]]),kn=n=>typeof n=="object"&&n!==null&&!Array.isArray(n),rt=(n,...e)=>{const t={...n};for(const i of e)if(i)for(const[r,o]of Object.entries(i)){if(o===void 0)continue;const a=t[r];t[r]=kn(a)&&kn(o)?rt(a,o):o}return t},Qp=s.defineComponent({__name:"HeatmapChart",props:{data:{},xAxisLabels:{},yAxisLabels:{},seriesName:{},min:{},max:{},colorRange:{},valueFormatter:{type:Function},visibleRows:{},showValues:{type:Boolean},seriesOption:{},option:{},height:{},tooltipTitle:{}},setup(n){Tt.use([li.HeatmapChart,ct.VisualMapComponent,ct.DataZoomSliderComponent]);const e=Zt(),t=a=>{const[l]=Jt(a),[d,c,u]=l.value;return{title:n.tooltipTitle,context:In(d,n.xAxisLabels),metric:n.seriesName,rows:[ei(l,In(c,n.yAxisLabels),u,n.valueFormatter)]}},i=a=>({type:"slider",yAxisIndex:0,startValue:0,endValue:a-1,zoomLock:!0,right:10,width:8,handleSize:0,moveHandleSize:0,showDetail:!1,brushSelect:!1,showDataShadow:!1,borderColor:"transparent",backgroundColor:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST,fillerColor:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAK}),r=s.computed(()=>{const a=n.data??[],l=!!n.visibleRows&&n.visibleRows<(n.yAxisLabels?.length??0),d=n.valueFormatter?c=>n.valueFormatter(Number(c)):void 0;return{grid:{top:10,left:10,right:l?30:20,bottom:70,outerBoundsMode:"same",outerBoundsContain:"axisLabel"},xAxis:{type:"category",data:n.xAxisLabels??[],splitArea:{show:!1},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"category",data:n.yAxisLabels??[],inverse:!0,splitArea:{show:!1},axisLine:{show:!1},axisTick:{show:!1},axisLabel:{width:160,overflow:"truncate"}},visualMap:{min:n.min??0,max:n.max??a.reduce((c,[,,u])=>Math.max(c,u),1),calculable:!0,orient:"horizontal",left:"center",bottom:0,inRange:{color:n.colorRange??[e.value.KUI_COLOR_BACKGROUND_INFO_WEAKEST,e.value.KUI_COLOR_BACKGROUND_INFO_STRONG]},formatter:d},...l?{dataZoom:[i(n.visibleRows)]}:{},series:[rt({name:n.seriesName,type:"heatmap",data:a,animation:!1,label:{show:n.showValues??!1,formatter:n.valueFormatter?({value:c})=>n.valueFormatter(Number(c[2])):void 0},itemStyle:{borderColor:e.value.KUI_COLOR_BACKGROUND,borderWidth:2,borderRadius:2},emphasis:{itemStyle:{shadowBlur:5,shadowColor:e.value.KUI_COLOR_BACKGROUND_OVERLAY}}},n.seriesOption)]}}),o=s.computed(()=>rt(r.value,n.option));return(a,l)=>(s.openBlock(),s.createBlock(Dn,{height:n.height,option:o.value,"tooltip-content":t},null,8,["height","option"]))}}),Zp=s.defineComponent({__name:"TreeMapChart",props:{data:{},seriesName:{},showValues:{type:Boolean},valueFormatter:{type:Function},colorPalette:{},drillDown:{type:Boolean,default:!0},leafDepth:{},seriesOption:{},option:{},height:{},tooltipTitle:{}},setup(n){Tt.use([li.TreemapChart]);const e=Zt(),t=l=>{const[d]=Jt(l),c=d.treePathInfo??[];if(c.length===1)return;const u=c.slice(1,-1).map(({name:h})=>h);return{title:n.tooltipTitle,context:u.length?u.join(" / "):void 0,metric:n.seriesName,rows:[ei(d,d.name,Number(d.value),n.valueFormatter)]}},i=()=>[e.value.KUI_COLOR_BACKGROUND_PRIMARY_WEAK,e.value.KUI_COLOR_BACKGROUND_SUCCESS_WEAK,e.value.KUI_COLOR_BACKGROUND_WARNING_WEAK,e.value.KUI_COLOR_BACKGROUND_DANGER_WEAK,e.value.KUI_COLOR_BACKGROUND_INFO_WEAK,e.value.KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST,e.value.KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST],r=(l=[])=>l.reduce((d,c)=>Math.max(d,1+r(c.children)),0),o=s.computed(()=>({series:[rt({name:n.seriesName,type:"treemap",data:n.data??[],nodeClick:n.drillDown?"zoomToNode":!1,...n.drillDown?{scaleLimit:{min:1,max:1/0},zoomToNodeRatio:.2}:{},leafDepth:n.leafDepth??r(n.data),roam:n.drillDown,left:0,top:0,right:0,bottom:n.drillDown?40:0,visibleMin:0,breadcrumb:{show:n.drillDown,itemStyle:{color:e.value.KUI_COLOR_BACKGROUND_NEUTRAL_WEAK,borderColor:"transparent",borderWidth:0,borderRadius:2,textStyle:{color:e.value.KUI_COLOR_TEXT}},emphasis:{itemStyle:{color:e.value.KUI_COLOR_BACKGROUND_NEUTRAL,textStyle:{color:e.value.KUI_COLOR_TEXT}}}},levels:[{color:n.colorPalette??i(),itemStyle:{borderColor:e.value.KUI_COLOR_BACKGROUND,borderWidth:2,gapWidth:2}},{colorAlpha:[.55,1],itemStyle:{borderColor:e.value.KUI_COLOR_BACKGROUND,borderWidth:1,gapWidth:1}}],label:{show:!0,color:e.value.KUI_COLOR_TEXT,align:"center",verticalAlign:"middle",overflow:"truncate",formatter:n.showValues?({name:l,value:d})=>`${l}
13
+ ${n.valueFormatter?n.valueFormatter(Number(d)):String(d)}`:void 0}},n.seriesOption)]})),a=s.computed(()=>rt(o.value,n.option));return(l,d)=>(s.openBlock(),s.createBlock(Dn,{height:n.height,option:a.value,"tooltip-content":t},null,8,["height","option"]))}}),Nn=n=>{if(n==null||typeof n=="string"&&n.trim()==="")return;const e=Number(n);return Number.isFinite(e)?e:void 0},Jp=(n,e,t)=>{if(!t.length)return n;const i=t.reduce((o,a)=>Math.min(o,a));if(i<=n)return i;const r=Math.ceil((i-n)/e);return i-r*e},eg=(n,e,t)=>{const i=[];for(let r=n;r<e;r+=t)i.push(r);return i},tg=(n,e,t)=>{const i=o=>sa(o,t,"yyyy-MM-dd"),r=n.length>0&&i(n[0])!==i(n[n.length-1]);return n.map(o=>Ce.formatChartTicksByGranularity({tickValue:new Date(o),granularity:e,dayBoundaryCrossed:r,timezone:t}))},ig=(n,e)=>{const t=n.indexOf(e);return t===-1?n.push(e)-1:t},ng=(n,e)=>n[e]?.name??e,rg=(n,{tz:e}={})=>{if(!n?.meta||!n.data)return;const{display:t,metric_names:i,start:r,end:o,granularity_ms:a}=n.meta,l=i?.[0],d=t&&Object.keys(t).find(v=>v!=="time");if(!l||!d||!r||!o){console.error("Cannot build heatmap chart data from this explore result. Missing metric, dimension or time range.");return}const c=a||ie.Granularities.daily,u=ie.msToGranularity(c)??"daily",h=e||Intl.DateTimeFormat().resolvedOptions().timeZone,f=n.data,g=Jp(new Date(r).getTime(),c,f.map(({timestamp:v})=>new Date(v).getTime())),R=eg(g,new Date(o).getTime(),c),E=[],C=[];for(const{timestamp:v,event:k}of f){const I=Math.floor((new Date(v).getTime()-g)/c),O=Nn(k[l]);I<0||I>=R.length||O===void 0||C.push([I,ig(E,String(k[d])),O])}return{data:C,xAxisLabels:tg(R,u,h),yAxisLabels:E.map(v=>ng(t[d],v))}},sg={class:"wrapper","data-testid":"heatmap-chart"},og=10,ag=Se(s.defineComponent({__name:"HeatmapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(n,{emit:e}){const t=n,i=e,{i18n:r}=le.useI18n(),o=le.useMetricFormatter(),a=c=>{const u=rg(c,{tz:t.context.tz});if(u?.data.length)return{data:u.data,xAxisLabels:u.xAxisLabels,yAxisLabels:u.yAxisLabels,...o(c)}},l=new WeakMap,d=c=>(l.has(c)||l.set(c,a(c)),l.get(c));return(c,u)=>{const h=s.resolveComponent("KEmptyState");return s.openBlock(),s.createBlock(Be,{context:n.context,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onChartData:u[0]||(u[0]=f=>i("chart-data",f)),onQueryComplete:u[1]||(u[1]=f=>i("query-complete"))},{default:s.withCtx(({data:f})=>[s.createElementVNode("div",sg,[d(f)?(s.openBlock(),s.createBlock(s.unref(Qp),s.mergeProps({key:0,height:"100%","tooltip-title":n.chartOptions.chart_title??void 0,"visible-rows":og},d(f)),null,16,["tooltip-title"])):(s.openBlock(),s.createBlock(h,{key:1,"action-button-visible":!1,"data-testid":"no-data-in-report"},{title:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.noDataAvailable.title")),1)]),default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.noDataAvailable.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-3315f2cd"]]),An=(n,e,{otherLabel:t})=>({name:e===Ce.OTHER_DIMENSION_ID&&t||(n?.[e]?.name??e)}),lg=(n,e,t,i)=>({...An(e,t,i),itemStyle:{color:Es({dimension:n,dimensionValue:t})}}),Ln=(n,e,t)=>{const i=n.get(e)??t();return n.set(e,i),i},ti=(n,e)=>!e.includes("time")&&(!n||ie.isMetricSupported("treemap",n)),Un=(n,e)=>{n.value=Number(n.value??0)+e},cg=(n,e,t,[i,r],o)=>{const a=new Map,l=(d,c)=>String(d[c]);for(const{event:d}of n){const c=Nn(d[e]);if(c===void 0)continue;const u=l(d,i),h=Ln(a,u,()=>({node:lg(i,t[i],u,o),children:new Map}));if(!r){Un(h.node,c);continue}const f=l(d,r),g=Ln(h.children,f,()=>An(t[r],f,o));Un(g,c)}return a},ug=(n,e={})=>{if(!n?.meta||!n.data)return;const{display:t,metric_names:i}=n.meta,r=i?.[0],o=t?Object.keys(t):[];if(!r||!o.length){console.error("Cannot build treemap chart data from this explore result. Missing metric or dimension.");return}if(!ti(r,o)){console.error("Cannot build treemap chart data from this explore result. Needs an additive metric and no time dimension.");return}return[...cg(n.data,r,t,o,e).values()].map(({node:l,children:d})=>d.size?{...l,children:[...d.values()]}:l)},dg={class:"wrapper","data-testid":"treemap-chart"},hg=Se(s.defineComponent({__name:"TreemapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(n,{emit:e}){const t=n,i=e,{i18n:r}=le.useI18n(),o=le.useMetricFormatter(),a=s.computed(()=>ti(t.query.metrics?.[0],t.query.dimensions??[])),l=u=>{const h=ug(u,{otherLabel:r.t("chartLabels.____OTHER____")});if(h?.length)return{data:h,drillDown:h.some(f=>f.children?.length),...o(u)}},d=new WeakMap,c=u=>(d.has(u)||d.set(u,l(u)),d.get(u));return(u,h)=>{const f=s.resolveComponent("KEmptyState");return s.openBlock(),s.createBlock(Be,{context:n.context,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onChartData:h[0]||(h[0]=g=>i("chart-data",g)),onQueryComplete:h[1]||(h[1]=g=>i("query-complete"))},{default:s.withCtx(({data:g})=>[s.createElementVNode("div",dg,[a.value?c(g)?(s.openBlock(),s.createBlock(s.unref(Zp),s.mergeProps({key:1,height:"100%","tooltip-title":n.chartOptions.chart_title??void 0},c(g)),null,16,["tooltip-title"])):(s.openBlock(),s.createBlock(f,{key:2,"action-button-visible":!1,"data-testid":"no-data-in-report"},{title:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.noDataAvailable.title")),1)]),default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.noDataAvailable.description")),1)]),_:1})):(s.openBlock(),s.createBlock(f,{key:0,"action-button-visible":!1,"data-testid":"treemap-unsupported"},{title:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.treemapUnsupported.title")),1)]),default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.treemapUnsupported.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-d818a9ae"]]),fg=["data-testid"],mg={key:0,class:"tile-header"},pg={class:"badge-container"},gg={class:"badge-text"},_g={class:"badge-text"},yg={key:0,class:"metric-selector-wrapper"},Rg={key:1},Cg=["data-testid"],Eg=["data-testid"],Og=["data-testid"],bg={class:"delete-option"},wg=["data-testid"],Kn=Se(s.defineComponent({__name:"DashboardTile",props:s.mergeModels({context:{},definition:{},fitToContent:{type:Boolean,default:!1},height:{default:()=>tt},hideActions:{type:Boolean,default:!1},isFullscreen:{type:Boolean},preview:{type:Boolean,default:!1},queryReady:{type:Boolean},showRefresh:{type:Boolean,default:!1},tileId:{},tileType:{default:"chart"}},{refreshCounter:{default:0},refreshCounterModifiers:{}}),emits:s.mergeModels(["chart-data","tile-loaded","edit-tile","duplicate-tile","remove-tile","tile-time-range-zoom","tile-bounds-change"],["update:refreshCounter"]),setup(n,{expose:e,emit:t}){s.useCssVars(G=>({v76398b0c:`${G.height}px`}));const i=parseInt(qi,10),r=le.useFieldLabel(),{zoomConfiguration:o}=le.useDashboardContext({context:s.computed(()=>n.context),preview:s.computed(()=>n.preview)}),a=s.useModel(n,"refreshCounter"),l=()=>{O.value=!0,a.value++},d=t,c=s.defineAsyncComponent(()=>Promise.resolve().then(()=>Yg)),u=s.inject(ve),h=we.useDatasourceConfigStore(),{datasourceConfigMap:f,stripUnknownFilters:g}=Ye(h),{i18n:R}=le.useI18n(),E=s.ref(),C=s.ref({status:"loading"}),v=s.ref(!1),k=s.ref(),I=s.ref(!1),O=s.ref(!0),x=s.computed(()=>n.definition.chart),D=s.computed(()=>x.value.type==="single_value"),U=s.computed(()=>("chart_title"in x.value?x.value.chart_title:void 0)||(D.value?ue.value:void 0)),m=s.computed(()=>n.definition.header_description),p=s.computed(()=>x.value.type==="slottable"),_=s.computed(()=>De(n.definition)||Ht(n.definition)?!1:!("allow_csv_export"in x.value)||x.value.allow_csv_export!==!1),{exploreLinkKebabMenu:T,requestsLinkKebabMenu:S,canShowKebabMenu:q,canGenerateRequestsLink:P,canGenerateExploreLink:W,requestsLinkZoomActions:j,exploreLinkZoomActions:F,buildExploreQuery:b,buildExploreLink:w,buildRequestLink:L,buildRequestsQueryZoomActions:N}=le.useContextLinks({queryBridge:u,chartData:s.readonly(E),definition:s.toRef(()=>n.definition),context:s.readonly(s.toRef(()=>n.context))}),{issueQuery:z}=le.useIssueQuery();s.watch(()=>n.definition,async(G,te)=>{await s.nextTick(),k.value&&(I.value=k.value.scrollWidth>k.value.clientWidth);try{JSON.stringify(G?.query)!==JSON.stringify(te?.query)&&(O.value=!0)}catch{}},{immediate:!0,deep:!0});const A=s.computed(()=>R.t("csvExport.defaultFilename")),ae=s.computed(()=>!!T.value||_.value||!!n.context.editable),ne=s.computed(()=>!n.hideActions&&q.value&&ae.value),ce=s.computed(()=>ne.value&&ae.value&&!n.isFullscreen),H={heatmap:ag,treemap:hg,timeseries_line:fn,timeseries_bar:fn,scatter:fl,horizontal_bar:hn,vertical_bar:hn,gauge:dn,donut:cc,golden_signals:ml,top_n:nc,top_talkers:rc,table:lc,slottable:void 0,single_value:dn,choropleth_map:c},K=s.computed(()=>({...B.value?.rendererEvents.supportsRequests?{"select-chart-range":Xg}:{},...B.value?.rendererEvents.supportsZoom?{"zoom-time-range":He}:{},...B.value?.rendererEvents.supportsBounds?{"bounds-change":wt}:{},...B.value?.rendererEvents.supportsLoadingChange?{"loading-change":at}:{}})),B=s.computed(()=>{const G=H[n.definition.chart.type],te=De(n.definition),me=!!G?.emits?.includes("select-chart-range"),Ge=!!G?.emits?.includes("zoom-time-range"),ze=n.definition.chart.type==="choropleth_map",$e=!!G?.emits?.includes("loading-change"),ri={query:n.definition.query,context:n.context,queryReady:n.queryReady,height:n.height-i*2,refreshCounter:a.value,zoomConfiguration:o.value},si={chartOptions:n.definition.chart,activeMetric:Z.value,headerDescription:m.value,requestsLink:o.value.showRequestsAction?j.value:void 0,exploreLink:o.value.showExploreAction?F.value:void 0};return G&&{component:G,rendererProps:{...ri,...te?{}:si,...["top_n","single_value"].includes(n.definition.chart.type)?{fitToContent:n.fitToContent}:{}},rendererEvents:{supportsRequests:me,supportsZoom:Ge,supportsBounds:ze,supportsLoadingChange:$e}}}),Y=s.computed(()=>{if(De(n.definition))return null;const G=n.definition.query,te=G?.time_range;if(ie.isPlatformDatasource(G?.datasource)&&!G.dimensions?.includes("time"))return R.t("renderer.as_of_today");if(te?.type==="relative"){const me=ie.TimePeriods.get(ie.TIMEFRAME_LOOKUP[te.time_range]);return me?me.display:(console.warn("Did not recognize the given relative time range:",te.time_range),te.time_range)}else if(te?.type==="absolute"){const me=te.tz||"Etc/UTC";return`${ie.formatTime(te.start,{short:!0,tz:me})} - ${ie.formatTime(te.end,{short:!0,tz:me})}`}return null}),M=s.computed(()=>{const G=n.definition.query,te=G?.datasource,me=te?f.value[te]?.timeRangeOptions:void 0,ze=(G&&"time_range"in G?G.time_range:void 0)??n.context.timeSpec;return Ft(ze,me)}),J=s.computed(()=>p.value?!1:[!!U.value,ce.value,!!Y.value,M.value,!!m.value,n.showRefresh,X.value].some(Boolean)),de=s.computed(()=>E.value?ie.msToGranularity(E.value.meta.granularity_ms):void 0),ee=s.computed(()=>["timeseries_line","timeseries_bar"].includes(x.value.type)),re=s.computed(()=>E.value?.meta.metric_names??[]),Z=s.ref();s.watch(re,G=>{(!Z.value||!G.includes(Z.value))&&(Z.value=G[0])},{immediate:!0});const Re=s.computed(()=>{const G=x.value;return G.type!=="timeseries_line"?!1:re.value.some(te=>G.metric_axis_map?.[te]==="right")}),X=s.computed(()=>ee.value&&!Re.value&&(E.value?.data.length??0)>0&&re.value.length>1&&Object.keys(E.value?.meta.display??{}).length>0),ue=s.computed(()=>{const te=("metrics"in n.definition.query?n.definition.query.metrics?.[0]:void 0)??re.value[0];if(te)return r(te)}),Ae=s.computed(()=>re.value.map(G=>({value:G,label:r(G)}))),Le=s.computed(()=>{if(!Gt(n.definition)||!ee.value||!n.queryReady||O.value)return!1;const G=n.definition.query.granularity;return!G||!de.value?!1:G!==de.value}),Ee=s.computed(()=>{const G=ie.msToGranularity(E.value?.meta.granularity_ms??0)??"unknown",te=Gt(n.definition)?n.definition.query.granularity??"unknown":"unknown";return R.t("query_aged_out_warning",{currentGranularity:R.t(`granularities.${G}`),savedGranularity:R.t(`granularities.${te}`)})}),qe=s.computed(()=>{const G=[...n.context.filters,...n.definition.query.filters??[]],te="metrics"in n.definition.query?n.definition.query.metrics:void 0,me=n.definition.query.datasource??"api_usage";return g.value({datasource:me,filters:G,queryFields:te})}),fe=()=>{d("edit-tile",n.definition)},Oe=()=>{d("duplicate-tile",n.definition)},he=()=>{d("remove-tile",n.definition)},pe=G=>{E.value=G,O.value=!1,d("chart-data",G),d("tile-loaded")},Ie=()=>{O.value=!1,d("tile-loaded")},at=G=>{O.value=G,G||d("tile-loaded")},bt=()=>{v.value=!1},Ue=()=>{if(Ht(n.definition))throw new Error("Cannot export data for a tile backed by the api-requests endpoint");const G=n.definition.query.datasource?.startsWith("goap");return u?.staticConfig?.increaseCsvExportLimit!==!1&&!G?z(n.definition.query,n.context,ie.EXPORT_RECORD_LIMIT):E.value?Promise.resolve(E.value):new Promise(me=>{const Ge=s.watch(E,ze=>{ze&&(me(ze),Ge())})})},be=async()=>{v.value=!0,C.value={status:"loading"};try{const G=await Ue();C.value={status:"success",chartData:G}}catch(G){C.value={status:"error",error:G}}},He=G=>{const te={tileId:n.tileId.toString(),timeRange:G};d("tile-time-range-zoom",te)},wt=G=>{const te={tileId:n.tileId.toString(),bounds:G};d("tile-bounds-change",te)},Xg=G=>{const te=qe.value,me=b(G,te);F.value=W.value?{href:w(me)}:void 0,j.value=P.value?{href:L(N(G,te))}:void 0};return e({getExportData:Ue}),(G,te)=>{const me=s.resolveComponent("KTooltip"),Ge=s.resolveComponent("KBadge"),ze=s.resolveComponent("KButton"),$e=s.resolveComponent("KDropdownItem"),ri=s.resolveComponent("KDropdown");return s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["tile-boundary",{editable:n.context.editable,"fit-to-content":n.fitToContent,headless:!J.value,"compact-single_value":D.value&&n.fitToContent}]),"data-testid":`tile-${n.tileId}`},[J.value&&!p.value?(s.openBlock(),s.createElementBlock("div",mg,[s.createVNode(me,{class:"title-tooltip",disabled:!I.value,"max-width":"500",text:U.value},{default:s.withCtx(()=>[s.createElementVNode("div",{ref_key:"titleRef",ref:k,class:"title"},s.toDisplayString(U.value),513)]),_:1},8,["disabled","text"]),s.createElementVNode("div",pg,[M.value?(s.openBlock(),s.createBlock(Ge,{key:0,appearance:"warning","data-testid":"unsupported-time-range-badge",tooltip:s.unref(R).t("unsupported_time_range_warning"),"tooltip-attributes":{maxWidth:"320px"}},{icon:s.withCtx(()=>[s.createVNode(s.unref(se.WarningIcon),{size:`var(--kui-icon-size-20, ${s.unref(Bi)})`},null,8,["size"])]),default:s.withCtx(()=>[s.createElementVNode("span",gg,s.toDisplayString(s.unref(R).t("unsupported_time_range_badge")),1)]),_:1},8,["tooltip"])):s.createCommentVNode("",!0),Y.value?(s.openBlock(),s.createBlock(Ge,{key:1,"data-testid":"time-range-badge",tooltip:Le.value?Ee.value:void 0,"tooltip-attributes":{maxWidth:"320px"}},s.createSlots({default:s.withCtx(()=>[s.createElementVNode("span",_g,s.toDisplayString(Y.value),1)]),_:2},[Le.value?{name:"icon",fn:s.withCtx(()=>[s.createVNode(s.unref(se.WarningIcon),{size:`var(--kui-icon-size-20, ${s.unref(Bi)})`},null,8,["size"])]),key:"0"}:void 0]),1032,["tooltip"])):s.createCommentVNode("",!0)]),X.value?(s.openBlock(),s.createElementBlock("div",yg,[s.createVNode(s.unref(Gn.KSegmentedControl),{modelValue:Z.value,"onUpdate:modelValue":te[0]||(te[0]=si=>Z.value=si),class:"metric-selector","data-testid":"metric-selector",options:Ae.value},null,8,["modelValue","options"])])):s.createCommentVNode("",!0),n.showRefresh?(s.openBlock(),s.createElementBlock("div",Rg,[s.createVNode(ze,{appearance:"secondary",class:"refresh-button","data-testid":`tile-refresh-button-${n.tileId}`,disabled:O.value,icon:"",size:"small",onClick:l},{default:s.withCtx(()=>[O.value?(s.openBlock(),s.createBlock(s.unref(se.ProgressIcon),{key:0,role:"button",size:`var(--kui-icon-size-60, ${s.unref(Pi)})`,tabindex:"0"},null,8,["size"])):(s.openBlock(),s.createBlock(s.unref(se.RefreshIcon),{key:1,role:"button",size:`var(--kui-icon-size-60, ${s.unref(Pi)})`,tabindex:"0"},null,8,["size"]))]),_:1},8,["data-testid","disabled"])])):s.createCommentVNode("",!0),m.value?(s.openBlock(),s.createElementBlock("div",{key:2,class:"header-description","data-testid":`tile-description-${n.tileId}`},s.toDisplayString(m.value),9,Cg)):s.createCommentVNode("",!0),ne.value?(s.openBlock(),s.createElementBlock("div",{key:3,class:"tile-actions","data-testid":`tile-actions-${n.tileId}`},[ne.value&&n.context.editable&&!n.isFullscreen?(s.openBlock(),s.createBlock(s.unref(se.EditIcon),{key:0,class:"edit-icon",color:`var(--kui-color-text-neutral, ${s.unref(Mt)})`,"data-testid":`edit-tile-${n.tileId}`,size:`var(--kui-icon-size-40, ${s.unref(zi)})`,onClick:fe},null,8,["color","data-testid","size"])):s.createCommentVNode("",!0),ne.value&&ae.value&&!n.isFullscreen?(s.openBlock(),s.createBlock(ri,{key:1,class:"dropdown","data-testid":`chart-action-menu-${n.tileId}`,"kpop-attributes":{placement:"bottom-end"}},{items:s.withCtx(()=>[s.unref(T)?(s.openBlock(),s.createBlock($e,{key:0,"data-testid":`chart-jump-to-explore-${n.tileId}`,item:{label:s.unref(R).t("jumpToExplore"),to:s.unref(T)}},null,8,["data-testid","item"])):s.createCommentVNode("",!0),!s.unref(De)(n.definition)&&s.unref(S)?(s.openBlock(),s.createBlock($e,{key:1,"data-testid":`chart-jump-to-requests-${n.tileId}`,item:{label:s.unref(R).t("jumpToRequests"),to:s.unref(S)}},null,8,["data-testid","item"])):s.createCommentVNode("",!0),_.value?(s.openBlock(),s.createBlock($e,{key:2,class:"chart-export-button","data-testid":`chart-csv-export-${n.tileId}`,onClick:be},{default:s.withCtx(()=>[s.createElementVNode("span",{class:"chart-export-trigger","data-testid":`csv-export-button-${n.tileId}`},s.toDisplayString(s.unref(R).t("csvExport.exportAsCsv")),9,Og)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0),n.context.editable?(s.openBlock(),s.createBlock($e,{key:3,"data-testid":`duplicate-tile-${n.tileId}`,onClick:Oe},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(R).t("renderer.duplicateTile")),1)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0),n.context.editable?(s.openBlock(),s.createBlock($e,{key:4,"data-testid":`remove-tile-${n.tileId}`,onClick:he},{default:s.withCtx(()=>[s.createElementVNode("span",bg,s.toDisplayString(s.unref(R).t("renderer.delete")),1)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0)]),default:s.withCtx(()=>[s.createVNode(s.unref(se.MoreIcon),{class:"kebab-action-menu",color:`var(--kui-color-text-neutral, ${s.unref(Mt)})`,"data-testid":`kebab-action-menu-${n.tileId}`,size:`var(--kui-icon-size-40, ${s.unref(zi)})`},null,8,["color","data-testid","size"])]),_:1},8,["data-testid"])):s.createCommentVNode("",!0)],8,Eg)):s.createCommentVNode("",!0),v.value?(s.openBlock(),s.createBlock(ln,{key:4,"data-testid":`csv-export-modal-${n.tileId}`,"export-state":C.value,filename:A.value,onCloseModal:bt},null,8,["data-testid","export-state","filename"])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),s.createElementVNode("div",{class:s.normalizeClass(["tile-content",`type-${n.tileType}-${x.value.type}`]),"data-testid":`tile-content-${n.tileId}`},[B.value?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(B.value.component),s.mergeProps({key:0},B.value.rendererProps,s.toHandlers(K.value),{onChartData:pe,onQueryComplete:Ie}),null,16)):s.createCommentVNode("",!0)],10,wg)],10,fg)}}}),[["__scopeId","data-v-1017ac1a"]]);function Tg(n,e,t,i,r){const o=(...a)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+r+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),e.apply(n,a));return o.prototype=e.prototype,o}class y{static getElements(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(i&&!isNaN(+e[0])){const o=i.getElementById(e);return o?[o]:[]}let r=t.querySelectorAll(e);return!r.length&&e[0]!=="."&&e[0]!=="#"&&(r=t.querySelectorAll("."+e),r.length||(r=t.querySelectorAll("#"+e))),Array.from(r)}return[e]}static getElement(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(!e.length)return null;if(i&&e[0]==="#")return i.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return t.querySelector(e);if(i&&!isNaN(+e[0]))return i.getElementById(e);let r=t.querySelector(e);return i&&!r&&(r=i.getElementById(e)),r||(r=t.querySelector("."+e)),r}return e}static lazyLoad(e){return e.lazyLoad||e.grid?.opts?.lazyLoad&&e.lazyLoad!==!1}static createDiv(e,t){const i=document.createElement("div");return e.forEach(r=>{r&&i.classList.add(r)}),t?.appendChild(i),i}static shouldSizeToContent(e,t=!1){return e?.grid&&(t?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,t){return!(e.y>=t.y+t.h||e.y+e.h<=t.y||e.x+e.w<=t.x||e.x>=t.x+t.w)}static isTouching(e,t){return y.isIntercepted(e,{x:t.x-.5,y:t.y-.5,w:t.w+1,h:t.h+1})}static areaIntercept(e,t){const i=e.x>t.x?e.x:t.x,r=e.x+e.w<t.x+t.w?e.x+e.w:t.x+t.w;if(r<=i)return 0;const o=e.y>t.y?e.y:t.y,a=e.y+e.h<t.y+t.h?e.y+e.h:t.y+t.h;return a<=o?0:(r-i)*(a-o)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((r,o)=>{const a=t*((r.y??1e4)-(o.y??1e4));return a===0?t*((r.x??1e4)-(o.x??1e4)):a})}static find(e,t){return t?e.find(i=>i.id===t):void 0}static createStylesheet(e,t,i){const r=document.createElement("style"),o=i?.nonce;return o&&(r.nonce=o),r.setAttribute("type","text/css"),r.setAttribute("gs-style-id",e),r.styleSheet?r.styleSheet.cssText="":r.appendChild(document.createTextNode("")),t?t.insertBefore(r,t.firstChild):(t=document.getElementsByTagName("head")[0],t.appendChild(r)),r}static removeStylesheet(e,t){const r=(t||document).querySelector("STYLE[gs-style-id="+e+"]");r&&r.parentNode&&r.remove()}static addCSSRule(e,t,i){e.textContent+=`${t} { ${i} } `}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let t,i="px";if(typeof e=="string")if(e==="auto"||e==="")t=0;else{const r=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!r)throw new Error(`Invalid height val = ${e}`);i=r[2]||"px",t=parseFloat(r[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(const r in i){if(!i.hasOwnProperty(r))return;e[r]===null||e[r]===void 0?e[r]=i[r]:typeof i[r]=="object"&&typeof e[r]=="object"&&this.defaults(e[r],i[r])}}),e}static same(e,t){if(typeof e!="object")return e==t;if(typeof e!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}static copyPos(e,t,i=!1){return t.x!==void 0&&(e.x=t.x),t.y!==void 0&&(e.y=t.y),t.w!==void 0&&(e.w=t.w),t.h!==void 0&&(e.h=t.h),i&&(t.minW&&(e.minW=t.minW),t.minH&&(e.minH=t.minH),t.maxW&&(e.maxW=t.maxW),t.maxH&&(e.maxH=t.maxH)),e}static samePos(e,t){return e&&t&&e.x===t.x&&e.y===t.y&&(e.w||1)===(t.w||1)&&(e.h||1)===(t.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,t){if(!(typeof e!="object"||typeof t!="object"))for(let i in e){const r=e[i],o=t[i];i[0]==="_"||r===o?delete e[i]:r&&typeof r=="object"&&o!==void 0&&(y.removeInternalAndSame(r,o),Object.keys(r).length||delete e[i])}}static removeInternalForSave(e,t=!0){for(let i in e)(i[0]==="_"||e[i]===null||e[i]===void 0)&&delete e[i];delete e.grid,t&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,t){let i=!1;return(...r)=>{i||(i=!0,setTimeout(()=>{e(...r),i=!1},t))}}static removePositioningStyles(e){const t=e.style;t.position&&t.removeProperty("position"),t.left&&t.removeProperty("left"),t.top&&t.removeProperty("top"),t.width&&t.removeProperty("width"),t.height&&t.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const t=getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowY)?e:this.getScrollElement(e.parentElement)}static updateScrollPosition(e,t,i){const r=e.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight;if(r.top<0||r.bottom>o){const a=r.bottom-o,l=r.top,d=this.getScrollElement(e);if(d!==null){const c=d.scrollTop;r.top<0&&i<0?e.offsetHeight>o?d.scrollTop+=i:d.scrollTop+=Math.abs(l)>Math.abs(i)?i:l:i>0&&(e.offsetHeight>o?d.scrollTop+=i:d.scrollTop+=a>i?i:a),t.top+=d.scrollTop-c}}}static updateScrollResize(e,t,i){const r=this.getScrollElement(t),o=r.clientHeight,a=r===this.getScrollElement()?0:r.getBoundingClientRect().top,l=e.clientY-a,d=l<i,c=l>o-i;d?r.scrollBy({behavior:"smooth",top:l-i}):c&&r.scrollBy({behavior:"smooth",top:i-(o-l)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const t=["parentGrid","el","grid","subGrid","engine"],i=y.clone(e);for(const r in i)i.hasOwnProperty(r)&&typeof i[r]=="object"&&r.substring(0,2)!=="__"&&!t.find(o=>o===r)&&(i[r]=y.cloneDeep(e[r]));return i}static cloneNode(e){const t=e.cloneNode(!0);return t.removeAttribute("id"),t}static appendTo(e,t){let i;typeof t=="string"?i=y.getElement(t):i=t,i&&i.appendChild(e)}static addElStyles(e,t){if(t instanceof Object)for(const i in t)t.hasOwnProperty(i)&&(Array.isArray(t[i])?t[i].forEach(r=>{e.style[i]=r}):e.style[i]=t[i])}static initEvent(e,t){const i={type:t.type},r={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:t.target?t.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(o=>i[o]=e[o]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(o=>i[o]=e[o]),{...i,...r}}static simulateMouseEvent(e,t,i){const r=e,o=new MouseEvent(t,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:r.ctrlKey??!1,altKey:r.altKey??!1,shiftKey:r.shiftKey??!1,metaKey:r.metaKey??!1,button:0,relatedTarget:e.target});(i||e.target).dispatchEvent(o)}static getValuesFromTransformedElement(e){const t=document.createElement("div");y.addElStyles(t,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(t);const i=t.getBoundingClientRect();return e.removeChild(t),t.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(e,t,i){if(!e)return;const r=e[t];e[t]=e[i],e[i]=r}static canBeRotated(e){return!(!e||e.w===e.h||e.locked||e.noResize||e.grid?.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class ke{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,t=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,t){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,r={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!r.nested&&!this.float&&this.swap(e,i))return!0;let o=t;!this._loading&&this._useEntireRowArea(e,t)&&(o={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,o,r.skip));let a=!1;const l={nested:!0,pack:!1};let d=0;for(;i=i||this.collide(e,o,r.skip);){if(d++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,{...i,y:e.y},e)||!this.collide(i,{...i,y:t.y-i.h},e))){e._skipDown=e._skipDown||t.y>e.y;const u={...t,y:i.y+i.h,...l};c=this._loading&&y.samePos(e,u)?!0:this.moveNode(e,u),(i.locked||this._loading)&&c?y.copyPos(t,e):!i.locked&&c&&r.pack&&(this._packNodes(),t.y=i.y+i.h,y.copyPos(e,t)),a=a||c}else c=this.moveNode(i,{...i,y:t.y+t.h,skip:e,...l});if(!c)return a;i=void 0}return a}collide(e,t=e,i){const r=e._id,o=i?._id;return this.nodes.find(a=>a._id!==r&&a._id!==o&&y.isIntercepted(a,t))}collideAll(e,t=e,i){const r=e._id,o=i?._id;return this.nodes.filter(a=>a._id!==r&&a._id!==o&&y.isIntercepted(a,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const r=e._rect,o={...t.rect};o.y>r.y?(o.h+=o.y-r.y,o.y=r.y):o.h+=r.y-o.y,o.x>r.x?(o.w+=o.x-r.x,o.x=r.x):o.w+=r.x-o.x;let a,l=.5;for(let d of i){if(d.locked||!d._rect)break;const c=d._rect;let u=Number.MAX_VALUE,h=Number.MAX_VALUE;r.y<c.y?u=(o.y+o.h-c.y)/c.h:r.y+r.h>c.y+c.h&&(u=(c.y+c.h-o.y)/c.h),r.x<c.x?h=(o.x+o.w-c.x)/c.w:r.x+r.w>c.x+c.w&&(h=(c.x+c.w-o.x)/c.w);const f=Math.min(h,u);f>l&&(l=f,a=d)}return t.collide=a,a}cacheRects(e,t,i,r,o,a){return this.nodes.forEach(l=>l._rect={y:l.y*t+i,x:l.x*e+a,w:l.w*e-a-r,h:l.h*t-i-o}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const o=t.x,a=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=o,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=a):(e.x=o,e.y=a),e._dirty=t._dirty=!0,!0}let r;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(r=y.isTouching(e,t)))return i();if(r!==!1){if(e.w===t.w&&e.x===t.x&&(r||(r=y.isTouching(e,t)))){if(t.y<e.y){const o=e;e=t,t=o}return i()}if(r!==!1){if(e.h===t.h&&e.y===t.y&&(r||(r=y.isTouching(e,t)))){if(t.x<e.x){const o=e;e=t,t=o}return i()}return!1}}}isAreaEmpty(e,t,i,r){const o={x:e||0,y:t||0,w:i||1,h:r||1};return!this.collide(o)}compact(e="compact",t=!0){if(this.nodes.length===0)return this;t&&this.sortNodes();const i=this.batchMode;i||this.batchUpdate();const r=this._inColumnResize;r||(this._inColumnResize=!0);const o=this.nodes;return this.nodes=[],o.forEach((a,l,d)=>{let c;a.locked||(a.autoPosition=!0,e==="list"&&l&&(c=d[l-1])),this.addNode(a,!1,c)}),r||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=y.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let t=e.y;for(;t>e._orig.y;)--t,this.collide(e,{x:e.x,y:t,w:e.w,h:e.h})||(e._dirty=!0,e.y=t)}):this.nodes.forEach((e,t)=>{if(!e.locked)for(;e.y>0;){const i=t===0?0:e.y-1;if(!(t===0||!this.collide(e,{x:e.x,y:i,w:e.w,h:e.h})))break;e._dirty=e.y!==i,e.y=i}}),this)}prepareNode(e,t){e._id=e._id??ke._idSeq++;const i=e.id;if(i){let o=1;for(;this.nodes.find(a=>a.id===e.id&&a!==e);)e.id=i+"_"+o++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const r={x:0,y:0,w:1,h:1};return y.defaults(e,r),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,y.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=r.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=r.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=r.w),isNaN(e.h)&&(e.h=r.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){const i=e._orig||y.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id&&this.findCacheLayout(e,this.defaultColumn)===-1){const o={...e};o.autoPosition||o.x===void 0?(delete o.x,delete o.y):o.x=Math.min(this.defaultColumn-1,o.x),o.w=Math.min(this.defaultColumn,o.w||1),this.cacheOneLayout(o,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(t?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(t?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),y.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!y.samePos(t,t._orig)):this.nodes.filter(t=>t._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const t=(e||[]).concat(this.getDirtyNodes());return this.onChange(t),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=y.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||y.samePos(e,e._orig)||(y.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,r){const o=r?r.y*i+(r.x+r.w):0;let a=!1;for(let l=o;!a;++l){const d=l%i,c=Math.floor(l/i);if(d+e.w>i)continue;const u={x:d,y:c,w:e.w,h:e.h};t.find(h=>y.isIntercepted(u,h))||((e.x!==d||e.y!==c)&&(e._dirty=!0),e.x=d,e.y=c,delete e.autoPosition,a=!0)}return a}addNode(e,t=!1,i){const r=this.nodes.find(a=>a._id===e._id);if(r)return r;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let o;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,o=!0),this.nodes.push(e),t&&this.addedNodes.push(e),o||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=!0,i=!1){return this.nodes.find(r=>r._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(r=>r._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,t=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(r=>r._removeDOM=!0);const i=this.nodes;return this.removedNodes=t?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(e,t);let i;const r=new ke({column:this.column,float:this.float,nodes:this.nodes.map(a=>a._id===e._id?(i={...a},i):{...a})});if(!i)return!1;const o=r.moveNode(i,t)&&r.getRow()<=Math.max(this.getRow(),this.maxRow);if(!o&&!t.resizing&&t.collide){const a=t.collide.el.gridstackNode;if(this.swap(e,a))return this._notify(),!0}return o?(r.nodes.filter(a=>a._dirty).forEach(a=>{const l=this.nodes.find(d=>d._id===a._id);l&&(y.copyPos(l,a),l._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new ke({column:this.column,float:this.float,nodes:this.nodes.map(r=>({...r}))}),i={...e};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow?(e._willFitPos=y.copyPos({},i),!0):!1}changedPosConstrain(e,t){return t.w=t.w||e.w,t.h=t.h||e.h,e.x!==t.x||e.y!==t.y?!0:(e.maxW&&(t.w=Math.min(t.w,e.maxW)),e.maxH&&(t.h=Math.min(t.h,e.maxH)),e.minW&&(t.w=Math.max(t.w,e.minW)),e.minH&&(t.h=Math.max(t.h,e.minH)),e.w!==t.w||e.h!==t.h)}moveNode(e,t){if(!e||!t)return!1;let i;t.pack===void 0&&!this.batchMode&&(i=t.pack=!0),typeof t.x!="number"&&(t.x=e.x),typeof t.y!="number"&&(t.y=e.y),typeof t.w!="number"&&(t.w=e.w),typeof t.h!="number"&&(t.h=e.h);const r=e.w!==t.w||e.h!==t.h,o=y.copyPos({},e,!0);if(y.copyPos(o,t),this.nodeBoundFix(o,r),y.copyPos(t,o),!t.forceCollide&&y.samePos(e,t))return!1;const a=y.copyPos({},e),l=this.collideAll(e,o,t.skip);let d=!0;if(l.length){const c=e._moving&&!t.nested;let u=c?this.directionCollideCoverage(e,t,l):l[0];if(c&&u&&e.grid?.opts?.subGridDynamic&&!e.grid._isTemp){const h=y.areaIntercept(t.rect,u._rect),f=y.area(t.rect),g=y.area(u._rect);h/(f<g?f:g)>.8&&(u.grid.makeSubGrid(u.el,void 0,e),u=void 0)}u?d=!this._fixCollisions(e,o,u,t):(d=!1,i&&delete t.pack)}return d&&!y.samePos(e,o)&&(e._dirty=!0,y.copyPos(e,o)),t.pack&&this._packNodes()._notify(),!y.samePos(e,a)}getRow(){return this.nodes.reduce((e,t)=>Math.max(e,t.y+t.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(t=>t._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,t){const i=this._layouts?.length,r=i&&this.column!==i-1?this._layouts[i-1]:null,o=[];return this.sortNodes(),this.nodes.forEach(a=>{const l=r?.find(c=>c._id===a._id),d={...a,...l||{}};y.removeInternalForSave(d,!e),t&&t(a,d),o.push(d)}),o}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,i)=>{if(!t||i===this.column)return this;if(i<this.column)this._layouts[i]=void 0;else{const r=i/this.column;e.forEach(o=>{if(!o._orig)return;const a=t.find(l=>l._id===o._id);a&&(a.y>=0&&o.y!==o._orig.y&&(a.y+=o.y-o._orig.y),o.x!==o._orig.x&&(a.x=Math.round(o.x*r)),o.w!==o._orig.w&&(a.w=Math.round(o.w*r)))})}}),this)}columnChanged(e,t,i="moveScale"){if(!this.nodes.length||!t||e===t)return this;const r=i==="compact"||i==="list";r&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let o=[],a=r?this.nodes:y.sort(this.nodes,-1);if(t>e&&this._layouts){const l=this._layouts[t]||[],d=this._layouts.length-1;!l.length&&e!==d&&this._layouts[d]?.length&&(e=d,this._layouts[d].forEach(c=>{const u=a.find(h=>h._id===c._id);u&&(!r&&!c.autoPosition&&(u.x=c.x??u.x,u.y=c.y??u.y),u.w=c.w??u.w,(c.x==null||c.y===void 0)&&(u.autoPosition=!0))})),l.forEach(c=>{const u=a.findIndex(h=>h._id===c._id);if(u!==-1){const h=a[u];if(r){h.w=c.w;return}(c.autoPosition||isNaN(c.x)||isNaN(c.y))&&this.findEmptyPosition(c,o),c.autoPosition||(h.x=c.x??h.x,h.y=c.y??h.y,h.w=c.w??h.w,o.push(h)),a.splice(u,1)}})}if(r)this.compact(i,!1);else{if(a.length)if(typeof i=="function")i(t,e,o,a);else{const l=r||i==="none"?1:t/e,d=i==="move"||i==="moveScale",c=i==="scale"||i==="moveScale";a.forEach(u=>{u.x=t===1?0:d?Math.round(u.x*l):Math.min(u.x,t-1),u.w=t===1||e===1?1:c?Math.round(u.w*l)||1:Math.min(u.w,t),o.push(u)}),a=[]}o=y.sort(o,-1),this._inColumnResize=!0,this.nodes=[],o.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!r),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const r=[];return e.forEach((o,a)=>{if(o._id===void 0){const l=o.id?this.nodes.find(d=>d.id===o.id):void 0;o._id=l?._id??ke._idSeq++}r[a]={x:o.x,y:o.y,w:o.w,_id:o._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=r,this}cacheOneLayout(e,t){e._id=e._id??ke._idSeq++;const i={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete i.x,delete i.y,e.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];const r=this.findCacheLayout(e,t);return r===-1?this._layouts[t].push(i):this._layouts[t][r]=i,this}findCacheLayout(e,t){return this._layouts?.[t]?.findIndex(i=>i._id===e._id)??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let t=0;t<this._layouts.length;t++){const i=this.findCacheLayout(e,t);i!==-1&&this._layouts[t].splice(i,1)}}cleanupNode(e){for(const t in e)t[0]==="_"&&t!=="_id"&&delete e[t];return this}}ke._idSeq=0;const ye={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class V{}const xe=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class Ne{}function _t(n,e){n.touches.length>1||(n.cancelable&&n.preventDefault(),y.simulateMouseEvent(n.changedTouches[0],e))}function Mn(n,e){n.cancelable&&n.preventDefault(),y.simulateMouseEvent(n,e)}function yt(n){Ne.touchHandled||(Ne.touchHandled=!0,_t(n,"mousedown"))}function Rt(n){Ne.touchHandled&&_t(n,"mousemove")}function Ct(n){if(!Ne.touchHandled)return;Ne.pointerLeaveTimeout&&(window.clearTimeout(Ne.pointerLeaveTimeout),delete Ne.pointerLeaveTimeout);const e=!!V.dragElement;_t(n,"mouseup"),e||_t(n,"click"),Ne.touchHandled=!1}function Et(n){n.pointerType!=="mouse"&&n.target.releasePointerCapture(n.pointerId)}function Bn(n){V.dragElement&&n.pointerType!=="mouse"&&Mn(n,"mouseenter")}function zn(n){V.dragElement&&n.pointerType!=="mouse"&&(Ne.pointerLeaveTimeout=window.setTimeout(()=>{delete Ne.pointerLeaveTimeout,Mn(n,"mouseleave")},10))}class Ot{constructor(e,t,i){this.host=e,this.dir=t,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const e=this.el=document.createElement("div");return e.classList.add("ui-resizable-handle"),e.classList.add(`${Ot.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),xe&&(this.el.addEventListener("touchstart",yt),this.el.addEventListener("pointerdown",Et)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),xe&&(this.el.removeEventListener("touchstart",yt),this.el.removeEventListener("pointerdown",Et)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),xe&&(this.el.addEventListener("touchmove",Rt),this.el.addEventListener("touchend",Ct)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const t=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),xe&&(this.el.removeEventListener("touchmove",Rt),this.el.removeEventListener("touchend",Ct)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){e.key==="Escape"&&(this.host.gridstackNode?.grid?.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}Ot.prefix="ui-resizable-";class ii{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,t){this._eventRegister[e]=t}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,t){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](t)}}class st extends ii{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const r=this.el.parentElement.getBoundingClientRect(),o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},a=this.temporalRect||o;return{position:{left:(a.left-r.left)*this.rectScale.x,top:(a.top-r.top)*this.rectScale.y},size:{width:a.width*this.rectScale.x,height:a.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const t=e.handles&&e.handles!==this.option.handles,i=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(r=>this.option[r]=e[r]),t&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),V.overResizeElement===this&&delete V.overResizeElement),this}_mouseOver(e){V.overResizeElement||V.dragElement||(V.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){V.overResizeElement===this&&(delete V.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Ot(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=y.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=y.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=y.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(t,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",t),this}_resizing(e,t){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,t),this._applyChange();const i=y.initEvent(e,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(e){const t=y.initEvent(e,{type:"resizestop",target:this.el});return this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),this._cleanHelper(),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=st._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,t=y.getValuesFromTransformedElement(e);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return st._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){const i=this.startEvent,r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},o=e.clientX-i.clientX,a=this.sizeToContent?0:e.clientY-i.clientY;let l,d;t.indexOf("e")>-1?r.width+=o:t.indexOf("w")>-1&&(r.width-=o,r.left+=o,l=!0),t.indexOf("s")>-1?r.height+=a:t.indexOf("n")>-1&&(r.height-=a,r.top+=a,d=!0);const c=this._constrainSize(r.width,r.height,l,d);return Math.round(r.width)!==Math.round(c.width)&&(t.indexOf("w")>-1&&(r.left+=r.width-c.width),r.width=c.width),Math.round(r.height)!==Math.round(c.height)&&(t.indexOf("n")>-1&&(r.top+=r.height-c.height),r.height=c.height),r}_constrainSize(e,t,i,r){const o=this.option,a=(i?o.maxWidthMoveLeft:o.maxWidth)||Number.MAX_SAFE_INTEGER,l=o.minWidth/this.rectScale.x||e,d=(r?o.maxHeightMoveUp:o.maxHeight)||Number.MAX_SAFE_INTEGER,c=o.minHeight/this.rectScale.y||t,u=Math.min(a,Math.max(l,e)),h=Math.min(d,Math.max(c,t));return{width:u,height:h}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const t=this.el.parentElement,{left:i,top:r}=t.getBoundingClientRect();e={left:i,top:r,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const i=this.temporalRect[t],r=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*r+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}st._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const vg='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class ot extends ii{constructor(e,t={}){super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=t?.handle?.substring(1),r=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:r?.subGrid?[e.querySelector(t.handle)||e]:Array.from(e.querySelectorAll(t.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),xe&&(e.addEventListener("touchstart",yt),e.addEventListener("pointerdown",Et))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),xe&&(t.removeEventListener("touchstart",yt),t.removeEventListener("pointerdown",Et))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this}_mouseDown(e){if(!V.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(vg)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete V.dragElement,delete V.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),xe&&(e.currentTarget.addEventListener("touchmove",Rt),e.currentTarget.addEventListener("touchend",Ct)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),V.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=y.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(e){const t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),V.pauseDrag){const i=Number.isInteger(V.pauseDrag)?V.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),i)}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=!0,V.dragElement=this;const i=this.el.gridstackNode?.grid;i?V.dropElement=i.el.ddElement.ddDroppable:delete V.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=y.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const r=y.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(r,this.ui()),this.triggerEvent("dragstart",r),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),xe&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Rt,!0),e.currentTarget.removeEventListener("touchend",Ct,!0)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),V.dropElement?.el===this.el.parentElement&&delete V.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const t=y.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(t),this.triggerEvent("dragstop",t),V.dropElement&&V.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete V.dragElement,delete V.dropElement,delete V.mouseHandled,e.preventDefault()}_keyEvent(e){const t=this.el.gridstackNode,i=t?.grid||V.dropElement?.el?.gridstack;if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i?.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!y.canBeRotated(t))return;t._origRotate=t._origRotate||{...t._orig},delete t._moving,i.setAnimation(!1).rotate(t.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),t._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,t.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",y.swap(t._orig,"w","h"),delete t._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=y.cloneNode(this.el)),e.parentElement||y.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=ot.originStyleProp.map(t=>this.el.style[t]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging");const t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, top",t.position="fixed",this._dragFollow(e),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null)},0),this}_removeHelperStyle(){if(this.helper.classList.remove("ui-draggable-dragging"),!this.helper?.gridstackNode?._isAboutToRemove&&this.dragElementOriginStyle){const t=this.helper,i=this.dragElementOriginStyle.transition||null;t.style.transition=this.dragElementOriginStyle.transition="none",ot.originStyleProp.forEach(r=>t.style[r]=this.dragElementOriginStyle[r]||null),setTimeout(()=>t.style.transition=i,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const t={left:0,top:0},i=this.helper.style,r=this.dragOffset;i.left=(e.clientX+r.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+r.offsetTop-t.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,t,i){let r=0,o=0;i&&(r=this.dragTransform.xOffset,o=this.dragTransform.yOffset);const a=t.getBoundingClientRect();return{left:a.left,top:a.top,offsetLeft:-e.clientX+a.left-r,offsetTop:-e.clientY+a.top-o,width:a.width*this.dragTransform.xScale,height:a.height*this.dragTransform.yScale}}ui(){const t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-t.top)*this.dragTransform.yScale,left:(i.left-t.left)*this.dragTransform.xScale}}}}ot.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class Sg extends ii{constructor(e,t={}){super(),this.el=e,this.option=t,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),xe&&(this.el.addEventListener("pointerenter",Bn),this.el.addEventListener("pointerleave",zn)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),xe&&(this.el.removeEventListener("pointerenter",Bn),this.el.removeEventListener("pointerleave",zn)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this._setupAccept(),this}_mouseEnter(e){if(!V.dragElement||!this._canDrop(V.dragElement.el))return;e.preventDefault(),e.stopPropagation(),V.dropElement&&V.dropElement!==this&&V.dropElement._mouseLeave(e,!0),V.dropElement=this;const t=y.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(V.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){if(!V.dragElement||V.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const i=y.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(V.dragElement)),this.triggerEvent("dropout",i),V.dropElement===this&&(delete V.dropElement,!t)){let r,o=this.el.parentElement;for(;!r&&o;)r=o.ddElement?.ddDroppable,o=o.parentElement;r&&r._mouseEnter(e)}}drop(e){e.preventDefault();const t=y.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(V.dragElement)),this.triggerEvent("drop",t)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class ni{static init(e){return e.ddElement||(e.ddElement=new ni(e)),e.ddElement}constructor(e){this.el=e}on(e,t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,t),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new ot(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new st(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new Sg(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class xg{resizable(e,t,i,r){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddResizable&&o.ddResizable[t]();else if(t==="destroy")o.ddResizable&&o.cleanResizable();else if(t==="option")o.setupResizable({[i]:r});else{const l=o.el.gridstackNode.grid;let d=o.el.getAttribute("gs-resize-handles")||l.opts.resizable.handles||"e,s,se";d==="all"&&(d="n,e,s,w,se,sw,ne,nw");const c=!l.opts.alwaysShowResizeHandle;o.setupResizable({...l.opts.resizable,handles:d,autoHide:c,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,r){return this._getDDElements(e,t).forEach(o=>{if(t==="disable"||t==="enable")o.ddDraggable&&o.ddDraggable[t]();else if(t==="destroy")o.ddDraggable&&o.cleanDraggable();else if(t==="option")o.setupDraggable({[i]:r});else{const a=o.el.gridstackNode.grid;o.setupDraggable({...a.opts.draggable,start:t.start,stop:t.stop,drag:t.drag})}}),this}dragIn(e,t){return this._getDDElements(e).forEach(i=>i.setupDraggable(t)),this}droppable(e,t,i,r){return typeof t.accept=="function"&&!t._accept&&(t._accept=t.accept,t.accept=o=>t._accept(o)),this._getDDElements(e,t).forEach(o=>{t==="disable"||t==="enable"?o.ddDroppable&&o.ddDroppable[t]():t==="destroy"?o.ddDroppable&&o.cleanDroppable():t==="option"?o.setupDroppable({[i]:r}):o.setupDroppable(t)}),this}isDroppable(e){return!!(e?.ddElement?.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){return!!(e?.ddElement?.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){return!!(e?.ddElement?.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(r=>r.on(t,o=>{i(o,V.dragElement?V.dragElement.el:o.target,V.dragElement?V.dragElement.helper:null)})),this}off(e,t){return this._getDDElements(e).forEach(i=>i.off(t)),this}_getDDElements(e,t){const i=e.gridstack||t!=="destroy"&&t!=="disable",r=y.getElements(e);return r.length?r.map(a=>a.ddElement||(i?ni.init(a):null)).filter(a=>a):[]}}const _e=new xg;class ${static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=$.getGridElement(t);return i?(i.gridstack||(i.gridstack=new $(i,y.cloneDeep(e))),i.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
14
14
  Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(e={},t=".grid-stack"){const i=[];return typeof document>"u"||($.getGridElements(t).forEach(r=>{r.gridstack||(r.gridstack=new $(r,y.cloneDeep(e))),i.push(r.gridstack)}),i.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
15
- Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(e,t={}){if(!e)return null;let i=e;if(i.gridstack){const a=i.gridstack;return t&&(a.opts={...a.opts,...t}),t.children!==void 0&&a.load(t.children),a}return(!e.classList.contains("grid-stack")||$.addRemoveCB)&&($.addRemoveCB?i=$.addRemoveCB(e,t,!0,!0):i=y.createDiv(["grid-stack",t.class],e)),$.init(t,i)}static registerEngine(e){$.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=y.createDiv([this.opts.placeholderClass,ye.itemClass,this.opts.itemClass]);const e=y.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,t={}){this.el=e,this.opts=t,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=t=t||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),t.row&&(t.minRow=t.maxRow=t.row,delete t.row);const i=y.toNumber(e.getAttribute("gs-row"));t.column==="auto"&&delete t.column,t.alwaysShowResizeHandle!==void 0&&(t._alwaysShowResizeHandle=t.alwaysShowResizeHandle);let r=t.columnOpts?.breakpoints;const o=t;if(o.oneColumnModeDomSort&&(delete o.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),o.oneColumnSize||o.disableOneColumnMode===!1){const h=o.oneColumnSize||768;delete o.oneColumnSize,delete o.disableOneColumnMode,t.columnOpts=t.columnOpts||{},r=t.columnOpts.breakpoints=t.columnOpts.breakpoints||[];let f=r.find(p=>p.c===1);f?f.w=h:(f={c:1,w:h},r.push(f,{c:12,w:h+1}))}const a=t.columnOpts;a&&(!a.columnWidth&&!a.breakpoints?.length?(delete t.columnOpts,r=void 0):a.columnMax=a.columnMax||12),r?.length>1&&r.sort((h,f)=>(f.w||0)-(h.w||0));const l={...y.cloneDeep(ye),column:y.toNumber(e.getAttribute("gs-column"))||ye.column,minRow:i||y.toNumber(e.getAttribute("gs-min-row"))||ye.minRow,maxRow:i||y.toNumber(e.getAttribute("gs-max-row"))||ye.maxRow,staticGrid:y.toBool(e.getAttribute("gs-static"))||ye.staticGrid,sizeToContent:y.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||ye.draggable.handle},removableOptions:{accept:t.itemClass||ye.removableOptions.accept,decline:ye.removableOptions.decline}};e.getAttribute("gs-animate")&&(l.animate=y.toBool(e.getAttribute("gs-animate"))),t=y.defaults(t,l),this._initMargin(),this.checkDynamicColumn(),this.el.classList.add("gs-"+t.column),t.rtl==="auto"&&(t.rtl=e.style.direction==="rtl"),t.rtl&&this.el.classList.add("grid-stack-rtl");const c=this.el.closest("."+ye.itemClass)?.gridstackNode;c&&(c.subGrid=this,this.parentGridNode=c,this.el.classList.add("grid-stack-nested"),c.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=t.cellHeight==="auto",this._isAutoCellHeight||t.cellHeight==="initial"?this.cellHeight(void 0,!1):(typeof t.cellHeight=="number"&&t.cellHeightUnit&&t.cellHeightUnit!==ye.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit),this.cellHeight(t.cellHeight,!1)),t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=xe),this._styleSheetClass="gs-id-"+ke._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const u=t.engineClass||$.engineClass||ke;if(this.engine=new u({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:h=>{let f=0;this.engine.nodes.forEach(p=>{f=Math.max(f,p.y+p.h)}),h.forEach(p=>{const C=p.el;C&&(p._removeDOM?(C&&C.remove(),delete p._removeDOM):this._writePosAttr(C,p))}),this._updateStyles(!1,f)}}),this._updateStyles(!1,0),t.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(h=>this._prepareElement(h)),delete this.engine._loading,this.batchUpdate(!1)),t.children){const h=t.children;delete t.children,h.length&&this.load(h)}this.setAnimation(),t.subGridDynamic&&!V.pauseDrag&&(V.pauseDrag=!0),t.draggable?.pause!==void 0&&(V.pauseDrag=t.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}addWidget(e){if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let t,i=e;if(i.grid=this,i?.el?t=i.el:$.addRemoveCB?t=$.addRemoveCB(this.el,e,!0,!1):t=this.createWidgetDivs(i),!t)return;if(i=t.gridstackNode,i&&t.parentElement===this.el&&this.engine.nodes.find(o=>o._id===i._id))return t;const r=this._readAttr(t);return y.defaults(e,r),this.engine.prepareNode(e),this.el.appendChild(t),this.makeWidget(t,e),t}createWidgetDivs(e){const t=y.createDiv(["grid-stack-item",this.opts.itemClass]),i=y.createDiv(["grid-stack-item-content"],t);return y.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([r])=>{r.isIntersecting&&(e.visibleObservable?.disconnect(),delete e.visibleObservable,$.renderCB(i,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(t))):$.renderCB(i,e),t}makeSubGrid(e,t,i,r=!0){let o=e.gridstackNode;if(o||(o=this.makeWidget(e).gridstackNode),o.subGrid?.el)return o.subGrid;let a,l=this;for(;l&&!a;)a=l.opts?.subGridOpts,l=l.parentGridNode?.grid;t=y.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...a||{},...t||o.subGridOpts||{}}),o.subGridOpts=t;let d;t.column==="auto"&&(d=!0,t.column=Math.max(o.w||1,i?.w||1),delete t.columnOpts);let c=o.el.querySelector(".grid-stack-item-content"),u,h;if(r&&(this._removeDD(o.el),h={...o,x:0,y:0},y.removeInternalForSave(h),delete h.subGridOpts,o.content&&(h.content=o.content,delete o.content),$.addRemoveCB?u=$.addRemoveCB(this.el,h,!0,!1):(u=y.createDiv(["grid-stack-item"]),u.appendChild(c),c=y.createDiv(["grid-stack-item-content"],o.el)),this.prepareDragDrop(o.el)),i){const p=d?t.column:o.w,C=o.h+i.h,E=o.el.style;E.transition="none",this.update(o.el,{w:p,h:C}),setTimeout(()=>E.transition=null)}const f=o.subGrid=$.addGrid(c,t);return i?._moving&&(f._isTemp=!0),d&&(f._autoColumn=!0),r&&f.makeWidget(u,h),i&&(i._moving?window.setTimeout(()=>y.simulateMouseEvent(i._event,"mouseenter",f.el),0):f.makeWidget(o.el,o)),this.resizeToContentCheck(!1,o),f}removeAsSubGrid(e){const t=this.parentGridNode?.grid;t&&(t.batchUpdate(),t.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(i=>{i.x+=this.parentGridNode.x,i.y+=this.parentGridNode.y,t.makeWidget(i.el,i)}),t.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>y.simulateMouseEvent(e._event,"mouseenter",t.el),0))}save(e=!0,t=!1,i=$.saveCB){const r=this.engine.save(e,i);if(r.forEach(o=>{if(e&&o.el&&!o.subGrid&&!i){const a=o.el.querySelector(".grid-stack-item-content");o.content=a?.innerHTML,o.content||delete o.content}else if(!e&&!i&&delete o.content,o.subGrid?.el){const a=o.subGrid.save(e,t,i);o.subGridOpts=t?a:{children:a},delete o.subGrid}delete o.el}),t){const o=y.cloneDeep(this.opts);o.marginBottom===o.marginTop&&o.marginRight===o.marginLeft&&o.marginTop===o.marginRight&&(o.margin=o.marginTop,delete o.marginTop,delete o.marginRight,delete o.marginBottom,delete o.marginLeft),o.rtl===(this.el.style.direction==="rtl")&&(o.rtl="auto"),this._isAutoCellHeight&&(o.cellHeight="auto"),this._autoColumn&&(o.column="auto");const a=o._alwaysShowResizeHandle;return delete o._alwaysShowResizeHandle,a!==void 0?o.alwaysShowResizeHandle=a:delete o.alwaysShowResizeHandle,y.removeInternalAndSame(o,ye),o.children=r,o}return r}load(e,t=$.addRemoveCB||!0){e=y.cloneDeep(e);const i=this.getColumn();e.forEach(c=>{c.w=c.w||1,c.h=c.h||1}),e=y.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let r=0;e.forEach(c=>{r=Math.max(r,(c.x||0)+c.w)}),r>this.engine.defaultColumn&&(this.engine.defaultColumn=r),r>i&&this.engine.cacheLayout(e,r,!0);const o=$.addRemoveCB;typeof t=="function"&&($.addRemoveCB=t);const a=[];this.batchUpdate();const l=!this.engine.nodes.length;l&&this.setAnimation(!1),!l&&t&&[...this.engine.nodes].forEach(u=>{if(!u.id)return;y.find(e,u.id)||($.addRemoveCB&&$.addRemoveCB(this.el,u,!1,!1),a.push(u),this.removeWidget(u.el,!0,!1))}),this.engine._loading=!0;const d=[];return this.engine.nodes=this.engine.nodes.filter(c=>y.find(e,c.id)?(d.push(c),!1):!0),e.forEach(c=>{const u=y.find(d,c.id);if(u){if(y.shouldSizeToContent(u)&&(c.h=u.h),this.engine.nodeBoundFix(c),(c.autoPosition||c.x===void 0||c.y===void 0)&&(c.w=c.w||u.w,c.h=c.h||u.h,this.engine.findEmptyPosition(c)),this.engine.nodes.push(u),y.samePos(u,c)&&this.engine.nodes.length>1&&(this.moveNode(u,{...c,forceCollide:!0}),y.copyPos(c,u)),this.update(u.el,c),c.subGridOpts?.children){const h=u.el.querySelector(".grid-stack");h&&h.gridstack&&h.gridstack.load(c.subGridOpts.children)}}else t&&this.addWidget(c)}),delete this.engine._loading,this.engine.removedNodes=a,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,o?$.addRemoveCB=o:delete $.addRemoveCB,l&&this.opts?.animate&&this.setAnimation(this.opts.animate,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const t=this.el.querySelector("."+this.opts.itemClass);if(t){const r=y.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/r)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(e,t=!0){if(t&&e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const r=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+r}const i=y.parseHeight(e);return this.opts.cellHeightUnit===i.unit&&this.opts.cellHeight===i.h?this:(this.opts.cellHeightUnit=i.unit,this.opts.cellHeight=i.h,this.resizeToContentCheck(),t&&this._updateStyles(!0),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){return e&&this.opts.columnOpts?.breakpointForWindow?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!e.breakpoints?.length)return!1;const t=this.getColumn();let i=t;const r=this._widthOrContainer(!0);if(e.columnWidth)i=Math.min(Math.round(r/e.columnWidth)||1,e.columnMax);else{i=e.columnMax;let o=0;for(;o<e.breakpoints.length&&r<=e.breakpoints[o].w;)i=e.breakpoints[o++].c||t}if(i!==t){const o=e.breakpoints?.find(a=>a.c===i);return this.column(i,o?.layout||e.layout),!0}return!1}compact(e="compact",t=!0){return this.engine.compact(e,t),this._triggerChangeEvent(),this}column(e,t="moveScale"){if(!e||e<1||this.opts.column===e)return this;const i=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+i),this.el.classList.add("gs-"+e),this.engine.columnChanged(i,e,t),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):this}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.classList.remove(this._styleSheetClass),this.el.removeAttribute("gs-current-row")),this._removeStylesheet(),delete this.parentGridNode?.subGrid,delete this.parentGridNode,delete this.opts,delete this._placeholder?.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,t=!1){const i=this.el.getBoundingClientRect();let r;t?r={top:i.top+document.documentElement.scrollTop,left:i.left}:r={top:this.el.offsetTop,left:this.el.offsetLeft};const o=e.left-r.left,a=e.top-r.top,l=i.width/this.getColumn(),d=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(o/l),y:Math.floor(a/d)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(e,t,i,r){return this.engine.isAreaEmpty(e,t,i,r)}makeWidget(e,t){const i=$.getElement(e);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const r=i.gridstackNode;this._updateContainerHeight(),r.subGridOpts&&this.makeSubGrid(i,r.subGridOpts,void 0,!1);let o;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(o=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),o&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(r=>this.on(r,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=r=>t(r):this._gsEventHandler[e]=r=>{r.detail&&t(r,r.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=!0,i=!0){return e?($.getElements(e).forEach(r=>{if(r.parentElement&&r.parentElement!==this.el)return;let o=r.gridstackNode;o||(o=this.engine.nodes.find(a=>r===a.el)),o&&(t&&$.addRemoveCB&&$.addRemoveCB(this.el,o,!1,!1),delete r.gridstackNode,this._removeDD(r),this.engine.removeNode(o,t,i),t&&r.parentElement&&r.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,t=!0){return this.engine.nodes.forEach(i=>{e&&$.addRemoveCB&&$.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(e,t),t&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,t=!0,i=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(r=>{this.prepareDragDrop(r.el),r.subGrid&&i&&r.subGrid.setStatic(e,t,i)}),t&&this._setStaticClass(),this)}updateOptions(e){const t=this.opts;return e.acceptWidgets!==void 0&&this._setupAcceptWidget(),e.animate!==void 0&&this.setAnimation(),e.cellHeight&&(this.cellHeight(e.cellHeight,!0),delete e.cellHeight),e.class&&e.class!==t.class&&(t.class&&this.el.classList.remove(t.class),this.el.classList.add(e.class)),typeof e.column=="number"&&!e.columnOpts&&(this.column(e.column),delete e.column),e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0&&(t.minRow=t.maxRow=e.row),e.children?.length&&(this.load(e.children),delete e.children),this.opts={...this.opts,...e},this}update(e,t){return $.getElements(e).forEach(i=>{const r=i?.gridstackNode;if(!r)return;const o={...y.copyPos({},r),...y.cloneDeep(t)};this.engine.nodeBoundFix(o),delete o.autoPosition;const a=["x","y","w","h"];let l;if(a.some(u=>o[u]!==void 0&&o[u]!==r[u])&&(l={},a.forEach(u=>{l[u]=o[u]!==void 0?o[u]:r[u],delete o[u]})),!l&&(o.minW||o.minH||o.maxW||o.maxH)&&(l={}),o.content!==void 0){const u=i.querySelector(".grid-stack-item-content");u&&u.textContent!==o.content&&(r.content=o.content,$.renderCB(u,o),r.subGrid?.el&&(u.appendChild(r.subGrid.el),r.subGrid.opts.styleInHead||r.subGrid._updateStyles(!0))),delete o.content}let d=!1,c=!1;for(const u in o)u[0]!=="_"&&r[u]!==o[u]&&(r[u]=o[u],d=!0,c=c||!this.opts.staticGrid&&(u==="noResize"||u==="noMove"||u==="locked"));if(y.sanitizeMinMax(r),l){const u=l.w!==void 0&&l.w!==r.w;this.moveNode(r,l),u&&r.subGrid?r.subGrid.onResize(this.hasAnimationCSS()?r.w:void 0):this.resizeToContentCheck(u,r),delete r._orig}(l||d)&&this._writeAttr(i,r),c&&this.prepareDragDrop(r.el)}),this}moveNode(e,t){const i=e._updating;i||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,t),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const t=e.gridstackNode;if(!t)return;const i=t.grid;if(!i||e.parentElement!==i.el)return;const r=i.getCellHeight(!0);if(!r)return;let o=t.h?t.h*r:e.clientHeight,a;if(t.resizeToContentParent&&(a=e.querySelector(t.resizeToContentParent)),a||(a=e.querySelector($.resizeToContentParent)),!a)return;const l=e.clientHeight-a.clientHeight,d=t.h?t.h*r-l:a.clientHeight;let c;if(t.subGrid){c=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const f=t.subGrid.el.getBoundingClientRect(),p=t.subGrid.el.parentElement.getBoundingClientRect();c+=f.top-p.top}else{if(t.subGridOpts?.children?.length)return;{const f=a.firstElementChild;if(!f){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${$.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=f.getBoundingClientRect().height||d}}if(d===c)return;o+=c-d;let u=Math.ceil(o/r);const h=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;h&&u>h&&(u=h,e.classList.add("size-to-content-max")),t.minH&&u<t.minH?u=t.minH:t.maxH&&u>t.maxH&&(u=t.maxH),u!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h:u}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){$.resizeToContentCB?$.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return $.getElements(e).forEach(i=>{const r=i.gridstackNode;if(!y.canBeRotated(r))return;const o={w:r.h,h:r.w,minH:r.minW,minW:r.minH,maxH:r.maxW,maxW:r.maxH};if(t){const l=t.left>0?Math.floor(t.left/this.cellWidth()):0,d=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;o.x=r.x+l-(r.h-(d+1)),o.y=r.y+d-l}Object.keys(o).forEach(l=>{o[l]===void 0&&delete o[l]});const a=r._orig;this.update(i,o),r._orig=a}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const i=y.parseHeight(e);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this._updateStyles(!0),this}getMargin(){return this.opts.margin}willItFit(e){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const t=arguments;let i=0,r={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++]};return this.willItFit(r)}return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){if(this.engine.batchMode)return this;if(this.engine.addedNodes?.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(t=>{delete t._dirty});const e=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",e)}return this}_triggerRemoveEvent(){if(this.engine.batchMode)return this;if(this.engine.removedNodes?.length){const e=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",e)}return this}_triggerEvent(e,t){const i=t?new CustomEvent(e,{bubbles:!1,detail:t}):new Event(e);return this.el.dispatchEvent(i),this}_removeStylesheet(){if(this._styles){const e=this.opts.styleInHead?void 0:this.el.parentNode;y.removeStylesheet(this._styleSheetClass,e),delete this._styles}return this}_updateStyles(e=!1,t){if(e&&this._removeStylesheet(),t===void 0&&(t=this.getRow()),this._updateContainerHeight(),this.opts.cellHeight===0)return this;const i=this.opts.cellHeight,r=this.opts.cellHeightUnit,o=`.${this._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){const a=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=y.createStylesheet(this._styleSheetClass,a,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,y.addCSSRule(this._styles,o,`height: ${i}${r}`);const l=this.opts.marginTop+this.opts.marginUnit,d=this.opts.marginBottom+this.opts.marginUnit,c=this.opts.marginRight+this.opts.marginUnit,u=this.opts.marginLeft+this.opts.marginUnit,h=`${o} > .grid-stack-item-content`,f=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;y.addCSSRule(this._styles,h,`top: ${l}; right: ${c}; bottom: ${d}; left: ${u};`),y.addCSSRule(this._styles,f,`top: ${l}; right: ${c}; bottom: ${d}; left: ${u};`),y.addCSSRule(this._styles,`${o} > .ui-resizable-n`,`top: ${l};`),y.addCSSRule(this._styles,`${o} > .ui-resizable-s`,`bottom: ${d}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-ne`,`right: ${c}; top: ${l}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-e`,`right: ${c}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-se`,`right: ${c}; bottom: ${d}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-nw`,`left: ${u}; top: ${l}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-w`,`left: ${u}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-sw`,`left: ${u}; bottom: ${d}`)}if(t=t||this._styles._max,t>this._styles._max){const a=l=>i*l+r;for(let l=this._styles._max+1;l<=t;l++)y.addCSSRule(this._styles,`${o}[gs-y="${l}"]`,`top: ${a(l)}`),y.addCSSRule(this._styles,`${o}[gs-h="${l+1}"]`,`height: ${a(l+1)}`);this._styles._max=t}return this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const e=this.parentGridNode;let t=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,r=this.opts.cellHeightUnit;if(!i)return this;if(!e){const o=y.parseHeight(getComputedStyle(this.el).minHeight);if(o.h>0&&o.unit===r){const a=Math.floor(o.h/i);t<a&&(t=a)}}return this.el.setAttribute("gs-current-row",String(t)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),t&&(this.el.style[e?"minHeight":"height"]=t*i+r),e&&!e.grid.engine.batchMode&&y.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,t=!1,i){i=i||this._readAttr(e),e.gridstackNode=i,i.el=e,i.grid=this,i=this.engine.addNode(i,t),this._writeAttr(e,i),e.classList.add(ye.itemClass,this.opts.itemClass);const r=y.shouldSizeToContent(i);return r?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),r&&this.resizeToContentCheck(!1,i),y.lazyLoad(i)||this.prepareDragDrop(i.el),this}_writePosAttr(e,t){return t.x!==void 0&&t.x!==null&&e.setAttribute("gs-x",String(t.x)),t.y!==void 0&&t.y!==null&&e.setAttribute("gs-y",String(t.y)),t.w>1?e.setAttribute("gs-w",String(t.w)):e.removeAttribute("gs-w"),t.h>1?e.setAttribute("gs-h",String(t.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,t){if(!t)return this;this._writePosAttr(e,t);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const r in i)t[r]?e.setAttribute(i[r],String(t[r])):e.removeAttribute(i[r]);return this}_readAttr(e,t=!0){const i={};i.x=y.toNumber(e.getAttribute("gs-x")),i.y=y.toNumber(e.getAttribute("gs-y")),i.w=y.toNumber(e.getAttribute("gs-w")),i.h=y.toNumber(e.getAttribute("gs-h")),i.autoPosition=y.toBool(e.getAttribute("gs-auto-position")),i.noResize=y.toBool(e.getAttribute("gs-no-resize")),i.noMove=y.toBool(e.getAttribute("gs-no-move")),i.locked=y.toBool(e.getAttribute("gs-locked"));const r=e.getAttribute("gs-size-to-content");r&&(r==="true"||r==="false"?i.sizeToContent=y.toBool(r):i.sizeToContent=parseInt(r,10)),i.id=e.getAttribute("gs-id"),i.maxW=y.toNumber(e.getAttribute("gs-max-w")),i.minW=y.toNumber(e.getAttribute("gs-min-w")),i.maxH=y.toNumber(e.getAttribute("gs-max-h")),i.minH=y.toNumber(e.getAttribute("gs-min-h")),t&&(i.w===1&&e.removeAttribute("gs-w"),i.h===1&&e.removeAttribute("gs-h"),i.maxW&&e.removeAttribute("gs-max-w"),i.minW&&e.removeAttribute("gs-min-w"),i.maxH&&e.removeAttribute("gs-max-h"),i.minH&&e.removeAttribute("gs-min-h"));for(const o in i){if(!i.hasOwnProperty(o))return;!i[o]&&i[o]!==0&&o!=="gs-size-to-content"&&delete i[o]}return i}_setStaticClass(){const e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=this.el?.clientWidth){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let t=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),t=!0):t=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(i=>{i.subGrid&&i.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(t),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,t=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,t),this.animationDelay);if(t)y.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(i=>y.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(r=>{y.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el)}),this.batchUpdate(!1)}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,t?[t]:this.engine.nodes)}}_updateResizeEvent(e=!1){const t=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!e&&t&&!this.resizeObserver?(this._sizeThrottle=y.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!t)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return y.getElement(e)}static getElements(e=".grid-stack-item"){return y.getElements(e)}static getGridElement(e){return $.getElement(e)}static getGridElements(e){return y.getElements(e)}_initMargin(){let e,t=0,i=[];return typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(e=y.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,t=this.opts.margin=e.h),this.opts.marginTop===void 0?this.opts.marginTop=t:(e=y.parseHeight(this.opts.marginTop),this.opts.marginTop=e.h,delete this.opts.margin),this.opts.marginBottom===void 0?this.opts.marginBottom=t:(e=y.parseHeight(this.opts.marginBottom),this.opts.marginBottom=e.h,delete this.opts.margin),this.opts.marginRight===void 0?this.opts.marginRight=t:(e=y.parseHeight(this.opts.marginRight),this.opts.marginRight=e.h,delete this.opts.margin),this.opts.marginLeft===void 0?this.opts.marginLeft=t:(e=y.parseHeight(this.opts.marginLeft),this.opts.marginLeft=e.h,delete this.opts.margin),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop),this}static getDD(){return _e}static setupDragIn(e,t,i,r=document){t?.pause!==void 0&&(V.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?y.getElements(e,r):e).forEach((a,l)=>{_e.isDraggable(a)||_e.dragIn(a,t),i?.[l]&&(a.gridstackNode=i[l])})}movable(e,t){return this.opts.staticGrid?this:($.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noMove:r.noMove=!0,this.prepareDragDrop(r.el))}),this)}resizable(e,t){return this.opts.staticGrid?this:($.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noResize:r.noResize=!0,this.prepareDragDrop(r.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableMove(e,t)}),this)}enableResize(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableResize(e,t)}),this)}cancelDrag(){const e=this._placeholder?.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&$._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return _e.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return _e.droppable(this.el,"destroy"),this;let e,t;const i=(r,o,a)=>{a=a||o;const l=a.gridstackNode;if(!l)return;if(!l.grid?.el){a.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const f=a.getBoundingClientRect();a.style.left=f.x+(this.dragTransform.xScale-1)*(r.clientX-f.x)/this.dragTransform.xScale+"px",a.style.top=f.y+(this.dragTransform.yScale-1)*(r.clientY-f.y)/this.dragTransform.yScale+"px",a.style.transformOrigin="0px 0px"}let{top:d,left:c}=a.getBoundingClientRect();const u=this.el.getBoundingClientRect();c-=u.left,d-=u.top;const h={position:{top:d*this.dragTransform.xScale,left:c*this.dragTransform.yScale}};if(l._temporaryRemoved){if(l.x=Math.max(0,Math.round(c/t)),l.y=Math.max(0,Math.round(d/e)),delete l.autoPosition,this.engine.nodeBoundFix(l),!this.engine.willItFit(l)){if(l.autoPosition=!0,!this.engine.willItFit(l)){_e.off(o,"drag");return}l._willFitPos&&(y.copyPos(l,l._willFitPos),delete l._willFitPos)}this._onStartMoving(a,r,h,l,t,e)}else this._dragOrResize(a,r,h,l,t,e)};return _e.droppable(this.el,{accept:r=>{const o=r.gridstackNode||this._readAttr(r,!1);if(o?.grid===this)return!0;if(!this.opts.acceptWidgets)return!1;let a=!0;if(typeof this.opts.acceptWidgets=="function")a=this.opts.acceptWidgets(r);else{const l=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;a=r.matches(l)}if(a&&o&&this.opts.maxRow){const l={w:o.w,h:o.h,minW:o.minW,minH:o.minH};a=this.engine.willItFit(l)}return a}}).on(this.el,"dropover",(r,o,a)=>{let l=a?.gridstackNode||o.gridstackNode;if(l?.grid===this&&!l._temporaryRemoved)return!1;if(l?._sidebarOrig&&(l.w=l._sidebarOrig.w,l.h=l._sidebarOrig.h),l?.grid&&l.grid!==this&&!l._temporaryRemoved&&l.grid._leave(o,a),a=a||o,t=this.cellWidth(),e=this.getCellHeight(!0),!l){const u=a.getAttribute("data-gs-widget")||a.getAttribute("gridstacknode");if(u){try{l=JSON.parse(u)}catch{console.error("Gridstack dropover: Bad JSON format: ",u)}a.removeAttribute("data-gs-widget"),a.removeAttribute("gridstacknode")}l||(l=this._readAttr(a)),l._sidebarOrig={w:l.w,h:l.h}}l.grid||(l.el||(l={...l}),l._isExternal=!0,a.gridstackNode=l);const d=l.w||Math.round(a.offsetWidth/t)||1,c=l.h||Math.round(a.offsetHeight/e)||1;return l.grid&&l.grid!==this?(o._gridstackNodeOrig||(o._gridstackNodeOrig=l),o.gridstackNode=l={...l,w:d,h:c,grid:this},delete l.x,delete l.y,this.engine.cleanupNode(l).nodeBoundFix(l),l._initDD=l._isExternal=l._temporaryRemoved=!0):(l.w=d,l.h=c,l._temporaryRemoved=!0),$._itemRemoving(l.el,!1),_e.on(o,"drag",i),i(r,o,a),!1}).on(this.el,"dropout",(r,o,a)=>{const l=a?.gridstackNode||o.gridstackNode;return l&&(!l.grid||l.grid===this)&&(this._leave(o,a),this._isTemp&&this.removeAsSubGrid(l)),!1}).on(this.el,"drop",(r,o,a)=>{const l=a?.gridstackNode||o.gridstackNode;if(l?.grid===this&&!l._isExternal)return!1;const d=!!this.placeholder.parentElement,c=o!==a;this.placeholder.remove(),delete this.placeholder.gridstackNode;const u=d&&this.opts.animate;u&&this.setAnimation(!1);const h=o._gridstackNodeOrig;if(delete o._gridstackNodeOrig,d&&h?.grid&&h.grid!==this){const p=h.grid;p.engine.removeNodeFromLayoutCache(h),p.engine.removedNodes.push(h),p._triggerRemoveEvent()._triggerChangeEvent(),p.parentGridNode&&!p.engine.nodes.length&&p.opts.subGridDynamic&&p.removeAsSubGrid()}if(!l||(d&&(this.engine.cleanupNode(l),l.grid=this),delete l.grid?._isTemp,_e.off(o,"drag"),a!==o?(a.remove(),o=a):o.remove(),this._removeDD(o),!d))return!1;const f=l.subGrid?.el?.gridstack;return y.copyPos(l,this._readAttr(this.placeholder)),y.removePositioningStyles(o),c&&(l.content||l.subGridOpts||$.addRemoveCB)?(delete l.el,o=this.addWidget(l)):(this._prepareElement(o,!0,l),this.el.appendChild(o),this.resizeToContentCheck(!1,l),f&&(f.parentGridNode=l,f.opts.styleInHead||f._updateStyles(!0)),this._updateContainerHeight()),this.engine.addedNodes.push(l),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...r,type:"dropped"},h&&h.grid?h:void 0,l),u&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(e,t){if(!e)return;const i=e?e.gridstackNode:void 0;!i?.grid||e.classList.contains(i.grid.opts.removableOptions.decline)||(t?i._isAboutToRemove=!0:delete i._isAboutToRemove,t?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!_e.isDroppable(e)&&_e.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>$._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>$._itemRemoving(i,!1)),this):this}prepareDragDrop(e,t=!1){const i=e?.gridstackNode;if(!i)return;const r=i.noMove||this.opts.disableDrag,o=i.noResize||this.opts.disableResize,a=this.opts.staticGrid||r&&o;if((t||a)&&(i._initDD&&(this._removeDD(e),delete i._initDD),a&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!t))return this;if(!i._initDD){let l,d;const c=(f,p)=>{this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,f.target),l=this.cellWidth(),d=this.getCellHeight(!0),this._onStartMoving(e,f,p,i,l,d)},u=(f,p)=>{this._dragOrResize(e,f,p,i,l,d)},h=f=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._event,delete i._lastTried;const p=i.w!==i._orig.w,C=f.target;if(!(!C.gridstackNode||C.gridstackNode.grid!==this)){if(i.el=C,i._isAboutToRemove){const E=e.gridstackNode.grid;E._gsEventHandler[f.type]&&E._gsEventHandler[f.type](f,C),E.engine.nodes.push(i),E.removeWidget(e,!0,!0)}else y.removePositioningStyles(C),i._temporaryRemoved?(y.copyPos(i,i._orig),this._writePosAttr(C,i),this.engine.addNode(i)):this._writePosAttr(C,i),this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,C);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),f.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(p,i))}};_e.draggable(e,{start:c,stop:h,drag:u}).resizable(e,{start:c,stop:h,resize:u}),i._initDD=!0}return _e.draggable(e,r?"disable":"enable").resizable(e,o?"disable":"enable"),this}_onStartMoving(e,t,i,r,o,a){if(this.engine.cleanNodes().beginUpdate(r),this._writePosAttr(this.placeholder,r),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=r,r.grid?.el)this.dragTransform=y.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=y.getValuesFromTransformedElement(l)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(r.el=this.placeholder,r._lastUiPosition=i.position,r._prevYPix=i.position.top,r._moving=t.type==="dragstart",delete r._lastTried,t.type==="dropover"&&r._temporaryRemoved&&(this.engine.addNode(r),r._moving=!0),this.engine.cacheRects(o,a,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){const l=this.getColumn()-r.x,d=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-r.y;_e.resizable(e,"option","minWidth",o*Math.min(r.minW||1,l)).resizable(e,"option","minHeight",a*Math.min(r.minH||1,d)).resizable(e,"option","maxWidth",o*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",o*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,r.x+r.w)).resizable(e,"option","maxHeight",a*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,d)).resizable(e,"option","maxHeightMoveUp",a*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,r.y+r.h))}}_dragOrResize(e,t,i,r,o,a){const l={...r._orig};let d,c=this.opts.marginLeft,u=this.opts.marginRight,h=this.opts.marginTop,f=this.opts.marginBottom;const p=Math.round(a*.1),C=Math.round(o*.1);if(c=Math.min(c,C),u=Math.min(u,C),h=Math.min(h,p),f=Math.min(f,p),t.type==="drag"){if(r._temporaryRemoved)return;const R=i.position.top-r._prevYPix;r._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&y.updateScrollPosition(e,i.position,R);const I=i.position.left+(i.position.left>r._lastUiPosition.left?-u:c),D=i.position.top+(i.position.top>r._lastUiPosition.top?-f:h);l.x=Math.round(I/o),l.y=Math.round(D/a);const w=this._extraDragRow;if(this.engine.collide(r,l)){const O=this.getRow();let S=Math.max(0,l.y+r.h-O);this.opts.maxRow&&O+S>this.opts.maxRow&&(S=Math.max(0,this.opts.maxRow-O)),this._extraDragRow=S}else this._extraDragRow=0;if(this._extraDragRow!==w&&this._updateContainerHeight(),r.x===l.x&&r.y===l.y)return}else if(t.type==="resize"){if(l.x<0||(y.updateScrollResize(t,e,a),l.w=Math.round((i.size.width-c)/o),l.h=Math.round((i.size.height-h)/a),r.w===l.w&&r.h===l.h)||r._lastTried&&r._lastTried.w===l.w&&r._lastTried.h===l.h)return;const R=i.position.left+c,I=i.position.top+h;l.x=Math.round(R/o),l.y=Math.round(I/a),d=!0}r._event=t,r._lastTried=l;const E={x:i.position.left+c,y:i.position.top+h,w:(i.size?i.size.width:r.w*o)-c-u,h:(i.size?i.size.height:r.h*a)-h-f};if(this.engine.moveNodeCheck(r,{...l,cellWidth:o,cellHeight:a,rect:E,resizing:d})){r._lastUiPosition=i.position,this.engine.cacheRects(o,a,h,u,f,c),delete r._skipDown,d&&r.subGrid&&r.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const R=t.target;r._sidebarOrig||this._writePosAttr(R,r),this._gsEventHandler[t.type]&&this._gsEventHandler[t.type](t,R)}}_leave(e,t){t=t||e;const i=t.gridstackNode;if(!i||(t.style.transform=t.style.transformOrigin=null,_e.off(e,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e;const r=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=r,this.opts.removable===!0&&$._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return Cg(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}$.renderCB=(n,e)=>{n&&e?.content&&(n.textContent=e.content)},$.resizeToContentParent=".grid-stack-item-content",$.Utils=y,$.Engine=ke,$.GDRev="11.5.1";const wg=(n,e)=>{let t=0;const i=new Map;e.forEach(o=>{const a=o.layout.position.row,l=i.get(a),d=o.layout.size.rows===1&&!!o.layout.size.fit_to_content;t=Math.max(t,a+o.layout.size.rows),l===void 0?i.set(a,d):i.set(a,l&&d)});const r=[];for(let o=0;o<t;o++)i.get(o)?r.push("auto"):r.push(`${n}px`);return r},Pn=(n,e,t)=>e.get(`${n.id}`)??n.layout.size.rows*t,Tg=(n,e,t,i)=>e.map((r,o)=>{if(r!=="auto")return i;const a=n.filter(l=>l.layout.position.row===o);return Math.max(...a.map(l=>Pn(l,t,i)))}),vg=(n,e,t)=>{const i=[...n].sort((a,l)=>a.layout.position.row-l.layout.position.row||a.layout.position.col-l.layout.position.col),r=new Map;let o=0;return i.forEach(a=>{const l=Pn(a,e,t);r.set(`${a.id}`,{x:0,y:o,w:1,h:l}),o+=l}),r},Sg=(n,e,t,{cellsPerRow:i,columns:r})=>{if(r===1)return vg(n,t,i);const o=[0];return Tg(n,e,t,i).forEach(a=>{o.push(o[o.length-1]+a)}),new Map(n.map(a=>{const{position:l,size:d}=a.layout,c=o[l.row],u=o[l.row+d.rows];return[`${a.id}`,{x:l.col,y:c,w:d.cols,h:u-c}]}))},xg=["data-id","data-testid"],Ig={class:"grid-stack-item-content"},Dg=Se(s.defineComponent({__name:"DraggableGridLayout",props:{tiles:{},tileHeight:{default:tt},columns:{default:Bt},editable:{type:Boolean,default:!1},bottomTrim:{default:0}},emits:["update-tiles"],setup(n,{expose:e,emit:t}){const i=n,r=t,o=s.ref(null),a=s.ref(new Map(i.tiles.map(b=>[`${b.id}`,b])));let l=null,d=!1;const c=b=>`[data-id="${b}"]`,u=s.computed(()=>wg(i.tileHeight,i.tiles)),h=b=>!i.editable&&u.value[b.layout.position.row]==="auto",f=()=>i.editable?1:it,p=parseInt(la,10)/2,C=s.ref(new Map),E=s.ref(new Map),R=s.ref(!1),I=b=>R.value||h(b),D=s.computed(()=>Sg(i.tiles,u.value,C.value,{cellsPerRow:it,columns:R.value?1:i.columns})),w=s.computed(()=>{if(i.editable)return 0;const T=(R.value?[...i.tiles].sort((N,ae)=>N.layout.position.row-ae.layout.position.row||N.layout.position.col-ae.layout.position.col).slice(-1):i.tiles.filter(N=>N.layout.position.row===u.value.length-1)).filter(N=>C.value.has(`${N.id}`));if(!T.length||!T.every(I))return 0;const A=Math.max(...T.map(N=>C.value.get(`${N.id}`))),k=Math.max(...T.map(N=>E.value.get(`${N.id}`))),z=A*(i.tileHeight/it)-(k+2*p);return Math.max(0,Math.round(z*100)/100)}),O=b=>i.editable?{id:`${b.id}`,x:b.layout.position.col,y:b.layout.position.row,w:b.layout.size.cols,h:b.layout.size.rows}:{id:`${b.id}`,...D.value.get(`${b.id}`)},S=()=>({margin:p,column:i.columns,cellHeight:i.tileHeight/f(),resizable:{handles:"se, sw"},handle:".tile-header",staticGrid:!i.editable,float:!i.editable}),U=b=>b.map(T=>{const A=a.value.get(`${T.el?.getAttribute("data-id")}`);if(A)return{...A,layout:{position:{col:Number(T.x),row:Number(T.y)},size:{...A.layout.size,cols:Number(T.w),rows:Number(T.h)}}}}).filter(T=>T!==void 0),K=(b,T)=>{l&&!d&&(U(T).forEach(k=>{a.value.set(`${k.id}`,k)}),r("update-tiles",Array.from(a.value.values())))},m=(b,T)=>{T.forEach(A=>{a.value.delete(`${A.el?.getAttribute("data-id")}`)}),r("update-tiles",Array.from(a.value.values()))},g=b=>o.value?.querySelector(`${c(b)} > .grid-stack-item-content > :first-child`),_=b=>Math.ceil((b+2*p)/(i.tileHeight/it)),v=()=>{const b=new Map,T=new Map;i.tiles.filter(I).forEach(z=>{const N=g(z.id);if(N){const{height:ae}=N.getBoundingClientRect();b.set(`${z.id}`,_(ae)),T.set(`${z.id}`,ae)}}),(b.size!==C.value.size||[...b].some(([z,N])=>C.value.get(z)!==N))&&(C.value=b),(T.size!==E.value.size||[...T].some(([z,N])=>E.value.get(z)!==N))&&(E.value=T)},x=new ResizeObserver(()=>window.requestAnimationFrame(v)),q=()=>{x.disconnect(),i.tiles.filter(I).forEach(b=>{const T=g(b.id);T&&x.observe(T)})},P=new ResizeObserver(([b])=>{R.value=!i.editable&&b.contentRect.width<=parseInt(oa,10)}),W=(b,T)=>{const A=b.x===T.x&&b.y===T.y,k=b.w===T.w&&b.h===T.h;return A&&k},j=()=>{if(!l)return;const b=new Set(i.tiles.map(k=>`${k.id}`)),T=new Map(l.engine.nodes.map(k=>[`${k.id}`,k]));T.forEach((k,z)=>{!b.has(z)&&k.el&&(l.removeWidget(k.el,!1,!1),a.value.delete(z))});const A=i.tiles.filter(k=>T.has(`${k.id}`)).map(O);d=!0,A.some(k=>!W(T.get(`${k.id}`),k))&&l.load(A,!1),d=!1,i.tiles.filter(k=>!T.has(`${k.id}`)).forEach(k=>{l.makeWidget(c(k.id),{...O(k),autoPosition:i.editable})}),q()};s.onMounted(()=>{o.value&&(l=$.init(S(),o.value),l.batchUpdate(),i.tiles.forEach(b=>l.makeWidget(c(b.id),O(b))),l.batchUpdate(!1),q(),P.observe(o.value),i.editable&&(l.on("change",K),l.on("added",K),l.on("removed",m)))}),s.onUnmounted(()=>{x.disconnect(),P.disconnect(),l&&l.destroy(!1)});const F=b=>{if(l&&o.value){const T=o.value.querySelector(c(b));T&&l.removeWidget(T)}};return s.watch(R,b=>l?.column(b?1:i.columns,"none")),s.watch(()=>[i.tiles.map(b=>[b.id,b.layout]),D.value],j,{deep:!0,flush:"post"}),s.watchEffect(()=>{i.tiles.forEach(b=>{a.value.set(`${b.id}`,b)})}),e({removeWidget:F}),(b,T)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"gridContainer",ref:o,class:"grid-stack",style:s.normalizeStyle({marginBottom:`-${n.bottomTrim+w.value}px`})},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(i.tiles,A=>(s.openBlock(),s.createElementBlock("div",{key:A.id,"data-id":`${A.id}`,"data-testid":`grid-stack-item-${A.id}`},[s.createElementVNode("div",Ig,[s.renderSlot(b.$slots,"tile",{fitToContent:h(A),tile:A},void 0,!0)])],8,xg))),128))],4))}}),[["__scopeId","data-v-8a2b0f6f"]]),kg=n=>{const e={position:{col:0,row:0},size:n.layout.size};if(n.type==="slottable")return{id:crypto.randomUUID(),type:"slottable",layout:e};const t=n.meta,i={...t,chart:{...t.chart}};return"chart_title"in i.chart&&(i.chart.chart_title=i.chart.chart_title?`Copy of ${i.chart.chart_title}`:""),{id:crypto.randomUUID(),type:"chart",definition:i,layout:e}},Ng={key:0,class:"fullscreen-header"},Ag=["id"],Lg={key:1,class:"boundary-header"},Ug={key:0,class:"boundary-title"},Kg={key:1,class:"boundary-description"},Mg=Se(s.defineComponent({__name:"DashboardRenderer",props:s.mergeModels({context:{},preview:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:s.mergeModels(["edit-tile","tile-time-range-zoom","tiles-loaded"],["update:modelValue"]),setup(n,{expose:e,emit:t}){if(s.useCssVars(H=>({v1cd09a39:C.value})),n.context.disableCoordination!==!0){const H=ws();s.provide($i,H)}const i=t,r=s.useModel(n,"modelValue"),o=s.computed(()=>Array.isArray(r.value)?r.value:[{definition:r.value}]),a=H=>o.value[H].definition,l=s.computed(()=>{const H=o.value.flatMap(B=>B.definition.tiles),L=B=>B.type==="slottable"||"definition"in B&&B.definition?.chart?.type==="slottable";return H.filter(B=>!L(B)).length}),{i18n:d}=le.useI18n(),c=s.ref(0),u=[],h=(H,L)=>{u[H]=L},f=s.ref(),p=s.ref(),C=s.ref("scale(1)"),E=new Set,R=s.inject(ve);R||(console.warn("Analytics dashboards require a query bridge supplied via provide / inject."),console.warn("Please ensure your application has a query bridge provided under the key 'analytics-query-provider', as described in"),console.warn("https://github.com/Kong/public-ui-components/blob/main/packages/analytics/dashboard-renderer/README.md#requirements")),le.useRequestQueue();const{exportPdf:I,exportState:D}=le.useExportPdf(p),w=(H,L)=>{E.add(`${L}-${H.id}`),E.size>=l.value&&i("tiles-loaded",!0)},O=s.computed(()=>{const L=`renderer.trendRange.${ne.value.type==="absolute"?"custom":ne.value.time_range}`;return d.te(L)?d.t(L):""}),S=(H,L)=>{const B=H.layout.position.row-L.layout.position.row;return B!==0?B:H.layout.position.col-L.layout.position.col},U=H=>H.tiles.map(L=>{if(k.value&&!L.id&&console.warn("No id provided for tile. One will be generated automatically,","however tracking changes to this tile may not work as expected.",L),L.type==="slottable")return{layout:L.layout,type:L.type,id:L.id??crypto.randomUUID()};let B=L.definition;const Y=L.type??"chart",M=Ma(B,O.value);return M!==B.header_description&&(B={...B,header_description:M}),{layout:L.layout,meta:B,type:Y,id:L.id??crypto.randomUUID()}}),K=s.computed(()=>o.value.map(H=>U(H.definition))),m=H=>{i("edit-tile",H)},g=H=>H.type==="slottable"?!0:H.meta?.chart.type==="slottable",_=H=>H.type==="slottable",v=H=>{if(H.type==="slottable")return H.id;const L=H.meta?.chart;return L&&_(L)?L.id:void 0},x=(H,L)=>{const B=a(L);try{const Y=kg(H);B.tiles.push(JSON.parse(JSON.stringify(Y)))}catch(Y){console.warn(Y)}},q=(H,L)=>{u[L]?.removeWidget(H.id),E.delete(`${L}-${H.id}`)},P=()=>{E.clear(),c.value++},W=(H,L)=>{const B=a(L),Y=H.map(M=>M.type==="slottable"?{id:M.id,type:M.type,layout:M.layout}:{id:M.id,type:M.type,layout:M.layout,definition:M.meta});B.tiles=Y.sort(S)},j=async()=>{if(C.value="scale(1)",await s.nextTick(),p.value){const{availWidth:H,availHeight:L}=window.screen,{width:B,height:Y}=p.value.getBoundingClientRect(),M=Math.min(L/Y,H/B);C.value=`scale(${M})`}},F=()=>{f.value&&(document.fullscreenElement?document.exitFullscreen():f.value.requestFullscreen())},b=s.ref(!1),T=s.computed(()=>k.value&&!b.value),A=()=>{b.value=document.fullscreenElement!==null,b.value&&j()},{editable:k,enrichedContext:z,queryReady:N,showTileActions:ae,timeSpec:ne}=le.useDashboardContext({globalFilters:s.computed(()=>[]),context:s.computed(()=>n.context),isFullscreen:b,preview:s.computed(()=>n.preview)}),ce=H=>({...z.value,filters:[...n.context.filters??[],...H.preset_filters??[]]});return e({refresh:P,toggleFullscreen:F,exportPdf:I,pdfExportState:D}),(H,L)=>{const B=s.resolveComponent("KAlert");return s.openBlock(),s.createElementBlock("div",{ref_key:"dashboardContainer",ref:f,class:s.normalizeClass(["kong-ui-public-dashboard-renderer",{"is-fullscreen":b.value}]),onFullscreenchange:A},[s.createElementVNode("div",{ref_key:"layoutContainer",ref:p,class:"layout"},[s.unref(R)&&b.value?(s.openBlock(),s.createElementBlock("div",Ng,[s.renderSlot(H.$slots,"fullscreenHeader",{},void 0,!0)])):s.createCommentVNode("",!0),s.unref(R)?(s.openBlock(!0),s.createElementBlock(s.Fragment,{key:2},s.renderList(o.value,(Y,M)=>(s.openBlock(),s.createElementBlock("div",{key:`dash-${M}`,class:s.normalizeClass(["dashboard-boundary",{multiple:o.value.length>1}])},[Y.anchorId?(s.openBlock(),s.createElementBlock("a",{key:0,id:Y.anchorId},null,8,Ag)):s.createCommentVNode("",!0),Y.title||Y.description?(s.openBlock(),s.createElementBlock("div",Lg,[Y.title?(s.openBlock(),s.createElementBlock("div",Ug,s.toDisplayString(Y.title),1)):s.createCommentVNode("",!0),Y.description?(s.openBlock(),s.createElementBlock("div",Kg,s.toDisplayString(Y.description),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),(s.openBlock(),s.createBlock(Dg,{key:`layout-${T.value}`,ref_for:!0,ref:J=>h(M,J),"bottom-trim":o.value.length>1?4:0,columns:Y.definition.columns,editable:T.value,"tile-height":Y.definition.tile_height,tiles:K.value[M],onUpdateTiles:J=>W(J,M)},{tile:s.withCtx(({tile:J,fitToContent:de})=>[g(J)?(s.openBlock(),s.createElementBlock("div",{key:0,class:s.normalizeClass(["tile-container slottable-tile",{"fit-to-content":de}])},[s.renderSlot(H.$slots,v(J),{},void 0,!0)],2)):(s.openBlock(),s.createBlock(Kn,{key:b.value?`${J.id}-tile`:`${J.id}-tile-fullscreen`,"refresh-counter":c.value,"onUpdate:refreshCounter":L[0]||(L[0]=ee=>c.value=ee),class:"tile-container",context:ce(Y.definition),definition:J.meta,"fit-to-content":de,height:J.layout.size.rows*(Y.definition.tile_height||s.unref(tt))+parseInt(s.unref(qi),10),"hide-actions":!s.unref(ae),"is-fullscreen":b.value,preview:n.preview,"query-ready":s.unref(N),"tile-id":J.id,"tile-type":J.type,onDuplicateTile:ee=>x(J,M),onEditTile:ee=>m(J),onRemoveTile:ee=>q(J,M),onTileLoaded:ee=>w(J,M),onTileTimeRangeZoom:L[1]||(L[1]=ee=>i("tile-time-range-zoom",ee))},null,8,["refresh-counter","context","definition","fit-to-content","height","hide-actions","is-fullscreen","preview","query-ready","tile-id","tile-type","onDuplicateTile","onEditTile","onRemoveTile","onTileLoaded"]))]),_:2},1032,["bottom-trim","columns","editable","tile-height","tiles","onUpdateTiles"]))],2))),128)):(s.openBlock(),s.createBlock(B,{key:1,appearance:"danger"},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(d).t("renderer.noQueryBridge")),1)]),_:1}))],512)],34)}}}),[["__scopeId","data-v-db564ac2"]]),Bg=s.defineComponent({__name:"DashboardTilePreview",props:{context:{},definition:{},globalFilters:{default:()=>[]},preview:{type:Boolean,default:!1}},emits:["chart-data","tile-time-range-zoom","tile-bounds-change"],setup(n,{expose:e,emit:t}){const i=s.useTemplateRef("root"),r=s.useTemplateRef("dashboard-tile"),o=crypto.randomUUID(),a=t,l=w=>{a("tile-time-range-zoom",w)},d=w=>{a("chart-data",w)},c=w=>{a("tile-bounds-change",w)},{i18n:u}=le.useI18n(),{enrichedContext:h,queryReady:f}=le.useDashboardContext({globalFilters:s.toRef(()=>n.globalFilters),context:s.toRef(()=>n.context),preview:s.computed(()=>n.preview)}),p=s.computed(()=>De(n.definition)),C=s.computed(()=>p.value?"columns"in n.definition.query&&!n.definition.query.columns?.length:!("metrics"in n.definition.query)||!n.definition.query.metrics||n.definition.query.metrics.length===0),E=s.ref(tt);let R;s.onMounted(()=>{const w=i.value?.parentElement;w&&(E.value=w.getBoundingClientRect().height,R=new ResizeObserver(([O])=>{const{height:S}=O.contentRect;E.value=S}),R.observe(w))}),s.onUnmounted(()=>R?.disconnect());const I=s.ref(0);return e({refresh:()=>{I.value++},getExportData:()=>r.value?.getExportData()}),(w,O)=>{const S=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{ref_key:"root",ref:i,"data-testid":"dashboard-tile-preview-root"},[C.value?(s.openBlock(),s.createBlock(S,{key:0,"action-button-visible":!1,"data-testid":"chart-not-configured-empty-state"},{title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(s.unref(u).t("renderer.not_configured.title")),1)]),default:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(s.unref(u).t("renderer.not_configured.description")),1)]),_:1})):(s.openBlock(),s.createBlock(Kn,{key:1,ref:"dashboard-tile","refresh-counter":I.value,"onUpdate:refreshCounter":O[0]||(O[0]=U=>I.value=U),context:{...s.unref(h),editable:!1},definition:n.definition,height:E.value,"hide-actions":"",preview:n.preview,"query-ready":s.unref(f),"show-refresh":"","tile-id":s.unref(o),onChartData:d,onTileBoundsChange:c,onTileTimeRangeZoom:l},null,8,["refresh-counter","context","definition","height","preview","query-ready","tile-id"]))],512)}}}),zg=n=>{if(n.type!=="chart")return n;const e=n.definition?.query;if(!e)return n;if(e.datasource==="api_usage"){console.warn("[@kong-ui-public/dashboard-renderer] A tile was filtered out for the Basic Tier",n);return}return n},Pg=n=>{if(n.type!=="chart"||De(n.definition))return n;const e=n.definition?.query;if(!e)return n;const t={...e,datasource:e.datasource==="basic"?"api_usage":e.datasource};return{...n,definition:{...n.definition,query:t}}},qg=(n,e=Bt)=>{if(!n.length)return[];let t=0,i=0,r=0;const o=[];for(const a of n){const l=a.layout?.size?.cols??1,d=a.layout?.size?.rows??1;i+l>e&&(t+=r,i=0,r=0);const c={...a,layout:{...a.layout,position:{...a.layout?.position??{},col:i,row:t}}};o.push(c),i+=l,r=Math.max(r,d)}return o},Hg=(n,e)=>{if(e){const r=n.tiles.map(Pg);return{...n,tiles:r}}const t=n.tiles.map(zg).filter(r=>r!==void 0),i=qg(t,n.columns);return{...n,tiles:i}},Gg=Object.freeze(Object.defineProperty({__proto__:null,default:s.defineComponent({__name:"GeoMapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["bounds-change"],setup(n,{emit:e}){const t=n,i=s.ref(void 0),r=s.computed(()=>i.value?ci.exploreResultToCountryMetrics(i.value):{}),o=s.computed(()=>i.value?i.value?.meta.metric_names&&i.value.meta.metric_names[0]:""),a=s.computed(()=>t.query.limit!==void 0&&t.query.limit>0?t.query.limit:ie.COUNTRIES.length),l=s.computed(()=>{if(!t.query.filters?.find(({field:p,operator:C})=>p==="country_code"&&(C==="not_empty"||C==="empty"||C==="in"))){const p={field:"country_code",operator:"not_empty"};return{...t.query,filters:[...t.query.filters||[],p]}}return t.query}),d=s.computed(()=>{if(!i.value)return"";const f=i?.value?.meta.metric_units,p=i?.value?.meta?.metric_names;return f&&p&&f[p[0]]}),c=f=>{i.value=f},u=e,h=f=>{u("bounds-change",f)};return(f,p)=>(s.openBlock(),s.createBlock(Be,{context:n.context,"limit-override":a.value,query:l.value,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onChartData:c},{default:s.withCtx(()=>[s.createVNode(s.unref(ci.AnalyticsGeoMap),{bounds:n.chartOptions.bounds,"country-metrics":r.value,"fit-to-country":n.chartOptions.fit_to_country,metric:o.value,"metric-unit":d.value,"with-legend":n.chartOptions.legend||!1,onBoundsChange:h},null,8,["bounds","country-metrics","fit-to-country","metric","metric-unit","with-legend"])]),_:1},8,["context","limit-override","query","query-ready","refresh-counter"]))}})},Symbol.toStringTag,{value:"Module"}));Q.CELLS_PER_ROW=it,Q.CP_ID_TOKEN=Fi,Q.CsvExportModal=ln,Q.DASHBOARD_COLS=Bt,Q.DEFAULT_TILE_HEIGHT=tt,Q.DEFAULT_TILE_REFRESH_INTERVAL_MS=Vi,Q.DashboardRenderer=Mg,Q.DashboardTilePreview=Bg,Q.ENTITY_ID_TOKEN=zt,Q.FULLSCREEN_LONG_REFRESH_INTERVAL_MS=Xi,Q.FULLSCREEN_SHORT_REFRESH_INTERVAL_MS=Yi,Q.INJECT_DASHBOARD_COORDINATOR=$i,Q.INJECT_QUERY_PROVIDER=ve,Q.TIMEFRAME_TOKEN=Wi,Q.configureAllowedDefinition=Hg,Q.getTimeRangeDurationMs=$t,Q.isTimeRangeUnsupported=Ft,Q.isTreemapCompatible=ti,Q.limitTimeRange=Wt,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));
15
+ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(e,t={}){if(!e)return null;let i=e;if(i.gridstack){const a=i.gridstack;return t&&(a.opts={...a.opts,...t}),t.children!==void 0&&a.load(t.children),a}return(!e.classList.contains("grid-stack")||$.addRemoveCB)&&($.addRemoveCB?i=$.addRemoveCB(e,t,!0,!0):i=y.createDiv(["grid-stack",t.class],e)),$.init(t,i)}static registerEngine(e){$.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=y.createDiv([this.opts.placeholderClass,ye.itemClass,this.opts.itemClass]);const e=y.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,t={}){this.el=e,this.opts=t,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=t=t||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),t.row&&(t.minRow=t.maxRow=t.row,delete t.row);const i=y.toNumber(e.getAttribute("gs-row"));t.column==="auto"&&delete t.column,t.alwaysShowResizeHandle!==void 0&&(t._alwaysShowResizeHandle=t.alwaysShowResizeHandle);let r=t.columnOpts?.breakpoints;const o=t;if(o.oneColumnModeDomSort&&(delete o.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),o.oneColumnSize||o.disableOneColumnMode===!1){const h=o.oneColumnSize||768;delete o.oneColumnSize,delete o.disableOneColumnMode,t.columnOpts=t.columnOpts||{},r=t.columnOpts.breakpoints=t.columnOpts.breakpoints||[];let f=r.find(g=>g.c===1);f?f.w=h:(f={c:1,w:h},r.push(f,{c:12,w:h+1}))}const a=t.columnOpts;a&&(!a.columnWidth&&!a.breakpoints?.length?(delete t.columnOpts,r=void 0):a.columnMax=a.columnMax||12),r?.length>1&&r.sort((h,f)=>(f.w||0)-(h.w||0));const l={...y.cloneDeep(ye),column:y.toNumber(e.getAttribute("gs-column"))||ye.column,minRow:i||y.toNumber(e.getAttribute("gs-min-row"))||ye.minRow,maxRow:i||y.toNumber(e.getAttribute("gs-max-row"))||ye.maxRow,staticGrid:y.toBool(e.getAttribute("gs-static"))||ye.staticGrid,sizeToContent:y.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||ye.draggable.handle},removableOptions:{accept:t.itemClass||ye.removableOptions.accept,decline:ye.removableOptions.decline}};e.getAttribute("gs-animate")&&(l.animate=y.toBool(e.getAttribute("gs-animate"))),t=y.defaults(t,l),this._initMargin(),this.checkDynamicColumn(),this.el.classList.add("gs-"+t.column),t.rtl==="auto"&&(t.rtl=e.style.direction==="rtl"),t.rtl&&this.el.classList.add("grid-stack-rtl");const c=this.el.closest("."+ye.itemClass)?.gridstackNode;c&&(c.subGrid=this,this.parentGridNode=c,this.el.classList.add("grid-stack-nested"),c.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=t.cellHeight==="auto",this._isAutoCellHeight||t.cellHeight==="initial"?this.cellHeight(void 0,!1):(typeof t.cellHeight=="number"&&t.cellHeightUnit&&t.cellHeightUnit!==ye.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit),this.cellHeight(t.cellHeight,!1)),t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=xe),this._styleSheetClass="gs-id-"+ke._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const u=t.engineClass||$.engineClass||ke;if(this.engine=new u({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:h=>{let f=0;this.engine.nodes.forEach(g=>{f=Math.max(f,g.y+g.h)}),h.forEach(g=>{const R=g.el;R&&(g._removeDOM?(R&&R.remove(),delete g._removeDOM):this._writePosAttr(R,g))}),this._updateStyles(!1,f)}}),this._updateStyles(!1,0),t.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(h=>this._prepareElement(h)),delete this.engine._loading,this.batchUpdate(!1)),t.children){const h=t.children;delete t.children,h.length&&this.load(h)}this.setAnimation(),t.subGridDynamic&&!V.pauseDrag&&(V.pauseDrag=!0),t.draggable?.pause!==void 0&&(V.pauseDrag=t.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}addWidget(e){if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let t,i=e;if(i.grid=this,i?.el?t=i.el:$.addRemoveCB?t=$.addRemoveCB(this.el,e,!0,!1):t=this.createWidgetDivs(i),!t)return;if(i=t.gridstackNode,i&&t.parentElement===this.el&&this.engine.nodes.find(o=>o._id===i._id))return t;const r=this._readAttr(t);return y.defaults(e,r),this.engine.prepareNode(e),this.el.appendChild(t),this.makeWidget(t,e),t}createWidgetDivs(e){const t=y.createDiv(["grid-stack-item",this.opts.itemClass]),i=y.createDiv(["grid-stack-item-content"],t);return y.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([r])=>{r.isIntersecting&&(e.visibleObservable?.disconnect(),delete e.visibleObservable,$.renderCB(i,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(t))):$.renderCB(i,e),t}makeSubGrid(e,t,i,r=!0){let o=e.gridstackNode;if(o||(o=this.makeWidget(e).gridstackNode),o.subGrid?.el)return o.subGrid;let a,l=this;for(;l&&!a;)a=l.opts?.subGridOpts,l=l.parentGridNode?.grid;t=y.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...a||{},...t||o.subGridOpts||{}}),o.subGridOpts=t;let d;t.column==="auto"&&(d=!0,t.column=Math.max(o.w||1,i?.w||1),delete t.columnOpts);let c=o.el.querySelector(".grid-stack-item-content"),u,h;if(r&&(this._removeDD(o.el),h={...o,x:0,y:0},y.removeInternalForSave(h),delete h.subGridOpts,o.content&&(h.content=o.content,delete o.content),$.addRemoveCB?u=$.addRemoveCB(this.el,h,!0,!1):(u=y.createDiv(["grid-stack-item"]),u.appendChild(c),c=y.createDiv(["grid-stack-item-content"],o.el)),this.prepareDragDrop(o.el)),i){const g=d?t.column:o.w,R=o.h+i.h,E=o.el.style;E.transition="none",this.update(o.el,{w:g,h:R}),setTimeout(()=>E.transition=null)}const f=o.subGrid=$.addGrid(c,t);return i?._moving&&(f._isTemp=!0),d&&(f._autoColumn=!0),r&&f.makeWidget(u,h),i&&(i._moving?window.setTimeout(()=>y.simulateMouseEvent(i._event,"mouseenter",f.el),0):f.makeWidget(o.el,o)),this.resizeToContentCheck(!1,o),f}removeAsSubGrid(e){const t=this.parentGridNode?.grid;t&&(t.batchUpdate(),t.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(i=>{i.x+=this.parentGridNode.x,i.y+=this.parentGridNode.y,t.makeWidget(i.el,i)}),t.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>y.simulateMouseEvent(e._event,"mouseenter",t.el),0))}save(e=!0,t=!1,i=$.saveCB){const r=this.engine.save(e,i);if(r.forEach(o=>{if(e&&o.el&&!o.subGrid&&!i){const a=o.el.querySelector(".grid-stack-item-content");o.content=a?.innerHTML,o.content||delete o.content}else if(!e&&!i&&delete o.content,o.subGrid?.el){const a=o.subGrid.save(e,t,i);o.subGridOpts=t?a:{children:a},delete o.subGrid}delete o.el}),t){const o=y.cloneDeep(this.opts);o.marginBottom===o.marginTop&&o.marginRight===o.marginLeft&&o.marginTop===o.marginRight&&(o.margin=o.marginTop,delete o.marginTop,delete o.marginRight,delete o.marginBottom,delete o.marginLeft),o.rtl===(this.el.style.direction==="rtl")&&(o.rtl="auto"),this._isAutoCellHeight&&(o.cellHeight="auto"),this._autoColumn&&(o.column="auto");const a=o._alwaysShowResizeHandle;return delete o._alwaysShowResizeHandle,a!==void 0?o.alwaysShowResizeHandle=a:delete o.alwaysShowResizeHandle,y.removeInternalAndSame(o,ye),o.children=r,o}return r}load(e,t=$.addRemoveCB||!0){e=y.cloneDeep(e);const i=this.getColumn();e.forEach(c=>{c.w=c.w||1,c.h=c.h||1}),e=y.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let r=0;e.forEach(c=>{r=Math.max(r,(c.x||0)+c.w)}),r>this.engine.defaultColumn&&(this.engine.defaultColumn=r),r>i&&this.engine.cacheLayout(e,r,!0);const o=$.addRemoveCB;typeof t=="function"&&($.addRemoveCB=t);const a=[];this.batchUpdate();const l=!this.engine.nodes.length;l&&this.setAnimation(!1),!l&&t&&[...this.engine.nodes].forEach(u=>{if(!u.id)return;y.find(e,u.id)||($.addRemoveCB&&$.addRemoveCB(this.el,u,!1,!1),a.push(u),this.removeWidget(u.el,!0,!1))}),this.engine._loading=!0;const d=[];return this.engine.nodes=this.engine.nodes.filter(c=>y.find(e,c.id)?(d.push(c),!1):!0),e.forEach(c=>{const u=y.find(d,c.id);if(u){if(y.shouldSizeToContent(u)&&(c.h=u.h),this.engine.nodeBoundFix(c),(c.autoPosition||c.x===void 0||c.y===void 0)&&(c.w=c.w||u.w,c.h=c.h||u.h,this.engine.findEmptyPosition(c)),this.engine.nodes.push(u),y.samePos(u,c)&&this.engine.nodes.length>1&&(this.moveNode(u,{...c,forceCollide:!0}),y.copyPos(c,u)),this.update(u.el,c),c.subGridOpts?.children){const h=u.el.querySelector(".grid-stack");h&&h.gridstack&&h.gridstack.load(c.subGridOpts.children)}}else t&&this.addWidget(c)}),delete this.engine._loading,this.engine.removedNodes=a,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,o?$.addRemoveCB=o:delete $.addRemoveCB,l&&this.opts?.animate&&this.setAnimation(this.opts.animate,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const t=this.el.querySelector("."+this.opts.itemClass);if(t){const r=y.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/r)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(e,t=!0){if(t&&e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const r=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+r}const i=y.parseHeight(e);return this.opts.cellHeightUnit===i.unit&&this.opts.cellHeight===i.h?this:(this.opts.cellHeightUnit=i.unit,this.opts.cellHeight=i.h,this.resizeToContentCheck(),t&&this._updateStyles(!0),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){return e&&this.opts.columnOpts?.breakpointForWindow?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!e.breakpoints?.length)return!1;const t=this.getColumn();let i=t;const r=this._widthOrContainer(!0);if(e.columnWidth)i=Math.min(Math.round(r/e.columnWidth)||1,e.columnMax);else{i=e.columnMax;let o=0;for(;o<e.breakpoints.length&&r<=e.breakpoints[o].w;)i=e.breakpoints[o++].c||t}if(i!==t){const o=e.breakpoints?.find(a=>a.c===i);return this.column(i,o?.layout||e.layout),!0}return!1}compact(e="compact",t=!0){return this.engine.compact(e,t),this._triggerChangeEvent(),this}column(e,t="moveScale"){if(!e||e<1||this.opts.column===e)return this;const i=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+i),this.el.classList.add("gs-"+e),this.engine.columnChanged(i,e,t),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):this}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.classList.remove(this._styleSheetClass),this.el.removeAttribute("gs-current-row")),this._removeStylesheet(),delete this.parentGridNode?.subGrid,delete this.parentGridNode,delete this.opts,delete this._placeholder?.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,t=!1){const i=this.el.getBoundingClientRect();let r;t?r={top:i.top+document.documentElement.scrollTop,left:i.left}:r={top:this.el.offsetTop,left:this.el.offsetLeft};const o=e.left-r.left,a=e.top-r.top,l=i.width/this.getColumn(),d=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(o/l),y:Math.floor(a/d)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(e,t,i,r){return this.engine.isAreaEmpty(e,t,i,r)}makeWidget(e,t){const i=$.getElement(e);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const r=i.gridstackNode;this._updateContainerHeight(),r.subGridOpts&&this.makeSubGrid(i,r.subGridOpts,void 0,!1);let o;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(o=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),o&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(r=>this.on(r,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=r=>t(r):this._gsEventHandler[e]=r=>{r.detail&&t(r,r.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=!0,i=!0){return e?($.getElements(e).forEach(r=>{if(r.parentElement&&r.parentElement!==this.el)return;let o=r.gridstackNode;o||(o=this.engine.nodes.find(a=>r===a.el)),o&&(t&&$.addRemoveCB&&$.addRemoveCB(this.el,o,!1,!1),delete r.gridstackNode,this._removeDD(r),this.engine.removeNode(o,t,i),t&&r.parentElement&&r.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,t=!0){return this.engine.nodes.forEach(i=>{e&&$.addRemoveCB&&$.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(e,t),t&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,t=!0,i=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(r=>{this.prepareDragDrop(r.el),r.subGrid&&i&&r.subGrid.setStatic(e,t,i)}),t&&this._setStaticClass(),this)}updateOptions(e){const t=this.opts;return e.acceptWidgets!==void 0&&this._setupAcceptWidget(),e.animate!==void 0&&this.setAnimation(),e.cellHeight&&(this.cellHeight(e.cellHeight,!0),delete e.cellHeight),e.class&&e.class!==t.class&&(t.class&&this.el.classList.remove(t.class),this.el.classList.add(e.class)),typeof e.column=="number"&&!e.columnOpts&&(this.column(e.column),delete e.column),e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0&&(t.minRow=t.maxRow=e.row),e.children?.length&&(this.load(e.children),delete e.children),this.opts={...this.opts,...e},this}update(e,t){return $.getElements(e).forEach(i=>{const r=i?.gridstackNode;if(!r)return;const o={...y.copyPos({},r),...y.cloneDeep(t)};this.engine.nodeBoundFix(o),delete o.autoPosition;const a=["x","y","w","h"];let l;if(a.some(u=>o[u]!==void 0&&o[u]!==r[u])&&(l={},a.forEach(u=>{l[u]=o[u]!==void 0?o[u]:r[u],delete o[u]})),!l&&(o.minW||o.minH||o.maxW||o.maxH)&&(l={}),o.content!==void 0){const u=i.querySelector(".grid-stack-item-content");u&&u.textContent!==o.content&&(r.content=o.content,$.renderCB(u,o),r.subGrid?.el&&(u.appendChild(r.subGrid.el),r.subGrid.opts.styleInHead||r.subGrid._updateStyles(!0))),delete o.content}let d=!1,c=!1;for(const u in o)u[0]!=="_"&&r[u]!==o[u]&&(r[u]=o[u],d=!0,c=c||!this.opts.staticGrid&&(u==="noResize"||u==="noMove"||u==="locked"));if(y.sanitizeMinMax(r),l){const u=l.w!==void 0&&l.w!==r.w;this.moveNode(r,l),u&&r.subGrid?r.subGrid.onResize(this.hasAnimationCSS()?r.w:void 0):this.resizeToContentCheck(u,r),delete r._orig}(l||d)&&this._writeAttr(i,r),c&&this.prepareDragDrop(r.el)}),this}moveNode(e,t){const i=e._updating;i||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,t),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const t=e.gridstackNode;if(!t)return;const i=t.grid;if(!i||e.parentElement!==i.el)return;const r=i.getCellHeight(!0);if(!r)return;let o=t.h?t.h*r:e.clientHeight,a;if(t.resizeToContentParent&&(a=e.querySelector(t.resizeToContentParent)),a||(a=e.querySelector($.resizeToContentParent)),!a)return;const l=e.clientHeight-a.clientHeight,d=t.h?t.h*r-l:a.clientHeight;let c;if(t.subGrid){c=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const f=t.subGrid.el.getBoundingClientRect(),g=t.subGrid.el.parentElement.getBoundingClientRect();c+=f.top-g.top}else{if(t.subGridOpts?.children?.length)return;{const f=a.firstElementChild;if(!f){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${$.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=f.getBoundingClientRect().height||d}}if(d===c)return;o+=c-d;let u=Math.ceil(o/r);const h=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;h&&u>h&&(u=h,e.classList.add("size-to-content-max")),t.minH&&u<t.minH?u=t.minH:t.maxH&&u>t.maxH&&(u=t.maxH),u!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h:u}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){$.resizeToContentCB?$.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return $.getElements(e).forEach(i=>{const r=i.gridstackNode;if(!y.canBeRotated(r))return;const o={w:r.h,h:r.w,minH:r.minW,minW:r.minH,maxH:r.maxW,maxW:r.maxH};if(t){const l=t.left>0?Math.floor(t.left/this.cellWidth()):0,d=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;o.x=r.x+l-(r.h-(d+1)),o.y=r.y+d-l}Object.keys(o).forEach(l=>{o[l]===void 0&&delete o[l]});const a=r._orig;this.update(i,o),r._orig=a}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const i=y.parseHeight(e);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this._updateStyles(!0),this}getMargin(){return this.opts.margin}willItFit(e){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const t=arguments;let i=0,r={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++]};return this.willItFit(r)}return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){if(this.engine.batchMode)return this;if(this.engine.addedNodes?.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(t=>{delete t._dirty});const e=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",e)}return this}_triggerRemoveEvent(){if(this.engine.batchMode)return this;if(this.engine.removedNodes?.length){const e=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",e)}return this}_triggerEvent(e,t){const i=t?new CustomEvent(e,{bubbles:!1,detail:t}):new Event(e);return this.el.dispatchEvent(i),this}_removeStylesheet(){if(this._styles){const e=this.opts.styleInHead?void 0:this.el.parentNode;y.removeStylesheet(this._styleSheetClass,e),delete this._styles}return this}_updateStyles(e=!1,t){if(e&&this._removeStylesheet(),t===void 0&&(t=this.getRow()),this._updateContainerHeight(),this.opts.cellHeight===0)return this;const i=this.opts.cellHeight,r=this.opts.cellHeightUnit,o=`.${this._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){const a=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=y.createStylesheet(this._styleSheetClass,a,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,y.addCSSRule(this._styles,o,`height: ${i}${r}`);const l=this.opts.marginTop+this.opts.marginUnit,d=this.opts.marginBottom+this.opts.marginUnit,c=this.opts.marginRight+this.opts.marginUnit,u=this.opts.marginLeft+this.opts.marginUnit,h=`${o} > .grid-stack-item-content`,f=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;y.addCSSRule(this._styles,h,`top: ${l}; right: ${c}; bottom: ${d}; left: ${u};`),y.addCSSRule(this._styles,f,`top: ${l}; right: ${c}; bottom: ${d}; left: ${u};`),y.addCSSRule(this._styles,`${o} > .ui-resizable-n`,`top: ${l};`),y.addCSSRule(this._styles,`${o} > .ui-resizable-s`,`bottom: ${d}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-ne`,`right: ${c}; top: ${l}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-e`,`right: ${c}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-se`,`right: ${c}; bottom: ${d}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-nw`,`left: ${u}; top: ${l}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-w`,`left: ${u}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-sw`,`left: ${u}; bottom: ${d}`)}if(t=t||this._styles._max,t>this._styles._max){const a=l=>i*l+r;for(let l=this._styles._max+1;l<=t;l++)y.addCSSRule(this._styles,`${o}[gs-y="${l}"]`,`top: ${a(l)}`),y.addCSSRule(this._styles,`${o}[gs-h="${l+1}"]`,`height: ${a(l+1)}`);this._styles._max=t}return this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const e=this.parentGridNode;let t=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,r=this.opts.cellHeightUnit;if(!i)return this;if(!e){const o=y.parseHeight(getComputedStyle(this.el).minHeight);if(o.h>0&&o.unit===r){const a=Math.floor(o.h/i);t<a&&(t=a)}}return this.el.setAttribute("gs-current-row",String(t)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),t&&(this.el.style[e?"minHeight":"height"]=t*i+r),e&&!e.grid.engine.batchMode&&y.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,t=!1,i){i=i||this._readAttr(e),e.gridstackNode=i,i.el=e,i.grid=this,i=this.engine.addNode(i,t),this._writeAttr(e,i),e.classList.add(ye.itemClass,this.opts.itemClass);const r=y.shouldSizeToContent(i);return r?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),r&&this.resizeToContentCheck(!1,i),y.lazyLoad(i)||this.prepareDragDrop(i.el),this}_writePosAttr(e,t){return t.x!==void 0&&t.x!==null&&e.setAttribute("gs-x",String(t.x)),t.y!==void 0&&t.y!==null&&e.setAttribute("gs-y",String(t.y)),t.w>1?e.setAttribute("gs-w",String(t.w)):e.removeAttribute("gs-w"),t.h>1?e.setAttribute("gs-h",String(t.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,t){if(!t)return this;this._writePosAttr(e,t);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const r in i)t[r]?e.setAttribute(i[r],String(t[r])):e.removeAttribute(i[r]);return this}_readAttr(e,t=!0){const i={};i.x=y.toNumber(e.getAttribute("gs-x")),i.y=y.toNumber(e.getAttribute("gs-y")),i.w=y.toNumber(e.getAttribute("gs-w")),i.h=y.toNumber(e.getAttribute("gs-h")),i.autoPosition=y.toBool(e.getAttribute("gs-auto-position")),i.noResize=y.toBool(e.getAttribute("gs-no-resize")),i.noMove=y.toBool(e.getAttribute("gs-no-move")),i.locked=y.toBool(e.getAttribute("gs-locked"));const r=e.getAttribute("gs-size-to-content");r&&(r==="true"||r==="false"?i.sizeToContent=y.toBool(r):i.sizeToContent=parseInt(r,10)),i.id=e.getAttribute("gs-id"),i.maxW=y.toNumber(e.getAttribute("gs-max-w")),i.minW=y.toNumber(e.getAttribute("gs-min-w")),i.maxH=y.toNumber(e.getAttribute("gs-max-h")),i.minH=y.toNumber(e.getAttribute("gs-min-h")),t&&(i.w===1&&e.removeAttribute("gs-w"),i.h===1&&e.removeAttribute("gs-h"),i.maxW&&e.removeAttribute("gs-max-w"),i.minW&&e.removeAttribute("gs-min-w"),i.maxH&&e.removeAttribute("gs-max-h"),i.minH&&e.removeAttribute("gs-min-h"));for(const o in i){if(!i.hasOwnProperty(o))return;!i[o]&&i[o]!==0&&o!=="gs-size-to-content"&&delete i[o]}return i}_setStaticClass(){const e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=this.el?.clientWidth){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let t=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),t=!0):t=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(i=>{i.subGrid&&i.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(t),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,t=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,t),this.animationDelay);if(t)y.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(i=>y.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(r=>{y.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el)}),this.batchUpdate(!1)}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,t?[t]:this.engine.nodes)}}_updateResizeEvent(e=!1){const t=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!e&&t&&!this.resizeObserver?(this._sizeThrottle=y.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!t)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return y.getElement(e)}static getElements(e=".grid-stack-item"){return y.getElements(e)}static getGridElement(e){return $.getElement(e)}static getGridElements(e){return y.getElements(e)}_initMargin(){let e,t=0,i=[];return typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(e=y.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,t=this.opts.margin=e.h),this.opts.marginTop===void 0?this.opts.marginTop=t:(e=y.parseHeight(this.opts.marginTop),this.opts.marginTop=e.h,delete this.opts.margin),this.opts.marginBottom===void 0?this.opts.marginBottom=t:(e=y.parseHeight(this.opts.marginBottom),this.opts.marginBottom=e.h,delete this.opts.margin),this.opts.marginRight===void 0?this.opts.marginRight=t:(e=y.parseHeight(this.opts.marginRight),this.opts.marginRight=e.h,delete this.opts.margin),this.opts.marginLeft===void 0?this.opts.marginLeft=t:(e=y.parseHeight(this.opts.marginLeft),this.opts.marginLeft=e.h,delete this.opts.margin),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop),this}static getDD(){return _e}static setupDragIn(e,t,i,r=document){t?.pause!==void 0&&(V.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?y.getElements(e,r):e).forEach((a,l)=>{_e.isDraggable(a)||_e.dragIn(a,t),i?.[l]&&(a.gridstackNode=i[l])})}movable(e,t){return this.opts.staticGrid?this:($.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noMove:r.noMove=!0,this.prepareDragDrop(r.el))}),this)}resizable(e,t){return this.opts.staticGrid?this:($.getElements(e).forEach(i=>{const r=i.gridstackNode;r&&(t?delete r.noResize:r.noResize=!0,this.prepareDragDrop(r.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableMove(e,t)}),this)}enableResize(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&t&&i.subGrid.enableResize(e,t)}),this)}cancelDrag(){const e=this._placeholder?.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&$._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return _e.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return _e.droppable(this.el,"destroy"),this;let e,t;const i=(r,o,a)=>{a=a||o;const l=a.gridstackNode;if(!l)return;if(!l.grid?.el){a.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const f=a.getBoundingClientRect();a.style.left=f.x+(this.dragTransform.xScale-1)*(r.clientX-f.x)/this.dragTransform.xScale+"px",a.style.top=f.y+(this.dragTransform.yScale-1)*(r.clientY-f.y)/this.dragTransform.yScale+"px",a.style.transformOrigin="0px 0px"}let{top:d,left:c}=a.getBoundingClientRect();const u=this.el.getBoundingClientRect();c-=u.left,d-=u.top;const h={position:{top:d*this.dragTransform.xScale,left:c*this.dragTransform.yScale}};if(l._temporaryRemoved){if(l.x=Math.max(0,Math.round(c/t)),l.y=Math.max(0,Math.round(d/e)),delete l.autoPosition,this.engine.nodeBoundFix(l),!this.engine.willItFit(l)){if(l.autoPosition=!0,!this.engine.willItFit(l)){_e.off(o,"drag");return}l._willFitPos&&(y.copyPos(l,l._willFitPos),delete l._willFitPos)}this._onStartMoving(a,r,h,l,t,e)}else this._dragOrResize(a,r,h,l,t,e)};return _e.droppable(this.el,{accept:r=>{const o=r.gridstackNode||this._readAttr(r,!1);if(o?.grid===this)return!0;if(!this.opts.acceptWidgets)return!1;let a=!0;if(typeof this.opts.acceptWidgets=="function")a=this.opts.acceptWidgets(r);else{const l=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;a=r.matches(l)}if(a&&o&&this.opts.maxRow){const l={w:o.w,h:o.h,minW:o.minW,minH:o.minH};a=this.engine.willItFit(l)}return a}}).on(this.el,"dropover",(r,o,a)=>{let l=a?.gridstackNode||o.gridstackNode;if(l?.grid===this&&!l._temporaryRemoved)return!1;if(l?._sidebarOrig&&(l.w=l._sidebarOrig.w,l.h=l._sidebarOrig.h),l?.grid&&l.grid!==this&&!l._temporaryRemoved&&l.grid._leave(o,a),a=a||o,t=this.cellWidth(),e=this.getCellHeight(!0),!l){const u=a.getAttribute("data-gs-widget")||a.getAttribute("gridstacknode");if(u){try{l=JSON.parse(u)}catch{console.error("Gridstack dropover: Bad JSON format: ",u)}a.removeAttribute("data-gs-widget"),a.removeAttribute("gridstacknode")}l||(l=this._readAttr(a)),l._sidebarOrig={w:l.w,h:l.h}}l.grid||(l.el||(l={...l}),l._isExternal=!0,a.gridstackNode=l);const d=l.w||Math.round(a.offsetWidth/t)||1,c=l.h||Math.round(a.offsetHeight/e)||1;return l.grid&&l.grid!==this?(o._gridstackNodeOrig||(o._gridstackNodeOrig=l),o.gridstackNode=l={...l,w:d,h:c,grid:this},delete l.x,delete l.y,this.engine.cleanupNode(l).nodeBoundFix(l),l._initDD=l._isExternal=l._temporaryRemoved=!0):(l.w=d,l.h=c,l._temporaryRemoved=!0),$._itemRemoving(l.el,!1),_e.on(o,"drag",i),i(r,o,a),!1}).on(this.el,"dropout",(r,o,a)=>{const l=a?.gridstackNode||o.gridstackNode;return l&&(!l.grid||l.grid===this)&&(this._leave(o,a),this._isTemp&&this.removeAsSubGrid(l)),!1}).on(this.el,"drop",(r,o,a)=>{const l=a?.gridstackNode||o.gridstackNode;if(l?.grid===this&&!l._isExternal)return!1;const d=!!this.placeholder.parentElement,c=o!==a;this.placeholder.remove(),delete this.placeholder.gridstackNode;const u=d&&this.opts.animate;u&&this.setAnimation(!1);const h=o._gridstackNodeOrig;if(delete o._gridstackNodeOrig,d&&h?.grid&&h.grid!==this){const g=h.grid;g.engine.removeNodeFromLayoutCache(h),g.engine.removedNodes.push(h),g._triggerRemoveEvent()._triggerChangeEvent(),g.parentGridNode&&!g.engine.nodes.length&&g.opts.subGridDynamic&&g.removeAsSubGrid()}if(!l||(d&&(this.engine.cleanupNode(l),l.grid=this),delete l.grid?._isTemp,_e.off(o,"drag"),a!==o?(a.remove(),o=a):o.remove(),this._removeDD(o),!d))return!1;const f=l.subGrid?.el?.gridstack;return y.copyPos(l,this._readAttr(this.placeholder)),y.removePositioningStyles(o),c&&(l.content||l.subGridOpts||$.addRemoveCB)?(delete l.el,o=this.addWidget(l)):(this._prepareElement(o,!0,l),this.el.appendChild(o),this.resizeToContentCheck(!1,l),f&&(f.parentGridNode=l,f.opts.styleInHead||f._updateStyles(!0)),this._updateContainerHeight()),this.engine.addedNodes.push(l),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...r,type:"dropped"},h&&h.grid?h:void 0,l),u&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(e,t){if(!e)return;const i=e?e.gridstackNode:void 0;!i?.grid||e.classList.contains(i.grid.opts.removableOptions.decline)||(t?i._isAboutToRemove=!0:delete i._isAboutToRemove,t?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!_e.isDroppable(e)&&_e.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>$._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>$._itemRemoving(i,!1)),this):this}prepareDragDrop(e,t=!1){const i=e?.gridstackNode;if(!i)return;const r=i.noMove||this.opts.disableDrag,o=i.noResize||this.opts.disableResize,a=this.opts.staticGrid||r&&o;if((t||a)&&(i._initDD&&(this._removeDD(e),delete i._initDD),a&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!t))return this;if(!i._initDD){let l,d;const c=(f,g)=>{this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,f.target),l=this.cellWidth(),d=this.getCellHeight(!0),this._onStartMoving(e,f,g,i,l,d)},u=(f,g)=>{this._dragOrResize(e,f,g,i,l,d)},h=f=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._event,delete i._lastTried;const g=i.w!==i._orig.w,R=f.target;if(!(!R.gridstackNode||R.gridstackNode.grid!==this)){if(i.el=R,i._isAboutToRemove){const E=e.gridstackNode.grid;E._gsEventHandler[f.type]&&E._gsEventHandler[f.type](f,R),E.engine.nodes.push(i),E.removeWidget(e,!0,!0)}else y.removePositioningStyles(R),i._temporaryRemoved?(y.copyPos(i,i._orig),this._writePosAttr(R,i),this.engine.addNode(i)):this._writePosAttr(R,i),this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,R);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),f.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(g,i))}};_e.draggable(e,{start:c,stop:h,drag:u}).resizable(e,{start:c,stop:h,resize:u}),i._initDD=!0}return _e.draggable(e,r?"disable":"enable").resizable(e,o?"disable":"enable"),this}_onStartMoving(e,t,i,r,o,a){if(this.engine.cleanNodes().beginUpdate(r),this._writePosAttr(this.placeholder,r),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=r,r.grid?.el)this.dragTransform=y.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=y.getValuesFromTransformedElement(l)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(r.el=this.placeholder,r._lastUiPosition=i.position,r._prevYPix=i.position.top,r._moving=t.type==="dragstart",delete r._lastTried,t.type==="dropover"&&r._temporaryRemoved&&(this.engine.addNode(r),r._moving=!0),this.engine.cacheRects(o,a,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){const l=this.getColumn()-r.x,d=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-r.y;_e.resizable(e,"option","minWidth",o*Math.min(r.minW||1,l)).resizable(e,"option","minHeight",a*Math.min(r.minH||1,d)).resizable(e,"option","maxWidth",o*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",o*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,r.x+r.w)).resizable(e,"option","maxHeight",a*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,d)).resizable(e,"option","maxHeightMoveUp",a*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,r.y+r.h))}}_dragOrResize(e,t,i,r,o,a){const l={...r._orig};let d,c=this.opts.marginLeft,u=this.opts.marginRight,h=this.opts.marginTop,f=this.opts.marginBottom;const g=Math.round(a*.1),R=Math.round(o*.1);if(c=Math.min(c,R),u=Math.min(u,R),h=Math.min(h,g),f=Math.min(f,g),t.type==="drag"){if(r._temporaryRemoved)return;const C=i.position.top-r._prevYPix;r._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&y.updateScrollPosition(e,i.position,C);const v=i.position.left+(i.position.left>r._lastUiPosition.left?-u:c),k=i.position.top+(i.position.top>r._lastUiPosition.top?-f:h);l.x=Math.round(v/o),l.y=Math.round(k/a);const I=this._extraDragRow;if(this.engine.collide(r,l)){const O=this.getRow();let x=Math.max(0,l.y+r.h-O);this.opts.maxRow&&O+x>this.opts.maxRow&&(x=Math.max(0,this.opts.maxRow-O)),this._extraDragRow=x}else this._extraDragRow=0;if(this._extraDragRow!==I&&this._updateContainerHeight(),r.x===l.x&&r.y===l.y)return}else if(t.type==="resize"){if(l.x<0||(y.updateScrollResize(t,e,a),l.w=Math.round((i.size.width-c)/o),l.h=Math.round((i.size.height-h)/a),r.w===l.w&&r.h===l.h)||r._lastTried&&r._lastTried.w===l.w&&r._lastTried.h===l.h)return;const C=i.position.left+c,v=i.position.top+h;l.x=Math.round(C/o),l.y=Math.round(v/a),d=!0}r._event=t,r._lastTried=l;const E={x:i.position.left+c,y:i.position.top+h,w:(i.size?i.size.width:r.w*o)-c-u,h:(i.size?i.size.height:r.h*a)-h-f};if(this.engine.moveNodeCheck(r,{...l,cellWidth:o,cellHeight:a,rect:E,resizing:d})){r._lastUiPosition=i.position,this.engine.cacheRects(o,a,h,u,f,c),delete r._skipDown,d&&r.subGrid&&r.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const C=t.target;r._sidebarOrig||this._writePosAttr(C,r),this._gsEventHandler[t.type]&&this._gsEventHandler[t.type](t,C)}}_leave(e,t){t=t||e;const i=t.gridstackNode;if(!i||(t.style.transform=t.style.transformOrigin=null,_e.off(e,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e;const r=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=r,this.opts.removable===!0&&$._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return Tg(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}$.renderCB=(n,e)=>{n&&e?.content&&(n.textContent=e.content)},$.resizeToContentParent=".grid-stack-item-content",$.Utils=y,$.Engine=ke,$.GDRev="11.5.1";const Ig=(n,e)=>{let t=0;const i=new Map;e.forEach(o=>{const a=o.layout.position.row,l=i.get(a),d=o.layout.size.rows===1&&!!o.layout.size.fit_to_content;t=Math.max(t,a+o.layout.size.rows),l===void 0?i.set(a,d):i.set(a,l&&d)});const r=[];for(let o=0;o<t;o++)i.get(o)?r.push("auto"):r.push(`${n}px`);return r},Pn=(n,e,t)=>e.get(`${n.id}`)??n.layout.size.rows*t,Dg=(n,e,t,i)=>e.map((r,o)=>{if(r!=="auto")return i;const a=n.filter(l=>l.layout.position.row===o);return Math.max(...a.map(l=>Pn(l,t,i)))}),kg=(n,e,t)=>{const i=[...n].sort((a,l)=>a.layout.position.row-l.layout.position.row||a.layout.position.col-l.layout.position.col),r=new Map;let o=0;return i.forEach(a=>{const l=Pn(a,e,t);r.set(`${a.id}`,{x:0,y:o,w:1,h:l}),o+=l}),r},Ng=(n,e,t,{cellsPerRow:i,columns:r})=>{if(r===1)return kg(n,t,i);const o=[0];return Dg(n,e,t,i).forEach(a=>{o.push(o[o.length-1]+a)}),new Map(n.map(a=>{const{position:l,size:d}=a.layout,c=o[l.row],u=o[l.row+d.rows];return[`${a.id}`,{x:l.col,y:c,w:d.cols,h:u-c}]}))},Ag=["data-id","data-testid"],Lg={class:"grid-stack-item-content"},Ug=Se(s.defineComponent({__name:"DraggableGridLayout",props:{tiles:{},tileHeight:{default:tt},columns:{default:Bt},editable:{type:Boolean,default:!1},bottomTrim:{default:0}},emits:["update-tiles"],setup(n,{expose:e,emit:t}){const i=n,r=t,o=s.ref(null),a=s.ref(new Map(i.tiles.map(b=>[`${b.id}`,b])));let l=null,d=!1;const c=b=>`[data-id="${b}"]`,u=s.computed(()=>Ig(i.tileHeight,i.tiles)),h=b=>!i.editable&&u.value[b.layout.position.row]==="auto",f=()=>i.editable?1:it,g=parseInt(la,10)/2,R=s.ref(new Map),E=s.ref(new Map),C=s.ref(!1),v=b=>C.value||h(b),k=s.computed(()=>Ng(i.tiles,u.value,R.value,{cellsPerRow:it,columns:C.value?1:i.columns})),I=s.computed(()=>{if(i.editable)return 0;const w=(C.value?[...i.tiles].sort((A,ae)=>A.layout.position.row-ae.layout.position.row||A.layout.position.col-ae.layout.position.col).slice(-1):i.tiles.filter(A=>A.layout.position.row===u.value.length-1)).filter(A=>R.value.has(`${A.id}`));if(!w.length||!w.every(v))return 0;const L=Math.max(...w.map(A=>R.value.get(`${A.id}`))),N=Math.max(...w.map(A=>E.value.get(`${A.id}`))),z=L*(i.tileHeight/it)-(N+2*g);return Math.max(0,Math.round(z*100)/100)}),O=b=>i.editable?{id:`${b.id}`,x:b.layout.position.col,y:b.layout.position.row,w:b.layout.size.cols,h:b.layout.size.rows}:{id:`${b.id}`,...k.value.get(`${b.id}`)},x=()=>({margin:g,column:i.columns,cellHeight:i.tileHeight/f(),resizable:{handles:"se, sw"},handle:".tile-header",staticGrid:!i.editable,float:!i.editable}),D=b=>b.map(w=>{const L=a.value.get(`${w.el?.getAttribute("data-id")}`);if(L)return{...L,layout:{position:{col:Number(w.x),row:Number(w.y)},size:{...L.layout.size,cols:Number(w.w),rows:Number(w.h)}}}}).filter(w=>w!==void 0),U=(b,w)=>{l&&!d&&(D(w).forEach(N=>{a.value.set(`${N.id}`,N)}),r("update-tiles",Array.from(a.value.values())))},m=(b,w)=>{w.forEach(L=>{a.value.delete(`${L.el?.getAttribute("data-id")}`)}),r("update-tiles",Array.from(a.value.values()))},p=b=>o.value?.querySelector(`${c(b)} > .grid-stack-item-content > :first-child`),_=b=>Math.ceil((b+2*g)/(i.tileHeight/it)),T=()=>{const b=new Map,w=new Map;i.tiles.filter(v).forEach(z=>{const A=p(z.id);if(A){const{height:ae}=A.getBoundingClientRect();b.set(`${z.id}`,_(ae)),w.set(`${z.id}`,ae)}}),(b.size!==R.value.size||[...b].some(([z,A])=>R.value.get(z)!==A))&&(R.value=b),(w.size!==E.value.size||[...w].some(([z,A])=>E.value.get(z)!==A))&&(E.value=w)},S=new ResizeObserver(()=>window.requestAnimationFrame(T)),q=()=>{S.disconnect(),i.tiles.filter(v).forEach(b=>{const w=p(b.id);w&&S.observe(w)})},P=new ResizeObserver(([b])=>{C.value=!i.editable&&b.contentRect.width<=parseInt(oa,10)}),W=(b,w)=>{const L=b.x===w.x&&b.y===w.y,N=b.w===w.w&&b.h===w.h;return L&&N},j=()=>{if(!l)return;const b=new Set(i.tiles.map(N=>`${N.id}`)),w=new Map(l.engine.nodes.map(N=>[`${N.id}`,N]));w.forEach((N,z)=>{!b.has(z)&&N.el&&(l.removeWidget(N.el,!1,!1),a.value.delete(z))});const L=i.tiles.filter(N=>w.has(`${N.id}`)).map(O);d=!0,L.some(N=>!W(w.get(`${N.id}`),N))&&l.load(L,!1),d=!1,i.tiles.filter(N=>!w.has(`${N.id}`)).forEach(N=>{l.makeWidget(c(N.id),{...O(N),autoPosition:i.editable})}),q()};s.onMounted(()=>{o.value&&(l=$.init(x(),o.value),l.batchUpdate(),i.tiles.forEach(b=>l.makeWidget(c(b.id),O(b))),l.batchUpdate(!1),q(),P.observe(o.value),i.editable&&(l.on("change",U),l.on("added",U),l.on("removed",m)))}),s.onUnmounted(()=>{S.disconnect(),P.disconnect(),l&&l.destroy(!1)});const F=b=>{if(l&&o.value){const w=o.value.querySelector(c(b));w&&l.removeWidget(w)}};return s.watch(C,b=>l?.column(b?1:i.columns,"none")),s.watch(()=>[i.tiles.map(b=>[b.id,b.layout]),k.value],j,{deep:!0,flush:"post"}),s.watchEffect(()=>{i.tiles.forEach(b=>{a.value.set(`${b.id}`,b)})}),e({removeWidget:F}),(b,w)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"gridContainer",ref:o,class:"grid-stack",style:s.normalizeStyle({marginBottom:`-${n.bottomTrim+I.value}px`})},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(i.tiles,L=>(s.openBlock(),s.createElementBlock("div",{key:L.id,"data-id":`${L.id}`,"data-testid":`grid-stack-item-${L.id}`},[s.createElementVNode("div",Lg,[s.renderSlot(b.$slots,"tile",{fitToContent:h(L),tile:L},void 0,!0)])],8,Ag))),128))],4))}}),[["__scopeId","data-v-8a2b0f6f"]]),Kg=n=>{const e={position:{col:0,row:0},size:n.layout.size};if(n.type==="slottable")return{id:crypto.randomUUID(),type:"slottable",layout:e};const t=n.meta,i={...t,chart:{...t.chart}};return"chart_title"in i.chart&&(i.chart.chart_title=i.chart.chart_title?`Copy of ${i.chart.chart_title}`:""),{id:crypto.randomUUID(),type:"chart",definition:i,layout:e}},Mg={key:0,class:"fullscreen-header"},Bg=["id"],zg={key:1,class:"boundary-header"},Pg={key:0,class:"boundary-title"},qg={key:1,class:"boundary-description"},Hg=Se(s.defineComponent({__name:"DashboardRenderer",props:s.mergeModels({context:{},preview:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:s.mergeModels(["edit-tile","tile-time-range-zoom","tiles-loaded"],["update:modelValue"]),setup(n,{expose:e,emit:t}){if(s.useCssVars(H=>({v1cd09a39:R.value})),n.context.disableCoordination!==!0){const H=ws();s.provide($i,H)}const i=t,r=s.useModel(n,"modelValue"),o=s.computed(()=>Array.isArray(r.value)?r.value:[{definition:r.value}]),a=H=>o.value[H].definition,l=s.computed(()=>{const H=o.value.flatMap(B=>B.definition.tiles),K=B=>B.type==="slottable"||"definition"in B&&B.definition?.chart?.type==="slottable";return H.filter(B=>!K(B)).length}),{i18n:d}=le.useI18n(),c=s.ref(0),u=[],h=(H,K)=>{u[H]=K},f=s.ref(),g=s.ref(),R=s.ref("scale(1)"),E=new Set,C=s.inject(ve);C||(console.warn("Analytics dashboards require a query bridge supplied via provide / inject."),console.warn("Please ensure your application has a query bridge provided under the key 'analytics-query-provider', as described in"),console.warn("https://github.com/Kong/public-ui-components/blob/main/packages/analytics/dashboard-renderer/README.md#requirements")),le.useRequestQueue();const{exportPdf:v,exportState:k}=le.useExportPdf(g),I=(H,K)=>{E.add(`${K}-${H.id}`),E.size>=l.value&&i("tiles-loaded",!0)},O=s.computed(()=>{const K=`renderer.trendRange.${ne.value.type==="absolute"?"custom":ne.value.time_range}`;return d.te(K)?d.t(K):""}),x=(H,K)=>{const B=H.layout.position.row-K.layout.position.row;return B!==0?B:H.layout.position.col-K.layout.position.col},D=H=>H.tiles.map(K=>{if(N.value&&!K.id&&console.warn("No id provided for tile. One will be generated automatically,","however tracking changes to this tile may not work as expected.",K),K.type==="slottable")return{layout:K.layout,type:K.type,id:K.id??crypto.randomUUID()};let B=K.definition;const Y=K.type??"chart",M=Ma(B,O.value);return M!==B.header_description&&(B={...B,header_description:M}),{layout:K.layout,meta:B,type:Y,id:K.id??crypto.randomUUID()}}),U=s.computed(()=>o.value.map(H=>D(H.definition))),m=H=>{i("edit-tile",H)},p=H=>H.type==="slottable"?!0:H.meta?.chart.type==="slottable",_=H=>H.type==="slottable",T=H=>{if(H.type==="slottable")return H.id;const K=H.meta?.chart;return K&&_(K)?K.id:void 0},S=(H,K)=>{const B=a(K);try{const Y=Kg(H);B.tiles.push(JSON.parse(JSON.stringify(Y)))}catch(Y){console.warn(Y)}},q=(H,K)=>{u[K]?.removeWidget(H.id),E.delete(`${K}-${H.id}`)},P=()=>{E.clear(),c.value++},W=(H,K)=>{const B=a(K),Y=H.map(M=>M.type==="slottable"?{id:M.id,type:M.type,layout:M.layout}:{id:M.id,type:M.type,layout:M.layout,definition:M.meta});B.tiles=Y.sort(x)},j=async()=>{if(R.value="scale(1)",await s.nextTick(),g.value){const{availWidth:H,availHeight:K}=window.screen,{width:B,height:Y}=g.value.getBoundingClientRect(),M=Math.min(K/Y,H/B);R.value=`scale(${M})`}},F=()=>{f.value&&(document.fullscreenElement?document.exitFullscreen():f.value.requestFullscreen())},b=s.ref(!1),w=s.computed(()=>N.value&&!b.value),L=()=>{b.value=document.fullscreenElement!==null,b.value&&j()},{editable:N,enrichedContext:z,queryReady:A,showTileActions:ae,timeSpec:ne}=le.useDashboardContext({globalFilters:s.computed(()=>[]),context:s.computed(()=>n.context),isFullscreen:b,preview:s.computed(()=>n.preview)}),ce=H=>({...z.value,filters:[...n.context.filters??[],...H.preset_filters??[]]});return e({refresh:P,toggleFullscreen:F,exportPdf:v,pdfExportState:k}),(H,K)=>{const B=s.resolveComponent("KAlert");return s.openBlock(),s.createElementBlock("div",{ref_key:"dashboardContainer",ref:f,class:s.normalizeClass(["kong-ui-public-dashboard-renderer",{"is-fullscreen":b.value}]),onFullscreenchange:L},[s.createElementVNode("div",{ref_key:"layoutContainer",ref:g,class:"layout"},[s.unref(C)&&b.value?(s.openBlock(),s.createElementBlock("div",Mg,[s.renderSlot(H.$slots,"fullscreenHeader",{},void 0,!0)])):s.createCommentVNode("",!0),s.unref(C)?(s.openBlock(!0),s.createElementBlock(s.Fragment,{key:2},s.renderList(o.value,(Y,M)=>(s.openBlock(),s.createElementBlock("div",{key:`dash-${M}`,class:s.normalizeClass(["dashboard-boundary",{multiple:o.value.length>1}])},[Y.anchorId?(s.openBlock(),s.createElementBlock("a",{key:0,id:Y.anchorId},null,8,Bg)):s.createCommentVNode("",!0),Y.title||Y.description?(s.openBlock(),s.createElementBlock("div",zg,[Y.title?(s.openBlock(),s.createElementBlock("div",Pg,s.toDisplayString(Y.title),1)):s.createCommentVNode("",!0),Y.description?(s.openBlock(),s.createElementBlock("div",qg,s.toDisplayString(Y.description),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),(s.openBlock(),s.createBlock(Ug,{key:`layout-${w.value}`,ref_for:!0,ref:J=>h(M,J),"bottom-trim":o.value.length>1?4:0,columns:Y.definition.columns,editable:w.value,"tile-height":Y.definition.tile_height,tiles:U.value[M],onUpdateTiles:J=>W(J,M)},{tile:s.withCtx(({tile:J,fitToContent:de})=>[p(J)?(s.openBlock(),s.createElementBlock("div",{key:0,class:s.normalizeClass(["tile-container slottable-tile",{"fit-to-content":de}])},[s.renderSlot(H.$slots,T(J),{},void 0,!0)],2)):(s.openBlock(),s.createBlock(Kn,{key:b.value?`${J.id}-tile`:`${J.id}-tile-fullscreen`,"refresh-counter":c.value,"onUpdate:refreshCounter":K[0]||(K[0]=ee=>c.value=ee),class:"tile-container",context:ce(Y.definition),definition:J.meta,"fit-to-content":de,height:J.layout.size.rows*(Y.definition.tile_height||s.unref(tt))+parseInt(s.unref(qi),10),"hide-actions":!s.unref(ae),"is-fullscreen":b.value,preview:n.preview,"query-ready":s.unref(A),"tile-id":J.id,"tile-type":J.type,onDuplicateTile:ee=>S(J,M),onEditTile:ee=>m(J),onRemoveTile:ee=>q(J,M),onTileLoaded:ee=>I(J,M),onTileTimeRangeZoom:K[1]||(K[1]=ee=>i("tile-time-range-zoom",ee))},null,8,["refresh-counter","context","definition","fit-to-content","height","hide-actions","is-fullscreen","preview","query-ready","tile-id","tile-type","onDuplicateTile","onEditTile","onRemoveTile","onTileLoaded"]))]),_:2},1032,["bottom-trim","columns","editable","tile-height","tiles","onUpdateTiles"]))],2))),128)):(s.openBlock(),s.createBlock(B,{key:1,appearance:"danger"},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(d).t("renderer.noQueryBridge")),1)]),_:1}))],512)],34)}}}),[["__scopeId","data-v-db564ac2"]]),Gg=s.defineComponent({__name:"DashboardTilePreview",props:{context:{},definition:{},globalFilters:{default:()=>[]},preview:{type:Boolean,default:!1}},emits:["chart-data","tile-time-range-zoom","tile-bounds-change"],setup(n,{expose:e,emit:t}){const i=s.useTemplateRef("root"),r=s.useTemplateRef("dashboard-tile"),o=crypto.randomUUID(),a=t,l=I=>{a("tile-time-range-zoom",I)},d=I=>{a("chart-data",I)},c=I=>{a("tile-bounds-change",I)},{i18n:u}=le.useI18n(),{enrichedContext:h,queryReady:f}=le.useDashboardContext({globalFilters:s.toRef(()=>n.globalFilters),context:s.toRef(()=>n.context),preview:s.computed(()=>n.preview)}),g=s.computed(()=>De(n.definition)),R=s.computed(()=>g.value?"columns"in n.definition.query&&!n.definition.query.columns?.length:!("metrics"in n.definition.query)||!n.definition.query.metrics||n.definition.query.metrics.length===0),E=s.ref(tt);let C;s.onMounted(()=>{const I=i.value?.parentElement;I&&(E.value=I.getBoundingClientRect().height,C=new ResizeObserver(([O])=>{const{height:x}=O.contentRect;E.value=x}),C.observe(I))}),s.onUnmounted(()=>C?.disconnect());const v=s.ref(0);return e({refresh:()=>{v.value++},getExportData:()=>r.value?.getExportData()}),(I,O)=>{const x=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{ref_key:"root",ref:i,"data-testid":"dashboard-tile-preview-root"},[R.value?(s.openBlock(),s.createBlock(x,{key:0,"action-button-visible":!1,"data-testid":"chart-not-configured-empty-state"},{title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(s.unref(u).t("renderer.not_configured.title")),1)]),default:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(s.unref(u).t("renderer.not_configured.description")),1)]),_:1})):(s.openBlock(),s.createBlock(Kn,{key:1,ref:"dashboard-tile","refresh-counter":v.value,"onUpdate:refreshCounter":O[0]||(O[0]=D=>v.value=D),context:{...s.unref(h),editable:!1},definition:n.definition,height:E.value,"hide-actions":"",preview:n.preview,"query-ready":s.unref(f),"show-refresh":"","tile-id":s.unref(o),onChartData:d,onTileBoundsChange:c,onTileTimeRangeZoom:l},null,8,["refresh-counter","context","definition","height","preview","query-ready","tile-id"]))],512)}}}),$g=n=>{if(n.type!=="chart")return n;const e=n.definition?.query;if(!e)return n;if(e.datasource==="api_usage"){console.warn("[@kong-ui-public/dashboard-renderer] A tile was filtered out for the Basic Tier",n);return}return n},Fg=n=>{if(n.type!=="chart"||De(n.definition))return n;const e=n.definition?.query;if(!e)return n;const t={...e,datasource:e.datasource==="basic"?"api_usage":e.datasource};return{...n,definition:{...n.definition,query:t}}},Wg=(n,e=Bt)=>{if(!n.length)return[];let t=0,i=0,r=0;const o=[];for(const a of n){const l=a.layout?.size?.cols??1,d=a.layout?.size?.rows??1;i+l>e&&(t+=r,i=0,r=0);const c={...a,layout:{...a.layout,position:{...a.layout?.position??{},col:i,row:t}}};o.push(c),i+=l,r=Math.max(r,d)}return o},Vg=(n,e)=>{if(e){const r=n.tiles.map(Fg);return{...n,tiles:r}}const t=n.tiles.map($g).filter(r=>r!==void 0),i=Wg(t,n.columns);return{...n,tiles:i}},Yg=Object.freeze(Object.defineProperty({__proto__:null,default:s.defineComponent({__name:"GeoMapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["bounds-change"],setup(n,{emit:e}){const t=n,i=s.ref(void 0),r=s.computed(()=>i.value?ci.exploreResultToCountryMetrics(i.value):{}),o=s.computed(()=>i.value?i.value?.meta.metric_names&&i.value.meta.metric_names[0]:""),a=s.computed(()=>t.query.limit!==void 0&&t.query.limit>0?t.query.limit:ie.COUNTRIES.length),l=s.computed(()=>{if(!t.query.filters?.find(({field:g,operator:R})=>g==="country_code"&&(R==="not_empty"||R==="empty"||R==="in"))){const g={field:"country_code",operator:"not_empty"};return{...t.query,filters:[...t.query.filters||[],g]}}return t.query}),d=s.computed(()=>{if(!i.value)return"";const f=i?.value?.meta.metric_units,g=i?.value?.meta?.metric_names;return f&&g&&f[g[0]]}),c=f=>{i.value=f},u=e,h=f=>{u("bounds-change",f)};return(f,g)=>(s.openBlock(),s.createBlock(Be,{context:n.context,"limit-override":a.value,query:l.value,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onChartData:c},{default:s.withCtx(()=>[s.createVNode(s.unref(ci.AnalyticsGeoMap),{bounds:n.chartOptions.bounds,"country-metrics":r.value,"fit-to-country":n.chartOptions.fit_to_country,metric:o.value,"metric-unit":d.value,"with-legend":n.chartOptions.legend||!1,onBoundsChange:h},null,8,["bounds","country-metrics","fit-to-country","metric","metric-unit","with-legend"])]),_:1},8,["context","limit-override","query","query-ready","refresh-counter"]))}})},Symbol.toStringTag,{value:"Module"}));Q.CELLS_PER_ROW=it,Q.CP_ID_TOKEN=Fi,Q.CsvExportModal=ln,Q.DASHBOARD_COLS=Bt,Q.DEFAULT_TILE_HEIGHT=tt,Q.DEFAULT_TILE_REFRESH_INTERVAL_MS=Vi,Q.DashboardRenderer=Hg,Q.DashboardTilePreview=Gg,Q.ENTITY_ID_TOKEN=zt,Q.FULLSCREEN_LONG_REFRESH_INTERVAL_MS=Xi,Q.FULLSCREEN_SHORT_REFRESH_INTERVAL_MS=Yi,Q.INJECT_DASHBOARD_COORDINATOR=$i,Q.INJECT_QUERY_PROVIDER=ve,Q.TIMEFRAME_TOKEN=Wi,Q.configureAllowedDefinition=Vg,Q.getTimeRangeDurationMs=$t,Q.isTimeRangeUnsupported=Ft,Q.isTreemapCompatible=ti,Q.limitTimeRange=Wt,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));