@kong-ui-public/dashboard-renderer 9.0.1 → 9.0.3
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,14 +1,15 @@
|
|
|
1
|
-
(function(W,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("@kong-ui-public/table-data-grid"),require("@kong-ui-public/analytics-config-store"),require("@kong/kongponents"),require("@kong-ui-public/echarts"),require("axios"),require("@kong-ui-public/i18n"),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","@kong-ui-public/table-data-grid","@kong-ui-public/analytics-config-store","@kong/kongponents","@kong-ui-public/echarts","axios","@kong-ui-public/i18n","@kong-ui-public/analytics-geo-map"],s):(W=typeof globalThis<"u"?globalThis:W||self,s(W["kong-ui-public-dashboard-renderer"]={},W.Vue,W["kong-ui-public-analytics-utilities"],W.KongIcons,W["kong-ui-public-analytics-chart"],W.swrv,W["kong-ui-public-analytics-metric-provider"],W["kong-ui-public-table-data-grid"],W["kong-ui-public-analytics-config-store"],W.Kongponents,W["kong-ui-public-echarts"],W.axios,W["kong-ui-public-i18n"],W["kong-ui-public-analytics-geo-map"]))})(this,(function(W,s,j,Q,Se,$t,Ut,Wt,Me,yn,Gt,Pl,Vt,Yt){"use strict";function _n(){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,u=({chartUuid:d,timestamp:h=null,dimension:f=null,dimensionValue:g=null,metric:b=null})=>{n.value=d,e.value=h,t.value=f,i.value=g,r.value=b},c=({chartUuid:d})=>{n.value===d&&(n.value=null,e.value=null,t.value=null,i.value=null,r.value=null)};return{activate:u,activeChart:s.readonly(n),activeDimension:s.readonly(t),activeDimensionValue:s.readonly(i),activeMetric:s.readonly(r),activeTimestamp:s.readonly(e),deactivate:c,DIMENSION_DEBOUNCE_MS:o,METRIC_DEBOUNCE_MS:a,TIMESTAMP_DEBOUNCE_MS:l}}const bn=n=>{const e=n.length;let t=5381;for(let i=0;i<e;i++)t=t*33^n.charCodeAt(i);return t>>>0},wn="#0044f4",jt="#6c7489",vn="#d60027",xn="#ffc400",En="#bee2ff",Cn="#8fc1ff",kn="#5f9aff",Tn="#306fff",Rn="#b5ffee",Sn="#00fabe",Dn="#00d6a4",On="#00a17b",Nn="#007d60",Mn="#005944",In="#b5ffee",zn="#00fabe",An="#b5ffee",Ln="#00a17b",qn="#fff296",Pn="#ffe04b",Bn="#ffc400",Hn="#b37600",Fn="#995c00",$n="#804400",Un="#fff296",Wn="#ffe04b",Gn="#ffc2b3",Vn="#ff9877",Yn="#ff723c",jn="#f75008",Kn="#d13500",Qn="#a31f00",Xn="#ffc2b3",Zn="#ff9877",Jn="#ff723c",er="#f75008",tr="#d13500",ir="#a31f00",nr="#ffc2b3",rr="#ff9877",sr="#ff723c",or="#f75008",ar="#d13500",lr="#a31f00",cr="#ffc2b3",ur="#ff9877",dr="#ff723c",hr="#f75008",fr="#d13500",mr="#a31f00",pr="#ffc2b3",gr="#ff9877",yr="#ff723c",_r="#f75008",br="#d13500",wr="#ffabab",vr="#ff7272",xr="#ff3954",Er="#f50045",Cr="#d60027",kr="#ad000e",Tr="#ffabab",Rr="#ff7272",Sr="#ff3954",Dr="#f50045",Or="#d60027",Nr="#eefaff",Mr="#ecfffb",Ir="#fffce0",zr="#fff1ef",Ar="#ffe5e5",Lr="#5f9aff",qr="#00d6a4",Pr="#ffc400",Br="#ff723c",Hr="#ff3954",Fr={100:En,101:Cn,102:kn,103:Tn,200:Rn,201:Sn,202:Dn,203:On,204:Nn,205:Mn,206:In,207:zn,208:An,226:Ln,300:qn,301:Pn,302:Bn,303:Hn,304:Fn,305:$n,307:Un,308:Wn,400:Gn,401:Vn,402:Yn,403:jn,404:Kn,405:Qn,406:Xn,407:Zn,408:Jn,409:er,410:tr,411:ir,412:nr,413:rr,414:sr,415:or,416:ar,417:lr,418:cr,421:ur,422:dr,423:hr,424:fr,425:mr,426:pr,428:gr,429:yr,431:_r,451:br,500:wr,501:vr,502:xr,503:Er,504:Cr,505:kr,506:Tr,507:Rr,508:Sr,510:Dr,511:Or},$r={100:Nr,200:Mr,300:Ir,400:zr,500:Ar},Kt={"1XX":Lr,"2XX":qr,"3XX":Pr,"4XX":Br,"5XX":Hr},Ur={error:vn,warning:xn,empty:"#9DA99D",neutral:jt,____OTHER____:wn},Qt=["#0076F4","#00819D","#00A17B","#8A50FF","#FF3C99","#FF6D3C","#B3A100"],Xt=["#5485BA","#087D96","#3D8776","#7654BA","#A1406F","#BF5430","#B5A72C"],Wr=n=>bn(n),Zt=({discriminator:n,theme:e="light",customPalette:t=void 0})=>{const i=Math.abs(Math.floor(n));return t?t[i%t.length]:e==="dark"?Xt[i%Xt.length]:Qt[i%Qt.length]},Xe=({state:n})=>Ur[n]??jt,Gr=({statusCode:n})=>{const e=typeof n=="number"?n:Number.parseInt(n,10),t=`${e}`,i=`${Math.floor(e/100)*100}`;return Fr[t]??$r[i]??Xe({state:"neutral"})},Vr=({group:n})=>Kt[n]?Kt[n]:Xe({state:"neutral"}),Yr=({discriminator:n=void 0,state:e=void 0,dimension:t=void 0,dimensionValue:i=void 0,metric:r=void 0,customPalette:o=void 0})=>{let a="light";if(s.hasInjectionContext()&&(a=s.inject("app:konnectColorMode",s.computed(()=>"light")).value),n!==void 0)return Zt({discriminator:n,theme:a,customPalette:o});if(e!==void 0)return Xe({state:e});if(i&&["empty","____OTHER____"].includes(i))return Xe({state:i});if(t!==void 0&&i!==void 0){if(t==="status_code")return Gr({statusCode:i});if(t==="status_code_grouped")return Vr({group:i})}return t||i||r?Zt({discriminator:Wr(`${t??""}${i??""}${r??""}`),theme:a,customPalette:o}):Xe({state:"neutral"})},jr={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"}},Kr=(n,e,t)=>{let i;const r=jr[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 yt(n){return(e={})=>{const t=e.width?String(e.width):n.defaultWidth;return n.formats[t]||n.formats[n.defaultWidth]}}const Qr={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Xr={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Zr={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Jr={date:yt({formats:Qr,defaultWidth:"full"}),time:yt({formats:Xr,defaultWidth:"full"}),dateTime:yt({formats:Zr,defaultWidth:"full"})},es={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ts=(n,e,t,i)=>es[n];function Ze(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 is={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},ns={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},rs={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"]},ss={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"]},os={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"}},as={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"}},ls={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:Ze({values:is,defaultWidth:"wide"}),quarter:Ze({values:ns,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Ze({values:rs,defaultWidth:"wide"}),day:Ze({values:ss,defaultWidth:"wide"}),dayPeriod:Ze({values:os,defaultWidth:"wide",formattingValues:as,defaultFormattingWidth:"wide"})};function Je(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],u=Array.isArray(l)?us(l,h=>h.test(a)):cs(l,h=>h.test(a));let c;c=n.valueCallback?n.valueCallback(u):u,c=t.valueCallback?t.valueCallback(c):c;const d=e.slice(a.length);return{value:c,rest:d}}}function cs(n,e){for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&e(n[t]))return t}function us(n,e){for(let t=0;t<n.length;t++)if(e(n[t]))return t}function ds(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 hs=/^(\d+)(th|st|nd|rd)?/i,fs=/\d+/i,ms={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},ps={any:[/^b/i,/^(a|c)/i]},gs={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]},_s={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},bs={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]},ws={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},vs={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]},xs={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},Es={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}},Cs={ordinalNumber:ds({matchPattern:hs,parsePattern:fs,valueCallback:n=>parseInt(n,10)}),era:Je({matchPatterns:ms,defaultMatchWidth:"wide",parsePatterns:ps,defaultParseWidth:"any"}),quarter:Je({matchPatterns:gs,defaultMatchWidth:"wide",parsePatterns:ys,defaultParseWidth:"any",valueCallback:n=>n+1}),month:Je({matchPatterns:_s,defaultMatchWidth:"wide",parsePatterns:bs,defaultParseWidth:"any"}),day:Je({matchPatterns:ws,defaultMatchWidth:"wide",parsePatterns:vs,defaultParseWidth:"any"}),dayPeriod:Je({matchPatterns:xs,defaultMatchWidth:"any",parsePatterns:Es,defaultParseWidth:"any"})},ks={code:"en-US",formatDistance:Kr,formatLong:Jr,formatRelative:ts,localize:ls,match:Cs,options:{weekStartsOn:0,firstWeekContainsDate:1}};let Ts={};function et(){return Ts}const Jt=6048e5,Rs=864e5,ei=Symbol.for("constructDateFrom");function ze(n,e){return typeof n=="function"?n(e):n&&typeof n=="object"&&ei in n?n[ei](e):n instanceof Date?new n.constructor(e):new Date(e)}function Ce(n,e){return ze(e||n,n)}function ti(n){const e=Ce(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 Ss(n,...e){const t=ze.bind(null,e.find(i=>typeof i=="object"));return e.map(t)}function ii(n,e){const t=Ce(n,e?.in);return t.setHours(0,0,0,0),t}function Ds(n,e,t){const[i,r]=Ss(t?.in,n,e),o=ii(i),a=ii(r),l=+o-ti(o),u=+a-ti(a);return Math.round((l-u)/Rs)}function Os(n,e){const t=Ce(n,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function Ns(n,e){const t=Ce(n,e?.in);return Ds(t,Os(t))+1}function tt(n,e){const t=et(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,r=Ce(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 rt(n,e){return tt(n,{...e,weekStartsOn:1})}function ni(n,e){const t=Ce(n,e?.in),i=t.getFullYear(),r=ze(t,0);r.setFullYear(i+1,0,4),r.setHours(0,0,0,0);const o=rt(r),a=ze(t,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const l=rt(a);return t.getTime()>=o.getTime()?i+1:t.getTime()>=l.getTime()?i:i-1}function Ms(n,e){const t=ni(n,e),i=ze(n,0);return i.setFullYear(t,0,4),i.setHours(0,0,0,0),rt(i)}function Is(n,e){const t=Ce(n,e?.in),i=+rt(t)-+Ms(t);return Math.round(i/Jt)+1}function ri(n,e){const t=Ce(n,e?.in),i=t.getFullYear(),r=et(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=ze(e?.in||n,0);a.setFullYear(i+1,0,o),a.setHours(0,0,0,0);const l=tt(a,e),u=ze(e?.in||n,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 zs(n,e){const t=et(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,r=ri(n,e),o=ze(e?.in||n,0);return o.setFullYear(r,0,i),o.setHours(0,0,0,0),tt(o,e)}function As(n,e){const t=Ce(n,e?.in),i=+tt(t,e)-+zs(t,e);return Math.round(i/Jt)+1}function Z(n,e){const t=n<0?"-":"",i=Math.abs(n).toString().padStart(e,"0");return t+i}const Ae={y(n,e){const t=n.getFullYear(),i=t>0?t:1-t;return Z(e==="yy"?i%100:i,e.length)},M(n,e){const t=n.getMonth();return e==="M"?String(t+1):Z(t+1,2)},d(n,e){return Z(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 Z(n.getHours()%12||12,e.length)},H(n,e){return Z(n.getHours(),e.length)},m(n,e){return Z(n.getMinutes(),e.length)},s(n,e){return Z(n.getSeconds(),e.length)},S(n,e){const t=e.length,i=n.getMilliseconds(),r=Math.trunc(i*Math.pow(10,t-3));return Z(r,e.length)}},Ge={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},si={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 Ae.y(n,e)},Y:function(n,e,t,i){const r=ri(n,i),o=r>0?r:1-r;if(e==="YY"){const a=o%100;return Z(a,2)}return e==="Yo"?t.ordinalNumber(o,{unit:"year"}):Z(o,e.length)},R:function(n,e){const t=ni(n);return Z(t,e.length)},u:function(n,e){const t=n.getFullYear();return Z(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 Z(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 Z(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 Ae.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 Z(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=As(n,i);return e==="wo"?t.ordinalNumber(r,{unit:"week"}):Z(r,e.length)},I:function(n,e,t){const i=Is(n);return e==="Io"?t.ordinalNumber(i,{unit:"week"}):Z(i,e.length)},d:function(n,e,t){return e==="do"?t.ordinalNumber(n.getDate(),{unit:"date"}):Ae.d(n,e)},D:function(n,e,t){const i=Ns(n);return e==="Do"?t.ordinalNumber(i,{unit:"dayOfYear"}):Z(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 Z(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 Z(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 Z(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=Ge.noon:i===0?r=Ge.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=Ge.evening:i>=12?r=Ge.afternoon:i>=4?r=Ge.morning:r=Ge.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 Ae.h(n,e)},H:function(n,e,t){return e==="Ho"?t.ordinalNumber(n.getHours(),{unit:"hour"}):Ae.H(n,e)},K:function(n,e,t){const i=n.getHours()%12;return e==="Ko"?t.ordinalNumber(i,{unit:"hour"}):Z(i,e.length)},k:function(n,e,t){let i=n.getHours();return i===0&&(i=24),e==="ko"?t.ordinalNumber(i,{unit:"hour"}):Z(i,e.length)},m:function(n,e,t){return e==="mo"?t.ordinalNumber(n.getMinutes(),{unit:"minute"}):Ae.m(n,e)},s:function(n,e,t){return e==="so"?t.ordinalNumber(n.getSeconds(),{unit:"second"}):Ae.s(n,e)},S:function(n,e){return Ae.S(n,e)},X:function(n,e,t){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return ai(i);case"XXXX":case"XX":return He(i);default:return He(i,":")}},x:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"x":return ai(i);case"xxxx":case"xx":return He(i);default:return He(i,":")}},O:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+oi(i,":");default:return"GMT"+He(i,":")}},z:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+oi(i,":");default:return"GMT"+He(i,":")}},t:function(n,e,t){const i=Math.trunc(+n/1e3);return Z(i,e.length)},T:function(n,e,t){return Z(+n,e.length)}};function oi(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+Z(o,2)}function ai(n,e){return n%60===0?(n>0?"-":"+")+Z(Math.abs(n)/60,2):He(n,e)}function He(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),r=Z(Math.trunc(i/60),2),o=Z(i%60,2);return t+r+e+o}const li=(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"})}},ci=(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"})}},Ls={p:ci,P:(n,e)=>{const t=n.match(/(P+)(p+)?/)||[],i=t[1],r=t[2];if(!r)return li(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}}",li(i,e)).replace("{{time}}",ci(r,e))}},qs=/^D+$/,Ps=/^Y+$/,Bs=["D","DD","YY","YYYY"];function Hs(n){return qs.test(n)}function Fs(n){return Ps.test(n)}function $s(n,e,t){const i=Us(n,e,t);if(console.warn(i),Bs.includes(n))throw new RangeError(i)}function Us(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 Ws(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function Gs(n){return!(!Ws(n)&&typeof n!="number"||isNaN(+Ce(n)))}const Vs=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ys=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,js=/^'([^]*?)'?$/,Ks=/''/g,Qs=/[a-zA-Z]/;function _t(n,e,t){const i=et(),r=t?.locale??i.locale??ks,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=Ce(n,t?.in);if(!Gs(l))throw new RangeError("Invalid time value");let u=e.match(Ys).map(d=>{const h=d[0];if(h==="p"||h==="P"){const f=Ls[h];return f(d,r.formatLong)}return d}).join("").match(Vs).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const h=d[0];if(h==="'")return{isToken:!1,value:Xs(d)};if(si[h])return{isToken:!0,value:d};if(h.match(Qs))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:d}});r.localize.preprocessor&&(u=r.localize.preprocessor(l,u));const c={firstWeekContainsDate:o,weekStartsOn:a,locale:r};return u.map(d=>{if(!d.isToken)return d.value;const h=d.value;(!t?.useAdditionalWeekYearTokens&&Fs(h)||!t?.useAdditionalDayOfYearTokens&&Hs(h))&&$s(h,e,String(n));const f=si[h[0]];return f(l,h,r.localize,c)}).join("")}function Xs(n){const e=n.match(js);return e?e[1].replace(Ks,"'"):n}function Zs(){return Object.assign({},et())}function ui(n,e,t){const i=Zs(),r=to(n,t.timeZone,t.locale??i.locale);return"formatToParts"in r?Js(r,e):eo(r,e)}function Js(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 eo(n,e){const t=n.format(e).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(t);return i?i[0].substr(1):""}function to(n,e,t){return new Intl.DateTimeFormat(t?[t.code,"en-US"]:void 0,{timeZone:e,timeZoneName:n})}function io(n,e){const t=ao(e);return"formatToParts"in t?ro(t,n):so(t,n)}const no={year:0,month:1,day:2,hour:3,minute:4,second:5};function ro(n,e){try{const t=n.formatToParts(e),i=[];for(let r=0;r<t.length;r++){const o=no[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 so(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 bt={},di=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")),oo=di==="06/25/2014, 00:00:00"||di==="06/25/2014 00:00:00";function ao(n){return bt[n]||(bt[n]=oo?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"})),bt[n]}function hi(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 fi=36e5,lo=6e4,wt={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function mi(n,e,t){if(!n)return 0;let i=wt.timezoneZ.exec(n);if(i)return 0;let r,o;if(i=wt.timezoneHH.exec(n),i)return r=parseInt(i[1],10),pi(r)?-(r*fi):NaN;if(i=wt.timezoneHHMM.exec(n),i){r=parseInt(i[2],10);const a=parseInt(i[3],10);return pi(r,a)?(o=Math.abs(r)*fi+a*lo,i[1]==="+"?-o:o):NaN}if(ho(n)){e=new Date(e||Date.now());const a=t?e:co(e),l=vt(a,n);return-(t?l:uo(e,l,n))}return NaN}function co(n){return hi(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())}function vt(n,e){const t=io(n,e),i=hi(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 uo(n,e,t){let r=n.getTime()-e;const o=vt(new Date(r),t);if(e===o)return e;r-=o-e;const a=vt(new Date(r),t);return o===a?o:Math.max(o,a)}function pi(n,e){return-23<=n&&n<=23&&(e==null||0<=e&&e<=59)}const gi={};function ho(n){if(gi[n])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:n}),gi[n]=!0,!0}catch{return!1}}const fo=60*1e3,mo={X:function(n,e,t){const i=xt(t.timeZone,n);if(i===0)return"Z";switch(e){case"X":return yi(i);case"XXXX":case"XX":return Ve(i);default:return Ve(i,":")}},x:function(n,e,t){const i=xt(t.timeZone,n);switch(e){case"x":return yi(i);case"xxxx":case"xx":return Ve(i);default:return Ve(i,":")}},O:function(n,e,t){const i=xt(t.timeZone,n);switch(e){case"O":case"OO":case"OOO":return"GMT"+po(i,":");default:return"GMT"+Ve(i,":")}},z:function(n,e,t){switch(e){case"z":case"zz":case"zzz":return ui("short",n,t);default:return ui("long",n,t)}}};function xt(n,e){const t=n?mi(n,e,!0)/fo:e?.getTimezoneOffset()??0;if(Number.isNaN(t))throw new RangeError("Invalid time zone specified: "+n);return t}function st(n,e){const t=n<0?"-":"";let i=Math.abs(n).toString();for(;i.length<e;)i="0"+i;return t+i}function Ve(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),r=st(Math.floor(i/60),2),o=st(Math.floor(i%60),2);return t+r+e+o}function yi(n,e){return n%60===0?(n>0?"-":"+")+st(Math.abs(n)/60,2):Ve(n,e)}function po(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+st(o,2)}function _i(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 go=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Et=36e5,bi=6e4,yo=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:go};function _o(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?yo: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=bo(n),{year:r,restDateString:o}=wo(i.date,t),a=vo(o,r);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const l=a.getTime();let u=0,c;if(i.time&&(u=xo(i.time),u===null||isNaN(u)))return new Date(NaN);if(i.timeZone||e.timeZone){if(c=mi(i.timeZone||e.timeZone,new Date(l+u)),isNaN(c))return new Date(NaN)}else c=_i(new Date(l+u)),c=_i(new Date(l+u+c));return new Date(l+u+c)}else return new Date(NaN)}function bo(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 wo(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 vo(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,xi(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 ko(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 xi(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,Ei(r)?wi(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 Ei(r,a)?wi(e,r,a):new Date(NaN)}return null}function xo(n){let e,t,i=ge.HH.exec(n);if(i)return e=parseFloat(i[1].replace(",",".")),Ct(e)?e%24*Et:NaN;if(i=ge.HHMM.exec(n),i)return e=parseInt(i[1],10),t=parseFloat(i[2].replace(",",".")),Ct(e,t)?e%24*Et+t*bi: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 Ct(e,t,r)?e%24*Et+t*bi+r*1e3:NaN}return null}function wi(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 Eo=[31,28,31,30,31,30,31,31,30,31,30,31],Co=[31,29,31,30,31,30,31,31,30,31,30,31];function vi(n){return n%400===0||n%4===0&&n%100!==0}function xi(n,e,t){if(e<0||e>11)return!1;if(t!=null){if(t<1)return!1;const i=vi(n);if(i&&t>Co[e]||!i&&t>Eo[e])return!1}return!0}function ko(n,e){if(e<1)return!1;const t=vi(n);return!(t&&e>366||!t&&e>365)}function Ei(n,e){return!(n<0||n>52||e!=null&&(e<0||e>6))}function Ct(n,e,t){return!(n<0||n>=25||e!=null&&(e<0||e>=60)||t!=null&&(t<0||t>=60))}const To=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Ci(n,e,t={}){e=String(e);const i=e.match(To);if(i){const r=_o(t.originalDate||n,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,"'"+mo[a[0]](r,a,t)+"'");return u?c.substring(0,l-1)+c.substring(l+1):c},e)}return _t(n,e,t)}const kt="#6c7489",ki="12px",Ro="16px",Ti="20px",Ri="32px",Si="20px";var ot=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function So(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var at={exports:{}},Do=at.exports,Di;function Oo(){return Di||(Di=1,(function(n,e){(function(t,i){i()})(Do,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 r(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 ot=="object"&&ot.global===ot?ot: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,g=document.createElement("a");d=d||c.name||"download",g.download=d,g.rel="noopener",typeof c=="string"?(g.href=c,g.origin===location.origin?o(g):r(g.href)?i(c,d,h):o(g,g.target="_blank")):(g.href=f.createObjectURL(c),setTimeout(function(){f.revokeObjectURL(g.href)},4e4),setTimeout(function(){o(g)},0))}:"msSaveOrOpenBlob"in navigator?function(c,d,h){if(d=d||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(t(c,h),d);else if(r(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 g=c.type==="application/octet-stream",b=/constructor/i.test(a.HTMLElement)||a.safari,E=/CriOS\/[\d]+/.test(navigator.userAgent);if((E||g&&b||l)&&typeof FileReader<"u"){var w=new FileReader;w.onloadend=function(){var v=w.result;v=E?v:v.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=v:location=v,f=null},w.readAsDataURL(c)}else{var O=a.URL||a.webkitURL,N=O.createObjectURL(c);f?f.location=N:location.href=N,f=null,setTimeout(function(){O.revokeObjectURL(N)},4e4)}});a.saveAs=u.saveAs=u,n.exports=u})})(at)),at.exports}var No=Oo(),lt={exports:{}};var Mo=lt.exports,Oi;function Io(){return Oi||(Oi=1,(function(n,e){((t,i)=>{n.exports=i()})(Mo,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,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(m){var _=k(m);_.chunkSize=parseInt(_.chunkSize),m.step||m.chunk||(_.chunkSize=null),this._handle=new E(_),(this._handle.streamer=this)._config=_}).call(this,p),this.parseChunk=function(m,_){var R=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<R){let z=this._config.newline;z||(S=this._config.quoteChar||'"',z=this._handle.guessLineEndings(m,S)),m=[...m.split(z).slice(R)].join(z)}this.isFirstChunk&&H(this._config.beforeFirstChunk)&&(S=this._config.beforeFirstChunk(m))!==void 0&&(m=S),this.isFirstChunk=!1,this._halted=!1;var R=this._partialLine+m,S=(this._partialLine="",this._handle.parse(R,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(m=S.meta.cursor,R=(this._finished||(this._partialLine=R.substring(m-this._baseIndex),this._baseIndex=m),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:R});else if(H(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||!R||!H(this._config.complete)||S&&S.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),R||S&&S.meta.paused||this._nextChunk(),S}this._halted=!0},this._sendError=function(m){H(this._config.error)?this._config.error(m):o&&this._config.error&&i.postMessage({workerId:u.WORKER_ID,error:m,finished:!1})}}function h(p){var m;(p=p||{}).chunkSize||(p.chunkSize=u.RemoteChunkSize),d.call(this,p),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(m=new XMLHttpRequest,this._config.withCredentials&&(m.withCredentials=this._config.withCredentials),r||(m.onload=A(this._chunkLoaded,this),m.onerror=A(this._chunkError,this)),m.ontimeout=A(this._chunkTimeout,this),m.open(this._config.downloadRequestBody?"POST":"GET",this._input,!r),this._config.downloadTimeout&&!r&&(m.timeout=this._config.downloadTimeout),this._config.downloadRequestHeaders){var _,R=this._config.downloadRequestHeaders;for(_ in R)m.setRequestHeader(_,R[_])}var S;this._config.chunkSize&&(S=this._start+this._config.chunkSize-1,m.setRequestHeader("Range","bytes="+this._start+"-"+S));try{m.send(this._config.downloadRequestBody)}catch(z){this._chunkError(z.message)}r&&m.status===0&&this._chunkError()}},this._chunkLoaded=function(){m.readyState===4&&(m.status<200||400<=m.status?this._chunkError():(this._start+=this._config.chunkSize||m.responseText.length,this._finished=!this._config.chunkSize||this._start>=(_=>(_=_.getResponseHeader("Content-Range"))!==null?parseInt(_.substring(_.lastIndexOf("/")+1)):-1)(m),this.parseChunk(m.responseText)))},this._chunkError=function(_){_=m.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 m,_,R=typeof FileReader<"u";this.stream=function(S){this._input=S,_=S.slice||S.webkitSlice||S.mozSlice,R?((m=new FileReader).onload=A(this._chunkLoaded,this),m.onerror=A(this._chunkError,this)):m=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,z=(this._config.chunkSize&&(z=Math.min(this._start+this._config.chunkSize,this._input.size),S=_.call(S,this._start,z)),m.readAsText(S,this._config.encoding));R||this._chunkLoaded({target:{result:z}})},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(m.error)}}function g(p){var m;d.call(this,p=p||{}),this.stream=function(_){return m=_,this._nextChunk()},this._nextChunk=function(){var _,R;if(!this._finished)return _=this._config.chunkSize,m=_?(R=m.substring(0,_),m.substring(_)):(R=m,""),this._finished=!m,this.parseChunk(R)}}function b(p){d.call(this,p=p||{});var m=[],_=!0,R=!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(){R&&m.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),m.length?this.parseChunk(m.shift()):_=!0},this._streamData=A(function(S){try{m.push(typeof S=="string"?S:S.toString(this._config.encoding)),_&&(_=!1,this._checkIsFinished(),this.parseChunk(m.shift()))}catch(z){this._streamError(z)}},this),this._streamError=A(function(S){this._streamCleanUp(),this._sendError(S)},this),this._streamEnd=A(function(){this._streamCleanUp(),R=!0,this._streamData("")},this),this._streamCleanUp=A(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function E(p){var m,_,R,S,z=Math.pow(2,53),ne=-z,he=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,fe=/^((\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)))$/,J=this,se=0,P=0,te=!1,C=!1,D=[],T={data:[],errors:[],meta:{}};function G(F){return p.skipEmptyLines==="greedy"?F.join("").trim()==="":F.length===1&&F[0].length===0}function X(){if(T&&R&&(ue("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),R=!1),p.skipEmptyLines&&(T.data=T.data.filter(function(q){return!G(q)})),K()){let q=function(oe){D.push(oe)};if(T)if(Array.isArray(T.data[0])){for(var F=0;K()&&F<T.data.length;F++)T.data[F].forEach(q);T.data.splice(0,1)}else T.data.forEach(q)}function $(q,oe){for(var le=p.header?{}:[],V=0;V<q.length;V++){var ee=V,U=q[V],U=((be,B)=>(ie=>(p.dynamicTypingFunction&&p.dynamicTyping[ie]===void 0&&(p.dynamicTyping[ie]=p.dynamicTypingFunction(ie)),(p.dynamicTyping[ie]||p.dynamicTyping)===!0))(be)?B==="true"||B==="TRUE"||B!=="false"&&B!=="FALSE"&&((ie=>{if(he.test(ie)&&(ie=parseFloat(ie),ne<ie&&ie<z))return 1})(B)?parseFloat(B):fe.test(B)?new Date(B):B===""?null:B):B)(ee=p.header?V>=D.length?"__parsed_extra":D[V]:ee,U=p.transform?p.transform(U,ee):U);ee==="__parsed_extra"?(le[ee]=le[ee]||[],le[ee].push(U)):le[ee]=U}return p.header&&(V>D.length?ue("FieldMismatch","TooManyFields","Too many fields: expected "+D.length+" fields but parsed "+V,P+oe):V<D.length&&ue("FieldMismatch","TooFewFields","Too few fields: expected "+D.length+" fields but parsed "+V,P+oe)),le}var re;T&&(p.header||p.dynamicTyping||p.transform)&&(re=1,!T.data.length||Array.isArray(T.data[0])?(T.data=T.data.map($),re=T.data.length):T.data=$(T.data,0),p.header&&T.meta&&(T.meta.fields=D),P+=re)}function K(){return p.header&&D.length===0}function ue(F,$,re,q){F={type:F,code:$,message:re},q!==void 0&&(F.row=q),T.errors.push(F)}H(p.step)&&(S=p.step,p.step=function(F){T=F,K()?X():(X(),T.data.length!==0&&(se+=F.data.length,p.preview&&se>p.preview?_.abort():(T.data=T.data[0],S(T,J))))}),this.parse=function(F,$,re){var q=p.quoteChar||'"',q=(p.newline||(p.newline=this.guessLineEndings(F,q)),R=!1,p.delimiter?H(p.delimiter)&&(p.delimiter=p.delimiter(F),T.meta.delimiter=p.delimiter):((q=((oe,le,V,ee,U)=>{var be,B,ie,Ie;U=U||[","," ","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var qe=0;qe<U.length;qe++){for(var ve,Fe=U[qe],de=0,xe=0,ce=0,pe=(ie=void 0,new O({comments:ee,delimiter:Fe,newline:le,preview:10}).parse(oe)),Re=0;Re<pe.data.length;Re++)V&&G(pe.data[Re])?ce++:(ve=pe.data[Re].length,xe+=ve,ie===void 0?ie=ve:0<ve&&(de+=Math.abs(ve-ie),ie=ve));0<pe.data.length&&(xe/=pe.data.length-ce),1.99<xe&&(B===void 0||de<B||de===B&&Ie<xe)&&(B=de,be=Fe,Ie=xe)}return{successful:!!(p.delimiter=be),bestDelimiter:be}})(F,p.newline,p.skipEmptyLines,p.comments,p.delimitersToGuess)).successful?p.delimiter=q.bestDelimiter:(R=!0,p.delimiter=u.DefaultDelimiter),T.meta.delimiter=p.delimiter),k(p));return q.header=K(),p.preview&&p.header&&q.preview++,m=F,_=new O(q),T=_.parse(m,$,re),X(),te?{meta:{paused:!0}}:T||{meta:{paused:!1}}},this.paused=function(){return te},this.pause=function(){te=!0,_.abort(),m=H(p.chunk)?"":m.substring(_.getCharIndex())},this.resume=function(){J.streamer._halted?(te=!1,J.streamer.parseChunk(m,!0)):setTimeout(J.resume,3)},this.aborted=function(){return C},this.abort=function(){C=!0,_.abort(),T.meta.aborted=!0,H(p.complete)&&p.complete(T),m=""},this.guessLineEndings=function(oe,q){oe=oe.substring(0,1048576);var q=new RegExp(w(q)+"([^]*?)"+w(q),"gm"),re=(oe=oe.replace(q,"")).split("\r"),q=oe.split(`
|
|
2
|
-
`),
|
|
3
|
-
`;for(var
|
|
4
|
-
`&&
|
|
5
|
-
`:"\r"}}function
|
|
6
|
-
`&&
|
|
7
|
-
`&&(
|
|
8
|
-
`);var
|
|
9
|
-
`,
|
|
10
|
-
`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!
|
|
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});No.saveAs(h,i.filename)}};return(d,h)=>(s.openBlock(),s.createElementBlock("div",{id:r.value,"data-testid":"export-csv",onClick:c},[s.renderSlot(d.$slots,"default",{},()=>[s.createTextVNode("Download "+s.toDisplayString(n.filename),1)])],8,Ao))}}),qo=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(Lo,{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"])]))}}),Ni={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_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 Tt(){const n=Vt.createI18n("en-us",Ni);return{i18n:n,i18nT:Vt.i18nTComponent(n)}}const je=170,ct=6,ke="analytics-query-provider",Mi="analytics-dashboard-coordinator",Rt="{entity-id}",Ii="{cp-id}",zi="{timeframe}",Ai=30*1e3,Li=3e5,qi=36e5;function Po(){const n=s.inject(ke);return{evaluateFeatureFlag:(t,i)=>typeof n?.evaluateFeatureFlagFn!="function"?i:n.evaluateFeatureFlagFn(t,i)}}var St={exports:{}},Pi;function Bo(){return Pi||(Pi=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(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 g=new r(d,h||u,f),b=t?t+c:c;return u._events[b]?u._events[b].fn?u._events[b]=[u._events[b],g]:u._events[b].push(g):(u._events[b]=g,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,g=h.length,b=new Array(g);f<g;f++)b[f]=h[f].fn;return b},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,g,b){var E=t?t+c:c;if(!this._events[E])return!1;var w=this._events[E],O=arguments.length,N,v;if(w.fn){switch(w.once&&this.removeListener(c,w.fn,void 0,!0),O){case 1:return w.fn.call(w.context),!0;case 2:return w.fn.call(w.context,d),!0;case 3:return w.fn.call(w.context,d,h),!0;case 4:return w.fn.call(w.context,d,h,f),!0;case 5:return w.fn.call(w.context,d,h,f,g),!0;case 6:return w.fn.call(w.context,d,h,f,g,b),!0}for(v=1,N=new Array(O-1);v<O;v++)N[v-1]=arguments[v];w.fn.apply(w.context,N)}else{var x=w.length,k;for(v=0;v<x;v++)switch(w[v].once&&this.removeListener(c,w[v].fn,void 0,!0),O){case 1:w[v].fn.call(w[v].context);break;case 2:w[v].fn.call(w[v].context,d);break;case 3:w[v].fn.call(w[v].context,d,h);break;case 4:w[v].fn.call(w[v].context,d,h,f);break;default:if(!N)for(k=1,N=new Array(O-1);k<O;k++)N[k-1]=arguments[k];w[v].fn.apply(w[v].context,N)}}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 g=t?t+c:c;if(!this._events[g])return this;if(!d)return a(this,g),this;var b=this._events[g];if(b.fn)b.fn===d&&(!f||b.once)&&(!h||b.context===h)&&a(this,g);else{for(var E=0,w=[],O=b.length;E<O;E++)(b[E].fn!==d||f&&!b[E].once||h&&b[E].context!==h)&&w.push(b[E]);w.length?this._events[g]=w.length===1?w[0]:w:a(this,g)}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,n.exports=l})(St)),St.exports}var Ho=Bo();const Fo=So(Ho);class Dt extends Error{name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,Dt)}}const Bi=n=>n.reason??new DOMException("This operation was aborted.","AbortError");function $o(n,e){const{milliseconds:t,fallback:i,message:r,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(Bi(a));return}if(a&&(u=()=>{f(Bi(a))},a.addEventListener("abort",u,{once:!0})),n.then(h,f),t===Number.POSITIVE_INFINITY)return;const g=new Dt;l=o.setTimeout.call(void 0,()=>{if(i){try{h(i())}catch(b){f(b)}return}typeof n.cancel=="function"&&n.cancel(),r===!1?h():r instanceof Error?f(r):(g.message=r??`Promise timed out after ${t} milliseconds`,f(g))},t)}).finally(()=>{d.clear(),u&&a&&a.removeEventListener("abort",u)});return d.clear=()=>{o.clearTimeout.call(void 0,l),l=void 0},d}function Uo(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 Wo=100;class Hi{#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=Uo(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[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>Wo&&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 Go extends Fo{#t;#e;#s=0;#f;#p=!1;#b=!1;#c;#w=0;#l;#u;#a;#o=[];#r=0;#i;#T;#n=0;#g;#d;#M=1n;#y=new Map;#v=new Set;timeout;constructor(e){if(super(),e={carryoverIntervalCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:Hi,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.#T=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.#H()}#x(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)}#I(e){this.#a?this.#o.push(e):this.#s++}#z(){this.#a?this.#o.length>this.#r&&this.#o.pop():this.#s>0&&this.#s--}#E(){return this.#o.length-this.#r}get#A(){return this.#e?!0:this.#a?this.#E()<this.#f:this.#s<this.#f}get#L(){return this.#n<this.#g}#q(){this.#n--,this.#n===0&&this.emit("pendingZero"),this.#_(),this.emit("next")}#P(){this.#u=void 0,this.#O(),this.#D()}#B(e){if(this.#a){if(this.#x(e),this.#E()>=this.#f){const i=this.#o[this.#r],r=this.#c-(e-i);return this.#R(r),!0}return!1}if(this.#l===void 0){const t=this.#w-e;if(t<0)this.#s=this.#t?this.#n:0;else return this.#R(t),!0}return!1}#R(e){this.#u===void 0&&(this.#u=setTimeout(()=>{this.#P()},e))}#C(){this.#l&&(clearInterval(this.#l),this.#l=void 0)}#S(){this.#u&&(clearTimeout(this.#u),this.#u=void 0)}#_(){if(this.#i.size===0){if(this.#C(),this.emit("empty"),this.#n===0){if(this.#S(),this.#a&&this.#r>0){const t=Date.now();this.#x(t)}this.emit("idle")}return!1}let e=!1;if(!this.#d){const t=Date.now(),i=!this.#B(t);if(this.#A&&this.#L){const r=this.#i.dequeue();this.#e||(this.#I(t),this.#m()),i&&this.#D(),this.emit("active"),r(),e=!0}}return e}#D(){this.#e||this.#l!==void 0||this.#a||(this.#l=setInterval(()=>{this.#O()},this.#c),this.#w=Date.now()+this.#c)}#O(){this.#a||(this.#l!==void 0&&(this.#s===0&&this.#n===0?this.#C():this.#w=Date.now()+this.#c),this.#s=this.#t?this.#n:0),this.#k(),this.#m()}#k(){for(;this.#_(););}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.#k()}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.#M++).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.#y.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.#F(),this.#y.delete(o),f}let d=e({signal:t.signal});if(t.timeout!==void 0&&(d=$o(Promise.resolve(d),{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;d=Promise.race([d,new Promise((g,b)=>{c=()=>{b(f.reason)},f.addEventListener("abort",c,{once:!0})})])}const h=await d;i(h),this.emit("completed",h)}catch(d){r(d),this.emit("error",d)}finally{c&&t.signal?.removeEventListener("abort",c),this.#y.delete(o),queueMicrotask(()=>{this.#q()})}};this.#i.enqueue(l,t);const u=()=>{if(this.#i instanceof Hi){this.#i.remove(l);return}this.#i.remove?.(t.id)};if(t.signal){const{signal:c}=t,d=()=>{a(),u(),r(c.reason),this.#_(),this.emit("next")};if(a=()=>{c.removeEventListener("abort",d),this.#v.delete(a)},c.aborted){d();return}c.addEventListener("abort",d,{once:!0}),this.#v.add(a)}this.emit("add"),this.#_()})}async addAll(e,t){return Promise.all(e.map(async i=>this.add(i,t)))}start(){return this.#d?(this.#d=!1,this.#k(),this):this}pause(){this.#d=!0}clear(){for(const e of this.#v)e();this.#i=new this.#T,this.#C(),this.#N(),this.emit("empty"),this.#n===0&&(this.#S(),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}#H(){this.#e||(this.on("add",()=>{this.#i.size>0&&this.#m()}),this.on("next",()=>{this.#m()}))}#m(){this.#e||this.#b||(this.#b=!0,queueMicrotask(()=>{this.#b=!1,this.#N()}))}#F(){this.#e||(this.#z(),this.#m())}#N(){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.#x(r),t=this.#E()}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.#y.values()].map(e=>({...e,timeoutRemaining:e.timeout?Math.max(0,e.startTime+e.timeout-Date.now()):void 0}))}}const Vo=()=>{const n=Me.useAnalyticsConfigStore(),e=s.inject(ke);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 Go({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(ke,i)};function Yo(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 Fi(n,...e){return typeof n=="function"?n(...e):n}function jo({method:n="warn",formatter:e=Yo}={}){return(t,{method:i=n}={})=>{console[i](e(t))}}const Ko=Error.captureStackTrace;var Qo=class gn extends Error{name;code;docs;fix;sources;get why(){return this.message}constructor(e,t=gn){super(e.why,{cause:e.cause}),this.code=this.name=e.code,this.fix=e.fix,this.docs=e.docs,this.sources=e.sources,Ko?.(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 Xo(n,e){return typeof n=="string"?`${n}/${e.toLowerCase()}`:n?.(e)}function Zo(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||Xo(i,r),l=(u={},c={})=>{const d=new Qo({code:r,why:Fi(o.why,u),fix:Fi(o.fix,u),docs:a,cause:u.cause,sources:u.sources},l);for(const h of e)h(d,c);return d};t[r]=l}return t}const Jo=typeof window<"u",ea=Zo({reporters:[jo()],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 $i;process.env.NODE_ENV;const Ui=process.env.NODE_ENV!=="production"?Symbol("pinia"):Symbol();process.env.NODE_ENV;function Ke(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",Ot=n=>n?.query?.datasource==="requests",Nt=n=>!!n&&!De(n)&&!Ot(n),ta=(n,e)=>{const t=n.header_description??("description"in n.chart?n.chart.description:void 0);if(t)return t.replaceAll(zi,e)||void 0},ia=["basic","api_usage","llm_usage","agentic_usage","platform","platform_usage","managed_cache_usage",void 0],na=n=>ia.includes(n);function ra({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),u=Me.useAnalyticsConfigStore(),c=Me.useDatasourceConfigStore(),{stripUnknownFilters:d,loading:h}=Ke(c),f=s.computed(()=>De(t.value));s.onMounted(async()=>{r.value=await n?.exploreBaseUrl?.()??"",o.value=await n?.requestsBaseUrl?.()??""});const g=s.computed(()=>u.analytics&&u.percentiles),b=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)&&g.value&&!h.value),w=s.computed(()=>r.value&&t.value.query&&na(t.value.query.datasource)&&g.value&&!h.value),O=s.computed(()=>i.value?j.msToGranularity(i.value.meta.granularity_ms):void 0),N=s.computed(()=>{const _=t.value,R=[...e.value.filters,..._.query.filters??[]],S="metrics"in _.query?_.query.metrics:void 0,z=_.query?.datasource??"api_usage";return d.value({datasource:z,filters:R,queryFields:S})}),v=s.computed(()=>{if(!w.value||!b.value)return"";const _=t.value;if(De(_))return m({..._.query,filters:N.value});const R=_.query.time_range||e.value.timeSpec,S=p(R,N.value);return m(S)}),x=s.computed(()=>{if(!E.value||!b.value)return"";const _=N.value,R=t.value;if(De(R))return"";const S=A(R.query.time_range||e.value.timeSpec,_);return k(S)}),k=_=>E.value?`${o.value}?q=${JSON.stringify(_)}`:"",A=(_,R)=>{const S=i.value?.meta?.start?new Date(i.value.meta.start):void 0,z=i.value?.meta?.end?new Date(i.value.meta.end):void 0;return{filter:R,timeframe:{timePeriodsKey:_.type==="relative"?_.time_range:"custom",start:_.type==="absolute"?S:void 0,end:_.type==="absolute"?z:void 0}}},H=(_,R)=>({filter:R,timeframe:{timePeriodsKey:_.type==="relative"?_.time_range:"custom",start:_.type==="absolute"?_.start:void 0,end:_.type==="absolute"?_.end:void 0}}),p=(_,R)=>{const S=t.value;if(!Nt(S))throw new Error("Cannot build a chart explore query for table or api-requests definitions");const z=[...S.query.dimensions??[]],ne=[...S.query.metrics??[]];return{filters:R,metrics:ne,dimensions:z,time_range:_,granularity:S.query.granularity||O.value||void 0}},m=_=>{if(!w.value)return"";const R=t.value.query.datasource&&t.value.query.datasource!=="basic"?t.value.query.datasource:"api_usage";return`${r.value}?q=${JSON.stringify(_)}&d=${R}&c=${t.value.chart.type}`};return s.watch([E,w],([_,R])=>{_&&(a.value={href:""}),R&&(l.value={href:""})}),{exploreLinkKebabMenu:v,requestsLinkKebabMenu:x,canShowKebabMenu:b,canGenerateRequestsLink:E,canGenerateExploreLink:w,requestsLinkZoomActions:a,exploreLinkZoomActions:l,buildExploreQuery:p,buildRequestsQueryZoomActions:H,buildExploreLink:m,buildRequestLink:k}}const Mt=n=>n.type==="relative"?j.TimePeriods.get(j.TIMEFRAME_LOOKUP[n.time_range])?.timeframeLengthMs():new Date(n.end).getTime()-new Date(n.start).getTime(),sa=n=>n.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),It=(n,e)=>{if(!n||!e?.length)return;const t=Mt(n),i=sa(e);return t!==void 0&&i&&t>i.durationSeconds*1e3?i:void 0},zt=(n,e)=>{const t=It(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 oa(){const n=s.inject(ke),e=Me.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Ke(e);let r=null;return s.onUnmounted(()=>{r?.abort()}),{issueQuery:async(a,l,u)=>{if(!n)throw new Error("Query bridge is not defined");r?.abort();const c=new AbortController;r=c,await e.isReady();const{datasource:d,limit:h,...f}=a,g=d||"basic",b=j.isPlatformDatasource(g),E=i.value({datasource:g,filters:[...a.filters??[],...l.filters],queryFields:a.metrics}).filter(({operator:N})=>!b||!j.requestFilterTypeEmptyV2.some(v=>v===N));let w=a.time_range;!w&&l.timeSpec?w={...l.timeSpec,tz:l.tz}:w&&!w.tz&&(w={...w,tz:l.tz}),w=zt(w,t.value[g]?.timeRangeOptions);const O={datasource:g,query:{...f,time_range:w,filters:E,limit:u??h}};return n.queryFn(O,c)}}}const aa="24H",la={status_code:"response_http_status",upstream_status_code:"upstream_status"},ca={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"},ua=n=>j.relativeTimeRangeValuesRequestV2.includes(n),da=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:ua(t)?t:aa,...e}},Wi=n=>la[n]??n,ha=n=>({metric:Wi(n.metric),dimension:n.dimension?Wi(n.dimension):void 0,unroll:n.unroll,metricUnit:ca[n.metric],extraFields:n.extra_fields}),At="requests";function fa(){const n=s.inject(ke),e=Me.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Ke(e);let r=null;s.onUnmounted(()=>{r?.abort()});const o=(l,u)=>{const c=l.time_range??u.timeSpec;return zt(c&&{...c,tz:c.tz??u.tz},t.value[At]?.timeRangeOptions)};return{issueRequestsQuery:async(l,u)=>{const c=n?.requestsQueryFn;if(!c)throw new Error("Query bridge cannot fetch request records");r?.abort();const d=new AbortController;r=d,await e.isReady();const h=i.value({datasource:At,filters:[...l.filters??[],...u.filters]});return j.fetchAllRequests(c,{datasource:At,query:{filters:h,time_range:da(o(l,u))}},d,{maxRecords:l.max_records})}}}function ma({context:n,globalFilters:e=s.ref([]),isFullscreen:t=s.ref(!1),preview:i=s.ref(!1)}){const r=Me.useAnalyticsConfigStore(),o=Me.useDatasourceConfigStore(),{loading:a}=Ke(r),{loading:l}=Ke(o),u=s.computed(()=>n.value.timeSpec?n.value.timeSpec:{type:"relative",time_range:r.defaultQueryTimeForOrg}),c=s.computed(()=>{const{tz:x}=n.value;return x||new Intl.DateTimeFormat().resolvedOptions().timeZone}),d=s.computed(()=>{const{editable:x}=n.value;return x===void 0||i.value?!1:x}),h=s.computed(()=>{const{showTileActions:x}=n.value;return i.value?!1:x===void 0?!0:x}),f=s.computed(()=>[...n.value.filters??[],...e.value]),g=s.computed(()=>{let{refreshInterval:x}=n.value;if(x===void 0&&(x=Ai),t.value){let k=!1;if(u.value.type==="relative")k=["15m","1h","6h","12h","24h"].includes(u.value.time_range);else{const p=u.value.start.getTime(),m=u.value.end.getTime();k=Math.abs(m-p)<=864e5}const A=new Date().getTime();u.value.type==="absolute"&&u.value.end.getTime()<A||u.value.type==="relative"&&["previous_week","previous_month"].includes(u.value.time_range)?x=0:k?x=Li:x=qi}return x}),b=s.computed(()=>({filters:f.value,timeSpec:u.value,tz:c.value,refreshInterval:g.value,editable:d.value,showTileActions:h.value})),E=s.computed(()=>!a.value&&!l.value),w=s.computed(()=>!i.value&&!!s.getCurrentInstance()?.vnode?.props?.onTileTimeRangeZoom),O=s.computed(()=>!i.value),N=s.computed(()=>!i.value),v=s.computed(()=>({enabled:w.value,showExploreAction:O.value,showRequestsAction:N.value,showZoomInAction:w.value}));return{editable:d,enrichedContext:b,filters:f,queryReady:E,refreshInterval:g,showTileActions:h,timeSpec:u,tz:c,zoomConfiguration:v}}const pa=6,Gi=6,Vi=4;function ga(n,e){const{pageWidth:t,pageHeight:i,margin:r}=e,o=r+1,a=r+e.headerHeight-3,l=i-r-Gi+3,u=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+Vi),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,u);const c=n.getTextWidth(e.branding);n.setFont("helvetica","normal");const d=` ${e.dashboardNote}`;e.dashboardUrl?(n.setTextColor(0,68,204),n.textWithLink(d,r+c,u,{url:e.dashboardUrl})):(n.setTextColor(120),n.text(d,r+c,u)),n.setTextColor(120),n.text(e.pageLabel,t-r,u,{align:"right"})}function ya(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),u=Math.round(a.bottom-i),c=r.get(l);r.set(l,c!==void 0?Math.max(c,u):u)}),[...r.entries()].map(([o,a])=>({top:o,bottom:a})).sort((o,a)=>o.top-a.top)}function _a(n,e,t,i){if(!n.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 r=[];let o=0;for(const a of n){const l=a.top*i,u=a.bottom*i;u-o>t&&(l>o?(r.push({startY:o,height:l-o}),o=l):(r.push({startY:o,height:u-o}),o=u))}return o<e&&r.push({startY:o,height:e-o}),r}function ba(n){const{i18n:e}=Tt(),t=s.ref({status:"idle"});async function i(r={}){const{filename:o="dashboard-export",title:a,subtitle:l,dashboardUrl:u,orientation:c="landscape",pageSize:d="letter",margin:h=4,scale:f=2,exclude:g=[".tile-actions",".tooltip",".popover",".dropdown-popover"],output:b="download",onBeforeCapture:E,onAfterCapture:w}=r,O=n.value;if(!O){t.value={status:"error",error:new Error("Dashboard layout container not found.")};return}try{t.value={status:"preparing"},await E?.();const[{snapdom:N},{jsPDF:v}]=await Promise.all([import("@zumer/snapdom"),import("jspdf")]);t.value={status:"capturing"};const x={name:"kong-webgl-snapshot",beforeClone:()=>j.prepareForCapture(),afterClone:()=>j.restoreAfterCapture()},k=await N.toCanvas(O,{scale:f,exclude:g,excludeMode:"remove",embedFonts:!0,plugins:[x]}),A=ya(O),H=O.getBoundingClientRect().width,p=H?k.width/H:f;t.value={status:"generating"};const m=new Date,_=new v({orientation:c,unit:"mm",format:d}),R=_.internal.pageSize.getWidth(),S=_.internal.pageSize.getHeight(),z=pa+(l?Vi:0),ne=R-h*2,he=S-h*2-z-Gi,fe=k.width/ne,J=he*fe,se=_a(A,k.height,J,p),P={title:a,subtitle:l,dashboardUrl:u,generatedAt:e.t("pdfExport.generated",{timestamp:m.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}),branding:e.t("pdfExport.branding"),dashboardNote:e.t("pdfExport.dashboardNote"),pageWidth:R,pageHeight:S,headerHeight:z,margin:h};for(let te=0;te<se.length;te++){te>0&&_.addPage();const{startY:C,height:D}=se[te],T=document.createElement("canvas");T.width=k.width,T.height=D,T.getContext("2d").drawImage(k,0,C,k.width,D,0,0,k.width,D),_.addImage(T.toDataURL("image/png"),"PNG",h,h+z,ne,D/fe),ga(_,{...P,pageLabel:e.t("pdfExport.pageOf",{page:String(te+1),total:String(se.length)})})}if(b==="blob"){const te=_.output("blob");return t.value={status:"complete",pageCount:se.length},te}_.save(o),t.value={status:"complete",pageCount:se.length}}catch(N){t.value={status:"error",error:N}}finally{j.restoreAfterCapture(),await w?.()}}return{exportPdf:i,exportState:s.readonly(t)}}const wa=n=>n.toLowerCase().endsWith("count")?"":n;function va(){const{i18n:n}=Tt(),{formatUnit:e}=j.unitFormatter({i18n:n});return t=>{const i=t.meta?.metric_names?.[0]??"",r=t.meta?.metric_units?.[i]??"",o=`chartLabels.${i}`;return{seriesName:n.te(o)?n.t(o):i,valueFormatter:a=>e(a,r,{translateUnit:wa})}}}const ae={useContextLinks:ra,useDashboardContext:ma,useEvaluateFeatureFlag:Po,useExportPdf:ba,useI18n:Tt,useIssueQuery:oa,useIssueRequestsQuery:fa,useMetricFormatter:va,useRequestQueue:Vo},xa={class:"kong-ui-public-csv-export-modal"},Ea={key:0,class:"selected-range"},Ca={key:4,class:"text-muted",tag:"span"},Yi=3,ji=s.defineComponent({__name:"CsvExportModal",props:{exportState:{},filename:{},modalDescription:{default:void 0}},emits:["closeModal"],setup(n,{emit:e}){const{i18n:t}=ae.useI18n(),i=n,r=e,o=`${i.filename.replace(/\s+/g,"-").toLowerCase()}-${new Date().toISOString().slice(0,10)}.csv`,a=s.ref(1),l=s.computed(()=>f.value.rows.length),u=s.computed(()=>i.exportState.status==="success"&&!!i.exportState.chartData?.data?.length),c=s.computed(()=>{if(i.exportState.status!=="success"||!i.exportState.chartData?.meta)return"";const{start:b,end:E}=i.exportState.chartData.meta;return!b||!E?"":new Date(b).getTime()===new Date(E).getTime()?t.t("csvExport.exportAsOf",{time:j.formatTimestamp(new Date(b),{includeTZ:!0})}):`${t.t("csvExport.exportTimeRange")}: ${j.formatTimestamp(new Date(b))} - ${j.formatTimestamp(new Date(E),{includeTZ:!0})}`}),d=s.computed(()=>i.exportState.status!=="success"?"":t.t("csvExport.previewRows",{rowsMax:Math.min(Yi,l.value),rowsTotal:l.value,plural:l.value===1?"":"s"})),h=()=>{r("closeModal")},f=s.computed(()=>{if(i.exportState.status!=="success"||!u.value||!i.exportState.chartData?.meta.metric_names)return{headers:[],rows:[],csvHeaders:{}};const b=i.exportState.chartData,E=b.data.some(k=>k.timestamp!==b.data[0].timestamp),w=b.data.map(k=>{const A=new Date(k.timestamp);return{...Object.keys(k.event).reduce((p,m)=>{if(m in b.meta.display){const _=k.event[m],R=b.meta.display[m];p[m]=_&&R?.[_]?.name||k.event[m]}else p[m]=k.event[m];return p},{}),...E?{timestamp:Ci(A,"yyyy-MM-dd HH:mm:ss"),tzOffset:Ci(A,"XXX")}:{}}});let O=[];E&&(O=[{label:t.t("csvExport.Timestamp"),key:"timestamp"},{label:t.t("csvExport.UtcOffset"),key:"tzOffset"}]);const N="display"in i.exportState.chartData.meta&&i.exportState.chartData.meta.display?i.exportState.chartData.meta.display:{},v=[...O,...Object.keys(N).map(k=>({label:t.t(`chartLabels.${k}`),key:k})),...i.exportState.chartData.meta.metric_names.map(k=>({label:t.t(`chartLabels.${k}`),key:k}))],x=v.reduce((k,A)=>(k[A.key]=A.label,k),{});return{headers:v,csvHeaders:x,rows:w}}),g=async()=>{if(i.exportState.status!=="success")return{total:0,data:[]};const{rows:b}=f.value;return{total:Number(b.length)||0,data:b.slice(0,Yi)}};return s.watch(f,()=>{a.value++}),(b,E)=>{const w=s.resolveComponent("KSkeleton"),O=s.resolveComponent("KEmptyState"),N=s.resolveComponent("KTableData"),v=s.resolveComponent("KTooltip"),x=s.resolveComponent("KButton"),k=s.resolveComponent("KModal");return s.openBlock(),s.createElementBlock("div",xa,[s.createVNode(k,{class:"vitals-report","data-testid":"csv-export-modal","show-dismiss-icon":"",title:s.unref(t).t("csvExport.exportPreview"),visible:"",onCancel:h,onKeyup:s.withKeys(h,["esc"])},{default:s.withCtx(()=>[s.createElementVNode("div",null,[n.exportState.status==="success"&&u.value?(s.openBlock(),s.createElementBlock("div",Ea,[s.createElementVNode("p",null,s.toDisplayString(n.modalDescription?n.modalDescription:s.unref(t).t("csvExport.exportDescription")),1),s.createElementVNode("p",null,s.toDisplayString(c.value),1)])):s.createCommentVNode("",!0),n.exportState.status==="loading"?(s.openBlock(),s.createBlock(w,{key:1,class:"chart-skeleton",type:"table"})):n.exportState.status==="success"?(s.openBlock(),s.createBlock(N,{key:2,class:"vitals-table",fetcher:g,"fetcher-cache-key":String(a.value),headers:f.value.headers,"hide-pagination":"","row-hover":!1,sortable:!1},{"empty-state":s.withCtx(()=>[s.createVNode(O,{"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(O,{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"&&u.value?(s.openBlock(),s.createElementBlock("div",Ca,[s.createTextVNode(s.toDisplayString(d.value)+" ",1),s.createVNode(v,{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(Q.InfoIcon),{color:`var(--kui-color-text-neutral, ${s.unref(kt)})`,size:`var(--kui-icon-size-30, ${s.unref(Ro)})`},null,8,["color","size"])]),_:1},8,["text"])])):s.createCommentVNode("",!0)])]),"footer-actions":s.withCtx(()=>[s.createVNode(x,{appearance:"tertiary",class:"cancel-btn",onClick:h},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(t).t("csvExport.cancelButton")),1)]),_:1}),s.createVNode(qo,{class:"vitals-report-export-button",filename:o,headers:f.value.csvHeaders,rows:f.value.rows},{default:s.withCtx(()=>[s.createVNode(x,{appearance:"primary","data-testid":"csv-download-button",disabled:n.exportState.status!=="success"||!u.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 Ki=(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))(Ki||{});const ka=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 Qi(n=s.ref({}),e,t,i=ka){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:Ki}}const Le=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(ke),l=()=>t.queryReady&&a?JSON.stringify([t.query,t.context,t.refreshCounter]):null,{data:u,error:c,isValidating:d}=$t(l,async()=>{const N=l();try{const v=await o(t.query,t.context,t.limitOverride);return l()!==N?void 0:(g.value=null,v)}catch(v){if(l()!==N)return;throw g.value=Se.handleQueryError(v),v}finally{l()===N&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:h,swrvState:f}=Qi(u,c,d),g=s.ref(null),b=s.computed(()=>h.value===f.ERROR||!!g.value),E=s.computed(()=>!t.queryReady||h.value===f.PENDING),w=s.ref(),O=s.computed(()=>u.value??(t.queryReady&&h.value===f.PENDING?w.value:void 0));return s.watch([()=>u.value,()=>h.value],([N,v])=>{N&&(v==="SUCCESS_HAS_DATA"||v==="SUCCESS")&&N!==w.value&&(w.value=N,i("chart-data",N))}),(N,v)=>{const x=s.resolveComponent("KSkeleton"),k=s.resolveComponent("KEmptyState");return(E.value||!s.unref(u)&&!b.value)&&!O.value?(s.openBlock(),s.createBlock(x,{key:0,class:"chart-skeleton",type:"table"})):b.value&&!E.value?(s.openBlock(),s.createBlock(k,{key:1,"action-button-visible":!1,"data-testid":"chart-empty-state"},s.createSlots({icon:s.withCtx(()=>[g.value?.type==="forbidden"?(s.openBlock(),s.createBlock(s.unref(Q.VisibilityOffIcon),{key:0})):(s.openBlock(),s.createBlock(s.unref(Q.WarningOutlineIcon),{key:1}))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(g.value?.message||s.unref(r).t("renderer.unexpectedError")),1)]),_:2},[g.value?.details?{name:"default",fn:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(g.value.details),1)]),key:"0"}:void 0]),1024)):O.value?s.renderSlot(N.$slots,"default",{data:O.value},void 0,void 0,2):s.createCommentVNode("",!0)}}}),Ta=s.defineComponent({__name:"SimpleChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},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"}:e.chartOptions);return(r,o)=>(s.openBlock(),s.createBlock(Le,{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}]),style:s.normalizeStyle(t.value?void 0:{height:`${n.height}px`})},[s.createVNode(s.unref(Se.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"]))}}),we=(n,e)=>{const t=n.__vccOpts||n;for(const[i,r]of e)t[i]=r;return t},Xi=we(Ta,[["__scopeId","data-v-22077b88"]]),Ra={class:"analytics-chart"},Lt=we(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")},u=c=>{i("chart-data",c)};return(c,d)=>{const h=s.resolveComponent("KDropdownItem");return s.openBlock(),s.createBlock(Le,{context:n.context,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onChartData:u},{default:s.withCtx(({data:f})=>[s.createElementVNode("div",Ra,[s.createVNode(s.unref(Se.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:d[0]||(d[0]=g=>i("select-chart-range",g)),onZoomTimeRange:d[1]||(d[1]=g=>i("zoom-time-range",g))}),s.createSlots({_:2},[n.context.editable?{name:"menu-items",fn:s.withCtx(()=>[s.createVNode(h,{onClick:l},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.edit")),1)]),_:1})]),key:"0"}:void 0]),1040,["active-metric","chart-data","chart-options","explore-link","requests-link","synthetics-data-key","timeseries-zoom"])])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-5e3d0a14"]]),Zi=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(Lt,{"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"]))}}),Sa={class:"analytics-chart"},Da={key:3,class:"analytics-chart"},Oa=we(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 x=t.query,k=x.time_range??t.context.timeSpec,A=k?Mt(k):void 0;if(!A)return x;const H=j.finestGranularityForDuration(A);let p;return x.granularity&&j.Granularities[x.granularity]>=j.Granularities[H]?p=x.granularity:p=H,{...x,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}=$t(u,async()=>{const x=u(),k=t.query;try{const A=await o(k,t.context);return u()!==x?void 0:(c.value=null,Se.requestsToScatterData(A,ha(k)))}catch(A){if(u()!==x)return;throw c.value=Se.handleQueryError(A),A}finally{u()===x&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:g,swrvState:b}=Qi(d,h,f),E=s.ref(),w=s.computed(()=>d.value??E.value);s.watch(d,x=>{x&&(E.value=x)});const O=s.computed(()=>g.value===b.ERROR||!!c.value),N=s.computed(()=>!O.value&&(!t.queryReady||g.value===b.PENDING)&&!w.value),v=s.computed(()=>({type:"scatter",chartDatasetColors:t.chartOptions.chart_dataset_colors,scatter:{percentileLines:t.chartOptions.percentile_lines?.map(x=>({percentile:x.percentile,label:x.label,borderDash:x.border_dash,color:x.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(x,k)=>{const A=s.resolveComponent("KSkeleton"),H=s.resolveComponent("KEmptyState");return a.value?N.value?(s.openBlock(),s.createBlock(A,{key:1,class:"chart-skeleton",type:"table"})):O.value?(s.openBlock(),s.createBlock(H,{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(Q.VisibilityOffIcon),{key:0})):(s.openBlock(),s.createBlock(s.unref(Q.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)):w.value?(s.openBlock(),s.createElementBlock("div",Da,[s.createVNode(s.unref(Se.AnalyticsChart),{"chart-data":w.value,"chart-options":v.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(Le,{key:0,context:n.context,query:l.value,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onChartData:k[0]||(k[0]=p=>i("chart-data",p)),onQueryComplete:k[1]||(k[1]=p=>i("query-complete"))},{default:s.withCtx(({data:p})=>[s.createElementVNode("div",Sa,[s.createVNode(s.unref(Se.AnalyticsChart),{"chart-data":p,"chart-options":v.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"]]),Ji=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(Lt,{"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"]))}}),Na=we(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(Ut.MetricsProvider),s.normalizeProps(s.guardReactiveProps(t.value)),{default:s.withCtx(()=>[s.createVNode(s.unref(Ut.MetricsConsumer))]),_:1},16)],2))}}),[["__scopeId","data-v-3eda5028"]]),en=3,Ma={anthropic:Q.AnthropicIcon,azure:Q.AzureIcon,bedrock:Q.AmazonBedrockIcon,cerebras:Q.CerebrasIcon,cohere:Q.CohereIcon,databricks:Q.DatabricksIcon,deepseek:Q.DeepseekIcon,gemini:Q.GeminiIcon,huggingface:Q.HuggingFaceIcon,llama2:Q.MetaLlamaIcon,mistral:Q.MistralIcon,moonshot:Q.KimiIcon,nvidia:Q.NvidiaIcon,ollama:Q.OllamaIcon,openai:Q.OpenAiIcon,vertex:Q.GoogleVertexIcon,vllm:Q.VllmIcon,xai:Q.GrokIcon},qt=(n,e)=>{if(!n||!e)return;const t=e.toLowerCase();return n[e]??Object.entries(n).find(([i])=>i.toLowerCase()===t)?.[1]},Ia=({columnOptions:n,columnKey:e,rawValue:t})=>{if(!(qt(n,e)?.icon_set!=="ai_provider"||typeof t!="string"))return Ma[t.toLowerCase()]},za=n=>{if(n==null||n==="")return null;const e=typeof n=="number"?n:Number(n);return Number.isFinite(e)?e:null},Aa=n=>n.toLocaleLowerCase().endsWith("count"),La=n=>{const e=Object.keys(n?.meta?.display??{}).slice(0,en),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]=za(i.event[o])}),r})},qa=({data:n,columnOptions:e,i18n:t})=>{const{formatUnit:i}=j.unitFormatter({i18n:t}),r=n?.data??[],o=n?.meta,a=o?.display??{},l=Object.keys(a).slice(0,en),u=o?.metric_names??[],c=u[0],d=l.length>1,h=v=>{const x=`chartLabels.${v}`;return t.messages[x]?t.formatMessage({id:x}):v},f=(v,x)=>qt(e,v)?.label||x,g=(v,x)=>{if(Aa(v)||v==="requests")return"";const k=x===1?"":"s",A=`chartUnits.${v}`;return t.messages[A]?t.formatMessage({id:A},{plural:k}):v},b=v=>{const x=k=>i(k,"%",{translateUnit:g});return v>0&&v<.01?`< ${x(.01)}`:x(v)},E=(v,x)=>{const k=v.event[x];if(k==null)return"–";const A=typeof k=="number"?k:Number(k);if(Number.isNaN(A))return"–";const H=o?.metric_units?.[x]||"count";return H==="%"?b(A):i(A,H,{approximate:["count","count/minute","token count"].includes(H),isBytes1024:!0,translateUnit:g})},w=(v,x)=>{const k=String(v.record.event[x]),A=a[x]?.[k];return{id:k,label:A?.name||"-",deleted:!!A?.deleted}},O=l.map(v=>({key:v,label:f(v,d?h(v):t.t("topNTable.nameLabel")),type:"dimension",valueFormatter:(x,k)=>w(k,v).label,sortable:!1}));u.forEach(v=>{const x=qt(e,v);O.push({key:v,label:x?.label||h(v),type:"metric",valueFormatter:(k,A)=>E(A.record,v),showPercentage:x?.value==="relative",percentageFormatter:b,bar:x?.bar==="max"?"absolute":x?.bar,thresholds:x?.thresholds,sortable:!1})});const N=r.length?o?l.some(v=>!Object.keys(a[v]||{}).length)?t.t("topNTable.errors.display"):c?"":t.t("topNTable.errors.metricNames"):t.t("topNTable.errors.meta"):"";return{headers:O,errorMessage:N,getDimension:w}},Pa={class:"fallback-entity-link","data-testid":"entity-link-parent"},tn=s.defineComponent({__name:"FallbackEntityLink",props:{entityLinkData:{}},setup(n){return(e,t)=>(s.openBlock(),s.createElementBlock("div",Pa,s.toDisplayString(n.entityLinkData.label),1))}}),Ba=["data-testid"],Ha={key:1},Fa=we(s.defineComponent({__name:"TopNDataGrid",props:{chartOptions:{},data:{},fitToContent:{type:Boolean,default:!1},height:{}},setup(n){const e=s.inject(ke),{i18n:t}=ae.useI18n(),i=s.computed(()=>La(n.data)),r=s.computed(()=>qa({data:n.data,columnOptions:n.chartOptions.column_options,i18n:t})),o=s.computed(()=>r.value.headers.map(b=>({...b,minWidth:b.type==="dimension"?160:b.bar?260:140}))),a=s.computed(()=>r.value.headers.filter(b=>b.type==="dimension")),l=s.computed(()=>({fitToContent:n.fitToContent})),u=s.computed(()=>n.fitToContent?{height:"auto"}:n.height===void 0?void 0:{height:`${n.height}px`}),c=(b,E)=>Ia({columnOptions:n.chartOptions.column_options,columnKey:b,rawValue:E}),d=s.defineAsyncComponent(async()=>{if(e?.fetchComponent)try{return await e.fetchComponent("EntityLink")}catch{return tn}return tn}),h=b=>{const E=n.chartOptions.entity_links;return E&&(E[b]||Object.entries(E).find(([w])=>w.toLowerCase()===b.toLowerCase())?.[1])||""},f=b=>h(b)||a.value[0]?.key===b&&n.chartOptions.entity_link||"",g=(b,E)=>{const w=f(E),O=String(b[E]);if(O.includes(":")){const[N,v]=O.split(":");return w.replace(Ii,N).replace(Rt,v)}return w.replace(Rt,O)};return(b,E)=>{const w=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{class:"top-n-data-grid","data-testid":i.value.length?"top-n-table":void 0,style:s.normalizeStyle(u.value)},[s.createVNode(s.unref(Wt.TableDataGrid),{error:!!r.value.errorMessage,headers:o.value,mode:"unpaginated",rows:i.value,"table-config":l.value},s.createSlots({"error-state":s.withCtx(()=>[s.createVNode(w,{"action-button-visible":!1,"data-testid":"chart-empty-state"},{icon:s.withCtx(()=>[s.createVNode(s.unref(Q.WarningOutlineIcon))]),title:s.withCtx(()=>[s.createElementVNode("p",null,s.toDisplayString(r.value.errorMessage),1)]),_:1})]),"empty-state":s.withCtx(()=>[s.createVNode(w,{"action-button-visible":!1,"data-testid":"top-n-empty-state",title:s.unref(t).t("topNTable.defaultEmptyStateTitle")},null,8,["title"])]),"cell-icon":s.withCtx(({column:O,rowValue:N})=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(c(O.key,N)),{class:"top-n-provider-icon","data-testid":"top-n-provider-icon",decorative:"",size:"var(--kui-icon-size-30, 16px)"}))]),_:2},[s.renderList(a.value,O=>({name:O.key,fn:s.withCtx(({row:N})=>[f(O.key)&&N[O.key]!=="empty"?(s.openBlock(),s.createBlock(s.unref(d),{key:0,class:"top-n-entity-link","entity-link-data":r.value.getDimension(N,O.key),"external-link":g(N,O.key)},null,8,["entity-link-data","external-link"])):r.value.getDimension(N,O.key).label==="empty"?(s.openBlock(),s.createElementBlock("i",Ha,"empty")):s.createCommentVNode("",!0)])}))]),1032,["error","headers","rows","table-config"])],12,Ba)}}}),[["__scopeId","data-v-f6b76589"]]),$a=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(Le,{context:n.context,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter},{default:s.withCtx(({data:i})=>[s.createVNode(Fa,{"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"]))}}),Ua=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,d)=>[c,o(t.chartOptions.columns[d])]))),l=new Set,u=c=>{l.add(c),l.size===r.value.length&&(l.clear(),i("query-complete"))};return s.watch([a,()=>t.refreshCounter],()=>l.clear()),(c,d)=>(s.openBlock(),s.createBlock(s.unref(Se.TopTalkersGrid),{"column-options":n.chartOptions.column_options,columns:r.value,"size-metric":n.chartOptions.size_metric},{column:s.withCtx(({column:h})=>[s.createVNode(Le,{context:n.context,query:a.value.get(h),"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onQueryComplete:f=>u(h)},{default:s.withCtx(({data:f})=>[s.createVNode(s.unref(Se.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"]))}}),Wa=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}),nn=({canTranslate:n,columns:e,translate:t})=>e.map(i=>{const r=`chartLabels.${i}`;return{key:i,label:n(r)?t(r):i}}),Ga={platform:nn,platform_usage:nn},rn=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 u=r.query,c=a({datasource:r.datasource,filters:[...u.filters??[],...e.filters],queryFields:u.entity===void 0?void 0:[u.entity]}),d=await l({datasource:r.datasource,query:{columns:u.columns,cursor:t===void 0?u.cursor:String(t),entity:u.entity,filters:c,page_size:i}},n);return d.meta.columns?.length&&o?.(d.meta.columns),{data:Wa(d),cursor:d.meta.cursor,hasMore:!!d.meta.cursor}},Va={platform:rn,platform_usage:rn},Ya=we(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(ke),o=Me.useDatasourceConfigStore(),{i18n:a}=ae.useI18n(),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 g=s.computed(()=>Ga[t.query.datasource]({columns:t.query.columns?.length?t.query.columns:u.value,translate:w=>a.t(w),canTranslate:w=>a.te(w)})),b=s.computed(()=>async({cursor:w,pageSize:O})=>{try{await o.isReady();const N=Va[h.value.datasource];if(!N)throw new Error(`No table data grid fetcher found for datasource: ${h.value.datasource}`);const v=await N({abortController:l,context:t.context,cursor:w,pageSize:O,query:h.value,onResponseColumns:x=>{u.value=x},stripUnknownFilters:o.stripUnknownFilters,tabularQueryFn:r?.tabularQueryFn});return c.value=!1,v}catch(N){throw c.value=!0,N}}),E=w=>{w.state==="error"&&(c.value=!0),i("loading-change",w.state==="loading")};return(w,O)=>{const N=s.resolveComponent("KSkeleton");return s.openBlock(),s.createElementBlock("div",{class:"table-data-grid-renderer",style:s.normalizeStyle(d.value)},[n.queryReady?(s.openBlock(),s.createBlock(s.unref(Wt.TableDataGrid),{key:1,error:c.value,fetcher:b.value,headers:g.value,"page-size":n.query.page_size,"refresh-key":f.value,onState:E},null,8,["error","fetcher","headers","page-size","refresh-key"])):(s.openBlock(),s.createBlock(N,{key:0,"data-testid":"table-skeleton",type:"table"}))],4)}}}),[["__scopeId","data-v-c49ff2eb"]]),ja=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(Lt,{"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"]))}}),sn=n=>{if(n==null||typeof n=="string"&&n.trim()==="")return;const e=Number(n);return Number.isFinite(e)?e:void 0},on="MMM dd",Ka=(n,e)=>{const t=[],i=new Date(e);for(const r=new Date(n);r<i;r.setDate(r.getDate()+1))t.push(_t(r,on));return t},Qa=(n,e)=>{const t=n.indexOf(e);return t===-1?n.push(e)-1:t},Xa=(n,e)=>n[e]?.name??e,Za=n=>{if(!n?.meta||!n.data)return;const{display:e,metric_names:t,start:i,end:r}=n.meta,o=t?.[0],a=e&&Object.keys(e).find(d=>d!=="time");if(!o||!a||!i||!r){console.error("Cannot build heatmap chart data from this explore result. Missing metric, dimension or time range.");return}const l=Ka(i,r),u=[],c=[];for(const{timestamp:d,event:h}of n.data){const f=l.indexOf(_t(new Date(d),on)),g=sn(h[o]);f===-1||g===void 0||c.push([f,Qa(u,String(h[a])),g])}return{data:c,xAxisLabels:l,yAxisLabels:u.map(d=>Xa(e[a],d))}},Ja={class:"wrapper","data-testid":"heatmap-chart"},el=10,tl=we(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=e,{i18n:i}=ae.useI18n(),r=ae.useMetricFormatter(),o=u=>{const c=Za(u);if(c?.data.length)return{data:c.data,xAxisLabels:c.xAxisLabels,yAxisLabels:c.yAxisLabels,...r(u)}},a=new WeakMap,l=u=>(a.has(u)||a.set(u,o(u)),a.get(u));return(u,c)=>{const d=s.resolveComponent("KEmptyState");return s.openBlock(),s.createBlock(Le,{context:n.context,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onChartData:c[0]||(c[0]=h=>t("chart-data",h)),onQueryComplete:c[1]||(c[1]=h=>t("query-complete"))},{default:s.withCtx(({data:h})=>[s.createElementVNode("div",Ja,[l(h)?(s.openBlock(),s.createBlock(s.unref(Gt.HeatmapChart),s.mergeProps({key:0,height:"100%","tooltip-title":n.chartOptions.chart_title??void 0,"visible-rows":el},l(h)),null,16,["tooltip-title"])):(s.openBlock(),s.createBlock(d,{key:1,"action-button-visible":!1,"data-testid":"no-data-in-report"},{title:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(i).t("renderer.noDataAvailable.title")),1)]),default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(i).t("renderer.noDataAvailable.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-937dae87"]]),an=(n,e,{otherLabel:t})=>({name:e===Se.OTHER_DIMENSION_ID&&t||(n?.[e]?.name??e)}),il=(n,e,t,i)=>({...an(e,t,i),itemStyle:{color:Yr({dimension:n,dimensionValue:t})}}),ln=(n,e,t)=>{const i=n.get(e)??t();return n.set(e,i),i},nl=/_(average|p\d+|rate|max|per_minute)$/,cn=(n,e)=>!e.includes("time")&&!(n&&nl.test(n)),un=(n,e)=>{n.value=Number(n.value??0)+e},rl=(n,e,t,[i,r],o)=>{const a=new Map,l=(u,c)=>String(u[c]);for(const{event:u}of n){const c=sn(u[e]);if(c===void 0)continue;const d=l(u,i),h=ln(a,d,()=>({node:il(i,t[i],d,o),children:new Map}));if(!r){un(h.node,c);continue}const f=l(u,r),g=ln(h.children,f,()=>an(t[r],f,o));un(g,c)}return a},sl=(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(!cn(r,o)){console.error("Cannot build treemap chart data from this explore result. Needs an additive metric and no time dimension.");return}return[...rl(n.data,r,t,o,e).values()].map(({node:l,children:u})=>u.size?{...l,children:[...u.values()]}:l)},ol={class:"wrapper","data-testid":"treemap-chart"},al=we(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(()=>cn(t.query.metrics?.[0],t.query.dimensions??[])),l=d=>{const h=sl(d,{otherLabel:r.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(Le,{context:n.context,query:n.query,"query-ready":n.queryReady,"refresh-counter":n.refreshCounter,onChartData:h[0]||(h[0]=g=>i("chart-data",g)),onQueryComplete:h[1]||(h[1]=g=>i("query-complete"))},{default:s.withCtx(({data:g})=>[s.createElementVNode("div",ol,[a.value?c(g)?(s.openBlock(),s.createBlock(s.unref(Gt.TreeMapChart),s.mergeProps({key:1,height:"100%","tooltip-title":n.chartOptions.chart_title??void 0},c(g)),null,16,["tooltip-title"])):(s.openBlock(),s.createBlock(f,{key:2,"action-button-visible":!1,"data-testid":"no-data-in-report"},{title:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.noDataAvailable.title")),1)]),default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.noDataAvailable.description")),1)]),_:1})):(s.openBlock(),s.createBlock(f,{key:0,"action-button-visible":!1,"data-testid":"treemap-unsupported"},{title:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.treemapUnsupported.title")),1)]),default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(r).t("renderer.treemapUnsupported.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-d818a9ae"]]),ll=["data-testid"],cl={key:0,class:"tile-header"},ul={class:"badge-container"},dl={class:"badge-text"},hl={class:"badge-text"},fl={key:0,class:"metric-selector-wrapper"},ml={key:1},pl=["data-testid"],gl=["data-testid"],yl=["data-testid"],_l={class:"delete-option"},bl=["data-testid"],dn=we(s.defineComponent({__name:"DashboardTile",props:s.mergeModels({context:{},definition:{},fitToContent:{type:Boolean,default:!1},height:{default:()=>je},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(M=>({v692e8c06:`${M.height}px`}));const i=parseInt(Si,10),{zoomConfiguration:r}=ae.useDashboardContext({context:s.computed(()=>n.context),preview:s.computed(()=>n.preview)}),o=s.useModel(n,"refreshCounter"),a=()=>{v.value=!0,o.value++},l=t,u=s.defineAsyncComponent(()=>Promise.resolve().then(()=>ql)),c=s.inject(ke),d=Me.useDatasourceConfigStore(),{datasourceConfigMap:h,stripUnknownFilters:f}=Ke(d),{i18n:g}=ae.useI18n(),b=s.ref(),E=s.ref({status:"loading"}),w=s.ref(!1),O=s.ref(),N=s.ref(!1),v=s.ref(!0),x=s.computed(()=>n.definition.chart),k=s.computed(()=>"chart_title"in x.value?x.value.chart_title:void 0),A=s.computed(()=>n.definition.header_description),H=s.computed(()=>x.value.type==="slottable"),p=s.computed(()=>De(n.definition)||Ot(n.definition)?!1:!("allow_csv_export"in x.value)||x.value.allow_csv_export!==!1),{exploreLinkKebabMenu:m,requestsLinkKebabMenu:_,canShowKebabMenu:R,canGenerateRequestsLink:S,canGenerateExploreLink:z,requestsLinkZoomActions:ne,exploreLinkZoomActions:he,buildExploreQuery:fe,buildExploreLink:J,buildRequestLink:se,buildRequestsQueryZoomActions:P}=ae.useContextLinks({queryBridge:c,chartData:s.readonly(b),definition:s.toRef(()=>n.definition),context:s.readonly(s.toRef(()=>n.context))}),{issueQuery:te}=ae.useIssueQuery();s.watch(()=>n.definition,async(M,Y)=>{await s.nextTick(),O.value&&(N.value=O.value.scrollWidth>O.value.clientWidth);try{JSON.stringify(M?.query)!==JSON.stringify(Y?.query)&&(v.value=!0)}catch{}},{immediate:!0,deep:!0});const C=s.computed(()=>g.t("csvExport.defaultFilename")),D=s.computed(()=>!!m.value||p.value||!!n.context.editable),T=s.computed(()=>!n.hideActions&&R.value&&D.value),G=s.computed(()=>T.value&&D.value&&!n.isFullscreen),X={heatmap:tl,treemap:al,timeseries_line:Ji,timeseries_bar:Ji,scatter:Oa,horizontal_bar:Zi,vertical_bar:Zi,gauge:Xi,donut:ja,golden_signals:Na,top_n:$a,top_talkers:Ua,table:Ya,slottable:void 0,single_value:Xi,choropleth_map:u},K=s.computed(()=>({...ue.value?.rendererEvents.supportsRequests?{"select-chart-range":$e}:{},...ue.value?.rendererEvents.supportsZoom?{"zoom-time-range":Pe}:{},...ue.value?.rendererEvents.supportsBounds?{"bounds-change":Ee}:{},...ue.value?.rendererEvents.supportsLoadingChange?{"loading-change":pe}:{}})),ue=s.computed(()=>{const M=X[n.definition.chart.type],Y=De(n.definition),me=!!M?.emits?.includes("select-chart-range"),Ue=!!M?.emits?.includes("zoom-time-range"),Be=n.definition.chart.type==="choropleth_map",We=!!M?.emits?.includes("loading-change"),Ht={query:n.definition.query,context:n.context,queryReady:n.queryReady,height:n.height-i*2,refreshCounter:o.value,zoomConfiguration:r.value},Ft={chartOptions:n.definition.chart,activeMetric:V.value,headerDescription:A.value,requestsLink:r.value.showRequestsAction?ne.value:void 0,exploreLink:r.value.showExploreAction?he.value:void 0};return M&&{component:M,rendererProps:{...Ht,...Y?{}:Ft,...n.definition.chart.type==="top_n"?{fitToContent:n.fitToContent}:{}},rendererEvents:{supportsRequests:me,supportsZoom:Ue,supportsBounds:Be,supportsLoadingChange:We}}}),F=s.computed(()=>{if(De(n.definition))return null;const M=n.definition.query,Y=M?.time_range;if(j.isPlatformDatasource(M?.datasource)&&!M.dimensions?.includes("time"))return g.t("renderer.as_of_today");if(Y?.type==="relative"){const me=j.TimePeriods.get(j.TIMEFRAME_LOOKUP[Y.time_range]);return me?me.display:(console.warn("Did not recognize the given relative time range:",Y.time_range),Y.time_range)}else if(Y?.type==="absolute"){const me=Y.tz||"Etc/UTC";return`${j.formatTime(Y.start,{short:!0,tz:me})} - ${j.formatTime(Y.end,{short:!0,tz:me})}`}return null}),$=s.computed(()=>{const M=n.definition.query,Y=M?.datasource,me=Y?h.value[Y]?.timeRangeOptions:void 0,Be=(M&&"time_range"in M?M.time_range:void 0)??n.context.timeSpec;return It(Be,me)}),re=s.computed(()=>H.value?!1:[!!k.value,G.value,!!F.value,$.value,!!A.value,n.showRefresh,U.value].some(Boolean)),q=s.computed(()=>b.value?j.msToGranularity(b.value.meta.granularity_ms):void 0),oe=s.computed(()=>["timeseries_line","timeseries_bar"].includes(x.value.type)),le=s.computed(()=>b.value?.meta.metric_names??[]),V=s.ref();s.watch(le,M=>{(!V.value||!M.includes(V.value))&&(V.value=M[0])},{immediate:!0});const ee=s.computed(()=>{const M=x.value;return M.type!=="timeseries_line"?!1:le.value.some(Y=>M.metric_axis_map?.[Y]==="right")}),U=s.computed(()=>oe.value&&!ee.value&&(b.value?.data.length??0)>0&&le.value.length>1&&Object.keys(b.value?.meta.display??{}).length>0),be=M=>Object.hasOwn(Ni.chartLabels,M),B=s.computed(()=>le.value.map(M=>({value:M,label:be(M)?g.t(`chartLabels.${M}`):M}))),ie=s.computed(()=>{if(!Nt(n.definition)||!oe.value||!n.queryReady||v.value)return!1;const M=n.definition.query.granularity;return!M||!q.value?!1:M!==q.value}),Ie=s.computed(()=>{const M=j.msToGranularity(b.value?.meta.granularity_ms??0)??"unknown",Y=Nt(n.definition)?n.definition.query.granularity??"unknown":"unknown";return g.t("query_aged_out_warning",{currentGranularity:g.t(`granularities.${M}`),savedGranularity:g.t(`granularities.${Y}`)})}),qe=s.computed(()=>{const M=[...n.context.filters,...n.definition.query.filters??[]],Y="metrics"in n.definition.query?n.definition.query.metrics:void 0,me=n.definition.query.datasource??"api_usage";return f.value({datasource:me,filters:M,queryFields:Y})}),ve=()=>{l("edit-tile",n.definition)},Fe=()=>{l("duplicate-tile",n.definition)},de=()=>{l("remove-tile",n.definition)},xe=M=>{b.value=M,v.value=!1,l("chart-data",M),l("tile-loaded")},ce=()=>{v.value=!1,l("tile-loaded")},pe=M=>{v.value=M,M||l("tile-loaded")},Re=()=>{w.value=!1},Qe=()=>{if(Ot(n.definition))throw new Error("Cannot export data for a tile backed by the api-requests endpoint");const M=n.definition.query.datasource?.startsWith("goap");return c?.staticConfig?.increaseCsvExportLimit!==!1&&!M?te(n.definition.query,n.context,j.EXPORT_RECORD_LIMIT):b.value?Promise.resolve(b.value):new Promise(me=>{const Ue=s.watch(b,Be=>{Be&&(me(Be),Ue())})})},gt=async()=>{w.value=!0,E.value={status:"loading"};try{const M=await Qe();E.value={status:"success",chartData:M}}catch(M){E.value={status:"error",error:M}}},Pe=M=>{const Y={tileId:n.tileId.toString(),timeRange:M};l("tile-time-range-zoom",Y)},Ee=M=>{const Y={tileId:n.tileId.toString(),bounds:M};l("tile-bounds-change",Y)},$e=M=>{const Y=qe.value,me=fe(M,Y);he.value=z.value?{href:J(me)}:void 0,ne.value=S.value?{href:se(P(M,Y))}:void 0};return e({getExportData:Qe}),(M,Y)=>{const me=s.resolveComponent("KTooltip"),Ue=s.resolveComponent("KBadge"),Be=s.resolveComponent("KButton"),We=s.resolveComponent("KDropdownItem"),Ht=s.resolveComponent("KDropdown");return s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["tile-boundary",{editable:n.context.editable,headless:!re.value}]),"data-testid":`tile-${n.tileId}`},[re.value&&!H.value?(s.openBlock(),s.createElementBlock("div",cl,[s.createVNode(me,{class:"title-tooltip",disabled:!N.value,"max-width":"500",text:k.value},{default:s.withCtx(()=>[s.createElementVNode("div",{ref_key:"titleRef",ref:O,class:"title"},s.toDisplayString(k.value),513)]),_:1},8,["disabled","text"]),s.createElementVNode("div",ul,[$.value?(s.openBlock(),s.createBlock(Ue,{key:0,appearance:"warning","data-testid":"unsupported-time-range-badge",tooltip:s.unref(g).t("unsupported_time_range_warning"),"tooltip-attributes":{maxWidth:"320px"}},{icon:s.withCtx(()=>[s.createVNode(s.unref(Q.WarningIcon),{size:`var(--kui-icon-size-20, ${s.unref(ki)})`},null,8,["size"])]),default:s.withCtx(()=>[s.createElementVNode("span",dl,s.toDisplayString(s.unref(g).t("unsupported_time_range_badge")),1)]),_:1},8,["tooltip"])):s.createCommentVNode("",!0),F.value?(s.openBlock(),s.createBlock(Ue,{key:1,"data-testid":"time-range-badge",tooltip:ie.value?Ie.value:void 0,"tooltip-attributes":{maxWidth:"320px"}},s.createSlots({default:s.withCtx(()=>[s.createElementVNode("span",hl,s.toDisplayString(F.value),1)]),_:2},[ie.value?{name:"icon",fn:s.withCtx(()=>[s.createVNode(s.unref(Q.WarningIcon),{size:`var(--kui-icon-size-20, ${s.unref(ki)})`},null,8,["size"])]),key:"0"}:void 0]),1032,["tooltip"])):s.createCommentVNode("",!0)]),U.value?(s.openBlock(),s.createElementBlock("div",fl,[s.createVNode(s.unref(yn.KSegmentedControl),{modelValue:V.value,"onUpdate:modelValue":Y[0]||(Y[0]=Ft=>V.value=Ft),class:"metric-selector","data-testid":"metric-selector",options:B.value},null,8,["modelValue","options"])])):s.createCommentVNode("",!0),n.showRefresh?(s.openBlock(),s.createElementBlock("div",ml,[s.createVNode(Be,{appearance:"secondary",class:"refresh-button","data-testid":`tile-refresh-button-${n.tileId}`,disabled:v.value,icon:"",size:"small",onClick:a},{default:s.withCtx(()=>[v.value?(s.openBlock(),s.createBlock(s.unref(Q.ProgressIcon),{key:0,role:"button",size:`var(--kui-icon-size-60, ${s.unref(Ri)})`,tabindex:"0"},null,8,["size"])):(s.openBlock(),s.createBlock(s.unref(Q.RefreshIcon),{key:1,role:"button",size:`var(--kui-icon-size-60, ${s.unref(Ri)})`,tabindex:"0"},null,8,["size"]))]),_:1},8,["data-testid","disabled"])])):s.createCommentVNode("",!0),A.value?(s.openBlock(),s.createElementBlock("div",{key:2,class:"header-description","data-testid":`tile-description-${n.tileId}`},s.toDisplayString(A.value),9,pl)):s.createCommentVNode("",!0),T.value?(s.openBlock(),s.createElementBlock("div",{key:3,class:"tile-actions","data-testid":`tile-actions-${n.tileId}`},[T.value&&n.context.editable&&!n.isFullscreen?(s.openBlock(),s.createBlock(s.unref(Q.EditIcon),{key:0,class:"edit-icon",color:`var(--kui-color-text-neutral, ${s.unref(kt)})`,"data-testid":`edit-tile-${n.tileId}`,size:`var(--kui-icon-size-40, ${s.unref(Ti)})`,onClick:ve},null,8,["color","data-testid","size"])):s.createCommentVNode("",!0),T.value&&D.value&&!n.isFullscreen?(s.openBlock(),s.createBlock(Ht,{key:1,class:"dropdown","data-testid":`chart-action-menu-${n.tileId}`,"kpop-attributes":{placement:"bottom-end"}},{items:s.withCtx(()=>[s.unref(m)?(s.openBlock(),s.createBlock(We,{key:0,"data-testid":`chart-jump-to-explore-${n.tileId}`,item:{label:s.unref(g).t("jumpToExplore"),to:s.unref(m)}},null,8,["data-testid","item"])):s.createCommentVNode("",!0),!s.unref(De)(n.definition)&&s.unref(_)?(s.openBlock(),s.createBlock(We,{key:1,"data-testid":`chart-jump-to-requests-${n.tileId}`,item:{label:s.unref(g).t("jumpToRequests"),to:s.unref(_)}},null,8,["data-testid","item"])):s.createCommentVNode("",!0),p.value?(s.openBlock(),s.createBlock(We,{key:2,class:"chart-export-button","data-testid":`chart-csv-export-${n.tileId}`,onClick:gt},{default:s.withCtx(()=>[s.createElementVNode("span",{class:"chart-export-trigger","data-testid":`csv-export-button-${n.tileId}`},s.toDisplayString(s.unref(g).t("csvExport.exportAsCsv")),9,yl)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0),n.context.editable?(s.openBlock(),s.createBlock(We,{key:3,"data-testid":`duplicate-tile-${n.tileId}`,onClick:Fe},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(s.unref(g).t("renderer.duplicateTile")),1)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0),n.context.editable?(s.openBlock(),s.createBlock(We,{key:4,"data-testid":`remove-tile-${n.tileId}`,onClick:de},{default:s.withCtx(()=>[s.createElementVNode("span",_l,s.toDisplayString(s.unref(g).t("renderer.delete")),1)]),_:1},8,["data-testid"])):s.createCommentVNode("",!0)]),default:s.withCtx(()=>[s.createVNode(s.unref(Q.MoreIcon),{class:"kebab-action-menu",color:`var(--kui-color-text-neutral, ${s.unref(kt)})`,"data-testid":`kebab-action-menu-${n.tileId}`,size:`var(--kui-icon-size-40, ${s.unref(Ti)})`},null,8,["color","data-testid","size"])]),_:1},8,["data-testid"])):s.createCommentVNode("",!0)],8,gl)):s.createCommentVNode("",!0),w.value?(s.openBlock(),s.createBlock(ji,{key:4,"data-testid":`csv-export-modal-${n.tileId}`,"export-state":E.value,filename:C.value,onCloseModal:Re},null,8,["data-testid","export-state","filename"])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),s.createElementVNode("div",{class:s.normalizeClass(["tile-content",`type-${n.tileType}-${x.value.type}`]),"data-testid":`tile-content-${n.tileId}`},[ue.value?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(ue.value.component),s.mergeProps({key:0},ue.value.rendererProps,s.toHandlers(K.value),{onChartData:xe,onQueryComplete:ce}),null,16)):s.createCommentVNode("",!0)],10,bl)],10,ll)}}}),[["__scopeId","data-v-a062c19f"]]),wl=(n,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 r=[];for(let o=0;o<t;o++)i.get(o)?r.push("auto"):r.push(`${n}px`);return r},hn=we(s.defineComponent({__name:"GridLayout",props:{tileHeight:{type:Number,required:!1,default:()=>je},columns:{type:Number,required:!1,default:()=>ct},tiles:{type:Array,required:!0}},setup(n){s.useCssVars(u=>({v6834ae83:e.columns,v9c95201e:a.value}));const e=n,t=s.ref(null),i=s.ref(0),r=new ResizeObserver(u=>{window.requestAnimationFrame(()=>{!Array.isArray(u)||!u.length||(i.value=u[0].contentRect.width)})});s.onMounted(()=>{t.value&&r.observe(t.value)}),s.onUnmounted(()=>{t.value&&r.unobserve(t.value)});const o=s.computed(()=>wl(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 vl(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,u=this.getScrollElement(e);if(u!==null){const c=u.scrollTop;r.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 r=this.getScrollElement(t),o=r.clientHeight,a=r===this.getScrollElement()?0:r.getBoundingClientRect().top,l=e.clientY-a,u=l<i,c=l>o-i;u?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 Oe{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 u=0;for(;i=i||this.collide(e,o,r.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&&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 u of i){if(u.locked||!u._rect)break;const c=u._rect;let d=Number.MAX_VALUE,h=Number.MAX_VALUE;r.y<c.y?d=(o.y+o.h-c.y)/c.h:r.y+r.h>c.y+c.h&&(d=(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,d);f>l&&(l=f,a=u)}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,u)=>{let c;a.locked||(a.autoPosition=!0,e==="list"&&l&&(c=u[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??Oe._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 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 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 Oe({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(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 Oe({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 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),g=y.area(d._rect);h/(f<g?f:g)>.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,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),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 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]||[],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&&(!r&&!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(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(d,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,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,!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(u=>u.id===o.id):void 0;o._id=l?._id??Oe._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??Oe._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}}Oe._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 L{}const Te=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 ut(n,e){n.touches.length>1||(n.cancelable&&n.preventDefault(),y.simulateMouseEvent(n.changedTouches[0],e))}function fn(n,e){n.cancelable&&n.preventDefault(),y.simulateMouseEvent(n,e)}function dt(n){Ne.touchHandled||(Ne.touchHandled=!0,ut(n,"mousedown"))}function ht(n){Ne.touchHandled&&ut(n,"mousemove")}function ft(n){if(!Ne.touchHandled)return;Ne.pointerLeaveTimeout&&(window.clearTimeout(Ne.pointerLeaveTimeout),delete Ne.pointerLeaveTimeout);const e=!!L.dragElement;ut(n,"mouseup"),e||ut(n,"click"),Ne.touchHandled=!1}function mt(n){n.pointerType!=="mouse"&&n.target.releasePointerCapture(n.pointerId)}function mn(n){L.dragElement&&n.pointerType!=="mouse"&&fn(n,"mouseenter")}function pn(n){L.dragElement&&n.pointerType!=="mouse"&&(Ne.pointerLeaveTimeout=window.setTimeout(()=>{delete Ne.pointerLeaveTimeout,fn(n,"mouseleave")},10))}class pt{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(`${pt.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),Te&&(this.el.addEventListener("touchstart",dt),this.el.addEventListener("pointerdown",mt)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Te&&(this.el.removeEventListener("touchstart",dt),this.el.removeEventListener("pointerdown",mt)),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),Te&&(this.el.addEventListener("touchmove",ht),this.el.addEventListener("touchend",ft)),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),Te&&(this.el.removeEventListener("touchmove",ht),this.el.removeEventListener("touchend",ft)),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}}pt.prefix="ui-resizable-";class Pt{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 it extends Pt{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),L.overResizeElement===this&&delete L.overResizeElement),this}_mouseOver(e){L.overResizeElement||L.dragElement||(L.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){L.overResizeElement===this&&(delete L.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new pt(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=it._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 it._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,u;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,u=!0);const c=this._constrainSize(r.width,r.height,l,u);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,u=(r?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: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}}it._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const xl='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class nt extends Pt{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),Te&&(e.addEventListener("touchstart",dt),e.addEventListener("pointerdown",mt))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),Te&&(t.removeEventListener("touchstart",dt),t.removeEventListener("pointerdown",mt))}),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(!L.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(xl)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete L.dragElement,delete L.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Te&&(e.currentTarget.addEventListener("touchmove",ht),e.currentTarget.addEventListener("touchend",ft)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),L.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),L.pauseDrag){const i=Number.isInteger(L.pauseDrag)?L.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,L.dragElement=this;const i=this.el.gridstackNode?.grid;i?L.dropElement=i.el.ddElement.ddDroppable:delete L.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),Te&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",ht,!0),e.currentTarget.removeEventListener("touchend",ft,!0)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),L.dropElement?.el===this.el.parentElement&&delete L.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),L.dropElement&&L.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete L.dragElement,delete L.dropElement,delete L.mouseHandled,e.preventDefault()}_keyEvent(e){const t=this.el.gridstackNode,i=t?.grid||L.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=nt.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",nt.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}}}}nt.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class El extends Pt{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),Te&&(this.el.addEventListener("pointerenter",mn),this.el.addEventListener("pointerleave",pn)))}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),Te&&(this.el.removeEventListener("pointerenter",mn),this.el.removeEventListener("pointerleave",pn)))}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(!L.dragElement||!this._canDrop(L.dragElement.el))return;e.preventDefault(),e.stopPropagation(),L.dropElement&&L.dropElement!==this&&L.dropElement._mouseLeave(e,!0),L.dropElement=this;const t=y.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(L.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){if(!L.dragElement||L.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(L.dragElement)),this.triggerEvent("dropout",i),L.dropElement===this&&(delete L.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(L.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 Bt{static init(e){return e.ddElement||(e.ddElement=new Bt(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 nt(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 it(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 El(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class Cl{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 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,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,L.dragElement?L.dragElement.el:o.target,L.dragElement?L.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?Bt.init(a):null)).filter(a=>a):[]}}const ye=new Cl;class I{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=I.getGridElement(t);return i?(i.gridstack||(i.gridstack=new I(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 ?
|
|
13
|
-
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"||(I.getGridElements(t).forEach(r=>{r.gridstack||(r.gridstack=new I(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 ?
|
|
14
|
-
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")||I.addRemoveCB)&&(I.addRemoveCB?i=I.addRemoveCB(e,t,!0,!0):i=y.createDiv(["grid-stack",t.class],e)),I.init(t,i)}static registerEngine(e){I.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 r=t.columnOpts?.breakpoints;const o=t;if(o.oneColumnModeDomSort&&(delete o.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),o.oneColumnSize||o.disableOneColumnMode===!1){const h=o.oneColumnSize||768;delete o.oneColumnSize,delete o.disableOneColumnMode,t.columnOpts=t.columnOpts||{},r=t.columnOpts.breakpoints=t.columnOpts.breakpoints||[];let f=r.find(g=>g.c===1);f?f.w=h:(f={c:1,w:h},r.push(f,{c:12,w:h+1}))}const a=t.columnOpts;a&&(!a.columnWidth&&!a.breakpoints?.length?(delete t.columnOpts,r=void 0):a.columnMax=a.columnMax||12),r?.length>1&&r.sort((h,f)=>(f.w||0)-(h.w||0));const l={...y.cloneDeep(_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=Te),this._styleSheetClass="gs-id-"+Oe._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const d=t.engineClass||I.engineClass||Oe;if(this.engine=new d({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:h=>{let f=0;this.engine.nodes.forEach(g=>{f=Math.max(f,g.y+g.h)}),h.forEach(g=>{const b=g.el;b&&(g._removeDOM?(b&&b.remove(),delete g._removeDOM):this._writePosAttr(b,g))}),this._updateStyles(!1,f)}}),this._updateStyles(!1,0),t.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(h=>this._prepareElement(h)),delete this.engine._loading,this.batchUpdate(!1)),t.children){const h=t.children;delete t.children,h.length&&this.load(h)}this.setAnimation(),t.subGridDynamic&&!L.pauseDrag&&(L.pauseDrag=!0),t.draggable?.pause!==void 0&&(L.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:I.addRemoveCB?t=I.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,I.renderCB(i,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(t))):I.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 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(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),I.addRemoveCB?d=I.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 g=u?t.column:o.w,b=o.h+i.h,E=o.el.style;E.transition="none",this.update(o.el,{w:g,h:b}),setTimeout(()=>E.transition=null)}const f=o.subGrid=I.addGrid(c,t);return i?._moving&&(f._isTemp=!0),u&&(f._autoColumn=!0),r&&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=I.saveCB){const r=this.engine.save(e,i);if(r.forEach(o=>{if(e&&o.el&&!o.subGrid&&!i){const a=o.el.querySelector(".grid-stack-item-content");o.content=a?.innerHTML,o.content||delete o.content}else if(!e&&!i&&delete o.content,o.subGrid?.el){const a=o.subGrid.save(e,t,i);o.subGridOpts=t?a:{children:a},delete o.subGrid}delete o.el}),t){const o=y.cloneDeep(this.opts);o.marginBottom===o.marginTop&&o.marginRight===o.marginLeft&&o.marginTop===o.marginRight&&(o.margin=o.marginTop,delete o.marginTop,delete o.marginRight,delete o.marginBottom,delete o.marginLeft),o.rtl===(this.el.style.direction==="rtl")&&(o.rtl="auto"),this._isAutoCellHeight&&(o.cellHeight="auto"),this._autoColumn&&(o.column="auto");const a=o._alwaysShowResizeHandle;return delete o._alwaysShowResizeHandle,a!==void 0?o.alwaysShowResizeHandle=a:delete o.alwaysShowResizeHandle,y.removeInternalAndSame(o,_e),o.children=r,o}return r}load(e,t=I.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=I.addRemoveCB;typeof t=="function"&&(I.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)||(I.addRemoveCB&&I.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?I.addRemoveCB=o:delete I.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(),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,r){return this.engine.isAreaEmpty(e,t,i,r)}makeWidget(e,t){const i=I.getElement(e);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const r=i.gridstackNode;this._updateContainerHeight(),r.subGridOpts&&this.makeSubGrid(i,r.subGridOpts,void 0,!1);let o;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(o=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),o&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(r=>this.on(r,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=r=>t(r):this._gsEventHandler[e]=r=>{r.detail&&t(r,r.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=!0,i=!0){return e?(I.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&&I.addRemoveCB&&I.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&&I.addRemoveCB&&I.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 I.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(d=>o[d]!==void 0&&o[d]!==r[d])&&(l={},a.forEach(d=>{l[d]=o[d]!==void 0?o[d]:r[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&&(r.content=o.content,I.renderCB(d,o),r.subGrid?.el&&(d.appendChild(r.subGrid.el),r.subGrid.opts.styleInHead||r.subGrid._updateStyles(!0))),delete o.content}let u=!1,c=!1;for(const d in o)d[0]!=="_"&&r[d]!==o[d]&&(r[d]=o[d],u=!0,c=c||!this.opts.staticGrid&&(d==="noResize"||d==="noMove"||d==="locked"));if(y.sanitizeMinMax(r),l){const d=l.w!==void 0&&l.w!==r.w;this.moveNode(r,l),d&&r.subGrid?r.subGrid.onResize(this.hasAnimationCSS()?r.w:void 0):this.resizeToContentCheck(d,r),delete r._orig}(l||u)&&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(I.resizeToContentParent)),!a)return;const l=e.clientHeight-a.clientHeight,u=t.h?t.h*r-l:a.clientHeight;let c;if(t.subGrid){c=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const f=t.subGrid.el.getBoundingClientRect(),g=t.subGrid.el.parentElement.getBoundingClientRect();c+=f.top-g.top}else{if(t.subGridOpts?.children?.length)return;{const f=a.firstElementChild;if(!f){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${I.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/r);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){I.resizeToContentCB?I.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return I.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,u=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;o.x=r.x+l-(r.h-(u+1)),o.y=r.y+u-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,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+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(_e.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 I.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 ye}static setupDragIn(e,t,i,r=document){t?.pause!==void 0&&(L.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?y.getElements(e,r):e).forEach((a,l)=>{ye.isDraggable(a)||ye.dragIn(a,t),i?.[l]&&(a.gridstackNode=i[l])})}movable(e,t){return this.opts.staticGrid?this:(I.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:(I.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&&I._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return ye.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 ye.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: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)){ye.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 ye.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 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),I._itemRemoving(l.el,!1),ye.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 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 g=h.grid;g.engine.removeNodeFromLayoutCache(h),g.engine.removedNodes.push(h),g._triggerRemoveEvent()._triggerChangeEvent(),g.parentGridNode&&!g.engine.nodes.length&&g.opts.subGridDynamic&&g.removeAsSubGrid()}if(!l||(u&&(this.engine.cleanupNode(l),l.grid=this),delete l.grid?._isTemp,ye.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||I.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),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&&!ye.isDroppable(e)&&ye.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>I._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>I._itemRemoving(i,!1)),this):this}prepareDragDrop(e,t=!1){const i=e?.gridstackNode;if(!i)return;const r=i.noMove||this.opts.disableDrag,o=i.noResize||this.opts.disableResize,a=this.opts.staticGrid||r&&o;if((t||a)&&(i._initDD&&(this._removeDD(e),delete i._initDD),a&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!t))return this;if(!i._initDD){let l,u;const c=(f,g)=>{this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,f.target),l=this.cellWidth(),u=this.getCellHeight(!0),this._onStartMoving(e,f,g,i,l,u)},d=(f,g)=>{this._dragOrResize(e,f,g,i,l,u)},h=f=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._event,delete i._lastTried;const g=i.w!==i._orig.w,b=f.target;if(!(!b.gridstackNode||b.gridstackNode.grid!==this)){if(i.el=b,i._isAboutToRemove){const E=e.gridstackNode.grid;E._gsEventHandler[f.type]&&E._gsEventHandler[f.type](f,b),E.engine.nodes.push(i),E.removeWidget(e,!0,!0)}else y.removePositioningStyles(b),i._temporaryRemoved?(y.copyPos(i,i._orig),this._writePosAttr(b,i),this.engine.addNode(i)):this._writePosAttr(b,i),this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,b);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),f.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(g,i))}};ye.draggable(e,{start:c,stop:h,drag:d}).resizable(e,{start:c,stop:h,resize:d}),i._initDD=!0}return ye.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,u=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-r.y;ye.resizable(e,"option","minWidth",o*Math.min(r.minW||1,l)).resizable(e,"option","minHeight",a*Math.min(r.minH||1,u)).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,u)).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 u,c=this.opts.marginLeft,d=this.opts.marginRight,h=this.opts.marginTop,f=this.opts.marginBottom;const g=Math.round(a*.1),b=Math.round(o*.1);if(c=Math.min(c,b),d=Math.min(d,b),h=Math.min(h,g),f=Math.min(f,g),t.type==="drag"){if(r._temporaryRemoved)return;const w=i.position.top-r._prevYPix;r._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&y.updateScrollPosition(e,i.position,w);const O=i.position.left+(i.position.left>r._lastUiPosition.left?-d:c),N=i.position.top+(i.position.top>r._lastUiPosition.top?-f:h);l.x=Math.round(O/o),l.y=Math.round(N/a);const v=this._extraDragRow;if(this.engine.collide(r,l)){const x=this.getRow();let k=Math.max(0,l.y+r.h-x);this.opts.maxRow&&x+k>this.opts.maxRow&&(k=Math.max(0,this.opts.maxRow-x)),this._extraDragRow=k}else this._extraDragRow=0;if(this._extraDragRow!==v&&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 w=i.position.left+c,O=i.position.top+h;l.x=Math.round(w/o),l.y=Math.round(O/a),u=!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-d,h:(i.size?i.size.height:r.h*a)-h-f};if(this.engine.moveNodeCheck(r,{...l,cellWidth:o,cellHeight:a,rect:E,resizing:u})){r._lastUiPosition=i.position,this.engine.cacheRects(o,a,h,d,f,c),delete r._skipDown,u&&r.subGrid&&r.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const w=t.target;r._sidebarOrig||this._writePosAttr(w,r),this._gsEventHandler[t.type]&&this._gsEventHandler[t.type](t,w)}}_leave(e,t){t=t||e;const i=t.gridstackNode;if(!i||(t.style.transform=t.style.transformOrigin=null,ye.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&&I._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return vl(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}I.renderCB=(n,e)=>{n&&e?.content&&(n.textContent=e.content)},I.resizeToContentParent=".grid-stack-item-content",I.Utils=y,I.Engine=Oe,I.GDRev="11.5.1";const kl=["data-id","data-testid","gs-h","gs-w","gs-x","gs-y"],Tl={class:"grid-stack-item-content"},Rl=we(s.defineComponent({__name:"DraggableGridLayout",props:{tiles:{},tileHeight:{default:je},columns:{default:ct}},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(g=>[`${g.id}`,g])));let l=null;const u=g=>`[data-id="${g}"]`,c=g=>g.map(b=>{const E=a.value.get(`${b.el?.getAttribute("data-id")}`);if(E)return{...E,layout:{position:{col:Number(b.x),row:Number(b.y)},size:{cols:Number(b.w),rows:Number(b.h)}}}}).filter(b=>b!==void 0),d=(g,b)=>{l&&(c(b).forEach(w=>{a.value.set(`${w.id}`,w)}),r("update-tiles",Array.from(a.value.values())))},h=(g,b)=>{b.forEach(E=>{a.value.delete(`${E.el?.getAttribute("data-id")}`)}),r("update-tiles",Array.from(a.value.values()))};s.onMounted(()=>{o.value&&(l=I.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=g=>{if(l&&o.value){const b=o.value.querySelector(u(g));b&&l.removeWidget(b)}};return s.watch(()=>i.tiles.length,async(g,b)=>{if(g>b&&l){const E=i.tiles.slice(b);for(const w of E)a.value.set(`${w.id}`,w),await s.nextTick(),l.makeWidget(u(w.id),{autoPosition:!0,w:w.layout.size.cols,h:w.layout.size.rows})}}),s.watchEffect(()=>{i.tiles.forEach(g=>{a.value.set(`${g.id}`,g)})}),e({removeWidget:f}),(g,b)=>(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",Tl,[s.renderSlot(g.$slots,"tile",{fitToContent:!1,tile:E},void 0,!0)])],8,kl))),128))],512))}}),[["__scopeId","data-v-a060e0c5"]]),Sl=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}},Dl={key:0,class:"fullscreen-header"},Ol={key:0,class:"tile-container slottable-tile"},Nl=we(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(C=>({v577760a8:d.value})),n.context.disableCoordination!==!0){const C=_n();s.provide(Mi,C)}const i=t,r=s.useModel(n,"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(ke);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:g,exportState:b}=ae.useExportPdf(c),E=C=>{h.add(C.id);const D=N.value.filter(T=>!x(T)).length;h.size>=D&&i("tiles-loaded",!0)},w=s.computed(()=>{const D=`renderer.trendRange.${te.value.type==="absolute"?"custom":te.value.time_range}`;return o.te(D)?o.t(D):""}),O=(C,D)=>{const T=C.layout.position.row-D.layout.position.row;return T!==0?T:C.layout.position.col-D.layout.position.col},N=s.computed(()=>r.value.tiles.map(C=>{if(fe.value&&!C.id&&console.warn("No id provided for tile. One will be generated automatically,","however tracking changes to this tile may not work as expected.",C),C.type==="slottable")return{layout:C.layout,type:C.type,id:C.id??crypto.randomUUID()};let D=C.definition;const T=C.type??"chart",G=ta(D,w.value);return G!==D.header_description&&(D={...D,header_description:G}),{layout:C.layout,meta:D,type:T,id:C.id??crypto.randomUUID()}})),v=C=>{i("edit-tile",C)},x=C=>C.type==="slottable"?!0:C.meta?.chart.type==="slottable",k=C=>C.type==="slottable",A=C=>{if(C.type==="slottable")return C.id;const D=C.meta?.chart;return D&&k(D)?D.id:void 0},H=C=>{try{const D=Sl(C);r.value.tiles.push(JSON.parse(JSON.stringify(D)))}catch(D){console.warn(D)}},p=C=>{l.value&&l.value.removeWidget(C.id),h.delete(C.id)},m=()=>{h.clear(),a.value++},_=C=>{const D=C.map(T=>T.type==="slottable"?{id:T.id,type:T.type,layout:T.layout}:{id:T.id,type:T.type,layout:T.layout,definition:T.meta});r.value.tiles=D.sort(O)},R=async()=>{if(d.value="scale(1)",await s.nextTick(),c.value){const{availWidth:C,availHeight:D}=window.screen,{width:T,height:G}=c.value.getBoundingClientRect(),X=Math.min(D/G,C/T);d.value=`scale(${X})`}},S=()=>{u.value&&(document.fullscreenElement?document.exitFullscreen():u.value.requestFullscreen())},z=s.ref(!1),ne=()=>{z.value=document.fullscreenElement!==null,z.value&&R()},he=s.computed(()=>r.value.preset_filters??[]),{editable:fe,enrichedContext:J,queryReady:se,showTileActions:P,timeSpec:te}=ae.useDashboardContext({globalFilters:he,context:s.computed(()=>n.context),isFullscreen:z,preview:s.computed(()=>n.preview)});return e({refresh:m,toggleFullscreen:S,exportPdf:g,pdfExportState:b}),(C,D)=>{const T=s.resolveComponent("KAlert");return s.openBlock(),s.createElementBlock("div",{ref_key:"dashboardContainer",ref:u,class:s.normalizeClass(["kong-ui-public-dashboard-renderer",{"is-fullscreen":z.value}]),onFullscreenchange:ne},[s.createElementVNode("div",{ref_key:"layoutContainer",ref:c,class:"layout"},[s.unref(f)&&z.value?(s.openBlock(),s.createElementBlock("div",Dl,[s.renderSlot(C.$slots,"fullscreenHeader",{},void 0,!0)])):s.createCommentVNode("",!0),s.unref(f)?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(s.unref(fe)&&!z.value?Rl:hn),{key:2,ref_key:"gridLayoutRef",ref:l,columns:r.value.columns,"tile-height":r.value.tile_height,tiles:N.value,onUpdateTiles:_},{tile:s.withCtx(({tile:G,fitToContent:X})=>[x(G)?(s.openBlock(),s.createElementBlock("div",Ol,[s.renderSlot(C.$slots,A(G),{},void 0,!0)])):(s.openBlock(),s.createBlock(dn,{key:z.value?`${G.id}-tile`:`${G.id}-tile-fullscreen`,"refresh-counter":a.value,"onUpdate:refreshCounter":D[0]||(D[0]=K=>a.value=K),class:"tile-container",context:s.unref(J),definition:G.meta,"fit-to-content":X,height:G.layout.size.rows*(r.value.tile_height||s.unref(je))+parseInt(s.unref(Si),10),"hide-actions":!s.unref(P),"is-fullscreen":z.value,preview:n.preview,"query-ready":s.unref(se),"tile-id":G.id,"tile-type":G.type,onDuplicateTile:K=>H(G),onEditTile:K=>v(G),onRemoveTile:K=>p(G),onTileLoaded:K=>E(G),onTileTimeRangeZoom:D[1]||(D[1]=K=>i("tile-time-range-zoom",K))},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(T,{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"]]),Ml=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=v=>{a("tile-time-range-zoom",v)},u=v=>{a("chart-data",v)},c=v=>{a("tile-bounds-change",v)},{i18n:d}=ae.useI18n(),{enrichedContext:h,queryReady:f}=ae.useDashboardContext({globalFilters:s.toRef(()=>n.globalFilters),context:s.toRef(()=>n.context),preview:s.computed(()=>n.preview)}),g=s.computed(()=>De(n.definition)),b=s.computed(()=>g.value?"columns"in n.definition.query&&!n.definition.query.columns?.length:!("metrics"in n.definition.query)||!n.definition.query.metrics||n.definition.query.metrics.length===0),E=s.ref(je);let w;s.onMounted(()=>{const v=i.value?.parentElement;v&&(E.value=v.getBoundingClientRect().height,w=new ResizeObserver(([x])=>{const{height:k}=x.contentRect;E.value=k}),w.observe(v))}),s.onUnmounted(()=>w?.disconnect());const O=s.ref(0);return e({refresh:()=>{O.value++},getExportData:()=>r.value?.getExportData()}),(v,x)=>{const k=s.resolveComponent("KEmptyState");return s.openBlock(),s.createElementBlock("div",{ref_key:"root",ref:i,"data-testid":"dashboard-tile-preview-root"},[b.value?(s.openBlock(),s.createBlock(k,{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(dn,{key:1,ref:"dashboard-tile","refresh-counter":O.value,"onUpdate:refreshCounter":x[0]||(x[0]=A=>O.value=A),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:u,onTileBoundsChange:c,onTileTimeRangeZoom:l},null,8,["refresh-counter","context","definition","height","preview","query-ready","tile-id"]))],512)}}}),Il=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},zl=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}}},Al=(n,e=ct)=>{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,u=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,u)}return o},Ll=(n,e)=>{if(e){const r=n.tiles.map(zl);return{...n,tiles:r}}const t=n.tiles.map(Il).filter(r=>r!==void 0),i=Al(t,n.columns);return{...n,tiles:i}},ql=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?Yt.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:g,operator:b})=>g==="country_code"&&(b==="not_empty"||b==="empty"||b==="in"))){const g={field:"country_code",operator:"not_empty"};return{...t.query,filters:[...t.query.filters||[],g]}}return t.query}),u=s.computed(()=>{if(!i.value)return"";const f=i?.value?.meta.metric_units,g=i?.value?.meta?.metric_names;return f&&g&&f[g[0]]}),c=f=>{i.value=f},d=e,h=f=>{d("bounds-change",f)};return(f,g)=>(s.openBlock(),s.createBlock(Le,{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(Yt.AnalyticsGeoMap),{bounds:n.chartOptions.bounds,"country-metrics":r.value,"fit-to-country":n.chartOptions.fit_to_country,metric:o.value,"metric-unit":u.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"}));W.CP_ID_TOKEN=Ii,W.CsvExportModal=ji,W.DASHBOARD_COLS=ct,W.DEFAULT_TILE_HEIGHT=je,W.DEFAULT_TILE_REFRESH_INTERVAL_MS=Ai,W.DashboardRenderer=Nl,W.DashboardTilePreview=Ml,W.ENTITY_ID_TOKEN=Rt,W.FULLSCREEN_LONG_REFRESH_INTERVAL_MS=qi,W.FULLSCREEN_SHORT_REFRESH_INTERVAL_MS=Li,W.GridLayout=hn,W.INJECT_DASHBOARD_COORDINATOR=Mi,W.INJECT_QUERY_PROVIDER=ke,W.TIMEFRAME_TOKEN=zi,W.configureAllowedDefinition=Ll,W.getTimeRangeDurationMs=Mt,W.isTimeRangeUnsupported=It,W.limitTimeRange=zt,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(W,n){typeof exports=="object"&&typeof module<"u"?n(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"],n):(W=typeof globalThis<"u"?globalThis:W||self,n(W["kong-ui-public-dashboard-renderer"]={},W.Vue,W["kong-ui-public-analytics-utilities"],W.KongIcons,W["kong-ui-public-analytics-chart"],W.swrv,W["kong-ui-public-analytics-metric-provider"],W.AgGridVue,W.agGridCommunity,W["kong-ui-public-i18n"],W["kong-ui-public-analytics-config-store"],W.Kongponents,W.VueECharts,W.echarts,W.echarts,W.echarts,W.echarts,W.axios,W["kong-ui-public-analytics-geo-map"]))})(this,(function(W,n,ee,ie,xe,ei,ti,Pr,Qe,at,Ne,qr,Hr,bt,Gr,lt,ii,Sg,ri){"use strict";function Fr(){const r=n.ref(null),e=n.ref(null),t=n.ref(null),i=n.ref(null),s=n.ref(null),o=300,a=300,l=10,u=({chartUuid:d,timestamp:h=null,dimension:f=null,dimensionValue:m=null,metric:_=null})=>{r.value=d,e.value=h,t.value=f,i.value=m,s.value=_},c=({chartUuid:d})=>{r.value===d&&(r.value=null,e.value=null,t.value=null,i.value=null,s.value=null)};return{activate:u,activeChart:n.readonly(r),activeDimension:n.readonly(t),activeDimensionValue:n.readonly(i),activeMetric:n.readonly(s),activeTimestamp:n.readonly(e),deactivate:c,DIMENSION_DEBOUNCE_MS:o,METRIC_DEBOUNCE_MS:a,TIMESTAMP_DEBOUNCE_MS:l}}const $r=r=>{const e=r.length;let t=5381;for(let i=0;i<e;i++)t=t*33^r.charCodeAt(i);return t>>>0},Wr="#0044f4",ni="#6c7489",Vr="#d60027",Yr="#ffc400",Xr="#bee2ff",jr="#8fc1ff",Qr="#5f9aff",Zr="#306fff",Jr="#b5ffee",en="#00fabe",tn="#00d6a4",rn="#00a17b",nn="#007d60",sn="#005944",on="#b5ffee",an="#00fabe",ln="#b5ffee",cn="#00a17b",un="#fff296",dn="#ffe04b",hn="#ffc400",fn="#b37600",mn="#995c00",pn="#804400",gn="#fff296",_n="#ffe04b",yn="#ffc2b3",Rn="#ff9877",Cn="#ff723c",En="#f75008",On="#d13500",bn="#a31f00",wn="#ffc2b3",Tn="#ff9877",vn="#ff723c",Sn="#f75008",xn="#d13500",In="#a31f00",Dn="#ffc2b3",kn="#ff9877",Nn="#ff723c",An="#f75008",Ln="#d13500",Un="#a31f00",Kn="#ffc2b3",Mn="#ff9877",Bn="#ff723c",zn="#f75008",Pn="#d13500",qn="#a31f00",Hn="#ffc2b3",Gn="#ff9877",Fn="#ff723c",$n="#f75008",Wn="#d13500",Vn="#ffabab",Yn="#ff7272",Xn="#ff3954",jn="#f50045",Qn="#d60027",Zn="#ad000e",Jn="#ffabab",es="#ff7272",ts="#ff3954",is="#f50045",rs="#d60027",ns="#eefaff",ss="#ecfffb",os="#fffce0",as="#fff1ef",ls="#ffe5e5",cs="#5f9aff",us="#00d6a4",ds="#ffc400",hs="#ff723c",fs="#ff3954",ms={100:Xr,101:jr,102:Qr,103:Zr,200:Jr,201:en,202:tn,203:rn,204:nn,205:sn,206:on,207:an,208:ln,226:cn,300:un,301:dn,302:hn,303:fn,304:mn,305:pn,307:gn,308:_n,400:yn,401:Rn,402:Cn,403:En,404:On,405:bn,406:wn,407:Tn,408:vn,409:Sn,410:xn,411:In,412:Dn,413:kn,414:Nn,415:An,416:Ln,417:Un,418:Kn,421:Mn,422:Bn,423:zn,424:Pn,425:qn,426:Hn,428:Gn,429:Fn,431:$n,451:Wn,500:Vn,501:Yn,502:Xn,503:jn,504:Qn,505:Zn,506:Jn,507:es,508:ts,510:is,511:rs},ps={100:ns,200:ss,300:os,400:as,500:ls},si={"1XX":cs,"2XX":us,"3XX":ds,"4XX":hs,"5XX":fs},gs={error:Vr,warning:Yr,empty:"#9DA99D",neutral:ni,____OTHER____:Wr},oi=["#0076F4","#00819D","#00A17B","#8A50FF","#FF3C99","#FF6D3C","#B3A100"],ai=["#5485BA","#087D96","#3D8776","#7654BA","#A1406F","#BF5430","#B5A72C"],_s=r=>$r(r),li=({discriminator:r,theme:e="light",customPalette:t=void 0})=>{const i=Math.abs(Math.floor(r));return t?t[i%t.length]:e==="dark"?ai[i%ai.length]:oi[i%oi.length]},Ze=({state:r})=>gs[r]??ni,ys=({statusCode:r})=>{const e=typeof r=="number"?r:Number.parseInt(r,10),t=`${e}`,i=`${Math.floor(e/100)*100}`;return ms[t]??ps[i]??Ze({state:"neutral"})},Rs=({group:r})=>si[r]?si[r]:Ze({state:"neutral"}),Cs=({discriminator:r=void 0,state:e=void 0,dimension:t=void 0,dimensionValue:i=void 0,metric:s=void 0,customPalette:o=void 0})=>{let a="light";if(n.hasInjectionContext()&&(a=n.inject("app:konnectColorMode",n.computed(()=>"light")).value),r!==void 0)return li({discriminator:r,theme:a,customPalette:o});if(e!==void 0)return Ze({state:e});if(i&&["empty","____OTHER____"].includes(i))return Ze({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})}return t||i||s?li({discriminator:_s(`${t??""}${i??""}${s??""}`),theme:a,customPalette:o}):Ze({state:"neutral"})},Es={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"}},Os=(r,e,t)=>{let i;const s=Es[r];return typeof s=="string"?i=s:e===1?i=s.one:i=s.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+i:i+" ago":i};function wt(r){return(e={})=>{const t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}const bs={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ws={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ts={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},vs={date:wt({formats:bs,defaultWidth:"full"}),time:wt({formats:ws,defaultWidth:"full"}),dateTime:wt({formats:Ts,defaultWidth:"full"})},Ss={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},xs=(r,e,t,i)=>Ss[r];function Je(r){return(e,t)=>{const i=t?.context?String(t.context):"standalone";let s;if(i==="formatting"&&r.formattingValues){const a=r.defaultFormattingWidth||r.defaultWidth,l=t?.width?String(t.width):a;s=r.formattingValues[l]||r.formattingValues[a]}else{const a=r.defaultWidth,l=t?.width?String(t.width):r.defaultWidth;s=r.values[l]||r.values[a]}const o=r.argumentCallback?r.argumentCallback(e):e;return s[o]}}const Is={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Ds={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},ks={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"]},Ns={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"]},As={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"}},Ls={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"}},Us={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:Je({values:Is,defaultWidth:"wide"}),quarter:Je({values:Ds,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Je({values:ks,defaultWidth:"wide"}),day:Je({values:Ns,defaultWidth:"wide"}),dayPeriod:Je({values:As,defaultWidth:"wide",formattingValues:Ls,defaultFormattingWidth:"wide"})};function et(r){return(e,t={})=>{const i=t.width,s=i&&r.matchPatterns[i]||r.matchPatterns[r.defaultMatchWidth],o=e.match(s);if(!o)return null;const a=o[0],l=i&&r.parsePatterns[i]||r.parsePatterns[r.defaultParseWidth],u=Array.isArray(l)?Ms(l,h=>h.test(a)):Ks(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 Ks(r,e){for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}function Ms(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return t}function Bs(r){return(e,t={})=>{const i=e.match(r.matchPattern);if(!i)return null;const s=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(s.length);return{value:a,rest:l}}}const zs=/^(\d+)(th|st|nd|rd)?/i,Ps=/\d+/i,qs={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},Hs={any:[/^b/i,/^(a|c)/i]},Gs={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Fs={any:[/1/i,/2/i,/3/i,/4/i]},$s={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},Ws={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]},Vs={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},Ys={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]},Xs={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}},Qs={ordinalNumber:Bs({matchPattern:zs,parsePattern:Ps,valueCallback:r=>parseInt(r,10)}),era:et({matchPatterns:qs,defaultMatchWidth:"wide",parsePatterns:Hs,defaultParseWidth:"any"}),quarter:et({matchPatterns:Gs,defaultMatchWidth:"wide",parsePatterns:Fs,defaultParseWidth:"any",valueCallback:r=>r+1}),month:et({matchPatterns:$s,defaultMatchWidth:"wide",parsePatterns:Ws,defaultParseWidth:"any"}),day:et({matchPatterns:Vs,defaultMatchWidth:"wide",parsePatterns:Ys,defaultParseWidth:"any"}),dayPeriod:et({matchPatterns:Xs,defaultMatchWidth:"any",parsePatterns:js,defaultParseWidth:"any"})},Zs={code:"en-US",formatDistance:Os,formatLong:vs,formatRelative:xs,localize:Us,match:Qs,options:{weekStartsOn:0,firstWeekContainsDate:1}};let Js={};function tt(){return Js}const ci=6048e5,eo=864e5,ui=Symbol.for("constructDateFrom");function Le(r,e){return typeof r=="function"?r(e):r&&typeof r=="object"&&ui in r?r[ui](e):r instanceof Date?new r.constructor(e):new Date(e)}function we(r,e){return Le(e||r,r)}function di(r){const e=we(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 to(r,...e){const t=Le.bind(null,e.find(i=>typeof i=="object"));return e.map(t)}function hi(r,e){const t=we(r,e?.in);return t.setHours(0,0,0,0),t}function io(r,e,t){const[i,s]=to(t?.in,r,e),o=hi(i),a=hi(s),l=+o-di(o),u=+a-di(a);return Math.round((l-u)/eo)}function ro(r,e){const t=we(r,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function no(r,e){const t=we(r,e?.in);return io(t,ro(t))+1}function it(r,e){const t=tt(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,s=we(r,e?.in),o=s.getDay(),a=(o<i?7:0)+o-i;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function ct(r,e){return it(r,{...e,weekStartsOn:1})}function fi(r,e){const t=we(r,e?.in),i=t.getFullYear(),s=Le(t,0);s.setFullYear(i+1,0,4),s.setHours(0,0,0,0);const o=ct(s),a=Le(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 so(r,e){const t=fi(r,e),i=Le(r,0);return i.setFullYear(t,0,4),i.setHours(0,0,0,0),ct(i)}function oo(r,e){const t=we(r,e?.in),i=+ct(t)-+so(t);return Math.round(i/ci)+1}function mi(r,e){const t=we(r,e?.in),i=t.getFullYear(),s=tt(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=Le(e?.in||r,0);a.setFullYear(i+1,0,o),a.setHours(0,0,0,0);const l=it(a,e),u=Le(e?.in||r,0);u.setFullYear(i,0,o),u.setHours(0,0,0,0);const c=it(u,e);return+t>=+l?i+1:+t>=+c?i:i-1}function ao(r,e){const t=tt(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,s=mi(r,e),o=Le(e?.in||r,0);return o.setFullYear(s,0,i),o.setHours(0,0,0,0),it(o,e)}function lo(r,e){const t=we(r,e?.in),i=+it(t,e)-+ao(t,e);return Math.round(i/ci)+1}function ne(r,e){const t=r<0?"-":"",i=Math.abs(r).toString().padStart(e,"0");return t+i}const Ue={y(r,e){const t=r.getFullYear(),i=t>0?t:1-t;return ne(e==="yy"?i%100:i,e.length)},M(r,e){const t=r.getMonth();return e==="M"?String(t+1):ne(t+1,2)},d(r,e){return ne(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 ne(r.getHours()%12||12,e.length)},H(r,e){return ne(r.getHours(),e.length)},m(r,e){return ne(r.getMinutes(),e.length)},s(r,e){return ne(r.getSeconds(),e.length)},S(r,e){const t=e.length,i=r.getMilliseconds(),s=Math.trunc(i*Math.pow(10,t-3));return ne(s,e.length)}},$e={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},pi={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(),s=i>0?i:1-i;return t.ordinalNumber(s,{unit:"year"})}return Ue.y(r,e)},Y:function(r,e,t,i){const s=mi(r,i),o=s>0?s:1-s;if(e==="YY"){const a=o%100;return ne(a,2)}return e==="Yo"?t.ordinalNumber(o,{unit:"year"}):ne(o,e.length)},R:function(r,e){const t=fi(r);return ne(t,e.length)},u:function(r,e){const t=r.getFullYear();return ne(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 ne(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 ne(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 Ue.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 ne(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 s=lo(r,i);return e==="wo"?t.ordinalNumber(s,{unit:"week"}):ne(s,e.length)},I:function(r,e,t){const i=oo(r);return e==="Io"?t.ordinalNumber(i,{unit:"week"}):ne(i,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):Ue.d(r,e)},D:function(r,e,t){const i=no(r);return e==="Do"?t.ordinalNumber(i,{unit:"dayOfYear"}):ne(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 s=r.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return ne(o,2);case"eo":return t.ordinalNumber(o,{unit:"day"});case"eee":return t.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(s,{width:"short",context:"formatting"});default:return t.day(s,{width:"wide",context:"formatting"})}},c:function(r,e,t,i){const s=r.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return ne(o,e.length);case"co":return t.ordinalNumber(o,{unit:"day"});case"ccc":return t.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(s,{width:"narrow",context:"standalone"});case"cccccc":return t.day(s,{width:"short",context:"standalone"});default:return t.day(s,{width:"wide",context:"standalone"})}},i:function(r,e,t){const i=r.getDay(),s=i===0?7:i;switch(e){case"i":return String(s);case"ii":return ne(s,e.length);case"io":return t.ordinalNumber(s,{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 s=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(r,e,t){const i=r.getHours();let s;switch(i===12?s=$e.noon:i===0?s=$e.midnight:s=i/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(r,e,t){const i=r.getHours();let s;switch(i>=17?s=$e.evening:i>=12?s=$e.afternoon:i>=4?s=$e.morning:s=$e.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(s,{width:"narrow",context:"formatting"});default:return t.dayPeriod(s,{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 Ue.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):Ue.H(r,e)},K:function(r,e,t){const i=r.getHours()%12;return e==="Ko"?t.ordinalNumber(i,{unit:"hour"}):ne(i,e.length)},k:function(r,e,t){let i=r.getHours();return i===0&&(i=24),e==="ko"?t.ordinalNumber(i,{unit:"hour"}):ne(i,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):Ue.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):Ue.s(r,e)},S:function(r,e){return Ue.S(r,e)},X:function(r,e,t){const i=r.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return _i(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 _i(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"+gi(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"+gi(i,":");default:return"GMT"+Pe(i,":")}},t:function(r,e,t){const i=Math.trunc(+r/1e3);return ne(i,e.length)},T:function(r,e,t){return ne(+r,e.length)}};function gi(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),s=Math.trunc(i/60),o=i%60;return o===0?t+String(s):t+String(s)+e+ne(o,2)}function _i(r,e){return r%60===0?(r>0?"-":"+")+ne(Math.abs(r)/60,2):Pe(r,e)}function Pe(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),s=ne(Math.trunc(i/60),2),o=ne(i%60,2);return t+s+e+o}const yi=(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"})}},Ri=(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"})}},co={p:Ri,P:(r,e)=>{const t=r.match(/(P+)(p+)?/)||[],i=t[1],s=t[2];if(!s)return yi(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}}",yi(i,e)).replace("{{time}}",Ri(s,e))}},uo=/^D+$/,ho=/^Y+$/,fo=["D","DD","YY","YYYY"];function mo(r){return uo.test(r)}function po(r){return ho.test(r)}function go(r,e,t){const i=_o(r,e,t);if(console.warn(i),fo.includes(r))throw new RangeError(i)}function _o(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 yo(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function Ro(r){return!(!yo(r)&&typeof r!="number"||isNaN(+we(r)))}const Co=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Eo=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Oo=/^'([^]*?)'?$/,bo=/''/g,wo=/[a-zA-Z]/;function Tt(r,e,t){const i=tt(),s=t?.locale??i.locale??Zs,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=we(r,t?.in);if(!Ro(l))throw new RangeError("Invalid time value");let u=e.match(Eo).map(d=>{const h=d[0];if(h==="p"||h==="P"){const f=co[h];return f(d,s.formatLong)}return d}).join("").match(Co).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const h=d[0];if(h==="'")return{isToken:!1,value:To(d)};if(pi[h])return{isToken:!0,value:d};if(h.match(wo))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:d}});s.localize.preprocessor&&(u=s.localize.preprocessor(l,u));const c={firstWeekContainsDate:o,weekStartsOn:a,locale:s};return u.map(d=>{if(!d.isToken)return d.value;const h=d.value;(!t?.useAdditionalWeekYearTokens&&po(h)||!t?.useAdditionalDayOfYearTokens&&mo(h))&&go(h,e,String(r));const f=pi[h[0]];return f(l,h,s.localize,c)}).join("")}function To(r){const e=r.match(Oo);return e?e[1].replace(bo,"'"):r}function vo(){return Object.assign({},tt())}function Ci(r,e,t){const i=vo(),s=Io(r,t.timeZone,t.locale??i.locale);return"formatToParts"in s?So(s,e):xo(s,e)}function So(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 xo(r,e){const t=r.format(e).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(t);return i?i[0].substr(1):""}function Io(r,e,t){return new Intl.DateTimeFormat(t?[t.code,"en-US"]:void 0,{timeZone:e,timeZoneName:r})}function Do(r,e){const t=Uo(e);return"formatToParts"in t?No(t,r):Ao(t,r)}const ko={year:0,month:1,day:2,hour:3,minute:4,second:5};function No(r,e){try{const t=r.formatToParts(e),i=[];for(let s=0;s<t.length;s++){const o=ko[t[s].type];o!==void 0&&(i[o]=parseInt(t[s].value,10))}return i}catch(t){if(t instanceof RangeError)return[NaN];throw t}}function Ao(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 vt={},Ei=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")),Lo=Ei==="06/25/2014, 00:00:00"||Ei==="06/25/2014 00:00:00";function Uo(r){return vt[r]||(vt[r]=Lo?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"})),vt[r]}function Oi(r,e,t,i,s,o,a){const l=new Date(0);return l.setUTCFullYear(r,e,t),l.setUTCHours(i,s,o,a),l}const bi=36e5,Ko=6e4,St={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function wi(r,e,t){if(!r)return 0;let i=St.timezoneZ.exec(r);if(i)return 0;let s,o;if(i=St.timezoneHH.exec(r),i)return s=parseInt(i[1],10),Ti(s)?-(s*bi):NaN;if(i=St.timezoneHHMM.exec(r),i){s=parseInt(i[2],10);const a=parseInt(i[3],10);return Ti(s,a)?(o=Math.abs(s)*bi+a*Ko,i[1]==="+"?-o:o):NaN}if(zo(r)){e=new Date(e||Date.now());const a=t?e:Mo(e),l=xt(a,r);return-(t?l:Bo(e,l,r))}return NaN}function Mo(r){return Oi(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds())}function xt(r,e){const t=Do(r,e),i=Oi(t[0],t[1]-1,t[2],t[3]%24,t[4],t[5],0).getTime();let s=r.getTime();const o=s%1e3;return s-=o>=0?o:1e3+o,i-s}function Bo(r,e,t){let s=r.getTime()-e;const o=xt(new Date(s),t);if(e===o)return e;s-=o-e;const a=xt(new Date(s),t);return o===a?o:Math.max(o,a)}function Ti(r,e){return-23<=r&&r<=23&&(e==null||0<=e&&e<=59)}const vi={};function zo(r){if(vi[r])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:r}),vi[r]=!0,!0}catch{return!1}}const Po=60*1e3,qo={X:function(r,e,t){const i=It(t.timeZone,r);if(i===0)return"Z";switch(e){case"X":return Si(i);case"XXXX":case"XX":return We(i);default:return We(i,":")}},x:function(r,e,t){const i=It(t.timeZone,r);switch(e){case"x":return Si(i);case"xxxx":case"xx":return We(i);default:return We(i,":")}},O:function(r,e,t){const i=It(t.timeZone,r);switch(e){case"O":case"OO":case"OOO":return"GMT"+Ho(i,":");default:return"GMT"+We(i,":")}},z:function(r,e,t){switch(e){case"z":case"zz":case"zzz":return Ci("short",r,t);default:return Ci("long",r,t)}}};function It(r,e){const t=r?wi(r,e,!0)/Po: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),s=ut(Math.floor(i/60),2),o=ut(Math.floor(i%60),2);return t+s+e+o}function Si(r,e){return r%60===0?(r>0?"-":"+")+ut(Math.abs(r)/60,2):We(r,e)}function Ho(r,e=""){const t=r>0?"-":"+",i=Math.abs(r),s=Math.floor(i/60),o=i%60;return o===0?t+String(s):t+String(s)+e+ut(o,2)}function xi(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 Go=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Dt=36e5,Ii=6e4,Fo=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:Go};function $o(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?Fo: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=Wo(r),{year:s,restDateString:o}=Vo(i.date,t),a=Yo(o,s);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const l=a.getTime();let u=0,c;if(i.time&&(u=Xo(i.time),u===null||isNaN(u)))return new Date(NaN);if(i.timeZone||e.timeZone){if(c=wi(i.timeZone||e.timeZone,new Date(l+u)),isNaN(c))return new Date(NaN)}else c=xi(new Date(l+u)),c=xi(new Date(l+u+c));return new Date(l+u+c)}else return new Date(NaN)}function Wo(r){const e={};let t=ge.dateTimePattern.exec(r),i;if(t?(e.date=t[1],i=t[3]):(t=ge.datePattern.exec(r),t?(e.date=t[1],i=t[2]):(e.date=null,i=r)),i){const s=ge.timeZone.exec(i);s?(e.time=i.replace(s[1],""),e.timeZone=s[1].trim()):e.time=i}return e}function Vo(r,e){if(r){const t=ge.YYY[e],i=ge.YYYYY[e];let s=ge.YYYY.exec(r)||i.exec(r);if(s){const o=s[1];return{year:parseInt(o,10),restDateString:r.slice(o.length)}}if(s=ge.YY.exec(r)||t.exec(r),s){const o=s[1];return{year:parseInt(o,10)*100,restDateString:r.slice(o.length)}}}return{year:null}}function Yo(r,e){if(e===null)return null;let t,i,s;if(!r||!r.length)return t=new Date(0),t.setUTCFullYear(e),t;let o=ge.MM.exec(r);if(o)return t=new Date(0),i=parseInt(o[1],10)-1,Ni(e,i)?(t.setUTCFullYear(e,i),t):new Date(NaN);if(o=ge.DDD.exec(r),o){t=new Date(0);const a=parseInt(o[1],10);return Zo(e,a)?(t.setUTCFullYear(e,0,a),t):new Date(NaN)}if(o=ge.MMDD.exec(r),o){t=new Date(0),i=parseInt(o[1],10)-1;const a=parseInt(o[2],10);return Ni(e,i,a)?(t.setUTCFullYear(e,i,a),t):new Date(NaN)}if(o=ge.Www.exec(r),o)return s=parseInt(o[1],10)-1,Ai(s)?Di(e,s):new Date(NaN);if(o=ge.WwwD.exec(r),o){s=parseInt(o[1],10)-1;const a=parseInt(o[2],10)-1;return Ai(s,a)?Di(e,s,a):new Date(NaN)}return null}function Xo(r){let e,t,i=ge.HH.exec(r);if(i)return e=parseFloat(i[1].replace(",",".")),kt(e)?e%24*Dt:NaN;if(i=ge.HHMM.exec(r),i)return e=parseInt(i[1],10),t=parseFloat(i[2].replace(",",".")),kt(e,t)?e%24*Dt+t*Ii:NaN;if(i=ge.HHMMSS.exec(r),i){e=parseInt(i[1],10),t=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return kt(e,t,s)?e%24*Dt+t*Ii+s*1e3:NaN}return null}function Di(r,e,t){e=e||0,t=t||0;const i=new Date(0);i.setUTCFullYear(r,0,4);const s=i.getUTCDay()||7,o=e*7+t+1-s;return i.setUTCDate(i.getUTCDate()+o),i}const jo=[31,28,31,30,31,30,31,31,30,31,30,31],Qo=[31,29,31,30,31,30,31,31,30,31,30,31];function ki(r){return r%400===0||r%4===0&&r%100!==0}function Ni(r,e,t){if(e<0||e>11)return!1;if(t!=null){if(t<1)return!1;const i=ki(r);if(i&&t>Qo[e]||!i&&t>jo[e])return!1}return!0}function Zo(r,e){if(e<1)return!1;const t=ki(r);return!(t&&e>366||!t&&e>365)}function Ai(r,e){return!(r<0||r>52||e!=null&&(e<0||e>6))}function kt(r,e,t){return!(r<0||r>=25||e!=null&&(e<0||e>=60)||t!=null&&(t<0||t>=60))}const Jo=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Li(r,e,t={}){e=String(e);const i=e.match(Jo);if(i){const s=$o(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,"'"+qo[a[0]](s,a,t)+"'");return u?c.substring(0,l-1)+c.substring(l+1):c},e)}return Tt(r,e,t)}const Nt="#6c7489",Ui="12px",ea="16px",Ki="20px",Mi="32px",Bi="20px";var dt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ta(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ht={exports:{}},ia=ht.exports,zi;function ra(){return zi||(zi=1,(function(r,e){(function(t,i){i()})(ia,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 s(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):s(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(s(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",_=/constructor/i.test(a.HTMLElement)||a.safari,O=/CriOS\/[\d]+/.test(navigator.userAgent);if((O||m&&_||l)&&typeof FileReader<"u"){var C=new FileReader;C.onloadend=function(){var E=C.result;E=O?E:E.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=E:location=E,f=null},C.readAsDataURL(c)}else{var S=a.URL||a.webkitURL,k=S.createObjectURL(c);f?f.location=k:location.href=k,f=null,setTimeout(function(){S.revokeObjectURL(k)},4e4)}});a.saveAs=u.saveAs=u,r.exports=u})})(ht)),ht.exports}var na=ra(),ft={exports:{}};var sa=ft.exports,Pi;function oa(){return Pi||(Pi=1,(function(r,e){((t,i)=>{r.exports=i()})(sa,function t(){var i=typeof self<"u"?self:typeof window<"u"?window:i!==void 0?i:{},s=!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 y=T(g);y.chunkSize=parseInt(y.chunkSize),g.step||g.chunk||(y.chunkSize=null),this._handle=new O(y),(this._handle.streamer=this)._config=y}).call(this,p),this.parseChunk=function(g,y){var v=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<v){let N=this._config.newline;N||(x=this._config.quoteChar||'"',N=this._handle.guessLineEndings(g,x)),g=[...g.split(N).slice(v)].join(N)}this.isFirstChunk&&z(this._config.beforeFirstChunk)&&(x=this._config.beforeFirstChunk(g))!==void 0&&(g=x),this.isFirstChunk=!1,this._halted=!1;var v=this._partialLine+g,x=(this._partialLine="",this._handle.parse(v,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(g=x.meta.cursor,v=(this._finished||(this._partialLine=v.substring(g-this._baseIndex),this._baseIndex=g),x&&x.data&&(this._rowCount+=x.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)i.postMessage({results:x,workerId:u.WORKER_ID,finished:v});else if(z(this._config.chunk)&&!y){if(this._config.chunk(x,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=x=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(x.data),this._completeResults.errors=this._completeResults.errors.concat(x.errors),this._completeResults.meta=x.meta),this._completed||!v||!z(this._config.complete)||x&&x.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),v||x&&x.meta.paused||this._nextChunk(),x}this._halted=!0},this._sendError=function(g){z(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=s?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(y){this._input=y,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(g=new XMLHttpRequest,this._config.withCredentials&&(g.withCredentials=this._config.withCredentials),s||(g.onload=U(this._chunkLoaded,this),g.onerror=U(this._chunkError,this)),g.ontimeout=U(this._chunkTimeout,this),g.open(this._config.downloadRequestBody?"POST":"GET",this._input,!s),this._config.downloadTimeout&&!s&&(g.timeout=this._config.downloadTimeout),this._config.downloadRequestHeaders){var y,v=this._config.downloadRequestHeaders;for(y in v)g.setRequestHeader(y,v[y])}var x;this._config.chunkSize&&(x=this._start+this._config.chunkSize-1,g.setRequestHeader("Range","bytes="+this._start+"-"+x));try{g.send(this._config.downloadRequestBody)}catch(N){this._chunkError(N.message)}s&&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>=(y=>(y=y.getResponseHeader("Content-Range"))!==null?parseInt(y.substring(y.lastIndexOf("/")+1)):-1)(g),this.parseChunk(g.responseText)))},this._chunkError=function(y){y=g.statusText||y,this._sendError(new Error(y))},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,y,v=typeof FileReader<"u";this.stream=function(x){this._input=x,y=x.slice||x.webkitSlice||x.mozSlice,v?((g=new FileReader).onload=U(this._chunkLoaded,this),g.onerror=U(this._chunkError,this)):g=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var x=this._input,N=(this._config.chunkSize&&(N=Math.min(this._start+this._config.chunkSize,this._input.size),x=y.call(x,this._start,N)),g.readAsText(x,this._config.encoding));v||this._chunkLoaded({target:{result:N}})},this._chunkLoaded=function(x){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(x.target.result)},this._chunkError=function(){this._sendError(g.error)}}function m(p){var g;d.call(this,p=p||{}),this.stream=function(y){return g=y,this._nextChunk()},this._nextChunk=function(){var y,v;if(!this._finished)return y=this._config.chunkSize,g=y?(v=g.substring(0,y),g.substring(y)):(v=g,""),this._finished=!g,this.parseChunk(v)}}function _(p){d.call(this,p=p||{});var g=[],y=!0,v=!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(x){this._input=x,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){v&&g.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),g.length?this.parseChunk(g.shift()):y=!0},this._streamData=U(function(x){try{g.push(typeof x=="string"?x:x.toString(this._config.encoding)),y&&(y=!1,this._checkIsFinished(),this.parseChunk(g.shift()))}catch(N){this._streamError(N)}},this),this._streamError=U(function(x){this._streamCleanUp(),this._sendError(x)},this),this._streamEnd=U(function(){this._streamCleanUp(),v=!0,this._streamData("")},this),this._streamCleanUp=U(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function O(p){var g,y,v,x,N=Math.pow(2,53),K=-N,q=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,V=/^((\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,A=!1,w=!1,D=[],I={data:[],errors:[],meta:{}};function Q(Y){return p.skipEmptyLines==="greedy"?Y.join("").trim()==="":Y.length===1&&Y[0].length===0}function re(){if(I&&v&&(he("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),v=!1),p.skipEmptyLines&&(I.data=I.data.filter(function(G){return!Q(G)})),te()){let G=function(le){D.push(le)};if(I)if(Array.isArray(I.data[0])){for(var Y=0;te()&&Y<I.data.length;Y++)I.data[Y].forEach(G);I.data.splice(0,1)}else I.data.forEach(G)}function X(G,le){for(var ue=p.header?{}:[],Z=0;Z<G.length;Z++){var se=Z,j=G[Z],j=((Re,$)=>(oe=>(p.dynamicTypingFunction&&p.dynamicTyping[oe]===void 0&&(p.dynamicTyping[oe]=p.dynamicTypingFunction(oe)),(p.dynamicTyping[oe]||p.dynamicTyping)===!0))(Re)?$==="true"||$==="TRUE"||$!=="false"&&$!=="FALSE"&&((oe=>{if(q.test(oe)&&(oe=parseFloat(oe),K<oe&&oe<N))return 1})($)?parseFloat($):V.test($)?new Date($):$===""?null:$):$)(se=p.header?Z>=D.length?"__parsed_extra":D[Z]:se,j=p.transform?p.transform(j,se):j);se==="__parsed_extra"?(ue[se]=ue[se]||[],ue[se].push(j)):ue[se]=j}return p.header&&(Z>D.length?he("FieldMismatch","TooManyFields","Too many fields: expected "+D.length+" fields but parsed "+Z,M+le):Z<D.length&&he("FieldMismatch","TooFewFields","Too few fields: expected "+D.length+" fields but parsed "+Z,M+le)),ue}var ae;I&&(p.header||p.dynamicTyping||p.transform)&&(ae=1,!I.data.length||Array.isArray(I.data[0])?(I.data=I.data.map(X),ae=I.data.length):I.data=X(I.data,0),p.header&&I.meta&&(I.meta.fields=D),M+=ae)}function te(){return p.header&&D.length===0}function he(Y,X,ae,G){Y={type:Y,code:X,message:ae},G!==void 0&&(Y.row=G),I.errors.push(Y)}z(p.step)&&(x=p.step,p.step=function(Y){I=Y,te()?re():(re(),I.data.length!==0&&(F+=Y.data.length,p.preview&&F>p.preview?y.abort():(I.data=I.data[0],x(I,P))))}),this.parse=function(Y,X,ae){var G=p.quoteChar||'"',G=(p.newline||(p.newline=this.guessLineEndings(Y,G)),v=!1,p.delimiter?z(p.delimiter)&&(p.delimiter=p.delimiter(Y),I.meta.delimiter=p.delimiter):((G=((le,ue,Z,se,j)=>{var Re,$,oe,Ae;j=j||[","," ","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var Me=0;Me<j.length;Me++){for(var Ee,qe=j[Me],fe=0,Oe=0,de=0,pe=(oe=void 0,new S({comments:se,delimiter:qe,newline:ue,preview:10}).parse(le)),Se=0;Se<pe.data.length;Se++)Z&&Q(pe.data[Se])?de++:(Ee=pe.data[Se].length,Oe+=Ee,oe===void 0?oe=Ee:0<Ee&&(fe+=Math.abs(Ee-oe),oe=Ee));0<pe.data.length&&(Oe/=pe.data.length-de),1.99<Oe&&($===void 0||fe<$||fe===$&&Ae<Oe)&&($=fe,Re=qe,Ae=Oe)}return{successful:!!(p.delimiter=Re),bestDelimiter:Re}})(Y,p.newline,p.skipEmptyLines,p.comments,p.delimitersToGuess)).successful?p.delimiter=G.bestDelimiter:(v=!0,p.delimiter=u.DefaultDelimiter),I.meta.delimiter=p.delimiter),T(p));return G.header=te(),p.preview&&p.header&&G.preview++,g=Y,y=new S(G),I=y.parse(g,X,ae),re(),A?{meta:{paused:!0}}:I||{meta:{paused:!1}}},this.paused=function(){return A},this.pause=function(){A=!0,y.abort(),g=z(p.chunk)?"":g.substring(y.getCharIndex())},this.resume=function(){P.streamer._halted?(A=!1,P.streamer.parseChunk(g,!0)):setTimeout(P.resume,3)},this.aborted=function(){return w},this.abort=function(){w=!0,y.abort(),I.meta.aborted=!0,z(p.complete)&&p.complete(I),g=""},this.guessLineEndings=function(le,G){le=le.substring(0,1048576);var G=new RegExp(C(G)+"([^]*?)"+C(G),"gm"),ae=(le=le.replace(G,"")).split("\r"),G=le.split(`
|
|
2
|
+
`),le=1<G.length&&G[0].length<ae[0].length;if(ae.length===1||le)return`
|
|
3
|
+
`;for(var ue=0,Z=0;Z<ae.length;Z++)ae[Z][0]===`
|
|
4
|
+
`&&ue++;return ue>=ae.length/2?`\r
|
|
5
|
+
`:"\r"}}function C(p){return p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function S(p){var g=(p=p||{}).delimiter,y=p.newline,v=p.comments,x=p.step,N=p.preview,K=p.fastMode,q=null,V=!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=","),v===g)throw new Error("Comment character same as delimiter");v===!0?v="#":(typeof v!="string"||-1<u.BAD_DELIMITERS.indexOf(v))&&(v=!1),y!==`
|
|
6
|
+
`&&y!=="\r"&&y!==`\r
|
|
7
|
+
`&&(y=`
|
|
8
|
+
`);var M=0,A=!1;this.parse=function(w,D,I){if(typeof w!="string")throw new Error("Input must be a string");var Q=w.length,re=g.length,te=y.length,he=v.length,Y=z(x),X=[],ae=[],G=[],le=M=0;if(!w)return fe();if(K||K!==!1&&w.indexOf(P)===-1){for(var ue=w.split(y),Z=0;Z<ue.length;Z++){if(G=ue[Z],M+=G.length,Z!==ue.length-1)M+=y.length;else if(I)return fe();if(!v||G.substring(0,he)!==v){if(Y){if(X=[],Ae(G.split(g)),Oe(),A)return fe()}else Ae(G.split(g));if(N&&N<=Z)return X=X.slice(0,N),fe(!0)}}return fe()}for(var se=w.indexOf(g,M),j=w.indexOf(y,M),Re=new RegExp(C(F)+C(P),"g"),$=w.indexOf(P,M);;)if(w[M]===P)for($=M,M++;;){if(($=w.indexOf(P,$+1))===-1)return I||ae.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:X.length,index:M}),Ee();if($===Q-1)return Ee(w.substring(M,$).replace(Re,P));if(P===F&&w[$+1]===F)$++;else if(P===F||$===0||w[$-1]!==F){se!==-1&&se<$+1&&(se=w.indexOf(g,$+1));var oe=Me((j=j!==-1&&j<$+1?w.indexOf(y,$+1):j)===-1?se:Math.min(se,j));if(w.substr($+1+oe,re)===g){G.push(w.substring(M,$).replace(Re,P)),w[M=$+1+oe+re]!==P&&($=w.indexOf(P,M)),se=w.indexOf(g,M),j=w.indexOf(y,M);break}if(oe=Me(j),w.substring($+1+oe,$+1+oe+te)===y){if(G.push(w.substring(M,$).replace(Re,P)),qe($+1+oe+te),se=w.indexOf(g,M),$=w.indexOf(P,M),Y&&(Oe(),A))return fe();if(N&&X.length>=N)return fe(!0);break}ae.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:X.length,index:M}),$++}}else if(v&&G.length===0&&w.substring(M,M+he)===v){if(j===-1)return fe();M=j+te,j=w.indexOf(y,M),se=w.indexOf(g,M)}else if(se!==-1&&(se<j||j===-1))G.push(w.substring(M,se)),M=se+re,se=w.indexOf(g,M);else{if(j===-1)break;if(G.push(w.substring(M,j)),qe(j+te),Y&&(Oe(),A))return fe();if(N&&X.length>=N)return fe(!0)}return Ee();function Ae(de){X.push(de),le=M}function Me(de){var pe=0;return pe=de!==-1&&(de=w.substring($+1,de))&&de.trim()===""?de.length:pe}function Ee(de){return I||(de===void 0&&(de=w.substring(M)),G.push(de),M=Q,Ae(G),Y&&Oe()),fe()}function qe(de){M=de,Ae(G),G=[],j=w.indexOf(y,M)}function fe(de){if(p.header&&!D&&X.length&&!V){var pe=X[0],Se=Object.create(null),je=new Set(pe);let Ot=!1;for(let Be=0;Be<pe.length;Be++){let be=c(pe[Be]);if(Se[be=z(p.transformHeader)?p.transformHeader(be,Be):be]){let He,L=Se[be];for(;He=be+"_"+L,L++,je.has(He););je.add(He),pe[Be]=He,Se[be]++,Ot=!0,(q=q===null?{}:q)[He]=be}else Se[be]=1,pe[Be]=be;je.add(be)}Ot&&console.warn("Duplicate headers found and renamed."),V=!0}return{data:X,errors:ae,meta:{delimiter:g,linebreak:y,aborted:A,truncated:!!de,cursor:le+(D||0),renamedHeaders:q}}}function Oe(){x(fe()),X=[],ae=[]}},this.abort=function(){A=!0},this.getCharIndex=function(){return M}}function k(p){var g=p.data,y=a[g.workerId],v=!1;if(g.error)y.userError(g.error,g.file);else if(g.results&&g.results.data){var x={abort:function(){v=!0,E(g.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:b,resume:b};if(z(y.userStep)){for(var N=0;N<g.results.data.length&&(y.userStep({data:g.results.data[N],errors:g.results.errors,meta:g.results.meta},x),!v);N++);delete g.results}else z(y.userChunk)&&(y.userChunk(g.results,x,g.file),delete g.results)}g.finished&&!v&&E(g.workerId,g.results)}function E(p,g){var y=a[p];z(y.userComplete)&&y.userComplete(g),y.terminate(),delete a[p]}function b(){throw new Error("Not implemented.")}function T(p){if(typeof p!="object"||p===null)return p;var g,y=Array.isArray(p)?[]:{};for(g in p)y[g]=T(p[g]);return y}function U(p,g){return function(){p.apply(g,arguments)}}function z(p){return typeof p=="function"}return u.parse=function(p,g){var y=(g=g||{}).dynamicTyping||!1;if(z(y)&&(g.dynamicTypingFunction=y,y={}),g.dynamicTyping=y,g.transform=!!z(g.transform)&&g.transform,g.downloadTimeout!==void 0){var y=parseInt(g.downloadTimeout);if(isNaN(y))throw new Error("Config downloadTimeout value ("+g.downloadTimeout+") not parsable by parseInt(val).");g.downloadTimeout=y}if(!g.worker||!u.WORKERS_SUPPORTED)return y=null,u.NODE_STREAM_INPUT,typeof p=="string"?(p=c(p),y=new(g.download?h:m)(g)):p.readable===!0&&z(p.read)&&z(p.on)?y=new _(g):(i.File&&p instanceof File||p instanceof Object)&&(y=new f(g)),y.stream(p);(y=(()=>{var v;return!!u.WORKERS_SUPPORTED&&(v=(()=>{var x=i.URL||i.webkitURL||null,N=t.toString();return u.BLOB_URL||(u.BLOB_URL=x.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",N,")();"],{type:"text/javascript"})))})(),(v=new i.Worker(v)).onmessage=k,v.id=l++,a[v.id]=v)})()).userStep=g.step,y.userChunk=g.chunk,y.userComplete=g.complete,y.userError=g.error,g.step=z(g.step),g.chunk=z(g.chunk),g.complete=z(g.complete),g.error=z(g.error),delete g.worker,y.postMessage({input:p,config:g,workerId:y.id})},u.unparse=function(p,g){var y=!1,v=!0,x=",",N=`\r
|
|
9
|
+
`,K='"',q=K+K,V=!1,P=null,F=!1,M=((()=>{if(typeof g=="object"){if(typeof g.delimiter!="string"||u.BAD_DELIMITERS.filter(function(D){return g.delimiter.indexOf(D)!==-1}).length||(x=g.delimiter),typeof g.quotes!="boolean"&&typeof g.quotes!="function"&&!Array.isArray(g.quotes)||(y=g.quotes),typeof g.skipEmptyLines!="boolean"&&typeof g.skipEmptyLines!="string"||(V=g.skipEmptyLines),typeof g.newline=="string"&&(N=g.newline),typeof g.quoteChar=="string"&&(K=g.quoteChar,q=K+K),typeof g.header=="boolean"&&(v=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&&(q=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 A(null,p,V);if(typeof p[0]=="object")return A(P||Object.keys(p[0]),p,V)}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])),A(p.fields||[],p.data||[],V);throw new Error("Unable to serialize unrecognized input");function A(D,I,Q){var re="",te=(typeof D=="string"&&(D=JSON.parse(D)),typeof I=="string"&&(I=JSON.parse(I)),Array.isArray(D)&&0<D.length),he=!Array.isArray(I[0]);if(te&&v){for(var Y=0;Y<D.length;Y++)0<Y&&(re+=x),re+=w(D[Y],Y);0<I.length&&(re+=N)}for(var X=0;X<I.length;X++){var ae=(te?D:I[X]).length,G=!1,le=te?Object.keys(I[X]).length===0:I[X].length===0;if(Q&&!te&&(G=Q==="greedy"?I[X].join("").trim()==="":I[X].length===1&&I[X][0].length===0),Q==="greedy"&&te){for(var ue=[],Z=0;Z<ae;Z++){var se=he?D[Z]:Z;ue.push(I[X][se])}G=ue.join("").trim()===""}if(!G){for(var j=0;j<ae;j++){0<j&&!le&&(re+=x);var Re=te&&he?D[j]:j;re+=w(I[X][Re],j)}X<I.length-1&&(!Q||0<ae&&!le)&&(re+=N)}}return re}function w(D,I){var Q,re,te;return D==null?"":D.constructor===Date?isNaN(D.getTime())?"":D.toISOString():(te=!1,F&&typeof D=="string"&&F.test(D)&&(D="'"+D,te=!0),re=(Q=D.toString()).replace(M,q),(te=te||y===!0||typeof y=="function"&&y(D,I)||Array.isArray(y)&&y[I]||((he,Y)=>{for(var X=0;X<Y.length;X++)if(-1<he.indexOf(Y[X]))return!0;return!1})(re,u.BAD_DELIMITERS)||-1<re.indexOf(x)||-1<Q.indexOf(K)||re.charAt(0)===" "||re.charAt(re.length-1)===" ")?K+re+K:re)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
|
|
10
|
+
`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!s&&!!i.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=S,u.ParserHandle=O,u.NetworkStreamer=h,u.FileStreamer=f,u.StringStreamer=m,u.ReadableStreamStreamer=_,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,(_.prototype=Object.create(d.prototype)).constructor=_,u})})(ft)),ft.exports}var aa=oa(),Ve=(r=>(r.String="string",r.Number="number",r.Boolean="boolean",r.Object="object",r.Undefined="undefined",r))(Ve||{});const la=["id"],ca=n.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,s=n.computed(()=>`export_${new Date().getTime()}`),o=n.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=aa.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});na.saveAs(h,i.filename)}};return(d,h)=>(n.openBlock(),n.createElementBlock("div",{id:s.value,"data-testid":"export-csv",onClick:c},[n.renderSlot(d.$slots,"default",{},()=>[n.createTextVNode("Download "+n.toDisplayString(r.filename),1)])],8,la))}}),ua=n.defineComponent({__name:"DownloadCsv",props:{rows:{},headers:{},filename:{}},setup(r){const e=r,t=n.computed(()=>Object.keys(e.headers));return(i,s)=>(n.openBlock(),n.createElementBlock("div",null,[n.createVNode(ca,{data:r.rows,fields:t.value,filename:r.filename,labels:r.headers},{default:n.withCtx(()=>[n.renderSlot(i.$slots,"default")]),_:3},8,["data","fields","filename","labels"])]))}}),qi={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_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 At(){const r=at.createI18n("en-us",qi);return{i18n:r,i18nT:at.i18nTComponent(r)}}const Ye=170,mt=6,Te="analytics-query-provider",Hi="analytics-dashboard-coordinator",Lt="{entity-id}",Gi="{cp-id}",Fi="{timeframe}",$i=30*1e3,Wi=3e5,Vi=36e5;function da(){const r=n.inject(Te);return{evaluateFeatureFlag:(t,i)=>typeof r?.evaluateFeatureFlagFn!="function"?i:r.evaluateFeatureFlagFn(t,i)}}var Ut={exports:{}},Yi;function ha(){return Yi||(Yi=1,(function(r){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function s(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 s(d,h||u,f),_=t?t+c:c;return u._events[_]?u._events[_].fn?u._events[_]=[u._events[_],m]:u._events[_].push(m):(u._events[_]=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,_=new Array(m);f<m;f++)_[f]=h[f].fn;return _},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,_){var O=t?t+c:c;if(!this._events[O])return!1;var C=this._events[O],S=arguments.length,k,E;if(C.fn){switch(C.once&&this.removeListener(c,C.fn,void 0,!0),S){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,_),!0}for(E=1,k=new Array(S-1);E<S;E++)k[E-1]=arguments[E];C.fn.apply(C.context,k)}else{var b=C.length,T;for(E=0;E<b;E++)switch(C[E].once&&this.removeListener(c,C[E].fn,void 0,!0),S){case 1:C[E].fn.call(C[E].context);break;case 2:C[E].fn.call(C[E].context,d);break;case 3:C[E].fn.call(C[E].context,d,h);break;case 4:C[E].fn.call(C[E].context,d,h,f);break;default:if(!k)for(T=1,k=new Array(S-1);T<S;T++)k[T-1]=arguments[T];C[E].fn.apply(C[E].context,k)}}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 _=this._events[m];if(_.fn)_.fn===d&&(!f||_.once)&&(!h||_.context===h)&&a(this,m);else{for(var O=0,C=[],S=_.length;O<S;O++)(_[O].fn!==d||f&&!_[O].once||h&&_[O].context!==h)&&C.push(_[O]);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})(Ut)),Ut.exports}var fa=ha();const ma=ta(fa);class Kt extends Error{name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,Kt)}}const Xi=r=>r.reason??new DOMException("This operation was aborted.","AbortError");function pa(r,e){const{milliseconds:t,fallback:i,message:s,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(Xi(a));return}if(a&&(u=()=>{f(Xi(a))},a.addEventListener("abort",u,{once:!0})),r.then(h,f),t===Number.POSITIVE_INFINITY)return;const m=new Kt;l=o.setTimeout.call(void 0,()=>{if(i){try{h(i())}catch(_){f(_)}return}typeof r.cancel=="function"&&r.cancel(),s===!1?h():s instanceof Error?f(s):(m.message=s??`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 ga(r,e,t){let i=0,s=r.length;for(;s>0;){const o=Math.trunc(s/2);let a=i+o;t(r[a],e)<=0?(i=++a,s-=o+1):s=o}return i}const _a=100;class ji{#t=[];#e=0;enqueue(e,t){const{priority:i=0,id:s}=t??{},{size:o}=this,a={priority:i,id:s,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=ga(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[s]=this.#t.splice(i,1);this.enqueue(s.run,{priority:t,id:e})}remove(e){const t=this.#t.findIndex((i,s)=>s<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>_a&&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 s=this.#t[i];s.priority===e.priority&&t.push(s.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 ya extends ma{#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:ji,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],s=this.#c-(e-i);return this.#S(s),!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 s=this.#i.dequeue();this.#e||(this.#A(t),this.#m()),i&&this.#I(),this.emit("active"),s(),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,s)=>{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=pa(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,_)=>{c=()=>{_(f.reason)},f.addEventListener("abort",c,{once:!0})})])}const h=await d;i(h),this.emit("completed",h)}catch(d){s(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 ji){this.#i.remove(l);return}this.#i.remove?.(t.id)};if(t.signal){const{signal:c}=t,d=()=>{a(),u(),s(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=s=>{this.off("error",i),t(s)};this.on("error",i)})}async#h(e,t){const i=Array.isArray(e)?e:[e];return new Promise(s=>{const o=()=>{if(!(t&&!t())){for(const a of i)this.off(a,o);s()}};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 s=Date.now();this.#O(s),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 Ra=()=>{const r=Ne.useAnalyticsConfigStore(),e=n.inject(Te);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 ya({carryoverConcurrencyCount:!0,concurrency:r.maxParallelRequests,interval:r.requestInterval,intervalCap:r.requestIntervalCap}),i={...e,queryFnOverride:!0,queryFn:(s,o)=>t.add(()=>e.queryFn(s,o))};n.provide(Te,i)};function Ca(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,s)=>`${s<t.length-1?"├▶":"╰▶"} ${i}`)].join(`
|
|
12
|
+
`)}function Qi(r,...e){return typeof r=="function"?r(...e):r}function Ea({method:r="warn",formatter:e=Ca}={}){return(t,{method:i=r}={})=>{console[i](e(t))}}const Oa=Error.captureStackTrace;var ba=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,Oa?.(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 wa(r,e){return typeof r=="string"?`${r}/${e.toLowerCase()}`:r?.(e)}function Ta(r){const e=r.reporters??[],t={},{docsBase:i}=r;for(const s of Object.keys(r.codes)){const o=r.codes[s],a=o.docs===!1?void 0:o.docs||wa(i,s),l=(u={},c={})=>{const d=new ba({code:s,why:Qi(o.why,u),fix:Qi(o.fix,u),docs:a,cause:u.cause,sources:u.sources},l);for(const h of e)h(d,c);return d};t[s]=l}return t}const va=typeof window<"u",Sa=Ta({reporters:[Ea()],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 Zi;process.env.NODE_ENV;const Ji=process.env.NODE_ENV!=="production"?Symbol("pinia"):Symbol();process.env.NODE_ENV;function Xe(r){const e=n.toRaw(r),t={};for(const i in e){const s=e[i];s?.effect?t[i]=n.computed({get:()=>r[i],set(o){r[i]=o}}):(n.isRef(s)||n.isReactive(s))&&(t[i]=n.toRef(r,i))}return t}const Ie=r=>r?.chart.type==="table",Mt=r=>r?.query?.datasource==="requests",Bt=r=>!!r&&!Ie(r)&&!Mt(r),xa=(r,e)=>{const t=r.header_description??("description"in r.chart?r.chart.description:void 0);if(t)return t.replaceAll(Fi,e)||void 0},Ia=["basic","api_usage","llm_usage","agentic_usage","platform","platform_usage","managed_cache_usage",void 0],Da=r=>Ia.includes(r);function ka({queryBridge:r,context:e,definition:t,chartData:i}){const s=n.ref(""),o=n.ref(""),a=n.ref(void 0),l=n.ref(void 0),u=Ne.useAnalyticsConfigStore(),c=Ne.useDatasourceConfigStore(),{stripUnknownFilters:d,loading:h}=Xe(c),f=n.computed(()=>Ie(t.value));n.onMounted(async()=>{s.value=await r?.exploreBaseUrl?.()??"",o.value=await r?.requestsBaseUrl?.()??""});const m=n.computed(()=>u.analytics&&u.percentiles),_=n.computed(()=>{const y=t.value.chart.type;return["golden_signals","gauge"].includes(y)?!1:y==="top_n"?!!e.value.editable||!!e.value.showTileActions:!0}),O=n.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)&&m.value&&!h.value),C=n.computed(()=>s.value&&t.value.query&&Da(t.value.query.datasource)&&m.value&&!h.value),S=n.computed(()=>i.value?ee.msToGranularity(i.value.meta.granularity_ms):void 0),k=n.computed(()=>{const y=t.value,v=[...e.value.filters,...y.query.filters??[]],x="metrics"in y.query?y.query.metrics:void 0,N=y.query?.datasource??"api_usage";return d.value({datasource:N,filters:v,queryFields:x})}),E=n.computed(()=>{if(!C.value||!_.value)return"";const y=t.value;if(Ie(y))return g({...y.query,filters:k.value});const v=y.query.time_range||e.value.timeSpec,x=p(v,k.value);return g(x)}),b=n.computed(()=>{if(!O.value||!_.value)return"";const y=k.value,v=t.value;if(Ie(v))return"";const x=U(v.query.time_range||e.value.timeSpec,y);return T(x)}),T=y=>O.value?`${o.value}?q=${JSON.stringify(y)}`:"",U=(y,v)=>{const x=i.value?.meta?.start?new Date(i.value.meta.start):void 0,N=i.value?.meta?.end?new Date(i.value.meta.end):void 0;return{filter:v,timeframe:{timePeriodsKey:y.type==="relative"?y.time_range:"custom",start:y.type==="absolute"?x:void 0,end:y.type==="absolute"?N:void 0}}},z=(y,v)=>({filter:v,timeframe:{timePeriodsKey:y.type==="relative"?y.time_range:"custom",start:y.type==="absolute"?y.start:void 0,end:y.type==="absolute"?y.end:void 0}}),p=(y,v)=>{const x=t.value;if(!Bt(x))throw new Error("Cannot build a chart explore query for table or api-requests definitions");const N=[...x.query.dimensions??[]],K=[...x.query.metrics??[]];return{filters:v,metrics:K,dimensions:N,time_range:y,granularity:x.query.granularity||S.value||void 0}},g=y=>{if(!C.value)return"";const v=t.value.query.datasource&&t.value.query.datasource!=="basic"?t.value.query.datasource:"api_usage";return`${s.value}?q=${JSON.stringify(y)}&d=${v}&c=${t.value.chart.type}`};return n.watch([O,C],([y,v])=>{y&&(a.value={href:""}),v&&(l.value={href:""})}),{exploreLinkKebabMenu:E,requestsLinkKebabMenu:b,canShowKebabMenu:_,canGenerateRequestsLink:O,canGenerateExploreLink:C,requestsLinkZoomActions:a,exploreLinkZoomActions:l,buildExploreQuery:p,buildRequestsQueryZoomActions:z,buildExploreLink:g,buildRequestLink:T}}const zt=r=>r.type==="relative"?ee.TimePeriods.get(ee.TIMEFRAME_LOOKUP[r.time_range])?.timeframeLengthMs():new Date(r.end).getTime()-new Date(r.start).getTime(),Na=r=>r.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),Pt=(r,e)=>{if(!r||!e?.length)return;const t=zt(r),i=Na(e);return t!==void 0&&i&&t>i.durationSeconds*1e3?i:void 0},qt=(r,e)=>{const t=Pt(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 Aa(){const r=n.inject(Te),e=Ne.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let s=null;return n.onUnmounted(()=>{s?.abort()}),{issueQuery:async(a,l,u)=>{if(!r)throw new Error("Query bridge is not defined");s?.abort();const c=new AbortController;s=c,await e.isReady();const{datasource:d,limit:h,...f}=a,m=d||"basic",_=ee.isPlatformDatasource(m),O=i.value({datasource:m,filters:[...a.filters??[],...l.filters],queryFields:a.metrics}).filter(({operator:k})=>!_||!ee.requestFilterTypeEmptyV2.some(E=>E===k));let C=a.time_range;!C&&l.timeSpec?C={...l.timeSpec,tz:l.tz}:C&&!C.tz&&(C={...C,tz:l.tz}),C=qt(C,t.value[m]?.timeRangeOptions);const S={datasource:m,query:{...f,time_range:C,filters:O,limit:u??h}};return r.queryFn(S,c)}}}const La="24H",Ua={status_code:"response_http_status",upstream_status_code:"upstream_status"},Ka={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"},Ma=r=>ee.relativeTimeRangeValuesRequestV2.includes(r),Ba=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:Ma(t)?t:La,...e}},er=r=>Ua[r]??r,za=r=>({metric:er(r.metric),dimension:r.dimension?er(r.dimension):void 0,unroll:r.unroll,metricUnit:Ka[r.metric],extraFields:r.extra_fields}),Ht="requests";function Pa(){const r=n.inject(Te),e=Ne.useDatasourceConfigStore(),{datasourceConfigMap:t,stripUnknownFilters:i}=Xe(e);let s=null;n.onUnmounted(()=>{s?.abort()});const o=(l,u)=>{const c=l.time_range??u.timeSpec;return qt(c&&{...c,tz:c.tz??u.tz},t.value[Ht]?.timeRangeOptions)};return{issueRequestsQuery:async(l,u)=>{const c=r?.requestsQueryFn;if(!c)throw new Error("Query bridge cannot fetch request records");s?.abort();const d=new AbortController;s=d,await e.isReady();const h=i.value({datasource:Ht,filters:[...l.filters??[],...u.filters]});return ee.fetchAllRequests(c,{datasource:Ht,query:{filters:h,time_range:Ba(o(l,u))}},d,{maxRecords:l.max_records})}}}function qa({context:r,globalFilters:e=n.ref([]),isFullscreen:t=n.ref(!1),preview:i=n.ref(!1)}){const s=Ne.useAnalyticsConfigStore(),o=Ne.useDatasourceConfigStore(),{loading:a}=Xe(s),{loading:l}=Xe(o),u=n.computed(()=>r.value.timeSpec?r.value.timeSpec:{type:"relative",time_range:s.defaultQueryTimeForOrg}),c=n.computed(()=>{const{tz:b}=r.value;return b||new Intl.DateTimeFormat().resolvedOptions().timeZone}),d=n.computed(()=>{const{editable:b}=r.value;return b===void 0||i.value?!1:b}),h=n.computed(()=>{const{showTileActions:b}=r.value;return i.value?!1:b===void 0?!0:b}),f=n.computed(()=>[...r.value.filters??[],...e.value]),m=n.computed(()=>{let{refreshInterval:b}=r.value;if(b===void 0&&(b=$i),t.value){let T=!1;if(u.value.type==="relative")T=["15m","1h","6h","12h","24h"].includes(u.value.time_range);else{const p=u.value.start.getTime(),g=u.value.end.getTime();T=Math.abs(g-p)<=864e5}const U=new Date().getTime();u.value.type==="absolute"&&u.value.end.getTime()<U||u.value.type==="relative"&&["previous_week","previous_month"].includes(u.value.time_range)?b=0:T?b=Wi:b=Vi}return b}),_=n.computed(()=>({filters:f.value,timeSpec:u.value,tz:c.value,refreshInterval:m.value,editable:d.value,showTileActions:h.value})),O=n.computed(()=>!a.value&&!l.value),C=n.computed(()=>!i.value&&!!n.getCurrentInstance()?.vnode?.props?.onTileTimeRangeZoom),S=n.computed(()=>!i.value),k=n.computed(()=>!i.value),E=n.computed(()=>({enabled:C.value,showExploreAction:S.value,showRequestsAction:k.value,showZoomInAction:C.value}));return{editable:d,enrichedContext:_,filters:f,queryReady:O,refreshInterval:m,showTileActions:h,timeSpec:u,tz:c,zoomConfiguration:E}}const Ha=6,tr=6,ir=4;function Ga(r,e){const{pageWidth:t,pageHeight:i,margin:s}=e,o=s+1,a=s+e.headerHeight-3,l=i-s-tr+3,u=l+4;e.title&&(r.setFont("helvetica","bold"),r.setFontSize(11),r.setTextColor(60),r.text(e.title,s,o)),r.setFont("helvetica","normal"),r.setFontSize(8),r.setTextColor(120),r.text(e.generatedAt,t-s,o,{align:"right"}),e.subtitle&&r.text(e.subtitle,s,o+ir),r.setDrawColor(220),r.line(s,a,t-s,a),r.line(s,l,t-s,l),r.setFont("helvetica","bold"),r.setTextColor(60),r.text(e.branding,s,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,s+c,u,{url:e.dashboardUrl})):(r.setTextColor(120),r.text(d,s+c,u)),r.setTextColor(120),r.text(e.pageLabel,t-s,u,{align:"right"})}function Fa(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,s=new Map;return t.forEach(o=>{const a=o.getBoundingClientRect(),l=Math.round(a.top-i),u=Math.round(a.bottom-i),c=s.get(l);s.set(l,c!==void 0?Math.max(c,u):u)}),[...s.entries()].map(([o,a])=>({top:o,bottom:a})).sort((o,a)=>o.top-a.top)}function $a(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 s=[];let o=0;for(const a of r){const l=a.top*i,u=a.bottom*i;u-o>t&&(l>o?(s.push({startY:o,height:l-o}),o=l):(s.push({startY:o,height:u-o}),o=u))}return o<e&&s.push({startY:o,height:e-o}),s}function Wa(r){const{i18n:e}=At(),t=n.ref({status:"idle"});async function i(s={}){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:_="download",onBeforeCapture:O,onAfterCapture:C}=s,S=r.value;if(!S){t.value={status:"error",error:new Error("Dashboard layout container not found.")};return}try{t.value={status:"preparing"},await O?.();const[{snapdom:k},{jsPDF:E}]=await Promise.all([import("@zumer/snapdom"),import("jspdf")]);t.value={status:"capturing"};const b={name:"kong-webgl-snapshot",beforeClone:()=>ee.prepareForCapture(),afterClone:()=>ee.restoreAfterCapture()},T=await k.toCanvas(S,{scale:f,exclude:m,excludeMode:"remove",embedFonts:!0,plugins:[b]}),U=Fa(S),z=S.getBoundingClientRect().width,p=z?T.width/z:f;t.value={status:"generating"};const g=new Date,y=new E({orientation:c,unit:"mm",format:d}),v=y.internal.pageSize.getWidth(),x=y.internal.pageSize.getHeight(),N=Ha+(l?ir:0),K=v-h*2,q=x-h*2-N-tr,V=T.width/K,P=q*V,F=$a(U,T.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:v,pageHeight:x,headerHeight:N,margin:h};for(let A=0;A<F.length;A++){A>0&&y.addPage();const{startY:w,height:D}=F[A],I=document.createElement("canvas");I.width=T.width,I.height=D,I.getContext("2d").drawImage(T,0,w,T.width,D,0,0,T.width,D),y.addImage(I.toDataURL("image/png"),"PNG",h,h+N,K,D/V),Ga(y,{...M,pageLabel:e.t("pdfExport.pageOf",{page:String(A+1),total:String(F.length)})})}if(_==="blob"){const A=y.output("blob");return t.value={status:"complete",pageCount:F.length},A}y.save(o),t.value={status:"complete",pageCount:F.length}}catch(k){t.value={status:"error",error:k}}finally{ee.restoreAfterCapture(),await C?.()}}return{exportPdf:i,exportState:n.readonly(t)}}const Va=r=>r.toLowerCase().endsWith("count")?"":r;function Ya(){const{i18n:r}=At(),{formatUnit:e}=ee.unitFormatter({i18n:r});return t=>{const i=t.meta?.metric_names?.[0]??"",s=t.meta?.metric_units?.[i]??"",o=`chartLabels.${i}`;return{seriesName:r.te(o)?r.t(o):i,valueFormatter:a=>e(a,s,{translateUnit:Va})}}}const ce={useContextLinks:ka,useDashboardContext:qa,useEvaluateFeatureFlag:da,useExportPdf:Wa,useI18n:At,useIssueQuery:Aa,useIssueRequestsQuery:Pa,useMetricFormatter:Ya,useRequestQueue:Ra},Xa={class:"kong-ui-public-csv-export-modal"},ja={key:0,class:"selected-range"},Qa={key:4,class:"text-muted",tag:"span"},rr=3,nr=n.defineComponent({__name:"CsvExportModal",props:{exportState:{},filename:{},modalDescription:{default:void 0}},emits:["closeModal"],setup(r,{emit:e}){const{i18n:t}=ce.useI18n(),i=r,s=e,o=`${i.filename.replace(/\s+/g,"-").toLowerCase()}-${new Date().toISOString().slice(0,10)}.csv`,a=n.ref(1),l=n.computed(()=>f.value.rows.length),u=n.computed(()=>i.exportState.status==="success"&&!!i.exportState.chartData?.data?.length),c=n.computed(()=>{if(i.exportState.status!=="success"||!i.exportState.chartData?.meta)return"";const{start:_,end:O}=i.exportState.chartData.meta;return!_||!O?"":new Date(_).getTime()===new Date(O).getTime()?t.t("csvExport.exportAsOf",{time:ee.formatTimestamp(new Date(_),{includeTZ:!0})}):`${t.t("csvExport.exportTimeRange")}: ${ee.formatTimestamp(new Date(_))} - ${ee.formatTimestamp(new Date(O),{includeTZ:!0})}`}),d=n.computed(()=>i.exportState.status!=="success"?"":t.t("csvExport.previewRows",{rowsMax:Math.min(rr,l.value),rowsTotal:l.value,plural:l.value===1?"":"s"})),h=()=>{s("closeModal")},f=n.computed(()=>{if(i.exportState.status!=="success"||!u.value||!i.exportState.chartData?.meta.metric_names)return{headers:[],rows:[],csvHeaders:{}};const _=i.exportState.chartData,O=_.data.some(T=>T.timestamp!==_.data[0].timestamp),C=_.data.map(T=>{const U=new Date(T.timestamp);return{...Object.keys(T.event).reduce((p,g)=>{if(g in _.meta.display){const y=T.event[g],v=_.meta.display[g];p[g]=y&&v?.[y]?.name||T.event[g]}else p[g]=T.event[g];return p},{}),...O?{timestamp:Li(U,"yyyy-MM-dd HH:mm:ss"),tzOffset:Li(U,"XXX")}:{}}});let S=[];O&&(S=[{label:t.t("csvExport.Timestamp"),key:"timestamp"},{label:t.t("csvExport.UtcOffset"),key:"tzOffset"}]);const k="display"in i.exportState.chartData.meta&&i.exportState.chartData.meta.display?i.exportState.chartData.meta.display:{},E=[...S,...Object.keys(k).map(T=>({label:t.t(`chartLabels.${T}`),key:T})),...i.exportState.chartData.meta.metric_names.map(T=>({label:t.t(`chartLabels.${T}`),key:T}))],b=E.reduce((T,U)=>(T[U.key]=U.label,T),{});return{headers:E,csvHeaders:b,rows:C}}),m=async()=>{if(i.exportState.status!=="success")return{total:0,data:[]};const{rows:_}=f.value;return{total:Number(_.length)||0,data:_.slice(0,rr)}};return n.watch(f,()=>{a.value++}),(_,O)=>{const C=n.resolveComponent("KSkeleton"),S=n.resolveComponent("KEmptyState"),k=n.resolveComponent("KTableData"),E=n.resolveComponent("KTooltip"),b=n.resolveComponent("KButton"),T=n.resolveComponent("KModal");return n.openBlock(),n.createElementBlock("div",Xa,[n.createVNode(T,{class:"vitals-report","data-testid":"csv-export-modal","show-dismiss-icon":"",title:n.unref(t).t("csvExport.exportPreview"),visible:"",onCancel:h,onKeyup:n.withKeys(h,["esc"])},{default:n.withCtx(()=>[n.createElementVNode("div",null,[r.exportState.status==="success"&&u.value?(n.openBlock(),n.createElementBlock("div",ja,[n.createElementVNode("p",null,n.toDisplayString(r.modalDescription?r.modalDescription:n.unref(t).t("csvExport.exportDescription")),1),n.createElementVNode("p",null,n.toDisplayString(c.value),1)])):n.createCommentVNode("",!0),r.exportState.status==="loading"?(n.openBlock(),n.createBlock(C,{key:1,class:"chart-skeleton",type:"table"})):r.exportState.status==="success"?(n.openBlock(),n.createBlock(k,{key:2,class:"vitals-table",fetcher:m,"fetcher-cache-key":String(a.value),headers:f.value.headers,"hide-pagination":"","row-hover":!1,sortable:!1},{"empty-state":n.withCtx(()=>[n.createVNode(S,{"action-button-visible":!1},{title:n.withCtx(()=>[n.createElementVNode("h5",null,n.toDisplayString(n.unref(t).t("csvExport.noDataRange")),1)]),default:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(n.unref(t).t("csvExport.noDataRetry")),1)]),_:1})]),_:1},8,["fetcher-cache-key","headers"])):r.exportState.status==="error"?(n.openBlock(),n.createBlock(S,{key:3,"action-button-visible":!1},{title:n.withCtx(()=>[n.createElementVNode("h5",null,n.toDisplayString(n.unref(t).t("csvExport.dataError")),1)]),_:1})):n.createCommentVNode("",!0),r.exportState.status==="success"&&u.value?(n.openBlock(),n.createElementBlock("div",Qa,[n.createTextVNode(n.toDisplayString(d.value)+" ",1),n.createVNode(E,{class:"preview-tooltip",placement:"right",text:n.unref(t).t("csvExport.maximumRecordAmount",{value:n.unref(ee.EXPORT_RECORD_LIMIT)})},{default:n.withCtx(()=>[n.createVNode(n.unref(ie.InfoIcon),{color:`var(--kui-color-text-neutral, ${n.unref(Nt)})`,size:`var(--kui-icon-size-30, ${n.unref(ea)})`},null,8,["color","size"])]),_:1},8,["text"])])):n.createCommentVNode("",!0)])]),"footer-actions":n.withCtx(()=>[n.createVNode(b,{appearance:"tertiary",class:"cancel-btn",onClick:h},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(t).t("csvExport.cancelButton")),1)]),_:1}),n.createVNode(ua,{class:"vitals-report-export-button",filename:o,headers:f.value.csvHeaders,rows:f.value.rows},{default:n.withCtx(()=>[n.createVNode(b,{appearance:"primary","data-testid":"csv-download-button",disabled:r.exportState.status!=="success"||!u.value},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(t).t("csvExport.downloadButton")),1)]),_:1},8,["disabled"])]),_:1},8,["headers","rows"])]),_:1},8,["title"])])}}});var sr=(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))(sr||{});const Za=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 or(r=n.ref({}),e,t,i=Za){const s=n.ref("PENDING");return n.watchEffect(()=>{const o=i(r.value);if(r.value&&o&&t.value){s.value="VALIDATING_HAS_DATA";return}if(r.value&&t.value){s.value="VALIDATING";return}if(r.value&&e.value){s.value="STALE_IF_ERROR";return}if(r.value===void 0&&!e.value){s.value="PENDING";return}if(r.value&&!e.value&&o){s.value="SUCCESS_HAS_DATA";return}if(r.value&&!e.value){s.value="SUCCESS";return}r.value===void 0&&e&&(s.value="ERROR")}),{state:s,swrvState:sr}}const Ke=n.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:s}=ce.useI18n(),{issueQuery:o}=ce.useIssueQuery(),a=n.inject(Te),l=()=>t.queryReady&&a?JSON.stringify([t.query,t.context,t.refreshCounter]):null,{data:u,error:c,isValidating:d}=ei(l,async()=>{const k=l();try{const E=await o(t.query,t.context,t.limitOverride);return l()!==k?void 0:(m.value=null,E)}catch(E){if(l()!==k)return;throw m.value=xe.handleQueryError(E),E}finally{l()===k&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:h,swrvState:f}=or(u,c,d),m=n.ref(null),_=n.computed(()=>h.value===f.ERROR||!!m.value),O=n.computed(()=>!t.queryReady||h.value===f.PENDING),C=n.ref(),S=n.computed(()=>u.value??(t.queryReady&&h.value===f.PENDING?C.value:void 0));return n.watch([()=>u.value,()=>h.value],([k,E])=>{k&&(E==="SUCCESS_HAS_DATA"||E==="SUCCESS")&&k!==C.value&&(C.value=k,i("chart-data",k))}),(k,E)=>{const b=n.resolveComponent("KSkeleton"),T=n.resolveComponent("KEmptyState");return(O.value||!n.unref(u)&&!_.value)&&!S.value?(n.openBlock(),n.createBlock(b,{key:0,class:"chart-skeleton",type:"table"})):_.value&&!O.value?(n.openBlock(),n.createBlock(T,{key:1,"action-button-visible":!1,"data-testid":"chart-empty-state"},n.createSlots({icon:n.withCtx(()=>[m.value?.type==="forbidden"?(n.openBlock(),n.createBlock(n.unref(ie.VisibilityOffIcon),{key:0})):(n.openBlock(),n.createBlock(n.unref(ie.WarningOutlineIcon),{key:1}))]),title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(m.value?.message||n.unref(s).t("renderer.unexpectedError")),1)]),_:2},[m.value?.details?{name:"default",fn:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(m.value.details),1)]),key:"0"}:void 0]),1024)):S.value?n.renderSlot(k.$slots,"default",{data:S.value},void 0,void 0,2):n.createCommentVNode("",!0)}}}),Ja=n.defineComponent({__name:"SimpleChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){const e=r,t=n.computed(()=>e.chartOptions.type==="single_value"),i=n.computed(()=>e.chartOptions.type==="single_value"?{...e.chartOptions,alignX:e.chartOptions.align_x??"left",showTrend:e.query.granularity==="trend"}:e.chartOptions);return(s,o)=>(n.openBlock(),n.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:n.withCtx(({data:a})=>[n.createElementVNode("div",{class:n.normalizeClass(["analytics-chart",{"single-value":t.value}]),style:n.normalizeStyle(t.value?void 0:{height:`${r.height}px`})},[n.createVNode(n.unref(xe.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,s]of e)t[i]=s;return t},ar=Ce(Ja,[["__scopeId","data-v-22077b88"]]),el={class:"analytics-chart"},Gt=Ce(n.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:s}=ce.useI18n(),o=n.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=n.resolveComponent("KDropdownItem");return n.openBlock(),n.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:u},{default:n.withCtx(({data:f})=>[n.createElementVNode("div",el,[n.createVNode(n.unref(xe.AnalyticsChart),n.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))}),n.createSlots({_:2},[r.context.editable?{name:"menu-items",fn:n.withCtx(()=>[n.createVNode(h,{onClick:l},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).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"]]),lr=n.defineComponent({__name:"BarChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){return(e,t)=>(n.openBlock(),n.createBlock(Gt,{"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"]))}}),tl={class:"analytics-chart"},il={key:3,class:"analytics-chart"},rl=Ce(n.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:s}=ce.useI18n(),{issueRequestsQuery:o}=ce.useIssueRequestsQuery(),a=n.computed(()=>t.query.datasource==="requests"),l=n.computed(()=>{const b=t.query,T=b.time_range??t.context.timeSpec,U=T?zt(T):void 0;if(!U)return b;const z=ee.finestGranularityForDuration(U);let p;return b.granularity&&ee.Granularities[b.granularity]>=ee.Granularities[z]?p=b.granularity:p=z,{...b,granularity:p}}),u=()=>a.value&&t.queryReady?JSON.stringify([t.query,t.context,t.refreshCounter]):null,c=n.ref(null),{data:d,error:h,isValidating:f}=ei(u,async()=>{const b=u(),T=t.query;try{const U=await o(T,t.context);return u()!==b?void 0:(c.value=null,xe.requestsToScatterData(U,za(T)))}catch(U){if(u()!==b)return;throw c.value=xe.handleQueryError(U),U}finally{u()===b&&i("query-complete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:m,swrvState:_}=or(d,h,f),O=n.ref(),C=n.computed(()=>d.value??O.value);n.watch(d,b=>{b&&(O.value=b)});const S=n.computed(()=>m.value===_.ERROR||!!c.value),k=n.computed(()=>!S.value&&(!t.queryReady||m.value===_.PENDING)&&!C.value),E=n.computed(()=>({type:"scatter",chartDatasetColors:t.chartOptions.chart_dataset_colors,scatter:{percentileLines:t.chartOptions.percentile_lines?.map(b=>({percentile:b.percentile,label:b.label,borderDash:b.border_dash,color:b.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(b,T)=>{const U=n.resolveComponent("KSkeleton"),z=n.resolveComponent("KEmptyState");return a.value?k.value?(n.openBlock(),n.createBlock(U,{key:1,class:"chart-skeleton",type:"table"})):S.value?(n.openBlock(),n.createBlock(z,{key:2,"action-button-visible":!1,"data-testid":"scatter-chart-empty-state"},n.createSlots({icon:n.withCtx(()=>[c.value?.type==="forbidden"?(n.openBlock(),n.createBlock(n.unref(ie.VisibilityOffIcon),{key:0})):(n.openBlock(),n.createBlock(n.unref(ie.WarningOutlineIcon),{key:1}))]),title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(c.value?.message||n.unref(s).t("renderer.unexpectedError")),1)]),_:2},[c.value?.details?{name:"default",fn:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(c.value.details),1)]),key:"0"}:void 0]),1024)):C.value?(n.openBlock(),n.createElementBlock("div",il,[n.createVNode(n.unref(xe.AnalyticsChart),{"chart-data":C.value,"chart-options":E.value,"legend-position":"bottom","synthetics-data-key":r.chartOptions.synthetics_data_key,"tooltip-title":""},null,8,["chart-data","chart-options","synthetics-data-key"])])):n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Ke,{key:0,context:r.context,query:l.value,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:T[0]||(T[0]=p=>i("chart-data",p)),onQueryComplete:T[1]||(T[1]=p=>i("query-complete"))},{default:n.withCtx(({data:p})=>[n.createElementVNode("div",tl,[n.createVNode(n.unref(xe.AnalyticsChart),{"chart-data":p,"chart-options":E.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"]]),cr=n.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,s)=>(n.openBlock(),n.createBlock(Gt,{"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:s[0]||(s[0]=o=>t("select-chart-range",o)),onZoomTimeRange:s[1]||(s[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"]))}}),nl=Ce(n.defineComponent({__name:"GoldenSignalsRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){const e=r,t=n.computed(()=>{const s=e.query?.datasource;if(s&&s!=="api_usage"&&s!=="basic")throw new Error(`Invalid datasource value: ${s}`);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=n.computed(()=>!!(e.chartOptions.chart_title||e.headerDescription));return(s,o)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["metric-card-tile-wrapper",{titled:i.value}])},[n.createVNode(n.unref(ti.MetricsProvider),n.normalizeProps(n.guardReactiveProps(t.value)),{default:n.withCtx(()=>[n.createVNode(n.unref(ti.MetricsConsumer))]),_:1},16)],2))}}),[["__scopeId","data-v-3eda5028"]]);var rt=(r=>(r.PENDING="PENDING",r.LOADING="LOADING",r.SUCCESS="SUCCESS",r.ERROR="ERROR",r))(rt||{});const sl=r=>!!r?.length;function ol(r,e,t,i=sl){const s=n.computed(()=>i(r.value)),o=n.computed(()=>{const a=r.value!==void 0,l=e.value!==void 0&&e.value!==null;return t.value?"LOADING":s.value?"SUCCESS":l?"ERROR":a?"SUCCESS":"PENDING"});return{fetchState:rt,hasData:s,state:o}}const al=({emitState:r,fetchLifecycleState:e,hasData:t})=>{n.watch(()=>({hasData:t.value,state:e.value}),({hasData:i,state:s})=>{if(s!==rt.PENDING){if(s===rt.LOADING){r({hasData:i,state:"loading"});return}if(s===rt.ERROR){r({hasData:i,state:"error"});return}r({hasData:i,state:"success"})}})},ll=({startRow:r,endRow:e})=>{const t=e-r;return{blockIndex:t>0?Math.floor(r/t):0,pageSize:t}},cl=({startRow:r,rowsLength:e,pageSize:t,total:i,hasMore:s})=>{if(typeof i=="number")return i;if(s!==!0&&(s===!1||e<t))return r+e},ul=({fetcher:r,resetKey:e,sort:t})=>{const i=new Map,s=new Map,o=n.ref(0),a=n.ref(0),l=n.shallowRef(),u=n.shallowRef(),c=n.shallowRef(),d=n.ref(0),h=n.ref(!1);let f,m,_=t?.value?.sortColumnKey,O=t?.value?.sortColumnOrder;const C=K=>K===o.value&&f===r.value&&m===e?.value,S=(K,q)=>C(K)&&q===a.value&&_===t?.value?.sortColumnKey&&O===t?.value?.sortColumnOrder,k=K=>{if(!t)return!0;const q=t.value;return!q?.sortColumnKey||!q.sortColumnOrder?K.length===0:K.length===1&&K[0].colId===q.sortColumnKey&&K[0].sort===q.sortColumnOrder},E=()=>{h.value=d.value>0},b=()=>{a.value+=1,_=t?.value?.sortColumnKey,O=t?.value?.sortColumnOrder;for(const K of s.values())K.resolve(!1);i.clear(),s.clear(),u.value=void 0,c.value=void 0,d.value=0,E()},T=()=>{c.value=void 0,d.value+=1,E()},U=()=>{d.value=Math.max(0,d.value-1),E()},z=K=>{const q=s.get(K);if(q)return q;let V;const P={promise:new Promise(F=>{V=F}),resolve:F=>V(F)};return s.set(K,P),P},p=(K,q)=>{q.resolve(!1),s.get(K)===q&&s.delete(K)},g=async({blockIndex:K,currentBlockCompletion:q,datasourceId:V,requestGeneration:P})=>{if(K===0)return"ready";const F=s.get(K-1);if(!F)return p(K,q),"failed";const M=await F.promise;return S(V,P)?M?"ready":(p(K,q),"failed"):(p(K,q),"stale")},y=({blockIndex:K,currentBlockCompletion:q,getRowsParams:V,pageSize:P,result:F})=>{F.cursor!==void 0&&i.set(K,F.cursor),V.successCallback(F.data,cl({startRow:V.startRow,rowsLength:F.data.length,pageSize:P,total:F.total,hasMore:F.hasMore})),V.startRow===0&&(u.value=F.data),q.resolve(!0)},v=({blockIndex:K,currentBlockCompletion:q,fetchError:V,getRowsParams:P})=>{c.value=V,P.failCallback(),p(K,q)},x=()=>{const K=r.value;if(!K)throw new Error("TableDataGrid requires a fetcher in infinite mode");f=K,m=e?.value;const q=o.value+1;return o.value=q,b(),{async getRows(V){if(!C(q)||!k(V.sortModel)){V.failCallback();return}const{blockIndex:P,pageSize:F}=ll({startRow:V.startRow,endRow:V.endRow});P===0&&s.has(0)&&b();const M=a.value,A=z(P);if(await g({blockIndex:P,currentBlockCompletion:A,datasourceId:q,requestGeneration:M})!=="ready"||!S(q,M)){V.failCallback(),p(P,A);return}T();try{const w=P>0?i.get(P-1):void 0,D=await K({mode:"infinite",pageSize:F,cursor:w,sort:t?.value});if(!S(q,M)){V.failCallback(),p(P,A);return}y({blockIndex:P,currentBlockCompletion:A,getRowsParams:V,pageSize:F,result:D})}catch(w){if(!S(q,M)){V.failCallback(),p(P,A);return}v({blockIndex:P,currentBlockCompletion:A,fetchError:w,getRowsParams:V})}finally{S(q,M)&&U()}}}},N=()=>{l.value=x()};return n.watch([r,()=>e?.value],()=>{N()},{immediate:!0}),n.watch([()=>t?.value?.sortColumnKey,()=>t?.value?.sortColumnOrder],()=>b()),{datasource:n.readonly(l),data:n.shallowReadonly(u),error:n.readonly(c),isFetching:n.readonly(h)}},dl={title:"No Data",message:"There is no data to display."},hl={title:"An error occurred",message:"Data cannot be displayed due to an error."},fl={emptyState:dl,errorState:hl};function ur(){const r=at.createI18n("en-us",fl);return{i18n:r,i18nT:at.i18nTComponent(r)}}const{i18n:ml}=ur(),dr=(r,e)=>{const t=Reflect.get(e,r.key);return r.valueFormatter?r.valueFormatter(t,e):String(t??"")},pt=r=>typeof r!="number"?null:Number.isFinite(r)?r:null,pl=(r,e)=>r.reduce((t,i)=>{const s=pt(Reflect.get(i,e.key));return s===null?t:{sum:t.sum+s,max:Math.max(t.max,s)}},{sum:0,max:0}),gl=(r,e)=>{const t=(e??[]).filter(s=>Number.isFinite(s.value)&&r>=s.value);if(!t.length)return;const i=Math.max(...t.map(s=>s.value));return t.filter(s=>s.value===i).some(s=>s.type==="error")?"error":"warning"},_l=(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},yl=r=>{const e=t=>ml.formatNumber(t,{maximumFractionDigits:2});return r>0&&r<.01?`< ${e(.01)} %`:`${e(r)} %`},hr=({value:r,stats:e,header:t})=>{if(r===null||e.sum<=0)return;const i=r/e.sum*100;return t.percentageFormatter?.(i)??yl(i)},fr=(r,e)=>e!==void 0&&e.length>(r?.length??-1)?e:r,Rl=({rows:r,header:e,stats:t})=>r.reduce((i,s)=>({value:fr(i.value,dr(e,s))??"",relative:e.showPercentage?fr(i.relative,hr({value:pt(Reflect.get(s,e.key)),stats:t,header:e})):void 0}),{value:""}),Cl=["data-threshold"],El={class:"table-data-grid-cell-label-track"},Ol={class:"table-data-grid-cell-label"},bl={key:0,class:"table-data-grid-cell-relative","data-testid":"table-data-grid-cell-relative"},wl={key:0,"aria-hidden":"true",class:"table-data-grid-cell-label table-data-grid-cell-label-sizer"},Tl=["data-text"],vl=["data-text"],Sl=["data-threshold"],xl=n.defineComponent({name:"TableDataGridCellRenderer",__name:"TableDataGridCellRenderer",props:{params:{}},setup(r,{expose:e}){const t=n.shallowRef(r.params),i=n.ref(null),s=n.ref(!1),o=n.computed(()=>t.value.headerDef??{key:"",label:""}),a=n.computed(()=>t.value.context?.presentation),l=n.computed(()=>t.value.context?.cells?.tooltipTarget?.value??"body"),u=n.computed(()=>t.value.valueFormatted??String(t.value.value??"")),c=n.computed(()=>t.value.value),d=n.computed(()=>pt(c.value)),h=n.computed(()=>a.value?.stats[o.value.key]),f=n.computed(()=>o.value.showPercentage&&h.value?hr({value:d.value,stats:h.value,header:o.value}):void 0),m=n.computed(()=>!!o.value.bar&&!!h.value&&(d.value!==null||c.value===null||c.value===void 0)),_=n.computed(()=>m.value&&h.value?_l(d.value,h.value,o.value.bar)*100:0),O=n.computed(()=>m.value?a.value?.labelSizers[o.value.key]:void 0),C=n.computed(()=>o.value.thresholds?.length&&d.value!==null?gl(d.value,o.value.thresholds):void 0),S=n.computed(()=>({column:o.value,refreshCell:()=>{const y=t.value.node;y&&t.value.api.refreshCells({force:!0,rowNodes:[y]})},row:t.value.data??{},rowIndex:t.value.node?.rowIndex??0,rowValue:t.value.value,selected:t.value.node?.isSelected()??!1})),k=(y,{slots:v})=>{const x=t.value.colDef?.colId,N=t.value.context?.cells?.slots;return!x||x==="cell-icon"||!N?.[x]?v.default?.():n.h("span",{class:"table-data-grid-cell-slot-content"},n.renderSlot(N,x,S.value,()=>v.default?.()??[]))},E=()=>{const y=t.value.context?.cells?.slots;return y?.["cell-icon"]?n.renderSlot(y,"cell-icon",S.value):null};let b,T,U=!1;const z=()=>{const y=i.value;s.value=!!y&&y.scrollWidth>y.clientWidth},p=()=>{U||(T!==void 0&&cancelAnimationFrame(T),T=requestAnimationFrame(()=>{T=void 0,z()}))},g=y=>{if(b?.disconnect(),y){b?.observe(y);const v=y.closest(".ag-cell");v&&b?.observe(v)}p()};return n.onMounted(()=>{b=new ResizeObserver(p),g(i.value)}),n.watch(i,g),n.onUnmounted(()=>{U=!0,b?.disconnect(),T!==void 0&&cancelAnimationFrame(T)}),e({refresh(y){return t.value=y,n.nextTick(p),!0}}),(y,v)=>{const x=n.resolveComponent("KTooltip");return n.openBlock(),n.createElementBlock("span",{class:n.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},[n.createElementVNode("span",El,[n.createElementVNode("span",Ol,[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(E))),(n.openBlock(),n.createBlock(n.resolveDynamicComponent(k),null,{default:n.withCtx(()=>[n.createVNode(x,{class:"table-data-grid-cell-tooltip",disabled:!s.value,"kpop-attributes":{popoverDelay:400},"max-width":"300",placement:"bottom-start",target:l.value,text:u.value},{default:n.withCtx(()=>[n.createElementVNode("span",{ref_key:"contentElement",ref:i,class:"table-data-grid-cell-content"},n.toDisplayString(u.value),513)]),_:1},8,["disabled","target","text"])]),_:1})),f.value?(n.openBlock(),n.createElementBlock("span",bl,"("+n.toDisplayString(f.value)+")",1)):n.createCommentVNode("",!0)]),O.value?(n.openBlock(),n.createElementBlock("span",wl,[n.createElementVNode("span",{class:"table-data-grid-cell-sizer-value","data-text":O.value.value},null,8,Tl),O.value.relative?(n.openBlock(),n.createElementBlock("span",{key:0,class:"table-data-grid-cell-sizer-relative","data-text":`(${O.value.relative})`},null,8,vl)):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),m.value?(n.openBlock(),n.createElementBlock("span",{key:0,class:"table-data-grid-cell-bar","data-testid":"table-data-grid-cell-bar","data-threshold":C.value},[n.createElementVNode("span",{class:"table-data-grid-cell-bar-fill","data-testid":"table-data-grid-cell-bar-fill",style:n.normalizeStyle({width:`${_.value}%`})},null,4)],8,Sl)):n.createCommentVNode("",!0)],10,Cl)}}}),Il=({headers:r,slots:e,initialSort:t,mode:i,rows:s,tooltipTarget:o})=>{const a=i??"infinite",l=new Set,u=m=>!!(m.showPercentage||m.bar||m.thresholds?.length);n.watch([r,()=>s?.value],()=>{r.value.forEach(m=>{if(!u(m))return;let _;if(a==="infinite"&&(m.showPercentage||m.bar)?_="percentage and bar presentation is only supported in unpaginated mode":a==="unpaginated"&&s?.value?.some(C=>{const S=Reflect.get(C,m.key);return S!=null&&pt(S)===null})&&(_="contains non-finite or nonnumeric values; numeric presentation skips those values"),!_)return;const O=`${m.key}:${_}`;l.has(O)||(l.add(O),console.warn(`[TableDataGrid] Column "${m.key}" ${_}.`))})},{immediate:!0});const c=n.computed(()=>{if(a!=="unpaginated")return{};const m=s?.value??[];return Object.fromEntries(r.value.filter(_=>_.showPercentage||_.bar).map(_=>[_.key,pl(m,_)]))}),d=n.computed(()=>{if(a!=="unpaginated")return{};const m=s?.value??[];return Object.fromEntries(r.value.filter(_=>_.bar).map(_=>[_.key,Rl({rows:m,header:_,stats:c.value[_.key]})]))}),h=n.computed(()=>({cells:{slots:e,tooltipTarget:o},presentation:{stats:c.value,labelSizers:d.value}})),f=m=>{const _=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,..._?{initialSort:t?.sortColumnOrder,initialSortIndex:0}:{},valueGetter:O=>O.data?.[m.key],valueFormatter:O=>O.data?dr(m,O.data):String(O.value??""),width:m.width,cellRenderer:xl,cellRendererParams:{headerDef:m}}};return{columnDefs:n.computed(()=>r.value.map(f)),gridContext:h}},Ft=({config:r,headers:e,pageSize:t})=>{const i=new Set(e.filter(o=>o.sortable).map(o=>o.key)),s=r?.sortColumnKey&&i.has(r.sortColumnKey)?r.sortColumnKey:void 0;return{sortColumnKey:s,sortColumnOrder:s?r?.sortColumnOrder:void 0,pageSize:r?.pageSize??t,...r?.fitToContent!==void 0?{fitToContent:r.fitToContent}:{}}},mr=(r,e)=>r.sortColumnKey===e.sortColumnKey&&r.sortColumnOrder===e.sortColumnOrder&&r.pageSize===e.pageSize&&r.fitToContent===e.fitToContent,Dl=({headers:r,pageSize:e,tableConfig:t,emitSort:i,emitTableConfigUpdate:s,onExternalConfigChange:o})=>{const a=n.computed(()=>t.value?Ft({config:t.value,headers:r.value,pageSize:e.value}):void 0),l=n.ref(a.value??Ft({config:void 0,headers:r.value,pageSize:e.value}));n.watch(a,h=>{h&&!mr(h,l.value)&&(l.value=h,o?.(h))});const u=h=>{const f=Ft({config:{...l.value,...h},headers:r.value,pageSize:e.value});mr(f,l.value)||((f.sortColumnKey!==l.value.sortColumnKey||f.sortColumnOrder!==l.value.sortColumnOrder)&&i({sortColumnKey:f.sortColumnKey,sortColumnOrder:f.sortColumnOrder}),l.value=f,s(f))};n.watch(r,()=>{t.value||u({})},{deep:!0});const c=n.computed(()=>({sortColumnKey:l.value.sortColumnKey,sortColumnOrder:l.value.sortColumnOrder})),d=n.computed(()=>t.value?.pageSize??e.value);return{activeTableConfig:n.readonly(l),activeSort:c,activePageSize:d,patchTableConfig:u}},kl=({cellClick:r,headers:e,rowClick:t})=>{const i=n.computed(()=>new Set(e.value.filter(a=>a.disableRowClick).map(a=>a.key))),s=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=s(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)}}},Nl=({activeSort:r,patchTableConfig:e})=>{const t=(i,s)=>{i.applyColumnState({state:s.sortColumnKey?[{colId:s.sortColumnKey,sort:s.sortColumnOrder??null,sortIndex:0}]:[],defaultState:{sort:null,sortIndex:null}})};return{onSortChanged:i=>{const s=i.api.getColumnState().filter(l=>l.sort).sort((l,u)=>(l.sortIndex??0)-(u.sortIndex??0)),o=s[s.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),s.length>1&&t(i.api,a)},applySortToGrid:t}},Al={key:0,class:"table-error-state","data-testid":"table-error-state"},Ll={key:1,class:"table-empty-state","data-testid":"table-empty-state"},Ul=n.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}){Qe.ModuleRegistry.registerModules([Qe.AllCommunityModule,Qe.ClientSideRowModelModule,Qe.InfiniteRowModelModule]);const t=r.mode??"infinite",i=e,{i18n:s}=ur(),{t:o}=s,a=n.useSlots(),l=n.shallowRef(),u=n.useTemplateRef("rootElement"),c=n.shallowRef("body"),d=()=>{const A=document.fullscreenElement;c.value=A instanceof HTMLElement&&A.contains(u.value??null)?A:"body"};n.onMounted(()=>{d(),document.addEventListener("fullscreenchange",d)}),n.onBeforeUnmount(()=>{document.removeEventListener("fullscreenchange",d)});const{activeTableConfig:h,activeSort:f,activePageSize:m,patchTableConfig:_}=Dl({headers:n.toRef(()=>r.headers),pageSize:n.toRef(()=>r.pageSize),tableConfig:n.toRef(()=>r.tableConfig),emitSort:A=>i("sort",A),emitTableConfigUpdate:A=>i("update:tableConfig",A),onExternalConfigChange:A=>{l.value&&C(l.value,A)}}),{onSortChanged:O,applySortToGrid:C}=Nl({activeSort:f,patchTableConfig:_}),S=n.computed(()=>t==="unpaginated"&&!!h.value.fitToContent),k=Qe.themeQuartz.withParams({autoHeightMinBodyHeight:0}),{onCellClick:E,onRowClick:b}=kl({cellClick:A=>i("cell:click",A),headers:n.toRef(()=>r.headers),rowClick:(A,w)=>i("row:click",A,w)}),T={resizable:!1,sortable:!1,suppressMovable:!0},U=n.computed(()=>[m.value,r.refreshKey]),z=t==="infinite"?ul({fetcher:n.toRef(()=>r.fetcher),resetKey:U,sort:f}):void 0,p=z?.datasource,g=n.computed(()=>z?z.data.value:r.rows),y=n.computed(()=>z?.isFetching.value??!1),v=n.computed(()=>r.rows?Array.from(r.rows):void 0),{columnDefs:x,gridContext:N}=Il({headers:n.toRef(()=>r.headers),mode:t,rows:v,slots:a,tooltipTarget:c,initialSort:f.value}),{fetchState:K,hasData:q,state:V}=ol(g,n.toRef(()=>z?.error.value),y),P=n.computed(()=>V.value===K.SUCCESS&&!q.value);z&&al({emitState:A=>i("state",A),fetchLifecycleState:V,hasData:q});const F=()=>{const A=l.value;if(!A||A.isDestroyed())return;const w=f.value,D=A.getColumnState().find(I=>I.sort);D?.colId===w.sortColumnKey&&(D?.sort??void 0)===w.sortColumnOrder||C(A,w)};n.watch([l,f],F);const M=A=>{l.value=A.api,i("grid:ready",A.api)};return(A,w)=>{const D=n.resolveComponent("KEmptyState");return n.openBlock(),n.createElementBlock("div",{ref_key:"rootElement",ref:u,class:n.normalizeClass(["kong-ui-public-table-data-grid",{"fit-to-content":S.value}]),"data-testid":"table-data-grid"},[r.error?(n.openBlock(),n.createElementBlock("div",Al,[n.renderSlot(A.$slots,"error-state",{},()=>[n.createVNode(D,{"icon-variant":"error",message:n.unref(o)("errorState.message"),title:n.unref(o)("errorState.title")},null,8,["message","title"])],!0)])):P.value?(n.openBlock(),n.createElementBlock("div",Ll,[n.renderSlot(A.$slots,"empty-state",{},()=>[n.createVNode(D,{message:n.unref(o)("emptyState.message"),title:n.unref(o)("emptyState.title")},null,8,["message","title"])],!0)])):(n.openBlock(),n.createBlock(n.unref(Pr.AgGridVue),{key:2,"cache-block-size":n.unref(t)==="infinite"?n.unref(m):void 0,class:"table-data-grid-grid","column-defs":n.unref(x),context:n.unref(N),datasource:n.unref(t)==="infinite"?n.unref(p):void 0,"default-col-def":T,"dom-layout":S.value?"autoHeight":"normal","infinite-initial-row-count":n.unref(t)==="infinite"?1:void 0,loading:y.value,"row-data":n.unref(t)==="unpaginated"?v.value:void 0,"row-model-type":n.unref(t)==="unpaginated"?"clientSide":"infinite","suppress-cell-focus":!0,"suppress-multi-sort":!0,theme:n.unref(k),onCellClicked:n.unref(E),onGridReady:M,onNewColumnsLoaded:F,onRowClicked:n.unref(b),onSortChanged:n.unref(O)},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)}}}),Kl=(r,e)=>{const t=r.__vccOpts||r;for(const[i,s]of e)t[i]=s;return t},pr=Kl(Ul,[["__scopeId","data-v-01cd8bcd"]]),gr=3,Ml={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},$t=(r,e)=>{if(!r||!e)return;const t=e.toLowerCase();return r[e]??Object.entries(r).find(([i])=>i.toLowerCase()===t)?.[1]},Bl=({columnOptions:r,columnKey:e,rawValue:t})=>{if(!($t(r,e)?.icon_set!=="ai_provider"||typeof t!="string"))return Ml[t.toLowerCase()]},zl=r=>{if(r==null||r==="")return null;const e=typeof r=="number"?r:Number(r);return Number.isFinite(e)?e:null},Pl=r=>r.toLocaleLowerCase().endsWith("count"),ql=r=>{const e=Object.keys(r?.meta?.display??{}).slice(0,gr),t=r?.meta?.metric_names??[];return(r?.data??[]).map(i=>{const s={record:i};return e.forEach(o=>{s[o]=i.event[o]}),t.forEach(o=>{s[o]=zl(i.event[o])}),s})},Hl=({data:r,columnOptions:e,i18n:t})=>{const{formatUnit:i}=ee.unitFormatter({i18n:t}),s=r?.data??[],o=r?.meta,a=o?.display??{},l=Object.keys(a).slice(0,gr),u=o?.metric_names??[],c=u[0],d=l.length>1,h=E=>{const b=`chartLabels.${E}`;return t.messages[b]?t.formatMessage({id:b}):E},f=(E,b)=>$t(e,E)?.label||b,m=(E,b)=>{if(Pl(E)||E==="requests")return"";const T=b===1?"":"s",U=`chartUnits.${E}`;return t.messages[U]?t.formatMessage({id:U},{plural:T}):E},_=E=>{const b=T=>i(T,"%",{translateUnit:m});return E>0&&E<.01?`< ${b(.01)}`:b(E)},O=(E,b)=>{const T=E.event[b];if(T==null)return"–";const U=typeof T=="number"?T:Number(T);if(Number.isNaN(U))return"–";const z=o?.metric_units?.[b]||"count";return z==="%"?_(U):i(U,z,{approximate:["count","count/minute","token count"].includes(z),isBytes1024:!0,translateUnit:m})},C=(E,b)=>{const T=String(E.record.event[b]),U=a[b]?.[T];return{id:T,label:U?.name||"-",deleted:!!U?.deleted}},S=l.map(E=>({key:E,label:f(E,d?h(E):t.t("topNTable.nameLabel")),type:"dimension",valueFormatter:(b,T)=>C(T,E).label,sortable:!1}));u.forEach(E=>{const b=$t(e,E);S.push({key:E,label:b?.label||h(E),type:"metric",valueFormatter:(T,U)=>O(U.record,E),showPercentage:b?.value==="relative",percentageFormatter:_,bar:b?.bar==="max"?"absolute":b?.bar,thresholds:b?.thresholds,sortable:!1})});const k=s.length?o?l.some(E=>!Object.keys(a[E]||{}).length)?t.t("topNTable.errors.display"):c?"":t.t("topNTable.errors.metricNames"):t.t("topNTable.errors.meta"):"";return{headers:S,errorMessage:k,getDimension:C}},Gl={class:"fallback-entity-link","data-testid":"entity-link-parent"},_r=n.defineComponent({__name:"FallbackEntityLink",props:{entityLinkData:{}},setup(r){return(e,t)=>(n.openBlock(),n.createElementBlock("div",Gl,n.toDisplayString(r.entityLinkData.label),1))}}),Fl=["data-testid"],$l={key:1},Wl=Ce(n.defineComponent({__name:"TopNDataGrid",props:{chartOptions:{},data:{},fitToContent:{type:Boolean,default:!1},height:{}},setup(r){const e=n.inject(Te),{i18n:t}=ce.useI18n(),i=n.computed(()=>ql(r.data)),s=n.computed(()=>Hl({data:r.data,columnOptions:r.chartOptions.column_options,i18n:t})),o=n.computed(()=>s.value.headers.map(_=>({..._,minWidth:_.type==="dimension"?160:_.bar?260:140}))),a=n.computed(()=>s.value.headers.filter(_=>_.type==="dimension")),l=n.computed(()=>({fitToContent:r.fitToContent})),u=n.computed(()=>r.fitToContent?{height:"auto"}:r.height===void 0?void 0:{height:`${r.height}px`}),c=(_,O)=>Bl({columnOptions:r.chartOptions.column_options,columnKey:_,rawValue:O}),d=n.defineAsyncComponent(async()=>{if(e?.fetchComponent)try{return await e.fetchComponent("EntityLink")}catch{return _r}return _r}),h=_=>{const O=r.chartOptions.entity_links;return O&&(O[_]||Object.entries(O).find(([C])=>C.toLowerCase()===_.toLowerCase())?.[1])||""},f=_=>h(_)||a.value[0]?.key===_&&r.chartOptions.entity_link||"",m=(_,O)=>{const C=f(O),S=String(_[O]);if(S.includes(":")){const[k,E]=S.split(":");return C.replace(Gi,k).replace(Lt,E)}return C.replace(Lt,S)};return(_,O)=>{const C=n.resolveComponent("KEmptyState");return n.openBlock(),n.createElementBlock("div",{class:"top-n-data-grid","data-testid":i.value.length?"top-n-table":void 0,style:n.normalizeStyle(u.value)},[n.createVNode(n.unref(pr),{error:!!s.value.errorMessage,headers:o.value,mode:"unpaginated",rows:i.value,"table-config":l.value},n.createSlots({"error-state":n.withCtx(()=>[n.createVNode(C,{"action-button-visible":!1,"data-testid":"chart-empty-state"},{icon:n.withCtx(()=>[n.createVNode(n.unref(ie.WarningOutlineIcon))]),title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(s.value.errorMessage),1)]),_:1})]),"empty-state":n.withCtx(()=>[n.createVNode(C,{"action-button-visible":!1,"data-testid":"top-n-empty-state",title:n.unref(t).t("topNTable.defaultEmptyStateTitle")},null,8,["title"])]),"cell-icon":n.withCtx(({column:S,rowValue:k})=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(c(S.key,k)),{class:"top-n-provider-icon","data-testid":"top-n-provider-icon",decorative:"",size:"var(--kui-icon-size-30, 16px)"}))]),_:2},[n.renderList(a.value,S=>({name:S.key,fn:n.withCtx(({row:k})=>[f(S.key)&&k[S.key]!=="empty"?(n.openBlock(),n.createBlock(n.unref(d),{key:0,class:"top-n-entity-link","entity-link-data":s.value.getDimension(k,S.key),"external-link":m(k,S.key)},null,8,["entity-link-data","external-link"])):s.value.getDimension(k,S.key).label==="empty"?(n.openBlock(),n.createElementBlock("i",$l,"empty")):n.createCommentVNode("",!0)])}))]),1032,["error","headers","rows","table-config"])],12,Fl)}}}),[["__scopeId","data-v-f6b76589"]]),Vl=n.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)=>(n.openBlock(),n.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:n.withCtx(({data:i})=>[n.createVNode(Wl,{"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"]))}}),Yl=n.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,s=n.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=n.computed(()=>new Map(s.value.map((c,d)=>[c,o(t.chartOptions.columns[d])]))),l=new Set,u=c=>{l.add(c),l.size===s.value.length&&(l.clear(),i("query-complete"))};return n.watch([a,()=>t.refreshCounter],()=>l.clear()),(c,d)=>(n.openBlock(),n.createBlock(n.unref(xe.TopTalkersGrid),{"column-options":r.chartOptions.column_options,columns:s.value,"size-metric":r.chartOptions.size_metric},{column:n.withCtx(({column:h})=>[n.createVNode(Ke,{context:r.context,query:a.value.get(h),"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onQueryComplete:f=>u(h)},{default:n.withCtx(({data:f})=>[n.createVNode(n.unref(xe.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"]))}}),Xl=r=>r.records.map(e=>{const t={...e};return Object.entries(e).forEach(([i,s])=>{if(s===null)return;const o=r.meta.display?.[i]?.[String(s)]?.name;o&&(t[i]=o)}),t}),yr=({canTranslate:r,columns:e,translate:t})=>e.map(i=>{const s=`chartLabels.${i}`;return{key:i,label:r(s)?t(s):i}}),jl={platform:yr,platform_usage:yr},Rr=async({abortController:r,context:e,cursor:t,pageSize:i,query:s,onResponseColumns:o,stripUnknownFilters:a,tabularQueryFn:l})=>{if(!l)throw new Error("AnalyticsBridge.tabularQueryFn is not defined");const u=s.query,c=a({datasource:s.datasource,filters:[...u.filters??[],...e.filters],queryFields:u.entity===void 0?void 0:[u.entity]}),d=await l({datasource:s.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:Xl(d),cursor:d.meta.cursor,hasMore:!!d.meta.cursor}},Ql={platform:Rr,platform_usage:Rr},Zl=Ce(n.defineComponent({__name:"TableDataGridRenderer",props:{query:{},context:{},queryReady:{type:Boolean},height:{},refreshCounter:{}},emits:["loading-change"],setup(r,{emit:e}){const t=r,i=e,s=n.inject(Te),o=Ne.useDatasourceConfigStore(),{i18n:a}=ce.useI18n(),l=new AbortController,u=n.ref([]),c=n.ref(!1),d=n.computed(()=>t.height===void 0?void 0:{height:`${t.height}px`}),h=n.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=n.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}}));n.onUnmounted(()=>{l.abort()});const m=n.computed(()=>jl[t.query.datasource]({columns:t.query.columns?.length?t.query.columns:u.value,translate:C=>a.t(C),canTranslate:C=>a.te(C)})),_=n.computed(()=>async({cursor:C,pageSize:S})=>{try{await o.isReady();const k=Ql[h.value.datasource];if(!k)throw new Error(`No table data grid fetcher found for datasource: ${h.value.datasource}`);const E=await k({abortController:l,context:t.context,cursor:C,pageSize:S,query:h.value,onResponseColumns:b=>{u.value=b},stripUnknownFilters:o.stripUnknownFilters,tabularQueryFn:s?.tabularQueryFn});return c.value=!1,E}catch(k){throw c.value=!0,k}}),O=C=>{C.state==="error"&&(c.value=!0),i("loading-change",C.state==="loading")};return(C,S)=>{const k=n.resolveComponent("KSkeleton");return n.openBlock(),n.createElementBlock("div",{class:"table-data-grid-renderer",style:n.normalizeStyle(d.value)},[r.queryReady?(n.openBlock(),n.createBlock(n.unref(pr),{key:1,error:c.value,fetcher:_.value,headers:m.value,"page-size":r.query.page_size,"refresh-key":f.value,onState:O},null,8,["error","fetcher","headers","page-size","refresh-key"])):(n.openBlock(),n.createBlock(k,{key:0,"data-testid":"table-skeleton",type:"table"}))],4)}}}),[["__scopeId","data-v-c49ff2eb"]]),Jl=n.defineComponent({__name:"DonutChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},activeMetric:{},headerDescription:{},requestsLink:{},exploreLink:{},zoomConfiguration:{}},setup(r){return(e,t)=>(n.openBlock(),n.createBlock(Gt,{"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"]))}}),ec="#ffffff",tc="#0044f4",ic="#d60027",rc="#ad000e",nc="#850000",sc="#5c0000",oc="#ff3954",ac="#ffabab",lc="#ffe5e5",cc="#ecfcff",uc="#6f28ff",dc="#f1f0ff",hc="#e0e4ea",fc="#0044f4",mc="#0030cc",pc="#002099",gc="#001466",_c="#5f9aff",yc="#bee2ff",Rc="#eefaff",Cc="#0d0e14",Ec="#6c7489",Oc="#52596e",bc="#3a3f51",wc="#232633",Tc="#afb7c5",vc="#e0e4ea",Sc="#f9fafb",xc="rgba(13, 14, 20, 0.6)",Ic="#0044f4",Dc="#0030cc",kc="#002099",Nc="#001466",Ac="#5f9aff",Lc="#bee2ff",Uc="#eefaff",Kc="#007d60",Mc="#005944",Bc="#004737",zc="#003629",Pc="#00d6a4",qc="#b5ffee",Hc="#ecfffb",Gc="rgba(0, 0, 0, 0)",Fc="#995c00",$c="#804400",Wc="#662d00",Vc="#4d1b00",Yc="#ffc400",Xc="#fff296",jc="#fffce0",Qc="#e0e4ea",Zc="#0044f4",Jc="#d60027",eu="#ad000e",tu="#850000",iu="#5c0000",ru="#ff3954",nu="#ffabab",su="#ffe5e5",ou="#6f28ff",au="#e0e4ea",lu="rgba(255, 255, 255, 0.2)",cu="#6c7489",uu="#52596e",du="#3a3f51",hu="#232633",fu="#afb7c5",mu="#e0e4ea",pu="#f9fafb",gu="#0044f4",_u="#0030cc",yu="#002099",Ru="#001466",Cu="#5f9aff",Eu="#bee2ff",Ou="#eefaff",bu="rgba(0, 0, 0, 0)",wu="#0044f4",Tu="#0d0e14",vu="#0044f4",Su="#d60027",xu="#ad000e",Iu="#850000",Du="#5c0000",ku="#ff3954",Nu="#ffabab",Au="#ffe5e5",Lu="#00abd2",Uu="#d60067",Ku="#6f28ff",Mu="#5e00f5",Bu="#afb7c5",zu="#0044f4",Pu="#0030cc",qu="#002099",Hu="#001466",Gu="#5f9aff",Fu="#bee2ff",$u="#eefaff",Wu="#ffffff",Vu="#6c7489",Yu="#52596e",Xu="#3a3f51",ju="#232633",Qu="#afb7c5",Zu="#e0e4ea",Ju="#f9fafb",ed="#0044f4",td="#0030cc",id="#002099",rd="#001466",nd="#5f9aff",sd="#bee2ff",od="#eefaff",ad="#007d60",ld="#005944",cd="#004737",ud="#003629",dd="#00d6a4",hd="#b5ffee",fd="#ecfffb",md="#995c00",pd="#804400",gd="#662d00",_d="#4d1b00",yd="#ffc400",Rd="#fff296",Cd="#fffce0",Ed="0.2s",Od="0px",bd="2px",wd="4px",Td="6px",vd="8px",Sd="10px",xd="50%",Id="100px",Dd="0px",kd="1px",Nd="2px",Ad="4px",Ld="640px",Ud="768px",Kd="1024px",Md="1280px",Bd="1536px",zd="'JetBrains Mono', Consolas, monospace",Pd="'Inter', Roboto, Helvetica, sans-serif",Wt="'Inter', Roboto, Helvetica, sans-serif",qd="10px",Hd="12px",Gd="14px",Fd="16px",$d="18px",Wd="20px",Vd="24px",Yd="32px",Xd="40px",jd="48px",Qd="700",Zd="500",Jd="400",eh="600",th="#f50045",ih="#828a9e",rh="#306fff",nh="#00a17b",sh="#ffc400",oh="10px",ah="12px",lh="16px",ch="20px",uh="24px",dh="32px",hh="40px",fh="48px",mh="normal",ph="-0.12px",gh="-0.24px",_h="-0.32px",yh="-0.4px",Rh="-0.48px",Ch="normal",Eh="12px",Oh="16px",bh="20px",wh="24px",Th="28px",vh="32px",Sh="36px",xh="40px",Ih="48px",Dh="56px",kh="#f1f0ff",Nh="#ffe5e5",Ah="#eefaff",Lh="#52596e",Uh="#e0e4ea",Kh="#ecfcff",Mh="#ecfffb",Bh="#fffce0",zh="#fff0f7",Ph="#6f28ff",qh="#5e00f5",Hh="#d60027",Gh="#ad000e",Fh="#0044f4",$h="#0030cc",Wh="#e0e4ea",Vh="#afb7c5",Yh="#52596e",Xh="#3a3f51",jh="#00819d",Qh="#00647a",Zh="#007d60",Jh="#005944",ef="#995c00",tf="#804400",rf="#d60067",nf="#ad0053",sf="#000933",of="rgba(255, 255, 255, 0.12)",af="rgba(255, 255, 255, 0.12)",lf="#00fabe",cf="rgba(255, 255, 255, 0.24)",uf="#bee2ff",df="#ffffff",hf="#eefaff",ff="#00fabe",mf="0 0 0 1px rgba(255, 255, 255, 0.12) inset",pf="4px 0 0 0 #00fabe inset",gf="0 0 0 1px rgba(255, 255, 255, 0.60) inset",_f="0px 4px 20px 0px rgba(0, 0, 0, 0.08)",yf="0px 0px 0px 1px #e0e4ea inset",Rf="0px 0px 0px 1px #d60027 inset",Cf="0px 0px 0px 1px #ad000e inset",Ef="0px 0px 0px 1px #e0e4ea inset",Of="0px 0px 0px 1px #0044f4 inset",bf="0px 0px 0px 1px #001466 inset",wf="0px 0px 0px 1px #5f9aff inset",Tf="0px 0px 0px 4px rgba(0, 68, 244, 0.2)",vf="0px",Sf="2px",xf="4px",If="6px",Df="8px",kf="12px",Nf="16px",Af="20px",Lf="24px",Uf="32px",Kf="40px",Mf="48px",Bf="56px",zf="64px",Pf="80px",qf="96px",Hf="auto",Gf="#bee2ff",Ff="#8fc1ff",$f="#5f9aff",Wf="#306fff",Vf="#b5ffee",Yf="#00fabe",Xf="#00d6a4",jf="#00a17b",Qf="#007d60",Zf="#005944",Jf="#b5ffee",em="#00fabe",tm="#b5ffee",im="#00a17b",rm="#fff296",nm="#ffe04b",sm="#ffc400",om="#b37600",am="#995c00",lm="#804400",cm="#fff296",um="#ffe04b",dm="#ffc2b3",hm="#ff9877",fm="#ff723c",mm="#f75008",pm="#d13500",gm="#a31f00",_m="#ffc2b3",ym="#ff9877",Rm="#ff723c",Cm="#f75008",Em="#d13500",Om="#a31f00",bm="#ffc2b3",wm="#ff9877",Tm="#ff723c",vm="#f75008",Sm="#d13500",xm="#a31f00",Im="#ffc2b3",Dm="#ff9877",km="#ff723c",Nm="#f75008",Am="#d13500",Lm="#a31f00",Um="#ffc2b3",Km="#ff9877",Mm="#ff723c",Bm="#f75008",zm="#d13500",Pm="#ffabab",qm="#ff7272",Hm="#ff3954",Gm="#f50045",Fm="#d60027",$m="#ad000e",Wm="#ffabab",Vm="#ff7272",Ym="#ff3954",Xm="#f50045",jm="#d60027",Qm="#eefaff",Zm="#ecfffb",Jm="#fffce0",ep="#fff1ef",tp="#ffe5e5",ip="#5f9aff",rp="#00d6a4",np="#ffc400",sp="#ff723c",op="#ff3954",ap="#eefaff",lp="#ecfffb",cp="#fffce0",up="#fff1ef",dp="#ffe5e5",hp="#0044f4",fp="#007d60",mp="#995c00",pp="#d13500",gp="#d60027",Cr=Object.freeze(Object.defineProperty({__proto__:null,KUI_ANIMATION_DURATION_20:Ed,KUI_BORDER_RADIUS_0:Od,KUI_BORDER_RADIUS_10:bd,KUI_BORDER_RADIUS_20:wd,KUI_BORDER_RADIUS_30:Td,KUI_BORDER_RADIUS_40:vd,KUI_BORDER_RADIUS_50:Sd,KUI_BORDER_RADIUS_CIRCLE:xd,KUI_BORDER_RADIUS_ROUND:Id,KUI_BORDER_WIDTH_0:Dd,KUI_BORDER_WIDTH_10:kd,KUI_BORDER_WIDTH_20:Nd,KUI_BORDER_WIDTH_30:Ad,KUI_BREAKPOINT_DESKTOP:Bd,KUI_BREAKPOINT_LAPTOP:Md,KUI_BREAKPOINT_MOBILE:Ld,KUI_BREAKPOINT_PHABLET:Ud,KUI_BREAKPOINT_TABLET:Kd,KUI_COLOR_BACKGROUND:ec,KUI_COLOR_BACKGROUND_ACCENT:tc,KUI_COLOR_BACKGROUND_DANGER:ic,KUI_COLOR_BACKGROUND_DANGER_STRONG:rc,KUI_COLOR_BACKGROUND_DANGER_STRONGER:nc,KUI_COLOR_BACKGROUND_DANGER_STRONGEST:sc,KUI_COLOR_BACKGROUND_DANGER_WEAK:oc,KUI_COLOR_BACKGROUND_DANGER_WEAKER:ac,KUI_COLOR_BACKGROUND_DANGER_WEAKEST:lc,KUI_COLOR_BACKGROUND_DECORATIVE_AQUA_WEAKEST:cc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE:uc,KUI_COLOR_BACKGROUND_DECORATIVE_PURPLE_WEAKEST:dc,KUI_COLOR_BACKGROUND_DISABLED:hc,KUI_COLOR_BACKGROUND_INFO:fc,KUI_COLOR_BACKGROUND_INFO_STRONG:mc,KUI_COLOR_BACKGROUND_INFO_STRONGER:pc,KUI_COLOR_BACKGROUND_INFO_STRONGEST:gc,KUI_COLOR_BACKGROUND_INFO_WEAK:_c,KUI_COLOR_BACKGROUND_INFO_WEAKER:yc,KUI_COLOR_BACKGROUND_INFO_WEAKEST:Rc,KUI_COLOR_BACKGROUND_INVERSE:Cc,KUI_COLOR_BACKGROUND_NEUTRAL:Ec,KUI_COLOR_BACKGROUND_NEUTRAL_STRONG:Oc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGER:bc,KUI_COLOR_BACKGROUND_NEUTRAL_STRONGEST:wc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAK:Tc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKER:vc,KUI_COLOR_BACKGROUND_NEUTRAL_WEAKEST:Sc,KUI_COLOR_BACKGROUND_OVERLAY:xc,KUI_COLOR_BACKGROUND_PRIMARY:Ic,KUI_COLOR_BACKGROUND_PRIMARY_STRONG:Dc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGER:kc,KUI_COLOR_BACKGROUND_PRIMARY_STRONGEST:Nc,KUI_COLOR_BACKGROUND_PRIMARY_WEAK:Ac,KUI_COLOR_BACKGROUND_PRIMARY_WEAKER:Lc,KUI_COLOR_BACKGROUND_PRIMARY_WEAKEST:Uc,KUI_COLOR_BACKGROUND_SUCCESS:Kc,KUI_COLOR_BACKGROUND_SUCCESS_STRONG:Mc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGER:Bc,KUI_COLOR_BACKGROUND_SUCCESS_STRONGEST:zc,KUI_COLOR_BACKGROUND_SUCCESS_WEAK:Pc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKER:qc,KUI_COLOR_BACKGROUND_SUCCESS_WEAKEST:Hc,KUI_COLOR_BACKGROUND_TRANSPARENT:Gc,KUI_COLOR_BACKGROUND_WARNING:Fc,KUI_COLOR_BACKGROUND_WARNING_STRONG:$c,KUI_COLOR_BACKGROUND_WARNING_STRONGER:Wc,KUI_COLOR_BACKGROUND_WARNING_STRONGEST:Vc,KUI_COLOR_BACKGROUND_WARNING_WEAK:Yc,KUI_COLOR_BACKGROUND_WARNING_WEAKER:Xc,KUI_COLOR_BACKGROUND_WARNING_WEAKEST:jc,KUI_COLOR_BORDER:Qc,KUI_COLOR_BORDER_ACCENT:Zc,KUI_COLOR_BORDER_DANGER:Jc,KUI_COLOR_BORDER_DANGER_STRONG:eu,KUI_COLOR_BORDER_DANGER_STRONGER:tu,KUI_COLOR_BORDER_DANGER_STRONGEST:iu,KUI_COLOR_BORDER_DANGER_WEAK:ru,KUI_COLOR_BORDER_DANGER_WEAKER:nu,KUI_COLOR_BORDER_DANGER_WEAKEST:su,KUI_COLOR_BORDER_DECORATIVE_PURPLE:ou,KUI_COLOR_BORDER_DISABLED:au,KUI_COLOR_BORDER_INVERSE:lu,KUI_COLOR_BORDER_NEUTRAL:cu,KUI_COLOR_BORDER_NEUTRAL_STRONG:uu,KUI_COLOR_BORDER_NEUTRAL_STRONGER:du,KUI_COLOR_BORDER_NEUTRAL_STRONGEST:hu,KUI_COLOR_BORDER_NEUTRAL_WEAK:fu,KUI_COLOR_BORDER_NEUTRAL_WEAKER:mu,KUI_COLOR_BORDER_NEUTRAL_WEAKEST:pu,KUI_COLOR_BORDER_PRIMARY:gu,KUI_COLOR_BORDER_PRIMARY_STRONG:_u,KUI_COLOR_BORDER_PRIMARY_STRONGER:yu,KUI_COLOR_BORDER_PRIMARY_STRONGEST:Ru,KUI_COLOR_BORDER_PRIMARY_WEAK:Cu,KUI_COLOR_BORDER_PRIMARY_WEAKER:Eu,KUI_COLOR_BORDER_PRIMARY_WEAKEST:Ou,KUI_COLOR_BORDER_TRANSPARENT:bu,KUI_COLOR_BRAND:wu,KUI_COLOR_TEXT:Tu,KUI_COLOR_TEXT_ACCENT:vu,KUI_COLOR_TEXT_DANGER:Su,KUI_COLOR_TEXT_DANGER_STRONG:xu,KUI_COLOR_TEXT_DANGER_STRONGER:Iu,KUI_COLOR_TEXT_DANGER_STRONGEST:Du,KUI_COLOR_TEXT_DANGER_WEAK:ku,KUI_COLOR_TEXT_DANGER_WEAKER:Nu,KUI_COLOR_TEXT_DANGER_WEAKEST:Au,KUI_COLOR_TEXT_DECORATIVE_AQUA:Lu,KUI_COLOR_TEXT_DECORATIVE_PINK:Uu,KUI_COLOR_TEXT_DECORATIVE_PURPLE:Ku,KUI_COLOR_TEXT_DECORATIVE_PURPLE_STRONG:Mu,KUI_COLOR_TEXT_DISABLED:Bu,KUI_COLOR_TEXT_INFO:zu,KUI_COLOR_TEXT_INFO_STRONG:Pu,KUI_COLOR_TEXT_INFO_STRONGER:qu,KUI_COLOR_TEXT_INFO_STRONGEST:Hu,KUI_COLOR_TEXT_INFO_WEAK:Gu,KUI_COLOR_TEXT_INFO_WEAKER:Fu,KUI_COLOR_TEXT_INFO_WEAKEST:$u,KUI_COLOR_TEXT_INVERSE:Wu,KUI_COLOR_TEXT_NEUTRAL:Vu,KUI_COLOR_TEXT_NEUTRAL_STRONG:Yu,KUI_COLOR_TEXT_NEUTRAL_STRONGER:Xu,KUI_COLOR_TEXT_NEUTRAL_STRONGEST:ju,KUI_COLOR_TEXT_NEUTRAL_WEAK:Qu,KUI_COLOR_TEXT_NEUTRAL_WEAKER:Zu,KUI_COLOR_TEXT_NEUTRAL_WEAKEST:Ju,KUI_COLOR_TEXT_PRIMARY:ed,KUI_COLOR_TEXT_PRIMARY_STRONG:td,KUI_COLOR_TEXT_PRIMARY_STRONGER:id,KUI_COLOR_TEXT_PRIMARY_STRONGEST:rd,KUI_COLOR_TEXT_PRIMARY_WEAK:nd,KUI_COLOR_TEXT_PRIMARY_WEAKER:sd,KUI_COLOR_TEXT_PRIMARY_WEAKEST:od,KUI_COLOR_TEXT_SUCCESS:ad,KUI_COLOR_TEXT_SUCCESS_STRONG:ld,KUI_COLOR_TEXT_SUCCESS_STRONGER:cd,KUI_COLOR_TEXT_SUCCESS_STRONGEST:ud,KUI_COLOR_TEXT_SUCCESS_WEAK:dd,KUI_COLOR_TEXT_SUCCESS_WEAKER:hd,KUI_COLOR_TEXT_SUCCESS_WEAKEST:fd,KUI_COLOR_TEXT_WARNING:md,KUI_COLOR_TEXT_WARNING_STRONG:pd,KUI_COLOR_TEXT_WARNING_STRONGER:gd,KUI_COLOR_TEXT_WARNING_STRONGEST:_d,KUI_COLOR_TEXT_WARNING_WEAK:yd,KUI_COLOR_TEXT_WARNING_WEAKER:Rd,KUI_COLOR_TEXT_WARNING_WEAKEST:Cd,KUI_FONT_FAMILY_CODE:zd,KUI_FONT_FAMILY_HEADING:Pd,KUI_FONT_FAMILY_TEXT:Wt,KUI_FONT_SIZE_10:qd,KUI_FONT_SIZE_100:jd,KUI_FONT_SIZE_20:Hd,KUI_FONT_SIZE_30:Gd,KUI_FONT_SIZE_40:Fd,KUI_FONT_SIZE_50:$d,KUI_FONT_SIZE_60:Wd,KUI_FONT_SIZE_70:Vd,KUI_FONT_SIZE_80:Yd,KUI_FONT_SIZE_90:Xd,KUI_FONT_WEIGHT_BOLD:Qd,KUI_FONT_WEIGHT_MEDIUM:Zd,KUI_FONT_WEIGHT_REGULAR:Jd,KUI_FONT_WEIGHT_SEMIBOLD:eh,KUI_ICON_COLOR_DANGER:th,KUI_ICON_COLOR_NEUTRAL:ih,KUI_ICON_COLOR_PRIMARY:rh,KUI_ICON_COLOR_SUCCESS:nh,KUI_ICON_COLOR_WARNING:sh,KUI_ICON_SIZE_10:oh,KUI_ICON_SIZE_20:ah,KUI_ICON_SIZE_30:lh,KUI_ICON_SIZE_40:ch,KUI_ICON_SIZE_50:uh,KUI_ICON_SIZE_60:dh,KUI_ICON_SIZE_70:hh,KUI_ICON_SIZE_80:fh,KUI_LETTER_SPACING_0:mh,KUI_LETTER_SPACING_MINUS_10:ph,KUI_LETTER_SPACING_MINUS_20:gh,KUI_LETTER_SPACING_MINUS_30:_h,KUI_LETTER_SPACING_MINUS_40:yh,KUI_LETTER_SPACING_MINUS_50:Rh,KUI_LETTER_SPACING_NORMAL:Ch,KUI_LINE_HEIGHT_10:Eh,KUI_LINE_HEIGHT_100:Dh,KUI_LINE_HEIGHT_20:Oh,KUI_LINE_HEIGHT_30:bh,KUI_LINE_HEIGHT_40:wh,KUI_LINE_HEIGHT_50:Th,KUI_LINE_HEIGHT_60:vh,KUI_LINE_HEIGHT_70:Sh,KUI_LINE_HEIGHT_80:xh,KUI_LINE_HEIGHT_90:Ih,KUI_METHOD_COLOR_BACKGROUND_CONNECT:kh,KUI_METHOD_COLOR_BACKGROUND_DELETE:Nh,KUI_METHOD_COLOR_BACKGROUND_GET:Ah,KUI_METHOD_COLOR_BACKGROUND_HEAD:Lh,KUI_METHOD_COLOR_BACKGROUND_OPTIONS:Uh,KUI_METHOD_COLOR_BACKGROUND_PATCH:Kh,KUI_METHOD_COLOR_BACKGROUND_POST:Mh,KUI_METHOD_COLOR_BACKGROUND_PUT:Bh,KUI_METHOD_COLOR_BACKGROUND_TRACE:zh,KUI_METHOD_COLOR_TEXT_CONNECT:Ph,KUI_METHOD_COLOR_TEXT_CONNECT_STRONG:qh,KUI_METHOD_COLOR_TEXT_DELETE:Hh,KUI_METHOD_COLOR_TEXT_DELETE_STRONG:Gh,KUI_METHOD_COLOR_TEXT_GET:Fh,KUI_METHOD_COLOR_TEXT_GET_STRONG:$h,KUI_METHOD_COLOR_TEXT_HEAD:Wh,KUI_METHOD_COLOR_TEXT_HEAD_STRONG:Vh,KUI_METHOD_COLOR_TEXT_OPTIONS:Yh,KUI_METHOD_COLOR_TEXT_OPTIONS_STRONG:Xh,KUI_METHOD_COLOR_TEXT_PATCH:jh,KUI_METHOD_COLOR_TEXT_PATCH_STRONG:Qh,KUI_METHOD_COLOR_TEXT_POST:Zh,KUI_METHOD_COLOR_TEXT_POST_STRONG:Jh,KUI_METHOD_COLOR_TEXT_PUT:ef,KUI_METHOD_COLOR_TEXT_PUT_STRONG:tf,KUI_METHOD_COLOR_TEXT_TRACE:rf,KUI_METHOD_COLOR_TEXT_TRACE_STRONG:nf,KUI_NAVIGATION_COLOR_BACKGROUND:sf,KUI_NAVIGATION_COLOR_BACKGROUND_SELECTED:of,KUI_NAVIGATION_COLOR_BORDER:af,KUI_NAVIGATION_COLOR_BORDER_CHILD:lf,KUI_NAVIGATION_COLOR_BORDER_DIVIDER:cf,KUI_NAVIGATION_COLOR_TEXT:uf,KUI_NAVIGATION_COLOR_TEXT_FOCUS:df,KUI_NAVIGATION_COLOR_TEXT_HOVER:hf,KUI_NAVIGATION_COLOR_TEXT_SELECTED:ff,KUI_NAVIGATION_SHADOW_BORDER:mf,KUI_NAVIGATION_SHADOW_BORDER_CHILD:pf,KUI_NAVIGATION_SHADOW_FOCUS:gf,KUI_SHADOW:_f,KUI_SHADOW_BORDER:yf,KUI_SHADOW_BORDER_DANGER:Rf,KUI_SHADOW_BORDER_DANGER_STRONG:Cf,KUI_SHADOW_BORDER_DISABLED:Ef,KUI_SHADOW_BORDER_PRIMARY:Of,KUI_SHADOW_BORDER_PRIMARY_STRONGEST:bf,KUI_SHADOW_BORDER_PRIMARY_WEAK:wf,KUI_SHADOW_FOCUS:Tf,KUI_SPACE_0:vf,KUI_SPACE_10:Sf,KUI_SPACE_100:Kf,KUI_SPACE_110:Mf,KUI_SPACE_120:Bf,KUI_SPACE_130:zf,KUI_SPACE_140:Pf,KUI_SPACE_150:qf,KUI_SPACE_20:xf,KUI_SPACE_30:If,KUI_SPACE_40:Df,KUI_SPACE_50:kf,KUI_SPACE_60:Nf,KUI_SPACE_70:Af,KUI_SPACE_80:Lf,KUI_SPACE_90:Uf,KUI_SPACE_AUTO:Hf,KUI_STATUS_COLOR_100:Gf,KUI_STATUS_COLOR_100S:ip,KUI_STATUS_COLOR_101:Ff,KUI_STATUS_COLOR_102:$f,KUI_STATUS_COLOR_103:Wf,KUI_STATUS_COLOR_1NA:Qm,KUI_STATUS_COLOR_200:Vf,KUI_STATUS_COLOR_200S:rp,KUI_STATUS_COLOR_201:Yf,KUI_STATUS_COLOR_202:Xf,KUI_STATUS_COLOR_203:jf,KUI_STATUS_COLOR_204:Qf,KUI_STATUS_COLOR_205:Zf,KUI_STATUS_COLOR_206:Jf,KUI_STATUS_COLOR_207:em,KUI_STATUS_COLOR_208:tm,KUI_STATUS_COLOR_226:im,KUI_STATUS_COLOR_2NA:Zm,KUI_STATUS_COLOR_300:rm,KUI_STATUS_COLOR_300S:np,KUI_STATUS_COLOR_301:nm,KUI_STATUS_COLOR_302:sm,KUI_STATUS_COLOR_303:om,KUI_STATUS_COLOR_304:am,KUI_STATUS_COLOR_305:lm,KUI_STATUS_COLOR_307:cm,KUI_STATUS_COLOR_308:um,KUI_STATUS_COLOR_3NA:Jm,KUI_STATUS_COLOR_400:dm,KUI_STATUS_COLOR_400S:sp,KUI_STATUS_COLOR_401:hm,KUI_STATUS_COLOR_402:fm,KUI_STATUS_COLOR_403:mm,KUI_STATUS_COLOR_404:pm,KUI_STATUS_COLOR_405:gm,KUI_STATUS_COLOR_406:_m,KUI_STATUS_COLOR_407:ym,KUI_STATUS_COLOR_408:Rm,KUI_STATUS_COLOR_409:Cm,KUI_STATUS_COLOR_410:Em,KUI_STATUS_COLOR_411:Om,KUI_STATUS_COLOR_412:bm,KUI_STATUS_COLOR_413:wm,KUI_STATUS_COLOR_414:Tm,KUI_STATUS_COLOR_415:vm,KUI_STATUS_COLOR_416:Sm,KUI_STATUS_COLOR_417:xm,KUI_STATUS_COLOR_418:Im,KUI_STATUS_COLOR_421:Dm,KUI_STATUS_COLOR_422:km,KUI_STATUS_COLOR_423:Nm,KUI_STATUS_COLOR_424:Am,KUI_STATUS_COLOR_425:Lm,KUI_STATUS_COLOR_426:Um,KUI_STATUS_COLOR_428:Km,KUI_STATUS_COLOR_429:Mm,KUI_STATUS_COLOR_431:Bm,KUI_STATUS_COLOR_451:zm,KUI_STATUS_COLOR_4NA:ep,KUI_STATUS_COLOR_500:Pm,KUI_STATUS_COLOR_500S:op,KUI_STATUS_COLOR_501:qm,KUI_STATUS_COLOR_502:Hm,KUI_STATUS_COLOR_503:Gm,KUI_STATUS_COLOR_504:Fm,KUI_STATUS_COLOR_505:$m,KUI_STATUS_COLOR_506:Wm,KUI_STATUS_COLOR_507:Vm,KUI_STATUS_COLOR_508:Ym,KUI_STATUS_COLOR_510:Xm,KUI_STATUS_COLOR_511:jm,KUI_STATUS_COLOR_5NA:tp,KUI_STATUS_COLOR_BACKGROUND_100:ap,KUI_STATUS_COLOR_BACKGROUND_200:lp,KUI_STATUS_COLOR_BACKGROUND_300:cp,KUI_STATUS_COLOR_BACKGROUND_400:up,KUI_STATUS_COLOR_BACKGROUND_500:dp,KUI_STATUS_COLOR_TEXT_100:hp,KUI_STATUS_COLOR_TEXT_200:fp,KUI_STATUS_COLOR_TEXT_300:mp,KUI_STATUS_COLOR_TEXT_400:pp,KUI_STATUS_COLOR_TEXT_500:gp},Symbol.toStringTag,{value:"Module"})),Er=Object.keys(Cr).filter(r=>r.startsWith("KUI_COLOR")),Or=r=>Cr[r],_p=r=>`--${r.toLowerCase().replaceAll("_","-")}`,br=()=>{if(typeof window>"u")return Object.fromEntries(Er.map(t=>[t,Or(t)]));const r=window.getComputedStyle(document.documentElement),e=(t,i)=>r.getPropertyValue(t).trim()||i;return Object.fromEntries(Er.map(t=>[t,e(_p(t),Or(t))]))},Vt=r=>{const e=n.ref(br());if(typeof window<"u"&&typeof MutationObserver<"u"){const t=new MutationObserver(()=>{e.value=br()});t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-kui-theme"]}),n.getCurrentScope()&&n.onScopeDispose(()=>t.disconnect())}return e},yp=()=>typeof window>"u"?Wt:window.getComputedStyle(document.documentElement).getPropertyValue("--kui-font-family-text").trim()||Wt,Rp=r=>{const e=yp(),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}}}},Cp=r=>n.computed(()=>Rp(r.value)),Ep={class:"kong-ui-public-echarts-tooltip"},Op={class:"tooltip-title"},bp={class:"title"},wp={key:0,class:"subtitle"},Tp={class:"context"},vp={class:"metric"},Sp={class:"tooltip-rows"},xp={class:"display-value"},Ip=n.defineComponent({__name:"ChartTooltip",props:{title:{},context:{},metric:{},rows:{}},setup(r){return(e,t)=>(n.openBlock(),n.createElementBlock("div",Ep,[n.createElementVNode("div",Op,[n.createElementVNode("div",bp,n.toDisplayString(r.title),1),r.context||r.metric?(n.openBlock(),n.createElementBlock("div",wp,[n.createElementVNode("div",Tp,n.toDisplayString(r.context),1),n.createElementVNode("div",vp,n.toDisplayString(r.metric),1)])):n.createCommentVNode("",!0)]),n.createElementVNode("ul",Sp,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.rows,(i,s)=>(n.openBlock(),n.createElementBlock("li",{key:`${i.label}-${s}`,class:n.normalizeClass({"extra-row":i.isExtra})},[n.createElementVNode("span",{class:"square-marker",style:n.normalizeStyle(i.isExtra?void 0:{background:i.color})},null,4),n.createElementVNode("span",{class:n.normalizeClass(["display-label",{empty:i.isSegmentEmpty}])},n.toDisplayString(i.label),3),n.createElementVNode("span",xp,n.toDisplayString(i.value),1)],2))),128))])]))}}),wr=(r,e)=>{const t=r.__vccOpts||r;for(const[i,s]of e)t[i]=s;return t},Dp=wr(Ip,[["__scopeId","data-v-ca633353"]]),Yt=r=>Array.isArray(r)?r:[r],Tr=(r,e)=>typeof r=="number"?e?.[r]??String(r):r,Xt=(r,e,t,i)=>({color:typeof r.color=="string"?r.color:void 0,label:e,value:i?i(Number(t)):String(t??"")}),kp=r=>Array.isArray(r)?r[r.length-1]:r,Np=r=>{const e=Yt(r),t=e[0];return{context:String(t?.axisValueLabel??t?.name??""),rows:e.map(i=>Xt(i,i.seriesName??"",kp(i.value)))}},Ap=r=>{let e;return n.getCurrentScope()&&n.onScopeDispose(()=>{e&&n.render(null,e)}),t=>{const i=(r()??Np)(t);return i?(e??=document.createElement("div"),n.render(n.h(Dp,i),e),e):""}},Lp={class:"kong-ui-public-echarts"},Up=n.defineComponent({name:"KongECharts",inheritAttrs:!1,__name:"ECharts",props:{option:{},height:{default:"400px"},tooltipContent:{type:Function}},setup(r){n.useCssVars(o=>({v1cecfeed:o.height})),bt.use([Gr.CanvasRenderer,lt.GridComponent,lt.TooltipComponent]);const e=Vt(),t=Cp(e),i=Ap(()=>r.tooltipContent),s=n.computed(()=>({...r.option,tooltip:{...r.option?.tooltip,formatter:i}}));return(o,a)=>(n.openBlock(),n.createElementBlock("div",Lp,[n.createVNode(n.unref(Hr),n.mergeProps({autoresize:!0,class:"chart",option:s.value,theme:n.unref(t)},o.$attrs),null,16,["option","theme"])]))}}),vr=wr(Up,[["__scopeId","data-v-68114d20"]]),Sr=r=>typeof r=="object"&&r!==null&&!Array.isArray(r),nt=(r,...e)=>{const t={...r};for(const i of e)if(i)for(const[s,o]of Object.entries(i)){if(o===void 0)continue;const a=t[s];t[s]=Sr(a)&&Sr(o)?nt(a,o):o}return t},Kp=n.defineComponent({__name:"HeatmapChart",props:{data:{},xAxisLabels:{},yAxisLabels:{},seriesName:{},min:{},max:{},colorRange:{},valueFormatter:{type:Function},visibleRows:{},showValues:{type:Boolean},seriesOption:{},option:{},height:{},tooltipTitle:{}},setup(r){bt.use([ii.HeatmapChart,lt.VisualMapComponent,lt.DataZoomSliderComponent]);const e=Vt(),t=a=>{const[l]=Yt(a),[u,c,d]=l.value;return{title:r.tooltipTitle,context:Tr(u,r.xAxisLabels),metric:r.seriesName,rows:[Xt(l,Tr(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}),s=n.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:[nt({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=n.computed(()=>nt(s.value,r.option));return(a,l)=>(n.openBlock(),n.createBlock(vr,{height:r.height,option:o.value,"tooltip-content":t},null,8,["height","option"]))}}),Mp=n.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){bt.use([ii.TreemapChart]);const e=Vt(),t=l=>{const[u]=Yt(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:[Xt(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],s=(l=[])=>l.reduce((u,c)=>Math.max(u,1+s(c.children)),0),o=n.computed(()=>({series:[nt({name:r.seriesName,type:"treemap",data:r.data??[],nodeClick:r.drillDown?"zoomToNode":!1,leafDepth:r.leafDepth??s(r.data),roam:!1,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=n.computed(()=>nt(o.value,r.option));return(l,u)=>(n.openBlock(),n.createBlock(vr,{height:r.height,option:a.value,"tooltip-content":t},null,8,["height","option"]))}}),xr=r=>{if(r==null||typeof r=="string"&&r.trim()==="")return;const e=Number(r);return Number.isFinite(e)?e:void 0},Ir="MMM dd",Bp=(r,e)=>{const t=[],i=new Date(e);for(const s=new Date(r);s<i;s.setDate(s.getDate()+1))t.push(Tt(s,Ir));return t},zp=(r,e)=>{const t=r.indexOf(e);return t===-1?r.push(e)-1:t},Pp=(r,e)=>r[e]?.name??e,qp=r=>{if(!r?.meta||!r.data)return;const{display:e,metric_names:t,start:i,end:s}=r.meta,o=t?.[0],a=e&&Object.keys(e).find(d=>d!=="time");if(!o||!a||!i||!s){console.error("Cannot build heatmap chart data from this explore result. Missing metric, dimension or time range.");return}const l=Bp(i,s),u=[],c=[];for(const{timestamp:d,event:h}of r.data){const f=l.indexOf(Tt(new Date(d),Ir)),m=xr(h[o]);f===-1||m===void 0||c.push([f,zp(u,String(h[a])),m])}return{data:c,xAxisLabels:l,yAxisLabels:u.map(d=>Pp(e[a],d))}},Hp={class:"wrapper","data-testid":"heatmap-chart"},Gp=10,Fp=Ce(n.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=e,{i18n:i}=ce.useI18n(),s=ce.useMetricFormatter(),o=u=>{const c=qp(u);if(c?.data.length)return{data:c.data,xAxisLabels:c.xAxisLabels,yAxisLabels:c.yAxisLabels,...s(u)}},a=new WeakMap,l=u=>(a.has(u)||a.set(u,o(u)),a.get(u));return(u,c)=>{const d=n.resolveComponent("KEmptyState");return n.openBlock(),n.createBlock(Ke,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:c[0]||(c[0]=h=>t("chart-data",h)),onQueryComplete:c[1]||(c[1]=h=>t("query-complete"))},{default:n.withCtx(({data:h})=>[n.createElementVNode("div",Hp,[l(h)?(n.openBlock(),n.createBlock(n.unref(Kp),n.mergeProps({key:0,height:"100%","tooltip-title":r.chartOptions.chart_title??void 0,"visible-rows":Gp},l(h)),null,16,["tooltip-title"])):(n.openBlock(),n.createBlock(d,{key:1,"action-button-visible":!1,"data-testid":"no-data-in-report"},{title:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(i).t("renderer.noDataAvailable.title")),1)]),default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(i).t("renderer.noDataAvailable.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-937dae87"]]),Dr=(r,e,{otherLabel:t})=>({name:e===xe.OTHER_DIMENSION_ID&&t||(r?.[e]?.name??e)}),$p=(r,e,t,i)=>({...Dr(e,t,i),itemStyle:{color:Cs({dimension:r,dimensionValue:t})}}),kr=(r,e,t)=>{const i=r.get(e)??t();return r.set(e,i),i},Wp=/_(average|p\d+|rate|max|per_minute)$/,Nr=(r,e)=>!e.includes("time")&&!(r&&Wp.test(r)),Ar=(r,e)=>{r.value=Number(r.value??0)+e},Vp=(r,e,t,[i,s],o)=>{const a=new Map,l=(u,c)=>String(u[c]);for(const{event:u}of r){const c=xr(u[e]);if(c===void 0)continue;const d=l(u,i),h=kr(a,d,()=>({node:$p(i,t[i],d,o),children:new Map}));if(!s){Ar(h.node,c);continue}const f=l(u,s),m=kr(h.children,f,()=>Dr(t[s],f,o));Ar(m,c)}return a},Yp=(r,e={})=>{if(!r?.meta||!r.data)return;const{display:t,metric_names:i}=r.meta,s=i?.[0],o=t?Object.keys(t):[];if(!s||!o.length){console.error("Cannot build treemap chart data from this explore result. Missing metric or dimension.");return}if(!Nr(s,o)){console.error("Cannot build treemap chart data from this explore result. Needs an additive metric and no time dimension.");return}return[...Vp(r.data,s,t,o,e).values()].map(({node:l,children:u})=>u.size?{...l,children:[...u.values()]}:l)},Xp={class:"wrapper","data-testid":"treemap-chart"},jp=Ce(n.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:s}=ce.useI18n(),o=ce.useMetricFormatter(),a=n.computed(()=>Nr(t.query.metrics?.[0],t.query.dimensions??[])),l=d=>{const h=Yp(d,{otherLabel:s.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=n.resolveComponent("KEmptyState");return n.openBlock(),n.createBlock(Ke,{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:n.withCtx(({data:m})=>[n.createElementVNode("div",Xp,[a.value?c(m)?(n.openBlock(),n.createBlock(n.unref(Mp),n.mergeProps({key:1,height:"100%","tooltip-title":r.chartOptions.chart_title??void 0},c(m)),null,16,["tooltip-title"])):(n.openBlock(),n.createBlock(f,{key:2,"action-button-visible":!1,"data-testid":"no-data-in-report"},{title:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.noDataAvailable.title")),1)]),default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.noDataAvailable.description")),1)]),_:1})):(n.openBlock(),n.createBlock(f,{key:0,"action-button-visible":!1,"data-testid":"treemap-unsupported"},{title:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.treemapUnsupported.title")),1)]),default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.treemapUnsupported.description")),1)]),_:1}))])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-d818a9ae"]]),Qp=["data-testid"],Zp={key:0,class:"tile-header"},Jp={class:"badge-container"},eg={class:"badge-text"},tg={class:"badge-text"},ig={key:0,class:"metric-selector-wrapper"},rg={key:1},ng=["data-testid"],sg=["data-testid"],og=["data-testid"],ag={class:"delete-option"},lg=["data-testid"],Lr=Ce(n.defineComponent({__name:"DashboardTile",props:n.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:n.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}){n.useCssVars(L=>({v692e8c06:`${L.height}px`}));const i=parseInt(Bi,10),{zoomConfiguration:s}=ce.useDashboardContext({context:n.computed(()=>r.context),preview:n.computed(()=>r.preview)}),o=n.useModel(r,"refreshCounter"),a=()=>{E.value=!0,o.value++},l=t,u=n.defineAsyncComponent(()=>Promise.resolve().then(()=>vg)),c=n.inject(Te),d=Ne.useDatasourceConfigStore(),{datasourceConfigMap:h,stripUnknownFilters:f}=Xe(d),{i18n:m}=ce.useI18n(),_=n.ref(),O=n.ref({status:"loading"}),C=n.ref(!1),S=n.ref(),k=n.ref(!1),E=n.ref(!0),b=n.computed(()=>r.definition.chart),T=n.computed(()=>"chart_title"in b.value?b.value.chart_title:void 0),U=n.computed(()=>r.definition.header_description),z=n.computed(()=>b.value.type==="slottable"),p=n.computed(()=>Ie(r.definition)||Mt(r.definition)?!1:!("allow_csv_export"in b.value)||b.value.allow_csv_export!==!1),{exploreLinkKebabMenu:g,requestsLinkKebabMenu:y,canShowKebabMenu:v,canGenerateRequestsLink:x,canGenerateExploreLink:N,requestsLinkZoomActions:K,exploreLinkZoomActions:q,buildExploreQuery:V,buildExploreLink:P,buildRequestLink:F,buildRequestsQueryZoomActions:M}=ce.useContextLinks({queryBridge:c,chartData:n.readonly(_),definition:n.toRef(()=>r.definition),context:n.readonly(n.toRef(()=>r.context))}),{issueQuery:A}=ce.useIssueQuery();n.watch(()=>r.definition,async(L,J)=>{await n.nextTick(),S.value&&(k.value=S.value.scrollWidth>S.value.clientWidth);try{JSON.stringify(L?.query)!==JSON.stringify(J?.query)&&(E.value=!0)}catch{}},{immediate:!0,deep:!0});const w=n.computed(()=>m.t("csvExport.defaultFilename")),D=n.computed(()=>!!g.value||p.value||!!r.context.editable),I=n.computed(()=>!r.hideActions&&v.value&&D.value),Q=n.computed(()=>I.value&&D.value&&!r.isFullscreen),re={heatmap:Fp,treemap:jp,timeseries_line:cr,timeseries_bar:cr,scatter:rl,horizontal_bar:lr,vertical_bar:lr,gauge:ar,donut:Jl,golden_signals:nl,top_n:Vl,top_talkers:Yl,table:Zl,slottable:void 0,single_value:ar,choropleth_map:u},te=n.computed(()=>({...he.value?.rendererEvents.supportsRequests?{"select-chart-range":He}:{},...he.value?.rendererEvents.supportsZoom?{"zoom-time-range":Be}:{},...he.value?.rendererEvents.supportsBounds?{"bounds-change":be}:{},...he.value?.rendererEvents.supportsLoadingChange?{"loading-change":pe}:{}})),he=n.computed(()=>{const L=re[r.definition.chart.type],J=Ie(r.definition),me=!!L?.emits?.includes("select-chart-range"),Ge=!!L?.emits?.includes("zoom-time-range"),ze=r.definition.chart.type==="choropleth_map",Fe=!!L?.emits?.includes("loading-change"),Zt={query:r.definition.query,context:r.context,queryReady:r.queryReady,height:r.height-i*2,refreshCounter:o.value,zoomConfiguration:s.value},Jt={chartOptions:r.definition.chart,activeMetric:Z.value,headerDescription:U.value,requestsLink:s.value.showRequestsAction?K.value:void 0,exploreLink:s.value.showExploreAction?q.value:void 0};return L&&{component:L,rendererProps:{...Zt,...J?{}:Jt,...r.definition.chart.type==="top_n"?{fitToContent:r.fitToContent}:{}},rendererEvents:{supportsRequests:me,supportsZoom:Ge,supportsBounds:ze,supportsLoadingChange:Fe}}}),Y=n.computed(()=>{if(Ie(r.definition))return null;const L=r.definition.query,J=L?.time_range;if(ee.isPlatformDatasource(L?.datasource)&&!L.dimensions?.includes("time"))return m.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}),X=n.computed(()=>{const L=r.definition.query,J=L?.datasource,me=J?h.value[J]?.timeRangeOptions:void 0,ze=(L&&"time_range"in L?L.time_range:void 0)??r.context.timeSpec;return Pt(ze,me)}),ae=n.computed(()=>z.value?!1:[!!T.value,Q.value,!!Y.value,X.value,!!U.value,r.showRefresh,j.value].some(Boolean)),G=n.computed(()=>_.value?ee.msToGranularity(_.value.meta.granularity_ms):void 0),le=n.computed(()=>["timeseries_line","timeseries_bar"].includes(b.value.type)),ue=n.computed(()=>_.value?.meta.metric_names??[]),Z=n.ref();n.watch(ue,L=>{(!Z.value||!L.includes(Z.value))&&(Z.value=L[0])},{immediate:!0});const se=n.computed(()=>{const L=b.value;return L.type!=="timeseries_line"?!1:ue.value.some(J=>L.metric_axis_map?.[J]==="right")}),j=n.computed(()=>le.value&&!se.value&&(_.value?.data.length??0)>0&&ue.value.length>1&&Object.keys(_.value?.meta.display??{}).length>0),Re=L=>Object.hasOwn(qi.chartLabels,L),$=n.computed(()=>ue.value.map(L=>({value:L,label:Re(L)?m.t(`chartLabels.${L}`):L}))),oe=n.computed(()=>{if(!Bt(r.definition)||!le.value||!r.queryReady||E.value)return!1;const L=r.definition.query.granularity;return!L||!G.value?!1:L!==G.value}),Ae=n.computed(()=>{const L=ee.msToGranularity(_.value?.meta.granularity_ms??0)??"unknown",J=Bt(r.definition)?r.definition.query.granularity??"unknown":"unknown";return m.t("query_aged_out_warning",{currentGranularity:m.t(`granularities.${L}`),savedGranularity:m.t(`granularities.${J}`)})}),Me=n.computed(()=>{const L=[...r.context.filters,...r.definition.query.filters??[]],J="metrics"in r.definition.query?r.definition.query.metrics:void 0,me=r.definition.query.datasource??"api_usage";return f.value({datasource:me,filters:L,queryFields:J})}),Ee=()=>{l("edit-tile",r.definition)},qe=()=>{l("duplicate-tile",r.definition)},fe=()=>{l("remove-tile",r.definition)},Oe=L=>{_.value=L,E.value=!1,l("chart-data",L),l("tile-loaded")},de=()=>{E.value=!1,l("tile-loaded")},pe=L=>{E.value=L,L||l("tile-loaded")},Se=()=>{C.value=!1},je=()=>{if(Mt(r.definition))throw new Error("Cannot export data for a tile backed by the api-requests endpoint");const L=r.definition.query.datasource?.startsWith("goap");return c?.staticConfig?.increaseCsvExportLimit!==!1&&!L?A(r.definition.query,r.context,ee.EXPORT_RECORD_LIMIT):_.value?Promise.resolve(_.value):new Promise(me=>{const Ge=n.watch(_,ze=>{ze&&(me(ze),Ge())})})},Ot=async()=>{C.value=!0,O.value={status:"loading"};try{const L=await je();O.value={status:"success",chartData:L}}catch(L){O.value={status:"error",error:L}}},Be=L=>{const J={tileId:r.tileId.toString(),timeRange:L};l("tile-time-range-zoom",J)},be=L=>{const J={tileId:r.tileId.toString(),bounds:L};l("tile-bounds-change",J)},He=L=>{const J=Me.value,me=V(L,J);q.value=N.value?{href:P(me)}:void 0,K.value=x.value?{href:F(M(L,J))}:void 0};return e({getExportData:je}),(L,J)=>{const me=n.resolveComponent("KTooltip"),Ge=n.resolveComponent("KBadge"),ze=n.resolveComponent("KButton"),Fe=n.resolveComponent("KDropdownItem"),Zt=n.resolveComponent("KDropdown");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["tile-boundary",{editable:r.context.editable,headless:!ae.value}]),"data-testid":`tile-${r.tileId}`},[ae.value&&!z.value?(n.openBlock(),n.createElementBlock("div",Zp,[n.createVNode(me,{class:"title-tooltip",disabled:!k.value,"max-width":"500",text:T.value},{default:n.withCtx(()=>[n.createElementVNode("div",{ref_key:"titleRef",ref:S,class:"title"},n.toDisplayString(T.value),513)]),_:1},8,["disabled","text"]),n.createElementVNode("div",Jp,[X.value?(n.openBlock(),n.createBlock(Ge,{key:0,appearance:"warning","data-testid":"unsupported-time-range-badge",tooltip:n.unref(m).t("unsupported_time_range_warning"),"tooltip-attributes":{maxWidth:"320px"}},{icon:n.withCtx(()=>[n.createVNode(n.unref(ie.WarningIcon),{size:`var(--kui-icon-size-20, ${n.unref(Ui)})`},null,8,["size"])]),default:n.withCtx(()=>[n.createElementVNode("span",eg,n.toDisplayString(n.unref(m).t("unsupported_time_range_badge")),1)]),_:1},8,["tooltip"])):n.createCommentVNode("",!0),Y.value?(n.openBlock(),n.createBlock(Ge,{key:1,"data-testid":"time-range-badge",tooltip:oe.value?Ae.value:void 0,"tooltip-attributes":{maxWidth:"320px"}},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("span",tg,n.toDisplayString(Y.value),1)]),_:2},[oe.value?{name:"icon",fn:n.withCtx(()=>[n.createVNode(n.unref(ie.WarningIcon),{size:`var(--kui-icon-size-20, ${n.unref(Ui)})`},null,8,["size"])]),key:"0"}:void 0]),1032,["tooltip"])):n.createCommentVNode("",!0)]),j.value?(n.openBlock(),n.createElementBlock("div",ig,[n.createVNode(n.unref(qr.KSegmentedControl),{modelValue:Z.value,"onUpdate:modelValue":J[0]||(J[0]=Jt=>Z.value=Jt),class:"metric-selector","data-testid":"metric-selector",options:$.value},null,8,["modelValue","options"])])):n.createCommentVNode("",!0),r.showRefresh?(n.openBlock(),n.createElementBlock("div",rg,[n.createVNode(ze,{appearance:"secondary",class:"refresh-button","data-testid":`tile-refresh-button-${r.tileId}`,disabled:E.value,icon:"",size:"small",onClick:a},{default:n.withCtx(()=>[E.value?(n.openBlock(),n.createBlock(n.unref(ie.ProgressIcon),{key:0,role:"button",size:`var(--kui-icon-size-60, ${n.unref(Mi)})`,tabindex:"0"},null,8,["size"])):(n.openBlock(),n.createBlock(n.unref(ie.RefreshIcon),{key:1,role:"button",size:`var(--kui-icon-size-60, ${n.unref(Mi)})`,tabindex:"0"},null,8,["size"]))]),_:1},8,["data-testid","disabled"])])):n.createCommentVNode("",!0),U.value?(n.openBlock(),n.createElementBlock("div",{key:2,class:"header-description","data-testid":`tile-description-${r.tileId}`},n.toDisplayString(U.value),9,ng)):n.createCommentVNode("",!0),I.value?(n.openBlock(),n.createElementBlock("div",{key:3,class:"tile-actions","data-testid":`tile-actions-${r.tileId}`},[I.value&&r.context.editable&&!r.isFullscreen?(n.openBlock(),n.createBlock(n.unref(ie.EditIcon),{key:0,class:"edit-icon",color:`var(--kui-color-text-neutral, ${n.unref(Nt)})`,"data-testid":`edit-tile-${r.tileId}`,size:`var(--kui-icon-size-40, ${n.unref(Ki)})`,onClick:Ee},null,8,["color","data-testid","size"])):n.createCommentVNode("",!0),I.value&&D.value&&!r.isFullscreen?(n.openBlock(),n.createBlock(Zt,{key:1,class:"dropdown","data-testid":`chart-action-menu-${r.tileId}`,"kpop-attributes":{placement:"bottom-end"}},{items:n.withCtx(()=>[n.unref(g)?(n.openBlock(),n.createBlock(Fe,{key:0,"data-testid":`chart-jump-to-explore-${r.tileId}`,item:{label:n.unref(m).t("jumpToExplore"),to:n.unref(g)}},null,8,["data-testid","item"])):n.createCommentVNode("",!0),!n.unref(Ie)(r.definition)&&n.unref(y)?(n.openBlock(),n.createBlock(Fe,{key:1,"data-testid":`chart-jump-to-requests-${r.tileId}`,item:{label:n.unref(m).t("jumpToRequests"),to:n.unref(y)}},null,8,["data-testid","item"])):n.createCommentVNode("",!0),p.value?(n.openBlock(),n.createBlock(Fe,{key:2,class:"chart-export-button","data-testid":`chart-csv-export-${r.tileId}`,onClick:Ot},{default:n.withCtx(()=>[n.createElementVNode("span",{class:"chart-export-trigger","data-testid":`csv-export-button-${r.tileId}`},n.toDisplayString(n.unref(m).t("csvExport.exportAsCsv")),9,og)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0),r.context.editable?(n.openBlock(),n.createBlock(Fe,{key:3,"data-testid":`duplicate-tile-${r.tileId}`,onClick:qe},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(m).t("renderer.duplicateTile")),1)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0),r.context.editable?(n.openBlock(),n.createBlock(Fe,{key:4,"data-testid":`remove-tile-${r.tileId}`,onClick:fe},{default:n.withCtx(()=>[n.createElementVNode("span",ag,n.toDisplayString(n.unref(m).t("renderer.delete")),1)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0)]),default:n.withCtx(()=>[n.createVNode(n.unref(ie.MoreIcon),{class:"kebab-action-menu",color:`var(--kui-color-text-neutral, ${n.unref(Nt)})`,"data-testid":`kebab-action-menu-${r.tileId}`,size:`var(--kui-icon-size-40, ${n.unref(Ki)})`},null,8,["color","data-testid","size"])]),_:1},8,["data-testid"])):n.createCommentVNode("",!0)],8,sg)):n.createCommentVNode("",!0),C.value?(n.openBlock(),n.createBlock(nr,{key:4,"data-testid":`csv-export-modal-${r.tileId}`,"export-state":O.value,filename:w.value,onCloseModal:Se},null,8,["data-testid","export-state","filename"])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(["tile-content",`type-${r.tileType}-${b.value.type}`]),"data-testid":`tile-content-${r.tileId}`},[he.value?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(he.value.component),n.mergeProps({key:0},he.value.rendererProps,n.toHandlers(te.value),{onChartData:Oe,onQueryComplete:de}),null,16)):n.createCommentVNode("",!0)],10,lg)],10,Qp)}}}),[["__scopeId","data-v-a062c19f"]]),cg=(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 s=[];for(let o=0;o<t;o++)i.get(o)?s.push("auto"):s.push(`${r}px`);return s},Ur=Ce(n.defineComponent({__name:"GridLayout",props:{tileHeight:{type:Number,required:!1,default:()=>Ye},columns:{type:Number,required:!1,default:()=>mt},tiles:{type:Array,required:!0}},setup(r){n.useCssVars(u=>({v6834ae83:e.columns,v9c95201e:a.value}));const e=r,t=n.ref(null),i=n.ref(0),s=new ResizeObserver(u=>{window.requestAnimationFrame(()=>{!Array.isArray(u)||!u.length||(i.value=u[0].contentRect.width)})});n.onMounted(()=>{t.value&&s.observe(t.value)}),n.onUnmounted(()=>{t.value&&s.unobserve(t.value)});const o=n.computed(()=>cg(e.tileHeight,e.tiles)),a=n.computed(()=>o.value.join(" ")),l=n.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)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"gridContainer",ref:t,class:"kong-ui-public-grid-layout"},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,d=>(n.openBlock(),n.createElementBlock("div",{key:d.key,class:n.normalizeClass(["grid-cell",{"empty-cell":!d.tile}]),style:n.normalizeStyle(d.style)},[n.renderSlot(u.$slots,"tile",{fitToContent:o.value[d.tile.layout.position.row]==="auto",style:n.normalizeStyle(d.style),tile:d.tile},void 0,!0)],6))),128))],512))}}),[["__scopeId","data-v-aa4f1c68"]]);function ug(r,e,t,i,s){const o=(...a)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+s+" 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 R{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 s=t.querySelectorAll(e);return!s.length&&e[0]!=="."&&e[0]!=="#"&&(s=t.querySelectorAll("."+e),s.length||(s=t.querySelectorAll("#"+e))),Array.from(s)}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 s=t.querySelector(e);return i&&!s&&(s=i.getElementById(e)),s||(s=t.querySelector("."+e)),s}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(s=>{s&&i.classList.add(s)}),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 R.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,s=e.x+e.w<t.x+t.w?e.x+e.w:t.x+t.w;if(s<=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:(s-i)*(a-o)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((s,o)=>{const a=t*((s.y??1e4)-(o.y??1e4));return a===0?t*((s.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 s=document.createElement("style"),o=i?.nonce;return o&&(s.nonce=o),s.setAttribute("type","text/css"),s.setAttribute("gs-style-id",e),s.styleSheet?s.styleSheet.cssText="":s.appendChild(document.createTextNode("")),t?t.insertBefore(s,t.firstChild):(t=document.getElementsByTagName("head")[0],t.appendChild(s)),s}static removeStylesheet(e,t){const s=(t||document).querySelector("STYLE[gs-style-id="+e+"]");s&&s.parentNode&&s.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 s=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!s)throw new Error(`Invalid height val = ${e}`);i=s[2]||"px",t=parseFloat(s[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(const s in i){if(!i.hasOwnProperty(s))return;e[s]===null||e[s]===void 0?e[s]=i[s]:typeof i[s]=="object"&&typeof e[s]=="object"&&this.defaults(e[s],i[s])}}),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 s=e[i],o=t[i];i[0]==="_"||s===o?delete e[i]:s&&typeof s=="object"&&o!==void 0&&(R.removeInternalAndSame(s,o),Object.keys(s).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(...s)=>{i||(i=!0,setTimeout(()=>{e(...s),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 s=e.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight;if(s.top<0||s.bottom>o){const a=s.bottom-o,l=s.top,u=this.getScrollElement(e);if(u!==null){const c=u.scrollTop;s.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 s=this.getScrollElement(t),o=s.clientHeight,a=s===this.getScrollElement()?0:s.getBoundingClientRect().top,l=e.clientY-a,u=l<i,c=l>o-i;u?s.scrollBy({behavior:"smooth",top:l-i}):c&&s.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=R.clone(e);for(const s in i)i.hasOwnProperty(s)&&typeof i[s]=="object"&&s.substring(0,2)!=="__"&&!t.find(o=>o===s)&&(i[s]=R.cloneDeep(e[s]));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=R.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(s=>{e.style[i]=s}):e.style[i]=t[i])}static initEvent(e,t){const i={type:t.type},s={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,...s}}static simulateMouseEvent(e,t,i){const s=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:s.ctrlKey??!1,altKey:s.altKey??!1,shiftKey:s.shiftKey??!1,metaKey:s.metaKey??!1,button:0,relatedTarget:e.target});(i||e.target).dispatchEvent(o)}static getValuesFromTransformedElement(e){const t=document.createElement("div");R.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 s=e[t];e[t]=e[i],e[i]=s}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 De{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,s={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!s.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,s.skip));let a=!1;const l={nested:!0,pack:!1};let u=0;for(;i=i||this.collide(e,o,s.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&&R.samePos(e,d)?!0:this.moveNode(e,d),(i.locked||this._loading)&&c?R.copyPos(t,e):!i.locked&&c&&s.pack&&(this._packNodes(),t.y=i.y+i.h,R.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 s=e._id,o=i?._id;return this.nodes.find(a=>a._id!==s&&a._id!==o&&R.isIntercepted(a,t))}collideAll(e,t=e,i){const s=e._id,o=i?._id;return this.nodes.filter(a=>a._id!==s&&a._id!==o&&R.isIntercepted(a,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const s=e._rect,o={...t.rect};o.y>s.y?(o.h+=o.y-s.y,o.y=s.y):o.h+=s.y-o.y,o.x>s.x?(o.w+=o.x-s.x,o.x=s.x):o.w+=s.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;s.y<c.y?d=(o.y+o.h-c.y)/c.h:s.y+s.h>c.y+c.h&&(d=(c.y+c.h-o.y)/c.h),s.x<c.x?h=(o.x+o.w-c.x)/c.w:s.x+s.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,s,o,a){return this.nodes.forEach(l=>l._rect={y:l.y*t+i,x:l.x*e+a,w:l.w*e-a-s,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 s;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(s=R.isTouching(e,t)))return i();if(s!==!1){if(e.w===t.w&&e.x===t.x&&(s||(s=R.isTouching(e,t)))){if(t.y<e.y){const o=e;e=t,t=o}return i()}if(s!==!1){if(e.h===t.h&&e.y===t.y&&(s||(s=R.isTouching(e,t)))){if(t.x<e.x){const o=e;e=t,t=o}return i()}return!1}}}isAreaEmpty(e,t,i,s){const o={x:e||0,y:t||0,w:i||1,h:s||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 s=this._inColumnResize;s||(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)}),s||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=R.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??De._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 s={x:0,y:0,w:1,h:1};return R.defaults(e,s),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,R.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=s.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=s.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=s.w),isNaN(e.h)&&(e.h=s.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){const i=e._orig||R.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),R.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!R.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=R.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||R.samePos(e,e._orig)||(R.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,s){const o=s?s.y*i+(s.x+s.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=>R.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 s=this.nodes.find(a=>a._id===e._id);if(s)return s;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(s=>s._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(s=>s._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(s=>s._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 s=new De({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=s.moveNode(i,t)&&s.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?(s.nodes.filter(a=>a._dirty).forEach(a=>{const l=this.nodes.find(u=>u._id===a._id);l&&(R.copyPos(l,a),l._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new De({column:this.column,float:this.float,nodes:this.nodes.map(s=>({...s}))}),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=R.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 s=e.w!==t.w||e.h!==t.h,o=R.copyPos({},e,!0);if(R.copyPos(o,t),this.nodeBoundFix(o,s),R.copyPos(t,o),!t.forceCollide&&R.samePos(e,t))return!1;const a=R.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=R.areaIntercept(t.rect,d._rect),f=R.area(t.rect),m=R.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&&!R.samePos(e,o)&&(e._dirty=!0,R.copyPos(e,o)),t.pack&&this._packNodes()._notify(),!R.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,s=i&&this.column!==i-1?this._layouts[i-1]:null,o=[];return this.sortNodes(),this.nodes.forEach(a=>{const l=s?.find(c=>c._id===a._id),u={...a,...l||{}};R.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 s=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*s)),o.w!==o._orig.w&&(a.w=Math.round(o.w*s)))})}}),this)}columnChanged(e,t,i="moveScale"){if(!this.nodes.length||!t||e===t)return this;const s=i==="compact"||i==="list";s&&this.sortNodes(1),t<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let o=[],a=s?this.nodes:R.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&&(!s&&!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(s){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(s)this.compact(i,!1);else{if(a.length)if(typeof i=="function")i(t,e,o,a);else{const l=s||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=R.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,!s),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const s=[];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??De._idSeq++}s[a]={x:o.x,y:o.y,w:o.w,_id:o._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=s,this}cacheOneLayout(e,t){e._id=e._id??De._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 s=this.findCacheLayout(e,t);return s===-1?this._layouts[t].push(i):this._layouts[t][s]=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}}De._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 H{}const ve=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 ke{}function gt(r,e){r.touches.length>1||(r.cancelable&&r.preventDefault(),R.simulateMouseEvent(r.changedTouches[0],e))}function Kr(r,e){r.cancelable&&r.preventDefault(),R.simulateMouseEvent(r,e)}function _t(r){ke.touchHandled||(ke.touchHandled=!0,gt(r,"mousedown"))}function yt(r){ke.touchHandled&>(r,"mousemove")}function Rt(r){if(!ke.touchHandled)return;ke.pointerLeaveTimeout&&(window.clearTimeout(ke.pointerLeaveTimeout),delete ke.pointerLeaveTimeout);const e=!!H.dragElement;gt(r,"mouseup"),e||gt(r,"click"),ke.touchHandled=!1}function Ct(r){r.pointerType!=="mouse"&&r.target.releasePointerCapture(r.pointerId)}function Mr(r){H.dragElement&&r.pointerType!=="mouse"&&Kr(r,"mouseenter")}function Br(r){H.dragElement&&r.pointerType!=="mouse"&&(ke.pointerLeaveTimeout=window.setTimeout(()=>{delete ke.pointerLeaveTimeout,Kr(r,"mouseleave")},10))}class Et{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(`${Et.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),ve&&(this.el.addEventListener("touchstart",_t),this.el.addEventListener("pointerdown",Ct)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),ve&&(this.el.removeEventListener("touchstart",_t),this.el.removeEventListener("pointerdown",Ct)),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),ve&&(this.el.addEventListener("touchmove",yt),this.el.addEventListener("touchend",Rt)),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),ve&&(this.el.removeEventListener("touchmove",yt),this.el.removeEventListener("touchend",Rt)),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}}Et.prefix="ui-resizable-";class jt{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,t){this._eventRegister[e]=t}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,t){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](t)}}class st extends jt{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const s=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-s.left)*this.rectScale.x,top:(a.top-s.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(s=>this.option[s]=e[s]),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),H.overResizeElement===this&&delete H.overResizeElement),this}_mouseOver(e){H.overResizeElement||H.dragElement||(H.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){H.overResizeElement===this&&(delete H.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Et(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=R.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=R.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=R.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=R.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=R.initEvent(e,{type:"resizestop",target:this.el});return this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),this._cleanHelper(),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=st._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,t=R.getValuesFromTransformedElement(e);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return st._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){const i=this.startEvent,s={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?s.width+=o:t.indexOf("w")>-1&&(s.width-=o,s.left+=o,l=!0),t.indexOf("s")>-1?s.height+=a:t.indexOf("n")>-1&&(s.height-=a,s.top+=a,u=!0);const c=this._constrainSize(s.width,s.height,l,u);return Math.round(s.width)!==Math.round(c.width)&&(t.indexOf("w")>-1&&(s.left+=s.width-c.width),s.width=c.width),Math.round(s.height)!==Math.round(c.height)&&(t.indexOf("n")>-1&&(s.top+=s.height-c.height),s.height=c.height),s}_constrainSize(e,t,i,s){const o=this.option,a=(i?o.maxWidthMoveLeft:o.maxWidth)||Number.MAX_SAFE_INTEGER,l=o.minWidth/this.rectScale.x||e,u=(s?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:s}=t.getBoundingClientRect();e={left:i,top:s,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const i=this.temporalRect[t],s=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*s+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}st._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const dg='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class ot extends jt{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),s=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:s?.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),ve&&(e.addEventListener("touchstart",_t),e.addEventListener("pointerdown",Ct))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),ve&&(t.removeEventListener("touchstart",_t),t.removeEventListener("pointerdown",Ct))}),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(!H.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(dg)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete H.dragElement,delete H.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),ve&&(e.currentTarget.addEventListener("touchmove",yt),e.currentTarget.addEventListener("touchend",Rt)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),H.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=R.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),H.pauseDrag){const i=Number.isInteger(H.pauseDrag)?H.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,H.dragElement=this;const i=this.el.gridstackNode?.grid;i?H.dropElement=i.el.ddElement.ddDroppable:delete H.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=R.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const s=R.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(s,this.ui()),this.triggerEvent("dragstart",s),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),ve&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",yt,!0),e.currentTarget.removeEventListener("touchend",Rt,!0)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),H.dropElement?.el===this.el.parentElement&&delete H.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const t=R.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(t),this.triggerEvent("dragstop",t),H.dropElement&&H.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete H.dragElement,delete H.dropElement,delete H.mouseHandled,e.preventDefault()}_keyEvent(e){const t=this.el.gridstackNode,i=t?.grid||H.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(!R.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",R.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=R.cloneNode(this.el)),e.parentElement||R.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=ot.originStyleProp.map(t=>this.el.style[t]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging");const t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, top",t.position="fixed",this._dragFollow(e),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null)},0),this}_removeHelperStyle(){if(this.helper.classList.remove("ui-draggable-dragging"),!this.helper?.gridstackNode?._isAboutToRemove&&this.dragElementOriginStyle){const t=this.helper,i=this.dragElementOriginStyle.transition||null;t.style.transition=this.dragElementOriginStyle.transition="none",ot.originStyleProp.forEach(s=>t.style[s]=this.dragElementOriginStyle[s]||null),setTimeout(()=>t.style.transition=i,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const t={left:0,top:0},i=this.helper.style,s=this.dragOffset;i.left=(e.clientX+s.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+s.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 s=0,o=0;i&&(s=this.dragTransform.xOffset,o=this.dragTransform.yOffset);const a=t.getBoundingClientRect();return{left:a.left,top:a.top,offsetLeft:-e.clientX+a.left-s,offsetTop:-e.clientY+a.top-o,width:a.width*this.dragTransform.xScale,height:a.height*this.dragTransform.yScale}}ui(){const t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-t.top)*this.dragTransform.yScale,left:(i.left-t.left)*this.dragTransform.xScale}}}}ot.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class hg extends jt{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),ve&&(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),ve&&(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(!H.dragElement||!this._canDrop(H.dragElement.el))return;e.preventDefault(),e.stopPropagation(),H.dropElement&&H.dropElement!==this&&H.dropElement._mouseLeave(e,!0),H.dropElement=this;const t=R.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(H.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){if(!H.dragElement||H.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const i=R.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(H.dragElement)),this.triggerEvent("dropout",i),H.dropElement===this&&(delete H.dropElement,!t)){let s,o=this.el.parentElement;for(;!s&&o;)s=o.ddElement?.ddDroppable,o=o.parentElement;s&&s._mouseEnter(e)}}drop(e){e.preventDefault();const t=R.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(H.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 Qt{static init(e){return e.ddElement||(e.ddElement=new Qt(e)),e.ddElement}constructor(e){this.el=e}on(e,t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,t),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new ot(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new st(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new hg(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class fg{resizable(e,t,i,s){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]:s});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,s){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]:s});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,s){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]:s}):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(s=>s.on(t,o=>{i(o,H.dragElement?H.dragElement.el:o.target,H.dragElement?H.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",s=R.getElements(e);return s.length?s.map(a=>a.ddElement||(i?Qt.init(a):null)).filter(a=>a):[]}}const _e=new fg;class B{static init(e={},t=".grid-stack"){if(typeof document>"u")return null;const i=B.getGridElement(t);return i?(i.gridstack||(i.gridstack=new B(i,R.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"||(B.getGridElements(t).forEach(s=>{s.gridstack||(s.gridstack=new B(s,R.cloneDeep(e))),i.push(s.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")||B.addRemoveCB)&&(B.addRemoveCB?i=B.addRemoveCB(e,t,!0,!0):i=R.createDiv(["grid-stack",t.class],e)),B.init(t,i)}static registerEngine(e){B.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=R.createDiv([this.opts.placeholderClass,ye.itemClass,this.opts.itemClass]);const e=R.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=R.toNumber(e.getAttribute("gs-row"));t.column==="auto"&&delete t.column,t.alwaysShowResizeHandle!==void 0&&(t._alwaysShowResizeHandle=t.alwaysShowResizeHandle);let s=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||{},s=t.columnOpts.breakpoints=t.columnOpts.breakpoints||[];let f=s.find(m=>m.c===1);f?f.w=h:(f={c:1,w:h},s.push(f,{c:12,w:h+1}))}const a=t.columnOpts;a&&(!a.columnWidth&&!a.breakpoints?.length?(delete t.columnOpts,s=void 0):a.columnMax=a.columnMax||12),s?.length>1&&s.sort((h,f)=>(f.w||0)-(h.w||0));const l={...R.cloneDeep(ye),column:R.toNumber(e.getAttribute("gs-column"))||ye.column,minRow:i||R.toNumber(e.getAttribute("gs-min-row"))||ye.minRow,maxRow:i||R.toNumber(e.getAttribute("gs-max-row"))||ye.maxRow,staticGrid:R.toBool(e.getAttribute("gs-static"))||ye.staticGrid,sizeToContent:R.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=R.toBool(e.getAttribute("gs-animate"))),t=R.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=ve),this._styleSheetClass="gs-id-"+De._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const d=t.engineClass||B.engineClass||De;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 _=m.el;_&&(m._removeDOM?(_&&_.remove(),delete m._removeDOM):this._writePosAttr(_,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&&!H.pauseDrag&&(H.pauseDrag=!0),t.draggable?.pause!==void 0&&(H.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:B.addRemoveCB?t=B.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 s=this._readAttr(t);return R.defaults(e,s),this.engine.prepareNode(e),this.el.appendChild(t),this.makeWidget(t,e),t}createWidgetDivs(e){const t=R.createDiv(["grid-stack-item",this.opts.itemClass]),i=R.createDiv(["grid-stack-item-content"],t);return R.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([s])=>{s.isIntersecting&&(e.visibleObservable?.disconnect(),delete e.visibleObservable,B.renderCB(i,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(t))):B.renderCB(i,e),t}makeSubGrid(e,t,i,s=!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=R.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(s&&(this._removeDD(o.el),h={...o,x:0,y:0},R.removeInternalForSave(h),delete h.subGridOpts,o.content&&(h.content=o.content,delete o.content),B.addRemoveCB?d=B.addRemoveCB(this.el,h,!0,!1):(d=R.createDiv(["grid-stack-item"]),d.appendChild(c),c=R.createDiv(["grid-stack-item-content"],o.el)),this.prepareDragDrop(o.el)),i){const m=u?t.column:o.w,_=o.h+i.h,O=o.el.style;O.transition="none",this.update(o.el,{w:m,h:_}),setTimeout(()=>O.transition=null)}const f=o.subGrid=B.addGrid(c,t);return i?._moving&&(f._isTemp=!0),u&&(f._autoColumn=!0),s&&f.makeWidget(d,h),i&&(i._moving?window.setTimeout(()=>R.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(()=>R.simulateMouseEvent(e._event,"mouseenter",t.el),0))}save(e=!0,t=!1,i=B.saveCB){const s=this.engine.save(e,i);if(s.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=R.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,R.removeInternalAndSame(o,ye),o.children=s,o}return s}load(e,t=B.addRemoveCB||!0){e=R.cloneDeep(e);const i=this.getColumn();e.forEach(c=>{c.w=c.w||1,c.h=c.h||1}),e=R.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let s=0;e.forEach(c=>{s=Math.max(s,(c.x||0)+c.w)}),s>this.engine.defaultColumn&&(this.engine.defaultColumn=s),s>i&&this.engine.cacheLayout(e,s,!0);const o=B.addRemoveCB;typeof t=="function"&&(B.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;R.find(e,d.id)||(B.addRemoveCB&&B.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=>R.find(e,c.id)?(u.push(c),!1):!0),e.forEach(c=>{const d=R.find(u,c.id);if(d){if(R.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),R.samePos(d,c)&&this.engine.nodes.length>1&&(this.moveNode(d,{...c,forceCollide:!0}),R.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?B.addRemoveCB=o:delete B.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 s=R.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/s)}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 s=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+s}const i=R.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 s=this._widthOrContainer(!0);if(e.columnWidth)i=Math.min(Math.round(s/e.columnWidth)||1,e.columnMax);else{i=e.columnMax;let o=0;for(;o<e.breakpoints.length&&s<=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 s;t?s={top:i.top+document.documentElement.scrollTop,left:i.left}:s={top:this.el.offsetTop,left:this.el.offsetLeft};const o=e.left-s.left,a=e.top-s.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,s){return this.engine.isAreaEmpty(e,t,i,s)}makeWidget(e,t){const i=B.getElement(e);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);const s=i.gridstackNode;this._updateContainerHeight(),s.subGridOpts&&this.makeSubGrid(i,s.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(s=>this.on(s,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=s=>t(s):this._gsEventHandler[e]=s=>{s.detail&&t(s,s.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?(B.getElements(e).forEach(s=>{if(s.parentElement&&s.parentElement!==this.el)return;let o=s.gridstackNode;o||(o=this.engine.nodes.find(a=>s===a.el)),o&&(t&&B.addRemoveCB&&B.addRemoveCB(this.el,o,!1,!1),delete s.gridstackNode,this._removeDD(s),this.engine.removeNode(o,t,i),t&&s.parentElement&&s.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&&B.addRemoveCB&&B.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(s=>{this.prepareDragDrop(s.el),s.subGrid&&i&&s.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 B.getElements(e).forEach(i=>{const s=i?.gridstackNode;if(!s)return;const o={...R.copyPos({},s),...R.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]!==s[d])&&(l={},a.forEach(d=>{l[d]=o[d]!==void 0?o[d]:s[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&&(s.content=o.content,B.renderCB(d,o),s.subGrid?.el&&(d.appendChild(s.subGrid.el),s.subGrid.opts.styleInHead||s.subGrid._updateStyles(!0))),delete o.content}let u=!1,c=!1;for(const d in o)d[0]!=="_"&&s[d]!==o[d]&&(s[d]=o[d],u=!0,c=c||!this.opts.staticGrid&&(d==="noResize"||d==="noMove"||d==="locked"));if(R.sanitizeMinMax(s),l){const d=l.w!==void 0&&l.w!==s.w;this.moveNode(s,l),d&&s.subGrid?s.subGrid.onResize(this.hasAnimationCSS()?s.w:void 0):this.resizeToContentCheck(d,s),delete s._orig}(l||u)&&this._writeAttr(i,s),c&&this.prepareDragDrop(s.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 s=i.getCellHeight(!0);if(!s)return;let o=t.h?t.h*s:e.clientHeight,a;if(t.resizeToContentParent&&(a=e.querySelector(t.resizeToContentParent)),a||(a=e.querySelector(B.resizeToContentParent)),!a)return;const l=e.clientHeight-a.clientHeight,u=t.h?t.h*s-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} '${B.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/s);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){B.resizeToContentCB?B.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return B.getElements(e).forEach(i=>{const s=i.gridstackNode;if(!R.canBeRotated(s))return;const o={w:s.h,h:s.w,minH:s.minW,minW:s.minH,maxH:s.maxW,maxW:s.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=s.x+l-(s.h-(u+1)),o.y=s.y+u-l}Object.keys(o).forEach(l=>{o[l]===void 0&&delete o[l]});const a=s._orig;this.update(i,o),s._orig=a}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const i=R.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,s={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++]};return this.willItFit(s)}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;R.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,s=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=R.createStylesheet(this._styleSheetClass,a,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,R.addCSSRule(this._styles,o,`height: ${i}${s}`);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`;R.addCSSRule(this._styles,h,`top: ${l}; right: ${c}; bottom: ${u}; left: ${d};`),R.addCSSRule(this._styles,f,`top: ${l}; right: ${c}; bottom: ${u}; left: ${d};`),R.addCSSRule(this._styles,`${o} > .ui-resizable-n`,`top: ${l};`),R.addCSSRule(this._styles,`${o} > .ui-resizable-s`,`bottom: ${u}`),R.addCSSRule(this._styles,`${o} > .ui-resizable-ne`,`right: ${c}; top: ${l}`),R.addCSSRule(this._styles,`${o} > .ui-resizable-e`,`right: ${c}`),R.addCSSRule(this._styles,`${o} > .ui-resizable-se`,`right: ${c}; bottom: ${u}`),R.addCSSRule(this._styles,`${o} > .ui-resizable-nw`,`left: ${d}; top: ${l}`),R.addCSSRule(this._styles,`${o} > .ui-resizable-w`,`left: ${d}`),R.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+s;for(let l=this._styles._max+1;l<=t;l++)R.addCSSRule(this._styles,`${o}[gs-y="${l}"]`,`top: ${a(l)}`),R.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,s=this.opts.cellHeightUnit;if(!i)return this;if(!e){const o=R.parseHeight(getComputedStyle(this.el).minHeight);if(o.h>0&&o.unit===s){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+s),e&&!e.grid.engine.batchMode&&R.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 s=R.shouldSizeToContent(i);return s?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),s&&this.resizeToContentCheck(!1,i),R.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 s in i)t[s]?e.setAttribute(i[s],String(t[s])):e.removeAttribute(i[s]);return this}_readAttr(e,t=!0){const i={};i.x=R.toNumber(e.getAttribute("gs-x")),i.y=R.toNumber(e.getAttribute("gs-y")),i.w=R.toNumber(e.getAttribute("gs-w")),i.h=R.toNumber(e.getAttribute("gs-h")),i.autoPosition=R.toBool(e.getAttribute("gs-auto-position")),i.noResize=R.toBool(e.getAttribute("gs-no-resize")),i.noMove=R.toBool(e.getAttribute("gs-no-move")),i.locked=R.toBool(e.getAttribute("gs-locked"));const s=e.getAttribute("gs-size-to-content");s&&(s==="true"||s==="false"?i.sizeToContent=R.toBool(s):i.sizeToContent=parseInt(s,10)),i.id=e.getAttribute("gs-id"),i.maxW=R.toNumber(e.getAttribute("gs-max-w")),i.minW=R.toNumber(e.getAttribute("gs-min-w")),i.maxH=R.toNumber(e.getAttribute("gs-max-h")),i.minH=R.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)R.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(i=>R.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(s=>{R.shouldSizeToContent(s)&&this.resizeToContentCBCheck(s.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=R.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 R.getElement(e)}static getElements(e=".grid-stack-item"){return R.getElements(e)}static getGridElement(e){return B.getElement(e)}static getGridElements(e){return R.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=R.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=R.parseHeight(this.opts.marginTop),this.opts.marginTop=e.h,delete this.opts.margin),this.opts.marginBottom===void 0?this.opts.marginBottom=t:(e=R.parseHeight(this.opts.marginBottom),this.opts.marginBottom=e.h,delete this.opts.margin),this.opts.marginRight===void 0?this.opts.marginRight=t:(e=R.parseHeight(this.opts.marginRight),this.opts.marginRight=e.h,delete this.opts.margin),this.opts.marginLeft===void 0?this.opts.marginLeft=t:(e=R.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,s=document){t?.pause!==void 0&&(H.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof e=="string"?R.getElements(e,s):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:(B.getElements(e).forEach(i=>{const s=i.gridstackNode;s&&(t?delete s.noMove:s.noMove=!0,this.prepareDragDrop(s.el))}),this)}resizable(e,t){return this.opts.staticGrid?this:(B.getElements(e).forEach(i=>{const s=i.gridstackNode;s&&(t?delete s.noResize:s.noResize=!0,this.prepareDragDrop(s.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&&B._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=(s,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)*(s.clientX-f.x)/this.dragTransform.xScale+"px",a.style.top=f.y+(this.dragTransform.yScale-1)*(s.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)){_e.off(o,"drag");return}l._willFitPos&&(R.copyPos(l,l._willFitPos),delete l._willFitPos)}this._onStartMoving(a,s,h,l,t,e)}else this._dragOrResize(a,s,h,l,t,e)};return _e.droppable(this.el,{accept:s=>{const o=s.gridstackNode||this._readAttr(s,!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(s);else{const l=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;a=s.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",(s,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),B._itemRemoving(l.el,!1),_e.on(o,"drag",i),i(s,o,a),!1}).on(this.el,"dropout",(s,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",(s,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,_e.off(o,"drag"),a!==o?(a.remove(),o=a):o.remove(),this._removeDD(o),!u))return!1;const f=l.subGrid?.el?.gridstack;return R.copyPos(l,this._readAttr(this.placeholder)),R.removePositioningStyles(o),c&&(l.content||l.subGridOpts||B.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({...s,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&&!_e.isDroppable(e)&&_e.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>B._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>B._itemRemoving(i,!1)),this):this}prepareDragDrop(e,t=!1){const i=e?.gridstackNode;if(!i)return;const s=i.noMove||this.opts.disableDrag,o=i.noResize||this.opts.disableResize,a=this.opts.staticGrid||s&&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,_=f.target;if(!(!_.gridstackNode||_.gridstackNode.grid!==this)){if(i.el=_,i._isAboutToRemove){const O=e.gridstackNode.grid;O._gsEventHandler[f.type]&&O._gsEventHandler[f.type](f,_),O.engine.nodes.push(i),O.removeWidget(e,!0,!0)}else R.removePositioningStyles(_),i._temporaryRemoved?(R.copyPos(i,i._orig),this._writePosAttr(_,i),this.engine.addNode(i)):this._writePosAttr(_,i),this._gsEventHandler[f.type]&&this._gsEventHandler[f.type](f,_);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))}};_e.draggable(e,{start:c,stop:h,drag:d}).resizable(e,{start:c,stop:h,resize:d}),i._initDD=!0}return _e.draggable(e,s?"disable":"enable").resizable(e,o?"disable":"enable"),this}_onStartMoving(e,t,i,s,o,a){if(this.engine.cleanNodes().beginUpdate(s),this._writePosAttr(this.placeholder,s),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=s,s.grid?.el)this.dragTransform=R.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=R.getValuesFromTransformedElement(l)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(s.el=this.placeholder,s._lastUiPosition=i.position,s._prevYPix=i.position.top,s._moving=t.type==="dragstart",delete s._lastTried,t.type==="dropover"&&s._temporaryRemoved&&(this.engine.addNode(s),s._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()-s.x,u=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-s.y;_e.resizable(e,"option","minWidth",o*Math.min(s.minW||1,l)).resizable(e,"option","minHeight",a*Math.min(s.minH||1,u)).resizable(e,"option","maxWidth",o*Math.min(s.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",o*Math.min(s.maxW||Number.MAX_SAFE_INTEGER,s.x+s.w)).resizable(e,"option","maxHeight",a*Math.min(s.maxH||Number.MAX_SAFE_INTEGER,u)).resizable(e,"option","maxHeightMoveUp",a*Math.min(s.maxH||Number.MAX_SAFE_INTEGER,s.y+s.h))}}_dragOrResize(e,t,i,s,o,a){const l={...s._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),_=Math.round(o*.1);if(c=Math.min(c,_),d=Math.min(d,_),h=Math.min(h,m),f=Math.min(f,m),t.type==="drag"){if(s._temporaryRemoved)return;const C=i.position.top-s._prevYPix;s._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&R.updateScrollPosition(e,i.position,C);const S=i.position.left+(i.position.left>s._lastUiPosition.left?-d:c),k=i.position.top+(i.position.top>s._lastUiPosition.top?-f:h);l.x=Math.round(S/o),l.y=Math.round(k/a);const E=this._extraDragRow;if(this.engine.collide(s,l)){const b=this.getRow();let T=Math.max(0,l.y+s.h-b);this.opts.maxRow&&b+T>this.opts.maxRow&&(T=Math.max(0,this.opts.maxRow-b)),this._extraDragRow=T}else this._extraDragRow=0;if(this._extraDragRow!==E&&this._updateContainerHeight(),s.x===l.x&&s.y===l.y)return}else if(t.type==="resize"){if(l.x<0||(R.updateScrollResize(t,e,a),l.w=Math.round((i.size.width-c)/o),l.h=Math.round((i.size.height-h)/a),s.w===l.w&&s.h===l.h)||s._lastTried&&s._lastTried.w===l.w&&s._lastTried.h===l.h)return;const C=i.position.left+c,S=i.position.top+h;l.x=Math.round(C/o),l.y=Math.round(S/a),u=!0}s._event=t,s._lastTried=l;const O={x:i.position.left+c,y:i.position.top+h,w:(i.size?i.size.width:s.w*o)-c-d,h:(i.size?i.size.height:s.h*a)-h-f};if(this.engine.moveNodeCheck(s,{...l,cellWidth:o,cellHeight:a,rect:O,resizing:u})){s._lastUiPosition=i.position,this.engine.cacheRects(o,a,h,d,f,c),delete s._skipDown,u&&s.subGrid&&s.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const C=t.target;s._sidebarOrig||this._writePosAttr(C,s),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 s=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=s,this.opts.removable===!0&&B._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return ug(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}B.renderCB=(r,e)=>{r&&e?.content&&(r.textContent=e.content)},B.resizeToContentParent=".grid-stack-item-content",B.Utils=R,B.Engine=De,B.GDRev="11.5.1";const mg=["data-id","data-testid","gs-h","gs-w","gs-x","gs-y"],pg={class:"grid-stack-item-content"},gg=Ce(n.defineComponent({__name:"DraggableGridLayout",props:{tiles:{},tileHeight:{default:Ye},columns:{default:mt}},emits:["update-tiles"],setup(r,{expose:e,emit:t}){const i=r,s=t,o=n.ref(null),a=n.ref(new Map(i.tiles.map(m=>[`${m.id}`,m])));let l=null;const u=m=>`[data-id="${m}"]`,c=m=>m.map(_=>{const O=a.value.get(`${_.el?.getAttribute("data-id")}`);if(O)return{...O,layout:{position:{col:Number(_.x),row:Number(_.y)},size:{cols:Number(_.w),rows:Number(_.h)}}}}).filter(_=>_!==void 0),d=(m,_)=>{l&&(c(_).forEach(C=>{a.value.set(`${C.id}`,C)}),s("update-tiles",Array.from(a.value.values())))},h=(m,_)=>{_.forEach(O=>{a.value.delete(`${O.el?.getAttribute("data-id")}`)}),s("update-tiles",Array.from(a.value.values()))};n.onMounted(()=>{o.value&&(l=B.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))}),n.onUnmounted(()=>{l&&l.destroy(!1)});const f=m=>{if(l&&o.value){const _=o.value.querySelector(u(m));_&&l.removeWidget(_)}};return n.watch(()=>i.tiles.length,async(m,_)=>{if(m>_&&l){const O=i.tiles.slice(_);for(const C of O)a.value.set(`${C.id}`,C),await n.nextTick(),l.makeWidget(u(C.id),{autoPosition:!0,w:C.layout.size.cols,h:C.layout.size.rows})}}),n.watchEffect(()=>{i.tiles.forEach(m=>{a.value.set(`${m.id}`,m)})}),e({removeWidget:f}),(m,_)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"gridContainer",ref:o,class:"grid-stack"},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.tiles,O=>(n.openBlock(),n.createElementBlock("div",{key:O.id,class:"grid-stack-item","data-id":`${O.id}`,"data-testid":`grid-stack-item-${O.id}`,"gs-h":O.layout.size.rows,"gs-lazy-load":!0,"gs-w":O.layout.size.cols,"gs-x":O.layout.position.col,"gs-y":O.layout.position.row},[n.createElementVNode("div",pg,[n.renderSlot(m.$slots,"tile",{fitToContent:!1,tile:O},void 0,!0)])],8,mg))),128))],512))}}),[["__scopeId","data-v-a060e0c5"]]),_g=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}},yg={key:0,class:"fullscreen-header"},Rg={key:0,class:"tile-container slottable-tile"},Cg=Ce(n.defineComponent({__name:"DashboardRenderer",props:n.mergeModels({context:{},preview:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:n.mergeModels(["edit-tile","tile-time-range-zoom","tiles-loaded"],["update:modelValue"]),setup(r,{expose:e,emit:t}){if(n.useCssVars(w=>({v577760a8:d.value})),r.context.disableCoordination!==!0){const w=Fr();n.provide(Hi,w)}const i=t,s=n.useModel(r,"modelValue"),{i18n:o}=ce.useI18n(),a=n.ref(0),l=n.ref(null),u=n.ref(),c=n.ref(),d=n.ref("scale(1)"),h=new Set,f=n.inject(Te);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")),ce.useRequestQueue();const{exportPdf:m,exportState:_}=ce.useExportPdf(c),O=w=>{h.add(w.id);const D=k.value.filter(I=>!b(I)).length;h.size>=D&&i("tiles-loaded",!0)},C=n.computed(()=>{const D=`renderer.trendRange.${A.value.type==="absolute"?"custom":A.value.time_range}`;return o.te(D)?o.t(D):""}),S=(w,D)=>{const I=w.layout.position.row-D.layout.position.row;return I!==0?I:w.layout.position.col-D.layout.position.col},k=n.computed(()=>s.value.tiles.map(w=>{if(V.value&&!w.id&&console.warn("No id provided for tile. One will be generated automatically,","however tracking changes to this tile may not work as expected.",w),w.type==="slottable")return{layout:w.layout,type:w.type,id:w.id??crypto.randomUUID()};let D=w.definition;const I=w.type??"chart",Q=xa(D,C.value);return Q!==D.header_description&&(D={...D,header_description:Q}),{layout:w.layout,meta:D,type:I,id:w.id??crypto.randomUUID()}})),E=w=>{i("edit-tile",w)},b=w=>w.type==="slottable"?!0:w.meta?.chart.type==="slottable",T=w=>w.type==="slottable",U=w=>{if(w.type==="slottable")return w.id;const D=w.meta?.chart;return D&&T(D)?D.id:void 0},z=w=>{try{const D=_g(w);s.value.tiles.push(JSON.parse(JSON.stringify(D)))}catch(D){console.warn(D)}},p=w=>{l.value&&l.value.removeWidget(w.id),h.delete(w.id)},g=()=>{h.clear(),a.value++},y=w=>{const D=w.map(I=>I.type==="slottable"?{id:I.id,type:I.type,layout:I.layout}:{id:I.id,type:I.type,layout:I.layout,definition:I.meta});s.value.tiles=D.sort(S)},v=async()=>{if(d.value="scale(1)",await n.nextTick(),c.value){const{availWidth:w,availHeight:D}=window.screen,{width:I,height:Q}=c.value.getBoundingClientRect(),re=Math.min(D/Q,w/I);d.value=`scale(${re})`}},x=()=>{u.value&&(document.fullscreenElement?document.exitFullscreen():u.value.requestFullscreen())},N=n.ref(!1),K=()=>{N.value=document.fullscreenElement!==null,N.value&&v()},q=n.computed(()=>s.value.preset_filters??[]),{editable:V,enrichedContext:P,queryReady:F,showTileActions:M,timeSpec:A}=ce.useDashboardContext({globalFilters:q,context:n.computed(()=>r.context),isFullscreen:N,preview:n.computed(()=>r.preview)});return e({refresh:g,toggleFullscreen:x,exportPdf:m,pdfExportState:_}),(w,D)=>{const I=n.resolveComponent("KAlert");return n.openBlock(),n.createElementBlock("div",{ref_key:"dashboardContainer",ref:u,class:n.normalizeClass(["kong-ui-public-dashboard-renderer",{"is-fullscreen":N.value}]),onFullscreenchange:K},[n.createElementVNode("div",{ref_key:"layoutContainer",ref:c,class:"layout"},[n.unref(f)&&N.value?(n.openBlock(),n.createElementBlock("div",yg,[n.renderSlot(w.$slots,"fullscreenHeader",{},void 0,!0)])):n.createCommentVNode("",!0),n.unref(f)?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(n.unref(V)&&!N.value?gg:Ur),{key:2,ref_key:"gridLayoutRef",ref:l,columns:s.value.columns,"tile-height":s.value.tile_height,tiles:k.value,onUpdateTiles:y},{tile:n.withCtx(({tile:Q,fitToContent:re})=>[b(Q)?(n.openBlock(),n.createElementBlock("div",Rg,[n.renderSlot(w.$slots,U(Q),{},void 0,!0)])):(n.openBlock(),n.createBlock(Lr,{key:N.value?`${Q.id}-tile`:`${Q.id}-tile-fullscreen`,"refresh-counter":a.value,"onUpdate:refreshCounter":D[0]||(D[0]=te=>a.value=te),class:"tile-container",context:n.unref(P),definition:Q.meta,"fit-to-content":re,height:Q.layout.size.rows*(s.value.tile_height||n.unref(Ye))+parseInt(n.unref(Bi),10),"hide-actions":!n.unref(M),"is-fullscreen":N.value,preview:r.preview,"query-ready":n.unref(F),"tile-id":Q.id,"tile-type":Q.type,onDuplicateTile:te=>z(Q),onEditTile:te=>E(Q),onRemoveTile:te=>p(Q),onTileLoaded:te=>O(Q),onTileTimeRangeZoom:D[1]||(D[1]=te=>i("tile-time-range-zoom",te))},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"])):(n.openBlock(),n.createBlock(I,{key:1,appearance:"danger"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(o).t("renderer.noQueryBridge")),1)]),_:1}))],512)],34)}}}),[["__scopeId","data-v-9925f70d"]]),Eg=n.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=n.useTemplateRef("root"),s=n.useTemplateRef("dashboard-tile"),o=crypto.randomUUID(),a=t,l=E=>{a("tile-time-range-zoom",E)},u=E=>{a("chart-data",E)},c=E=>{a("tile-bounds-change",E)},{i18n:d}=ce.useI18n(),{enrichedContext:h,queryReady:f}=ce.useDashboardContext({globalFilters:n.toRef(()=>r.globalFilters),context:n.toRef(()=>r.context),preview:n.computed(()=>r.preview)}),m=n.computed(()=>Ie(r.definition)),_=n.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),O=n.ref(Ye);let C;n.onMounted(()=>{const E=i.value?.parentElement;E&&(O.value=E.getBoundingClientRect().height,C=new ResizeObserver(([b])=>{const{height:T}=b.contentRect;O.value=T}),C.observe(E))}),n.onUnmounted(()=>C?.disconnect());const S=n.ref(0);return e({refresh:()=>{S.value++},getExportData:()=>s.value?.getExportData()}),(E,b)=>{const T=n.resolveComponent("KEmptyState");return n.openBlock(),n.createElementBlock("div",{ref_key:"root",ref:i,"data-testid":"dashboard-tile-preview-root"},[_.value?(n.openBlock(),n.createBlock(T,{key:0,"action-button-visible":!1,"data-testid":"chart-not-configured-empty-state"},{title:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(n.unref(d).t("renderer.not_configured.title")),1)]),default:n.withCtx(()=>[n.createElementVNode("p",null,n.toDisplayString(n.unref(d).t("renderer.not_configured.description")),1)]),_:1})):(n.openBlock(),n.createBlock(Lr,{key:1,ref:"dashboard-tile","refresh-counter":S.value,"onUpdate:refreshCounter":b[0]||(b[0]=U=>S.value=U),context:{...n.unref(h),editable:!1},definition:r.definition,height:O.value,"hide-actions":"",preview:r.preview,"query-ready":n.unref(f),"show-refresh":"","tile-id":n.unref(o),onChartData:u,onTileBoundsChange:c,onTileTimeRangeZoom:l},null,8,["refresh-counter","context","definition","height","preview","query-ready","tile-id"]))],512)}}}),Og=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},bg=r=>{if(r.type!=="chart"||Ie(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}}},wg=(r,e=mt)=>{if(!r.length)return[];let t=0,i=0,s=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+=s,i=0,s=0);const c={...a,layout:{...a.layout,position:{...a.layout?.position??{},col:i,row:t}}};o.push(c),i+=l,s=Math.max(s,u)}return o},Tg=(r,e)=>{if(e){const s=r.tiles.map(bg);return{...r,tiles:s}}const t=r.tiles.map(Og).filter(s=>s!==void 0),i=wg(t,r.columns);return{...r,tiles:i}},vg=Object.freeze(Object.defineProperty({__proto__:null,default:n.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=n.ref(void 0),s=n.computed(()=>i.value?ri.exploreResultToCountryMetrics(i.value):{}),o=n.computed(()=>i.value?i.value?.meta.metric_names&&i.value.meta.metric_names[0]:""),a=n.computed(()=>t.query.limit!==void 0&&t.query.limit>0?t.query.limit:ee.COUNTRIES.length),l=n.computed(()=>{if(!t.query.filters?.find(({field:m,operator:_})=>m==="country_code"&&(_==="not_empty"||_==="empty"||_==="in"))){const m={field:"country_code",operator:"not_empty"};return{...t.query,filters:[...t.query.filters||[],m]}}return t.query}),u=n.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)=>(n.openBlock(),n.createBlock(Ke,{context:r.context,"limit-override":a.value,query:l.value,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter,onChartData:c},{default:n.withCtx(()=>[n.createVNode(n.unref(ri.AnalyticsGeoMap),{bounds:r.chartOptions.bounds,"country-metrics":s.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"}));W.CP_ID_TOKEN=Gi,W.CsvExportModal=nr,W.DASHBOARD_COLS=mt,W.DEFAULT_TILE_HEIGHT=Ye,W.DEFAULT_TILE_REFRESH_INTERVAL_MS=$i,W.DashboardRenderer=Cg,W.DashboardTilePreview=Eg,W.ENTITY_ID_TOKEN=Lt,W.FULLSCREEN_LONG_REFRESH_INTERVAL_MS=Vi,W.FULLSCREEN_SHORT_REFRESH_INTERVAL_MS=Wi,W.GridLayout=Ur,W.INJECT_DASHBOARD_COORDINATOR=Hi,W.INJECT_QUERY_PROVIDER=Te,W.TIMEFRAME_TOKEN=Fi,W.configureAllowedDefinition=Tg,W.getTimeRangeDurationMs=zt,W.isTimeRangeUnsupported=Pt,W.limitTimeRange=qt,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})}));
|