@kong-ui-public/dashboard-renderer 10.0.3 → 10.0.4

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(V,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):(V=typeof globalThis<"u"?globalThis:V||self,s(V["kong-ui-public-dashboard-renderer"]={},V.Vue,V["kong-ui-public-analytics-utilities"],V.KongIcons,V["kong-ui-public-analytics-chart"],V.swrv,V["kong-ui-public-analytics-metric-provider"],V.AgGridVue,V.agGridCommunity,V["kong-ui-public-i18n"],V["kong-ui-public-analytics-config-store"],V.Kongponents,V.VueECharts,V.echarts,V.echarts,V.echarts,V.echarts,V.axios,V["kong-ui-public-analytics-geo-map"]))})(this,(function(V,s,J,re,we,si,oi,Pr,je,at,Te,qr,Hr,Tt,Gr,lt,ai,Kg,li){"use strict";const Fr=r=>{const e=r.length;let t=5381;for(let i=0;i<e;i++)t=t*33^r.charCodeAt(i);return t>>>0},$r="#0044f4",ci="#6c7489",Wr="#d60027",Vr="#ffc400",Yr="#bee2ff",Xr="#8fc1ff",jr="#5f9aff",Qr="#306fff",Zr="#b5ffee",Jr="#00fabe",en="#00d6a4",tn="#00a17b",rn="#007d60",nn="#005944",sn="#b5ffee",on="#00fabe",an="#b5ffee",ln="#00a17b",cn="#fff296",un="#ffe04b",dn="#ffc400",hn="#b37600",fn="#995c00",mn="#804400",pn="#fff296",gn="#ffe04b",_n="#ffc2b3",yn="#ff9877",Rn="#ff723c",Cn="#f75008",En="#d13500",On="#a31f00",bn="#ffc2b3",wn="#ff9877",Tn="#ff723c",vn="#f75008",Sn="#d13500",xn="#a31f00",In="#ffc2b3",Dn="#ff9877",kn="#ff723c",Nn="#f75008",An="#d13500",Ln="#a31f00",Un="#ffc2b3",Kn="#ff9877",Mn="#ff723c",Bn="#f75008",zn="#d13500",Pn="#a31f00",qn="#ffc2b3",Hn="#ff9877",Gn="#ff723c",Fn="#f75008",$n="#d13500",Wn="#ffabab",Vn="#ff7272",Yn="#ff3954",Xn="#f50045",jn="#d60027",Qn="#ad000e",Zn="#ffabab",Jn="#ff7272",es="#ff3954",ts="#f50045",is="#d60027",rs="#eefaff",ns="#ecfffb",ss="#fffce0",os="#fff1ef",as="#ffe5e5",ls="#5f9aff",cs="#00d6a4",us="#ffc400",ds="#ff723c",hs="#ff3954",fs={100:Yr,101:Xr,102:jr,103:Qr,200:Zr,201:Jr,202:en,203:tn,204:rn,205:nn,206:sn,207:on,208:an,226:ln,300:cn,301:un,302:dn,303:hn,304:fn,305:mn,307:pn,308:gn,400:_n,401:yn,402:Rn,403:Cn,404:En,405:On,406:bn,407:wn,408:Tn,409:vn,410:Sn,411:xn,412:In,413:Dn,414:kn,415:Nn,416:An,417:Ln,418:Un,421:Kn,422:Mn,423:Bn,424:zn,425:Pn,426:qn,428:Hn,429:Gn,431:Fn,451:$n,500:Wn,501:Vn,502:Yn,503:Xn,504:jn,505:Qn,506:Zn,507:Jn,508:es,510:ts,511:is},ms={100:rs,200:ns,300:ss,400:os,500:as},ui={"1XX":ls,"2XX":cs,"3XX":us,"4XX":ds,"5XX":hs},ps={error:Wr,warning:Vr,empty:"#9DA99D",neutral:ci,____OTHER____:$r},vt=["#0076F4","#00819D","#00A17B","#8A50FF","#FF3C99","#FF6D3C","#B3A100"],St=["#5485BA","#087D96","#3D8776","#7654BA","#A1406F","#BF5430","#B5A72C"],gs=r=>Fr(r),_s=({theme:r="light"}={})=>r==="dark"?St:vt,di=({discriminator:r,theme:e="light"})=>{const t=Math.abs(Math.floor(r));return e==="dark"?St[t%St.length]:vt[t%vt.length]},Qe=({state:r})=>ps[r]??ci,ys=({statusCode:r})=>{const e=typeof r=="number"?r:Number.parseInt(r,10),t=`${e}`,i=`${Math.floor(e/100)*100}`;return fs[t]??ms[i]??Qe({state:"neutral"})},Rs=({group:r})=>ui[r]?ui[r]:Qe({state:"neutral"}),Cs=({discriminator:r=void 0,state:e=void 0,dimension:t=void 0,dimensionValue:i=void 0,metric:n=void 0,coordinator:o=void 0,order:a=void 0,chartUuid:l=void 0,customDimensionColors:u=void 0})=>{let c="light";if(s.hasInjectionContext()&&(c=s.inject("app:konnectColorMode",s.computed(()=>"light")).value),e!==void 0)return Qe({state:e});if(i!==void 0&&u!==void 0&&u[i])return u[i];if(i&&["empty","____OTHER____"].includes(i))return Qe({state:i});if(t!==void 0&&i!==void 0){if(t==="status_code")return ys({statusCode:i});if(t==="status_code_grouped")return Rs({group:i})}if(r!==void 0)return di({discriminator:r,theme:c});if(t||i||n){const d=`${t??""}${i??""}${n??""}`,h=o?o.resolveDiscriminator({name:d,order:a,chartUuid:l,theme:c}):gs(d);return di({discriminator:h,theme:c})}return Qe({state:"neutral"})},Es="__no_chart__";function Os(){const r=new Map,e=new Map,t=new Map,i=o=>{e.set(o,(e.get(o)??0)+1)},n=(o,a)=>{let l=-1,u=1/0;for(let c=0;c<o;c++){if(a.has(c))continue;const d=e.get(c)??0;d<u&&(l=c,u=d)}return l!==-1?l:o<1?0:n(o,new Set)};return{resolveDiscriminator:({name:o,order:a,chartUuid:l,theme:u})=>{const c=l??Es,d=a??null,h=_s({theme:u});let f;if(r.has(o))f=r.get(o);else{const m=new Set,R=t.get(c);d!==null&&R?.order!==null&&R?.order!==void 0&&d===R.order+1&&m.add(R.index);const E=h.length;f=n(E,m),r.set(o,f),i(f)}return t.set(c,{order:d,index:f}),f},reset:()=>{r.clear(),e.clear(),t.clear()}}}function bs(){const r=s.ref(null),e=s.ref(null),t=s.ref(null),i=s.ref(null),n=s.ref(null),o=300,a=300,l=10,u=Os(),c=({chartUuid:h,timestamp:f=null,dimension:m=null,dimensionValue:R=null,metric:E=null})=>{r.value=h,e.value=f,t.value=m,i.value=R,n.value=E},d=({chartUuid:h})=>{r.value===h&&(r.value=null,e.value=null,t.value=null,i.value=null,n.value=null)};return{activate:c,activeChart:s.readonly(r),activeDimension:s.readonly(t),activeDimensionValue:s.readonly(i),activeMetric:s.readonly(n),activeTimestamp:s.readonly(e),deactivate:d,DIMENSION_DEBOUNCE_MS:o,METRIC_DEBOUNCE_MS:a,TIMESTAMP_DEBOUNCE_MS:l,color:u}}const ws={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"}},Ts=(r,e,t)=>{let i;const n=ws[r];return typeof n=="string"?i=n:e===1?i=n.one:i=n.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+i:i+" ago":i};function xt(r){return(e={})=>{const t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}const vs={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ss={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},xs={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Is={date:xt({formats:vs,defaultWidth:"full"}),time:xt({formats:Ss,defaultWidth:"full"}),dateTime:xt({formats:xs,defaultWidth:"full"})},Ds={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ks=(r,e,t,i)=>Ds[r];function Ze(r){return(e,t)=>{const i=t?.context?String(t.context):"standalone";let n;if(i==="formatting"&&r.formattingValues){const a=r.defaultFormattingWidth||r.defaultWidth,l=t?.width?String(t.width):a;n=r.formattingValues[l]||r.formattingValues[a]}else{const a=r.defaultWidth,l=t?.width?String(t.width):r.defaultWidth;n=r.values[l]||r.values[a]}const o=r.argumentCallback?r.argumentCallback(e):e;return n[o]}}const Ns={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},As={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Ls={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"]},Us={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"]},Ks={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"}},Ms={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"}},Bs={ordinalNumber:(r,e)=>{const t=Number(r),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:Ze({values:Ns,defaultWidth:"wide"}),quarter:Ze({values:As,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Ze({values:Ls,defaultWidth:"wide"}),day:Ze({values:Us,defaultWidth:"wide"}),dayPeriod:Ze({values:Ks,defaultWidth:"wide",formattingValues:Ms,defaultFormattingWidth:"wide"})};function Je(r){return(e,t={})=>{const i=t.width,n=i&&r.matchPatterns[i]||r.matchPatterns[r.defaultMatchWidth],o=e.match(n);if(!o)return null;const a=o[0],l=i&&r.parsePatterns[i]||r.parsePatterns[r.defaultParseWidth],u=Array.isArray(l)?Ps(l,h=>h.test(a)):zs(l,h=>h.test(a));let c;c=r.valueCallback?r.valueCallback(u):u,c=t.valueCallback?t.valueCallback(c):c;const d=e.slice(a.length);return{value:c,rest:d}}}function zs(r,e){for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}function Ps(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return t}function qs(r){return(e,t={})=>{const i=e.match(r.matchPattern);if(!i)return null;const n=i[0],o=e.match(r.parsePattern);if(!o)return null;let a=r.valueCallback?r.valueCallback(o[0]):o[0];a=t.valueCallback?t.valueCallback(a):a;const l=e.slice(n.length);return{value:a,rest:l}}}const Hs=/^(\d+)(th|st|nd|rd)?/i,Gs=/\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},$s={any:[/^b/i,/^(a|c)/i]},Ws={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Vs={any:[/1/i,/2/i,/3/i,/4/i]},Ys={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},Xs={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]},js={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},Qs={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]},Zs={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},Js={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}},eo={ordinalNumber:qs({matchPattern:Hs,parsePattern:Gs,valueCallback:r=>parseInt(r,10)}),era:Je({matchPatterns:Fs,defaultMatchWidth:"wide",parsePatterns:$s,defaultParseWidth:"any"}),quarter:Je({matchPatterns:Ws,defaultMatchWidth:"wide",parsePatterns:Vs,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Je({matchPatterns:Ys,defaultMatchWidth:"wide",parsePatterns:Xs,defaultParseWidth:"any"}),day:Je({matchPatterns:js,defaultMatchWidth:"wide",parsePatterns:Qs,defaultParseWidth:"any"}),dayPeriod:Je({matchPatterns:Zs,defaultMatchWidth:"any",parsePatterns:Js,defaultParseWidth:"any"})},to={code:"en-US",formatDistance:Ts,formatLong:Is,formatRelative:ks,localize:Bs,match:eo,options:{weekStartsOn:0,firstWeekContainsDate:1}};let io={};function et(){return io}const hi=6048e5,ro=864e5,fi=Symbol.for("constructDateFrom");function Ke(r,e){return typeof r=="function"?r(e):r&&typeof r=="object"&&fi in r?r[fi](e):r instanceof Date?new r.constructor(e):new Date(e)}function ve(r,e){return Ke(e||r,r)}function mi(r){const e=ve(r),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+r-+t}function no(r,...e){const t=Ke.bind(null,e.find(i=>typeof i=="object"));return e.map(t)}function pi(r,e){const t=ve(r,e?.in);return t.setHours(0,0,0,0),t}function so(r,e,t){const[i,n]=no(t?.in,r,e),o=pi(i),a=pi(n),l=+o-mi(o),u=+a-mi(a);return Math.round((l-u)/ro)}function oo(r,e){const t=ve(r,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function ao(r,e){const t=ve(r,e?.in);return so(t,oo(t))+1}function tt(r,e){const t=et(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,n=ve(r,e?.in),o=n.getDay(),a=(o<i?7:0)+o-i;return n.setDate(n.getDate()-a),n.setHours(0,0,0,0),n}function ct(r,e){return tt(r,{...e,weekStartsOn:1})}function gi(r,e){const t=ve(r,e?.in),i=t.getFullYear(),n=Ke(t,0);n.setFullYear(i+1,0,4),n.setHours(0,0,0,0);const o=ct(n),a=Ke(t,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const l=ct(a);return t.getTime()>=o.getTime()?i+1:t.getTime()>=l.getTime()?i:i-1}function lo(r,e){const t=gi(r,e),i=Ke(r,0);return i.setFullYear(t,0,4),i.setHours(0,0,0,0),ct(i)}function co(r,e){const t=ve(r,e?.in),i=+ct(t)-+lo(t);return Math.round(i/hi)+1}function _i(r,e){const t=ve(r,e?.in),i=t.getFullYear(),n=et(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=Ke(e?.in||r,0);a.setFullYear(i+1,0,o),a.setHours(0,0,0,0);const l=tt(a,e),u=Ke(e?.in||r,0);u.setFullYear(i,0,o),u.setHours(0,0,0,0);const c=tt(u,e);return+t>=+l?i+1:+t>=+c?i:i-1}function uo(r,e){const t=et(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,n=_i(r,e),o=Ke(e?.in||r,0);return o.setFullYear(n,0,i),o.setHours(0,0,0,0),tt(o,e)}function ho(r,e){const t=ve(r,e?.in),i=+tt(t,e)-+uo(t,e);return Math.round(i/hi)+1}function se(r,e){const t=r<0?"-":"",i=Math.abs(r).toString().padStart(e,"0");return t+i}const Me={y(r,e){const t=r.getFullYear(),i=t>0?t:1-t;return se(e==="yy"?i%100:i,e.length)},M(r,e){const t=r.getMonth();return e==="M"?String(t+1):se(t+1,2)},d(r,e){return se(r.getDate(),e.length)},a(r,e){const t=r.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(r,e){return se(r.getHours()%12||12,e.length)},H(r,e){return se(r.getHours(),e.length)},m(r,e){return se(r.getMinutes(),e.length)},s(r,e){return se(r.getSeconds(),e.length)},S(r,e){const t=e.length,i=r.getMilliseconds(),n=Math.trunc(i*Math.pow(10,t-3));return se(n,e.length)}},$e={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},yi={G:function(r,e,t){const i=r.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(r,e,t){if(e==="yo"){const i=r.getFullYear(),n=i>0?i:1-i;return t.ordinalNumber(n,{unit:"year"})}return Me.y(r,e)},Y:function(r,e,t,i){const n=_i(r,i),o=n>0?n:1-n;if(e==="YY"){const a=o%100;return se(a,2)}return e==="Yo"?t.ordinalNumber(o,{unit:"year"}):se(o,e.length)},R:function(r,e){const t=gi(r);return se(t,e.length)},u:function(r,e){const t=r.getFullYear();return se(t,e.length)},Q:function(r,e,t){const i=Math.ceil((r.getMonth()+1)/3);switch(e){case"Q":return String(i);case"QQ":return se(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(r,e,t){const i=Math.ceil((r.getMonth()+1)/3);switch(e){case"q":return String(i);case"qq":return se(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(r,e,t){const i=r.getMonth();switch(e){case"M":case"MM":return Me.M(r,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(r,e,t){const i=r.getMonth();switch(e){case"L":return String(i+1);case"LL":return se(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(r,e,t,i){const n=ho(r,i);return e==="wo"?t.ordinalNumber(n,{unit:"week"}):se(n,e.length)},I:function(r,e,t){const i=co(r);return e==="Io"?t.ordinalNumber(i,{unit:"week"}):se(i,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):Me.d(r,e)},D:function(r,e,t){const i=ao(r);return e==="Do"?t.ordinalNumber(i,{unit:"dayOfYear"}):se(i,e.length)},E:function(r,e,t){const i=r.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(r,e,t,i){const n=r.getDay(),o=(n-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return se(o,2);case"eo":return t.ordinalNumber(o,{unit:"day"});case"eee":return t.day(n,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(n,{width:"short",context:"formatting"});default:return t.day(n,{width:"wide",context:"formatting"})}},c:function(r,e,t,i){const n=r.getDay(),o=(n-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return se(o,e.length);case"co":return t.ordinalNumber(o,{unit:"day"});case"ccc":return t.day(n,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(n,{width:"narrow",context:"standalone"});case"cccccc":return t.day(n,{width:"short",context:"standalone"});default:return t.day(n,{width:"wide",context:"standalone"})}},i:function(r,e,t){const i=r.getDay(),n=i===0?7:i;switch(e){case"i":return String(n);case"ii":return se(n,e.length);case"io":return t.ordinalNumber(n,{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(r,e,t){const n=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(r,e,t){const i=r.getHours();let n;switch(i===12?n=$e.noon:i===0?n=$e.midnight:n=i/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(r,e,t){const i=r.getHours();let n;switch(i>=17?n=$e.evening:i>=12?n=$e.afternoon:i>=4?n=$e.morning:n=$e.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(n,{width:"narrow",context:"formatting"});default:return t.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(r,e,t){if(e==="ho"){let i=r.getHours()%12;return i===0&&(i=12),t.ordinalNumber(i,{unit:"hour"})}return Me.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):Me.H(r,e)},K:function(r,e,t){const i=r.getHours()%12;return e==="Ko"?t.ordinalNumber(i,{unit:"hour"}):se(i,e.length)},k:function(r,e,t){let i=r.getHours();return i===0&&(i=24),e==="ko"?t.ordinalNumber(i,{unit:"hour"}):se(i,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):Me.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):Me.s(r,e)},S:function(r,e){return Me.S(r,e)},X:function(r,e,t){const i=r.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return Ci(i);case"XXXX":case"XX":return Pe(i);default:return Pe(i,":")}},x:function(r,e,t){const i=r.getTimezoneOffset();switch(e){case"x":return Ci(i);case"xxxx":case"xx":return Pe(i);default:return Pe(i,":")}},O:function(r,e,t){const i=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Ri(i,":");default:return"GMT"+Pe(i,":")}},z:function(r,e,t){const i=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Ri(i,":");default:return"GMT"+Pe(i,":")}},t:function(r,e,t){const i=Math.trunc(+r/1e3);return se(i,e.length)},T:function(r,e,t){return se(+r,e.length)}};function Ri(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),n=Math.trunc(i/60),o=i%60;return o===0?t+String(n):t+String(n)+e+se(o,2)}function Ci(r,e){return r%60===0?(r>0?"-":"+")+se(Math.abs(r)/60,2):Pe(r,e)}function Pe(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),n=se(Math.trunc(i/60),2),o=se(i%60,2);return t+n+e+o}const Ei=(r,e)=>{switch(r){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"})}},Oi=(r,e)=>{switch(r){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"})}},fo={p:Oi,P:(r,e)=>{const t=r.match(/(P+)(p+)?/)||[],i=t[1],n=t[2];if(!n)return Ei(r,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}}",Ei(i,e)).replace("{{time}}",Oi(n,e))}},mo=/^D+$/,po=/^Y+$/,go=["D","DD","YY","YYYY"];function _o(r){return mo.test(r)}function yo(r){return po.test(r)}function Ro(r,e,t){const i=Co(r,e,t);if(console.warn(i),go.includes(r))throw new RangeError(i)}function Co(r,e,t){const i=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${i} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function Eo(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function Oo(r){return!(!Eo(r)&&typeof r!="number"||isNaN(+ve(r)))}const bo=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,wo=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,To=/^'([^]*?)'?$/,vo=/''/g,So=/[a-zA-Z]/;function xo(r,e,t){const i=et(),n=t?.locale??i.locale??to,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=ve(r,t?.in);if(!Oo(l))throw new RangeError("Invalid time value");let u=e.match(wo).map(d=>{const h=d[0];if(h==="p"||h==="P"){const f=fo[h];return f(d,n.formatLong)}return d}).join("").match(bo).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const h=d[0];if(h==="'")return{isToken:!1,value:Io(d)};if(yi[h])return{isToken:!0,value:d};if(h.match(So))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:d}});n.localize.preprocessor&&(u=n.localize.preprocessor(l,u));const c={firstWeekContainsDate:o,weekStartsOn:a,locale:n};return u.map(d=>{if(!d.isToken)return d.value;const h=d.value;(!t?.useAdditionalWeekYearTokens&&yo(h)||!t?.useAdditionalDayOfYearTokens&&_o(h))&&Ro(h,e,String(r));const f=yi[h[0]];return f(l,h,n.localize,c)}).join("")}function Io(r){const e=r.match(To);return e?e[1].replace(vo,"'"):r}function Do(){return Object.assign({},et())}function bi(r,e,t){const i=Do(),n=Ao(r,t.timeZone,t.locale??i.locale);return"formatToParts"in n?ko(n,e):No(n,e)}function ko(r,e){const t=r.formatToParts(e);for(let i=t.length-1;i>=0;--i)if(t[i].type==="timeZoneName")return t[i].value}function No(r,e){const t=r.format(e).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(t);return i?i[0].substr(1):""}function Ao(r,e,t){return new Intl.DateTimeFormat(t?[t.code,"en-US"]:void 0,{timeZone:e,timeZoneName:r})}function Lo(r,e){const t=zo(e);return"formatToParts"in t?Ko(t,r):Mo(t,r)}const Uo={year:0,month:1,day:2,hour:3,minute:4,second:5};function Ko(r,e){try{const t=r.formatToParts(e),i=[];for(let n=0;n<t.length;n++){const o=Uo[t[n].type];o!==void 0&&(i[o]=parseInt(t[n].value,10))}return i}catch(t){if(t instanceof RangeError)return[NaN];throw t}}function Mo(r,e){const t=r.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={},wi=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")),Bo=wi==="06/25/2014, 00:00:00"||wi==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";function zo(r){return It[r]||(It[r]=Bo?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:r,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),It[r]}function Ti(r,e,t,i,n,o,a){const l=new Date(0);return l.setUTCFullYear(r,e,t),l.setUTCHours(i,n,o,a),l}const vi=36e5,Po=6e4,Dt={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function kt(r,e,t){if(!r)return 0;let i=Dt.timezoneZ.exec(r);if(i)return 0;let n,o;if(i=Dt.timezoneHH.exec(r),i)return n=parseInt(i[1],10),Si(n)?-(n*vi):NaN;if(i=Dt.timezoneHHMM.exec(r),i){n=parseInt(i[2],10);const a=parseInt(i[3],10);return Si(n,a)?(o=Math.abs(n)*vi+a*Po,i[1]==="+"?-o:o):NaN}if(Go(r)){e=new Date(e||Date.now());const a=t?e:qo(e),l=Nt(a,r);return-(t?l:Ho(e,l,r))}return NaN}function qo(r){return Ti(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds())}function Nt(r,e){const t=Lo(r,e),i=Ti(t[0],t[1]-1,t[2],t[3]%24,t[4],t[5],0).getTime();let n=r.getTime();const o=n%1e3;return n-=o>=0?o:1e3+o,i-n}function Ho(r,e,t){let n=r.getTime()-e;const o=Nt(new Date(n),t);if(e===o)return e;n-=o-e;const a=Nt(new Date(n),t);return o===a?o:Math.max(o,a)}function Si(r,e){return-23<=r&&r<=23&&(e==null||0<=e&&e<=59)}const xi={};function Go(r){if(xi[r])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:r}),xi[r]=!0,!0}catch{return!1}}const Fo=60*1e3,$o={X:function(r,e,t){const i=At(t.timeZone,r);if(i===0)return"Z";switch(e){case"X":return Ii(i);case"XXXX":case"XX":return We(i);default:return We(i,":")}},x:function(r,e,t){const i=At(t.timeZone,r);switch(e){case"x":return Ii(i);case"xxxx":case"xx":return We(i);default:return We(i,":")}},O:function(r,e,t){const i=At(t.timeZone,r);switch(e){case"O":case"OO":case"OOO":return"GMT"+Wo(i,":");default:return"GMT"+We(i,":")}},z:function(r,e,t){switch(e){case"z":case"zz":case"zzz":return bi("short",r,t);default:return bi("long",r,t)}}};function At(r,e){const t=r?kt(r,e,!0)/Fo:e?.getTimezoneOffset()??0;if(Number.isNaN(t))throw new RangeError("Invalid time zone specified: "+r);return t}function ut(r,e){const t=r<0?"-":"";let i=Math.abs(r).toString();for(;i.length<e;)i="0"+i;return t+i}function We(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),n=ut(Math.floor(i/60),2),o=ut(Math.floor(i%60),2);return t+n+e+o}function Ii(r,e){return r%60===0?(r>0?"-":"+")+ut(Math.abs(r)/60,2):We(r,e)}function Wo(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),n=Math.floor(i/60),o=i%60;return o===0?t+String(n):t+String(n)+e+ut(o,2)}function Di(r){const e=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()));return e.setUTCFullYear(r.getFullYear()),+r-+e}const Vo=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Lt=36e5,ki=6e4,Yo=2,pe={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:Vo};function Ni(r,e={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(r===null)return new Date(NaN);const t=e.additionalDigits==null?Yo:Number(e.additionalDigits);if(t!==2&&t!==1&&t!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]")return new Date(r.getTime());if(typeof r=="number"||Object.prototype.toString.call(r)==="[object Number]")return new Date(r);if(Object.prototype.toString.call(r)!=="[object String]")return new Date(NaN);const i=Xo(r),{year:n,restDateString:o}=jo(i.date,t),a=Qo(o,n);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const l=a.getTime();let u=0,c;if(i.time&&(u=Zo(i.time),u===null||isNaN(u)))return new Date(NaN);if(i.timeZone||e.timeZone){if(c=kt(i.timeZone||e.timeZone,new Date(l+u)),isNaN(c))return new Date(NaN)}else c=Di(new Date(l+u)),c=Di(new Date(l+u+c));return new Date(l+u+c)}else return new Date(NaN)}function Xo(r){const e={};let t=pe.dateTimePattern.exec(r),i;if(t?(e.date=t[1],i=t[3]):(t=pe.datePattern.exec(r),t?(e.date=t[1],i=t[2]):(e.date=null,i=r)),i){const n=pe.timeZone.exec(i);n?(e.time=i.replace(n[1],""),e.timeZone=n[1].trim()):e.time=i}return e}function jo(r,e){if(r){const t=pe.YYY[e],i=pe.YYYYY[e];let n=pe.YYYY.exec(r)||i.exec(r);if(n){const o=n[1];return{year:parseInt(o,10),restDateString:r.slice(o.length)}}if(n=pe.YY.exec(r)||t.exec(r),n){const o=n[1];return{year:parseInt(o,10)*100,restDateString:r.slice(o.length)}}}return{year:null}}function Qo(r,e){if(e===null)return null;let t,i,n;if(!r||!r.length)return t=new Date(0),t.setUTCFullYear(e),t;let o=pe.MM.exec(r);if(o)return t=new Date(0),i=parseInt(o[1],10)-1,Ui(e,i)?(t.setUTCFullYear(e,i),t):new Date(NaN);if(o=pe.DDD.exec(r),o){t=new Date(0);const a=parseInt(o[1],10);return ta(e,a)?(t.setUTCFullYear(e,0,a),t):new Date(NaN)}if(o=pe.MMDD.exec(r),o){t=new Date(0),i=parseInt(o[1],10)-1;const a=parseInt(o[2],10);return Ui(e,i,a)?(t.setUTCFullYear(e,i,a),t):new Date(NaN)}if(o=pe.Www.exec(r),o)return n=parseInt(o[1],10)-1,Ki(n)?Ai(e,n):new Date(NaN);if(o=pe.WwwD.exec(r),o){n=parseInt(o[1],10)-1;const a=parseInt(o[2],10)-1;return Ki(n,a)?Ai(e,n,a):new Date(NaN)}return null}function Zo(r){let e,t,i=pe.HH.exec(r);if(i)return e=parseFloat(i[1].replace(",",".")),Ut(e)?e%24*Lt:NaN;if(i=pe.HHMM.exec(r),i)return e=parseInt(i[1],10),t=parseFloat(i[2].replace(",",".")),Ut(e,t)?e%24*Lt+t*ki:NaN;if(i=pe.HHMMSS.exec(r),i){e=parseInt(i[1],10),t=parseInt(i[2],10);const n=parseFloat(i[3].replace(",","."));return Ut(e,t,n)?e%24*Lt+t*ki+n*1e3:NaN}return null}function Ai(r,e,t){e=e||0,t=t||0;const i=new Date(0);i.setUTCFullYear(r,0,4);const n=i.getUTCDay()||7,o=e*7+t+1-n;return i.setUTCDate(i.getUTCDate()+o),i}const Jo=[31,28,31,30,31,30,31,31,30,31,30,31],ea=[31,29,31,30,31,30,31,31,30,31,30,31];function Li(r){return r%400===0||r%4===0&&r%100!==0}function Ui(r,e,t){if(e<0||e>11)return!1;if(t!=null){if(t<1)return!1;const i=Li(r);if(i&&t>ea[e]||!i&&t>Jo[e])return!1}return!0}function ta(r,e){if(e<1)return!1;const t=Li(r);return!(t&&e>366||!t&&e>365)}function Ki(r,e){return!(r<0||r>52||e!=null&&(e<0||e>6))}function Ut(r,e,t){return!(r<0||r>=25||e!=null&&(e<0||e>=60)||t!=null&&(t<0||t>=60))}const ia=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Kt(r,e,t={}){e=String(e);const i=e.match(ia);if(i){const n=Ni(t.originalDate||r,t);e=i.reduce(function(o,a){if(a[0]==="'")return o;const l=o.indexOf(a),u=o[l-1]==="'",c=o.replace(a,"'"+$o[a[0]](n,a,t)+"'");return u?c.substring(0,l-1)+c.substring(l+1):c},e)}return xo(r,e,t)}function ra(r,e,t){r=Ni(r,t);const i=kt(e,r,!0),n=new Date(r.getTime()-i),o=new Date(0);return o.setFullYear(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),o.setHours(n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds(),n.getUTCMilliseconds()),o}function na(r,e,t,i){return i={...i,timeZone:e,originalDate:r},Kt(ra(r,e,{timeZone:i.timeZone}),t,i)}const Mt="#6c7489",Mi="12px",sa="16px",Bi="20px",zi="32px",Pi="20px";var dt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function oa(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ht={exports:{}},aa=ht.exports,qi;function la(){return qi||(qi=1,(function(r,e){(function(t,i){i()})(aa,function(){function t(c,d){return typeof d>"u"?d={autoBom:!1}:typeof d!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),d={autoBom:!d}),d.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,d,h){var f=new XMLHttpRequest;f.open("GET",c),f.responseType="blob",f.onload=function(){u(f.response,d,h)},f.onerror=function(){console.error("could not download file")},f.send()}function n(c){var d=new XMLHttpRequest;d.open("HEAD",c,!1);try{d.send()}catch{}return 200<=d.status&&299>=d.status}function o(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var d=document.createEvent("MouseEvents");d.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(d)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof dt=="object"&&dt.global===dt?dt:void 0,l=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),u=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!l?function(c,d,h){var f=a.URL||a.webkitURL,m=document.createElement("a");d=d||c.name||"download",m.download=d,m.rel="noopener",typeof c=="string"?(m.href=c,m.origin===location.origin?o(m):n(m.href)?i(c,d,h):o(m,m.target="_blank")):(m.href=f.createObjectURL(c),setTimeout(function(){f.revokeObjectURL(m.href)},4e4),setTimeout(function(){o(m)},0))}:"msSaveOrOpenBlob"in navigator?function(c,d,h){if(d=d||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(t(c,h),d);else if(n(c))i(c,d,h);else{var f=document.createElement("a");f.href=c,f.target="_blank",setTimeout(function(){o(f)})}}:function(c,d,h,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof c=="string")return i(c,d,h);var m=c.type==="application/octet-stream",R=/constructor/i.test(a.HTMLElement)||a.safari,E=/CriOS\/[\d]+/.test(navigator.userAgent);if((E||m&&R||l)&&typeof FileReader<"u"){var C=new FileReader;C.onloadend=function(){var w=C.result;w=E?w:w.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=w:location=w,f=null},C.readAsDataURL(c)}else{var x=a.URL||a.webkitURL,I=x.createObjectURL(c);f?f.location=I:location.href=I,f=null,setTimeout(function(){x.revokeObjectURL(I)},4e4)}});a.saveAs=u.saveAs=u,r.exports=u})})(ht)),ht.exports}var ca=la(),ft={exports:{}};var ua=ft.exports,Hi;function da(){return Hi||(Hi=1,(function(r,e){((t,i)=>{r.exports=i()})(ua,function t(){var i=typeof self<"u"?self:typeof window<"u"?window:i!==void 0?i:{},n=!i.document&&!!i.postMessage,o=i.IS_PAPA_WORKER||!1,a={},l=0,u={};function c(p){return p.charCodeAt(0)===65279?p.slice(1):p}function d(p){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 _=v(g);_.chunkSize=parseInt(_.chunkSize),g.step||g.chunk||(_.chunkSize=null),this._handle=new E(_),(this._handle.streamer=this)._config=_}).call(this,p),this.parseChunk=function(g,_){var T=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<T){let L=this._config.newline;L||(S=this._config.quoteChar||'"',L=this._handle.guessLineEndings(g,S)),g=[...g.split(L).slice(T)].join(L)}this.isFirstChunk&&A(this._config.beforeFirstChunk)&&(S=this._config.beforeFirstChunk(g))!==void 0&&(g=S),this.isFirstChunk=!1,this._halted=!1;var T=this._partialLine+g,S=(this._partialLine="",this._handle.parse(T,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(g=S.meta.cursor,T=(this._finished||(this._partialLine=T.substring(g-this._baseIndex),this._baseIndex=g),S&&S.data&&(this._rowCount+=S.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)i.postMessage({results:S,workerId:u.WORKER_ID,finished:T});else if(A(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||!A(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(g){A(this._config.error)?this._config.error(g):o&&this._config.error&&i.postMessage({workerId:u.WORKER_ID,error:g,finished:!1})}}function h(p){var g;(p=p||{}).chunkSize||(p.chunkSize=u.RemoteChunkSize),d.call(this,p),this._nextChunk=n?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),n||(g.onload=N(this._chunkLoaded,this),g.onerror=N(this._chunkError,this)),g.ontimeout=N(this._chunkTimeout,this),g.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadTimeout&&!n&&(g.timeout=this._config.downloadTimeout),this._config.downloadRequestHeaders){var _,T=this._config.downloadRequestHeaders;for(_ in T)g.setRequestHeader(_,T[_])}var S;this._config.chunkSize&&(S=this._start+this._config.chunkSize-1,g.setRequestHeader("Range","bytes="+this._start+"-"+S));try{g.send(this._config.downloadRequestBody)}catch(L){this._chunkError(L.message)}n&&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(p){(p=p||{}).chunkSize||(p.chunkSize=u.LocalChunkSize),d.call(this,p);var g,_,T=typeof FileReader<"u";this.stream=function(S){this._input=S,_=S.slice||S.webkitSlice||S.mozSlice,T?((g=new FileReader).onload=N(this._chunkLoaded,this),g.onerror=N(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 S=this._input,L=(this._config.chunkSize&&(L=Math.min(this._start+this._config.chunkSize,this._input.size),S=_.call(S,this._start,L)),g.readAsText(S,this._config.encoding));T||this._chunkLoaded({target:{result:L}})},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(g.error)}}function m(p){var g;d.call(this,p=p||{}),this.stream=function(_){return g=_,this._nextChunk()},this._nextChunk=function(){var _,T;if(!this._finished)return _=this._config.chunkSize,g=_?(T=g.substring(0,_),g.substring(_)):(T=g,""),this._finished=!g,this.parseChunk(T)}}function R(p){d.call(this,p=p||{});var g=[],_=!0,T=!1;this.pause=function(){d.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){d.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&&g.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),g.length?this.parseChunk(g.shift()):_=!0},this._streamData=N(function(S){try{g.push(typeof S=="string"?S:S.toString(this._config.encoding)),_&&(_=!1,this._checkIsFinished(),this.parseChunk(g.shift()))}catch(L){this._streamError(L)}},this),this._streamError=N(function(S){this._streamCleanUp(),this._sendError(S)},this),this._streamEnd=N(function(){this._streamCleanUp(),T=!0,this._streamData("")},this),this._streamCleanUp=N(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function E(p){var g,_,T,S,L=Math.pow(2,53),K=-L,H=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,Y=/^((\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)))$/,P=this,F=0,M=0,U=!1,b=!1,k=[],D={data:[],errors:[],meta:{}};function j(Q){return p.skipEmptyLines==="greedy"?Q.join("").trim()==="":Q.length===1&&Q[0].length===0}function ee(){if(D&&T&&(ye("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),T=!1),p.skipEmptyLines&&(D.data=D.data.filter(function(G){return!j(G)})),ie()){let G=function(ce){k.push(ce)};if(D)if(Array.isArray(D.data[0])){for(var Q=0;ie()&&Q<D.data.length;Q++)D.data[Q].forEach(G);D.data.splice(0,1)}else D.data.forEach(G)}function W(G,ce){for(var ue=p.header?{}:[],ne=0;ne<G.length;ne++){var te=ne,X=G[ne],X=((Re,$)=>(le=>(p.dynamicTypingFunction&&p.dynamicTyping[le]===void 0&&(p.dynamicTyping[le]=p.dynamicTypingFunction(le)),(p.dynamicTyping[le]||p.dynamicTyping)===!0))(Re)?$==="true"||$==="TRUE"||$!=="false"&&$!=="FALSE"&&((le=>{if(H.test(le)&&(le=parseFloat(le),K<le&&le<L))return 1})($)?parseFloat($):Y.test($)?new Date($):$===""?null:$):$)(te=p.header?ne>=k.length?"__parsed_extra":k[ne]:te,X=p.transform?p.transform(X,te):X);te==="__parsed_extra"?(ue[te]=ue[te]||[],ue[te].push(X)):ue[te]=X}return p.header&&(ne>k.length?ye("FieldMismatch","TooManyFields","Too many fields: expected "+k.length+" fields but parsed "+ne,M+ce):ne<k.length&&ye("FieldMismatch","TooFewFields","Too few fields: expected "+k.length+" fields but parsed "+ne,M+ce)),ue}var oe;D&&(p.header||p.dynamicTyping||p.transform)&&(oe=1,!D.data.length||Array.isArray(D.data[0])?(D.data=D.data.map(W),oe=D.data.length):D.data=W(D.data,0),p.header&&D.meta&&(D.meta.fields=k),M+=oe)}function ie(){return p.header&&k.length===0}function ye(Q,W,oe,G){Q={type:Q,code:W,message:oe},G!==void 0&&(Q.row=G),D.errors.push(Q)}A(p.step)&&(S=p.step,p.step=function(Q){D=Q,ie()?ee():(ee(),D.data.length!==0&&(F+=Q.data.length,p.preview&&F>p.preview?_.abort():(D.data=D.data[0],S(D,P))))}),this.parse=function(Q,W,oe){var G=p.quoteChar||'"',G=(p.newline||(p.newline=this.guessLineEndings(Q,G)),T=!1,p.delimiter?A(p.delimiter)&&(p.delimiter=p.delimiter(Q),D.meta.delimiter=p.delimiter):((G=((ce,ue,ne,te,X)=>{var Re,$,le,Ae;X=X||[","," ","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var Le=0;Le<X.length;Le++){for(var Ee,qe=X[Le],he=0,Oe=0,de=0,me=(le=void 0,new x({comments:te,delimiter:qe,newline:ue,preview:10}).parse(ce)),Ie=0;Ie<me.data.length;Ie++)ne&&j(me.data[Ie])?de++:(Ee=me.data[Ie].length,Oe+=Ee,le===void 0?le=Ee:0<Ee&&(he+=Math.abs(Ee-le),le=Ee));0<me.data.length&&(Oe/=me.data.length-de),1.99<Oe&&($===void 0||he<$||he===$&&Ae<Oe)&&($=he,Re=qe,Ae=Oe)}return{successful:!!(p.delimiter=Re),bestDelimiter:Re}})(Q,p.newline,p.skipEmptyLines,p.comments,p.delimitersToGuess)).successful?p.delimiter=G.bestDelimiter:(T=!0,p.delimiter=u.DefaultDelimiter),D.meta.delimiter=p.delimiter),v(p));return G.header=ie(),p.preview&&p.header&&G.preview++,g=Q,_=new x(G),D=_.parse(g,W,oe),ee(),U?{meta:{paused:!0}}:D||{meta:{paused:!1}}},this.paused=function(){return U},this.pause=function(){U=!0,_.abort(),g=A(p.chunk)?"":g.substring(_.getCharIndex())},this.resume=function(){P.streamer._halted?(U=!1,P.streamer.parseChunk(g,!0)):setTimeout(P.resume,3)},this.aborted=function(){return b},this.abort=function(){b=!0,_.abort(),D.meta.aborted=!0,A(p.complete)&&p.complete(D),g=""},this.guessLineEndings=function(ce,G){ce=ce.substring(0,1048576);var G=new RegExp(C(G)+"([^]*?)"+C(G),"gm"),oe=(ce=ce.replace(G,"")).split("\r"),G=ce.split(`
2
- `),ce=1<G.length&&G[0].length<oe[0].length;if(oe.length===1||ce)return`
3
- `;for(var ue=0,ne=0;ne<oe.length;ne++)oe[ne][0]===`
4
- `&&ue++;return ue>=oe.length/2?`\r
5
- `:"\r"}}function C(p){return p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function x(p){var g=(p=p||{}).delimiter,_=p.newline,T=p.comments,S=p.step,L=p.preview,K=p.fastMode,H=null,Y=!1,P=p.quoteChar==null?'"':p.quoteChar,F=P;if(p.escapeChar!==void 0&&(F=p.escapeChar),(typeof g!="string"||-1<u.BAD_DELIMITERS.indexOf(g))&&(g=","),T===g)throw new Error("Comment character same as delimiter");T===!0?T="#":(typeof T!="string"||-1<u.BAD_DELIMITERS.indexOf(T))&&(T=!1),_!==`
1
+ (function(X,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):(X=typeof globalThis<"u"?globalThis:X||self,s(X["kong-ui-public-dashboard-renderer"]={},X.Vue,X["kong-ui-public-analytics-utilities"],X.KongIcons,X["kong-ui-public-analytics-chart"],X.swrv,X["kong-ui-public-analytics-metric-provider"],X.AgGridVue,X.agGridCommunity,X["kong-ui-public-i18n"],X["kong-ui-public-analytics-config-store"],X.Kongponents,X.VueECharts,X.echarts,X.echarts,X.echarts,X.echarts,X.axios,X["kong-ui-public-analytics-geo-map"]))})(this,(function(X,s,ee,ie,be,oi,ai,Hn,Xe,at,we,Gn,$n,Tt,Fn,lt,li,qg,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,R=t.get(c);u!==null&&R?.order!==null&&R?.order!==void 0&&u===R.order+1&&p.add(R.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:R=null,metric:E=null})=>{n.value=h,e.value=f,t.value=p,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 ct(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=ct(r),a=Ke(t,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const l=ct(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),ct(i)}function uo(n,e){const t=Te(n,e?.in),i=+ct(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 re(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 re(e==="yy"?i%100:i,e.length)},M(n,e){const t=n.getMonth();return e==="M"?String(t+1):re(t+1,2)},d(n,e){return re(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 re(n.getHours()%12||12,e.length)},H(n,e){return re(n.getHours(),e.length)},m(n,e){return re(n.getMinutes(),e.length)},s(n,e){return re(n.getSeconds(),e.length)},S(n,e){const t=e.length,i=n.getMilliseconds(),r=Math.trunc(i*Math.pow(10,t-3));return re(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 re(a,2)}return e==="Yo"?t.ordinalNumber(o,{unit:"year"}):re(o,e.length)},R:function(n,e){const t=_i(n);return re(t,e.length)},u:function(n,e){const t=n.getFullYear();return re(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 re(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 re(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 re(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"}):re(r,e.length)},I:function(n,e,t){const i=uo(n);return e==="Io"?t.ordinalNumber(i,{unit:"week"}):re(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"}):re(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 re(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 re(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 re(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"}):re(i,e.length)},k:function(n,e,t){let i=n.getHours();return i===0&&(i=24),e==="ko"?t.ordinalNumber(i,{unit:"hour"}):re(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 re(i,e.length)},T:function(n,e,t){return re(+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+re(o,2)}function Ei(n,e){return n%60===0?(n>0?"-":"+")+re(Math.abs(n)/60,2):Pe(n,e)}function Pe(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),r=re(Math.trunc(i/60),2),o=re(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 ut(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=ut(Math.floor(i/60),2),o=ut(Math.floor(i%60),2);return t+r+e+o}function Di(n,e){return n%60===0?(n>0?"-":"+")+ut(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+ut(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 dt=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 ht={exports:{}},ua=ht.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 dt=="object"&&dt.global===dt?dt: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",R=/constructor/i.test(a.HTMLElement)||a.safari,E=/CriOS\/[\d]+/.test(navigator.userAgent);if((E||p&&R||l)&&typeof FileReader<"u"){var C=new FileReader;C.onloadend=function(){var b=C.result;b=E?b:b.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=b:location=b,f=null},C.readAsDataURL(c)}else{var D=a.URL||a.webkitURL,k=D.createObjectURL(c);f?f.location=k:location.href=k,f=null,setTimeout(function(){D.revokeObjectURL(k)},4e4)}});a.saveAs=d.saveAs=d,n.exports=d})})(ht)),ht.exports}var ha=da(),ft={exports:{}};var fa=ft.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 _=v(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 w=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<w){let M=this._config.newline;M||(S=this._config.quoteChar||'"',M=this._handle.guessLineEndings(g,S)),g=[...g.split(M).slice(w)].join(M)}this.isFirstChunk&&U(this._config.beforeFirstChunk)&&(S=this._config.beforeFirstChunk(g))!==void 0&&(g=S),this.isFirstChunk=!1,this._halted=!1;var w=this._partialLine+g,S=(this._partialLine="",this._handle.parse(w,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(g=S.meta.cursor,w=(this._finished||(this._partialLine=w.substring(g-this._baseIndex),this._baseIndex=g),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:w});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||!w||!U(this._config.complete)||S&&S.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),w||S&&S.meta.paused||this._nextChunk(),S}this._halted=!0},this._sendError=function(g){U(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=L(this._chunkLoaded,this),g.onerror=L(this._chunkError,this)),g.ontimeout=L(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 _,w=this._config.downloadRequestHeaders;for(_ in w)g.setRequestHeader(_,w[_])}var S;this._config.chunkSize&&(S=this._start+this._config.chunkSize-1,g.setRequestHeader("Range","bytes="+this._start+"-"+S));try{g.send(this._config.downloadRequestBody)}catch(M){this._chunkError(M.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,_,w=typeof FileReader<"u";this.stream=function(S){this._input=S,_=S.slice||S.webkitSlice||S.mozSlice,w?((g=new FileReader).onload=L(this._chunkLoaded,this),g.onerror=L(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 S=this._input,M=(this._config.chunkSize&&(M=Math.min(this._start+this._config.chunkSize,this._input.size),S=_.call(S,this._start,M)),g.readAsText(S,this._config.encoding));w||this._chunkLoaded({target:{result:M}})},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(g.error)}}function p(m){var g;u.call(this,m=m||{}),this.stream=function(_){return g=_,this._nextChunk()},this._nextChunk=function(){var _,w;if(!this._finished)return _=this._config.chunkSize,g=_?(w=g.substring(0,_),g.substring(_)):(w=g,""),this._finished=!g,this.parseChunk(w)}}function R(m){u.call(this,m=m||{});var g=[],_=!0,w=!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(){w&&g.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),g.length?this.parseChunk(g.shift()):_=!0},this._streamData=L(function(S){try{g.push(typeof S=="string"?S:S.toString(this._config.encoding)),_&&(_=!1,this._checkIsFinished(),this.parseChunk(g.shift()))}catch(M){this._streamError(M)}},this),this._streamError=L(function(S){this._streamCleanUp(),this._sendError(S)},this),this._streamEnd=L(function(){this._streamCleanUp(),w=!0,this._streamData("")},this),this._streamCleanUp=L(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,_,w,S,M=Math.pow(2,53),z=-M,G=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,T=/^((\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)))$/,A=this,K=0,N=0,B=!1,P=!1,x=[],I={data:[],errors:[],meta:{}};function Q(Z){return m.skipEmptyLines==="greedy"?Z.join("").trim()==="":Z.length===1&&Z[0].length===0}function W(){if(I&&w&&(ue("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+d.DefaultDelimiter+"'"),w=!1),m.skipEmptyLines&&(I.data=I.data.filter(function(F){return!Q(F)})),se()){let F=function(ce){x.push(ce)};if(I)if(Array.isArray(I.data[0])){for(var Z=0;se()&&Z<I.data.length;Z++)I.data[Z].forEach(F);I.data.splice(0,1)}else I.data.forEach(F)}function Y(F,ce){for(var de=m.header?{}:[],ne=0;ne<F.length;ne++){var te=ne,j=F[ne],j=((Re,V)=>(le=>(m.dynamicTypingFunction&&m.dynamicTyping[le]===void 0&&(m.dynamicTyping[le]=m.dynamicTypingFunction(le)),(m.dynamicTyping[le]||m.dynamicTyping)===!0))(Re)?V==="true"||V==="TRUE"||V!=="false"&&V!=="FALSE"&&((le=>{if(G.test(le)&&(le=parseFloat(le),z<le&&le<M))return 1})(V)?parseFloat(V):T.test(V)?new Date(V):V===""?null:V):V)(te=m.header?ne>=x.length?"__parsed_extra":x[ne]:te,j=m.transform?m.transform(j,te):j);te==="__parsed_extra"?(de[te]=de[te]||[],de[te].push(j)):de[te]=j}return m.header&&(ne>x.length?ue("FieldMismatch","TooManyFields","Too many fields: expected "+x.length+" fields but parsed "+ne,N+ce):ne<x.length&&ue("FieldMismatch","TooFewFields","Too few fields: expected "+x.length+" fields but parsed "+ne,N+ce)),de}var oe;I&&(m.header||m.dynamicTyping||m.transform)&&(oe=1,!I.data.length||Array.isArray(I.data[0])?(I.data=I.data.map(Y),oe=I.data.length):I.data=Y(I.data,0),m.header&&I.meta&&(I.meta.fields=x),N+=oe)}function se(){return m.header&&x.length===0}function ue(Z,Y,oe,F){Z={type:Z,code:Y,message:oe},F!==void 0&&(Z.row=F),I.errors.push(Z)}U(m.step)&&(S=m.step,m.step=function(Z){I=Z,se()?W():(W(),I.data.length!==0&&(K+=Z.data.length,m.preview&&K>m.preview?_.abort():(I.data=I.data[0],S(I,A))))}),this.parse=function(Z,Y,oe){var F=m.quoteChar||'"',F=(m.newline||(m.newline=this.guessLineEndings(Z,F)),w=!1,m.delimiter?U(m.delimiter)&&(m.delimiter=m.delimiter(Z),I.meta.delimiter=m.delimiter):((F=((ce,de,ne,te,j)=>{var Re,V,le,Ae;j=j||[","," ","|",";",d.RECORD_SEP,d.UNIT_SEP];for(var Le=0;Le<j.length;Le++){for(var Ce,qe=j[Le],fe=0,Ee=0,he=0,pe=(le=void 0,new D({comments:te,delimiter:qe,newline:de,preview:10}).parse(ce)),Ie=0;Ie<pe.data.length;Ie++)ne&&Q(pe.data[Ie])?he++:(Ce=pe.data[Ie].length,Ee+=Ce,le===void 0?le=Ce:0<Ce&&(fe+=Math.abs(Ce-le),le=Ce));0<pe.data.length&&(Ee/=pe.data.length-he),1.99<Ee&&(V===void 0||fe<V||fe===V&&Ae<Ee)&&(V=fe,Re=qe,Ae=Ee)}return{successful:!!(m.delimiter=Re),bestDelimiter:Re}})(Z,m.newline,m.skipEmptyLines,m.comments,m.delimitersToGuess)).successful?m.delimiter=F.bestDelimiter:(w=!0,m.delimiter=d.DefaultDelimiter),I.meta.delimiter=m.delimiter),v(m));return F.header=se(),m.preview&&m.header&&F.preview++,g=Z,_=new D(F),I=_.parse(g,Y,oe),W(),B?{meta:{paused:!0}}:I||{meta:{paused:!1}}},this.paused=function(){return B},this.pause=function(){B=!0,_.abort(),g=U(m.chunk)?"":g.substring(_.getCharIndex())},this.resume=function(){A.streamer._halted?(B=!1,A.streamer.parseChunk(g,!0)):setTimeout(A.resume,3)},this.aborted=function(){return P},this.abort=function(){P=!0,_.abort(),I.meta.aborted=!0,U(m.complete)&&m.complete(I),g=""},this.guessLineEndings=function(ce,F){ce=ce.substring(0,1048576);var F=new RegExp(C(F)+"([^]*?)"+C(F),"gm"),oe=(ce=ce.replace(F,"")).split("\r"),F=ce.split(`
2
+ `),ce=1<F.length&&F[0].length<oe[0].length;if(oe.length===1||ce)return`
3
+ `;for(var de=0,ne=0;ne<oe.length;ne++)oe[ne][0]===`
4
+ `&&de++;return de>=oe.length/2?`\r
5
+ `:"\r"}}function C(m){return m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function D(m){var g=(m=m||{}).delimiter,_=m.newline,w=m.comments,S=m.step,M=m.preview,z=m.fastMode,G=null,T=!1,A=m.quoteChar==null?'"':m.quoteChar,K=A;if(m.escapeChar!==void 0&&(K=m.escapeChar),(typeof g!="string"||-1<d.BAD_DELIMITERS.indexOf(g))&&(g=","),w===g)throw new Error("Comment character same as delimiter");w===!0?w="#":(typeof w!="string"||-1<d.BAD_DELIMITERS.indexOf(w))&&(w=!1),_!==`
6
6
  `&&_!=="\r"&&_!==`\r
7
7
  `&&(_=`
8
- `);var M=0,U=!1;this.parse=function(b,k,D){if(typeof b!="string")throw new Error("Input must be a string");var j=b.length,ee=g.length,ie=_.length,ye=T.length,Q=A(S),W=[],oe=[],G=[],ce=M=0;if(!b)return he();if(K||K!==!1&&b.indexOf(P)===-1){for(var ue=b.split(_),ne=0;ne<ue.length;ne++){if(G=ue[ne],M+=G.length,ne!==ue.length-1)M+=_.length;else if(D)return he();if(!T||G.substring(0,ye)!==T){if(Q){if(W=[],Ae(G.split(g)),Oe(),U)return he()}else Ae(G.split(g));if(L&&L<=ne)return W=W.slice(0,L),he(!0)}}return he()}for(var te=b.indexOf(g,M),X=b.indexOf(_,M),Re=new RegExp(C(F)+C(P),"g"),$=b.indexOf(P,M);;)if(b[M]===P)for($=M,M++;;){if(($=b.indexOf(P,$+1))===-1)return D||oe.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:W.length,index:M}),Ee();if($===j-1)return Ee(b.substring(M,$).replace(Re,P));if(P===F&&b[$+1]===F)$++;else if(P===F||$===0||b[$-1]!==F){te!==-1&&te<$+1&&(te=b.indexOf(g,$+1));var le=Le((X=X!==-1&&X<$+1?b.indexOf(_,$+1):X)===-1?te:Math.min(te,X));if(b.substr($+1+le,ee)===g){G.push(b.substring(M,$).replace(Re,P)),b[M=$+1+le+ee]!==P&&($=b.indexOf(P,M)),te=b.indexOf(g,M),X=b.indexOf(_,M);break}if(le=Le(X),b.substring($+1+le,$+1+le+ie)===_){if(G.push(b.substring(M,$).replace(Re,P)),qe($+1+le+ie),te=b.indexOf(g,M),$=b.indexOf(P,M),Q&&(Oe(),U))return he();if(L&&W.length>=L)return he(!0);break}oe.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:W.length,index:M}),$++}}else if(T&&G.length===0&&b.substring(M,M+ye)===T){if(X===-1)return he();M=X+ie,X=b.indexOf(_,M),te=b.indexOf(g,M)}else if(te!==-1&&(te<X||X===-1))G.push(b.substring(M,te)),M=te+ee,te=b.indexOf(g,M);else{if(X===-1)break;if(G.push(b.substring(M,X)),qe(X+ie),Q&&(Oe(),U))return he();if(L&&W.length>=L)return he(!0)}return Ee();function Ae(de){W.push(de),ce=M}function Le(de){var me=0;return me=de!==-1&&(de=b.substring($+1,de))&&de.trim()===""?de.length:me}function Ee(de){return D||(de===void 0&&(de=b.substring(M)),G.push(de),M=j,Ae(G),Q&&Oe()),he()}function qe(de){M=de,Ae(G),G=[],X=b.indexOf(_,M)}function he(de){if(p.header&&!k&&W.length&&!Y){var me=W[0],Ie=Object.create(null),ot=new Set(me);let bt=!1;for(let Ue=0;Ue<me.length;Ue++){let be=c(me[Ue]);if(Ie[be=A(p.transformHeader)?p.transformHeader(be,Ue):be]){let He,wt=Ie[be];for(;He=be+"_"+wt,wt++,ot.has(He););ot.add(He),me[Ue]=He,Ie[be]++,bt=!0,(H=H===null?{}:H)[He]=be}else Ie[be]=1,me[Ue]=be;ot.add(be)}bt&&console.warn("Duplicate headers found and renamed."),Y=!0}return{data:W,errors:oe,meta:{delimiter:g,linebreak:_,aborted:U,truncated:!!de,cursor:ce+(k||0),renamedHeaders:H}}}function Oe(){S(he()),W=[],oe=[]}},this.abort=function(){U=!0},this.getCharIndex=function(){return M}}function I(p){var g=p.data,_=a[g.workerId],T=!1;if(g.error)_.userError(g.error,g.file);else if(g.results&&g.results.data){var S={abort:function(){T=!0,w(g.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:O,resume:O};if(A(_.userStep)){for(var L=0;L<g.results.data.length&&(_.userStep({data:g.results.data[L],errors:g.results.errors,meta:g.results.meta},S),!T);L++);delete g.results}else A(_.userChunk)&&(_.userChunk(g.results,S,g.file),delete g.results)}g.finished&&!T&&w(g.workerId,g.results)}function w(p,g){var _=a[p];A(_.userComplete)&&_.userComplete(g),_.terminate(),delete a[p]}function O(){throw new Error("Not implemented.")}function v(p){if(typeof p!="object"||p===null)return p;var g,_=Array.isArray(p)?[]:{};for(g in p)_[g]=v(p[g]);return _}function N(p,g){return function(){p.apply(g,arguments)}}function A(p){return typeof p=="function"}return u.parse=function(p,g){var _=(g=g||{}).dynamicTyping||!1;if(A(_)&&(g.dynamicTypingFunction=_,_={}),g.dynamicTyping=_,g.transform=!!A(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||!u.WORKERS_SUPPORTED)return _=null,u.NODE_STREAM_INPUT,typeof p=="string"?(p=c(p),_=new(g.download?h:m)(g)):p.readable===!0&&A(p.read)&&A(p.on)?_=new R(g):(i.File&&p instanceof File||p instanceof Object)&&(_=new f(g)),_.stream(p);(_=(()=>{var T;return!!u.WORKERS_SUPPORTED&&(T=(()=>{var S=i.URL||i.webkitURL||null,L=t.toString();return u.BLOB_URL||(u.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; ","(",L,")();"],{type:"text/javascript"})))})(),(T=new i.Worker(T)).onmessage=I,T.id=l++,a[T.id]=T)})()).userStep=g.step,_.userChunk=g.chunk,_.userComplete=g.complete,_.userError=g.error,g.step=A(g.step),g.chunk=A(g.chunk),g.complete=A(g.complete),g.error=A(g.error),delete g.worker,_.postMessage({input:p,config:g,workerId:_.id})},u.unparse=function(p,g){var _=!1,T=!0,S=",",L=`\r
9
- `,K='"',H=K+K,Y=!1,P=null,F=!1,M=((()=>{if(typeof g=="object"){if(typeof g.delimiter!="string"||u.BAD_DELIMITERS.filter(function(k){return g.delimiter.indexOf(k)!==-1}).length||(S=g.delimiter),typeof g.quotes!="boolean"&&typeof g.quotes!="function"&&!Array.isArray(g.quotes)||(_=g.quotes),typeof g.skipEmptyLines!="boolean"&&typeof g.skipEmptyLines!="string"||(Y=g.skipEmptyLines),typeof g.newline=="string"&&(L=g.newline),typeof g.quoteChar=="string"&&(K=g.quoteChar,H=K+K),typeof g.header=="boolean"&&(T=g.header),Array.isArray(g.columns)){if(g.columns.length===0)throw new Error("Option columns is empty");P=g.columns}g.escapeChar!==void 0&&(H=g.escapeChar+K),g.escapeFormulae instanceof RegExp?F=g.escapeFormulae:typeof g.escapeFormulae=="boolean"&&g.escapeFormulae&&(F=/^[=+\-@\t\r].*$/)}})(),new RegExp(C(K),"g"));if(typeof p=="string"&&(p=JSON.parse(p)),Array.isArray(p)){if(!p.length||Array.isArray(p[0]))return U(null,p,Y);if(typeof p[0]=="object")return U(P||Object.keys(p[0]),p,Y)}else if(typeof p=="object")return typeof p.data=="string"&&(p.data=JSON.parse(p.data)),Array.isArray(p.data)&&(p.fields||(p.fields=p.meta&&p.meta.fields||P),p.fields||(p.fields=Array.isArray(p.data[0])?p.fields:typeof p.data[0]=="object"?Object.keys(p.data[0]):[]),Array.isArray(p.data[0])||typeof p.data[0]=="object"||(p.data=[p.data])),U(p.fields||[],p.data||[],Y);throw new Error("Unable to serialize unrecognized input");function U(k,D,j){var ee="",ie=(typeof k=="string"&&(k=JSON.parse(k)),typeof D=="string"&&(D=JSON.parse(D)),Array.isArray(k)&&0<k.length),ye=!Array.isArray(D[0]);if(ie&&T){for(var Q=0;Q<k.length;Q++)0<Q&&(ee+=S),ee+=b(k[Q],Q);0<D.length&&(ee+=L)}for(var W=0;W<D.length;W++){var oe=(ie?k:D[W]).length,G=!1,ce=ie?Object.keys(D[W]).length===0:D[W].length===0;if(j&&!ie&&(G=j==="greedy"?D[W].join("").trim()==="":D[W].length===1&&D[W][0].length===0),j==="greedy"&&ie){for(var ue=[],ne=0;ne<oe;ne++){var te=ye?k[ne]:ne;ue.push(D[W][te])}G=ue.join("").trim()===""}if(!G){for(var X=0;X<oe;X++){0<X&&!ce&&(ee+=S);var Re=ie&&ye?k[X]:X;ee+=b(D[W][Re],X)}W<D.length-1&&(!j||0<oe&&!ce)&&(ee+=L)}}return ee}function b(k,D){var j,ee,ie;return k==null?"":k.constructor===Date?isNaN(k.getTime())?"":k.toISOString():(ie=!1,F&&typeof k=="string"&&F.test(k)&&(k="'"+k,ie=!0),ee=(j=k.toString()).replace(M,H),(ie=ie||_===!0||typeof _=="function"&&_(k,D)||Array.isArray(_)&&_[D]||((ye,Q)=>{for(var W=0;W<Q.length;W++)if(-1<ye.indexOf(Q[W]))return!0;return!1})(ee,u.BAD_DELIMITERS)||-1<ee.indexOf(S)||-1<j.indexOf(K)||ee.charAt(0)===" "||ee.charAt(ee.length-1)===" ")?K+ee+K:ee)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
10
- `,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!n&&!!i.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=x,u.ParserHandle=E,u.NetworkStreamer=h,u.FileStreamer=f,u.StringStreamer=m,u.ReadableStreamStreamer=R,o&&(i.onmessage=function(p){p=p.data,u.WORKER_ID===void 0&&p&&(u.WORKER_ID=p.workerId),typeof p.input=="string"?i.postMessage({workerId:u.WORKER_ID,results:u.parse(p.input,p.config),finished:!0}):(i.File&&p.input instanceof File||p.input instanceof Object)&&(p=u.parse(p.input,p.config))&&i.postMessage({workerId:u.WORKER_ID,results:p,finished:!0})}),(h.prototype=Object.create(d.prototype)).constructor=h,(f.prototype=Object.create(d.prototype)).constructor=f,(m.prototype=Object.create(m.prototype)).constructor=m,(R.prototype=Object.create(d.prototype)).constructor=R,u})})(ft)),ft.exports}var ha=da(),Ve=(r=>(r.String="string",r.Number="number",r.Boolean="boolean",r.Object="object",r.Undefined="undefined",r))(Ve||{});const fa=["id"],ma=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(r,{emit:e}){const t=e,i=r,n=s.computed(()=>`export_${new Date().getTime()}`),o=s.computed(()=>{const d=u();return d.length?d:null}),a=()=>{const d=i.labels;if(typeof i.fields!==Ve.Object)throw new Error("Labels needs to be a object containing key / value pairs.");return d!==null&&typeof d===Ve.Object?h=>Object.fromEntries(Object.entries(h).map(([f,m])=>[d[f]||f,m])):h=>h},l=()=>{const d=i.fields;if(typeof i.fields!==Ve.Object&&!Array.isArray(d))throw new Error("Fields needs to be an array of strings.");return Array.isArray(d)?h=>Object.fromEntries(d.filter(f=>f in h).map(f=>[f,h[f]])):h=>h},u=()=>{if(typeof i.fields===Ve.Undefined&&typeof i.labels===Ve.Undefined)return i.data;const d=a(),h=l();return i.data.map(f=>d(h(f)))},c=()=>{if(!o.value){console.warn("No data to export");return}t("export-started",o.value);let d=ha.unparse(o.value,Object.assign({delimiter:i.delimiter,encoding:i.encoding}));if(i.separatorExcel&&(d="SEP="+i.delimiter+`\r
11
- `+d),i.encoding==="utf-8"&&(d="\uFEFF"+d),t("export-finished",i.filename),!i.testing){const h=new Blob([d],{type:"text/csv;charset="+i.encoding});ca.saveAs(h,i.filename)}};return(d,h)=>(s.openBlock(),s.createElementBlock("div",{id:n.value,"data-testid":"export-csv",onClick:c},[s.renderSlot(d.$slots,"default",{},()=>[s.createTextVNode("Download "+s.toDisplayString(r.filename),1)])],8,fa))}}),pa=s.defineComponent({__name:"DownloadCsv",props:{rows:{},headers:{},filename:{}},setup(r){const e=r,t=s.computed(()=>Object.keys(e.headers));return(i,n)=>(s.openBlock(),s.createElementBlock("div",null,[s.createVNode(ma,{data:r.rows,fields:t.value,filename:r.filename,labels:r.headers},{default:s.withCtx(()=>[s.renderSlot(i.$slots,"default")]),_:3},8,["data","fields","filename","labels"])]))}}),ga={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",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 mt(){const r=at.createI18n("en-us",ga);return{i18n:r,i18nT:at.i18nTComponent(r)}}const Ye=170,pt=6,Se="analytics-query-provider",Gi="analytics-dashboard-coordinator",Bt="{entity-id}",Fi="{cp-id}",$i="{timeframe}",Wi=30*1e3,Vi=3e5,Yi=36e5;function _a(){const r=s.inject(Se);return{evaluateFeatureFlag:(t,i)=>typeof r?.evaluateFeatureFlagFn!="function"?i:r.evaluateFeatureFlagFn(t,i)}}var zt={exports:{}},Xi;function ya(){return Xi||(Xi=1,(function(r){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function n(u,c,d){this.fn=u,this.context=c,this.once=d||!1}function o(u,c,d,h,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var m=new n(d,h||u,f),R=t?t+c:c;return u._events[R]?u._events[R].fn?u._events[R]=[u._events[R],m]:u._events[R].push(m):(u._events[R]=m,u._eventsCount++),u}function a(u,c){--u._eventsCount===0?u._events=new i:delete u._events[c]}function l(){this._events=new i,this._eventsCount=0}l.prototype.eventNames=function(){var c=[],d,h;if(this._eventsCount===0)return c;for(h in d=this._events)e.call(d,h)&&c.push(t?h.slice(1):h);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},l.prototype.listeners=function(c){var d=t?t+c:c,h=this._events[d];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,m=h.length,R=new Array(m);f<m;f++)R[f]=h[f].fn;return R},l.prototype.listenerCount=function(c){var d=t?t+c:c,h=this._events[d];return h?h.fn?1:h.length:0},l.prototype.emit=function(c,d,h,f,m,R){var E=t?t+c:c;if(!this._events[E])return!1;var C=this._events[E],x=arguments.length,I,w;if(C.fn){switch(C.once&&this.removeListener(c,C.fn,void 0,!0),x){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,d),!0;case 3:return C.fn.call(C.context,d,h),!0;case 4:return C.fn.call(C.context,d,h,f),!0;case 5:return C.fn.call(C.context,d,h,f,m),!0;case 6:return C.fn.call(C.context,d,h,f,m,R),!0}for(w=1,I=new Array(x-1);w<x;w++)I[w-1]=arguments[w];C.fn.apply(C.context,I)}else{var O=C.length,v;for(w=0;w<O;w++)switch(C[w].once&&this.removeListener(c,C[w].fn,void 0,!0),x){case 1:C[w].fn.call(C[w].context);break;case 2:C[w].fn.call(C[w].context,d);break;case 3:C[w].fn.call(C[w].context,d,h);break;case 4:C[w].fn.call(C[w].context,d,h,f);break;default:if(!I)for(v=1,I=new Array(x-1);v<x;v++)I[v-1]=arguments[v];C[w].fn.apply(C[w].context,I)}}return!0},l.prototype.on=function(c,d,h){return o(this,c,d,h,!1)},l.prototype.once=function(c,d,h){return o(this,c,d,h,!0)},l.prototype.removeListener=function(c,d,h,f){var m=t?t+c:c;if(!this._events[m])return this;if(!d)return a(this,m),this;var R=this._events[m];if(R.fn)R.fn===d&&(!f||R.once)&&(!h||R.context===h)&&a(this,m);else{for(var E=0,C=[],x=R.length;E<x;E++)(R[E].fn!==d||f&&!R[E].once||h&&R[E].context!==h)&&C.push(R[E]);C.length?this._events[m]=C.length===1?C[0]:C:a(this,m)}return this},l.prototype.removeAllListeners=function(c){var d;return c?(d=t?t+c:c,this._events[d]&&a(this,d)):(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,r.exports=l})(zt)),zt.exports}var Ra=ya();const Ca=oa(Ra);class Pt extends Error{name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,Pt)}}const ji=r=>r.reason??new DOMException("This operation was aborted.","AbortError");function Ea(r,e){const{milliseconds:t,fallback:i,message:n,customTimers:o={setTimeout,clearTimeout},signal:a}=e;let l,u;const d=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(ji(a));return}if(a&&(u=()=>{f(ji(a))},a.addEventListener("abort",u,{once:!0})),r.then(h,f),t===Number.POSITIVE_INFINITY)return;const m=new Pt;l=o.setTimeout.call(void 0,()=>{if(i){try{h(i())}catch(R){f(R)}return}typeof r.cancel=="function"&&r.cancel(),n===!1?h():n instanceof Error?f(n):(m.message=n??`Promise timed out after ${t} milliseconds`,f(m))},t)}).finally(()=>{d.clear(),u&&a&&a.removeEventListener("abort",u)});return d.clear=()=>{o.clearTimeout.call(void 0,l),l=void 0},d}function Oa(r,e,t){let i=0,n=r.length;for(;n>0;){const o=Math.trunc(n/2);let a=i+o;t(r[a],e)<=0?(i=++a,n-=o+1):n=o}return i}const ba=100;class Qi{#t=[];#e=0;enqueue(e,t){const{priority:i=0,id:n}=t??{},{size:o}=this,a={priority:i,id:n,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=Oa(this.#t,a,(u,c)=>c.priority-u.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[n]=this.#t.splice(i,1);this.enqueue(n.run,{priority:t,id:e})}remove(e){const t=this.#t.findIndex((i,n)=>n<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>ba&&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 n=this.#t[i];n.priority===e.priority&&t.push(n.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 wa extends Ca{#t;#e;#s=0;#f;#p=!1;#R=!1;#c;#C=0;#l;#u;#a;#o=[];#n=0;#i;#v;#r=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:Qi,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.#n<this.#o.length;){const i=this.#o[this.#n];if(i!==void 0&&e-i>=this.#c)this.#n++;else break}(this.#n>100&&this.#n>this.#o.length/2||this.#n===this.#o.length)&&(this.#o=this.#o.slice(this.#n),this.#n=0)}#A(e){this.#a?this.#o.push(e):this.#s++}#L(){this.#a?this.#o.length>this.#n&&this.#o.pop():this.#s>0&&this.#s--}#b(){return this.#o.length-this.#n}get#U(){return this.#e?!0:this.#a?this.#b()<this.#f:this.#s<this.#f}get#K(){return this.#r<this.#g}#M(){this.#r--,this.#r===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.#n],n=this.#c-(e-i);return this.#S(n),!0}return!1}if(this.#l===void 0){const t=this.#C-e;if(t<0)this.#s=this.#t?this.#r: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.#r===0){if(this.#x(),this.#a&&this.#n>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 n=this.#i.dequeue();this.#e||(this.#A(t),this.#m()),i&&this.#I(),this.emit("active"),n(),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.#r===0?this.#w():this.#C=Date.now()+this.#c),this.#s=this.#t?this.#r: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,n)=>{const o=Symbol(`task-${t.id}`);let a=()=>{};const l=async()=>{a(),this.#r++,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 d=e({signal:t.signal});if(t.timeout!==void 0&&(d=Ea(Promise.resolve(d),{milliseconds:t.timeout,message:`Task timed out after ${t.timeout}ms (queue has ${this.#r} running, ${this.#i.size} waiting)`})),t.signal){const{signal:f}=t;d=Promise.race([d,new Promise((m,R)=>{c=()=>{R(f.reason)},f.addEventListener("abort",c,{once:!0})})])}const h=await d;i(h),this.emit("completed",h)}catch(d){n(d),this.emit("error",d)}finally{c&&t.signal?.removeEventListener("abort",c),this.#_.delete(o),queueMicrotask(()=>{this.#M()})}};this.#i.enqueue(l,t);const u=()=>{if(this.#i instanceof Qi){this.#i.remove(l);return}this.#i.remove?.(t.id)};if(t.signal){const{signal:c}=t,d=()=>{a(),u(),n(c.reason),this.#y(),this.emit("next")};if(a=()=>{c.removeEventListener("abort",d),this.#E.delete(a)},c.aborted){d();return}c.addEventListener("abort",d,{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.#r===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.#r===0&&this.#i.size===0||await this.#h("idle")}async onPendingZero(){this.#r!==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=n=>{this.off("error",i),t(n)};this.on("error",i)})}async#h(e,t){const i=Array.isArray(e)?e:[e];return new Promise(n=>{const o=()=>{if(!(t&&!t())){for(const a of i)this.off(a,o);n()}};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.#r}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 n=Date.now();this.#O(n),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.#r===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 Ta=()=>{const r=Te.useAnalyticsConfigStore(),e=s.inject(Se);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 wa({carryoverConcurrencyCount:!0,concurrency:r.maxParallelRequests,interval:r.requestInterval,intervalCap:r.requestIntervalCap}),i={...e,queryFnOverride:!0,queryFn:(n,o)=>t.add(()=>e.queryFn(n,o))};s.provide(Se,i)};function va(r){const e=`[${r.name}] ${r.message}`,t=[];return r.fix&&t.push(`fix: ${r.fix}`),r.sources?.length&&t.push(`sources: ${r.sources.join(", ")}`),r.docs&&t.push(`see: ${r.docs}`),t.length===0?e:[e,...t.map((i,n)=>`${n<t.length-1?"├▶":"╰▶"} ${i}`)].join(`
12
- `)}function Zi(r,...e){return typeof r=="function"?r(...e):r}function Sa({method:r="warn",formatter:e=va}={}){return(t,{method:i=r}={})=>{console[i](e(t))}}const xa=Error.captureStackTrace;var Ia=class zr extends Error{name;code;docs;fix;sources;get why(){return this.message}constructor(e,t=zr){super(e.why,{cause:e.cause}),this.code=this.name=e.code,this.fix=e.fix,this.docs=e.docs,this.sources=e.sources,xa?.(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 Da(r,e){return typeof r=="string"?`${r}/${e.toLowerCase()}`:r?.(e)}function ka(r){const e=r.reporters??[],t={},{docsBase:i}=r;for(const n of Object.keys(r.codes)){const o=r.codes[n],a=o.docs===!1?void 0:o.docs||Da(i,n),l=(u={},c={})=>{const d=new Ia({code:n,why:Zi(o.why,u),fix:Zi(o.fix,u),docs:a,cause:u.cause,sources:u.sources},l);for(const h of e)h(d,c);return d};t[n]=l}return t}const Na=typeof window<"u",Aa=ka({reporters:[Sa()],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:r=>`A getter cannot have the same name as another state property. Found "${r.name}" in store "${r.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:r=>`The "state" must be a plain object. Found in store "${r.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:r=>`The store id changed from "${r.from}" to "${r.to}", forcing a reload.`,docs:"https://pinia.vuejs.org/cookbook/hot-module-replacement.html#HMR-Hot-Module-Replacement-"},PINIA_R1006:{why:r=>`Property "${r.key}" of store "${r.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:r=>`The same callback was passed to "$subscribe()" of store "${r.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 Ji;process.env.NODE_ENV;const er=process.env.NODE_ENV!=="production"?Symbol("pinia"):Symbol();process.env.NODE_ENV;function Xe(r){const e=s.toRaw(r),t={};for(const i in e){const n=e[i];n?.effect?t[i]=s.computed({get:()=>r[i],set(o){r[i]=o}}):(s.isRef(n)||s.isReactive(n))&&(t[i]=s.toRef(r,i))}return t}const De=r=>r?.chart.type==="table",qt=r=>r?.query?.datasource==="requests",Ht=r=>!!r&&!De(r)&&!qt(r),La=(r,e)=>{const t=r.header_description??("description"in r.chart?r.chart.description:void 0);if(t)return t.replaceAll($i,e)||void 0},Ua=["basic","api_usage","llm_usage","agentic_usage","platform","platform_usage","managed_cache_usage",void 0],Ka=r=>Ua.includes(r);function Ma({queryBridge:r,context:e,definition:t,chartData:i}){const n=s.ref(""),o=s.ref(""),a=s.ref(void 0),l=s.ref(void 0),u=Te.useAnalyticsConfigStore(),c=Te.useDatasourceConfigStore(),{stripUnknownFilters:d,loading:h}=Xe(c),f=s.computed(()=>De(t.value));s.onMounted(async()=>{n.value=await r?.exploreBaseUrl?.()??"",o.value=await r?.requestsBaseUrl?.()??""});const m=s.computed(()=>u.analytics&&u.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"&&!J.isPlatformDatasource(t.value.query.datasource)&&m.value&&!h.value),C=s.computed(()=>n.value&&t.value.query&&Ka(t.value.query.datasource)&&m.value&&!h.value),x=s.computed(()=>i.value?J.msToGranularity(i.value.meta.granularity_ms):void 0),I=s.computed(()=>{const _=t.value,T=[...e.value.filters,..._.query.filters??[]],S="metrics"in _.query?_.query.metrics:void 0,L=_.query?.datasource??"api_usage";return d.value({datasource:L,filters:T,queryFields:S})}),w=s.computed(()=>{if(!C.value||!R.value)return"";const _=t.value;if(De(_))return g({..._.query,filters:I.value});const T=_.query.time_range||e.value.timeSpec,S=p(T,I.value);return g(S)}),O=s.computed(()=>{if(!E.value||!R.value)return"";const _=I.value,T=t.value;if(De(T))return"";const S=N(T.query.time_range||e.value.timeSpec,_);return v(S)}),v=_=>E.value?`${o.value}?q=${JSON.stringify(_)}`:"",N=(_,T)=>{const S=i.value?.meta?.start?new Date(i.value.meta.start):void 0,L=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"?L:void 0}}},A=(_,T)=>({filter:T,timeframe:{timePeriodsKey:_.type==="relative"?_.time_range:"custom",start:_.type==="absolute"?_.start:void 0,end:_.type==="absolute"?_.end:void 0}}),p=(_,T)=>{const S=t.value;if(!Ht(S))throw new Error("Cannot build a chart explore query for table or api-requests definitions");const L=[...S.query.dimensions??[]],K=[...S.query.metrics??[]];return{filters:T,metrics:K,dimensions:L,time_range:_,granularity:S.query.granularity||x.value||void 0}},g=_=>{if(!C.value)return"";const T=t.value.query.datasource&&t.value.query.datasource!=="basic"?t.value.query.datasource:"api_usage";return`${n.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:w,requestsLinkKebabMenu:O,canShowKebabMenu:R,canGenerateRequestsLink:E,canGenerateExploreLink:C,requestsLinkZoomActions:a,exploreLinkZoomActions:l,buildExploreQuery:p,buildRequestsQueryZoomActions:A,buildExploreLink:g,buildRequestLink:v}}const Gt=r=>r.type==="relative"?J.TimePeriods.get(J.TIMEFRAME_LOOKUP[r.time_range])?.timeframeLengthMs():new Date(r.end).getTime()-new Date(r.start).getTime(),Ba=r=>r.reduce((e,t)=>{const i=J.TimePeriods.get(J.TIMEFRAME_LOOKUP[t])?.maximumTimeframeLength();return i===void 0||e&&i<=e.durationSeconds?e:{durationSeconds:i,key:t}},void 0),Ft=(r,e)=>{if(!r||!e?.length)return;const t=Gt(r),i=Ba(e);return t!==void 0&&i&&t>i.durationSeconds*1e3?i:void 0},$t=(r,e)=>{const t=Ft(r,e);return!t||!r?r:r.type==="relative"?{...r,time_range:t.key}:{...r,start:new Date(new Date(r.end).getTime()-t.durationSeconds*1e3)}};function za(){const r=s.inject(Se),e=Te.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let n=null;return s.onUnmounted(()=>{n?.abort()}),{issueQuery:async(a,l,u)=>{if(!r)throw new Error("Query bridge is not defined");n?.abort();const c=new AbortController;n=c,await e.isReady();const{datasource:d,limit:h,...f}=a,m=d||"basic",R=J.isPlatformDatasource(m),E=i.value({datasource:m,filters:[...a.filters??[],...l.filters],queryFields:a.metrics}).filter(({operator:I})=>!R||!J.requestFilterTypeEmptyV2.some(w=>w===I));let C=a.time_range;!C&&l.timeSpec?C={...l.timeSpec,tz:l.tz}:C&&!C.tz&&(C={...C,tz:l.tz}),C=$t(C,t.value[m]?.timeRangeOptions);const x={datasource:m,query:{...f,time_range:C,filters:E,limit:u??h}};return r.queryFn(x,c)}}}const Pa="24H",qa={status_code:"response_http_status",upstream_status_code:"upstream_status"},Ha={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"},Ga=r=>J.relativeTimeRangeValuesRequestV2.includes(r),Fa=r=>{const e=r?.tz?{tz:r.tz}:{};if(r?.type==="absolute")return{type:"absolute",start:r.start,end:r.end,...e};const t=r?.time_range.toUpperCase()??"";return{type:"relative",time_range:Ga(t)?t:Pa,...e}},tr=r=>qa[r]??r,$a=r=>({metric:tr(r.metric),dimension:r.dimension?tr(r.dimension):void 0,unroll:r.unroll,metricUnit:Ha[r.metric],extraFields:r.extra_fields}),Wt="requests";function Wa(){const r=s.inject(Se),e=Te.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let n=null;s.onUnmounted(()=>{n?.abort()});const o=(l,u)=>{const c=l.time_range??u.timeSpec;return $t(c&&{...c,tz:c.tz??u.tz},t.value[Wt]?.timeRangeOptions)};return{issueRequestsQuery:async(l,u)=>{const c=r?.requestsQueryFn;if(!c)throw new Error("Query bridge cannot fetch request records");n?.abort();const d=new AbortController;n=d,await e.isReady();const h=i.value({datasource:Wt,filters:[...l.filters??[],...u.filters]});return J.fetchAllRequests(c,{datasource:Wt,query:{filters:h,time_range:Fa(o(l,u))}},d,{maxRecords:l.max_records})}}}function Va({context:r,globalFilters:e=s.ref([]),isFullscreen:t=s.ref(!1),preview:i=s.ref(!1)}){const n=Te.useAnalyticsConfigStore(),o=Te.useDatasourceConfigStore(),{loading:a}=Xe(n),{loading:l}=Xe(o),u=s.computed(()=>r.value.timeSpec?r.value.timeSpec:{type:"relative",time_range:n.defaultQueryTimeForOrg}),c=s.computed(()=>{const{tz:O}=r.value;return O||new Intl.DateTimeFormat().resolvedOptions().timeZone}),d=s.computed(()=>{const{editable:O}=r.value;return O===void 0||i.value?!1:O}),h=s.computed(()=>{const{showTileActions:O}=r.value;return i.value?!1:O===void 0?!0:O}),f=s.computed(()=>[...r.value.filters??[],...e.value]),m=s.computed(()=>{let{refreshInterval:O}=r.value;if(O===void 0&&(O=Wi),t.value){let v=!1;if(u.value.type==="relative")v=["15m","1h","6h","12h","24h"].includes(u.value.time_range);else{const p=u.value.start.getTime(),g=u.value.end.getTime();v=Math.abs(g-p)<=864e5}const N=new Date().getTime();u.value.type==="absolute"&&u.value.end.getTime()<N||u.value.type==="relative"&&["previous_week","previous_month"].includes(u.value.time_range)?O=0:v?O=Vi:O=Yi}return O}),R=s.computed(()=>({filters:f.value,timeSpec:u.value,tz:c.value,refreshInterval:m.value,editable:d.value,showTileActions:h.value})),E=s.computed(()=>!a.value&&!l.value),C=s.computed(()=>!i.value&&!!s.getCurrentInstance()?.vnode?.props?.onTileTimeRangeZoom),x=s.computed(()=>!i.value),I=s.computed(()=>!i.value),w=s.computed(()=>({enabled:C.value,showExploreAction:x.value,showRequestsAction:I.value,showZoomInAction:C.value}));return{editable:d,enrichedContext:R,filters:f,queryReady:E,refreshInterval:m,showTileActions:h,timeSpec:u,tz:c,zoomConfiguration:w}}const Ya=6,ir=6,rr=4;function Xa(r,e){const{pageWidth:t,pageHeight:i,margin:n}=e,o=n+1,a=n+e.headerHeight-3,l=i-n-ir+3,u=l+4;e.title&&(r.setFont("helvetica","bold"),r.setFontSize(11),r.setTextColor(60),r.text(e.title,n,o)),r.setFont("helvetica","normal"),r.setFontSize(8),r.setTextColor(120),r.text(e.generatedAt,t-n,o,{align:"right"}),e.subtitle&&r.text(e.subtitle,n,o+rr),r.setDrawColor(220),r.line(n,a,t-n,a),r.line(n,l,t-n,l),r.setFont("helvetica","bold"),r.setTextColor(60),r.text(e.branding,n,u);const c=r.getTextWidth(e.branding);r.setFont("helvetica","normal");const d=` ${e.dashboardNote}`;e.dashboardUrl?(r.setTextColor(0,68,204),r.textWithLink(d,n+c,u,{url:e.dashboardUrl})):(r.setTextColor(120),r.text(d,n+c,u)),r.setTextColor(120),r.text(e.pageLabel,t-n,u,{align:"right"})}function ja(r){const e=r.querySelector(".kong-ui-public-grid-layout, .grid-stack");if(!e)return[];const t=e.querySelectorAll(":scope > .grid-cell:not(.empty-cell), :scope > .grid-stack-item");if(!t.length)return[];const i=r.getBoundingClientRect().top,n=new Map;return t.forEach(o=>{const a=o.getBoundingClientRect(),l=Math.round(a.top-i),u=Math.round(a.bottom-i),c=n.get(l);n.set(l,c!==void 0?Math.max(c,u):u)}),[...n.entries()].map(([o,a])=>({top:o,bottom:a})).sort((o,a)=>o.top-a.top)}function Qa(r,e,t,i){if(!r.length){const a=[];let l=0;for(;l<e;){const u=Math.min(t,e-l);a.push({startY:l,height:u}),l+=u}return a}const n=[];let o=0;for(const a of r){const l=a.top*i,u=a.bottom*i;u-o>t&&(l>o?(n.push({startY:o,height:l-o}),o=l):(n.push({startY:o,height:u-o}),o=u))}return o<e&&n.push({startY:o,height:e-o}),n}function Za(r){const{i18n:e}=mt(),t=s.ref({status:"idle"});async function i(n={}){const{filename:o="dashboard-export",title:a,subtitle:l,dashboardUrl:u,orientation:c="landscape",pageSize:d="letter",margin:h=4,scale:f=2,exclude:m=[".tile-actions",".tooltip",".popover",".dropdown-popover"],output:R="download",onBeforeCapture:E,onAfterCapture:C}=n,x=r.value;if(!x){t.value={status:"error",error:new Error("Dashboard layout container not found.")};return}try{t.value={status:"preparing"},await E?.();const[{snapdom:I},{jsPDF:w}]=await Promise.all([import("@zumer/snapdom"),import("jspdf")]);t.value={status:"capturing"};const O={name:"kong-webgl-snapshot",beforeClone:()=>J.prepareForCapture(),afterClone:()=>J.restoreAfterCapture()},v=await I.toCanvas(x,{scale:f,exclude:m,excludeMode:"remove",embedFonts:!0,plugins:[O]}),N=ja(x),A=x.getBoundingClientRect().width,p=A?v.width/A:f;t.value={status:"generating"};const g=new Date,_=new w({orientation:c,unit:"mm",format:d}),T=_.internal.pageSize.getWidth(),S=_.internal.pageSize.getHeight(),L=Ya+(l?rr:0),K=T-h*2,H=S-h*2-L-ir,Y=v.width/K,P=H*Y,F=Qa(N,v.height,P,p),M={title:a,subtitle:l,dashboardUrl:u,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:T,pageHeight:S,headerHeight:L,margin:h};for(let U=0;U<F.length;U++){U>0&&_.addPage();const{startY:b,height:k}=F[U],D=document.createElement("canvas");D.width=v.width,D.height=k,D.getContext("2d").drawImage(v,0,b,v.width,k,0,0,v.width,k),_.addImage(D.toDataURL("image/png"),"PNG",h,h+L,K,k/Y),Xa(_,{...M,pageLabel:e.t("pdfExport.pageOf",{page:String(U+1),total:String(F.length)})})}if(R==="blob"){const U=_.output("blob");return t.value={status:"complete",pageCount:F.length},U}_.save(o),t.value={status:"complete",pageCount:F.length}}catch(I){t.value={status:"error",error:I}}finally{J.restoreAfterCapture(),await C?.()}}return{exportPdf:i,exportState:s.readonly(t)}}const Ja=r=>r.toLowerCase().endsWith("count")?"":r;function el(){const{i18n:r}=mt(),{formatUnit:e}=J.unitFormatter({i18n:r}),t=ae.useFieldLabel();return i=>{const n=i.meta?.metric_names?.[0]??"",o=i.meta?.metric_units?.[n]??"";return{seriesName:t(n),valueFormatter:a=>e(a,o,{translateUnit:Ja})}}}const nr=(r,e,t,{prefix:i="chartLabels",fallback:n=t}={})=>{const o=`${i}.${t}`;return e.get(t)||(r.te(o)?r.t(o):n)};function tl(){const{i18n:r}=mt(),e=Te.useDatasourceConfigStore();return(t,i)=>nr(r,e.fieldTranslationMap,t,i)}const ae={useContextLinks:Ma,useDashboardContext:Va,useEvaluateFeatureFlag:_a,useExportPdf:Za,useFieldLabel:tl,useI18n:mt,useIssueQuery:za,useIssueRequestsQuery:Wa,useMetricFormatter:el,useRequestQueue:Ta},il={class:"kong-ui-public-csv-export-modal"},rl={key:0,class:"selected-range"},nl={key:4,class:"text-muted",tag:"span"},sr=3,or=s.defineComponent({__name:"CsvExportModal",props:{exportState:{},filename:{},modalDescription:{default:void 0}},emits:["closeModal"],setup(r,{emit:e}){const{i18n:t}=ae.useI18n(),i=ae.useFieldLabel(),n=r,o=e,a=`${n.filename.replace(/\s+/g,"-").toLowerCase()}-${new Date().toISOString().slice(0,10)}.csv`,l=s.ref(1),u=s.computed(()=>m.value.rows.length),c=s.computed(()=>n.exportState.status==="success"&&!!n.exportState.chartData?.data?.length),d=s.computed(()=>{if(n.exportState.status!=="success"||!n.exportState.chartData?.meta)return"";const{start:E,end:C}=n.exportState.chartData.meta;return!E||!C?"":new Date(E).getTime()===new Date(C).getTime()?t.t("csvExport.exportAsOf",{time:J.formatTimestamp(new Date(E),{includeTZ:!0})}):`${t.t("csvExport.exportTimeRange")}: ${J.formatTimestamp(new Date(E))} - ${J.formatTimestamp(new Date(C),{includeTZ:!0})}`}),h=s.computed(()=>n.exportState.status!=="success"?"":t.t("csvExport.previewRows",{rowsMax:Math.min(sr,u.value),rowsTotal:u.value,plural:u.value===1?"":"s"})),f=()=>{o("closeModal")},m=s.computed(()=>{if(n.exportState.status!=="success"||!c.value||!n.exportState.chartData?.meta.metric_names)return{headers:[],rows:[],csvHeaders:{}};const E=n.exportState.chartData,C=E.data.some(N=>N.timestamp!==E.data[0].timestamp),x=E.data.map(N=>{const A=new Date(N.timestamp);return{...Object.keys(N.event).reduce((g,_)=>{if(_ in E.meta.display){const T=N.event[_],S=E.meta.display[_];g[_]=T&&S?.[T]?.name||N.event[_]}else g[_]=N.event[_];return g},{}),...C?{timestamp:Kt(A,"yyyy-MM-dd HH:mm:ss"),tzOffset:Kt(A,"XXX")}:{}}});let I=[];C&&(I=[{label:t.t("csvExport.Timestamp"),key:"timestamp"},{label:t.t("csvExport.UtcOffset"),key:"tzOffset"}]);const w="display"in n.exportState.chartData.meta&&n.exportState.chartData.meta.display?n.exportState.chartData.meta.display:{},O=[...I,...Object.keys(w).map(N=>({label:i(N),key:N})),...n.exportState.chartData.meta.metric_names.map(N=>({label:i(N),key:N}))],v=O.reduce((N,A)=>(N[A.key]=A.label,N),{});return{headers:O,csvHeaders:v,rows:x}}),R=async()=>{if(n.exportState.status!=="success")return{total:0,data:[]};const{rows:E}=m.value;return{total:Number(E.length)||0,data:E.slice(0,sr)}};return s.watch(m,()=>{l.value++}),(E,C)=>{const x=s.resolveComponent("KSkeleton"),I=s.resolveComponent("KEmptyState"),w=s.resolveComponent("KTableData"),O=s.resolveComponent("KTooltip"),v=s.resolveComponent("KButton"),N=s.resolveComponent("KModal");return s.openBlock(),s.createElementBlock("div",il,[s.createVNode(N,{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,[r.exportState.status==="success"&&c.value?(s.openBlock(),s.createElementBlock("div",rl,[s.createElementVNode("p",null,s.toDisplayString(r.modalDescription?r.modalDescription:s.unref(t).t("csvExport.exportDescription")),1),s.createElementVNode("p",null,s.toDisplayString(d.value),1)])):s.createCommentVNode("",!0),r.exportState.status==="loading"?(s.openBlock(),s.createBlock(x,{key:1,class:"chart-skeleton",type:"table"})):r.exportState.status==="success"?(s.openBlock(),s.createBlock(w,{key:2,class:"vitals-table",fetcher:R,"fetcher-cache-key":String(l.value),headers:m.value.headers,"hide-pagination":"","row-hover":!1,sortable:!1},{"empty-state":s.withCtx(()=>[s.createVNode(I,{"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"])):r.exportState.status==="error"?(s.openBlock(),s.createBlock(I,{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),r.exportState.status==="success"&&c.value?(s.openBlock(),s.createElementBlock("div",nl,[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(J.EXPORT_RECORD_LIMIT)})},{default:s.withCtx(()=>[s.createVNode(s.unref(re.InfoIcon),{color:`var(--kui-color-text-neutral, ${s.unref(Mt)})`,size:`var(--kui-icon-size-30, ${s.unref(sa)})`},null,8,["color","size"])]),_:1},8,["text"])])):s.createCommentVNode("",!0)])]),"footer-actions":s.withCtx(()=>[s.createVNode(v,{appearance:"tertiary",class:"cancel-btn",onClick:f},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(t).t("csvExport.cancelButton")),1)]),_:1}),s.createVNode(pa,{class:"vitals-report-export-button",filename:a,headers:m.value.csvHeaders,rows:m.value.rows},{default:s.withCtx(()=>[s.createVNode(v,{appearance:"primary","data-testid":"csv-download-button",disabled:r.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 ar=(r=>(r.VALIDATING="VALIDATING",r.VALIDATING_HAS_DATA="VALIDATING_HAS_DATA",r.PENDING="PENDING",r.SUCCESS="SUCCESS",r.SUCCESS_HAS_DATA="SUCCESS_HAS_DATA",r.ERROR="ERROR",r.STALE_IF_ERROR="STALE_IF_ERROR",r))(ar||{});const sl=r=>r?!!(Object.keys(r)?.length||r.data?.length||r.data?.data?.length||!r.data?.data&&typeof r.data=="object"&&Object.keys(r?.data).length):!1;function lr(r=s.ref({}),e,t,i=sl){const n=s.ref("PENDING");return s.watchEffect(()=>{const o=i(r.value);if(r.value&&o&&t.value){n.value="VALIDATING_HAS_DATA";return}if(r.value&&t.value){n.value="VALIDATING";return}if(r.value&&e.value){n.value="STALE_IF_ERROR";return}if(r.value===void 0&&!e.value){n.value="PENDING";return}if(r.value&&!e.value&&o){n.value="SUCCESS_HAS_DATA";return}if(r.value&&!e.value){n.value="SUCCESS";return}r.value===void 0&&e&&(n.value="ERROR")}),{state:n,swrvState:ar}}const Be=s.defineComponent({__name:"QueryDataProvider",props:{context:{},limitOverride:{},query:{},queryReady:{type:Boolean},refreshCounter:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:n}=ae.useI18n(),{issueQuery:o}=ae.useIssueQuery(),a=s.inject(Se),l=()=>t.queryReady&&a?JSON.stringify([t.query,t.context,t.refreshCounter]):null,{data:u,error:c,isValidating:d}=si(l,async()=>{const I=l();try{const w=await o(t.query,t.context,t.limitOverride);return l()!==I?void 0:(m.value=null,w)}catch(w){if(l()!==I)return;throw m.value=we.handleQueryError(w),w}finally{l()===I&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:h,swrvState:f}=lr(u,c,d),m=s.ref(null),R=s.computed(()=>h.value===f.ERROR||!!m.value),E=s.computed(()=>!t.queryReady||h.value===f.PENDING),C=s.ref(),x=s.computed(()=>u.value??(t.queryReady&&h.value===f.PENDING?C.value:void 0));return s.watch([()=>u.value,()=>h.value],([I,w])=>{I&&(w==="SUCCESS_HAS_DATA"||w==="SUCCESS")&&I!==C.value&&(C.value=I,i("chart-data",I))}),(I,w)=>{const O=s.resolveComponent("KSkeleton"),v=s.resolveComponent("KEmptyState");return(E.value||!s.unref(u)&&!R.value)&&!x.value?(s.openBlock(),s.createBlock(O,{key:0,class:"chart-skeleton",type:"table"})):R.value&&!E.value?(s.openBlock(),s.createBlock(v,{key:1,"action-button-visible":!1,"data-testid":"chart-empty-state"},s.createSlots({icon:s.withCtx(()=>[m.value?.type==="forbidden"?(s.openBlock(),s.createBlock(s.unref(re.VisibilityOffIcon),{key:0})):(s.openBlock(),s.createBlock(s.unref(re.WarningOutlineIcon),{key:1}))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(m.value?.message||s.unref(n).t("renderer.unexpectedError")),1)]),_:2},[m.value?.details?{name:"default",fn:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(m.value.details),1)]),key:"0"}:void 0]),1024)):x.value?s.renderSlot(I.$slots,"default",{data:x.value},void 0,void 0,2):s.createCommentVNode("",!0)}}}),ol=s.defineComponent({__name:"SimpleChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},fitToContent:{type:Boolean}},setup(r){const e=r,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(n,o)=>(s.openBlock(),s.createBlock(Be,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:s.withCtx(({data:a})=>[s.createElementVNode("div",{class:s.normalizeClass(["analytics-chart",{"single-value":t.value,compact:t.value&&r.fitToContent}]),style:s.normalizeStyle(t.value?void 0:{height:`${r.height}px`})},[s.createVNode(s.unref(we.SimpleChart),{"chart-data":a,"chart-options":i.value,"synthetics-data-key":t.value?void 0:r.chartOptions.synthetics_data_key},null,8,["chart-data","chart-options","synthetics-data-key"])],6)]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),Ce=(r,e)=>{const t=r.__vccOpts||r;for(const[i,n]of e)t[i]=n;return t},cr=Ce(ol,[["__scopeId","data-v-df5d87ad"]]),al={class:"analytics-chart"},Vt=Ce(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(r,{emit:e}){const t=r,i=e,{i18n:n}=ae.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")},u=c=>{i("chart-data",c)};return(c,d)=>{const h=s.resolveComponent("KDropdownItem");return s.openBlock(),s.createBlock(Be,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:u},{default:s.withCtx(({data:f})=>[s.createElementVNode("div",al,[s.createVNode(s.unref(we.AnalyticsChart),s.mergeProps({"active-metric":r.activeMetric,"chart-data":f,"chart-options":o.value,"explore-link":r.exploreLink,"legend-position":"bottom","requests-link":r.requestsLink,"synthetics-data-key":r.chartOptions.synthetics_data_key,"timeseries-zoom":r.zoomConfiguration?.showZoomInAction,"tooltip-title":""},r.extraProps,{onSelectChartRange:d[0]||(d[0]=m=>i("select-chart-range",m)),onZoomTimeRange:d[1]||(d[1]=m=>i("zoom-time-range",m))}),s.createSlots({_:2},[r.context.editable?{name:"menu-items",fn:s.withCtx(()=>[s.createVNode(h,{onClick:l},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(n).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"]]),ur=s.defineComponent({__name:"BarChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){return(e,t)=>(s.openBlock(),s.createBlock(Vt,{"chart-options":r.chartOptions,context:r.context,"extra-props":{showAnnotations:!1},height:r.height,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),ll={class:"analytics-chart"},cl={key:3,class:"analytics-chart"},ul=Ce(s.defineComponent({__name:"ScatterChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:n}=ae.useI18n(),{issueRequestsQuery:o}=ae.useIssueRequestsQuery(),a=s.computed(()=>t.query.datasource==="requests"),l=s.computed(()=>{const O=t.query,v=O.time_range??t.context.timeSpec,N=v?Gt(v):void 0;if(!N)return O;const A=J.finestGranularityForDuration(N);let p;return O.granularity&&J.Granularities[O.granularity]>=J.Granularities[A]?p=O.granularity:p=A,{...O,granularity:p}}),u=()=>a.value&&t.queryReady?JSON.stringify([t.query,t.context,t.refreshCounter]):null,c=s.ref(null),{data:d,error:h,isValidating:f}=si(u,async()=>{const O=u(),v=t.query;try{const N=await o(v,t.context);return u()!==O?void 0:(c.value=null,we.requestsToScatterData(N,$a(v)))}catch(N){if(u()!==O)return;throw c.value=we.handleQueryError(N),N}finally{u()===O&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:m,swrvState:R}=lr(d,h,f),E=s.ref(),C=s.computed(()=>d.value??E.value);s.watch(d,O=>{O&&(E.value=O)});const x=s.computed(()=>m.value===R.ERROR||!!c.value),I=s.computed(()=>!x.value&&(!t.queryReady||m.value===R.PENDING)&&!C.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,v)=>{const N=s.resolveComponent("KSkeleton"),A=s.resolveComponent("KEmptyState");return a.value?I.value?(s.openBlock(),s.createBlock(N,{key:1,class:"chart-skeleton",type:"table"})):x.value?(s.openBlock(),s.createBlock(A,{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(re.VisibilityOffIcon),{key:0})):(s.openBlock(),s.createBlock(s.unref(re.WarningOutlineIcon),{key:1}))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(c.value?.message||s.unref(n).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)):C.value?(s.openBlock(),s.createElementBlock("div",cl,[s.createVNode(s.unref(we.AnalyticsChart),{"chart-data":C.value,"chart-options":w.value,"legend-position":"bottom","synthetics-data-key":r.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:r.context,query:l.value,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:v[0]||(v[0]=p=>i("chart-data",p)),onQueryComplete:v[1]||(v[1]=p=>i("query-complete"))},{default:s.withCtx(({data:p})=>[s.createElementVNode("div",ll,[s.createVNode(s.unref(we.AnalyticsChart),{"chart-data":p,"chart-options":w.value,"legend-position":"bottom","synthetics-data-key":r.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"]]),dr=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(r,{emit:e}){const t=e;return(i,n)=>(s.openBlock(),s.createBlock(Vt,{"active-metric":r.activeMetric,"chart-options":r.chartOptions,context:r.context,"explore-link":r.exploreLink,height:r.height,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,"requests-link":r.requestsLink,"zoom-configuration":r.zoomConfiguration,onSelectChartRange:n[0]||(n[0]=o=>t("select-chart-range",o)),onZoomTimeRange:n[1]||(n[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"]))}}),dl=Ce(s.defineComponent({__name:"GoldenSignalsRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){const e=r,t=s.computed(()=>{const n=e.query?.datasource;if(n&&n!=="api_usage"&&n!=="basic")throw new Error(`Invalid datasource value: ${n}`);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(n,o)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["metric-card-tile-wrapper",{titled:i.value}])},[s.createVNode(s.unref(oi.MetricsProvider),s.normalizeProps(s.guardReactiveProps(t.value)),{default:s.withCtx(()=>[s.createVNode(s.unref(oi.MetricsConsumer))]),_:1},16)],2))}}),[["__scopeId","data-v-3eda5028"]]);var it=(r=>(r.PENDING="PENDING",r.LOADING="LOADING",r.SUCCESS="SUCCESS",r.ERROR="ERROR",r))(it||{});const hl=r=>!!r?.length;function fl(r,e,t,i=hl){const n=s.computed(()=>i(r.value)),o=s.computed(()=>{const a=r.value!==void 0,l=e.value!==void 0&&e.value!==null;return t.value?"LOADING":n.value?"SUCCESS":l?"ERROR":a?"SUCCESS":"PENDING"});return{fetchState:it,hasData:n,state:o}}const ml=({emitState:r,fetchLifecycleState:e,hasData:t})=>{s.watch(()=>({hasData:t.value,state:e.value}),({hasData:i,state:n})=>{if(n!==it.PENDING){if(n===it.LOADING){r({hasData:i,state:"loading"});return}if(n===it.ERROR){r({hasData:i,state:"error"});return}r({hasData:i,state:"success"})}})},pl=({startRow:r,endRow:e})=>{const t=e-r;return{blockIndex:t>0?Math.floor(r/t):0,pageSize:t}},gl=({startRow:r,rowsLength:e,pageSize:t,total:i,hasMore:n})=>{if(typeof i=="number")return i;if(n!==!0&&(n===!1||e<t))return r+e},_l=({fetcher:r,resetKey:e,sort:t})=>{const i=new Map,n=new Map,o=s.ref(0),a=s.ref(0),l=s.shallowRef(),u=s.shallowRef(),c=s.shallowRef(),d=s.ref(0),h=s.ref(!1);let f,m,R=t?.value?.sortColumnKey,E=t?.value?.sortColumnOrder;const C=K=>K===o.value&&f===r.value&&m===e?.value,x=(K,H)=>C(K)&&H===a.value&&R===t?.value?.sortColumnKey&&E===t?.value?.sortColumnOrder,I=K=>{if(!t)return!0;const H=t.value;return!H?.sortColumnKey||!H.sortColumnOrder?K.length===0:K.length===1&&K[0].colId===H.sortColumnKey&&K[0].sort===H.sortColumnOrder},w=()=>{h.value=d.value>0},O=()=>{a.value+=1,R=t?.value?.sortColumnKey,E=t?.value?.sortColumnOrder;for(const K of n.values())K.resolve(!1);i.clear(),n.clear(),u.value=void 0,c.value=void 0,d.value=0,w()},v=()=>{c.value=void 0,d.value+=1,w()},N=()=>{d.value=Math.max(0,d.value-1),w()},A=K=>{const H=n.get(K);if(H)return H;let Y;const P={promise:new Promise(F=>{Y=F}),resolve:F=>Y(F)};return n.set(K,P),P},p=(K,H)=>{H.resolve(!1),n.get(K)===H&&n.delete(K)},g=async({blockIndex:K,currentBlockCompletion:H,datasourceId:Y,requestGeneration:P})=>{if(K===0)return"ready";const F=n.get(K-1);if(!F)return p(K,H),"failed";const M=await F.promise;return x(Y,P)?M?"ready":(p(K,H),"failed"):(p(K,H),"stale")},_=({blockIndex:K,currentBlockCompletion:H,getRowsParams:Y,pageSize:P,result:F})=>{F.cursor!==void 0&&i.set(K,F.cursor),Y.successCallback(F.data,gl({startRow:Y.startRow,rowsLength:F.data.length,pageSize:P,total:F.total,hasMore:F.hasMore})),Y.startRow===0&&(u.value=F.data),H.resolve(!0)},T=({blockIndex:K,currentBlockCompletion:H,fetchError:Y,getRowsParams:P})=>{c.value=Y,P.failCallback(),p(K,H)},S=()=>{const K=r.value;if(!K)throw new Error("TableDataGrid requires a fetcher in infinite mode");f=K,m=e?.value;const H=o.value+1;return o.value=H,O(),{async getRows(Y){if(!C(H)||!I(Y.sortModel)){Y.failCallback();return}const{blockIndex:P,pageSize:F}=pl({startRow:Y.startRow,endRow:Y.endRow});P===0&&n.has(0)&&O();const M=a.value,U=A(P);if(await g({blockIndex:P,currentBlockCompletion:U,datasourceId:H,requestGeneration:M})!=="ready"||!x(H,M)){Y.failCallback(),p(P,U);return}v();try{const b=P>0?i.get(P-1):void 0,k=await K({mode:"infinite",pageSize:F,cursor:b,sort:t?.value});if(!x(H,M)){Y.failCallback(),p(P,U);return}_({blockIndex:P,currentBlockCompletion:U,getRowsParams:Y,pageSize:F,result:k})}catch(b){if(!x(H,M)){Y.failCallback(),p(P,U);return}T({blockIndex:P,currentBlockCompletion:U,fetchError:b,getRowsParams:Y})}finally{x(H,M)&&N()}}}},L=()=>{l.value=S()};return s.watch([r,()=>e?.value],()=>{L()},{immediate:!0}),s.watch([()=>t?.value?.sortColumnKey,()=>t?.value?.sortColumnOrder],()=>O()),{datasource:s.readonly(l),data:s.shallowReadonly(u),error:s.readonly(c),isFetching:s.readonly(h)}},yl={title:"No Data",message:"There is no data to display."},Rl={title:"An error occurred",message:"Data cannot be displayed due to an error."},Cl={emptyState:yl,errorState:Rl};function hr(){const r=at.createI18n("en-us",Cl);return{i18n:r,i18nT:at.i18nTComponent(r)}}const{i18n:El}=hr(),fr=(r,e)=>{const t=Reflect.get(e,r.key);return r.valueFormatter?r.valueFormatter(t,e):String(t??"")},gt=r=>typeof r!="number"?null:Number.isFinite(r)?r:null,Ol=(r,e)=>r.reduce((t,i)=>{const n=gt(Reflect.get(i,e.key));return n===null?t:{sum:t.sum+n,max:Math.max(t.max,n)}},{sum:0,max:0}),bl=(r,e)=>{const t=(e??[]).filter(n=>Number.isFinite(n.value)&&r>=n.value);if(!t.length)return;const i=Math.max(...t.map(n=>n.value));return t.filter(n=>n.value===i).some(n=>n.type==="error")?"error":"warning"},wl=(r,e,t)=>{if(r===null)return 0;const i=t==="relative"?e.sum:e.max;return i>0?Math.min(Math.max(r/i,0),1):0},Tl=r=>{const e=t=>El.formatNumber(t,{maximumFractionDigits:2});return r>0&&r<.01?`< ${e(.01)} %`:`${e(r)} %`},mr=({value:r,stats:e,header:t})=>{if(r===null||e.sum<=0)return;const i=r/e.sum*100;return t.percentageFormatter?.(i)??Tl(i)},pr=(r,e)=>e!==void 0&&e.length>(r?.length??-1)?e:r,vl=({rows:r,header:e,stats:t})=>r.reduce((i,n)=>({value:pr(i.value,fr(e,n))??"",relative:e.showPercentage?pr(i.relative,mr({value:gt(Reflect.get(n,e.key)),stats:t,header:e})):void 0}),{value:""}),Sl=["data-threshold"],xl={class:"table-data-grid-cell-label-track"},Il={class:"table-data-grid-cell-label"},Dl={key:0,class:"table-data-grid-cell-relative","data-testid":"table-data-grid-cell-relative"},kl={key:0,"aria-hidden":"true",class:"table-data-grid-cell-label table-data-grid-cell-label-sizer"},Nl=["data-text"],Al=["data-text"],Ll=["data-threshold"],Ul=s.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(r,{expose:e}){const t=s.shallowRef(r.params),i=s.ref(null),n=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"),u=s.computed(()=>t.value.valueFormatted??String(t.value.value??"")),c=s.computed(()=>t.value.value),d=s.computed(()=>gt(c.value)),h=s.computed(()=>a.value?.stats[o.value.key]),f=s.computed(()=>o.value.showPercentage&&h.value?mr({value:d.value,stats:h.value,header:o.value}):void 0),m=s.computed(()=>!!o.value.bar&&!!h.value&&(d.value!==null||c.value===null||c.value===void 0)),R=s.computed(()=>m.value&&h.value?wl(d.value,h.value,o.value.bar)*100:0),E=s.computed(()=>m.value?a.value?.labelSizers[o.value.key]:void 0),C=s.computed(()=>o.value.thresholds?.length&&d.value!==null?bl(d.value,o.value.thresholds):void 0),x=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})),I=(_,{slots:T})=>{const S=t.value.colDef?.colId,L=t.value.context?.cells?.slots;return!S||S==="cell-icon"||!L?.[S]?T.default?.():s.h("span",{class:"table-data-grid-cell-slot-content"},s.renderSlot(L,S,x.value,()=>T.default?.()??[]))},w=()=>{const _=t.value.context?.cells?.slots;return _?.["cell-icon"]?s.renderSlot(_,"cell-icon",x.value):null};let O,v,N=!1;const A=()=>{const _=i.value;n.value=!!_&&_.scrollWidth>_.clientWidth},p=()=>{N||(v!==void 0&&cancelAnimationFrame(v),v=requestAnimationFrame(()=>{v=void 0,A()}))},g=_=>{if(O?.disconnect(),_){O?.observe(_);const T=_.closest(".ag-cell");T&&O?.observe(T)}p()};return s.onMounted(()=>{O=new ResizeObserver(p),g(i.value)}),s.watch(i,g),s.onUnmounted(()=>{N=!0,O?.disconnect(),v!==void 0&&cancelAnimationFrame(v)}),e({refresh(_){return t.value=_,s.nextTick(p),!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":m.value,"table-data-grid-cell-renderer--percentage":!!f.value,[`table-data-grid-cell-renderer--text-${C.value}`]:!m.value&&!!C.value}]),"data-threshold":C.value},[s.createElementVNode("span",xl,[s.createElementVNode("span",Il,[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(w))),(s.openBlock(),s.createBlock(s.resolveDynamicComponent(I),null,{default:s.withCtx(()=>[s.createVNode(S,{class:"table-data-grid-cell-tooltip",disabled:!n.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:l.value,text:u.value},{default:s.withCtx(()=>[s.createElementVNode("span",{ref_key:"contentElement",ref:i,class:"table-data-grid-cell-content"},s.toDisplayString(u.value),513)]),_:1},8,["disabled","target","text"])]),_:1})),f.value?(s.openBlock(),s.createElementBlock("span",Dl,"("+s.toDisplayString(f.value)+")",1)):s.createCommentVNode("",!0)]),E.value?(s.openBlock(),s.createElementBlock("span",kl,[s.createElementVNode("span",{class:"table-data-grid-cell-sizer-value","data-text":E.value.value},null,8,Nl),E.value.relative?(s.openBlock(),s.createElementBlock("span",{key:0,class:"table-data-grid-cell-sizer-relative","data-text":`(${E.value.relative})`},null,8,Al)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)]),m.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,Ll)):s.createCommentVNode("",!0)],10,Sl)}}}),Kl=({headers:r,slots:e,initialSort:t,mode:i,rows:n,tooltipTarget:o})=>{const a=i??"infinite",l=new Set,u=m=>!!(m.showPercentage||m.bar||m.thresholds?.length);s.watch([r,()=>n?.value],()=>{r.value.forEach(m=>{if(!u(m))return;let R;if(a==="infinite"&&(m.showPercentage||m.bar)?R="percentage and bar presentation is only supported in unpaginated mode":a==="unpaginated"&&n?.value?.some(C=>{const x=Reflect.get(C,m.key);return x!=null&&gt(x)===null})&&(R="contains non-finite or nonnumeric values; numeric presentation skips those values"),!R)return;const E=`${m.key}:${R}`;l.has(E)||(l.add(E),console.warn(`[TableDataGrid] Column "${m.key}" ${R}.`))})},{immediate:!0});const c=s.computed(()=>{if(a!=="unpaginated")return{};const m=n?.value??[];return Object.fromEntries(r.value.filter(R=>R.showPercentage||R.bar).map(R=>[R.key,Ol(m,R)]))}),d=s.computed(()=>{if(a!=="unpaginated")return{};const m=n?.value??[];return Object.fromEntries(r.value.filter(R=>R.bar).map(R=>[R.key,vl({rows:m,header:R,stats:c.value[R.key]})]))}),h=s.computed(()=>({cells:{slots:e,tooltipTarget:o},presentation:{stats:c.value,labelSizers:d.value}})),f=m=>{const R=t?.sortColumnKey===m.key;return{colId:m.key,flex:!m.width&&!m.maxWidth?1:void 0,headerName:m.label,maxWidth:m.maxWidth,minWidth:m.minWidth,sortable:m.sortable??!1,unSortIcon:m.showSortIcon,...R?{initialSort:t?.sortColumnOrder,initialSortIndex:0}:{},valueGetter:E=>E.data?.[m.key],valueFormatter:E=>E.data?fr(m,E.data):String(E.value??""),width:m.width,cellRenderer:Ul,cellRendererParams:{headerDef:m}}};return{columnDefs:s.computed(()=>r.value.map(f)),gridContext:h}},Yt=({config:r,headers:e,pageSize:t})=>{const i=new Set(e.filter(o=>o.sortable).map(o=>o.key)),n=r?.sortColumnKey&&i.has(r.sortColumnKey)?r.sortColumnKey:void 0;return{sortColumnKey:n,sortColumnOrder:n?r?.sortColumnOrder:void 0,pageSize:r?.pageSize??t,...r?.fitToContent!==void 0?{fitToContent:r.fitToContent}:{}}},gr=(r,e)=>r.sortColumnKey===e.sortColumnKey&&r.sortColumnOrder===e.sortColumnOrder&&r.pageSize===e.pageSize&&r.fitToContent===e.fitToContent,Ml=({headers:r,pageSize:e,tableConfig:t,emitSort:i,emitTableConfigUpdate:n,onExternalConfigChange:o})=>{const a=s.computed(()=>t.value?Yt({config:t.value,headers:r.value,pageSize:e.value}):void 0),l=s.ref(a.value??Yt({config:void 0,headers:r.value,pageSize:e.value}));s.watch(a,h=>{h&&!gr(h,l.value)&&(l.value=h,o?.(h))});const u=h=>{const f=Yt({config:{...l.value,...h},headers:r.value,pageSize:e.value});gr(f,l.value)||((f.sortColumnKey!==l.value.sortColumnKey||f.sortColumnOrder!==l.value.sortColumnOrder)&&i({sortColumnKey:f.sortColumnKey,sortColumnOrder:f.sortColumnOrder}),l.value=f,n(f))};s.watch(r,()=>{t.value||u({})},{deep:!0});const c=s.computed(()=>({sortColumnKey:l.value.sortColumnKey,sortColumnOrder:l.value.sortColumnOrder})),d=s.computed(()=>t.value?.pageSize??e.value);return{activeTableConfig:s.readonly(l),activeSort:c,activePageSize:d,patchTableConfig:u}},Bl=({cellClick:r,headers:e,rowClick:t})=>{const i=s.computed(()=>new Set(e.value.filter(a=>a.disableRowClick).map(a=>a.key))),n=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=n(a);return!!(l&&i.value.has(l))};return{onCellClick:a=>{const l=a.colDef.colId;!a.data||!l||r({columnKey:l,row:a.data,value:a.value})},onRowClick:a=>{a.data&&!o(a)&&t(a.data,a)}}},zl=({activeSort:r,patchTableConfig:e})=>{const t=(i,n)=>{i.applyColumnState({state:n.sortColumnKey?[{colId:n.sortColumnKey,sort:n.sortColumnOrder??null,sortIndex:0}]:[],defaultState:{sort:null,sortIndex:null}})};return{onSortChanged:i=>{const n=i.api.getColumnState().filter(l=>l.sort).sort((l,u)=>(l.sortIndex??0)-(u.sortIndex??0)),o=n[n.length-1],a=o?{sortColumnKey:o.colId,sortColumnOrder:o.sort}:{sortColumnKey:void 0,sortColumnOrder:void 0};(a.sortColumnKey!==r.value.sortColumnKey||a.sortColumnOrder!==r.value.sortColumnOrder)&&e(a),n.length>1&&t(i.api,a)},applySortToGrid:t}},Pl={key:0,class:"table-error-state","data-testid":"table-error-state"},ql={key:1,class:"table-empty-state","data-testid":"table-empty-state"},Hl=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(r,{emit:e}){je.ModuleRegistry.registerModules([je.AllCommunityModule,je.ClientSideRowModelModule,je.InfiniteRowModelModule]);const t=r.mode??"infinite",i=e,{i18n:n}=hr(),{t:o}=n,a=s.useSlots(),l=s.shallowRef(),u=s.useTemplateRef("rootElement"),c=s.shallowRef("body"),d=()=>{const U=document.fullscreenElement;c.value=U instanceof HTMLElement&&U.contains(u.value??null)?U:"body"};s.onMounted(()=>{d(),document.addEventListener("fullscreenchange",d)}),s.onBeforeUnmount(()=>{document.removeEventListener("fullscreenchange",d)});const{activeTableConfig:h,activeSort:f,activePageSize:m,patchTableConfig:R}=Ml({headers:s.toRef(()=>r.headers),pageSize:s.toRef(()=>r.pageSize),tableConfig:s.toRef(()=>r.tableConfig),emitSort:U=>i("sort",U),emitTableConfigUpdate:U=>i("update:tableConfig",U),onExternalConfigChange:U=>{l.value&&C(l.value,U)}}),{onSortChanged:E,applySortToGrid:C}=zl({activeSort:f,patchTableConfig:R}),x=s.computed(()=>t==="unpaginated"&&!!h.value.fitToContent),I=je.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:w,onRowClick:O}=Bl({cellClick:U=>i("cell:click",U),headers:s.toRef(()=>r.headers),rowClick:(U,b)=>i("row:click",U,b)}),v={resizable:!1,sortable:!1,suppressMovable:!0},N=s.computed(()=>[m.value,r.refreshKey]),A=t==="infinite"?_l({fetcher:s.toRef(()=>r.fetcher),resetKey:N,sort:f}):void 0,p=A?.datasource,g=s.computed(()=>A?A.data.value:r.rows),_=s.computed(()=>A?.isFetching.value??!1),T=s.computed(()=>r.rows?Array.from(r.rows):void 0),{columnDefs:S,gridContext:L}=Kl({headers:s.toRef(()=>r.headers),mode:t,rows:T,slots:a,tooltipTarget:c,initialSort:f.value}),{fetchState:K,hasData:H,state:Y}=fl(g,s.toRef(()=>A?.error.value),_),P=s.computed(()=>Y.value===K.SUCCESS&&!H.value);A&&ml({emitState:U=>i("state",U),fetchLifecycleState:Y,hasData:H});const F=()=>{const U=l.value;if(!U||U.isDestroyed())return;const b=f.value,k=U.getColumnState().find(D=>D.sort);k?.colId===b.sortColumnKey&&(k?.sort??void 0)===b.sortColumnOrder||C(U,b)};s.watch([l,f],F);const M=U=>{l.value=U.api,i("grid:ready",U.api)};return(U,b)=>{const k=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{ref_key:"rootElement",ref:u,class:s.normalizeClass(["kong-ui-public-table-data-grid",{"fit-to-content":x.value}]),"data-testid":"table-data-grid"},[r.error?(s.openBlock(),s.createElementBlock("div",Pl,[s.renderSlot(U.$slots,"error-state",{},()=>[s.createVNode(k,{"icon-variant":"error",message:s.unref(o)("errorState.message"),title:s.unref(o)("errorState.title")},null,8,["message","title"])],!0)])):P.value?(s.openBlock(),s.createElementBlock("div",ql,[s.renderSlot(U.$slots,"empty-state",{},()=>[s.createVNode(k,{message:s.unref(o)("emptyState.message"),title:s.unref(o)("emptyState.title")},null,8,["message","title"])],!0)])):(s.openBlock(),s.createBlock(s.unref(Pr.AgGridVue),{key:2,"cache-block-size":s.unref(t)==="infinite"?s.unref(m):void 0,class:"table-data-grid-grid","column-defs":s.unref(S),context:s.unref(L),datasource:s.unref(t)==="infinite"?s.unref(p):void 0,"default-col-def":v,"dom-layout":x.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(I),onCellClicked:s.unref(w),onGridReady:M,onNewColumnsLoaded:F,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)}}}),Gl=(r,e)=>{const t=r.__vccOpts||r;for(const[i,n]of e)t[i]=n;return t},_r=Gl(Hl,[["__scopeId","data-v-01cd8bcd"]]),yr=3,Fl={anthropic:re.AnthropicIcon,azure:re.AzureIcon,bedrock:re.AmazonBedrockIcon,cerebras:re.CerebrasIcon,cohere:re.CohereIcon,databricks:re.DatabricksIcon,deepseek:re.DeepseekIcon,gemini:re.GeminiIcon,huggingface:re.HuggingFaceIcon,llama2:re.MetaLlamaIcon,mistral:re.MistralIcon,moonshot:re.KimiIcon,nvidia:re.NvidiaIcon,ollama:re.OllamaIcon,openai:re.OpenAiIcon,vertex:re.GoogleVertexIcon,vllm:re.VllmIcon,xai:re.GrokIcon},Xt=(r,e)=>{if(!r||!e)return;const t=e.toLowerCase();return r[e]??Object.entries(r).find(([i])=>i.toLowerCase()===t)?.[1]},$l=({columnOptions:r,columnKey:e,rawValue:t})=>{if(!(Xt(r,e)?.icon_set!=="ai_provider"||typeof t!="string"))return Fl[t.toLowerCase()]},Wl=r=>{if(r==null||r==="")return null;const e=typeof r=="number"?r:Number(r);return Number.isFinite(e)?e:null},Vl=r=>r.toLocaleLowerCase().endsWith("count"),Yl=r=>{const e=Object.keys(r?.meta?.display??{}).slice(0,yr),t=r?.meta?.metric_names??[];return(r?.data??[]).map(i=>{const n={record:i};return e.forEach(o=>{n[o]=i.event[o]}),t.forEach(o=>{n[o]=Wl(i.event[o])}),n})},Xl=({data:r,columnOptions:e,i18n:t,fieldTranslationMap:i})=>{const{formatUnit:n}=J.unitFormatter({i18n:t}),o=r?.data??[],a=r?.meta,l=a?.display??{},u=Object.keys(l).slice(0,yr),c=a?.metric_names??[],d=c[0],h=u.length>1,f=O=>nr(t,i,O),m=(O,v)=>Xt(e,O)?.label||v,R=(O,v)=>{if(Vl(O)||O==="requests")return"";const N=v===1?"":"s",A=`chartUnits.${O}`;return t.messages[A]?t.formatMessage({id:A},{plural:N}):O},E=O=>{const v=N=>n(N,"%",{translateUnit:R});return O>0&&O<.01?`< ${v(.01)}`:v(O)},C=(O,v)=>{const N=O.event[v];if(N==null)return"–";const A=typeof N=="number"?N:Number(N);if(Number.isNaN(A))return"–";const p=a?.metric_units?.[v]||"count";return p==="%"?E(A):n(A,p,{approximate:["count","count/minute","token count"].includes(p),isBytes1024:!0,translateUnit:R})},x=(O,v)=>{const N=String(O.record.event[v]),A=l[v]?.[N];return{id:N,label:A?.name||"-",deleted:!!A?.deleted}},I=u.map(O=>({key:O,label:m(O,h?f(O):t.t("topNTable.nameLabel")),type:"dimension",valueFormatter:(v,N)=>x(N,O).label,sortable:!1}));c.forEach(O=>{const v=Xt(e,O);I.push({key:O,label:v?.label||f(O),type:"metric",valueFormatter:(N,A)=>C(A.record,O),showPercentage:v?.value==="relative",percentageFormatter:E,bar:v?.bar==="max"?"absolute":v?.bar,thresholds:v?.thresholds,sortable:!1})});const w=o.length?a?u.some(O=>!Object.keys(l[O]||{}).length)?t.t("topNTable.errors.display"):d?"":t.t("topNTable.errors.metricNames"):t.t("topNTable.errors.meta"):"";return{headers:I,errorMessage:w,getDimension:x}},jl={class:"fallback-entity-link","data-testid":"entity-link-parent"},Rr=s.defineComponent({__name:"FallbackEntityLink",props:{entityLinkData:{}},setup(r){return(e,t)=>(s.openBlock(),s.createElementBlock("div",jl,s.toDisplayString(r.entityLinkData.label),1))}}),Ql=["data-testid"],Zl={key:1},Jl=Ce(s.defineComponent({__name:"TopNDataGrid",props:{chartOptions:{},data:{},fitToContent:{type:Boolean,default:!1},height:{}},setup(r){const e=s.inject(Se),t=Te.useDatasourceConfigStore(),{i18n:i}=ae.useI18n(),n=s.computed(()=>Yl(r.data)),o=s.computed(()=>Xl({data:r.data,columnOptions:r.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")),u=s.computed(()=>({fitToContent:r.fitToContent})),c=s.computed(()=>r.fitToContent?{height:"auto"}:r.height===void 0?void 0:{height:`${r.height}px`}),d=(E,C)=>$l({columnOptions:r.chartOptions.column_options,columnKey:E,rawValue:C}),h=s.defineAsyncComponent(async()=>{if(e?.fetchComponent)try{return await e.fetchComponent("EntityLink")}catch{return Rr}return Rr}),f=E=>{const C=r.chartOptions.entity_links;return C&&(C[E]||Object.entries(C).find(([x])=>x.toLowerCase()===E.toLowerCase())?.[1])||""},m=E=>f(E)||l.value[0]?.key===E&&r.chartOptions.entity_link||"",R=(E,C)=>{const x=m(C),I=String(E[C]);if(I.includes(":")){const[w,O]=I.split(":");return x.replace(Fi,w).replace(Bt,O)}return x.replace(Bt,I)};return(E,C)=>{const x=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{class:"top-n-data-grid","data-testid":n.value.length?"top-n-table":void 0,style:s.normalizeStyle(c.value)},[s.createVNode(s.unref(_r),{error:!!o.value.errorMessage,headers:a.value,mode:"unpaginated",rows:n.value,"table-config":u.value},s.createSlots({"error-state":s.withCtx(()=>[s.createVNode(x,{"action-button-visible":!1,"data-testid":"chart-empty-state"},{icon:s.withCtx(()=>[s.createVNode(s.unref(re.WarningOutlineIcon))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(o.value.errorMessage),1)]),_:1})]),"empty-state":s.withCtx(()=>[s.createVNode(x,{"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:I,rowValue:w})=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(d(I.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,I=>({name:I.key,fn:s.withCtx(({row:w})=>[m(I.key)&&w[I.key]!=="empty"?(s.openBlock(),s.createBlock(s.unref(h),{key:0,class:"top-n-entity-link","entity-link-data":o.value.getDimension(w,I.key),"external-link":R(w,I.key)},null,8,["entity-link-data","external-link"])):o.value.getDimension(w,I.key).label==="empty"?(s.openBlock(),s.createElementBlock("i",Zl,"empty")):s.createCommentVNode("",!0)])}))]),1032,["error","headers","rows","table-config"])],12,Ql)}}}),[["__scopeId","data-v-5705b32b"]]),ec=s.defineComponent({__name:"TopNTableRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{},fitToContent:{type:Boolean}},setup(r){return(e,t)=>(s.openBlock(),s.createBlock(Be,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:s.withCtx(({data:i})=>[s.createVNode(Jl,{"chart-options":r.chartOptions,data:i,"fit-to-content":r.fitToContent,height:r.height},null,8,["chart-options","data","fit-to-content","height"])]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),tc=s.defineComponent({__name:"TopTalkersRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["query-complete"],setup(r,{emit:e}){const t=r,i=e,n=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(n.value.map((c,d)=>[c,o(t.chartOptions.columns[d])]))),l=new Set,u=c=>{l.add(c),l.size===n.value.length&&(l.clear(),i("query-complete"))};return s.watch([a,()=>t.refreshCounter],()=>l.clear()),(c,d)=>(s.openBlock(),s.createBlock(s.unref(we.TopTalkersGrid),{"column-options":r.chartOptions.column_options,columns:n.value,"size-metric":r.chartOptions.size_metric},{column:s.withCtx(({column:h})=>[s.createVNode(Be,{context:r.context,query:a.value.get(h),"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onQueryComplete:f=>u(h)},{default:s.withCtx(({data:f})=>[s.createVNode(s.unref(we.TopTalkersColumn),{"column-options":r.chartOptions.column_options,data:f,dimension:h.dimension,label:h.label,"size-metric":r.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"]))}}),ic=r=>r.records.map(e=>{const t={...e};return Object.entries(e).forEach(([i,n])=>{if(n===null)return;const o=r.meta.display?.[i]?.[String(n)]?.name;o&&(t[i]=o)}),t}),Cr=({columns:r,fieldLabel:e})=>r.map(t=>({key:t,label:e(t)})),rc={platform:Cr,platform_usage:Cr},Er=async({abortController:r,context:e,cursor:t,pageSize:i,query:n,onResponseColumns:o,stripUnknownFilters:a,tabularQueryFn:l})=>{if(!l)throw new Error("AnalyticsBridge.tabularQueryFn is not defined");const u=n.query,c=a({datasource:n.datasource,filters:[...u.filters??[],...e.filters],queryFields:u.entity===void 0?void 0:[u.entity]}),d=await l({datasource:n.datasource,query:{columns:u.columns,cursor:t===void 0?u.cursor:String(t),entity:u.entity,filters:c,page_size:i}},r);return d.meta.columns?.length&&o?.(d.meta.columns),{data:ic(d),cursor:d.meta.cursor,hasMore:!!d.meta.cursor}},nc={platform:Er,platform_usage:Er},sc=Ce(s.defineComponent({__name:"TableDataGridRenderer",props:{query:{},context:{},queryReady:{type:Boolean},height:{},refreshCounter:{}},emits:["loading-change"],setup(r,{emit:e}){const t=r,i=e,n=s.inject(Se),o=Te.useDatasourceConfigStore(),a=ae.useFieldLabel(),l=new AbortController,u=s.ref([]),c=s.ref(!1),d=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 m=s.computed(()=>rc[t.query.datasource]({columns:t.query.columns?.length?t.query.columns:u.value,fieldLabel:C=>a(C)})),R=s.computed(()=>async({cursor:C,pageSize:x})=>{try{await o.isReady();const I=nc[h.value.datasource];if(!I)throw new Error(`No table data grid fetcher found for datasource: ${h.value.datasource}`);const w=await I({abortController:l,context:t.context,cursor:C,pageSize:x,query:h.value,onResponseColumns:O=>{u.value=O},stripUnknownFilters:o.stripUnknownFilters,tabularQueryFn:n?.tabularQueryFn});return c.value=!1,w}catch(I){throw c.value=!0,I}}),E=C=>{C.state==="error"&&(c.value=!0),i("loading-change",C.state==="loading")};return(C,x)=>{const I=s.resolveComponent("KSkeleton");return s.openBlock(),s.createElementBlock("div",{class:"table-data-grid-renderer",style:s.normalizeStyle(d.value)},[r.queryReady?(s.openBlock(),s.createBlock(s.unref(_r),{key:1,error:c.value,fetcher:R.value,headers:m.value,"page-size":r.query.page_size,"refresh-key":f.value,onState:E},null,8,["error","fetcher","headers","page-size","refresh-key"])):(s.openBlock(),s.createBlock(I,{key:0,"data-testid":"table-skeleton",type:"table"}))],4)}}}),[["__scopeId","data-v-c8caabc2"]]),oc=s.defineComponent({__name:"DonutChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){return(e,t)=>(s.openBlock(),s.createBlock(Vt,{"chart-options":r.chartOptions,context:r.context,height:r.height,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),ac="#ffffff",lc="#0044f4",cc="#d60027",uc="#ad000e",dc="#850000",hc="#5c0000",fc="#ff3954",mc="#ffabab",pc="#ffe5e5",gc="#ecfcff",_c="#6f28ff",yc="#f1f0ff",Rc="#e0e4ea",Cc="#0044f4",Ec="#0030cc",Oc="#002099",bc="#001466",wc="#5f9aff",Tc="#bee2ff",vc="#eefaff",Sc="#0d0e14",xc="#6c7489",Ic="#52596e",Dc="#3a3f51",kc="#232633",Nc="#afb7c5",Ac="#e0e4ea",Lc="#f9fafb",Uc="rgba(13, 14, 20, 0.6)",Kc="#0044f4",Mc="#0030cc",Bc="#002099",zc="#001466",Pc="#5f9aff",qc="#bee2ff",Hc="#eefaff",Gc="#007d60",Fc="#005944",$c="#004737",Wc="#003629",Vc="#00d6a4",Yc="#b5ffee",Xc="#ecfffb",jc="rgba(0, 0, 0, 0)",Qc="#995c00",Zc="#804400",Jc="#662d00",eu="#4d1b00",tu="#ffc400",iu="#fff296",ru="#fffce0",nu="#e0e4ea",su="#0044f4",ou="#d60027",au="#ad000e",lu="#850000",cu="#5c0000",uu="#ff3954",du="#ffabab",hu="#ffe5e5",fu="#6f28ff",mu="#e0e4ea",pu="rgba(255, 255, 255, 0.2)",gu="#6c7489",_u="#52596e",yu="#3a3f51",Ru="#232633",Cu="#afb7c5",Eu="#e0e4ea",Ou="#f9fafb",bu="#0044f4",wu="#0030cc",Tu="#002099",vu="#001466",Su="#5f9aff",xu="#bee2ff",Iu="#eefaff",Du="rgba(0, 0, 0, 0)",ku="#0044f4",Nu="#0d0e14",Au="#0044f4",Lu="#d60027",Uu="#ad000e",Ku="#850000",Mu="#5c0000",Bu="#ff3954",zu="#ffabab",Pu="#ffe5e5",qu="#00abd2",Hu="#d60067",Gu="#6f28ff",Fu="#5e00f5",$u="#afb7c5",Wu="#0044f4",Vu="#0030cc",Yu="#002099",Xu="#001466",ju="#5f9aff",Qu="#bee2ff",Zu="#eefaff",Ju="#ffffff",ed="#6c7489",td="#52596e",id="#3a3f51",rd="#232633",nd="#afb7c5",sd="#e0e4ea",od="#f9fafb",ad="#0044f4",ld="#0030cc",cd="#002099",ud="#001466",dd="#5f9aff",hd="#bee2ff",fd="#eefaff",md="#007d60",pd="#005944",gd="#004737",_d="#003629",yd="#00d6a4",Rd="#b5ffee",Cd="#ecfffb",Ed="#995c00",Od="#804400",bd="#662d00",wd="#4d1b00",Td="#ffc400",vd="#fff296",Sd="#fffce0",xd="0.2s",Id="0px",Dd="2px",kd="4px",Nd="6px",Ad="8px",Ld="10px",Ud="50%",Kd="100px",Md="0px",Bd="1px",zd="2px",Pd="4px",qd="640px",Hd="768px",Gd="1024px",Fd="1280px",$d="1536px",Wd="'JetBrains Mono', Consolas, monospace",Vd="'Inter', Roboto, Helvetica, sans-serif",jt="'Inter', Roboto, Helvetica, sans-serif",Yd="10px",Xd="12px",jd="14px",Qd="16px",Zd="18px",Jd="20px",eh="24px",th="32px",ih="40px",rh="48px",nh="700",sh="500",oh="400",ah="600",lh="#f50045",ch="#828a9e",uh="#306fff",dh="#00a17b",hh="#ffc400",fh="10px",mh="12px",ph="16px",gh="20px",_h="24px",yh="32px",Rh="40px",Ch="48px",Eh="normal",Oh="-0.12px",bh="-0.24px",wh="-0.32px",Th="-0.4px",vh="-0.48px",Sh="normal",xh="12px",Ih="16px",Dh="20px",kh="24px",Nh="28px",Ah="32px",Lh="36px",Uh="40px",Kh="48px",Mh="56px",Bh="#f1f0ff",zh="#ffe5e5",Ph="#eefaff",qh="#52596e",Hh="#e0e4ea",Gh="#ecfcff",Fh="#ecfffb",$h="#fffce0",Wh="#fff0f7",Vh="#6f28ff",Yh="#5e00f5",Xh="#d60027",jh="#ad000e",Qh="#0044f4",Zh="#0030cc",Jh="#e0e4ea",ef="#afb7c5",tf="#52596e",rf="#3a3f51",nf="#00819d",sf="#00647a",of="#007d60",af="#005944",lf="#995c00",cf="#804400",uf="#d60067",df="#ad0053",hf="#000933",ff="rgba(255, 255, 255, 0.12)",mf="rgba(255, 255, 255, 0.12)",pf="#00fabe",gf="rgba(255, 255, 255, 0.24)",_f="#bee2ff",yf="#ffffff",Rf="#eefaff",Cf="#00fabe",Ef="0 0 0 1px rgba(255, 255, 255, 0.12) inset",Of="4px 0 0 0 #00fabe inset",bf="0 0 0 1px rgba(255, 255, 255, 0.60) inset",wf="0px 4px 20px 0px rgba(0, 0, 0, 0.08)",Tf="0px 0px 0px 1px #e0e4ea inset",vf="0px 0px 0px 1px #d60027 inset",Sf="0px 0px 0px 1px #ad000e inset",xf="0px 0px 0px 1px #e0e4ea inset",If="0px 0px 0px 1px #0044f4 inset",Df="0px 0px 0px 1px #001466 inset",kf="0px 0px 0px 1px #5f9aff inset",Nf="0px 0px 0px 4px rgba(0, 68, 244, 0.2)",Af="0px",Lf="2px",Uf="4px",Kf="6px",Mf="8px",Bf="12px",zf="16px",Pf="20px",qf="24px",Hf="32px",Gf="40px",Ff="48px",$f="56px",Wf="64px",Vf="80px",Yf="96px",Xf="auto",jf="#bee2ff",Qf="#8fc1ff",Zf="#5f9aff",Jf="#306fff",em="#b5ffee",tm="#00fabe",im="#00d6a4",rm="#00a17b",nm="#007d60",sm="#005944",om="#b5ffee",am="#00fabe",lm="#b5ffee",cm="#00a17b",um="#fff296",dm="#ffe04b",hm="#ffc400",fm="#b37600",mm="#995c00",pm="#804400",gm="#fff296",_m="#ffe04b",ym="#ffc2b3",Rm="#ff9877",Cm="#ff723c",Em="#f75008",Om="#d13500",bm="#a31f00",wm="#ffc2b3",Tm="#ff9877",vm="#ff723c",Sm="#f75008",xm="#d13500",Im="#a31f00",Dm="#ffc2b3",km="#ff9877",Nm="#ff723c",Am="#f75008",Lm="#d13500",Um="#a31f00",Km="#ffc2b3",Mm="#ff9877",Bm="#ff723c",zm="#f75008",Pm="#d13500",qm="#a31f00",Hm="#ffc2b3",Gm="#ff9877",Fm="#ff723c",$m="#f75008",Wm="#d13500",Vm="#ffabab",Ym="#ff7272",Xm="#ff3954",jm="#f50045",Qm="#d60027",Zm="#ad000e",Jm="#ffabab",ep="#ff7272",tp="#ff3954",ip="#f50045",rp="#d60027",np="#eefaff",sp="#ecfffb",op="#fffce0",ap="#fff1ef",lp="#ffe5e5",cp="#5f9aff",up="#00d6a4",dp="#ffc400",hp="#ff723c",fp="#ff3954",mp="#eefaff",pp="#ecfffb",gp="#fffce0",_p="#fff1ef",yp="#ffe5e5",Rp="#0044f4",Cp="#007d60",Ep="#995c00",Op="#d13500",bp="#d60027",Or=Object.freeze(Object.defineProperty({__proto__:null,KUI_ANIMATION_DURATION_20:xd,KUI_BORDER_RADIUS_0:Id,KUI_BORDER_RADIUS_10:Dd,KUI_BORDER_RADIUS_20:kd,KUI_BORDER_RADIUS_30:Nd,KUI_BORDER_RADIUS_40:Ad,KUI_BORDER_RADIUS_50:Ld,KUI_BORDER_RADIUS_CIRCLE:Ud,KUI_BORDER_RADIUS_ROUND:Kd,KUI_BORDER_WIDTH_0:Md,KUI_BORDER_WIDTH_10:Bd,KUI_BORDER_WIDTH_20:zd,KUI_BORDER_WIDTH_30:Pd,KUI_BREAKPOINT_DESKTOP:$d,KUI_BREAKPOINT_LAPTOP:Fd,KUI_BREAKPOINT_MOBILE:qd,KUI_BREAKPOINT_PHABLET:Hd,KUI_BREAKPOINT_TABLET:Gd,KUI_COLOR_BACKGROUND:ac,KUI_COLOR_BACKGROUND_ACCENT:lc,KUI_COLOR_BACKGROUND_DANGER:cc,KUI_COLOR_BACKGROUND_DANGER_STRONG:uc,KUI_COLOR_BACKGROUND_DANGER_STRONGER:dc,KUI_COLOR_BACKGROUND_DANGER_STRONGEST:hc,KUI_COLOR_BACKGROUND_DANGER_WEAK:fc,KUI_COLOR_BACKGROUND_DANGER_WEAKER:mc,KUI_COLOR_BACKGROUND_DANGER_WEAKEST:pc,KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST:gc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE:_c,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST:yc,KUI_COLOR_BACKGROUND_DISABLED:Rc,KUI_COLOR_BACKGROUND_INFO:Cc,KUI_COLOR_BACKGROUND_INFO_STRONG:Ec,KUI_COLOR_BACKGROUND_INFO_STRONGER:Oc,KUI_COLOR_BACKGROUND_INFO_STRONGEST:bc,KUI_COLOR_BACKGROUND_INFO_WEAK:wc,KUI_COLOR_BACKGROUND_INFO_WEAKER:Tc,KUI_COLOR_BACKGROUND_INFO_WEAKEST:vc,KUI_COLOR_BACKGROUND_INVERSE:Sc,KUI_COLOR_BACKGROUND_NEUTRAL:xc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONG:Ic,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGER:Dc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGEST:kc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAK:Nc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKER:Ac,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST:Lc,KUI_COLOR_BACKGROUND_OVERLAY:Uc,KUI_COLOR_BACKGROUND_PRIMARY:Kc,KUI_COLOR_BACKGROUND_PRIMARY_STRONG:Mc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGER:Bc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGEST:zc,KUI_COLOR_BACKGROUND_PRIMARY_WEAK:Pc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKER:qc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKEST:Hc,KUI_COLOR_BACKGROUND_SUCCESS:Gc,KUI_COLOR_BACKGROUND_SUCCESS_STRONG:Fc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGER:$c,KUI_COLOR_BACKGROUND_SUCCESS_STRONGEST:Wc,KUI_COLOR_BACKGROUND_SUCCESS_WEAK:Vc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKER:Yc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKEST:Xc,KUI_COLOR_BACKGROUND_TRANSPARENT:jc,KUI_COLOR_BACKGROUND_WARNING:Qc,KUI_COLOR_BACKGROUND_WARNING_STRONG:Zc,KUI_COLOR_BACKGROUND_WARNING_STRONGER:Jc,KUI_COLOR_BACKGROUND_WARNING_STRONGEST:eu,KUI_COLOR_BACKGROUND_WARNING_WEAK:tu,KUI_COLOR_BACKGROUND_WARNING_WEAKER:iu,KUI_COLOR_BACKGROUND_WARNING_WEAKEST:ru,KUI_COLOR_BORDER:nu,KUI_COLOR_BORDER_ACCENT:su,KUI_COLOR_BORDER_DANGER:ou,KUI_COLOR_BORDER_DANGER_STRONG:au,KUI_COLOR_BORDER_DANGER_STRONGER:lu,KUI_COLOR_BORDER_DANGER_STRONGEST:cu,KUI_COLOR_BORDER_DANGER_WEAK:uu,KUI_COLOR_BORDER_DANGER_WEAKER:du,KUI_COLOR_BORDER_DANGER_WEAKEST:hu,KUI_COLOR_BORDER_DECORATIVE_PURPLE:fu,KUI_COLOR_BORDER_DISABLED:mu,KUI_COLOR_BORDER_INVERSE:pu,KUI_COLOR_BORDER_NEUTRAL:gu,KUI_COLOR_BORDER_NEUTRAL_STRONG:_u,KUI_COLOR_BORDER_NEUTRAL_STRONGER:yu,KUI_COLOR_BORDER_NEUTRAL_STRONGEST:Ru,KUI_COLOR_BORDER_NEUTRAL_WEAK:Cu,KUI_COLOR_BORDER_NEUTRAL_WEAKER:Eu,KUI_COLOR_BORDER_NEUTRAL_WEAKEST:Ou,KUI_COLOR_BORDER_PRIMARY:bu,KUI_COLOR_BORDER_PRIMARY_STRONG:wu,KUI_COLOR_BORDER_PRIMARY_STRONGER:Tu,KUI_COLOR_BORDER_PRIMARY_STRONGEST:vu,KUI_COLOR_BORDER_PRIMARY_WEAK:Su,KUI_COLOR_BORDER_PRIMARY_WEAKER:xu,KUI_COLOR_BORDER_PRIMARY_WEAKEST:Iu,KUI_COLOR_BORDER_TRANSPARENT:Du,KUI_COLOR_BRAND:ku,KUI_COLOR_TEXT:Nu,KUI_COLOR_TEXT_ACCENT:Au,KUI_COLOR_TEXT_DANGER:Lu,KUI_COLOR_TEXT_DANGER_STRONG:Uu,KUI_COLOR_TEXT_DANGER_STRONGER:Ku,KUI_COLOR_TEXT_DANGER_STRONGEST:Mu,KUI_COLOR_TEXT_DANGER_WEAK:Bu,KUI_COLOR_TEXT_DANGER_WEAKER:zu,KUI_COLOR_TEXT_DANGER_WEAKEST:Pu,KUI_COLOR_TEXT_DECORATIVE_AQUA:qu,KUI_COLOR_TEXT_DECORATIVE_PINK:Hu,KUI_COLOR_TEXT_DECORATIVE_PURPLE:Gu,KUI_COLOR_TEXT_DECORATIVE_PURPLE_STRONG:Fu,KUI_COLOR_TEXT_DISABLED:$u,KUI_COLOR_TEXT_INFO:Wu,KUI_COLOR_TEXT_INFO_STRONG:Vu,KUI_COLOR_TEXT_INFO_STRONGER:Yu,KUI_COLOR_TEXT_INFO_STRONGEST:Xu,KUI_COLOR_TEXT_INFO_WEAK:ju,KUI_COLOR_TEXT_INFO_WEAKER:Qu,KUI_COLOR_TEXT_INFO_WEAKEST:Zu,KUI_COLOR_TEXT_INVERSE:Ju,KUI_COLOR_TEXT_NEUTRAL:ed,KUI_COLOR_TEXT_NEUTRAL_STRONG:td,KUI_COLOR_TEXT_NEUTRAL_STRONGER:id,KUI_COLOR_TEXT_NEUTRAL_STRONGEST:rd,KUI_COLOR_TEXT_NEUTRAL_WEAK:nd,KUI_COLOR_TEXT_NEUTRAL_WEAKER:sd,KUI_COLOR_TEXT_NEUTRAL_WEAKEST:od,KUI_COLOR_TEXT_PRIMARY:ad,KUI_COLOR_TEXT_PRIMARY_STRONG:ld,KUI_COLOR_TEXT_PRIMARY_STRONGER:cd,KUI_COLOR_TEXT_PRIMARY_STRONGEST:ud,KUI_COLOR_TEXT_PRIMARY_WEAK:dd,KUI_COLOR_TEXT_PRIMARY_WEAKER:hd,KUI_COLOR_TEXT_PRIMARY_WEAKEST:fd,KUI_COLOR_TEXT_SUCCESS:md,KUI_COLOR_TEXT_SUCCESS_STRONG:pd,KUI_COLOR_TEXT_SUCCESS_STRONGER:gd,KUI_COLOR_TEXT_SUCCESS_STRONGEST:_d,KUI_COLOR_TEXT_SUCCESS_WEAK:yd,KUI_COLOR_TEXT_SUCCESS_WEAKER:Rd,KUI_COLOR_TEXT_SUCCESS_WEAKEST:Cd,KUI_COLOR_TEXT_WARNING:Ed,KUI_COLOR_TEXT_WARNING_STRONG:Od,KUI_COLOR_TEXT_WARNING_STRONGER:bd,KUI_COLOR_TEXT_WARNING_STRONGEST:wd,KUI_COLOR_TEXT_WARNING_WEAK:Td,KUI_COLOR_TEXT_WARNING_WEAKER:vd,KUI_COLOR_TEXT_WARNING_WEAKEST:Sd,KUI_FONT_FAMILY_CODE:Wd,KUI_FONT_FAMILY_HEADING:Vd,KUI_FONT_FAMILY_TEXT:jt,KUI_FONT_SIZE_10:Yd,KUI_FONT_SIZE_100:rh,KUI_FONT_SIZE_20:Xd,KUI_FONT_SIZE_30:jd,KUI_FONT_SIZE_40:Qd,KUI_FONT_SIZE_50:Zd,KUI_FONT_SIZE_60:Jd,KUI_FONT_SIZE_70:eh,KUI_FONT_SIZE_80:th,KUI_FONT_SIZE_90:ih,KUI_FONT_WEIGHT_BOLD:nh,KUI_FONT_WEIGHT_MEDIUM:sh,KUI_FONT_WEIGHT_REGULAR:oh,KUI_FONT_WEIGHT_SEMIBOLD:ah,KUI_ICON_COLOR_DANGER:lh,KUI_ICON_COLOR_NEUTRAL:ch,KUI_ICON_COLOR_PRIMARY:uh,KUI_ICON_COLOR_SUCCESS:dh,KUI_ICON_COLOR_WARNING:hh,KUI_ICON_SIZE_10:fh,KUI_ICON_SIZE_20:mh,KUI_ICON_SIZE_30:ph,KUI_ICON_SIZE_40:gh,KUI_ICON_SIZE_50:_h,KUI_ICON_SIZE_60:yh,KUI_ICON_SIZE_70:Rh,KUI_ICON_SIZE_80:Ch,KUI_LETTER_SPACING_0:Eh,KUI_LETTER_SPACING_MINUS_10:Oh,KUI_LETTER_SPACING_MINUS_20:bh,KUI_LETTER_SPACING_MINUS_30:wh,KUI_LETTER_SPACING_MINUS_40:Th,KUI_LETTER_SPACING_MINUS_50:vh,KUI_LETTER_SPACING_NORMAL:Sh,KUI_LINE_HEIGHT_10:xh,KUI_LINE_HEIGHT_100:Mh,KUI_LINE_HEIGHT_20:Ih,KUI_LINE_HEIGHT_30:Dh,KUI_LINE_HEIGHT_40:kh,KUI_LINE_HEIGHT_50:Nh,KUI_LINE_HEIGHT_60:Ah,KUI_LINE_HEIGHT_70:Lh,KUI_LINE_HEIGHT_80:Uh,KUI_LINE_HEIGHT_90:Kh,KUI_METHOD_COLOR_BACKGROUND_CONNECT:Bh,KUI_METHOD_COLOR_BACKGROUND_DELETE:zh,KUI_METHOD_COLOR_BACKGROUND_GET:Ph,KUI_METHOD_COLOR_BACKGROUND_HEAD:qh,KUI_METHOD_COLOR_BACKGROUND_OPTIONS:Hh,KUI_METHOD_COLOR_BACKGROUND_PATCH:Gh,KUI_METHOD_COLOR_BACKGROUND_POST:Fh,KUI_METHOD_COLOR_BACKGROUND_PUT:$h,KUI_METHOD_COLOR_BACKGROUND_TRACE:Wh,KUI_METHOD_COLOR_TEXT_CONNECT:Vh,KUI_METHOD_COLOR_TEXT_CONNECT_STRONG:Yh,KUI_METHOD_COLOR_TEXT_DELETE:Xh,KUI_METHOD_COLOR_TEXT_DELETE_STRONG:jh,KUI_METHOD_COLOR_TEXT_GET:Qh,KUI_METHOD_COLOR_TEXT_GET_STRONG:Zh,KUI_METHOD_COLOR_TEXT_HEAD:Jh,KUI_METHOD_COLOR_TEXT_HEAD_STRONG:ef,KUI_METHOD_COLOR_TEXT_OPTIONS:tf,KUI_METHOD_COLOR_TEXT_OPTIONS_STRONG:rf,KUI_METHOD_COLOR_TEXT_PATCH:nf,KUI_METHOD_COLOR_TEXT_PATCH_STRONG:sf,KUI_METHOD_COLOR_TEXT_POST:of,KUI_METHOD_COLOR_TEXT_POST_STRONG:af,KUI_METHOD_COLOR_TEXT_PUT:lf,KUI_METHOD_COLOR_TEXT_PUT_STRONG:cf,KUI_METHOD_COLOR_TEXT_TRACE:uf,KUI_METHOD_COLOR_TEXT_TRACE_STRONG:df,KUI_NAVIGATION_COLOR_BACKGROUND:hf,KUI_NAVIGATION_COLOR_BACKGROUND_SELECTED:ff,KUI_NAVIGATION_COLOR_BORDER:mf,KUI_NAVIGATION_COLOR_BORDER_CHILD:pf,KUI_NAVIGATION_COLOR_BORDER_DIVIDER:gf,KUI_NAVIGATION_COLOR_TEXT:_f,KUI_NAVIGATION_COLOR_TEXT_FOCUS:yf,KUI_NAVIGATION_COLOR_TEXT_HOVER:Rf,KUI_NAVIGATION_COLOR_TEXT_SELECTED:Cf,KUI_NAVIGATION_SHADOW_BORDER:Ef,KUI_NAVIGATION_SHADOW_BORDER_CHILD:Of,KUI_NAVIGATION_SHADOW_FOCUS:bf,KUI_SHADOW:wf,KUI_SHADOW_BORDER:Tf,KUI_SHADOW_BORDER_DANGER:vf,KUI_SHADOW_BORDER_DANGER_STRONG:Sf,KUI_SHADOW_BORDER_DISABLED:xf,KUI_SHADOW_BORDER_PRIMARY:If,KUI_SHADOW_BORDER_PRIMARY_STRONGEST:Df,KUI_SHADOW_BORDER_PRIMARY_WEAK:kf,KUI_SHADOW_FOCUS:Nf,KUI_SPACE_0:Af,KUI_SPACE_10:Lf,KUI_SPACE_100:Gf,KUI_SPACE_110:Ff,KUI_SPACE_120:$f,KUI_SPACE_130:Wf,KUI_SPACE_140:Vf,KUI_SPACE_150:Yf,KUI_SPACE_20:Uf,KUI_SPACE_30:Kf,KUI_SPACE_40:Mf,KUI_SPACE_50:Bf,KUI_SPACE_60:zf,KUI_SPACE_70:Pf,KUI_SPACE_80:qf,KUI_SPACE_90:Hf,KUI_SPACE_AUTO:Xf,KUI_STATUS_COLOR_100:jf,KUI_STATUS_COLOR_100S:cp,KUI_STATUS_COLOR_101:Qf,KUI_STATUS_COLOR_102:Zf,KUI_STATUS_COLOR_103:Jf,KUI_STATUS_COLOR_1NA:np,KUI_STATUS_COLOR_200:em,KUI_STATUS_COLOR_200S:up,KUI_STATUS_COLOR_201:tm,KUI_STATUS_COLOR_202:im,KUI_STATUS_COLOR_203:rm,KUI_STATUS_COLOR_204:nm,KUI_STATUS_COLOR_205:sm,KUI_STATUS_COLOR_206:om,KUI_STATUS_COLOR_207:am,KUI_STATUS_COLOR_208:lm,KUI_STATUS_COLOR_226:cm,KUI_STATUS_COLOR_2NA:sp,KUI_STATUS_COLOR_300:um,KUI_STATUS_COLOR_300S:dp,KUI_STATUS_COLOR_301:dm,KUI_STATUS_COLOR_302:hm,KUI_STATUS_COLOR_303:fm,KUI_STATUS_COLOR_304:mm,KUI_STATUS_COLOR_305:pm,KUI_STATUS_COLOR_307:gm,KUI_STATUS_COLOR_308:_m,KUI_STATUS_COLOR_3NA:op,KUI_STATUS_COLOR_400:ym,KUI_STATUS_COLOR_400S:hp,KUI_STATUS_COLOR_401:Rm,KUI_STATUS_COLOR_402:Cm,KUI_STATUS_COLOR_403:Em,KUI_STATUS_COLOR_404:Om,KUI_STATUS_COLOR_405:bm,KUI_STATUS_COLOR_406:wm,KUI_STATUS_COLOR_407:Tm,KUI_STATUS_COLOR_408:vm,KUI_STATUS_COLOR_409:Sm,KUI_STATUS_COLOR_410:xm,KUI_STATUS_COLOR_411:Im,KUI_STATUS_COLOR_412:Dm,KUI_STATUS_COLOR_413:km,KUI_STATUS_COLOR_414:Nm,KUI_STATUS_COLOR_415:Am,KUI_STATUS_COLOR_416:Lm,KUI_STATUS_COLOR_417:Um,KUI_STATUS_COLOR_418:Km,KUI_STATUS_COLOR_421:Mm,KUI_STATUS_COLOR_422:Bm,KUI_STATUS_COLOR_423:zm,KUI_STATUS_COLOR_424:Pm,KUI_STATUS_COLOR_425:qm,KUI_STATUS_COLOR_426:Hm,KUI_STATUS_COLOR_428:Gm,KUI_STATUS_COLOR_429:Fm,KUI_STATUS_COLOR_431:$m,KUI_STATUS_COLOR_451:Wm,KUI_STATUS_COLOR_4NA:ap,KUI_STATUS_COLOR_500:Vm,KUI_STATUS_COLOR_500S:fp,KUI_STATUS_COLOR_501:Ym,KUI_STATUS_COLOR_502:Xm,KUI_STATUS_COLOR_503:jm,KUI_STATUS_COLOR_504:Qm,KUI_STATUS_COLOR_505:Zm,KUI_STATUS_COLOR_506:Jm,KUI_STATUS_COLOR_507:ep,KUI_STATUS_COLOR_508:tp,KUI_STATUS_COLOR_510:ip,KUI_STATUS_COLOR_511:rp,KUI_STATUS_COLOR_5NA:lp,KUI_STATUS_COLOR_BACKGROUND_100:mp,KUI_STATUS_COLOR_BACKGROUND_200:pp,KUI_STATUS_COLOR_BACKGROUND_300:gp,KUI_STATUS_COLOR_BACKGROUND_400:_p,KUI_STATUS_COLOR_BACKGROUND_500:yp,KUI_STATUS_COLOR_TEXT_100:Rp,KUI_STATUS_COLOR_TEXT_200:Cp,KUI_STATUS_COLOR_TEXT_300:Ep,KUI_STATUS_COLOR_TEXT_400:Op,KUI_STATUS_COLOR_TEXT_500:bp},Symbol.toStringTag,{value:"Module"})),br=Object.keys(Or).filter(r=>r.startsWith("KUI_COLOR")),wr=r=>Or[r],wp=r=>`--${r.toLowerCase().replaceAll("_","-")}`,Tr=()=>{if(typeof window>"u")return Object.fromEntries(br.map(t=>[t,wr(t)]));const r=window.getComputedStyle(document.documentElement),e=(t,i)=>r.getPropertyValue(t).trim()||i;return Object.fromEntries(br.map(t=>[t,e(wp(t),wr(t))]))},Qt=r=>{const e=s.ref(Tr());if(typeof window<"u"&&typeof MutationObserver<"u"){const t=new MutationObserver(()=>{e.value=Tr()});t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-kui-theme"]}),s.getCurrentScope()&&s.onScopeDispose(()=>t.disconnect())}return e},Tp=()=>typeof window>"u"?jt:window.getComputedStyle(document.documentElement).getPropertyValue("--kui-font-family-text").trim()||jt,vp=r=>{const e=Tp(),t={color:r.KUI_COLOR_TEXT,fontFamily:e},i={axisLabel:{color:r.KUI_COLOR_TEXT_NEUTRAL,fontFamily:e},axisLine:{lineStyle:{color:r.KUI_COLOR_BORDER}},splitLine:{lineStyle:{color:r.KUI_COLOR_BORDER}}};return{textStyle:t,categoryAxis:i,valueAxis:i,tooltip:{backgroundColor:r.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:r.KUI_COLOR_TEXT,fontFamily:e}},visualMap:{textStyle:{color:r.KUI_COLOR_TEXT_NEUTRAL,fontFamily:e}},legend:{textStyle:{color:r.KUI_COLOR_TEXT_NEUTRAL,fontFamily:e}}}},Sp=r=>s.computed(()=>vp(r.value)),xp={class:"kong-ui-public-echarts-tooltip"},Ip={class:"tooltip-title"},Dp={class:"title"},kp={key:0,class:"subtitle"},Np={class:"context"},Ap={class:"metric"},Lp={class:"tooltip-rows"},Up={class:"display-value"},Kp=s.defineComponent({__name:"ChartTooltip",props:{title:{},context:{},metric:{},rows:{}},setup(r){return(e,t)=>(s.openBlock(),s.createElementBlock("div",xp,[s.createElementVNode("div",Ip,[s.createElementVNode("div",Dp,s.toDisplayString(r.title),1),r.context||r.metric?(s.openBlock(),s.createElementBlock("div",kp,[s.createElementVNode("div",Np,s.toDisplayString(r.context),1),s.createElementVNode("div",Ap,s.toDisplayString(r.metric),1)])):s.createCommentVNode("",!0)]),s.createElementVNode("ul",Lp,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r.rows,(i,n)=>(s.openBlock(),s.createElementBlock("li",{key:`${i.label}-${n}`,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",Up,s.toDisplayString(i.value),1)],2))),128))])]))}}),vr=(r,e)=>{const t=r.__vccOpts||r;for(const[i,n]of e)t[i]=n;return t},Mp=vr(Kp,[["__scopeId","data-v-ca633353"]]),Zt=r=>Array.isArray(r)?r:[r],Sr=(r,e)=>typeof r=="number"?e?.[r]??String(r):r,Jt=(r,e,t,i)=>({color:typeof r.color=="string"?r.color:void 0,label:e,value:i?i(Number(t)):String(t??"")}),Bp=r=>Array.isArray(r)?r[r.length-1]:r,zp=r=>{const e=Zt(r),t=e[0];return{context:String(t?.axisValueLabel??t?.name??""),rows:e.map(i=>Jt(i,i.seriesName??"",Bp(i.value)))}},Pp=r=>{let e;return s.getCurrentScope()&&s.onScopeDispose(()=>{e&&s.render(null,e)}),t=>{const i=(r()??zp)(t);return i?(e??=document.createElement("div"),s.render(s.h(Mp,i),e),e):""}},qp={class:"kong-ui-public-echarts"},Hp=s.defineComponent({name:"KongECharts",inheritAttrs:!1,__name:"ECharts",props:{option:{},height:{default:"400px"},tooltipContent:{type:Function}},setup(r){s.useCssVars(o=>({v1cecfeed:o.height})),Tt.use([Gr.CanvasRenderer,lt.GridComponent,lt.TooltipComponent]);const e=Qt(),t=Sp(e),i=Pp(()=>r.tooltipContent),n=s.computed(()=>({...r.option,tooltip:{...r.option?.tooltip,formatter:i}}));return(o,a)=>(s.openBlock(),s.createElementBlock("div",qp,[s.createVNode(s.unref(Hr),s.mergeProps({autoresize:!0,class:"chart",option:n.value,theme:s.unref(t)},o.$attrs),null,16,["option","theme"])]))}}),xr=vr(Hp,[["__scopeId","data-v-68114d20"]]),Ir=r=>typeof r=="object"&&r!==null&&!Array.isArray(r),rt=(r,...e)=>{const t={...r};for(const i of e)if(i)for(const[n,o]of Object.entries(i)){if(o===void 0)continue;const a=t[n];t[n]=Ir(a)&&Ir(o)?rt(a,o):o}return t},Gp=s.defineComponent({__name:"HeatmapChart",props:{data:{},xAxisLabels:{},yAxisLabels:{},seriesName:{},min:{},max:{},colorRange:{},valueFormatter:{type:Function},visibleRows:{},showValues:{type:Boolean},seriesOption:{},option:{},height:{},tooltipTitle:{}},setup(r){Tt.use([ai.HeatmapChart,lt.VisualMapComponent,lt.DataZoomSliderComponent]);const e=Qt(),t=a=>{const[l]=Zt(a),[u,c,d]=l.value;return{title:r.tooltipTitle,context:Sr(u,r.xAxisLabels),metric:r.seriesName,rows:[Jt(l,Sr(c,r.yAxisLabels),d,r.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}),n=s.computed(()=>{const a=r.data??[],l=!!r.visibleRows&&r.visibleRows<(r.yAxisLabels?.length??0),u=r.valueFormatter?c=>r.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:r.xAxisLabels??[],splitArea:{show:!1},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"category",data:r.yAxisLabels??[],inverse:!0,splitArea:{show:!1},axisLine:{show:!1},axisTick:{show:!1},axisLabel:{width:160,overflow:"truncate"}},visualMap:{min:r.min??0,max:r.max??a.reduce((c,[,,d])=>Math.max(c,d),1),calculable:!0,orient:"horizontal",left:"center",bottom:0,inRange:{color:r.colorRange??[e.value.KUI_COLOR_BACKGROUND_INFO_WEAKEST,e.value.KUI_COLOR_BACKGROUND_INFO_STRONG]},formatter:u},...l?{dataZoom:[i(r.visibleRows)]}:{},series:[rt({name:r.seriesName,type:"heatmap",data:a,animation:!1,label:{show:r.showValues??!1,formatter:r.valueFormatter?({value:c})=>r.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}}},r.seriesOption)]}}),o=s.computed(()=>rt(n.value,r.option));return(a,l)=>(s.openBlock(),s.createBlock(xr,{height:r.height,option:o.value,"tooltip-content":t},null,8,["height","option"]))}}),Fp=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(r){Tt.use([ai.TreemapChart]);const e=Qt(),t=l=>{const[u]=Zt(l),c=u.treePathInfo??[];if(c.length===1)return;const d=c.slice(1,-1).map(({name:h})=>h);return{title:r.tooltipTitle,context:d.length?d.join(" / "):void 0,metric:r.seriesName,rows:[Jt(u,u.name,Number(u.value),r.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],n=(l=[])=>l.reduce((u,c)=>Math.max(u,1+n(c.children)),0),o=s.computed(()=>({series:[rt({name:r.seriesName,type:"treemap",data:r.data??[],nodeClick:r.drillDown?"zoomToNode":!1,...r.drillDown?{scaleLimit:{min:1,max:1/0},zoomToNodeRatio:.2}:{},leafDepth:r.leafDepth??n(r.data),roam:r.drillDown,left:0,top:0,right:0,bottom:r.drillDown?40:0,visibleMin:0,breadcrumb:{show:r.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:r.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:r.showValues?({name:l,value:u})=>`${l}
13
- ${r.valueFormatter?r.valueFormatter(Number(u)):String(u)}`:void 0}},r.seriesOption)]})),a=s.computed(()=>rt(o.value,r.option));return(l,u)=>(s.openBlock(),s.createBlock(xr,{height:r.height,option:a.value,"tooltip-content":t},null,8,["height","option"]))}}),Dr=r=>{if(r==null||typeof r=="string"&&r.trim()==="")return;const e=Number(r);return Number.isFinite(e)?e:void 0},$p=(r,e,t)=>{if(!t.length)return r;const i=t.reduce((o,a)=>Math.min(o,a));if(i<=r)return i;const n=Math.ceil((i-r)/e);return i-n*e},Wp=(r,e,t)=>{const i=[];for(let n=r;n<e;n+=t)i.push(n);return i},Vp=(r,e,t)=>{const i=o=>na(o,t,"yyyy-MM-dd"),n=r.length>0&&i(r[0])!==i(r[r.length-1]);return r.map(o=>we.formatChartTicksByGranularity({tickValue:new Date(o),granularity:e,dayBoundaryCrossed:n,timezone:t}))},Yp=(r,e)=>{const t=r.indexOf(e);return t===-1?r.push(e)-1:t},Xp=(r,e)=>r[e]?.name??e,jp=(r,{tz:e}={})=>{if(!r?.meta||!r.data)return;const{display:t,metric_names:i,start:n,end:o,granularity_ms:a}=r.meta,l=i?.[0],u=t&&Object.keys(t).find(x=>x!=="time");if(!l||!u||!n||!o){console.error("Cannot build heatmap chart data from this explore result. Missing metric, dimension or time range.");return}const c=a||J.Granularities.daily,d=J.msToGranularity(c)??"daily",h=e||Intl.DateTimeFormat().resolvedOptions().timeZone,f=r.data,m=$p(new Date(n).getTime(),c,f.map(({timestamp:x})=>new Date(x).getTime())),R=Wp(m,new Date(o).getTime(),c),E=[],C=[];for(const{timestamp:x,event:I}of f){const w=Math.floor((new Date(x).getTime()-m)/c),O=Dr(I[l]);w<0||w>=R.length||O===void 0||C.push([w,Yp(E,String(I[u])),O])}return{data:C,xAxisLabels:Vp(R,d,h),yAxisLabels:E.map(x=>Xp(t[u],x))}},Qp={class:"wrapper","data-testid":"heatmap-chart"},Zp=10,Jp=Ce(s.defineComponent({__name:"HeatmapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:n}=ae.useI18n(),o=ae.useMetricFormatter(),a=c=>{const d=jp(c,{tz:t.context.tz});if(d?.data.length)return{data:d.data,xAxisLabels:d.xAxisLabels,yAxisLabels:d.yAxisLabels,...o(c)}},l=new WeakMap,u=c=>(l.has(c)||l.set(c,a(c)),l.get(c));return(c,d)=>{const h=s.resolveComponent("KEmptyState");return s.openBlock(),s.createBlock(Be,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:d[0]||(d[0]=f=>i("chart-data",f)),onQueryComplete:d[1]||(d[1]=f=>i("query-complete"))},{default:s.withCtx(({data:f})=>[s.createElementVNode("div",Qp,[u(f)?(s.openBlock(),s.createBlock(s.unref(Gp),s.mergeProps({key:0,height:"100%","tooltip-title":r.chartOptions.chart_title??void 0,"visible-rows":Zp},u(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(n).t("renderer.noDataAvailable.title")),1)]),default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(n).t("renderer.noDataAvailable.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-3315f2cd"]]),kr=(r,e,{otherLabel:t})=>({name:e===we.OTHER_DIMENSION_ID&&t||(r?.[e]?.name??e)}),eg=(r,e,t,i)=>({...kr(e,t,i),itemStyle:{color:Cs({dimension:r,dimensionValue:t})}}),Nr=(r,e,t)=>{const i=r.get(e)??t();return r.set(e,i),i},ei=(r,e)=>!e.includes("time")&&(!r||J.isMetricSupported("treemap",r)),Ar=(r,e)=>{r.value=Number(r.value??0)+e},tg=(r,e,t,[i,n],o)=>{const a=new Map,l=(u,c)=>String(u[c]);for(const{event:u}of r){const c=Dr(u[e]);if(c===void 0)continue;const d=l(u,i),h=Nr(a,d,()=>({node:eg(i,t[i],d,o),children:new Map}));if(!n){Ar(h.node,c);continue}const f=l(u,n),m=Nr(h.children,f,()=>kr(t[n],f,o));Ar(m,c)}return a},ig=(r,e={})=>{if(!r?.meta||!r.data)return;const{display:t,metric_names:i}=r.meta,n=i?.[0],o=t?Object.keys(t):[];if(!n||!o.length){console.error("Cannot build treemap chart data from this explore result. Missing metric or dimension.");return}if(!ei(n,o)){console.error("Cannot build treemap chart data from this explore result. Needs an additive metric and no time dimension.");return}return[...tg(r.data,n,t,o,e).values()].map(({node:l,children:u})=>u.size?{...l,children:[...u.values()]}:l)},rg={class:"wrapper","data-testid":"treemap-chart"},ng=Ce(s.defineComponent({__name:"TreemapRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},emits:["chart-data","query-complete"],setup(r,{emit:e}){const t=r,i=e,{i18n:n}=ae.useI18n(),o=ae.useMetricFormatter(),a=s.computed(()=>ei(t.query.metrics?.[0],t.query.dimensions??[])),l=d=>{const h=ig(d,{otherLabel:n.t("chartLabels.____OTHER____")});if(h?.length)return{data:h,drillDown:h.some(f=>f.children?.length),...o(d)}},u=new WeakMap,c=d=>(u.has(d)||u.set(d,l(d)),u.get(d));return(d,h)=>{const f=s.resolveComponent("KEmptyState");return s.openBlock(),s.createBlock(Be,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:h[0]||(h[0]=m=>i("chart-data",m)),onQueryComplete:h[1]||(h[1]=m=>i("query-complete"))},{default:s.withCtx(({data:m})=>[s.createElementVNode("div",rg,[a.value?c(m)?(s.openBlock(),s.createBlock(s.unref(Fp),s.mergeProps({key:1,height:"100%","tooltip-title":r.chartOptions.chart_title??void 0},c(m)),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(n).t("renderer.noDataAvailable.title")),1)]),default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(n).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(n).t("renderer.treemapUnsupported.title")),1)]),default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(n).t("renderer.treemapUnsupported.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-d818a9ae"]]),sg=["data-testid"],og={key:0,class:"tile-header"},ag={class:"badge-container"},lg={class:"badge-text"},cg={class:"badge-text"},ug={key:0,class:"metric-selector-wrapper"},dg={key:1},hg=["data-testid"],fg=["data-testid"],mg=["data-testid"],pg={class:"delete-option"},gg=["data-testid"],Lr=Ce(s.defineComponent({__name:"DashboardTile",props:s.mergeModels({context:{},definition:{},fitToContent:{type:Boolean,default:!1},height:{default:()=>Ye},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(r,{expose:e,emit:t}){s.useCssVars(B=>({v8f0e7940:`${B.height}px`}));const i=parseInt(Pi,10),n=ae.useFieldLabel(),{zoomConfiguration:o}=ae.useDashboardContext({context:s.computed(()=>r.context),preview:s.computed(()=>r.preview)}),a=s.useModel(r,"refreshCounter"),l=()=>{O.value=!0,a.value++},u=t,c=s.defineAsyncComponent(()=>Promise.resolve().then(()=>Lg)),d=s.inject(Se),h=Te.useDatasourceConfigStore(),{datasourceConfigMap:f,stripUnknownFilters:m}=Xe(h),{i18n:R}=ae.useI18n(),E=s.ref(),C=s.ref({status:"loading"}),x=s.ref(!1),I=s.ref(),w=s.ref(!1),O=s.ref(!0),v=s.computed(()=>r.definition.chart),N=s.computed(()=>v.value.type==="single_value"),A=s.computed(()=>("chart_title"in v.value?v.value.chart_title:void 0)||(N.value?le.value:void 0)),p=s.computed(()=>r.definition.header_description),g=s.computed(()=>v.value.type==="slottable"),_=s.computed(()=>De(r.definition)||qt(r.definition)?!1:!("allow_csv_export"in v.value)||v.value.allow_csv_export!==!1),{exploreLinkKebabMenu:T,requestsLinkKebabMenu:S,canShowKebabMenu:L,canGenerateRequestsLink:K,canGenerateExploreLink:H,requestsLinkZoomActions:Y,exploreLinkZoomActions:P,buildExploreQuery:F,buildExploreLink:M,buildRequestLink:U,buildRequestsQueryZoomActions:b}=ae.useContextLinks({queryBridge:d,chartData:s.readonly(E),definition:s.toRef(()=>r.definition),context:s.readonly(s.toRef(()=>r.context))}),{issueQuery:k}=ae.useIssueQuery();s.watch(()=>r.definition,async(B,Z)=>{await s.nextTick(),I.value&&(w.value=I.value.scrollWidth>I.value.clientWidth);try{JSON.stringify(B?.query)!==JSON.stringify(Z?.query)&&(O.value=!0)}catch{}},{immediate:!0,deep:!0});const D=s.computed(()=>R.t("csvExport.defaultFilename")),j=s.computed(()=>!!T.value||_.value||!!r.context.editable),ee=s.computed(()=>!r.hideActions&&L.value&&j.value),ie=s.computed(()=>ee.value&&j.value&&!r.isFullscreen),ye={heatmap:Jp,treemap:ng,timeseries_line:dr,timeseries_bar:dr,scatter:ul,horizontal_bar:ur,vertical_bar:ur,gauge:cr,donut:oc,golden_signals:dl,top_n:ec,top_talkers:tc,table:sc,slottable:void 0,single_value:cr,choropleth_map:c},Q=s.computed(()=>({...W.value?.rendererEvents.supportsRequests?{"select-chart-range":Ug}:{},...W.value?.rendererEvents.supportsZoom?{"zoom-time-range":He}:{},...W.value?.rendererEvents.supportsBounds?{"bounds-change":wt}:{},...W.value?.rendererEvents.supportsLoadingChange?{"loading-change":ot}:{}})),W=s.computed(()=>{const B=ye[r.definition.chart.type],Z=De(r.definition),fe=!!B?.emits?.includes("select-chart-range"),Ge=!!B?.emits?.includes("zoom-time-range"),ze=r.definition.chart.type==="choropleth_map",Fe=!!B?.emits?.includes("loading-change"),ri={query:r.definition.query,context:r.context,queryReady:r.queryReady,height:r.height-i*2,refreshCounter:a.value,zoomConfiguration:o.value},ni={chartOptions:r.definition.chart,activeMetric:X.value,headerDescription:p.value,requestsLink:o.value.showRequestsAction?Y.value:void 0,exploreLink:o.value.showExploreAction?P.value:void 0};return B&&{component:B,rendererProps:{...ri,...Z?{}:ni,...["top_n","single_value"].includes(r.definition.chart.type)?{fitToContent:r.fitToContent}:{}},rendererEvents:{supportsRequests:fe,supportsZoom:Ge,supportsBounds:ze,supportsLoadingChange:Fe}}}),oe=s.computed(()=>{if(De(r.definition))return null;const B=r.definition.query,Z=B?.time_range;if(J.isPlatformDatasource(B?.datasource)&&!B.dimensions?.includes("time"))return R.t("renderer.as_of_today");if(Z?.type==="relative"){const fe=J.TimePeriods.get(J.TIMEFRAME_LOOKUP[Z.time_range]);return fe?fe.display:(console.warn("Did not recognize the given relative time range:",Z.time_range),Z.time_range)}else if(Z?.type==="absolute"){const fe=Z.tz||"Etc/UTC";return`${J.formatTime(Z.start,{short:!0,tz:fe})} - ${J.formatTime(Z.end,{short:!0,tz:fe})}`}return null}),G=s.computed(()=>{const B=r.definition.query,Z=B?.datasource,fe=Z?f.value[Z]?.timeRangeOptions:void 0,ze=(B&&"time_range"in B?B.time_range:void 0)??r.context.timeSpec;return Ft(ze,fe)}),ce=s.computed(()=>g.value?!1:[!!A.value,ie.value,!!oe.value,G.value,!!p.value,r.showRefresh,$.value].some(Boolean)),ue=s.computed(()=>E.value?J.msToGranularity(E.value.meta.granularity_ms):void 0),ne=s.computed(()=>["timeseries_line","timeseries_bar"].includes(v.value.type)),te=s.computed(()=>E.value?.meta.metric_names??[]),X=s.ref();s.watch(te,B=>{(!X.value||!B.includes(X.value))&&(X.value=B[0])},{immediate:!0});const Re=s.computed(()=>{const B=v.value;return B.type!=="timeseries_line"?!1:te.value.some(Z=>B.metric_axis_map?.[Z]==="right")}),$=s.computed(()=>ne.value&&!Re.value&&(E.value?.data.length??0)>0&&te.value.length>1&&Object.keys(E.value?.meta.display??{}).length>0),le=s.computed(()=>{const Z=("metrics"in r.definition.query?r.definition.query.metrics?.[0]:void 0)??te.value[0];if(Z)return n(Z)}),Ae=s.computed(()=>te.value.map(B=>({value:B,label:n(B)}))),Le=s.computed(()=>{if(!Ht(r.definition)||!ne.value||!r.queryReady||O.value)return!1;const B=r.definition.query.granularity;return!B||!ue.value?!1:B!==ue.value}),Ee=s.computed(()=>{const B=J.msToGranularity(E.value?.meta.granularity_ms??0)??"unknown",Z=Ht(r.definition)?r.definition.query.granularity??"unknown":"unknown";return R.t("query_aged_out_warning",{currentGranularity:R.t(`granularities.${B}`),savedGranularity:R.t(`granularities.${Z}`)})}),qe=s.computed(()=>{const B=[...r.context.filters,...r.definition.query.filters??[]],Z="metrics"in r.definition.query?r.definition.query.metrics:void 0,fe=r.definition.query.datasource??"api_usage";return m.value({datasource:fe,filters:B,queryFields:Z})}),he=()=>{u("edit-tile",r.definition)},Oe=()=>{u("duplicate-tile",r.definition)},de=()=>{u("remove-tile",r.definition)},me=B=>{E.value=B,O.value=!1,u("chart-data",B),u("tile-loaded")},Ie=()=>{O.value=!1,u("tile-loaded")},ot=B=>{O.value=B,B||u("tile-loaded")},bt=()=>{x.value=!1},Ue=()=>{if(qt(r.definition))throw new Error("Cannot export data for a tile backed by the api-requests endpoint");const B=r.definition.query.datasource?.startsWith("goap");return d?.staticConfig?.increaseCsvExportLimit!==!1&&!B?k(r.definition.query,r.context,J.EXPORT_RECORD_LIMIT):E.value?Promise.resolve(E.value):new Promise(fe=>{const Ge=s.watch(E,ze=>{ze&&(fe(ze),Ge())})})},be=async()=>{x.value=!0,C.value={status:"loading"};try{const B=await Ue();C.value={status:"success",chartData:B}}catch(B){C.value={status:"error",error:B}}},He=B=>{const Z={tileId:r.tileId.toString(),timeRange:B};u("tile-time-range-zoom",Z)},wt=B=>{const Z={tileId:r.tileId.toString(),bounds:B};u("tile-bounds-change",Z)},Ug=B=>{const Z=qe.value,fe=F(B,Z);P.value=H.value?{href:M(fe)}:void 0,Y.value=K.value?{href:U(b(B,Z))}:void 0};return e({getExportData:Ue}),(B,Z)=>{const fe=s.resolveComponent("KTooltip"),Ge=s.resolveComponent("KBadge"),ze=s.resolveComponent("KButton"),Fe=s.resolveComponent("KDropdownItem"),ri=s.resolveComponent("KDropdown");return s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["tile-boundary",{editable:r.context.editable,headless:!ce.value,"compact-single_value":N.value&&r.fitToContent}]),"data-testid":`tile-${r.tileId}`},[ce.value&&!g.value?(s.openBlock(),s.createElementBlock("div",og,[s.createVNode(fe,{class:"title-tooltip",disabled:!w.value,"max-width":"500",text:A.value},{default:s.withCtx(()=>[s.createElementVNode("div",{ref_key:"titleRef",ref:I,class:"title"},s.toDisplayString(A.value),513)]),_:1},8,["disabled","text"]),s.createElementVNode("div",ag,[G.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(re.WarningIcon),{size:`var(--kui-icon-size-20, ${s.unref(Mi)})`},null,8,["size"])]),default:s.withCtx(()=>[s.createElementVNode("span",lg,s.toDisplayString(s.unref(R).t("unsupported_time_range_badge")),1)]),_:1},8,["tooltip"])):s.createCommentVNode("",!0),oe.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",cg,s.toDisplayString(oe.value),1)]),_:2},[Le.value?{name:"icon",fn:s.withCtx(()=>[s.createVNode(s.unref(re.WarningIcon),{size:`var(--kui-icon-size-20, ${s.unref(Mi)})`},null,8,["size"])]),key:"0"}:void 0]),1032,["tooltip"])):s.createCommentVNode("",!0)]),$.value?(s.openBlock(),s.createElementBlock("div",ug,[s.createVNode(s.unref(qr.KSegmentedControl),{modelValue:X.value,"onUpdate:modelValue":Z[0]||(Z[0]=ni=>X.value=ni),class:"metric-selector","data-testid":"metric-selector",options:Ae.value},null,8,["modelValue","options"])])):s.createCommentVNode("",!0),r.showRefresh?(s.openBlock(),s.createElementBlock("div",dg,[s.createVNode(ze,{appearance:"secondary",class:"refresh-button","data-testid":`tile-refresh-button-${r.tileId}`,disabled:O.value,icon:"",size:"small",onClick:l},{default:s.withCtx(()=>[O.value?(s.openBlock(),s.createBlock(s.unref(re.ProgressIcon),{key:0,role:"button",size:`var(--kui-icon-size-60, ${s.unref(zi)})`,tabindex:"0"},null,8,["size"])):(s.openBlock(),s.createBlock(s.unref(re.RefreshIcon),{key:1,role:"button",size:`var(--kui-icon-size-60, ${s.unref(zi)})`,tabindex:"0"},null,8,["size"]))]),_:1},8,["data-testid","disabled"])])):s.createCommentVNode("",!0),p.value?(s.openBlock(),s.createElementBlock("div",{key:2,class:"header-description","data-testid":`tile-description-${r.tileId}`},s.toDisplayString(p.value),9,hg)):s.createCommentVNode("",!0),ee.value?(s.openBlock(),s.createElementBlock("div",{key:3,class:"tile-actions","data-testid":`tile-actions-${r.tileId}`},[ee.value&&r.context.editable&&!r.isFullscreen?(s.openBlock(),s.createBlock(s.unref(re.EditIcon),{key:0,class:"edit-icon",color:`var(--kui-color-text-neutral, ${s.unref(Mt)})`,"data-testid":`edit-tile-${r.tileId}`,size:`var(--kui-icon-size-40, ${s.unref(Bi)})`,onClick:he},null,8,["color","data-testid","size"])):s.createCommentVNode("",!0),ee.value&&j.value&&!r.isFullscreen?(s.openBlock(),s.createBlock(ri,{key:1,class:"dropdown","data-testid":`chart-action-menu-${r.tileId}`,"kpop-attributes":{placement:"bottom-end"}},{items:s.withCtx(()=>[s.unref(T)?(s.openBlock(),s.createBlock(Fe,{key:0,"data-testid":`chart-jump-to-explore-${r.tileId}`,item:{label:s.unref(R).t("jumpToExplore"),to:s.unref(T)}},null,8,["data-testid","item"])):s.createCommentVNode("",!0),!s.unref(De)(r.definition)&&s.unref(S)?(s.openBlock(),s.createBlock(Fe,{key:1,"data-testid":`chart-jump-to-requests-${r.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(Fe,{key:2,class:"chart-export-button","data-testid":`chart-csv-export-${r.tileId}`,onClick:be},{default:s.withCtx(()=>[s.createElementVNode("span",{class:"chart-export-trigger","data-testid":`csv-export-button-${r.tileId}`},s.toDisplayString(s.unref(R).t("csvExport.exportAsCsv")),9,mg)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0),r.context.editable?(s.openBlock(),s.createBlock(Fe,{key:3,"data-testid":`duplicate-tile-${r.tileId}`,onClick:Oe},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(R).t("renderer.duplicateTile")),1)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0),r.context.editable?(s.openBlock(),s.createBlock(Fe,{key:4,"data-testid":`remove-tile-${r.tileId}`,onClick:de},{default:s.withCtx(()=>[s.createElementVNode("span",pg,s.toDisplayString(s.unref(R).t("renderer.delete")),1)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0)]),default:s.withCtx(()=>[s.createVNode(s.unref(re.MoreIcon),{class:"kebab-action-menu",color:`var(--kui-color-text-neutral, ${s.unref(Mt)})`,"data-testid":`kebab-action-menu-${r.tileId}`,size:`var(--kui-icon-size-40, ${s.unref(Bi)})`},null,8,["color","data-testid","size"])]),_:1},8,["data-testid"])):s.createCommentVNode("",!0)],8,fg)):s.createCommentVNode("",!0),x.value?(s.openBlock(),s.createBlock(or,{key:4,"data-testid":`csv-export-modal-${r.tileId}`,"export-state":C.value,filename:D.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-${r.tileType}-${v.value.type}`]),"data-testid":`tile-content-${r.tileId}`},[W.value?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(W.value.component),s.mergeProps({key:0},W.value.rendererProps,s.toHandlers(Q.value),{onChartData:me,onQueryComplete:Ie}),null,16)):s.createCommentVNode("",!0)],10,gg)],10,sg)}}}),[["__scopeId","data-v-99bed0a5"]]),_g=(r,e)=>{let t=0;const i=new Map;e.forEach(o=>{const a=o.layout.position.row,l=i.get(a),u=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,u):i.set(a,l&&u)});const n=[];for(let o=0;o<t;o++)i.get(o)?n.push("auto"):n.push(`${r}px`);return n},Ur=Ce(s.defineComponent({__name:"GridLayout",props:{tileHeight:{type:Number,required:!1,default:()=>Ye},columns:{type:Number,required:!1,default:()=>pt},tiles:{type:Array,required:!0}},setup(r){s.useCssVars(u=>({v6834ae83:e.columns,v9c95201e:a.value}));const e=r,t=s.ref(null),i=s.ref(0),n=new ResizeObserver(u=>{window.requestAnimationFrame(()=>{!Array.isArray(u)||!u.length||(i.value=u[0].contentRect.width)})});s.onMounted(()=>{t.value&&n.observe(t.value)}),s.onUnmounted(()=>{t.value&&n.unobserve(t.value)});const o=s.computed(()=>_g(e.tileHeight,e.tiles)),a=s.computed(()=>o.value.join(" ")),l=s.computed(()=>e.tiles.map((u,c)=>({key:`tile-${c}`,tile:u,style:{"grid-column-start":u.layout.position.col+1,"grid-column-end":u.layout.position.col+1+u.layout.size.cols,"grid-row-start":u.layout.position.row+1,"grid-row-end":u.layout.position.row+1+u.layout.size.rows}})));return(u,c)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"gridContainer",ref:t,class:"kong-ui-public-grid-layout"},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(l.value,d=>(s.openBlock(),s.createElementBlock("div",{key:d.key,class:s.normalizeClass(["grid-cell",{"empty-cell":!d.tile}]),style:s.normalizeStyle(d.style)},[s.renderSlot(u.$slots,"tile",{fitToContent:o.value[d.tile.layout.position.row]==="auto",style:s.normalizeStyle(d.style),tile:d.tile},void 0,!0)],6))),128))],512))}}),[["__scopeId","data-v-aa4f1c68"]]);function yg(r,e,t,i,n){const o=(...a)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+n+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),e.apply(r,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 n=t.querySelectorAll(e);return!n.length&&e[0]!=="."&&e[0]!=="#"&&(n=t.querySelectorAll("."+e),n.length||(n=t.querySelectorAll("#"+e))),Array.from(n)}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 n=t.querySelector(e);return i&&!n&&(n=i.getElementById(e)),n||(n=t.querySelector("."+e)),n}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(n=>{n&&i.classList.add(n)}),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,n=e.x+e.w<t.x+t.w?e.x+e.w:t.x+t.w;if(n<=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:(n-i)*(a-o)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((n,o)=>{const a=t*((n.y??1e4)-(o.y??1e4));return a===0?t*((n.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 n=document.createElement("style"),o=i?.nonce;return o&&(n.nonce=o),n.setAttribute("type","text/css"),n.setAttribute("gs-style-id",e),n.styleSheet?n.styleSheet.cssText="":n.appendChild(document.createTextNode("")),t?t.insertBefore(n,t.firstChild):(t=document.getElementsByTagName("head")[0],t.appendChild(n)),n}static removeStylesheet(e,t){const n=(t||document).querySelector("STYLE[gs-style-id="+e+"]");n&&n.parentNode&&n.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 n=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!n)throw new Error(`Invalid height val = ${e}`);i=n[2]||"px",t=parseFloat(n[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(const n in i){if(!i.hasOwnProperty(n))return;e[n]===null||e[n]===void 0?e[n]=i[n]:typeof i[n]=="object"&&typeof e[n]=="object"&&this.defaults(e[n],i[n])}}),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 n=e[i],o=t[i];i[0]==="_"||n===o?delete e[i]:n&&typeof n=="object"&&o!==void 0&&(y.removeInternalAndSame(n,o),Object.keys(n).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(...n)=>{i||(i=!0,setTimeout(()=>{e(...n),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 n=e.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight;if(n.top<0||n.bottom>o){const a=n.bottom-o,l=n.top,u=this.getScrollElement(e);if(u!==null){const c=u.scrollTop;n.top<0&&i<0?e.offsetHeight>o?u.scrollTop+=i:u.scrollTop+=Math.abs(l)>Math.abs(i)?i:l:i>0&&(e.offsetHeight>o?u.scrollTop+=i:u.scrollTop+=a>i?i:a),t.top+=u.scrollTop-c}}}static updateScrollResize(e,t,i){const n=this.getScrollElement(t),o=n.clientHeight,a=n===this.getScrollElement()?0:n.getBoundingClientRect().top,l=e.clientY-a,u=l<i,c=l>o-i;u?n.scrollBy({behavior:"smooth",top:l-i}):c&&n.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 n in i)i.hasOwnProperty(n)&&typeof i[n]=="object"&&n.substring(0,2)!=="__"&&!t.find(o=>o===n)&&(i[n]=y.cloneDeep(e[n]));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(n=>{e.style[i]=n}):e.style[i]=t[i])}static initEvent(e,t){const i={type:t.type},n={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,...n}}static simulateMouseEvent(e,t,i){const n=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:n.ctrlKey??!1,altKey:n.altKey??!1,shiftKey:n.shiftKey??!1,metaKey:n.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 n=e[t];e[t]=e[i],e[i]=n}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,n={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!n.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,n.skip));let a=!1;const l={nested:!0,pack:!1};let u=0;for(;i=i||this.collide(e,o,n.skip);){if(u++>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 d={...t,y:i.y+i.h,...l};c=this._loading&&y.samePos(e,d)?!0:this.moveNode(e,d),(i.locked||this._loading)&&c?y.copyPos(t,e):!i.locked&&c&&n.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 n=e._id,o=i?._id;return this.nodes.find(a=>a._id!==n&&a._id!==o&&y.isIntercepted(a,t))}collideAll(e,t=e,i){const n=e._id,o=i?._id;return this.nodes.filter(a=>a._id!==n&&a._id!==o&&y.isIntercepted(a,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const n=e._rect,o={...t.rect};o.y>n.y?(o.h+=o.y-n.y,o.y=n.y):o.h+=n.y-o.y,o.x>n.x?(o.w+=o.x-n.x,o.x=n.x):o.w+=n.x-o.x;let a,l=.5;for(let u of i){if(u.locked||!u._rect)break;const c=u._rect;let d=Number.MAX_VALUE,h=Number.MAX_VALUE;n.y<c.y?d=(o.y+o.h-c.y)/c.h:n.y+n.h>c.y+c.h&&(d=(c.y+c.h-o.y)/c.h),n.x<c.x?h=(o.x+o.w-c.x)/c.w:n.x+n.w>c.x+c.w&&(h=(c.x+c.w-o.x)/c.w);const f=Math.min(h,d);f>l&&(l=f,a=u)}return t.collide=a,a}cacheRects(e,t,i,n,o,a){return this.nodes.forEach(l=>l._rect={y:l.y*t+i,x:l.x*e+a,w:l.w*e-a-n,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 n;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(n=y.isTouching(e,t)))return i();if(n!==!1){if(e.w===t.w&&e.x===t.x&&(n||(n=y.isTouching(e,t)))){if(t.y<e.y){const o=e;e=t,t=o}return i()}if(n!==!1){if(e.h===t.h&&e.y===t.y&&(n||(n=y.isTouching(e,t)))){if(t.x<e.x){const o=e;e=t,t=o}return i()}return!1}}}isAreaEmpty(e,t,i,n){const o={x:e||0,y:t||0,w:i||1,h:n||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 n=this._inColumnResize;n||(this._inColumnResize=!0);const o=this.nodes;return this.nodes=[],o.forEach((a,l,u)=>{let c;a.locked||(a.autoPosition=!0,e==="list"&&l&&(c=u[l-1])),this.addNode(a,!1,c)}),n||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 n={x:0,y:0,w:1,h:1};return y.defaults(e,n),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=n.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=n.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=n.w),isNaN(e.h)&&(e.h=n.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,n){const o=n?n.y*i+(n.x+n.w):0;let a=!1;for(let l=o;!a;++l){const u=l%i,c=Math.floor(l/i);if(u+e.w>i)continue;const d={x:u,y:c,w:e.w,h:e.h};t.find(h=>y.isIntercepted(d,h))||((e.x!==u||e.y!==c)&&(e._dirty=!0),e.x=u,e.y=c,delete e.autoPosition,a=!0)}return a}addNode(e,t=!1,i){const n=this.nodes.find(a=>a._id===e._id);if(n)return n;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(n=>n._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(n=>n._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(n=>n._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 n=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=n.moveNode(i,t)&&n.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?(n.nodes.filter(a=>a._dirty).forEach(a=>{const l=this.nodes.find(u=>u._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(n=>({...n}))}),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 n=e.w!==t.w||e.h!==t.h,o=y.copyPos({},e,!0);if(y.copyPos(o,t),this.nodeBoundFix(o,n),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 u=!0;if(l.length){const c=e._moving&&!t.nested;let d=c?this.directionCollideCoverage(e,t,l):l[0];if(c&&d&&e.grid?.opts?.subGridDynamic&&!e.grid._isTemp){const h=y.areaIntercept(t.rect,d._rect),f=y.area(t.rect),m=y.area(d._rect);h/(f<m?f:m)>.8&&(d.grid.makeSubGrid(d.el,void 0,e),d=void 0)}d?u=!this._fixCollisions(e,o,d,t):(u=!1,i&&delete t.pack)}return u&&!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,n=i&&this.column!==i-1?this._layouts[i-1]:null,o=[];return this.sortNodes(),this.nodes.forEach(a=>{const l=n?.find(c=>c._id===a._id),u={...a,...l||{}};y.removeInternalForSave(u,!e),t&&t(a,u),o.push(u)}),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 n=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*n)),o.w!==o._orig.w&&(a.w=Math.round(o.w*n)))})}}),this)}columnChanged(e,t,i="moveScale"){if(!this.nodes.length||!t||e===t)return this;const n=i==="compact"||i==="list";n&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let o=[],a=n?this.nodes:y.sort(this.nodes,-1);if(t>e&&this._layouts){const l=this._layouts[t]||[],u=this._layouts.length-1;!l.length&&e!==u&&this._layouts[u]?.length&&(e=u,this._layouts[u].forEach(c=>{const d=a.find(h=>h._id===c._id);d&&(!n&&!c.autoPosition&&(d.x=c.x??d.x,d.y=c.y??d.y),d.w=c.w??d.w,(c.x==null||c.y===void 0)&&(d.autoPosition=!0))})),l.forEach(c=>{const d=a.findIndex(h=>h._id===c._id);if(d!==-1){const h=a[d];if(n){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(d,1)}})}if(n)this.compact(i,!1);else{if(a.length)if(typeof i=="function")i(t,e,o,a);else{const l=n||i==="none"?1:t/e,u=i==="move"||i==="moveScale",c=i==="scale"||i==="moveScale";a.forEach(d=>{d.x=t===1?0:u?Math.round(d.x*l):Math.min(d.x,t-1),d.w=t===1||e===1?1:c?Math.round(d.w*l)||1:Math.min(d.w,t),o.push(d)}),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,!n),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const n=[];return e.forEach((o,a)=>{if(o._id===void 0){const l=o.id?this.nodes.find(u=>u.id===o.id):void 0;o._id=l?._id??ke._idSeq++}n[a]={x:o.x,y:o.y,w:o.w,_id:o._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=n,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 n=this.findCacheLayout(e,t);return n===-1?this._layouts[t].push(i):this._layouts[t][n]=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 _e={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 q{}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(r,e){r.touches.length>1||(r.cancelable&&r.preventDefault(),y.simulateMouseEvent(r.changedTouches[0],e))}function Kr(r,e){r.cancelable&&r.preventDefault(),y.simulateMouseEvent(r,e)}function yt(r){Ne.touchHandled||(Ne.touchHandled=!0,_t(r,"mousedown"))}function Rt(r){Ne.touchHandled&&_t(r,"mousemove")}function Ct(r){if(!Ne.touchHandled)return;Ne.pointerLeaveTimeout&&(window.clearTimeout(Ne.pointerLeaveTimeout),delete Ne.pointerLeaveTimeout);const e=!!q.dragElement;_t(r,"mouseup"),e||_t(r,"click"),Ne.touchHandled=!1}function Et(r){r.pointerType!=="mouse"&&r.target.releasePointerCapture(r.pointerId)}function Mr(r){q.dragElement&&r.pointerType!=="mouse"&&Kr(r,"mouseenter")}function Br(r){q.dragElement&&r.pointerType!=="mouse"&&(Ne.pointerLeaveTimeout=window.setTimeout(()=>{delete Ne.pointerLeaveTimeout,Kr(r,"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 ti{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 nt extends ti{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const n=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-n.left)*this.rectScale.x,top:(a.top-n.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(n=>this.option[n]=e[n]),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),q.overResizeElement===this&&delete q.overResizeElement),this}_mouseOver(e){q.overResizeElement||q.dragElement||(q.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){q.overResizeElement===this&&(delete q.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=nt._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 nt._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,n={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,u;t.indexOf("e")>-1?n.width+=o:t.indexOf("w")>-1&&(n.width-=o,n.left+=o,l=!0),t.indexOf("s")>-1?n.height+=a:t.indexOf("n")>-1&&(n.height-=a,n.top+=a,u=!0);const c=this._constrainSize(n.width,n.height,l,u);return Math.round(n.width)!==Math.round(c.width)&&(t.indexOf("w")>-1&&(n.left+=n.width-c.width),n.width=c.width),Math.round(n.height)!==Math.round(c.height)&&(t.indexOf("n")>-1&&(n.top+=n.height-c.height),n.height=c.height),n}_constrainSize(e,t,i,n){const o=this.option,a=(i?o.maxWidthMoveLeft:o.maxWidth)||Number.MAX_SAFE_INTEGER,l=o.minWidth/this.rectScale.x||e,u=(n?o.maxHeightMoveUp:o.maxHeight)||Number.MAX_SAFE_INTEGER,c=o.minHeight/this.rectScale.y||t,d=Math.min(a,Math.max(l,e)),h=Math.min(u,Math.max(c,t));return{width:d,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:n}=t.getBoundingClientRect();e={left:i,top:n,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const i=this.temporalRect[t],n=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*n+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}nt._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const Rg='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class st extends ti{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),n=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:n?.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(!q.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(Rg)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete q.dragElement,delete q.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(),q.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),q.pauseDrag){const i=Number.isInteger(q.pauseDrag)?q.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,q.dragElement=this;const i=this.el.gridstackNode?.grid;i?q.dropElement=i.el.ddElement.ddDroppable:delete q.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 n=y.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(n,this.ui()),this.triggerEvent("dragstart",n),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),q.dropElement?.el===this.el.parentElement&&delete q.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),q.dropElement&&q.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete q.dragElement,delete q.dropElement,delete q.mouseHandled,e.preventDefault()}_keyEvent(e){const t=this.el.gridstackNode,i=t?.grid||q.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=st.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",st.originStyleProp.forEach(n=>t.style[n]=this.dragElementOriginStyle[n]||null),setTimeout(()=>t.style.transition=i,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const t={left:0,top:0},i=this.helper.style,n=this.dragOffset;i.left=(e.clientX+n.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+n.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 n=0,o=0;i&&(n=this.dragTransform.xOffset,o=this.dragTransform.yOffset);const a=t.getBoundingClientRect();return{left:a.left,top:a.top,offsetLeft:-e.clientX+a.left-n,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}}}}st.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class Cg extends ti{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",Mr),this.el.addEventListener("pointerleave",Br)))}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",Mr),this.el.removeEventListener("pointerleave",Br)))}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(!q.dragElement||!this._canDrop(q.dragElement.el))return;e.preventDefault(),e.stopPropagation(),q.dropElement&&q.dropElement!==this&&q.dropElement._mouseLeave(e,!0),q.dropElement=this;const t=y.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(q.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){if(!q.dragElement||q.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(q.dragElement)),this.triggerEvent("dropout",i),q.dropElement===this&&(delete q.dropElement,!t)){let n,o=this.el.parentElement;for(;!n&&o;)n=o.ddElement?.ddDroppable,o=o.parentElement;n&&n._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(q.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 ii{static init(e){return e.ddElement||(e.ddElement=new ii(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 st(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 nt(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 Cg(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class Eg{resizable(e,t,i,n){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]:n});else{const l=o.el.gridstackNode.grid;let u=o.el.getAttribute("gs-resize-handles")||l.opts.resizable.handles||"e,s,se";u==="all"&&(u="n,e,s,w,se,sw,ne,nw");const c=!l.opts.alwaysShowResizeHandle;o.setupResizable({...l.opts.resizable,handles:u,autoHide:c,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,n){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]:n});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,n){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]:n}):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(n=>n.on(t,o=>{i(o,q.dragElement?q.dragElement.el:o.target,q.dragElement?q.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",n=y.getElements(e);return n.length?n.map(a=>a.ddElement||(i?ii.init(a):null)).filter(a=>a):[]}}const ge=new Eg;class z{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=z.getGridElement(t);return i?(i.gridstack||(i.gridstack=new z(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
- 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"||(z.getGridElements(t).forEach(n=>{n.gridstack||(n.gridstack=new z(n,y.cloneDeep(e))),i.push(n.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")||z.addRemoveCB)&&(z.addRemoveCB?i=z.addRemoveCB(e,t,!0,!0):i=y.createDiv(["grid-stack",t.class],e)),z.init(t,i)}static registerEngine(e){z.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=y.createDiv([this.opts.placeholderClass,_e.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 n=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||{},n=t.columnOpts.breakpoints=t.columnOpts.breakpoints||[];let f=n.find(m=>m.c===1);f?f.w=h:(f={c:1,w:h},n.push(f,{c:12,w:h+1}))}const a=t.columnOpts;a&&(!a.columnWidth&&!a.breakpoints?.length?(delete t.columnOpts,n=void 0):a.columnMax=a.columnMax||12),n?.length>1&&n.sort((h,f)=>(f.w||0)-(h.w||0));const l={...y.cloneDeep(_e),column:y.toNumber(e.getAttribute("gs-column"))||_e.column,minRow:i||y.toNumber(e.getAttribute("gs-min-row"))||_e.minRow,maxRow:i||y.toNumber(e.getAttribute("gs-max-row"))||_e.maxRow,staticGrid:y.toBool(e.getAttribute("gs-static"))||_e.staticGrid,sizeToContent:y.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||_e.draggable.handle},removableOptions:{accept:t.itemClass||_e.removableOptions.accept,decline:_e.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("."+_e.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!==_e.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 d=t.engineClass||z.engineClass||ke;if(this.engine=new d({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:h=>{let f=0;this.engine.nodes.forEach(m=>{f=Math.max(f,m.y+m.h)}),h.forEach(m=>{const R=m.el;R&&(m._removeDOM?(R&&R.remove(),delete m._removeDOM):this._writePosAttr(R,m))}),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&&!q.pauseDrag&&(q.pauseDrag=!0),t.draggable?.pause!==void 0&&(q.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:z.addRemoveCB?t=z.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 n=this._readAttr(t);return y.defaults(e,n),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(([n])=>{n.isIntersecting&&(e.visibleObservable?.disconnect(),delete e.visibleObservable,z.renderCB(i,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(t))):z.renderCB(i,e),t}makeSubGrid(e,t,i,n=!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 u;t.column==="auto"&&(u=!0,t.column=Math.max(o.w||1,i?.w||1),delete t.columnOpts);let c=o.el.querySelector(".grid-stack-item-content"),d,h;if(n&&(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),z.addRemoveCB?d=z.addRemoveCB(this.el,h,!0,!1):(d=y.createDiv(["grid-stack-item"]),d.appendChild(c),c=y.createDiv(["grid-stack-item-content"],o.el)),this.prepareDragDrop(o.el)),i){const m=u?t.column:o.w,R=o.h+i.h,E=o.el.style;E.transition="none",this.update(o.el,{w:m,h:R}),setTimeout(()=>E.transition=null)}const f=o.subGrid=z.addGrid(c,t);return i?._moving&&(f._isTemp=!0),u&&(f._autoColumn=!0),n&&f.makeWidget(d,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=z.saveCB){const n=this.engine.save(e,i);if(n.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,_e),o.children=n,o}return n}load(e,t=z.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 n=0;e.forEach(c=>{n=Math.max(n,(c.x||0)+c.w)}),n>this.engine.defaultColumn&&(this.engine.defaultColumn=n),n>i&&this.engine.cacheLayout(e,n,!0);const o=z.addRemoveCB;typeof t=="function"&&(z.addRemoveCB=t);const a=[];this.batchUpdate();const l=!this.engine.nodes.length;l&&this.setAnimation(!1),!l&&t&&[...this.engine.nodes].forEach(d=>{if(!d.id)return;y.find(e,d.id)||(z.addRemoveCB&&z.addRemoveCB(this.el,d,!1,!1),a.push(d),this.removeWidget(d.el,!0,!1))}),this.engine._loading=!0;const u=[];return this.engine.nodes=this.engine.nodes.filter(c=>y.find(e,c.id)?(u.push(c),!1):!0),e.forEach(c=>{const d=y.find(u,c.id);if(d){if(y.shouldSizeToContent(d)&&(c.h=d.h),this.engine.nodeBoundFix(c),(c.autoPosition||c.x===void 0||c.y===void 0)&&(c.w=c.w||d.w,c.h=c.h||d.h,this.engine.findEmptyPosition(c)),this.engine.nodes.push(d),y.samePos(d,c)&&this.engine.nodes.length>1&&(this.moveNode(d,{...c,forceCollide:!0}),y.copyPos(c,d)),this.update(d.el,c),c.subGridOpts?.children){const h=d.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?z.addRemoveCB=o:delete z.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 n=y.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/n)}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 n=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+n}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 n=this._widthOrContainer(!0);if(e.columnWidth)i=Math.min(Math.round(n/e.columnWidth)||1,e.columnMax);else{i=e.columnMax;let o=0;for(;o<e.breakpoints.length&&n<=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 n;t?n={top:i.top+document.documentElement.scrollTop,left:i.left}:n={top:this.el.offsetTop,left:this.el.offsetLeft};const o=e.left-n.left,a=e.top-n.top,l=i.width/this.getColumn(),u=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(o/l),y:Math.floor(a/u)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(e,t,i,n){return this.engine.isAreaEmpty(e,t,i,n)}makeWidget(e,t){const i=z.getElement(e);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const n=i.gridstackNode;this._updateContainerHeight(),n.subGridOpts&&this.makeSubGrid(i,n.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(n=>this.on(n,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=n=>t(n):this._gsEventHandler[e]=n=>{n.detail&&t(n,n.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?(z.getElements(e).forEach(n=>{if(n.parentElement&&n.parentElement!==this.el)return;let o=n.gridstackNode;o||(o=this.engine.nodes.find(a=>n===a.el)),o&&(t&&z.addRemoveCB&&z.addRemoveCB(this.el,o,!1,!1),delete n.gridstackNode,this._removeDD(n),this.engine.removeNode(o,t,i),t&&n.parentElement&&n.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&&z.addRemoveCB&&z.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(n=>{this.prepareDragDrop(n.el),n.subGrid&&i&&n.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 z.getElements(e).forEach(i=>{const n=i?.gridstackNode;if(!n)return;const o={...y.copyPos({},n),...y.cloneDeep(t)};this.engine.nodeBoundFix(o),delete o.autoPosition;const a=["x","y","w","h"];let l;if(a.some(d=>o[d]!==void 0&&o[d]!==n[d])&&(l={},a.forEach(d=>{l[d]=o[d]!==void 0?o[d]:n[d],delete o[d]})),!l&&(o.minW||o.minH||o.maxW||o.maxH)&&(l={}),o.content!==void 0){const d=i.querySelector(".grid-stack-item-content");d&&d.textContent!==o.content&&(n.content=o.content,z.renderCB(d,o),n.subGrid?.el&&(d.appendChild(n.subGrid.el),n.subGrid.opts.styleInHead||n.subGrid._updateStyles(!0))),delete o.content}let u=!1,c=!1;for(const d in o)d[0]!=="_"&&n[d]!==o[d]&&(n[d]=o[d],u=!0,c=c||!this.opts.staticGrid&&(d==="noResize"||d==="noMove"||d==="locked"));if(y.sanitizeMinMax(n),l){const d=l.w!==void 0&&l.w!==n.w;this.moveNode(n,l),d&&n.subGrid?n.subGrid.onResize(this.hasAnimationCSS()?n.w:void 0):this.resizeToContentCheck(d,n),delete n._orig}(l||u)&&this._writeAttr(i,n),c&&this.prepareDragDrop(n.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 n=i.getCellHeight(!0);if(!n)return;let o=t.h?t.h*n:e.clientHeight,a;if(t.resizeToContentParent&&(a=e.querySelector(t.resizeToContentParent)),a||(a=e.querySelector(z.resizeToContentParent)),!a)return;const l=e.clientHeight-a.clientHeight,u=t.h?t.h*n-l:a.clientHeight;let c;if(t.subGrid){c=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const f=t.subGrid.el.getBoundingClientRect(),m=t.subGrid.el.parentElement.getBoundingClientRect();c+=f.top-m.top}else{if(t.subGridOpts?.children?.length)return;{const f=a.firstElementChild;if(!f){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${z.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=f.getBoundingClientRect().height||u}}if(u===c)return;o+=c-u;let d=Math.ceil(o/n);const h=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;h&&d>h&&(d=h,e.classList.add("size-to-content-max")),t.minH&&d<t.minH?d=t.minH:t.maxH&&d>t.maxH&&(d=t.maxH),d!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h:d}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){z.resizeToContentCB?z.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return z.getElements(e).forEach(i=>{const n=i.gridstackNode;if(!y.canBeRotated(n))return;const o={w:n.h,h:n.w,minH:n.minW,minW:n.minH,maxH:n.maxW,maxW:n.maxH};if(t){const l=t.left>0?Math.floor(t.left/this.cellWidth()):0,u=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;o.x=n.x+l-(n.h-(u+1)),o.y=n.y+u-l}Object.keys(o).forEach(l=>{o[l]===void 0&&delete o[l]});const a=n._orig;this.update(i,o),n._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,n={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++]};return this.willItFit(n)}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,n=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}${n}`);const l=this.opts.marginTop+this.opts.marginUnit,u=this.opts.marginBottom+this.opts.marginUnit,c=this.opts.marginRight+this.opts.marginUnit,d=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: ${u}; left: ${d};`),y.addCSSRule(this._styles,f,`top: ${l}; right: ${c}; bottom: ${u}; left: ${d};`),y.addCSSRule(this._styles,`${o} > .ui-resizable-n`,`top: ${l};`),y.addCSSRule(this._styles,`${o} > .ui-resizable-s`,`bottom: ${u}`),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: ${u}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-nw`,`left: ${d}; top: ${l}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-w`,`left: ${d}`),y.addCSSRule(this._styles,`${o} > .ui-resizable-sw`,`left: ${d}; bottom: ${u}`)}if(t=t||this._styles._max,t>this._styles._max){const a=l=>i*l+n;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,n=this.opts.cellHeightUnit;if(!i)return this;if(!e){const o=y.parseHeight(getComputedStyle(this.el).minHeight);if(o.h>0&&o.unit===n){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+n),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(_e.itemClass,this.opts.itemClass);const n=y.shouldSizeToContent(i);return n?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),n&&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 n in i)t[n]?e.setAttribute(i[n],String(t[n])):e.removeAttribute(i[n]);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 n=e.getAttribute("gs-size-to-content");n&&(n==="true"||n==="false"?i.sizeToContent=y.toBool(n):i.sizeToContent=parseInt(n,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(n=>{y.shouldSizeToContent(n)&&this.resizeToContentCBCheck(n.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 z.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 ge}static setupDragIn(e,t,i,n=document){t?.pause!==void 0&&(q.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?y.getElements(e,n):e).forEach((a,l)=>{ge.isDraggable(a)||ge.dragIn(a,t),i?.[l]&&(a.gridstackNode=i[l])})}movable(e,t){return this.opts.staticGrid?this:(z.getElements(e).forEach(i=>{const n=i.gridstackNode;n&&(t?delete n.noMove:n.noMove=!0,this.prepareDragDrop(n.el))}),this)}resizable(e,t){return this.opts.staticGrid?this:(z.getElements(e).forEach(i=>{const n=i.gridstackNode;n&&(t?delete n.noResize:n.noResize=!0,this.prepareDragDrop(n.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&&z._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return ge.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 ge.droppable(this.el,"destroy"),this;let e,t;const i=(n,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)*(n.clientX-f.x)/this.dragTransform.xScale+"px",a.style.top=f.y+(this.dragTransform.yScale-1)*(n.clientY-f.y)/this.dragTransform.yScale+"px",a.style.transformOrigin="0px 0px"}let{top:u,left:c}=a.getBoundingClientRect();const d=this.el.getBoundingClientRect();c-=d.left,u-=d.top;const h={position:{top:u*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(u/e)),delete l.autoPosition,this.engine.nodeBoundFix(l),!this.engine.willItFit(l)){if(l.autoPosition=!0,!this.engine.willItFit(l)){ge.off(o,"drag");return}l._willFitPos&&(y.copyPos(l,l._willFitPos),delete l._willFitPos)}this._onStartMoving(a,n,h,l,t,e)}else this._dragOrResize(a,n,h,l,t,e)};return ge.droppable(this.el,{accept:n=>{const o=n.gridstackNode||this._readAttr(n,!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(n);else{const l=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;a=n.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",(n,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 d=a.getAttribute("data-gs-widget")||a.getAttribute("gridstacknode");if(d){try{l=JSON.parse(d)}catch{console.error("Gridstack dropover: Bad JSON format: ",d)}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 u=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:u,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=u,l.h=c,l._temporaryRemoved=!0),z._itemRemoving(l.el,!1),ge.on(o,"drag",i),i(n,o,a),!1}).on(this.el,"dropout",(n,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",(n,o,a)=>{const l=a?.gridstackNode||o.gridstackNode;if(l?.grid===this&&!l._isExternal)return!1;const u=!!this.placeholder.parentElement,c=o!==a;this.placeholder.remove(),delete this.placeholder.gridstackNode;const d=u&&this.opts.animate;d&&this.setAnimation(!1);const h=o._gridstackNodeOrig;if(delete o._gridstackNodeOrig,u&&h?.grid&&h.grid!==this){const m=h.grid;m.engine.removeNodeFromLayoutCache(h),m.engine.removedNodes.push(h),m._triggerRemoveEvent()._triggerChangeEvent(),m.parentGridNode&&!m.engine.nodes.length&&m.opts.subGridDynamic&&m.removeAsSubGrid()}if(!l||(u&&(this.engine.cleanupNode(l),l.grid=this),delete l.grid?._isTemp,ge.off(o,"drag"),a!==o?(a.remove(),o=a):o.remove(),this._removeDD(o),!u))return!1;const f=l.subGrid?.el?.gridstack;return y.copyPos(l,this._readAttr(this.placeholder)),y.removePositioningStyles(o),c&&(l.content||l.subGridOpts||z.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({...n,type:"dropped"},h&&h.grid?h:void 0,l),d&&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&&!ge.isDroppable(e)&&ge.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>z._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>z._itemRemoving(i,!1)),this):this}prepareDragDrop(e,t=!1){const i=e?.gridstackNode;if(!i)return;const n=i.noMove||this.opts.disableDrag,o=i.noResize||this.opts.disableResize,a=this.opts.staticGrid||n&&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,u;const c=(f,m)=>{this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,f.target),l=this.cellWidth(),u=this.getCellHeight(!0),this._onStartMoving(e,f,m,i,l,u)},d=(f,m)=>{this._dragOrResize(e,f,m,i,l,u)},h=f=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._event,delete i._lastTried;const m=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(m,i))}};ge.draggable(e,{start:c,stop:h,drag:d}).resizable(e,{start:c,stop:h,resize:d}),i._initDD=!0}return ge.draggable(e,n?"disable":"enable").resizable(e,o?"disable":"enable"),this}_onStartMoving(e,t,i,n,o,a){if(this.engine.cleanNodes().beginUpdate(n),this._writePosAttr(this.placeholder,n),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=n,n.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(n.el=this.placeholder,n._lastUiPosition=i.position,n._prevYPix=i.position.top,n._moving=t.type==="dragstart",delete n._lastTried,t.type==="dropover"&&n._temporaryRemoved&&(this.engine.addNode(n),n._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()-n.x,u=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-n.y;ge.resizable(e,"option","minWidth",o*Math.min(n.minW||1,l)).resizable(e,"option","minHeight",a*Math.min(n.minH||1,u)).resizable(e,"option","maxWidth",o*Math.min(n.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",o*Math.min(n.maxW||Number.MAX_SAFE_INTEGER,n.x+n.w)).resizable(e,"option","maxHeight",a*Math.min(n.maxH||Number.MAX_SAFE_INTEGER,u)).resizable(e,"option","maxHeightMoveUp",a*Math.min(n.maxH||Number.MAX_SAFE_INTEGER,n.y+n.h))}}_dragOrResize(e,t,i,n,o,a){const l={...n._orig};let u,c=this.opts.marginLeft,d=this.opts.marginRight,h=this.opts.marginTop,f=this.opts.marginBottom;const m=Math.round(a*.1),R=Math.round(o*.1);if(c=Math.min(c,R),d=Math.min(d,R),h=Math.min(h,m),f=Math.min(f,m),t.type==="drag"){if(n._temporaryRemoved)return;const C=i.position.top-n._prevYPix;n._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&y.updateScrollPosition(e,i.position,C);const x=i.position.left+(i.position.left>n._lastUiPosition.left?-d:c),I=i.position.top+(i.position.top>n._lastUiPosition.top?-f:h);l.x=Math.round(x/o),l.y=Math.round(I/a);const w=this._extraDragRow;if(this.engine.collide(n,l)){const O=this.getRow();let v=Math.max(0,l.y+n.h-O);this.opts.maxRow&&O+v>this.opts.maxRow&&(v=Math.max(0,this.opts.maxRow-O)),this._extraDragRow=v}else this._extraDragRow=0;if(this._extraDragRow!==w&&this._updateContainerHeight(),n.x===l.x&&n.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),n.w===l.w&&n.h===l.h)||n._lastTried&&n._lastTried.w===l.w&&n._lastTried.h===l.h)return;const C=i.position.left+c,x=i.position.top+h;l.x=Math.round(C/o),l.y=Math.round(x/a),u=!0}n._event=t,n._lastTried=l;const E={x:i.position.left+c,y:i.position.top+h,w:(i.size?i.size.width:n.w*o)-c-d,h:(i.size?i.size.height:n.h*a)-h-f};if(this.engine.moveNodeCheck(n,{...l,cellWidth:o,cellHeight:a,rect:E,resizing:u})){n._lastUiPosition=i.position,this.engine.cacheRects(o,a,h,d,f,c),delete n._skipDown,u&&n.subGrid&&n.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const C=t.target;n._sidebarOrig||this._writePosAttr(C,n),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,ge.off(e,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e;const n=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=n,this.opts.removable===!0&&z._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return yg(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}z.renderCB=(r,e)=>{r&&e?.content&&(r.textContent=e.content)},z.resizeToContentParent=".grid-stack-item-content",z.Utils=y,z.Engine=ke,z.GDRev="11.5.1";const Og=["data-id","data-testid","gs-h","gs-w","gs-x","gs-y"],bg={class:"grid-stack-item-content"},wg=Ce(s.defineComponent({__name:"DraggableGridLayout",props:{tiles:{},tileHeight:{default:Ye},columns:{default:pt}},emits:["update-tiles"],setup(r,{expose:e,emit:t}){const i=r,n=t,o=s.ref(null),a=s.ref(new Map(i.tiles.map(m=>[`${m.id}`,m])));let l=null;const u=m=>`[data-id="${m}"]`,c=m=>m.map(R=>{const E=a.value.get(`${R.el?.getAttribute("data-id")}`);if(E)return{...E,layout:{position:{col:Number(R.x),row:Number(R.y)},size:{cols:Number(R.w),rows:Number(R.h)}}}}).filter(R=>R!==void 0),d=(m,R)=>{l&&(c(R).forEach(C=>{a.value.set(`${C.id}`,C)}),n("update-tiles",Array.from(a.value.values())))},h=(m,R)=>{R.forEach(E=>{a.value.delete(`${E.el?.getAttribute("data-id")}`)}),n("update-tiles",Array.from(a.value.values()))};s.onMounted(()=>{o.value&&(l=z.init({margin:5,column:i.columns,cellHeight:i.tileHeight,resizable:{handles:"se, sw"},handle:".tile-header"},o.value),l.on("change",d),l.on("added",d),l.on("removed",h))}),s.onUnmounted(()=>{l&&l.destroy(!1)});const f=m=>{if(l&&o.value){const R=o.value.querySelector(u(m));R&&l.removeWidget(R)}};return s.watch(()=>i.tiles.length,async(m,R)=>{if(m>R&&l){const E=i.tiles.slice(R);for(const C of E)a.value.set(`${C.id}`,C),await s.nextTick(),l.makeWidget(u(C.id),{autoPosition:!0,w:C.layout.size.cols,h:C.layout.size.rows})}}),s.watchEffect(()=>{i.tiles.forEach(m=>{a.value.set(`${m.id}`,m)})}),e({removeWidget:f}),(m,R)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"gridContainer",ref:o,class:"grid-stack"},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(i.tiles,E=>(s.openBlock(),s.createElementBlock("div",{key:E.id,class:"grid-stack-item","data-id":`${E.id}`,"data-testid":`grid-stack-item-${E.id}`,"gs-h":E.layout.size.rows,"gs-lazy-load":!0,"gs-w":E.layout.size.cols,"gs-x":E.layout.position.col,"gs-y":E.layout.position.row},[s.createElementVNode("div",bg,[s.renderSlot(m.$slots,"tile",{fitToContent:!1,tile:E},void 0,!0)])],8,Og))),128))],512))}}),[["__scopeId","data-v-a060e0c5"]]),Tg=r=>{const e={position:{col:0,row:0},size:r.layout.size};if(r.type==="slottable")return{id:crypto.randomUUID(),type:"slottable",layout:e};const t=r.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}},vg={key:0,class:"fullscreen-header"},Sg={key:0,class:"tile-container slottable-tile"},xg=Ce(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(r,{expose:e,emit:t}){if(s.useCssVars(b=>({v577760a8:d.value})),r.context.disableCoordination!==!0){const b=bs();s.provide(Gi,b)}const i=t,n=s.useModel(r,"modelValue"),{i18n:o}=ae.useI18n(),a=s.ref(0),l=s.ref(null),u=s.ref(),c=s.ref(),d=s.ref("scale(1)"),h=new Set,f=s.inject(Se);f||(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")),ae.useRequestQueue();const{exportPdf:m,exportState:R}=ae.useExportPdf(c),E=b=>{h.add(b.id);const k=I.value.filter(D=>!O(D)).length;h.size>=k&&i("tiles-loaded",!0)},C=s.computed(()=>{const k=`renderer.trendRange.${U.value.type==="absolute"?"custom":U.value.time_range}`;return o.te(k)?o.t(k):""}),x=(b,k)=>{const D=b.layout.position.row-k.layout.position.row;return D!==0?D:b.layout.position.col-k.layout.position.col},I=s.computed(()=>n.value.tiles.map(b=>{if(Y.value&&!b.id&&console.warn("No id provided for tile. One will be generated automatically,","however tracking changes to this tile may not work as expected.",b),b.type==="slottable")return{layout:b.layout,type:b.type,id:b.id??crypto.randomUUID()};let k=b.definition;const D=b.type??"chart",j=La(k,C.value);return j!==k.header_description&&(k={...k,header_description:j}),{layout:b.layout,meta:k,type:D,id:b.id??crypto.randomUUID()}})),w=b=>{i("edit-tile",b)},O=b=>b.type==="slottable"?!0:b.meta?.chart.type==="slottable",v=b=>b.type==="slottable",N=b=>{if(b.type==="slottable")return b.id;const k=b.meta?.chart;return k&&v(k)?k.id:void 0},A=b=>{try{const k=Tg(b);n.value.tiles.push(JSON.parse(JSON.stringify(k)))}catch(k){console.warn(k)}},p=b=>{l.value&&l.value.removeWidget(b.id),h.delete(b.id)},g=()=>{h.clear(),a.value++},_=b=>{const k=b.map(D=>D.type==="slottable"?{id:D.id,type:D.type,layout:D.layout}:{id:D.id,type:D.type,layout:D.layout,definition:D.meta});n.value.tiles=k.sort(x)},T=async()=>{if(d.value="scale(1)",await s.nextTick(),c.value){const{availWidth:b,availHeight:k}=window.screen,{width:D,height:j}=c.value.getBoundingClientRect(),ee=Math.min(k/j,b/D);d.value=`scale(${ee})`}},S=()=>{u.value&&(document.fullscreenElement?document.exitFullscreen():u.value.requestFullscreen())},L=s.ref(!1),K=()=>{L.value=document.fullscreenElement!==null,L.value&&T()},H=s.computed(()=>n.value.preset_filters??[]),{editable:Y,enrichedContext:P,queryReady:F,showTileActions:M,timeSpec:U}=ae.useDashboardContext({globalFilters:H,context:s.computed(()=>r.context),isFullscreen:L,preview:s.computed(()=>r.preview)});return e({refresh:g,toggleFullscreen:S,exportPdf:m,pdfExportState:R}),(b,k)=>{const D=s.resolveComponent("KAlert");return s.openBlock(),s.createElementBlock("div",{ref_key:"dashboardContainer",ref:u,class:s.normalizeClass(["kong-ui-public-dashboard-renderer",{"is-fullscreen":L.value}]),onFullscreenchange:K},[s.createElementVNode("div",{ref_key:"layoutContainer",ref:c,class:"layout"},[s.unref(f)&&L.value?(s.openBlock(),s.createElementBlock("div",vg,[s.renderSlot(b.$slots,"fullscreenHeader",{},void 0,!0)])):s.createCommentVNode("",!0),s.unref(f)?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(s.unref(Y)&&!L.value?wg:Ur),{key:2,ref_key:"gridLayoutRef",ref:l,columns:n.value.columns,"tile-height":n.value.tile_height,tiles:I.value,onUpdateTiles:_},{tile:s.withCtx(({tile:j,fitToContent:ee})=>[O(j)?(s.openBlock(),s.createElementBlock("div",Sg,[s.renderSlot(b.$slots,N(j),{},void 0,!0)])):(s.openBlock(),s.createBlock(Lr,{key:L.value?`${j.id}-tile`:`${j.id}-tile-fullscreen`,"refresh-counter":a.value,"onUpdate:refreshCounter":k[0]||(k[0]=ie=>a.value=ie),class:"tile-container",context:s.unref(P),definition:j.meta,"fit-to-content":ee,height:j.layout.size.rows*(n.value.tile_height||s.unref(Ye))+parseInt(s.unref(Pi),10),"hide-actions":!s.unref(M),"is-fullscreen":L.value,preview:r.preview,"query-ready":s.unref(F),"tile-id":j.id,"tile-type":j.type,onDuplicateTile:ie=>A(j),onEditTile:ie=>w(j),onRemoveTile:ie=>p(j),onTileLoaded:ie=>E(j),onTileTimeRangeZoom:k[1]||(k[1]=ie=>i("tile-time-range-zoom",ie))},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"]))]),_:3},40,["columns","tile-height","tiles"])):(s.openBlock(),s.createBlock(D,{key:1,appearance:"danger"},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(o).t("renderer.noQueryBridge")),1)]),_:1}))],512)],34)}}}),[["__scopeId","data-v-9925f70d"]]),Ig=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(r,{expose:e,emit:t}){const i=s.useTemplateRef("root"),n=s.useTemplateRef("dashboard-tile"),o=crypto.randomUUID(),a=t,l=w=>{a("tile-time-range-zoom",w)},u=w=>{a("chart-data",w)},c=w=>{a("tile-bounds-change",w)},{i18n:d}=ae.useI18n(),{enrichedContext:h,queryReady:f}=ae.useDashboardContext({globalFilters:s.toRef(()=>r.globalFilters),context:s.toRef(()=>r.context),preview:s.computed(()=>r.preview)}),m=s.computed(()=>De(r.definition)),R=s.computed(()=>m.value?"columns"in r.definition.query&&!r.definition.query.columns?.length:!("metrics"in r.definition.query)||!r.definition.query.metrics||r.definition.query.metrics.length===0),E=s.ref(Ye);let C;s.onMounted(()=>{const w=i.value?.parentElement;w&&(E.value=w.getBoundingClientRect().height,C=new ResizeObserver(([O])=>{const{height:v}=O.contentRect;E.value=v}),C.observe(w))}),s.onUnmounted(()=>C?.disconnect());const x=s.ref(0);return e({refresh:()=>{x.value++},getExportData:()=>n.value?.getExportData()}),(w,O)=>{const v=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(v,{key:0,"action-button-visible":!1,"data-testid":"chart-not-configured-empty-state"},{title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(s.unref(d).t("renderer.not_configured.title")),1)]),default:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(s.unref(d).t("renderer.not_configured.description")),1)]),_:1})):(s.openBlock(),s.createBlock(Lr,{key:1,ref:"dashboard-tile","refresh-counter":x.value,"onUpdate:refreshCounter":O[0]||(O[0]=N=>x.value=N),context:{...s.unref(h),editable:!1},definition:r.definition,height:E.value,"hide-actions":"",preview:r.preview,"query-ready":s.unref(f),"show-refresh":"","tile-id":s.unref(o),onChartData:u,onTileBoundsChange:c,onTileTimeRangeZoom:l},null,8,["refresh-counter","context","definition","height","preview","query-ready","tile-id"]))],512)}}}),Dg=r=>{if(r.type!=="chart")return r;const e=r.definition?.query;if(!e)return r;if(e.datasource==="api_usage"){console.warn("[@kong-ui-public/dashboard-renderer] A tile was filtered out for the Basic Tier",r);return}return r},kg=r=>{if(r.type!=="chart"||De(r.definition))return r;const e=r.definition?.query;if(!e)return r;const t={...e,datasource:e.datasource==="basic"?"api_usage":e.datasource};return{...r,definition:{...r.definition,query:t}}},Ng=(r,e=pt)=>{if(!r.length)return[];let t=0,i=0,n=0;const o=[];for(const a of r){const l=a.layout?.size?.cols??1,u=a.layout?.size?.rows??1;i+l>e&&(t+=n,i=0,n=0);const c={...a,layout:{...a.layout,position:{...a.layout?.position??{},col:i,row:t}}};o.push(c),i+=l,n=Math.max(n,u)}return o},Ag=(r,e)=>{if(e){const n=r.tiles.map(kg);return{...r,tiles:n}}const t=r.tiles.map(Dg).filter(n=>n!==void 0),i=Ng(t,r.columns);return{...r,tiles:i}},Lg=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(r,{emit:e}){const t=r,i=s.ref(void 0),n=s.computed(()=>i.value?li.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:J.COUNTRIES.length),l=s.computed(()=>{if(!t.query.filters?.find(({field:m,operator:R})=>m==="country_code"&&(R==="not_empty"||R==="empty"||R==="in"))){const m={field:"country_code",operator:"not_empty"};return{...t.query,filters:[...t.query.filters||[],m]}}return t.query}),u=s.computed(()=>{if(!i.value)return"";const f=i?.value?.meta.metric_units,m=i?.value?.meta?.metric_names;return f&&m&&f[m[0]]}),c=f=>{i.value=f},d=e,h=f=>{d("bounds-change",f)};return(f,m)=>(s.openBlock(),s.createBlock(Be,{context:r.context,"limit-override":a.value,query:l.value,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:c},{default:s.withCtx(()=>[s.createVNode(s.unref(li.AnalyticsGeoMap),{bounds:r.chartOptions.bounds,"country-metrics":n.value,"fit-to-country":r.chartOptions.fit_to_country,metric:o.value,"metric-unit":u.value,"with-legend":r.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"}));V.CP_ID_TOKEN=Fi,V.CsvExportModal=or,V.DASHBOARD_COLS=pt,V.DEFAULT_TILE_HEIGHT=Ye,V.DEFAULT_TILE_REFRESH_INTERVAL_MS=Wi,V.DashboardRenderer=xg,V.DashboardTilePreview=Ig,V.ENTITY_ID_TOKEN=Bt,V.FULLSCREEN_LONG_REFRESH_INTERVAL_MS=Yi,V.FULLSCREEN_SHORT_REFRESH_INTERVAL_MS=Vi,V.GridLayout=Ur,V.INJECT_DASHBOARD_COORDINATOR=Gi,V.INJECT_QUERY_PROVIDER=Se,V.TIMEFRAME_TOKEN=$i,V.configureAllowedDefinition=Ag,V.getTimeRangeDurationMs=Gt,V.isTimeRangeUnsupported=Ft,V.isTreemapCompatible=ei,V.limitTimeRange=$t,Object.defineProperty(V,Symbol.toStringTag,{value:"Module"})}));
8
+ `);var N=0,B=!1;this.parse=function(P,x,I){if(typeof P!="string")throw new Error("Input must be a string");var Q=P.length,W=g.length,se=_.length,ue=w.length,Z=U(S),Y=[],oe=[],F=[],ce=N=0;if(!P)return fe();if(z||z!==!1&&P.indexOf(A)===-1){for(var de=P.split(_),ne=0;ne<de.length;ne++){if(F=de[ne],N+=F.length,ne!==de.length-1)N+=_.length;else if(I)return fe();if(!w||F.substring(0,ue)!==w){if(Z){if(Y=[],Ae(F.split(g)),Ee(),B)return fe()}else Ae(F.split(g));if(M&&M<=ne)return Y=Y.slice(0,M),fe(!0)}}return fe()}for(var te=P.indexOf(g,N),j=P.indexOf(_,N),Re=new RegExp(C(K)+C(A),"g"),V=P.indexOf(A,N);;)if(P[N]===A)for(V=N,N++;;){if((V=P.indexOf(A,V+1))===-1)return I||oe.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Y.length,index:N}),Ce();if(V===Q-1)return Ce(P.substring(N,V).replace(Re,A));if(A===K&&P[V+1]===K)V++;else if(A===K||V===0||P[V-1]!==K){te!==-1&&te<V+1&&(te=P.indexOf(g,V+1));var le=Le((j=j!==-1&&j<V+1?P.indexOf(_,V+1):j)===-1?te:Math.min(te,j));if(P.substr(V+1+le,W)===g){F.push(P.substring(N,V).replace(Re,A)),P[N=V+1+le+W]!==A&&(V=P.indexOf(A,N)),te=P.indexOf(g,N),j=P.indexOf(_,N);break}if(le=Le(j),P.substring(V+1+le,V+1+le+se)===_){if(F.push(P.substring(N,V).replace(Re,A)),qe(V+1+le+se),te=P.indexOf(g,N),V=P.indexOf(A,N),Z&&(Ee(),B))return fe();if(M&&Y.length>=M)return fe(!0);break}oe.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Y.length,index:N}),V++}}else if(w&&F.length===0&&P.substring(N,N+ue)===w){if(j===-1)return fe();N=j+se,j=P.indexOf(_,N),te=P.indexOf(g,N)}else if(te!==-1&&(te<j||j===-1))F.push(P.substring(N,te)),N=te+W,te=P.indexOf(g,N);else{if(j===-1)break;if(F.push(P.substring(N,j)),qe(j+se),Z&&(Ee(),B))return fe();if(M&&Y.length>=M)return fe(!0)}return Ce();function Ae(he){Y.push(he),ce=N}function Le(he){var pe=0;return pe=he!==-1&&(he=P.substring(V+1,he))&&he.trim()===""?he.length:pe}function Ce(he){return I||(he===void 0&&(he=P.substring(N)),F.push(he),N=Q,Ae(F),Z&&Ee()),fe()}function qe(he){N=he,Ae(F),F=[],j=P.indexOf(_,N)}function fe(he){if(m.header&&!x&&Y.length&&!T){var pe=Y[0],Ie=Object.create(null),ot=new Set(pe);let bt=!1;for(let Ue=0;Ue<pe.length;Ue++){let Oe=c(pe[Ue]);if(Ie[Oe=U(m.transformHeader)?m.transformHeader(Oe,Ue):Oe]){let He,wt=Ie[Oe];for(;He=Oe+"_"+wt,wt++,ot.has(He););ot.add(He),pe[Ue]=He,Ie[Oe]++,bt=!0,(G=G===null?{}:G)[He]=Oe}else Ie[Oe]=1,pe[Ue]=Oe;ot.add(Oe)}bt&&console.warn("Duplicate headers found and renamed."),T=!0}return{data:Y,errors:oe,meta:{delimiter:g,linebreak:_,aborted:B,truncated:!!he,cursor:ce+(x||0),renamedHeaders:G}}}function Ee(){S(fe()),Y=[],oe=[]}},this.abort=function(){B=!0},this.getCharIndex=function(){return N}}function k(m){var g=m.data,_=a[g.workerId],w=!1;if(g.error)_.userError(g.error,g.file);else if(g.results&&g.results.data){var S={abort:function(){w=!0,b(g.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:O,resume:O};if(U(_.userStep)){for(var M=0;M<g.results.data.length&&(_.userStep({data:g.results.data[M],errors:g.results.errors,meta:g.results.meta},S),!w);M++);delete g.results}else U(_.userChunk)&&(_.userChunk(g.results,S,g.file),delete g.results)}g.finished&&!w&&b(g.workerId,g.results)}function b(m,g){var _=a[m];U(_.userComplete)&&_.userComplete(g),_.terminate(),delete a[m]}function O(){throw new Error("Not implemented.")}function v(m){if(typeof m!="object"||m===null)return m;var g,_=Array.isArray(m)?[]:{};for(g in m)_[g]=v(m[g]);return _}function L(m,g){return function(){m.apply(g,arguments)}}function U(m){return typeof m=="function"}return d.parse=function(m,g){var _=(g=g||{}).dynamicTyping||!1;if(U(_)&&(g.dynamicTypingFunction=_,_={}),g.dynamicTyping=_,g.transform=!!U(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&&U(m.read)&&U(m.on)?_=new R(g):(i.File&&m instanceof File||m instanceof Object)&&(_=new f(g)),_.stream(m);(_=(()=>{var w;return!!d.WORKERS_SUPPORTED&&(w=(()=>{var S=i.URL||i.webkitURL||null,M=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; ","(",M,")();"],{type:"text/javascript"})))})(),(w=new i.Worker(w)).onmessage=k,w.id=l++,a[w.id]=w)})()).userStep=g.step,_.userChunk=g.chunk,_.userComplete=g.complete,_.userError=g.error,g.step=U(g.step),g.chunk=U(g.chunk),g.complete=U(g.complete),g.error=U(g.error),delete g.worker,_.postMessage({input:m,config:g,workerId:_.id})},d.unparse=function(m,g){var _=!1,w=!0,S=",",M=`\r
9
+ `,z='"',G=z+z,T=!1,A=null,K=!1,N=((()=>{if(typeof g=="object"){if(typeof g.delimiter!="string"||d.BAD_DELIMITERS.filter(function(x){return g.delimiter.indexOf(x)!==-1}).length||(S=g.delimiter),typeof g.quotes!="boolean"&&typeof g.quotes!="function"&&!Array.isArray(g.quotes)||(_=g.quotes),typeof g.skipEmptyLines!="boolean"&&typeof g.skipEmptyLines!="string"||(T=g.skipEmptyLines),typeof g.newline=="string"&&(M=g.newline),typeof g.quoteChar=="string"&&(z=g.quoteChar,G=z+z),typeof g.header=="boolean"&&(w=g.header),Array.isArray(g.columns)){if(g.columns.length===0)throw new Error("Option columns is empty");A=g.columns}g.escapeChar!==void 0&&(G=g.escapeChar+z),g.escapeFormulae instanceof RegExp?K=g.escapeFormulae:typeof g.escapeFormulae=="boolean"&&g.escapeFormulae&&(K=/^[=+\-@\t\r].*$/)}})(),new RegExp(C(z),"g"));if(typeof m=="string"&&(m=JSON.parse(m)),Array.isArray(m)){if(!m.length||Array.isArray(m[0]))return B(null,m,T);if(typeof m[0]=="object")return B(A||Object.keys(m[0]),m,T)}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||A),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])),B(m.fields||[],m.data||[],T);throw new Error("Unable to serialize unrecognized input");function B(x,I,Q){var W="",se=(typeof x=="string"&&(x=JSON.parse(x)),typeof I=="string"&&(I=JSON.parse(I)),Array.isArray(x)&&0<x.length),ue=!Array.isArray(I[0]);if(se&&w){for(var Z=0;Z<x.length;Z++)0<Z&&(W+=S),W+=P(x[Z],Z);0<I.length&&(W+=M)}for(var Y=0;Y<I.length;Y++){var oe=(se?x:I[Y]).length,F=!1,ce=se?Object.keys(I[Y]).length===0:I[Y].length===0;if(Q&&!se&&(F=Q==="greedy"?I[Y].join("").trim()==="":I[Y].length===1&&I[Y][0].length===0),Q==="greedy"&&se){for(var de=[],ne=0;ne<oe;ne++){var te=ue?x[ne]:ne;de.push(I[Y][te])}F=de.join("").trim()===""}if(!F){for(var j=0;j<oe;j++){0<j&&!ce&&(W+=S);var Re=se&&ue?x[j]:j;W+=P(I[Y][Re],j)}Y<I.length-1&&(!Q||0<oe&&!ce)&&(W+=M)}}return W}function P(x,I){var Q,W,se;return x==null?"":x.constructor===Date?isNaN(x.getTime())?"":x.toISOString():(se=!1,K&&typeof x=="string"&&K.test(x)&&(x="'"+x,se=!0),W=(Q=x.toString()).replace(N,G),(se=se||_===!0||typeof _=="function"&&_(x,I)||Array.isArray(_)&&_[I]||((ue,Z)=>{for(var Y=0;Y<Z.length;Y++)if(-1<ue.indexOf(Z[Y]))return!0;return!1})(W,d.BAD_DELIMITERS)||-1<W.indexOf(S)||-1<Q.indexOf(z)||W.charAt(0)===" "||W.charAt(W.length-1)===" ")?z+W+z:W)}},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=D,d.ParserHandle=E,d.NetworkStreamer=h,d.FileStreamer=f,d.StringStreamer=p,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,(p.prototype=Object.create(p.prototype)).constructor=p,(R.prototype=Object.create(u.prototype)).constructor=R,d})})(ft)),ft.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",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 mt(){const n=at.createI18n("en-us",Ra);return{i18n:n,i18nT:at.i18nTComponent(n)}}const tt=170,Bt=6,pt=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),R=t?t+c:c;return d._events[R]?d._events[R].fn?d._events[R]=[d._events[R],p]:d._events[R].push(p):(d._events[R]=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,R=new Array(p);f<p;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,p,R){var E=t?t+c:c;if(!this._events[E])return!1;var C=this._events[E],D=arguments.length,k,b;if(C.fn){switch(C.once&&this.removeListener(c,C.fn,void 0,!0),D){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,p),!0;case 6:return C.fn.call(C.context,u,h,f,p,R),!0}for(b=1,k=new Array(D-1);b<D;b++)k[b-1]=arguments[b];C.fn.apply(C.context,k)}else{var O=C.length,v;for(b=0;b<O;b++)switch(C[b].once&&this.removeListener(c,C[b].fn,void 0,!0),D){case 1:C[b].fn.call(C[b].context);break;case 2:C[b].fn.call(C[b].context,u);break;case 3:C[b].fn.call(C[b].context,u,h);break;case 4:C[b].fn.call(C[b].context,u,h,f);break;default:if(!k)for(v=1,k=new Array(D-1);v<D;v++)k[v-1]=arguments[v];C[b].fn.apply(C[b].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 p=t?t+c:c;if(!this._events[p])return this;if(!u)return a(this,p),this;var R=this._events[p];if(R.fn)R.fn===u&&(!f||R.once)&&(!h||R.context===h)&&a(this,p);else{for(var E=0,C=[],D=R.length;E<D;E++)(R[E].fn!==u||f&&!R[E].once||h&&R[E].context!==h)&&C.push(R[E]);C.length?this._events[p]=C.length===1?C[0]:C: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(R){f(R)}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,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 p=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"&&!ee.isPlatformDatasource(t.value.query.datasource)&&p.value&&!h.value),C=s.computed(()=>r.value&&t.value.query&&za(t.value.query.datasource)&&p.value&&!h.value),D=s.computed(()=>i.value?ee.msToGranularity(i.value.meta.granularity_ms):void 0),k=s.computed(()=>{const _=t.value,w=[...e.value.filters,..._.query.filters??[]],S="metrics"in _.query?_.query.metrics:void 0,M=_.query?.datasource??"api_usage";return u.value({datasource:M,filters:w,queryFields:S})}),b=s.computed(()=>{if(!C.value||!R.value)return"";const _=t.value;if(De(_))return g({..._.query,filters:k.value});const w=_.query.time_range||e.value.timeSpec,S=m(w,k.value);return g(S)}),O=s.computed(()=>{if(!E.value||!R.value)return"";const _=k.value,w=t.value;if(De(w))return"";const S=L(w.query.time_range||e.value.timeSpec,_);return v(S)}),v=_=>E.value?`${o.value}?q=${JSON.stringify(_)}`:"",L=(_,w)=>{const S=i.value?.meta?.start?new Date(i.value.meta.start):void 0,M=i.value?.meta?.end?new Date(i.value.meta.end):void 0;return{filter:w,timeframe:{timePeriodsKey:_.type==="relative"?_.time_range:"custom",start:_.type==="absolute"?S:void 0,end:_.type==="absolute"?M:void 0}}},U=(_,w)=>({filter:w,timeframe:{timePeriodsKey:_.type==="relative"?_.time_range:"custom",start:_.type==="absolute"?_.start:void 0,end:_.type==="absolute"?_.end:void 0}}),m=(_,w)=>{const S=t.value;if(!Gt(S))throw new Error("Cannot build a chart explore query for table or api-requests definitions");const M=[...S.query.dimensions??[]],z=[...S.query.metrics??[]];return{filters:w,metrics:z,dimensions:M,time_range:_,granularity:S.query.granularity||D.value||void 0}},g=_=>{if(!C.value)return"";const w=t.value.query.datasource&&t.value.query.datasource!=="basic"?t.value.query.datasource:"api_usage";return`${r.value}?q=${JSON.stringify(_)}&d=${w}&c=${t.value.chart.type}`};return s.watch([E,C],([_,w])=>{_&&(a.value={href:""}),w&&(l.value={href:""})}),{exploreLinkKebabMenu:b,requestsLinkKebabMenu:O,canShowKebabMenu:R,canGenerateRequestsLink:E,canGenerateExploreLink:C,requestsLinkZoomActions:a,exploreLinkZoomActions:l,buildExploreQuery:m,buildRequestsQueryZoomActions:U,buildExploreLink:g,buildRequestLink:v}}const $t=n=>n.type==="relative"?ee.TimePeriods.get(ee.TIMEFRAME_LOOKUP[n.time_range])?.timeframeLengthMs():new Date(n.end).getTime()-new Date(n.start).getTime(),qa=n=>n.reduce((e,t)=>{const i=ee.TimePeriods.get(ee.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",R=ee.isPlatformDatasource(p),E=i.value({datasource:p,filters:[...a.filters??[],...l.filters],queryFields:a.metrics}).filter(({operator:k})=>!R||!ee.requestFilterTypeEmptyV2.some(b=>b===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[p]?.timeRangeOptions);const D={datasource:p,query:{...f,time_range:C,filters:E,limit:d??h}};return n.queryFn(D,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=>ee.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 ee.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 v=!1;if(d.value.type==="relative")v=["15m","1h","6h","12h","24h"].includes(d.value.time_range);else{const m=d.value.start.getTime(),g=d.value.end.getTime();v=Math.abs(g-m)<=864e5}const L=new Date().getTime();d.value.type==="absolute"&&d.value.end.getTime()<L||d.value.type==="relative"&&["previous_week","previous_month"].includes(d.value.time_range)?O=0:v?O=Yi:O=Xi}return O}),R=s.computed(()=>({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),C=s.computed(()=>!i.value&&!!s.getCurrentInstance()?.vnode?.props?.onTileTimeRangeZoom),D=s.computed(()=>!i.value),k=s.computed(()=>!i.value),b=s.computed(()=>({enabled:C.value,showExploreAction:D.value,showRequestsAction:k.value,showZoomInAction:C.value}));return{editable:u,enrichedContext:R,filters:f,queryReady:E,refreshInterval:p,showTileActions:h,timeSpec:d,tz:c,zoomConfiguration:b}}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.querySelector(".kong-ui-public-grid-layout, .grid-stack");if(!e)return[];const t=e.querySelectorAll(":scope > .grid-cell:not(.empty-cell), :scope > .grid-stack-item");if(!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}=mt(),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:R="download",onBeforeCapture:E,onAfterCapture:C}=r,D=n.value;if(!D){t.value={status:"error",error:new Error("Dashboard layout container not found.")};return}try{t.value={status:"preparing"},await E?.();const[{snapdom:k},{jsPDF:b}]=await Promise.all([import("@zumer/snapdom"),import("jspdf")]);t.value={status:"capturing"};const O={name:"kong-webgl-snapshot",beforeClone:()=>ee.prepareForCapture(),afterClone:()=>ee.restoreAfterCapture()},v=await k.toCanvas(D,{scale:f,exclude:p,excludeMode:"remove",embedFonts:!0,plugins:[O]}),L=Ja(D),U=D.getBoundingClientRect().width,m=U?v.width/U:f;t.value={status:"generating"};const g=new Date,_=new b({orientation:c,unit:"mm",format:u}),w=_.internal.pageSize.getWidth(),S=_.internal.pageSize.getHeight(),M=Qa+(l?sn:0),z=w-h*2,G=S-h*2-M-rn,T=v.width/z,A=G*T,K=el(L,v.height,A,m),N={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:w,pageHeight:S,headerHeight:M,margin:h};for(let B=0;B<K.length;B++){B>0&&_.addPage();const{startY:P,height:x}=K[B],I=document.createElement("canvas");I.width=v.width,I.height=x,I.getContext("2d").drawImage(v,0,P,v.width,x,0,0,v.width,x),_.addImage(I.toDataURL("image/png"),"PNG",h,h+M,z,x/T),Za(_,{...N,pageLabel:e.t("pdfExport.pageOf",{page:String(B+1),total:String(K.length)})})}if(R==="blob"){const B=_.output("blob");return t.value={status:"complete",pageCount:K.length},B}_.save(o),t.value={status:"complete",pageCount:K.length}}catch(k){t.value={status:"error",error:k}}finally{ee.restoreAfterCapture(),await C?.()}}return{exportPdf:i,exportState:s.readonly(t)}}const il=n=>n.toLowerCase().endsWith("count")?"":n;function nl(){const{i18n:n}=mt(),{formatUnit:e}=ee.unitFormatter({i18n:n}),t=ae.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}=mt(),e=we.useDatasourceConfigStore();return(t,i)=>on(n,e.fieldTranslationMap,t,i)}const ae={useContextLinks:Pa,useDashboardContext:ja,useEvaluateFeatureFlag:Ca,useExportPdf:tl,useFieldLabel:rl,useI18n:mt,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}=ae.useI18n(),i=ae.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:C}=r.exportState.chartData.meta;return!E||!C?"":new Date(E).getTime()===new Date(C).getTime()?t.t("csvExport.exportAsOf",{time:ee.formatTimestamp(new Date(E),{includeTZ:!0})}):`${t.t("csvExport.exportTimeRange")}: ${ee.formatTimestamp(new Date(E))} - ${ee.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")},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,C=E.data.some(L=>L.timestamp!==E.data[0].timestamp),D=E.data.map(L=>{const U=new Date(L.timestamp);return{...Object.keys(L.event).reduce((g,_)=>{if(_ in E.meta.display){const w=L.event[_],S=E.meta.display[_];g[_]=w&&S?.[w]?.name||L.event[_]}else g[_]=L.event[_];return g},{}),...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 b="display"in r.exportState.chartData.meta&&r.exportState.chartData.meta.display?r.exportState.chartData.meta.display:{},O=[...k,...Object.keys(b).map(L=>({label:i(L),key:L})),...r.exportState.chartData.meta.metric_names.map(L=>({label:i(L),key:L}))],v=O.reduce((L,U)=>(L[U.key]=U.label,L),{});return{headers:O,csvHeaders:v,rows:D}}),R=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,C)=>{const D=s.resolveComponent("KSkeleton"),k=s.resolveComponent("KEmptyState"),b=s.resolveComponent("KTableData"),O=s.resolveComponent("KTooltip"),v=s.resolveComponent("KButton"),L=s.resolveComponent("KModal");return s.openBlock(),s.createElementBlock("div",sl,[s.createVNode(L,{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(D,{key:1,class:"chart-skeleton",type:"table"})):n.exportState.status==="success"?(s.openBlock(),s.createBlock(b,{key:2,class:"vitals-table",fetcher:R,"fetcher-cache-key":String(l.value),headers:p.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(ee.EXPORT_RECORD_LIMIT)})},{default:s.withCtx(()=>[s.createVNode(s.unref(ie.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(v,{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(v,{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}=ae.useI18n(),{issueQuery:o}=ae.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 k=l();try{const b=await o(t.query,t.context,t.limitOverride);return l()!==k?void 0:(p.value=null,b)}catch(b){if(l()!==k)return;throw p.value=be.handleQueryError(b),b}finally{l()===k&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:h,swrvState:f}=un(d,c,u),p=s.ref(null),R=s.computed(()=>h.value===f.ERROR||!!p.value),E=s.computed(()=>!t.queryReady||h.value===f.PENDING),C=s.ref(),D=s.computed(()=>d.value??(t.queryReady&&h.value===f.PENDING?C.value:void 0));return s.watch([()=>d.value,()=>h.value],([k,b])=>{k&&(b==="SUCCESS_HAS_DATA"||b==="SUCCESS")&&k!==C.value&&(C.value=k,i("chart-data",k))}),(k,b)=>{const O=s.resolveComponent("KSkeleton"),v=s.resolveComponent("KEmptyState");return(E.value||!s.unref(d)&&!R.value)&&!D.value?(s.openBlock(),s.createBlock(O,{key:0,class:"chart-skeleton",type:"table"})):R.value&&!E.value?(s.openBlock(),s.createBlock(v,{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(ie.VisibilityOffIcon),{key:0})):(s.openBlock(),s.createBlock(s.unref(ie.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)):D.value?s.renderSlot(k.$slots,"default",{data:D.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}=ae.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}=ae.useI18n(),{issueRequestsQuery:o}=ae.useIssueRequestsQuery(),a=s.computed(()=>t.query.datasource==="requests"),l=s.computed(()=>{const O=t.query,v=O.time_range??t.context.timeSpec,L=v?$t(v):void 0;if(!L)return O;const U=ee.finestGranularityForDuration(L);let m;return O.granularity&&ee.Granularities[O.granularity]>=ee.Granularities[U]?m=O.granularity:m=U,{...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(),v=t.query;try{const L=await o(v,t.context);return d()!==O?void 0:(c.value=null,be.requestsToScatterData(L,Ya(v)))}catch(L){if(d()!==O)return;throw c.value=be.handleQueryError(L),L}finally{d()===O&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:p,swrvState:R}=un(u,h,f),E=s.ref(),C=s.computed(()=>u.value??E.value);s.watch(u,O=>{O&&(E.value=O)});const D=s.computed(()=>p.value===R.ERROR||!!c.value),k=s.computed(()=>!D.value&&(!t.queryReady||p.value===R.PENDING)&&!C.value),b=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,v)=>{const L=s.resolveComponent("KSkeleton"),U=s.resolveComponent("KEmptyState");return a.value?k.value?(s.openBlock(),s.createBlock(L,{key:1,class:"chart-skeleton",type:"table"})):D.value?(s.openBlock(),s.createBlock(U,{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(ie.VisibilityOffIcon),{key:0})):(s.openBlock(),s.createBlock(s.unref(ie.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)):C.value?(s.openBlock(),s.createElementBlock("div",hl,[s.createVNode(s.unref(be.AnalyticsChart),{"chart-data":C.value,"chart-options":b.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:v[0]||(v[0]=m=>i("chart-data",m)),onQueryComplete:v[1]||(v[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":b.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 it=(n=>(n.PENDING="PENDING",n.LOADING="LOADING",n.SUCCESS="SUCCESS",n.ERROR="ERROR",n))(it||{});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:it,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!==it.PENDING){if(r===it.LOADING){n({hasData:i,state:"loading"});return}if(r===it.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,R=t?.value?.sortColumnKey,E=t?.value?.sortColumnOrder;const C=z=>z===o.value&&f===n.value&&p===e?.value,D=(z,G)=>C(z)&&G===a.value&&R===t?.value?.sortColumnKey&&E===t?.value?.sortColumnOrder,k=z=>{if(!t)return!0;const G=t.value;return!G?.sortColumnKey||!G.sortColumnOrder?z.length===0:z.length===1&&z[0].colId===G.sortColumnKey&&z[0].sort===G.sortColumnOrder},b=()=>{h.value=u.value>0},O=()=>{a.value+=1,R=t?.value?.sortColumnKey,E=t?.value?.sortColumnOrder;for(const z of r.values())z.resolve(!1);i.clear(),r.clear(),d.value=void 0,c.value=void 0,u.value=0,b()},v=()=>{c.value=void 0,u.value+=1,b()},L=()=>{u.value=Math.max(0,u.value-1),b()},U=z=>{const G=r.get(z);if(G)return G;let T;const A={promise:new Promise(K=>{T=K}),resolve:K=>T(K)};return r.set(z,A),A},m=(z,G)=>{G.resolve(!1),r.get(z)===G&&r.delete(z)},g=async({blockIndex:z,currentBlockCompletion:G,datasourceId:T,requestGeneration:A})=>{if(z===0)return"ready";const K=r.get(z-1);if(!K)return m(z,G),"failed";const N=await K.promise;return D(T,A)?N?"ready":(m(z,G),"failed"):(m(z,G),"stale")},_=({blockIndex:z,currentBlockCompletion:G,getRowsParams:T,pageSize:A,result:K})=>{K.cursor!==void 0&&i.set(z,K.cursor),T.successCallback(K.data,Rl({startRow:T.startRow,rowsLength:K.data.length,pageSize:A,total:K.total,hasMore:K.hasMore})),T.startRow===0&&(d.value=K.data),G.resolve(!0)},w=({blockIndex:z,currentBlockCompletion:G,fetchError:T,getRowsParams:A})=>{c.value=T,A.failCallback(),m(z,G)},S=()=>{const z=n.value;if(!z)throw new Error("TableDataGrid requires a fetcher in infinite mode");f=z,p=e?.value;const G=o.value+1;return o.value=G,O(),{async getRows(T){if(!C(G)||!k(T.sortModel)){T.failCallback();return}const{blockIndex:A,pageSize:K}=yl({startRow:T.startRow,endRow:T.endRow});A===0&&r.has(0)&&O();const N=a.value,B=U(A);if(await g({blockIndex:A,currentBlockCompletion:B,datasourceId:G,requestGeneration:N})!=="ready"||!D(G,N)){T.failCallback(),m(A,B);return}v();try{const P=A>0?i.get(A-1):void 0,x=await z({mode:"infinite",pageSize:K,cursor:P,sort:t?.value});if(!D(G,N)){T.failCallback(),m(A,B);return}_({blockIndex:A,currentBlockCompletion:B,getRowsParams:T,pageSize:K,result:x})}catch(P){if(!D(G,N)){T.failCallback(),m(A,B);return}w({blockIndex:A,currentBlockCompletion:B,fetchError:P,getRowsParams:T})}finally{D(G,N)&&L()}}}},M=()=>{l.value=S()};return s.watch([n,()=>e?.value],()=>{M()},{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=at.createI18n("en-us",bl);return{i18n:n,i18nT:at.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)),R=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),C=s.computed(()=>o.value.thresholds?.length&&u.value!==null?vl(u.value,o.value.thresholds):void 0),D=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:w})=>{const S=t.value.colDef?.colId,M=t.value.context?.cells?.slots;return!S||S==="cell-icon"||!M?.[S]?w.default?.():s.h("span",{class:"table-data-grid-cell-slot-content"},s.renderSlot(M,S,D.value,()=>w.default?.()??[]))},b=()=>{const _=t.value.context?.cells?.slots;return _?.["cell-icon"]?s.renderSlot(_,"cell-icon",D.value):null};let O,v,L=!1;const U=()=>{const _=i.value;r.value=!!_&&_.scrollWidth>_.clientWidth},m=()=>{L||(v!==void 0&&cancelAnimationFrame(v),v=requestAnimationFrame(()=>{v=void 0,U()}))},g=_=>{if(O?.disconnect(),_){O?.observe(_);const w=_.closest(".ag-cell");w&&O?.observe(w)}m()};return s.onMounted(()=>{O=new ResizeObserver(m),g(i.value)}),s.watch(i,g),s.onUnmounted(()=>{L=!0,O?.disconnect(),v!==void 0&&cancelAnimationFrame(v)}),e({refresh(_){return t.value=_,s.nextTick(m),!0}}),(_,w)=>{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":p.value,"table-data-grid-cell-renderer--percentage":!!f.value,[`table-data-grid-cell-renderer--text-${C.value}`]:!p.value&&!!C.value}]),"data-threshold":C.value},[s.createElementVNode("span",kl,[s.createElementVNode("span",Nl,[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(b))),(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)]),p.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=p=>!!(p.showPercentage||p.bar||p.thresholds?.length);s.watch([n,()=>r?.value],()=>{n.value.forEach(p=>{if(!d(p))return;let R;if(a==="infinite"&&(p.showPercentage||p.bar)?R="percentage and bar presentation is only supported in unpaginated mode":a==="unpaginated"&&r?.value?.some(C=>{const D=Reflect.get(C,p.key);return D!=null&&gt(D)===null})&&(R="contains non-finite or nonnumeric values; numeric presentation skips those values"),!R)return;const E=`${p.key}:${R}`;l.has(E)||(l.add(E),console.warn(`[TableDataGrid] Column "${p.key}" ${R}.`))})},{immediate:!0});const c=s.computed(()=>{if(a!=="unpaginated")return{};const p=r?.value??[];return Object.fromEntries(n.value.filter(R=>R.showPercentage||R.bar).map(R=>[R.key,Tl(p,R)]))}),u=s.computed(()=>{if(a!=="unpaginated")return{};const p=r?.value??[];return Object.fromEntries(n.value.filter(R=>R.bar).map(R=>[R.key,Il({rows:p,header:R,stats:c.value[R.key]})]))}),h=s.computed(()=>({cells:{slots:e,tooltipTarget:o},presentation:{stats:c.value,labelSizers:u.value}})),f=p=>{const R=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,...R?{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 B=document.fullscreenElement;c.value=B instanceof HTMLElement&&B.contains(d.value??null)?B:"body"};s.onMounted(()=>{u(),document.addEventListener("fullscreenchange",u)}),s.onBeforeUnmount(()=>{document.removeEventListener("fullscreenchange",u)});const{activeTableConfig:h,activeSort:f,activePageSize:p,patchTableConfig:R}=Pl({headers:s.toRef(()=>n.headers),pageSize:s.toRef(()=>n.pageSize),tableConfig:s.toRef(()=>n.tableConfig),emitSort:B=>i("sort",B),emitTableConfigUpdate:B=>i("update:tableConfig",B),onExternalConfigChange:B=>{l.value&&C(l.value,B)}}),{onSortChanged:E,applySortToGrid:C}=Hl({activeSort:f,patchTableConfig:R}),D=s.computed(()=>t==="unpaginated"&&!!h.value.fitToContent),k=Xe.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:b,onRowClick:O}=ql({cellClick:B=>i("cell:click",B),headers:s.toRef(()=>n.headers),rowClick:(B,P)=>i("row:click",B,P)}),v={resizable:!1,sortable:!1,suppressMovable:!0},L=s.computed(()=>[p.value,n.refreshKey]),U=t==="infinite"?Cl({fetcher:s.toRef(()=>n.fetcher),resetKey:L,sort:f}):void 0,m=U?.datasource,g=s.computed(()=>U?U.data.value:n.rows),_=s.computed(()=>U?.isFetching.value??!1),w=s.computed(()=>n.rows?Array.from(n.rows):void 0),{columnDefs:S,gridContext:M}=zl({headers:s.toRef(()=>n.headers),mode:t,rows:w,slots:a,tooltipTarget:c,initialSort:f.value}),{fetchState:z,hasData:G,state:T}=gl(g,s.toRef(()=>U?.error.value),_),A=s.computed(()=>T.value===z.SUCCESS&&!G.value);U&&_l({emitState:B=>i("state",B),fetchLifecycleState:T,hasData:G});const K=()=>{const B=l.value;if(!B||B.isDestroyed())return;const P=f.value,x=B.getColumnState().find(I=>I.sort);x?.colId===P.sortColumnKey&&(x?.sort??void 0)===P.sortColumnOrder||C(B,P)};s.watch([l,f],K);const N=B=>{l.value=B.api,i("grid:ready",B.api)};return(B,P)=>{const x=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":D.value}]),"data-testid":"table-data-grid"},[n.error?(s.openBlock(),s.createElementBlock("div",Gl,[s.renderSlot(B.$slots,"error-state",{},()=>[s.createVNode(x,{"icon-variant":"error",message:s.unref(o)("errorState.message"),title:s.unref(o)("errorState.title")},null,8,["message","title"])],!0)])):A.value?(s.openBlock(),s.createElementBlock("div",$l,[s.renderSlot(B.$slots,"empty-state",{},()=>[s.createVNode(x,{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(S),context:s.unref(M),datasource:s.unref(t)==="infinite"?s.unref(m):void 0,"default-col-def":v,"dom-layout":D.value?"autoHeight":"normal","infinite-initial-row-count":s.unref(t)==="infinite"?1:void 0,loading:_.value,"row-data":s.unref(t)==="unpaginated"?w.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(b),onGridReady:N,onNewColumnsLoaded:K,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:ie.AnthropicIcon,azure:ie.AzureIcon,bedrock:ie.AmazonBedrockIcon,cerebras:ie.CerebrasIcon,cohere:ie.CohereIcon,databricks:ie.DatabricksIcon,deepseek:ie.DeepseekIcon,gemini:ie.GeminiIcon,huggingface:ie.HuggingFaceIcon,llama2:ie.MetaLlamaIcon,mistral:ie.MistralIcon,moonshot:ie.KimiIcon,nvidia:ie.NvidiaIcon,ollama:ie.OllamaIcon,openai:ie.OpenAiIcon,vertex:ie.GoogleVertexIcon,vllm:ie.VllmIcon,xai:ie.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}=ee.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,v)=>jt(e,O)?.label||v,R=(O,v)=>{if(jl(O)||O==="requests")return"";const L=v===1?"":"s",U=`chartUnits.${O}`;return t.messages[U]?t.formatMessage({id:U},{plural:L}):O},E=O=>{const v=L=>r(L,"%",{translateUnit:R});return O>0&&O<.01?`< ${v(.01)}`:v(O)},C=(O,v)=>{const L=O.event[v];if(L==null)return"–";const U=typeof L=="number"?L:Number(L);if(Number.isNaN(U))return"–";const m=a?.metric_units?.[v]||"count";return m==="%"?E(U):r(U,m,{approximate:["count","count/minute","token count"].includes(m),isBytes1024:!0,translateUnit:R})},D=(O,v)=>{const L=String(O.record.event[v]),U=l[v]?.[L];return{id:L,label:U?.name||"-",deleted:!!U?.deleted}},k=d.map(O=>({key:O,label:p(O,h?f(O):t.t("topNTable.nameLabel")),type:"dimension",valueFormatter:(v,L)=>D(L,O).label,sortable:!1}));c.forEach(O=>{const v=jt(e,O);k.push({key:O,label:v?.label||f(O),type:"metric",valueFormatter:(L,U)=>C(U.record,O),showPercentage:v?.value==="relative",percentageFormatter:E,bar:v?.bar==="max"?"absolute":v?.bar,thresholds:v?.thresholds,sortable:!1})});const b=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:b,getDimension:D}},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}=ae.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(([D])=>D.toLowerCase()===E.toLowerCase())?.[1])||""},p=E=>f(E)||l.value[0]?.key===E&&n.chartOptions.entity_link||"",R=(E,C)=>{const D=p(C),k=String(E[C]);if(k.includes(":")){const[b,O]=k.split(":");return D.replace(Fi,b).replace(zt,O)}return D.replace(zt,k)};return(E,C)=>{const D=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(D,{"action-button-visible":!1,"data-testid":"chart-empty-state"},{icon:s.withCtx(()=>[s.createVNode(s.unref(ie.WarningOutlineIcon))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(o.value.errorMessage),1)]),_:1})]),"empty-state":s.withCtx(()=>[s.createVNode(D,{"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:b})=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(u(k.key,b)),{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:b})=>[p(k.key)&&b[k.key]!=="empty"?(s.openBlock(),s.createBlock(s.unref(h),{key:0,class:"top-n-entity-link","entity-link-data":o.value.getDimension(b,k.key),"external-link":R(b,k.key)},null,8,["entity-link-data","external-link"])):o.value.getDimension(b,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(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=ae.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:C=>a(C)})),R=s.computed(()=>async({cursor:C,pageSize:D})=>{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 b=await k({abortController:l,context:t.context,cursor:C,pageSize:D,query:h.value,onResponseColumns:O=>{d.value=O},stripUnknownFilters:o.stripUnknownFilters,tabularQueryFn:r?.tabularQueryFn});return c.value=!1,b}catch(k){throw c.value=!0,k}}),E=C=>{C.state==="error"&&(c.value=!0),i("loading-change",C.state==="loading")};return(C,D)=>{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: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(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="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,lt.GridComponent,lt.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),nt=(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)?nt(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,lt.VisualMapComponent,lt.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:[nt({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(()=>nt(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:[nt({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(()=>nt(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(D=>D!=="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||ee.Granularities.daily,u=ee.msToGranularity(c)??"daily",h=e||Intl.DateTimeFormat().resolvedOptions().timeZone,f=n.data,p=Yp(new Date(r).getTime(),c,f.map(({timestamp:D})=>new Date(D).getTime())),R=Xp(p,new Date(o).getTime(),c),E=[],C=[];for(const{timestamp:D,event:k}of f){const b=Math.floor((new Date(D).getTime()-p)/c),O=Nn(k[l]);b<0||b>=R.length||O===void 0||C.push([b,Qp(E,String(k[d])),O])}return{data:C,xAxisLabels:jp(R,u,h),yAxisLabels:E.map(D=>Zp(t[d],D))}},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}=ae.useI18n(),o=ae.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||ee.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}=ae.useI18n(),o=ae.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(q=>({v76398b0c:`${q.height}px`}));const i=parseInt(qi,10),r=ae.useFieldLabel(),{zoomConfiguration:o}=ae.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(()=>zg)),u=s.inject(ve),h=we.useDatasourceConfigStore(),{datasourceConfigMap:f,stripUnknownFilters:p}=Ye(h),{i18n:R}=ae.useI18n(),E=s.ref(),C=s.ref({status:"loading"}),D=s.ref(!1),k=s.ref(),b=s.ref(!1),O=s.ref(!0),v=s.computed(()=>n.definition.chart),L=s.computed(()=>v.value.type==="single_value"),U=s.computed(()=>("chart_title"in v.value?v.value.chart_title:void 0)||(L.value?le.value:void 0)),m=s.computed(()=>n.definition.header_description),g=s.computed(()=>v.value.type==="slottable"),_=s.computed(()=>De(n.definition)||Ht(n.definition)?!1:!("allow_csv_export"in v.value)||v.value.allow_csv_export!==!1),{exploreLinkKebabMenu:w,requestsLinkKebabMenu:S,canShowKebabMenu:M,canGenerateRequestsLink:z,canGenerateExploreLink:G,requestsLinkZoomActions:T,exploreLinkZoomActions:A,buildExploreQuery:K,buildExploreLink:N,buildRequestLink:B,buildRequestsQueryZoomActions:P}=ae.useContextLinks({queryBridge:u,chartData:s.readonly(E),definition:s.toRef(()=>n.definition),context:s.readonly(s.toRef(()=>n.context))}),{issueQuery:x}=ae.useIssueQuery();s.watch(()=>n.definition,async(q,J)=>{await s.nextTick(),k.value&&(b.value=k.value.scrollWidth>k.value.clientWidth);try{JSON.stringify(q?.query)!==JSON.stringify(J?.query)&&(O.value=!0)}catch{}},{immediate:!0,deep:!0});const I=s.computed(()=>R.t("csvExport.defaultFilename")),Q=s.computed(()=>!!w.value||_.value||!!n.context.editable),W=s.computed(()=>!n.hideActions&&M.value&&Q.value),se=s.computed(()=>W.value&&Q.value&&!n.isFullscreen),ue={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},Z=s.computed(()=>({...Y.value?.rendererEvents.supportsRequests?{"select-chart-range":Pg}:{},...Y.value?.rendererEvents.supportsZoom?{"zoom-time-range":He}:{},...Y.value?.rendererEvents.supportsBounds?{"bounds-change":wt}:{},...Y.value?.rendererEvents.supportsLoadingChange?{"loading-change":ot}:{}})),Y=s.computed(()=>{const q=ue[n.definition.chart.type],J=De(n.definition),me=!!q?.emits?.includes("select-chart-range"),Ge=!!q?.emits?.includes("zoom-time-range"),ze=n.definition.chart.type==="choropleth_map",$e=!!q?.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:j.value,headerDescription:m.value,requestsLink:o.value.showRequestsAction?T.value:void 0,exploreLink:o.value.showExploreAction?A.value:void 0};return q&&{component:q,rendererProps:{...ri,...J?{}:si,...["top_n","single_value"].includes(n.definition.chart.type)?{fitToContent:n.fitToContent}:{}},rendererEvents:{supportsRequests:me,supportsZoom:Ge,supportsBounds:ze,supportsLoadingChange:$e}}}),oe=s.computed(()=>{if(De(n.definition))return null;const q=n.definition.query,J=q?.time_range;if(ee.isPlatformDatasource(q?.datasource)&&!q.dimensions?.includes("time"))return R.t("renderer.as_of_today");if(J?.type==="relative"){const me=ee.TimePeriods.get(ee.TIMEFRAME_LOOKUP[J.time_range]);return me?me.display:(console.warn("Did not recognize the given relative time range:",J.time_range),J.time_range)}else if(J?.type==="absolute"){const me=J.tz||"Etc/UTC";return`${ee.formatTime(J.start,{short:!0,tz:me})} - ${ee.formatTime(J.end,{short:!0,tz:me})}`}return null}),F=s.computed(()=>{const q=n.definition.query,J=q?.datasource,me=J?f.value[J]?.timeRangeOptions:void 0,ze=(q&&"time_range"in q?q.time_range:void 0)??n.context.timeSpec;return Ft(ze,me)}),ce=s.computed(()=>g.value?!1:[!!U.value,se.value,!!oe.value,F.value,!!m.value,n.showRefresh,V.value].some(Boolean)),de=s.computed(()=>E.value?ee.msToGranularity(E.value.meta.granularity_ms):void 0),ne=s.computed(()=>["timeseries_line","timeseries_bar"].includes(v.value.type)),te=s.computed(()=>E.value?.meta.metric_names??[]),j=s.ref();s.watch(te,q=>{(!j.value||!q.includes(j.value))&&(j.value=q[0])},{immediate:!0});const Re=s.computed(()=>{const q=v.value;return q.type!=="timeseries_line"?!1:te.value.some(J=>q.metric_axis_map?.[J]==="right")}),V=s.computed(()=>ne.value&&!Re.value&&(E.value?.data.length??0)>0&&te.value.length>1&&Object.keys(E.value?.meta.display??{}).length>0),le=s.computed(()=>{const J=("metrics"in n.definition.query?n.definition.query.metrics?.[0]:void 0)??te.value[0];if(J)return r(J)}),Ae=s.computed(()=>te.value.map(q=>({value:q,label:r(q)}))),Le=s.computed(()=>{if(!Gt(n.definition)||!ne.value||!n.queryReady||O.value)return!1;const q=n.definition.query.granularity;return!q||!de.value?!1:q!==de.value}),Ce=s.computed(()=>{const q=ee.msToGranularity(E.value?.meta.granularity_ms??0)??"unknown",J=Gt(n.definition)?n.definition.query.granularity??"unknown":"unknown";return R.t("query_aged_out_warning",{currentGranularity:R.t(`granularities.${q}`),savedGranularity:R.t(`granularities.${J}`)})}),qe=s.computed(()=>{const q=[...n.context.filters,...n.definition.query.filters??[]],J="metrics"in n.definition.query?n.definition.query.metrics:void 0,me=n.definition.query.datasource??"api_usage";return p.value({datasource:me,filters:q,queryFields:J})}),fe=()=>{d("edit-tile",n.definition)},Ee=()=>{d("duplicate-tile",n.definition)},he=()=>{d("remove-tile",n.definition)},pe=q=>{E.value=q,O.value=!1,d("chart-data",q),d("tile-loaded")},Ie=()=>{O.value=!1,d("tile-loaded")},ot=q=>{O.value=q,q||d("tile-loaded")},bt=()=>{D.value=!1},Ue=()=>{if(Ht(n.definition))throw new Error("Cannot export data for a tile backed by the api-requests endpoint");const q=n.definition.query.datasource?.startsWith("goap");return u?.staticConfig?.increaseCsvExportLimit!==!1&&!q?x(n.definition.query,n.context,ee.EXPORT_RECORD_LIMIT):E.value?Promise.resolve(E.value):new Promise(me=>{const Ge=s.watch(E,ze=>{ze&&(me(ze),Ge())})})},Oe=async()=>{D.value=!0,C.value={status:"loading"};try{const q=await Ue();C.value={status:"success",chartData:q}}catch(q){C.value={status:"error",error:q}}},He=q=>{const J={tileId:n.tileId.toString(),timeRange:q};d("tile-time-range-zoom",J)},wt=q=>{const J={tileId:n.tileId.toString(),bounds:q};d("tile-bounds-change",J)},Pg=q=>{const J=qe.value,me=K(q,J);A.value=G.value?{href:N(me)}:void 0,T.value=z.value?{href:B(P(q,J))}:void 0};return e({getExportData:Ue}),(q,J)=>{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:!ce.value,"compact-single_value":L.value&&n.fitToContent}]),"data-testid":`tile-${n.tileId}`},[ce.value&&!g.value?(s.openBlock(),s.createElementBlock("div",cg,[s.createVNode(me,{class:"title-tooltip",disabled:!b.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",ug,[F.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(ie.WarningIcon),{size:`var(--kui-icon-size-20, ${s.unref(Bi)})`},null,8,["size"])]),default:s.withCtx(()=>[s.createElementVNode("span",dg,s.toDisplayString(s.unref(R).t("unsupported_time_range_badge")),1)]),_:1},8,["tooltip"])):s.createCommentVNode("",!0),oe.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(oe.value),1)]),_:2},[Le.value?{name:"icon",fn:s.withCtx(()=>[s.createVNode(s.unref(ie.WarningIcon),{size:`var(--kui-icon-size-20, ${s.unref(Bi)})`},null,8,["size"])]),key:"0"}:void 0]),1032,["tooltip"])):s.createCommentVNode("",!0)]),V.value?(s.openBlock(),s.createElementBlock("div",fg,[s.createVNode(s.unref(Gn.KSegmentedControl),{modelValue:j.value,"onUpdate:modelValue":J[0]||(J[0]=si=>j.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(ie.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(ie.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),W.value?(s.openBlock(),s.createElementBlock("div",{key:3,class:"tile-actions","data-testid":`tile-actions-${n.tileId}`},[W.value&&n.context.editable&&!n.isFullscreen?(s.openBlock(),s.createBlock(s.unref(ie.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),W.value&&Q.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(w)?(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(w)}},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:Oe},{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,_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(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",yg,s.toDisplayString(s.unref(R).t("renderer.delete")),1)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0)]),default:s.withCtx(()=>[s.createVNode(s.unref(ie.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),D.value?(s.openBlock(),s.createBlock(ln,{key:4,"data-testid":`csv-export-modal-${n.tileId}`,"export-state":C.value,filename:I.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}-${v.value.type}`]),"data-testid":`tile-content-${n.tileId}`},[Y.value?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(Y.value.component),s.mergeProps({key:0},Y.value.rendererProps,s.toHandlers(Z.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 ${}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=!!$.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){$.dragElement&&n.pointerType!=="mouse"&&Mn(n,"mouseenter")}function zn(n){$.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 rt 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),$.overResizeElement===this&&delete $.overResizeElement),this}_mouseOver(e){$.overResizeElement||$.dragElement||($.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){$.overResizeElement===this&&(delete $.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=rt._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 rt._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}}rt._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const Eg='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class st 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(!$.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 $.dragElement,delete $.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(),$.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),$.pauseDrag){const i=Number.isInteger($.pauseDrag)?$.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,$.dragElement=this;const i=this.el.gridstackNode?.grid;i?$.dropElement=i.el.ddElement.ddDroppable:delete $.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),$.dropElement?.el===this.el.parentElement&&delete $.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),$.dropElement&&$.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete $.dragElement,delete $.dropElement,delete $.mouseHandled,e.preventDefault()}_keyEvent(e){const t=this.el.gridstackNode,i=t?.grid||$.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=st.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",st.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}}}}st.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(!$.dragElement||!this._canDrop($.dragElement.el))return;e.preventDefault(),e.stopPropagation(),$.dropElement&&$.dropElement!==this&&$.dropElement._mouseLeave(e,!0),$.dropElement=this;const t=y.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui($.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){if(!$.dragElement||$.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($.dragElement)),this.triggerEvent("dropout",i),$.dropElement===this&&(delete $.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($.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 st(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 rt(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,$.dragElement?$.dragElement.el:o.target,$.dragElement?$.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 H{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=H.getGridElement(t);return i?(i.gridstack||(i.gridstack=new H(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
+ 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"||(H.getGridElements(t).forEach(r=>{r.gridstack||(r.gridstack=new H(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")||H.addRemoveCB)&&(H.addRemoveCB?i=H.addRemoveCB(e,t,!0,!0):i=y.createDiv(["grid-stack",t.class],e)),H.init(t,i)}static registerEngine(e){H.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||H.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 R=p.el;R&&(p._removeDOM?(R&&R.remove(),delete p._removeDOM):this._writePosAttr(R,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&&!$.pauseDrag&&($.pauseDrag=!0),t.draggable?.pause!==void 0&&($.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:H.addRemoveCB?t=H.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,H.renderCB(i,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(t))):H.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),H.addRemoveCB?u=H.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,R=o.h+i.h,E=o.el.style;E.transition="none",this.update(o.el,{w:p,h:R}),setTimeout(()=>E.transition=null)}const f=o.subGrid=H.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=H.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=H.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=H.addRemoveCB;typeof t=="function"&&(H.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)||(H.addRemoveCB&&H.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?H.addRemoveCB=o:delete H.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=H.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?(H.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&&H.addRemoveCB&&H.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&&H.addRemoveCB&&H.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 H.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,H.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(H.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} '${H.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){H.resizeToContentCB?H.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return H.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 H.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&&($.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:(H.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:(H.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&&H._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),H._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||H.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)=>H._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>H._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,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(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),R=Math.round(o*.1);if(c=Math.min(c,R),u=Math.min(u,R),h=Math.min(h,p),f=Math.min(f,p),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 D=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(D/o),l.y=Math.round(k/a);const b=this._extraDragRow;if(this.engine.collide(r,l)){const O=this.getRow();let v=Math.max(0,l.y+r.h-O);this.opts.maxRow&&O+v>this.opts.maxRow&&(v=Math.max(0,this.opts.maxRow-O)),this._extraDragRow=v}else this._extraDragRow=0;if(this._extraDragRow!==b&&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,D=i.position.top+h;l.x=Math.round(C/o),l.y=Math.round(D/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&&H._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}}H.renderCB=(n,e)=>{n&&e?.content&&(n.textContent=e.content)},H.resizeToContentParent=".grid-stack-item-content",H.Utils=y,H.Engine=ke,H.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}},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(T=>[`${T.id}`,T])));let l=null,d=!1;const c=T=>`[data-id="${T}"]`,u=s.computed(()=>wg(i.tileHeight,i.tiles)),h=T=>!i.editable&&u.value[T.layout.position.row]==="auto",f=()=>i.editable?1:pt,p=parseInt(la,10)/2,R=s.ref(new Map),E=s.ref(!1),C=T=>E.value||h(T),D=s.computed(()=>Sg(i.tiles,u.value,R.value,{cellsPerRow:pt,columns:E.value?1:i.columns})),k=T=>i.editable?{id:`${T.id}`,x:T.layout.position.col,y:T.layout.position.row,w:T.layout.size.cols,h:T.layout.size.rows}:{id:`${T.id}`,...D.value.get(`${T.id}`)},b=()=>({margin:p,column:i.columns,cellHeight:i.tileHeight/f(),resizable:{handles:"se, sw"},handle:".tile-header",staticGrid:!i.editable,float:!i.editable}),O=T=>T.map(A=>{const K=a.value.get(`${A.el?.getAttribute("data-id")}`);if(K)return{...K,layout:{position:{col:Number(A.x),row:Number(A.y)},size:{...K.layout.size,cols:Number(A.w),rows:Number(A.h)}}}}).filter(A=>A!==void 0),v=(T,A)=>{l&&!d&&(O(A).forEach(N=>{a.value.set(`${N.id}`,N)}),r("update-tiles",Array.from(a.value.values())))},L=(T,A)=>{A.forEach(K=>{a.value.delete(`${K.el?.getAttribute("data-id")}`)}),r("update-tiles",Array.from(a.value.values()))},U=T=>o.value?.querySelector(`${c(T)} > .grid-stack-item-content > :first-child`),m=T=>Math.ceil((T+2*p)/(i.tileHeight/pt)),g=()=>{const T=new Map;i.tiles.filter(C).forEach(K=>{const N=U(K.id);N&&T.set(`${K.id}`,m(N.getBoundingClientRect().height))}),(T.size!==R.value.size||[...T].some(([K,N])=>R.value.get(K)!==N))&&(R.value=T)},_=new ResizeObserver(()=>window.requestAnimationFrame(g)),w=()=>{_.disconnect(),i.tiles.filter(C).forEach(T=>{const A=U(T.id);A&&_.observe(A)})},S=new ResizeObserver(([T])=>{E.value=!i.editable&&T.contentRect.width<=parseInt(oa,10)}),M=(T,A)=>{const K=T.x===A.x&&T.y===A.y,N=T.w===A.w&&T.h===A.h;return K&&N},z=()=>{if(!l)return;const T=new Set(i.tiles.map(N=>`${N.id}`)),A=new Map(l.engine.nodes.map(N=>[`${N.id}`,N]));A.forEach((N,B)=>{!T.has(B)&&N.el&&(l.removeWidget(N.el,!1,!1),a.value.delete(B))});const K=i.tiles.filter(N=>A.has(`${N.id}`)).map(k);d=!0,K.some(N=>!M(A.get(`${N.id}`),N))&&l.load(K,!1),d=!1,i.tiles.filter(N=>!A.has(`${N.id}`)).forEach(N=>{l.makeWidget(c(N.id),{...k(N),autoPosition:i.editable})}),w()};s.onMounted(()=>{o.value&&(l=H.init(b(),o.value),l.batchUpdate(),i.tiles.forEach(T=>l.makeWidget(c(T.id),k(T))),l.batchUpdate(!1),w(),S.observe(o.value),i.editable&&(l.on("change",v),l.on("added",v),l.on("removed",L)))}),s.onUnmounted(()=>{_.disconnect(),S.disconnect(),l&&l.destroy(!1)});const G=T=>{if(l&&o.value){const A=o.value.querySelector(c(T));A&&l.removeWidget(A)}};return s.watch(E,T=>l?.column(T?1:i.columns,"none")),s.watch(()=>[i.tiles.map(T=>[T.id,T.layout]),D.value],z,{deep:!0,flush:"post"}),s.watchEffect(()=>{i.tiles.forEach(T=>{a.value.set(`${T.id}`,T)})}),e({removeWidget:G}),(T,A)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"gridContainer",ref:o,class:"grid-stack"},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(i.tiles,K=>(s.openBlock(),s.createElementBlock("div",{key:K.id,"data-id":`${K.id}`,"data-testid":`grid-stack-item-${K.id}`},[s.createElementVNode("div",Ig,[s.renderSlot(T.$slots,"tile",{fitToContent:h(K),tile:K},void 0,!0)])],8,xg))),128))],512))}}),[["__scopeId","data-v-19985f86"]]),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=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(x=>({v8d17c1de:u.value})),n.context.disableCoordination!==!0){const x=ws();s.provide($i,x)}const i=t,r=s.useModel(n,"modelValue"),{i18n:o}=ae.useI18n(),a=s.ref(0),l=s.ref(null),d=s.ref(),c=s.ref(),u=s.ref("scale(1)"),h=new Set,f=s.inject(ve);f||(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")),ae.useRequestQueue();const{exportPdf:p,exportState:R}=ae.useExportPdf(c),E=x=>{h.add(x.id);const I=k.value.filter(Q=>!O(Q)).length;h.size>=I&&i("tiles-loaded",!0)},C=s.computed(()=>{const I=`renderer.trendRange.${P.value.type==="absolute"?"custom":P.value.time_range}`;return o.te(I)?o.t(I):""}),D=(x,I)=>{const Q=x.layout.position.row-I.layout.position.row;return Q!==0?Q:x.layout.position.col-I.layout.position.col},k=s.computed(()=>r.value.tiles.map(x=>{if(A.value&&!x.id&&console.warn("No id provided for tile. One will be generated automatically,","however tracking changes to this tile may not work as expected.",x),x.type==="slottable")return{layout:x.layout,type:x.type,id:x.id??crypto.randomUUID()};let I=x.definition;const Q=x.type??"chart",W=Ma(I,C.value);return W!==I.header_description&&(I={...I,header_description:W}),{layout:x.layout,meta:I,type:Q,id:x.id??crypto.randomUUID()}})),b=x=>{i("edit-tile",x)},O=x=>x.type==="slottable"?!0:x.meta?.chart.type==="slottable",v=x=>x.type==="slottable",L=x=>{if(x.type==="slottable")return x.id;const I=x.meta?.chart;return I&&v(I)?I.id:void 0},U=x=>{try{const I=kg(x);r.value.tiles.push(JSON.parse(JSON.stringify(I)))}catch(I){console.warn(I)}},m=x=>{l.value&&l.value.removeWidget(x.id),h.delete(x.id)},g=()=>{h.clear(),a.value++},_=x=>{const I=x.map(Q=>Q.type==="slottable"?{id:Q.id,type:Q.type,layout:Q.layout}:{id:Q.id,type:Q.type,layout:Q.layout,definition:Q.meta});r.value.tiles=I.sort(D)},w=async()=>{if(u.value="scale(1)",await s.nextTick(),c.value){const{availWidth:x,availHeight:I}=window.screen,{width:Q,height:W}=c.value.getBoundingClientRect(),se=Math.min(I/W,x/Q);u.value=`scale(${se})`}},S=()=>{d.value&&(document.fullscreenElement?document.exitFullscreen():d.value.requestFullscreen())},M=s.ref(!1),z=s.computed(()=>A.value&&!M.value),G=()=>{M.value=document.fullscreenElement!==null,M.value&&w()},T=s.computed(()=>r.value.preset_filters??[]),{editable:A,enrichedContext:K,queryReady:N,showTileActions:B,timeSpec:P}=ae.useDashboardContext({globalFilters:T,context:s.computed(()=>n.context),isFullscreen:M,preview:s.computed(()=>n.preview)});return e({refresh:g,toggleFullscreen:S,exportPdf:p,pdfExportState:R}),(x,I)=>{const Q=s.resolveComponent("KAlert");return s.openBlock(),s.createElementBlock("div",{ref_key:"dashboardContainer",ref:d,class:s.normalizeClass(["kong-ui-public-dashboard-renderer",{"is-fullscreen":M.value}]),onFullscreenchange:G},[s.createElementVNode("div",{ref_key:"layoutContainer",ref:c,class:"layout"},[s.unref(f)&&M.value?(s.openBlock(),s.createElementBlock("div",Ng,[s.renderSlot(x.$slots,"fullscreenHeader",{},void 0,!0)])):s.createCommentVNode("",!0),s.unref(f)?(s.openBlock(),s.createBlock(Dg,{key:`layout-${z.value}`,ref_key:"gridLayoutRef",ref:l,columns:r.value.columns,editable:z.value,"tile-height":r.value.tile_height,tiles:k.value,onUpdateTiles:_},{tile:s.withCtx(({tile:W,fitToContent:se})=>[O(W)?(s.openBlock(),s.createElementBlock("div",{key:0,class:s.normalizeClass(["tile-container slottable-tile",{"fit-to-content":se}])},[s.renderSlot(x.$slots,L(W),{},void 0,!0)],2)):(s.openBlock(),s.createBlock(Kn,{key:M.value?`${W.id}-tile`:`${W.id}-tile-fullscreen`,"refresh-counter":a.value,"onUpdate:refreshCounter":I[0]||(I[0]=ue=>a.value=ue),class:"tile-container",context:s.unref(K),definition:W.meta,"fit-to-content":se,height:W.layout.size.rows*(r.value.tile_height||s.unref(tt))+parseInt(s.unref(qi),10),"hide-actions":!s.unref(B),"is-fullscreen":M.value,preview:n.preview,"query-ready":s.unref(N),"tile-id":W.id,"tile-type":W.type,onDuplicateTile:ue=>U(W),onEditTile:ue=>b(W),onRemoveTile:ue=>m(W),onTileLoaded:ue=>E(W),onTileTimeRangeZoom:I[1]||(I[1]=ue=>i("tile-time-range-zoom",ue))},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"]))]),_:3},8,["columns","editable","tile-height","tiles"])):(s.openBlock(),s.createBlock(Q,{key:1,appearance:"danger"},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(o).t("renderer.noQueryBridge")),1)]),_:1}))],512)],34)}}}),[["__scopeId","data-v-1405a0d0"]]),Lg=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=b=>{a("tile-time-range-zoom",b)},d=b=>{a("chart-data",b)},c=b=>{a("tile-bounds-change",b)},{i18n:u}=ae.useI18n(),{enrichedContext:h,queryReady:f}=ae.useDashboardContext({globalFilters:s.toRef(()=>n.globalFilters),context:s.toRef(()=>n.context),preview:s.computed(()=>n.preview)}),p=s.computed(()=>De(n.definition)),R=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 C;s.onMounted(()=>{const b=i.value?.parentElement;b&&(E.value=b.getBoundingClientRect().height,C=new ResizeObserver(([O])=>{const{height:v}=O.contentRect;E.value=v}),C.observe(b))}),s.onUnmounted(()=>C?.disconnect());const D=s.ref(0);return e({refresh:()=>{D.value++},getExportData:()=>r.value?.getExportData()}),(b,O)=>{const v=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(v,{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":D.value,"onUpdate:refreshCounter":O[0]||(O[0]=L=>D.value=L),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)}}}),Ug=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},Kg=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}}},Mg=(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},Bg=(n,e)=>{if(e){const r=n.tiles.map(Kg);return{...n,tiles:r}}const t=n.tiles.map(Ug).filter(r=>r!==void 0),i=Mg(t,n.columns);return{...n,tiles:i}},zg=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:ee.COUNTRIES.length),l=s.computed(()=>{if(!t.query.filters?.find(({field:p,operator:R})=>p==="country_code"&&(R==="not_empty"||R==="empty"||R==="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"}));X.CELLS_PER_ROW=pt,X.CP_ID_TOKEN=Fi,X.CsvExportModal=ln,X.DASHBOARD_COLS=Bt,X.DEFAULT_TILE_HEIGHT=tt,X.DEFAULT_TILE_REFRESH_INTERVAL_MS=Vi,X.DashboardRenderer=Ag,X.DashboardTilePreview=Lg,X.ENTITY_ID_TOKEN=zt,X.FULLSCREEN_LONG_REFRESH_INTERVAL_MS=Xi,X.FULLSCREEN_SHORT_REFRESH_INTERVAL_MS=Yi,X.INJECT_DASHBOARD_COORDINATOR=$i,X.INJECT_QUERY_PROVIDER=ve,X.TIMEFRAME_TOKEN=Wi,X.configureAllowedDefinition=Bg,X.getTimeRangeDurationMs=$t,X.isTimeRangeUnsupported=Ft,X.isTreemapCompatible=ti,X.limitTimeRange=Wt,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})}));