@kong-ui-public/dashboard-renderer 7.2.0 → 7.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as l, ref as y, computed as n, createBlock as f, openBlock as p, withCtx as d, createVNode as v, unref as h } from "vue";
|
|
2
|
-
import { _ } from "./index-
|
|
2
|
+
import { _ } from "./index-Cp5mehfA.js";
|
|
3
3
|
import { exploreResultToCountryMetrics as q, AnalyticsGeoMap as C } from "@kong-ui-public/analytics-geo-map";
|
|
4
4
|
const b = /* @__PURE__ */ l({
|
|
5
5
|
__name: "GeoMapRenderer",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(C,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("@kong-ui-public/analytics-utilities"),require("@kong-ui-public/analytics-chart"),require("@kong-ui-public/analytics-metric-provider"),require("@kong/icons"),require("@kong-ui-public/analytics-config-store"),require("swrv"),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-ui-public/analytics-chart","@kong-ui-public/analytics-metric-provider","@kong/icons","@kong-ui-public/analytics-config-store","swrv","axios","@kong-ui-public/i18n","@kong-ui-public/analytics-geo-map"],n):(C=typeof globalThis<"u"?globalThis:C||self,n(C["kong-ui-public-dashboard-renderer"]={},C.Vue,C["kong-ui-public-analytics-utilities"],C["kong-ui-public-analytics-chart"],C["kong-ui-public-analytics-metric-provider"],C.KongIcons,C["kong-ui-public-analytics-config-store"],C.swrv,C.axios,C["kong-ui-public-i18n"],C["kong-ui-public-analytics-geo-map"]))})(this,function(C,n,z,Z,be,ve,Fe,xt,Ti,Ue,We){"use strict";var ki=Object.defineProperty;var gt=C=>{throw TypeError(C)};var Ri=(C,n,z)=>n in C?ki(C,n,{enumerable:!0,configurable:!0,writable:!0,value:z}):C[n]=z;var yt=(C,n,z)=>Ri(C,typeof n!="symbol"?n+"":n,z),Be=(C,n,z)=>n.has(C)||gt("Cannot "+z);var v=(C,n,z)=>(Be(C,n,"read from private field"),z?z.call(C):n.get(C)),I=(C,n,z)=>n.has(C)?gt("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(C):n.set(C,z),H=(C,n,z,Z)=>(Be(C,n,"write to private field"),Z?Z.call(C,z):n.set(C,z),z),q=(C,n,z)=>(Be(C,n,"access private method"),z);var _e=(C,n,z,Z)=>({set _(be){H(C,n,be,z)},get _(){return v(C,n,Z)}});var U,ne,oe,te,fe,ae,me,W,le,$,pe,V,he,J,ge,De,S,_t,bt,vt,wt,Et,Ne,$e,Ge,Le,Ct,Oe;var Ve=(f=>(f.VALIDATING="VALIDATING",f.VALIDATING_HAS_DATA="VALIDATING_HAS_DATA",f.PENDING="PENDING",f.SUCCESS="SUCCESS",f.SUCCESS_HAS_DATA="SUCCESS_HAS_DATA",f.ERROR="ERROR",f.STALE_IF_ERROR="STALE_IF_ERROR",f))(Ve||{});const kt=f=>{var e,t,i,s,r;return f?!!((e=Object.keys(f))!=null&&e.length||(t=f.data)!=null&&t.length||(s=(i=f.data)==null?void 0:i.data)!=null&&s.length||!((r=f.data)!=null&&r.data)&&typeof f.data=="object"&&Object.keys(f==null?void 0:f.data).length):!1};function Rt(f=n.ref({}),e,t,i=kt){const s=n.ref("PENDING");return n.watchEffect(()=>{const r=i(f.value);if(f.value&&r&&t.value){s.value="VALIDATING_HAS_DATA";return}if(f.value&&t.value){s.value="VALIDATING";return}if(f.value&&e.value){s.value="STALE_IF_ERROR";return}if(f.value===void 0&&!e.value){s.value="PENDING";return}if(f.value&&!e.value&&r){s.value="SUCCESS_HAS_DATA";return}if(f.value&&!e.value){s.value="SUCCESS";return}f.value===void 0&&e&&(s.value="ERROR")}),{state:s,swrvState:Ve}}const Tt={renderer:{noQueryBridge:"No query bridge provided. Unable to render dashboard.",trendRange:{"24h":"Last 24-hour summary","7d":"Last 7-day summary","30d":"Last 30-day summary"},edit:"Edit",duplicateTile:"Duplicate",remove:"Remove",delete:"Delete"},queryDataProvider:{forbidden:"To access this data, either filter for an entity you have access to or request analytics viewer access from your administrator.",timeRangeExceeded:"The time range for this report is outside of your organization's data retention period",timeout:"Query timed out. Consider querying a shorter time range."},csvExport:{defaultFilename:"Chart export",exportAsCsv:"Export as CSV"},jumpToExplore:"Explore",jumpToRequests:"View requests",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 Dt(){const f=Ue.createI18n("en-us",Tt);return{i18n:f,i18nT:Ue.i18nTComponent(f)}}const de=170,Ae=6,ee="analytics-query-provider",He="{entity-id}",Ke="{cp-id}",je="{timeframe}",Ye=30*1e3;function zt(){const f=n.inject(ee);return{evaluateFeatureFlag:(t,i)=>f?f.evaluateFeatureFlagFn(t,i):i}}function St(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}var Qe={exports:{}};(function(f){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function s(d,h,c){this.fn=d,this.context=h,this.once=c||!1}function r(d,h,c,l,m){if(typeof c!="function")throw new TypeError("The listener must be a function");var y=new s(c,l||d,m),p=t?t+h:h;return d._events[p]?d._events[p].fn?d._events[p]=[d._events[p],y]:d._events[p].push(y):(d._events[p]=y,d._eventsCount++),d}function a(d,h){--d._eventsCount===0?d._events=new i:delete d._events[h]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var h=[],c,l;if(this._eventsCount===0)return h;for(l in c=this._events)e.call(c,l)&&h.push(t?l.slice(1):l);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(c)):h},o.prototype.listeners=function(h){var c=t?t+h:h,l=this._events[c];if(!l)return[];if(l.fn)return[l.fn];for(var m=0,y=l.length,p=new Array(y);m<y;m++)p[m]=l[m].fn;return p},o.prototype.listenerCount=function(h){var c=t?t+h:h,l=this._events[c];return l?l.fn?1:l.length:0},o.prototype.emit=function(h,c,l,m,y,p){var _=t?t+h:h;if(!this._events[_])return!1;var g=this._events[_],D=arguments.length,E,x;if(g.fn){switch(g.once&&this.removeListener(h,g.fn,void 0,!0),D){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,c),!0;case 3:return g.fn.call(g.context,c,l),!0;case 4:return g.fn.call(g.context,c,l,m),!0;case 5:return g.fn.call(g.context,c,l,m,y),!0;case 6:return g.fn.call(g.context,c,l,m,y,p),!0}for(x=1,E=new Array(D-1);x<D;x++)E[x-1]=arguments[x];g.fn.apply(g.context,E)}else{var N=g.length,R;for(x=0;x<N;x++)switch(g[x].once&&this.removeListener(h,g[x].fn,void 0,!0),D){case 1:g[x].fn.call(g[x].context);break;case 2:g[x].fn.call(g[x].context,c);break;case 3:g[x].fn.call(g[x].context,c,l);break;case 4:g[x].fn.call(g[x].context,c,l,m);break;default:if(!E)for(R=1,E=new Array(D-1);R<D;R++)E[R-1]=arguments[R];g[x].fn.apply(g[x].context,E)}}return!0},o.prototype.on=function(h,c,l){return r(this,h,c,l,!1)},o.prototype.once=function(h,c,l){return r(this,h,c,l,!0)},o.prototype.removeListener=function(h,c,l,m){var y=t?t+h:h;if(!this._events[y])return this;if(!c)return a(this,y),this;var p=this._events[y];if(p.fn)p.fn===c&&(!m||p.once)&&(!l||p.context===l)&&a(this,y);else{for(var _=0,g=[],D=p.length;_<D;_++)(p[_].fn!==c||m&&!p[_].once||l&&p[_].context!==l)&&g.push(p[_]);g.length?this._events[y]=g.length===1?g[0]:g:a(this,y)}return this},o.prototype.removeAllListeners=function(h){var c;return h?(c=t?t+h:h,this._events[c]&&a(this,c)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,f.exports=o})(Qe);var Nt=Qe.exports;const Lt=St(Nt);class Xe extends Error{constructor(e){super(e),this.name="TimeoutError"}}class Ot extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const Ze=f=>globalThis.DOMException===void 0?new Ot(f):new DOMException(f),Je=f=>{const e=f.reason===void 0?Ze("This operation was aborted."):f.reason;return e instanceof Error?e:Ze(e)};function At(f,e){const{milliseconds:t,fallback:i,message:s,customTimers:r={setTimeout,clearTimeout}}=e;let a,o;const h=new Promise((c,l)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(e.signal){const{signal:y}=e;y.aborted&&l(Je(y)),o=()=>{l(Je(y))},y.addEventListener("abort",o,{once:!0})}if(t===Number.POSITIVE_INFINITY){f.then(c,l);return}const m=new Xe;a=r.setTimeout.call(void 0,()=>{if(i){try{c(i())}catch(y){l(y)}return}typeof f.cancel=="function"&&f.cancel(),s===!1?c():s instanceof Error?l(s):(m.message=s??`Promise timed out after ${t} milliseconds`,l(m))},t),(async()=>{try{c(await f)}catch(y){l(y)}})()}).finally(()=>{h.clear(),o&&e.signal&&e.signal.removeEventListener("abort",o)});return h.clear=()=>{r.clearTimeout.call(void 0,a),a=void 0},h}function Ht(f,e,t){let i=0,s=f.length;for(;s>0;){const r=Math.trunc(s/2);let a=i+r;t(f[a],e)<=0?(i=++a,s-=r+1):s=r}return i}class Mt{constructor(){I(this,U,[])}enqueue(e,t){t={priority:0,...t};const i={priority:t.priority,id:t.id,run:e};if(this.size===0||v(this,U)[this.size-1].priority>=t.priority){v(this,U).push(i);return}const s=Ht(v(this,U),i,(r,a)=>a.priority-r.priority);v(this,U).splice(s,0,i)}setPriority(e,t){const i=v(this,U).findIndex(r=>r.id===e);if(i===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);const[s]=v(this,U).splice(i,1);this.enqueue(s.run,{priority:t,id:e})}dequeue(){const e=v(this,U).shift();return e==null?void 0:e.run}filter(e){return v(this,U).filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return v(this,U).length}}U=new WeakMap;class It extends Lt{constructor(t){var i,s;super();I(this,S);I(this,ne);I(this,oe);I(this,te,0);I(this,fe);I(this,ae);I(this,me,0);I(this,W);I(this,le);I(this,$);I(this,pe);I(this,V,0);I(this,he);I(this,J);I(this,ge);I(this,De,1n);yt(this,"timeout");if(t={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:Mt,...t},!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${((i=t.intervalCap)==null?void 0:i.toString())??""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${((s=t.interval)==null?void 0:s.toString())??""}\` (${typeof t.interval})`);H(this,ne,t.carryoverConcurrencyCount),H(this,oe,t.intervalCap===Number.POSITIVE_INFINITY||t.interval===0),H(this,fe,t.intervalCap),H(this,ae,t.interval),H(this,$,new t.queueClass),H(this,pe,t.queueClass),this.concurrency=t.concurrency,this.timeout=t.timeout,H(this,ge,t.throwOnTimeout===!0),H(this,J,t.autoStart===!1)}get concurrency(){return v(this,he)}set concurrency(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);H(this,he,t),q(this,S,Le).call(this)}setPriority(t,i){v(this,$).setPriority(t,i)}async add(t,i={}){return i.id??(i.id=(_e(this,De)._++).toString()),i={timeout:this.timeout,throwOnTimeout:v(this,ge),...i},new Promise((s,r)=>{v(this,$).enqueue(async()=>{var a;_e(this,V)._++,_e(this,te)._++;try{(a=i.signal)==null||a.throwIfAborted();let o=t({signal:i.signal});i.timeout&&(o=At(Promise.resolve(o),{milliseconds:i.timeout})),i.signal&&(o=Promise.race([o,q(this,S,Ct).call(this,i.signal)]));const d=await o;s(d),this.emit("completed",d)}catch(o){if(o instanceof Xe&&!i.throwOnTimeout){s();return}r(o),this.emit("error",o)}finally{q(this,S,vt).call(this)}},i),this.emit("add"),q(this,S,Ne).call(this)})}async addAll(t,i){return Promise.all(t.map(async s=>this.add(s,i)))}start(){return v(this,J)?(H(this,J,!1),q(this,S,Le).call(this),this):this}pause(){H(this,J,!0)}clear(){H(this,$,new(v(this,pe)))}async onEmpty(){v(this,$).size!==0&&await q(this,S,Oe).call(this,"empty")}async onSizeLessThan(t){v(this,$).size<t||await q(this,S,Oe).call(this,"next",()=>v(this,$).size<t)}async onIdle(){v(this,V)===0&&v(this,$).size===0||await q(this,S,Oe).call(this,"idle")}get size(){return v(this,$).size}sizeBy(t){return v(this,$).filter(t).length}get pending(){return v(this,V)}get isPaused(){return v(this,J)}}ne=new WeakMap,oe=new WeakMap,te=new WeakMap,fe=new WeakMap,ae=new WeakMap,me=new WeakMap,W=new WeakMap,le=new WeakMap,$=new WeakMap,pe=new WeakMap,V=new WeakMap,he=new WeakMap,J=new WeakMap,ge=new WeakMap,De=new WeakMap,S=new WeakSet,_t=function(){return v(this,oe)||v(this,te)<v(this,fe)},bt=function(){return v(this,V)<v(this,he)},vt=function(){_e(this,V)._--,q(this,S,Ne).call(this),this.emit("next")},wt=function(){q(this,S,Ge).call(this),q(this,S,$e).call(this),H(this,le,void 0)},Et=function(){const t=Date.now();if(v(this,W)===void 0){const i=v(this,me)-t;if(i<0)H(this,te,v(this,ne)?v(this,V):0);else return v(this,le)===void 0&&H(this,le,setTimeout(()=>{q(this,S,wt).call(this)},i)),!0}return!1},Ne=function(){if(v(this,$).size===0)return v(this,W)&&clearInterval(v(this,W)),H(this,W,void 0),this.emit("empty"),v(this,V)===0&&this.emit("idle"),!1;if(!v(this,J)){const t=!v(this,S,Et);if(v(this,S,_t)&&v(this,S,bt)){const i=v(this,$).dequeue();return i?(this.emit("active"),i(),t&&q(this,S,$e).call(this),!0):!1}}return!1},$e=function(){v(this,oe)||v(this,W)!==void 0||(H(this,W,setInterval(()=>{q(this,S,Ge).call(this)},v(this,ae))),H(this,me,Date.now()+v(this,ae)))},Ge=function(){v(this,te)===0&&v(this,V)===0&&v(this,W)&&(clearInterval(v(this,W)),H(this,W,void 0)),H(this,te,v(this,ne)?v(this,V):0),q(this,S,Le).call(this)},Le=function(){for(;q(this,S,Ne).call(this););},Ct=async function(t){return new Promise((i,s)=>{t.addEventListener("abort",()=>{s(t.reason)},{once:!0})})},Oe=async function(t,i){return new Promise(s=>{const r=()=>{i&&!i()||(this.off(t,r),s())};this.on(t,r)})};const qt=()=>{const f=Fe.useAnalyticsConfigStore(),e=n.inject(ee);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 It({carryoverConcurrencyCount:!0,concurrency:f.maxParallelRequests,interval:f.requestInterval,intervalCap:f.requestIntervalCap}),i={...e,queryFnOverride:!0,queryFn:(s,r)=>t.add(()=>e.queryFn(s,r),{throwOnTimeout:!0})};n.provide(ee,i)};function Pt({queryBridge:f,context:e,definition:t,chartData:i}){const s=n.ref(""),r=n.ref("");n.onMounted(async()=>{var E,x;s.value=await((E=f==null?void 0:f.exploreBaseUrl)==null?void 0:E.call(f))??"",r.value=await((x=f==null?void 0:f.requestsBaseUrl)==null?void 0:x.call(f))??""});const a=n.computed(()=>!["golden_signals","top_n","gauge"].includes(t.value.chart.type)),o=n.computed(()=>r.value&&t.value.query&&t.value.query.datasource!=="llm_usage"),d=n.computed(()=>s.value&&t.value.query&&["api_usage","llm_usage","basic"].includes(t.value.query.datasource)),h=n.computed(()=>i.value?z.msToGranularity(i.value.meta.granularity_ms):void 0),c=n.computed(()=>{var N;const E=[...e.value.filters,...t.value.query.filters??[]],x=((N=t.value.query)==null?void 0:N.datasource)??"api_usage";return E.filter(R=>z.getFieldDataSources(R.field).some(O=>x===O))}),l=n.computed(()=>{if(!d.value||!a.value)return"";const E=c.value,x=t.value.query.time_range||e.value.timeSpec,N=g(x,E);return D(N)}),m=n.computed(()=>{if(!o.value||!a.value)return"";const E=[...e.value.filters,...t.value.query.filters??[]],x=p(t.value.query.time_range||e.value.timeSpec,E);return y(x)}),y=E=>o.value?`${r.value}?q=${JSON.stringify(E)}`:"",p=(E,x)=>{var N,R;return{filter:x,timeframe:{timePeriodsKey:E.type==="relative"?E.time_range:"custom",start:E.type==="absolute"?(N=i.value)==null?void 0:N.meta.start_ms:void 0,end:E.type==="absolute"?(R=i.value)==null?void 0:R.meta.end_ms:void 0}}},_=(E,x)=>({filter:x,timeframe:{timePeriodsKey:E.type==="relative"?E.time_range:"custom",start:E.type==="absolute"?E.start:void 0,end:E.type==="absolute"?E.end:void 0}}),g=(E,x)=>{const N=t.value.query.dimensions??[];return{filters:x,metrics:t.value.query.metrics??[],dimensions:N,time_range:E,granularity:t.value.query.granularity||h.value}},D=E=>{var N,R;if(!d.value)return"";const x=((N=t.value.query)==null?void 0:N.datasource)==="basic"?"api_usage":(R=t.value.query)==null?void 0:R.datasource;return`${s.value}?q=${JSON.stringify(E)}&d=${x}&c=${t.value.chart.type}`};return{exploreLinkKebabMenu:l,requestsLinkKebabMenu:m,canShowKebabMenu:a,canGenerateRequestsLink:o,canGenerateExploreLink:d,buildExploreQuery:g,buildRequestsQueryZoomActions:_,buildExploreLink:D,buildRequestLink:y}}const se={useI18n:Dt,useEvaluateFeatureFlag:zt,useRequestQueue:qt,useContextLinks:Pt},we=n.defineComponent({__name:"QueryDataProvider",props:{context:{},query:{},queryReady:{type:Boolean},refreshCounter:{}},emits:["chart-data","queryComplete"],setup(f,{emit:e}){const t=f,i=e,{i18n:s}=se.useI18n(),r=n.inject(ee),a=()=>t.queryReady&&r?JSON.stringify([t.query,t.context,t.refreshCounter]):null,o=new AbortController;n.onUnmounted(()=>{o.abort()});const d=(D,E,x)=>{const N=[];return E&&N.push(...E),N.push(...z.stripUnknownFilters(D,x)),N},{data:h,error:c,isValidating:l}=xt(a,async()=>{var D,E,x,N;try{let{datasource:R,...T}=t.query;R||(R="basic");const O=d(R,t.query.filters,t.context.filters);let L=t.query.time_range;L?L.tz||(L={...L,tz:t.context.tz}):L={...t.context.timeSpec,tz:t.context.tz};const P={datasource:R,query:{...T,time_range:L,filters:O}},Y=await(r==null?void 0:r.queryFn(P,o));return p.value=null,Y}catch(R){throw(R==null?void 0:R.status)===403?p.value={message:s.t("queryDataProvider.forbidden"),type:"forbidden"}:(R==null?void 0:R.status)===408?p.value={message:s.t("queryDataProvider.timeout"),type:"timeout"}:((E=(D=R==null?void 0:R.response)==null?void 0:D.data)==null?void 0:E.message)==="Range not allowed for this tier"?p.value={message:s.t("queryDataProvider.timeRangeExceeded"),type:"range_exceeded"}:p.value={message:((N=(x=R==null?void 0:R.response)==null?void 0:x.data)==null?void 0:N.message)||(R==null?void 0:R.message),type:"other"},R}finally{i("queryComplete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:m,swrvState:y}=Rt(h,c,l),p=n.ref(null),_=n.computed(()=>m.value===y.ERROR||!!p.value),g=n.computed(()=>!t.queryReady||m.value===y.PENDING);return n.watch(h,D=>{D&&i("chart-data",D)}),(D,E)=>{var R;const x=n.resolveComponent("KSkeleton"),N=n.resolveComponent("KEmptyState");return g.value||!n.unref(h)&&!_.value?(n.openBlock(),n.createBlock(x,{key:0,class:"chart-skeleton",type:"table"})):_.value&&((R=p.value)==null?void 0:R.type)==="forbidden"?(n.openBlock(),n.createBlock(N,{key:1,"action-button-visible":!1,"data-testid":"chart-forbidden-state"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(p.value.message),1)]),icon:n.withCtx(()=>[n.createVNode(n.unref(ve.VisibilityOffIcon))]),_:1})):_.value?(n.openBlock(),n.createBlock(N,{key:2,"action-button-visible":!1,"data-testid":"chart-empty-state","icon-variant":"error"},{default:n.withCtx(()=>{var T;return[n.createTextVNode(n.toDisplayString((T=p.value)==null?void 0:T.message),1)]}),_:1})):n.unref(h)?n.renderSlot(D.$slots,"default",{key:3,data:n.unref(h)}):n.createCommentVNode("",!0)}}}),Bt=n.defineComponent({__name:"SimpleChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},requestsLink:{},exploreLink:{}},setup(f){n.useCssVars(i=>({"088169ae":`${i.height}px`}));const e=f,t=n.computed(()=>e.chartOptions.type==="single_value");return(i,s)=>(n.openBlock(),n.createBlock(we,{context:i.context,query:i.query,"query-ready":i.queryReady,"refresh-counter":i.refreshCounter},{default:n.withCtx(({data:r})=>[n.createElementVNode("div",{class:n.normalizeClass(["analytics-chart",{"single-value":t.value}])},[n.createVNode(n.unref(Z.SimpleChart),{"chart-data":r,"chart-options":i.chartOptions,"synthetics-data-key":t.value?void 0:i.chartOptions.synthetics_data_key},null,8,["chart-data","chart-options","synthetics-data-key"])],2)]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),re=(f,e)=>{const t=f.__vccOpts||f;for(const[i,s]of e)t[i]=s;return t},et=re(Bt,[["__scopeId","data-v-1e9ff912"]]),$t={class:"analytics-chart"},Me=re(n.defineComponent({__name:"BaseAnalyticsChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},requestsLink:{},exploreLink:{},extraProps:{}},emits:["edit-tile","chart-data","zoom-time-range","view-requests","select-chart-range"],setup(f,{emit:e}){const t=f,i=e,{i18n:s}=se.useI18n(),{evaluateFeatureFlag:r}=se.useEvaluateFeatureFlag(),a=r("ma-4135-allow-zooming-all-dashboard-tiles",!1),o=n.computed(()=>({type:t.chartOptions.type,stacked:t.chartOptions.stacked??!1,chartDatasetColors:t.chartOptions.chart_dataset_colors,threshold:t.chartOptions.threshold})),d=n.computed(()=>a?t.context.zoomable:t.context.zoomable&&!t.query.time_range),h=()=>{i("edit-tile")},c=l=>{i("chart-data",l)};return(l,m)=>{const y=n.resolveComponent("KDropdownItem");return n.openBlock(),n.createBlock(we,{context:l.context,query:l.query,"query-ready":l.queryReady,"refresh-counter":l.refreshCounter,onChartData:c},{default:n.withCtx(({data:p})=>[n.createElementVNode("div",$t,[n.createVNode(n.unref(Z.AnalyticsChart),n.mergeProps({"chart-data":p,"chart-options":o.value,"explore-link":l.exploreLink,"legend-position":"bottom","requests-link":l.requestsLink,"synthetics-data-key":l.chartOptions.synthetics_data_key,"timeseries-zoom":d.value,"tooltip-title":""},l.extraProps,{onSelectChartRange:m[0]||(m[0]=_=>i("select-chart-range",_)),onZoomTimeRange:m[1]||(m[1]=_=>i("zoom-time-range",_))}),n.createSlots({_:2},[l.context.editable?{name:"menu-items",fn:n.withCtx(()=>[n.createVNode(y,{onClick:h},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.edit")),1)]),_:1})]),key:"0"}:void 0]),1040,["chart-data","chart-options","explore-link","requests-link","synthetics-data-key","timeseries-zoom"])])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-965790dd"]]),tt=n.defineComponent({__name:"BarChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},requestsLink:{},exploreLink:{}},setup(f){return(e,t)=>(n.openBlock(),n.createBlock(Me,{"chart-options":e.chartOptions,context:e.context,"extra-props":{showAnnotations:!1},height:e.height,query:e.query,"query-ready":e.queryReady,"refresh-counter":e.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),it=n.defineComponent({__name:"TimeseriesChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},requestsLink:{},exploreLink:{}},emits:["zoom-time-range","select-chart-range"],setup(f,{emit:e}){const t=e;return(i,s)=>(n.openBlock(),n.createBlock(Me,{"chart-options":i.chartOptions,context:i.context,"explore-link":i.exploreLink,height:i.height,query:i.query,"query-ready":i.queryReady,"refresh-counter":i.refreshCounter,"requests-link":i.requestsLink,onSelectChartRange:s[0]||(s[0]=r=>t("select-chart-range",r)),onZoomTimeRange:s[1]||(s[1]=r=>t("zoom-time-range",r))},null,8,["chart-options","context","explore-link","height","query","query-ready","refresh-counter","requests-link"]))}}),Gt={class:"metric-card-tile-wrapper"},Ft=re(n.defineComponent({__name:"GoldenSignalsRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},requestsLink:{},exploreLink:{}},setup(f){const e=f,t=n.computed(()=>{const s=e.context.timeSpec;if(s.type==="absolute")return new z.Timeframe({key:"custom",timeframeText:"custom",display:"custom",startCustom:s.start,endCustom:s.end,timeframeLength:()=>s.end.getTime()-s.start.getTime(),defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["free","plus","enterprise"]});const r=z.TimePeriods.get(s.time_range);if(!r)throw new Error("Unknown time range");return r}),i=n.computed(()=>{var r,a;const s=(r=e.query)==null?void 0:r.datasource;if(s&&s!=="api_usage"&&s!=="basic")throw new Error(`Invalid datasource value: ${s}`);return{datasource:(a=e.query)==null?void 0:a.datasource,overrideTimeframe:t.value,tz:e.context.tz,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}});return(s,r)=>(n.openBlock(),n.createElementBlock("div",Gt,[n.createVNode(n.unref(be.MetricsProvider),n.normalizeProps(n.guardReactiveProps(i.value)),{default:n.withCtx(()=>[n.createVNode(n.unref(be.MetricsConsumer))]),_:1},16)]))}}),[["__scopeId","data-v-7e1b1cc1"]]),st="#6c7489",Ut="12px",rt="20px",nt="20px",Wt={class:"fallback-entity-link","data-testid":"entity-link-parent"},ot=n.defineComponent({__name:"FallbackEntityLink",props:{entityLinkData:{}},setup(f){return(e,t)=>(n.openBlock(),n.createElementBlock("div",Wt,n.toDisplayString(e.entityLinkData.label),1))}}),Vt=n.defineComponent({__name:"TopNTableRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},requestsLink:{},exploreLink:{}},setup(f){const e=f,t=n.inject(ee),i=n.defineAsyncComponent(async()=>{if(t!=null&&t.fetchComponent)try{return await t.fetchComponent("EntityLink")}catch{return ot}return ot}),s=r=>{var a;if((a=e.chartOptions)!=null&&a.entity_link)if(r.id.includes(":")){const[o,d]=r.id.split(":");return e.chartOptions.entity_link.replace(Ke,o).replace(He,d)}else return e.chartOptions.entity_link.replace(He,r.id);return""};return(r,a)=>(n.openBlock(),n.createBlock(we,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:n.withCtx(({data:o})=>[n.createVNode(n.unref(Z.TopNTable),{data:o,"synthetics-data-key":r.chartOptions.synthetics_data_key},n.createSlots({_:2},[e.chartOptions.entity_link?{name:"name",fn:n.withCtx(({record:d})=>[n.createVNode(n.unref(i),{"entity-link-data":{id:d.id,label:d.name,deleted:d.deleted},"external-link":s(d)},null,8,["entity-link-data","external-link"])]),key:"0"}:void 0]),1032,["data","synthetics-data-key"])]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),Kt=n.defineComponent({__name:"DonutChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},requestsLink:{},exploreLink:{}},setup(f){return(e,t)=>(n.openBlock(),n.createBlock(Me,{"chart-options":e.chartOptions,context:e.context,height:e.height,query:e.query,"query-ready":e.queryReady,"refresh-counter":e.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),jt=["data-testid"],Yt={key:0,class:"tile-header"},Qt=["data-testid"],Xt={class:"badge-text"},Zt=["data-testid"],Jt={class:"delete-option"},ei=["data-testid"],ti=["data-testid"],ii=re(n.defineComponent({__name:"DashboardTile",props:{definition:{},context:{},height:{default:de},queryReady:{type:Boolean},refreshCounter:{},tileId:{}},emits:["edit-tile","duplicate-tile","remove-tile","tile-time-range-zoom"],setup(f,{emit:e}){n.useCssVars(b=>({"3d5e4dab":`${b.height}px`}));const t=parseInt(nt,10),i=f,s=e,r=n.defineAsyncComponent(()=>Promise.resolve().then(()=>mi)),a=n.inject(ee),o=a==null?void 0:a.evaluateFeatureFlagFn("analytics-chart-zoom-actions",!1),{i18n:d}=se.useI18n(),h=n.ref(),c=n.ref(!1),l=n.ref(),m=n.ref(!1),y=n.ref(void 0),p=n.ref(void 0),_=n.ref(!0),{exploreLinkKebabMenu:g,requestsLinkKebabMenu:D,canShowKebabMenu:E,canGenerateRequestsLink:x,canGenerateExploreLink:N,buildExploreQuery:R,buildExploreLink:T,buildRequestLink:O,buildRequestsQueryZoomActions:L}=se.useContextLinks({queryBridge:a,chartData:n.readonly(h),definition:n.readonly(n.toRef(i,"definition")),context:n.readonly(n.toRef(i,"context"))});n.watch(()=>i.definition,async()=>{await n.nextTick(),l.value&&(m.value=l.value.scrollWidth>l.value.clientWidth),_.value=!0},{immediate:!0,deep:!0});const P=n.computed(()=>d.t("csvExport.defaultFilename")),Y=n.computed(()=>E.value&&(ie.value||i.context.editable)||!!Pe.value),ie=n.computed(()=>!!g.value||"allow_csv_export"in i.definition.chart&&i.definition.chart.allow_csv_export||i.context.editable),ze={timeseries_line:it,timeseries_bar:it,horizontal_bar:tt,vertical_bar:tt,gauge:et,donut:Kt,golden_signals:Ft,top_n:Vt,slottable:void 0,single_value:et,choropleth_map:r},Se=n.computed(()=>{var b,A;return{...(b=ye.value)!=null&&b.rendererEvents.supportsRequests?{"select-chart-range":xi}:{},...(A=ye.value)!=null&&A.rendererEvents.supportsZoom?{"zoom-time-range":Ci}:{}}}),ye=n.computed(()=>{var K,F;const b=ze[i.definition.chart.type],A=!!((K=b==null?void 0:b.emits)!=null&&K.includes("select-chart-range")),M=!!((F=b==null?void 0:b.emits)!=null&&F.includes("zoom-time-range"));return b&&{component:b,rendererProps:{query:i.definition.query,context:i.context,queryReady:i.queryReady,chartOptions:i.definition.chart,height:i.height-t*2,refreshCounter:i.refreshCounter,requestsLink:y.value,exploreLink:p.value},rendererEvents:{supportsRequests:A,supportsZoom:M}}}),Pe=n.computed(()=>{var A;const b=(A=i.definition.query)==null?void 0:A.time_range;if((b==null?void 0:b.type)==="relative"){const M=z.TimePeriods.get(z.TIMEFRAME_LOOKUP[b.time_range]);return M?M.display:(console.warn("Did not recognize the given relative time range:",b.time_range),b.time_range)}else if((b==null?void 0:b.type)==="absolute"){const M=b.tz||"Etc/UTC";return`${z.formatTime(b.start,{short:!0,tz:M})} - ${z.formatTime(b.end,{short:!0,tz:M})}`}return null}),ct=n.computed(()=>h.value?z.msToGranularity(h.value.meta.granularity_ms):void 0),pi=n.computed(()=>["timeseries_line","timeseries_bar"].includes(i.definition.chart.type)),ut=n.computed(()=>{var A,M;if(!pi.value||!i.queryReady||_.value)return!1;const b=(M=(A=i.definition)==null?void 0:A.query)==null?void 0:M.granularity;return!b||!ct.value?!1:b!==ct.value}),gi=n.computed(()=>{var M,K,F;const b=z.msToGranularity(((M=h.value)==null?void 0:M.meta.granularity_ms)??0)??"unknown",A=((F=(K=i.definition)==null?void 0:K.query)==null?void 0:F.granularity)??"unknown";return d.t("query_aged_out_warning",{currentGranularity:d.t(`granularities.${b}`),savedGranularity:d.t(`granularities.${A}`)})}),yi=n.computed(()=>{var M,K;const b=[...i.context.filters,...i.definition.query.filters??[]],A=((K=(M=i.definition)==null?void 0:M.query)==null?void 0:K.datasource)??"api_usage";return b.filter(F=>z.getFieldDataSources(F.field).some(pt=>A===pt))}),_i=()=>{s("edit-tile",i.definition)},bi=()=>{s("duplicate-tile",i.definition)},vi=()=>{s("remove-tile",i.definition)},wi=b=>{h.value=b,_.value=!1},ft=b=>{c.value=b},Ei=()=>{ft(!0)},Ci=b=>{const A={tileId:i.tileId.toString(),timeRange:b};s("tile-time-range-zoom",A)},xi=b=>{const A=yi.value,M=L(b,A),K=R(b,A);y.value=x.value?{href:O(M)}:void 0,p.value=N.value?{href:T(K)}:void 0};return(b,A)=>{const M=n.resolveComponent("KTooltip"),K=n.resolveComponent("KBadge"),F=n.resolveComponent("KDropdownItem"),mt=n.resolveComponent("KDropdown");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["tile-boundary",{editable:b.context.editable}]),"data-testid":`tile-${b.tileId}`},[b.definition.chart.type!=="slottable"?(n.openBlock(),n.createElementBlock("div",Yt,[n.createVNode(M,{class:"title-tooltip",disabled:!m.value,"max-width":"500",text:b.definition.chart.chart_title},{default:n.withCtx(()=>[n.createElementVNode("div",{ref_key:"titleRef",ref:l,class:"title"},n.toDisplayString(b.definition.chart.chart_title),513)]),_:1},8,["disabled","text"]),Y.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"tile-actions","data-testid":`tile-actions-${b.tileId}`},[Pe.value?(n.openBlock(),n.createBlock(K,{key:0,"data-testid":"time-range-badge",tooltip:ut.value?gi.value:void 0,"tooltip-attributes":{maxWidth:"320px"}},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("span",Xt,n.toDisplayString(Pe.value),1)]),_:2},[ut.value?{name:"icon",fn:n.withCtx(()=>[n.createVNode(n.unref(ve.WarningIcon),{size:n.unref(Ut)},null,8,["size"])]),key:"0"}:void 0]),1032,["tooltip"])):n.createCommentVNode("",!0),n.unref(E)&&b.context.editable?(n.openBlock(),n.createBlock(n.unref(ve.EditIcon),{key:1,class:"edit-icon",color:n.unref(st),"data-testid":`edit-tile-${b.tileId}`,size:n.unref(rt),onClick:_i},null,8,["color","data-testid","size"])):n.createCommentVNode("",!0),n.unref(E)&&ie.value?(n.openBlock(),n.createBlock(mt,{key:2,class:"dropdown","data-testid":`chart-action-menu-${b.tileId}`,"kpop-attributes":{placement:"bottom-end"}},{items:n.withCtx(()=>[n.unref(g)?(n.openBlock(),n.createBlock(F,{key:0,"data-testid":`chart-jump-to-explore-${b.tileId}`,item:{label:n.unref(d).t("jumpToExplore"),to:n.unref(g)}},null,8,["data-testid","item"])):n.createCommentVNode("",!0),n.unref(o)&&n.unref(D)?(n.openBlock(),n.createBlock(F,{key:1,"data-testid":`chart-jump-to-requests-${b.tileId}`,item:{label:n.unref(d).t("jumpToRequests"),to:n.unref(D)}},null,8,["data-testid","item"])):n.createCommentVNode("",!0),!("allow_csv_export"in b.definition.chart)||b.definition.chart.allow_csv_export?(n.openBlock(),n.createBlock(F,{key:2,class:"chart-export-button","data-testid":`chart-csv-export-${b.tileId}`,onClick:A[0]||(A[0]=pt=>Ei())},{default:n.withCtx(()=>[n.createElementVNode("span",{class:"chart-export-trigger","data-testid":`csv-export-button-${b.tileId}`},n.toDisplayString(n.unref(d).t("csvExport.exportAsCsv")),9,Zt)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0),b.context.editable?(n.openBlock(),n.createBlock(F,{key:3,"data-testid":`duplicate-tile-${b.tileId}`,onClick:bi},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(d).t("renderer.duplicateTile")),1)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0),b.context.editable?(n.openBlock(),n.createBlock(F,{key:4,"data-testid":`remove-tile-${b.tileId}`,onClick:vi},{default:n.withCtx(()=>[n.createElementVNode("span",Jt,n.toDisplayString(n.unref(d).t("renderer.delete")),1)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0)]),default:n.withCtx(()=>[n.createVNode(n.unref(ve.MoreIcon),{class:"kebab-action-menu",color:n.unref(st),"data-testid":`kebab-action-menu-${b.tileId}`,size:n.unref(rt)},null,8,["color","data-testid","size"])]),_:1},8,["data-testid"])):n.createCommentVNode("",!0)],8,Qt)):"description"in b.definition.chart?(n.openBlock(),n.createElementBlock("div",{key:1,class:"header-description","data-testid":`tile-description-${b.tileId}`},n.toDisplayString(b.definition.chart.description),9,ei)):n.createCommentVNode("",!0),c.value?(n.openBlock(),n.createBlock(n.unref(Z.CsvExportModal),{key:2,"chart-data":h.value,"data-testid":`csv-export-modal-${b.tileId}`,filename:P.value,onToggleModal:ft},null,8,["chart-data","data-testid","filename"])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:"tile-content","data-testid":`tile-content-${b.tileId}`},[ye.value?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(ye.value.component),n.mergeProps({key:0},ye.value.rendererProps,n.toHandlers(Se.value),{onChartData:wi}),null,16)):n.createCommentVNode("",!0)],8,ti)],10,jt)}}}),[["__scopeId","data-v-7a51e777"]]),si=(f,e)=>{let t=0;const i=new Map;e.forEach(r=>{const a=r.layout.position.row,o=i.get(a),d=r.layout.size.rows===1&&!!r.layout.size.fit_to_content;t=Math.max(t,a+r.layout.size.rows),o===void 0?i.set(a,d):i.set(a,o&&d)});const s=[];for(let r=0;r<t;r++)i.get(r)?s.push("auto"):s.push(`${f}px`);return s},at=re(n.defineComponent({__name:"GridLayout",props:{tileHeight:{type:Number,required:!1,default:()=>de},tiles:{type:Array,required:!0}},setup(f){n.useCssVars(o=>({"2a38e79e":n.unref(Ae),"4cc71de6":r.value}));const e=f,t=n.ref(null),i=n.ref(0),s=new ResizeObserver(o=>{window.requestAnimationFrame(()=>{!Array.isArray(o)||!o.length||(i.value=o[0].contentRect.width)})});n.onMounted(()=>{t.value&&s.observe(t.value)}),n.onUnmounted(()=>{t.value&&s.unobserve(t.value)});const r=n.computed(()=>si(e.tileHeight,e.tiles).join(" ")),a=n.computed(()=>e.tiles.map((o,d)=>({key:`tile-${d}`,tile:o,style:{"grid-column-start":o.layout.position.col+1,"grid-column-end":o.layout.position.col+1+o.layout.size.cols,"grid-row-start":o.layout.position.row+1,"grid-row-end":o.layout.position.row+1+o.layout.size.rows}})));return(o,d)=>(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(a.value,h=>(n.openBlock(),n.createElementBlock("div",{key:h.key,class:n.normalizeClass(["grid-cell",{"empty-cell":!h.tile}]),style:n.normalizeStyle(h.style)},[n.renderSlot(o.$slots,"tile",{style:n.normalizeStyle(h.style),tile:h.tile},void 0,!0)],6))),128))],512))}}),[["__scopeId","data-v-354b7177"]]);function ri(f,e,t,i,s){const r=(...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(f,a));return r.prototype=e.prototype,r}class u{static getElements(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(i&&!isNaN(+e[0])){const r=i.getElementById(e);return r?[r]:[]}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){var t,i;return e.lazyLoad||((i=(t=e.grid)==null?void 0:t.opts)==null?void 0:i.lazyLoad)&&e.lazyLoad!==!1}static createDiv(e,t){const i=document.createElement("div");return e.forEach(s=>{s&&i.classList.add(s)}),t==null||t.appendChild(i),i}static shouldSizeToContent(e,t=!1){return(e==null?void 0: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 u.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 r=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<=r?0:(s-i)*(a-r)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((s,r)=>{const a=t*((s.y??1e4)-(r.y??1e4));return a===0?t*((s.x??1e4)-(r.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"),r=i==null?void 0:i.nonce;return r&&(s.nonce=r),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],r=t[i];i[0]==="_"||s===r?delete e[i]:s&&typeof s=="object"&&r!==void 0&&(u.removeInternalAndSame(s,r),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(),r=window.innerHeight||document.documentElement.clientHeight;if(s.top<0||s.bottom>r){const a=s.bottom-r,o=s.top,d=this.getScrollElement(e);if(d!==null){const h=d.scrollTop;s.top<0&&i<0?e.offsetHeight>r?d.scrollTop+=i:d.scrollTop+=Math.abs(o)>Math.abs(i)?i:o:i>0&&(e.offsetHeight>r?d.scrollTop+=i:d.scrollTop+=a>i?i:a),t.top+=d.scrollTop-h}}}static updateScrollResize(e,t,i){const s=this.getScrollElement(t),r=s.clientHeight,a=s===this.getScrollElement()?0:s.getBoundingClientRect().top,o=e.clientY-a,d=o<i,h=o>r-i;d?s.scrollBy({behavior:"smooth",top:o-i}):h&&s.scrollBy({behavior:"smooth",top:i-(r-o)})}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=u.clone(e);for(const s in i)i.hasOwnProperty(s)&&typeof i[s]=="object"&&s.substring(0,2)!=="__"&&!t.find(r=>r===s)&&(i[s]=u.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=u.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(r=>i[r]=e[r]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(r=>i[r]=e[r]),{...i,...s}}static simulateMouseEvent(e,t,i){const s=e,r=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(r)}static getValuesFromTransformedElement(e){const t=document.createElement("div");u.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){var t;return!(!e||e.w===e.h||e.locked||e.noResize||(t=e.grid)!=null&&t.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class Q{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 r=t;!this._loading&&this._useEntireRowArea(e,t)&&(r={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,r,s.skip));let a=!1;const o={nested:!0,pack:!1};let d=0;for(;i=i||this.collide(e,r,s.skip);){if(d++>this.nodes.length*2)throw new Error("Infinite collide check");let h;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 c={...t,y:i.y+i.h,...o};h=this._loading&&u.samePos(e,c)?!0:this.moveNode(e,c),(i.locked||this._loading)&&h?u.copyPos(t,e):!i.locked&&h&&s.pack&&(this._packNodes(),t.y=i.y+i.h,u.copyPos(e,t)),a=a||h}else h=this.moveNode(i,{...i,y:t.y+t.h,skip:e,...o});if(!h)return a;i=void 0}return a}collide(e,t=e,i){const s=e._id,r=i==null?void 0:i._id;return this.nodes.find(a=>a._id!==s&&a._id!==r&&u.isIntercepted(a,t))}collideAll(e,t=e,i){const s=e._id,r=i==null?void 0:i._id;return this.nodes.filter(a=>a._id!==s&&a._id!==r&&u.isIntercepted(a,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const s=e._rect,r={...t.rect};r.y>s.y?(r.h+=r.y-s.y,r.y=s.y):r.h+=s.y-r.y,r.x>s.x?(r.w+=r.x-s.x,r.x=s.x):r.w+=s.x-r.x;let a,o=.5;for(let d of i){if(d.locked||!d._rect)break;const h=d._rect;let c=Number.MAX_VALUE,l=Number.MAX_VALUE;s.y<h.y?c=(r.y+r.h-h.y)/h.h:s.y+s.h>h.y+h.h&&(c=(h.y+h.h-r.y)/h.h),s.x<h.x?l=(r.x+r.w-h.x)/h.w:s.x+s.w>h.x+h.w&&(l=(h.x+h.w-r.x)/h.w);const m=Math.min(l,c);m>o&&(o=m,a=d)}return t.collide=a,a}cacheRects(e,t,i,s,r,a){return this.nodes.forEach(o=>o._rect={y:o.y*t+i,x:o.x*e+a,w:o.w*e-a-s,h:o.h*t-i-r}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const r=t.x,a=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=r,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=a):(e.x=r,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=u.isTouching(e,t)))return i();if(s!==!1){if(e.w===t.w&&e.x===t.x&&(s||(s=u.isTouching(e,t)))){if(t.y<e.y){const r=e;e=t,t=r}return i()}if(s!==!1){if(e.h===t.h&&e.y===t.y&&(s||(s=u.isTouching(e,t)))){if(t.x<e.x){const r=e;e=t,t=r}return i()}return!1}}}isAreaEmpty(e,t,i,s){const r={x:e||0,y:t||0,w:i||1,h:s||1};return!this.collide(r)}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 r=this.nodes;return this.nodes=[],r.forEach((a,o,d)=>{let h;a.locked||(a.autoPosition=!0,e==="list"&&o&&(h=d[o-1])),this.addNode(a,!1,h)}),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=u.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??Q._idSeq++;const i=e.id;if(i){let r=1;for(;this.nodes.find(a=>a.id===e.id&&a!==e);)e.id=i+"_"+r++}(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 u.defaults(e,s),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,u.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||u.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 r={...e};r.autoPosition||r.x===void 0?(delete r.x,delete r.y):r.x=Math.min(this.defaultColumn-1,r.x),r.w=Math.min(this.defaultColumn,r.w||1),this.cacheOneLayout(r,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),u.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!u.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=u.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||u.samePos(e,e._orig)||(u.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,s){const r=s?s.y*i+(s.x+s.w):0;let a=!1;for(let o=r;!a;++o){const d=o%i,h=Math.floor(o/i);if(d+e.w>i)continue;const c={x:d,y:h,w:e.w,h:e.h};t.find(l=>u.isIntercepted(c,l))||((e.x!==d||e.y!==h)&&(e._dirty=!0),e.x=d,e.y=h,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 r;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,r=!0),this.nodes.push(e),t&&this.addedNodes.push(e),r||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 Q({column:this.column,float:this.float,nodes:this.nodes.map(a=>a._id===e._id?(i={...a},i):{...a})});if(!i)return!1;const r=s.moveNode(i,t)&&s.getRow()<=Math.max(this.getRow(),this.maxRow);if(!r&&!t.resizing&&t.collide){const a=t.collide.el.gridstackNode;if(this.swap(e,a))return this._notify(),!0}return r?(s.nodes.filter(a=>a._dirty).forEach(a=>{const o=this.nodes.find(d=>d._id===a._id);o&&(u.copyPos(o,a),o._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new Q({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=u.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){var h,c;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,r=u.copyPos({},e,!0);if(u.copyPos(r,t),this.nodeBoundFix(r,s),u.copyPos(t,r),!t.forceCollide&&u.samePos(e,t))return!1;const a=u.copyPos({},e),o=this.collideAll(e,r,t.skip);let d=!0;if(o.length){const l=e._moving&&!t.nested;let m=l?this.directionCollideCoverage(e,t,o):o[0];if(l&&m&&((c=(h=e.grid)==null?void 0:h.opts)!=null&&c.subGridDynamic)&&!e.grid._isTemp){const y=u.areaIntercept(t.rect,m._rect),p=u.area(t.rect),_=u.area(m._rect);y/(p<_?p:_)>.8&&(m.grid.makeSubGrid(m.el,void 0,e),m=void 0)}m?d=!this._fixCollisions(e,r,m,t):(d=!1,i&&delete t.pack)}return d&&!u.samePos(e,r)&&(e._dirty=!0,u.copyPos(e,r)),t.pack&&this._packNodes()._notify(),!u.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){var a;const i=(a=this._layouts)==null?void 0:a.length,s=i&&this.column!==i-1?this._layouts[i-1]:null,r=[];return this.sortNodes(),this.nodes.forEach(o=>{const d=s==null?void 0:s.find(c=>c._id===o._id),h={...o,...d||{}};u.removeInternalForSave(h,!e),t&&t(o,h),r.push(h)}),r}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(r=>{if(!r._orig)return;const a=t.find(o=>o._id===r._id);a&&(a.y>=0&&r.y!==r._orig.y&&(a.y+=r.y-r._orig.y),r.x!==r._orig.x&&(a.x=Math.round(r.x*s)),r.w!==r._orig.w&&(a.w=Math.round(r.w*s)))})}}),this)}columnChanged(e,t,i="moveScale"){var o;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 r=[],a=s?this.nodes:u.sort(this.nodes,-1);if(t>e&&this._layouts){const d=this._layouts[t]||[],h=this._layouts.length-1;!d.length&&e!==h&&((o=this._layouts[h])!=null&&o.length)&&(e=h,this._layouts[h].forEach(c=>{const l=a.find(m=>m._id===c._id);l&&(!s&&!c.autoPosition&&(l.x=c.x??l.x,l.y=c.y??l.y),l.w=c.w??l.w,(c.x==null||c.y===void 0)&&(l.autoPosition=!0))})),d.forEach(c=>{const l=a.findIndex(m=>m._id===c._id);if(l!==-1){const m=a[l];if(s){m.w=c.w;return}(c.autoPosition||isNaN(c.x)||isNaN(c.y))&&this.findEmptyPosition(c,r),c.autoPosition||(m.x=c.x??m.x,m.y=c.y??m.y,m.w=c.w??m.w,r.push(m)),a.splice(l,1)}})}if(s)this.compact(i,!1);else{if(a.length)if(typeof i=="function")i(t,e,r,a);else{const d=s||i==="none"?1:t/e,h=i==="move"||i==="moveScale",c=i==="scale"||i==="moveScale";a.forEach(l=>{l.x=t===1?0:h?Math.round(l.x*d):Math.min(l.x,t-1),l.w=t===1||e===1?1:c?Math.round(l.w*d)||1:Math.min(l.w,t),r.push(l)}),a=[]}r=u.sort(r,-1),this._inColumnResize=!0,this.nodes=[],r.forEach(d=>{this.addNode(d,!1),delete d._orig})}return this.nodes.forEach(d=>delete d._orig),this.batchUpdate(!1,!s),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const s=[];return e.forEach((r,a)=>{if(r._id===void 0){const o=r.id?this.nodes.find(d=>d.id===r.id):void 0;r._id=(o==null?void 0:o._id)??Q._idSeq++}s[a]={x:r.x,y:r.y,w:r.w,_id:r._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=s,this}cacheOneLayout(e,t){e._id=e._id??Q._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){var i,s;return((s=(i=this._layouts)==null?void 0:i[t])==null?void 0:s.findIndex(r=>r._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}}Q._idSeq=0;const G={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 k{}const j=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 X{}function Ee(f,e){f.touches.length>1||(f.cancelable&&f.preventDefault(),u.simulateMouseEvent(f.changedTouches[0],e))}function lt(f,e){f.cancelable&&f.preventDefault(),u.simulateMouseEvent(f,e)}function Ce(f){X.touchHandled||(X.touchHandled=!0,Ee(f,"mousedown"))}function xe(f){X.touchHandled&&Ee(f,"mousemove")}function ke(f){if(!X.touchHandled)return;X.pointerLeaveTimeout&&(window.clearTimeout(X.pointerLeaveTimeout),delete X.pointerLeaveTimeout);const e=!!k.dragElement;Ee(f,"mouseup"),e||Ee(f,"click"),X.touchHandled=!1}function Re(f){f.pointerType!=="mouse"&&f.target.releasePointerCapture(f.pointerId)}function ht(f){k.dragElement&&f.pointerType!=="mouse"&<(f,"mouseenter")}function dt(f){k.dragElement&&f.pointerType!=="mouse"&&(X.pointerLeaveTimeout=window.setTimeout(()=>{delete X.pointerLeaveTimeout,lt(f,"mouseleave")},10))}class Te{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(`${Te.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),j&&(this.el.addEventListener("touchstart",Ce),this.el.addEventListener("pointerdown",Re)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),j&&(this.el.removeEventListener("touchstart",Ce),this.el.removeEventListener("pointerdown",Re)),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),j&&(this.el.addEventListener("touchmove",xe),this.el.addEventListener("touchend",ke)),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),j&&(this.el.removeEventListener("touchmove",xe),this.el.removeEventListener("touchend",ke)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){var t,i;e.key==="Escape"&&((i=(t=this.host.gridstackNode)==null?void 0:t.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}Te.prefix="ui-resizable-";class Ie{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 ce extends Ie{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const s=this.el.parentElement.getBoundingClientRect(),r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},a=this.temporalRect||r;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),k.overResizeElement===this&&delete k.overResizeElement),this}_mouseOver(e){k.overResizeElement||k.dragElement||(k.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){k.overResizeElement===this&&(delete k.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Te(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=u.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=u.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=u.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=u.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=u.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=ce._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,t=u.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 ce._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},r=e.clientX-i.clientX,a=this.sizeToContent?0:e.clientY-i.clientY;let o,d;t.indexOf("e")>-1?s.width+=r:t.indexOf("w")>-1&&(s.width-=r,s.left+=r,o=!0),t.indexOf("s")>-1?s.height+=a:t.indexOf("n")>-1&&(s.height-=a,s.top+=a,d=!0);const h=this._constrainSize(s.width,s.height,o,d);return Math.round(s.width)!==Math.round(h.width)&&(t.indexOf("w")>-1&&(s.left+=s.width-h.width),s.width=h.width),Math.round(s.height)!==Math.round(h.height)&&(t.indexOf("n")>-1&&(s.top+=s.height-h.height),s.height=h.height),s}_constrainSize(e,t,i,s){const r=this.option,a=(i?r.maxWidthMoveLeft:r.maxWidth)||Number.MAX_SAFE_INTEGER,o=r.minWidth/this.rectScale.x||e,d=(s?r.maxHeightMoveUp:r.maxHeight)||Number.MAX_SAFE_INTEGER,h=r.minHeight/this.rectScale.y||t,c=Math.min(a,Math.max(o,e)),l=Math.min(d,Math.max(h,t));return{width:c,height:l}}_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}}ce._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const ni='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class ue extends Ie{constructor(e,t={}){var r;super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=(r=t==null?void 0:t.handle)==null?void 0:r.substring(1),s=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:s!=null&&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),j&&(e.addEventListener("touchstart",Ce),e.addEventListener("pointerdown",Re))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),j&&(t.removeEventListener("touchstart",Ce),t.removeEventListener("pointerdown",Re))}),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(!k.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(ni)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete k.dragElement,delete k.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),j&&(e.currentTarget.addEventListener("touchmove",xe),e.currentTarget.addEventListener("touchend",ke)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),k.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=u.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(e){var i;const t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),k.pauseDrag){const s=Number.isInteger(k.pauseDrag)?k.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),s)}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=!0,k.dragElement=this;const s=(i=this.el.gridstackNode)==null?void 0:i.grid;s?k.dropElement=s.el.ddElement.ddDroppable:delete k.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=u.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const r=u.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){var t,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),j&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",xe,!0),e.currentTarget.removeEventListener("touchend",ke,!0)),this.dragging){delete this.dragging,(t=this.el.gridstackNode)==null||delete t._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=k.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete k.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const s=u.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(s),this.triggerEvent("dragstop",s),k.dropElement&&k.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete k.dragElement,delete k.dropElement,delete k.mouseHandled,e.preventDefault()}_keyEvent(e){var s,r;const t=this.el.gridstackNode,i=(t==null?void 0:t.grid)||((r=(s=k.dropElement)==null?void 0:s.el)==null?void 0:r.gridstack);if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!u.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",u.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=u.cloneNode(this.el)),e.parentElement||u.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=ue.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(){var t;this.helper.classList.remove("ui-draggable-dragging");const e=(t=this.helper)==null?void 0:t.gridstackNode;if(!(e!=null&&e._isAboutToRemove)&&this.dragElementOriginStyle){const i=this.helper,s=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",ue.originStyleProp.forEach(r=>i.style[r]=this.dragElementOriginStyle[r]||null),setTimeout(()=>i.style.transition=s,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,r=0;i&&(s=this.dragTransform.xOffset,r=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-r,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}}}}ue.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class oi extends Ie{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),j&&(this.el.addEventListener("pointerenter",ht),this.el.addEventListener("pointerleave",dt)))}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),j&&(this.el.removeEventListener("pointerenter",ht),this.el.removeEventListener("pointerleave",dt)))}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(!k.dragElement||!this._canDrop(k.dragElement.el))return;e.preventDefault(),e.stopPropagation(),k.dropElement&&k.dropElement!==this&&k.dropElement._mouseLeave(e,!0),k.dropElement=this;const t=u.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(k.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){var s;if(!k.dragElement||k.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const i=u.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(k.dragElement)),this.triggerEvent("dropout",i),k.dropElement===this&&(delete k.dropElement,!t)){let r,a=this.el.parentElement;for(;!r&&a;)r=(s=a.ddElement)==null?void 0:s.ddDroppable,a=a.parentElement;r&&r._mouseEnter(e)}}drop(e){e.preventDefault();const t=u.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(k.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 qe{static init(e){return e.ddElement||(e.ddElement=new qe(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 ue(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 ce(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 oi(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class ai{resizable(e,t,i,s){return this._getDDElements(e,t).forEach(r=>{if(t==="disable"||t==="enable")r.ddResizable&&r.ddResizable[t]();else if(t==="destroy")r.ddResizable&&r.cleanResizable();else if(t==="option")r.setupResizable({[i]:s});else{const o=r.el.gridstackNode.grid;let d=r.el.getAttribute("gs-resize-handles")||o.opts.resizable.handles||"e,s,se";d==="all"&&(d="n,e,s,w,se,sw,ne,nw");const h=!o.opts.alwaysShowResizeHandle;r.setupResizable({...o.opts.resizable,handles:d,autoHide:h,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,s){return this._getDDElements(e,t).forEach(r=>{if(t==="disable"||t==="enable")r.ddDraggable&&r.ddDraggable[t]();else if(t==="destroy")r.ddDraggable&&r.cleanDraggable();else if(t==="option")r.setupDraggable({[i]:s});else{const a=r.el.gridstackNode.grid;r.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=r=>t._accept(r)),this._getDDElements(e,t).forEach(r=>{t==="disable"||t==="enable"?r.ddDroppable&&r.ddDroppable[t]():t==="destroy"?r.ddDroppable&&r.cleanDroppable():t==="option"?r.setupDroppable({[i]:s}):r.setupDroppable(t)}),this}isDroppable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(s=>s.on(t,r=>{i(r,k.dragElement?k.dragElement.el:r.target,k.dragElement?k.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=u.getElements(e);return s.length?s.map(a=>a.ddElement||(i?qe.init(a):null)).filter(a=>a):[]}}/*!
|
|
1
|
+
(function(C,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("@kong-ui-public/analytics-utilities"),require("@kong-ui-public/analytics-chart"),require("@kong-ui-public/analytics-metric-provider"),require("@kong/icons"),require("@kong-ui-public/analytics-config-store"),require("swrv"),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-ui-public/analytics-chart","@kong-ui-public/analytics-metric-provider","@kong/icons","@kong-ui-public/analytics-config-store","swrv","axios","@kong-ui-public/i18n","@kong-ui-public/analytics-geo-map"],n):(C=typeof globalThis<"u"?globalThis:C||self,n(C["kong-ui-public-dashboard-renderer"]={},C.Vue,C["kong-ui-public-analytics-utilities"],C["kong-ui-public-analytics-chart"],C["kong-ui-public-analytics-metric-provider"],C.KongIcons,C["kong-ui-public-analytics-config-store"],C.swrv,C.axios,C["kong-ui-public-i18n"],C["kong-ui-public-analytics-geo-map"]))})(this,function(C,n,z,Z,be,ve,Fe,xt,Ti,Ue,We){"use strict";var ki=Object.defineProperty;var gt=C=>{throw TypeError(C)};var Ri=(C,n,z)=>n in C?ki(C,n,{enumerable:!0,configurable:!0,writable:!0,value:z}):C[n]=z;var yt=(C,n,z)=>Ri(C,typeof n!="symbol"?n+"":n,z),Be=(C,n,z)=>n.has(C)||gt("Cannot "+z);var v=(C,n,z)=>(Be(C,n,"read from private field"),z?z.call(C):n.get(C)),I=(C,n,z)=>n.has(C)?gt("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(C):n.set(C,z),H=(C,n,z,Z)=>(Be(C,n,"write to private field"),Z?Z.call(C,z):n.set(C,z),z),q=(C,n,z)=>(Be(C,n,"access private method"),z);var _e=(C,n,z,Z)=>({set _(be){H(C,n,be,z)},get _(){return v(C,n,Z)}});var U,ne,oe,te,fe,ae,me,W,le,$,pe,V,he,J,ge,De,S,_t,bt,vt,wt,Et,Ne,$e,Ge,Le,Ct,Oe;var Ve=(f=>(f.VALIDATING="VALIDATING",f.VALIDATING_HAS_DATA="VALIDATING_HAS_DATA",f.PENDING="PENDING",f.SUCCESS="SUCCESS",f.SUCCESS_HAS_DATA="SUCCESS_HAS_DATA",f.ERROR="ERROR",f.STALE_IF_ERROR="STALE_IF_ERROR",f))(Ve||{});const kt=f=>{var e,t,i,s,r;return f?!!((e=Object.keys(f))!=null&&e.length||(t=f.data)!=null&&t.length||(s=(i=f.data)==null?void 0:i.data)!=null&&s.length||!((r=f.data)!=null&&r.data)&&typeof f.data=="object"&&Object.keys(f==null?void 0:f.data).length):!1};function Rt(f=n.ref({}),e,t,i=kt){const s=n.ref("PENDING");return n.watchEffect(()=>{const r=i(f.value);if(f.value&&r&&t.value){s.value="VALIDATING_HAS_DATA";return}if(f.value&&t.value){s.value="VALIDATING";return}if(f.value&&e.value){s.value="STALE_IF_ERROR";return}if(f.value===void 0&&!e.value){s.value="PENDING";return}if(f.value&&!e.value&&r){s.value="SUCCESS_HAS_DATA";return}if(f.value&&!e.value){s.value="SUCCESS";return}f.value===void 0&&e&&(s.value="ERROR")}),{state:s,swrvState:Ve}}const Tt={renderer:{noQueryBridge:"No query bridge provided. Unable to render dashboard.",trendRange:{"24h":"Last 24-hour summary","7d":"Last 7-day summary","30d":"Last 30-day summary"},edit:"Edit",duplicateTile:"Duplicate",remove:"Remove",delete:"Delete"},queryDataProvider:{forbidden:"To access this data, either filter for an entity you have access to or request analytics viewer access from your administrator.",timeRangeExceeded:"The time range for this report is outside of your organization's data retention period",timeout:"Query timed out. Consider querying a shorter time range."},csvExport:{defaultFilename:"Chart export",exportAsCsv:"Export as CSV"},jumpToExplore:"Explore",jumpToRequests:"View requests",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 Dt(){const f=Ue.createI18n("en-us",Tt);return{i18n:f,i18nT:Ue.i18nTComponent(f)}}const de=170,Ae=6,ee="analytics-query-provider",He="{entity-id}",Ke="{cp-id}",je="{timeframe}",Ye=30*1e3;function zt(){const f=n.inject(ee);return{evaluateFeatureFlag:(t,i)=>f?f.evaluateFeatureFlagFn(t,i):i}}function St(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}var Qe={exports:{}};(function(f){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function s(d,h,c){this.fn=d,this.context=h,this.once=c||!1}function r(d,h,c,l,m){if(typeof c!="function")throw new TypeError("The listener must be a function");var y=new s(c,l||d,m),p=t?t+h:h;return d._events[p]?d._events[p].fn?d._events[p]=[d._events[p],y]:d._events[p].push(y):(d._events[p]=y,d._eventsCount++),d}function a(d,h){--d._eventsCount===0?d._events=new i:delete d._events[h]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var h=[],c,l;if(this._eventsCount===0)return h;for(l in c=this._events)e.call(c,l)&&h.push(t?l.slice(1):l);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(c)):h},o.prototype.listeners=function(h){var c=t?t+h:h,l=this._events[c];if(!l)return[];if(l.fn)return[l.fn];for(var m=0,y=l.length,p=new Array(y);m<y;m++)p[m]=l[m].fn;return p},o.prototype.listenerCount=function(h){var c=t?t+h:h,l=this._events[c];return l?l.fn?1:l.length:0},o.prototype.emit=function(h,c,l,m,y,p){var _=t?t+h:h;if(!this._events[_])return!1;var g=this._events[_],D=arguments.length,E,x;if(g.fn){switch(g.once&&this.removeListener(h,g.fn,void 0,!0),D){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,c),!0;case 3:return g.fn.call(g.context,c,l),!0;case 4:return g.fn.call(g.context,c,l,m),!0;case 5:return g.fn.call(g.context,c,l,m,y),!0;case 6:return g.fn.call(g.context,c,l,m,y,p),!0}for(x=1,E=new Array(D-1);x<D;x++)E[x-1]=arguments[x];g.fn.apply(g.context,E)}else{var N=g.length,R;for(x=0;x<N;x++)switch(g[x].once&&this.removeListener(h,g[x].fn,void 0,!0),D){case 1:g[x].fn.call(g[x].context);break;case 2:g[x].fn.call(g[x].context,c);break;case 3:g[x].fn.call(g[x].context,c,l);break;case 4:g[x].fn.call(g[x].context,c,l,m);break;default:if(!E)for(R=1,E=new Array(D-1);R<D;R++)E[R-1]=arguments[R];g[x].fn.apply(g[x].context,E)}}return!0},o.prototype.on=function(h,c,l){return r(this,h,c,l,!1)},o.prototype.once=function(h,c,l){return r(this,h,c,l,!0)},o.prototype.removeListener=function(h,c,l,m){var y=t?t+h:h;if(!this._events[y])return this;if(!c)return a(this,y),this;var p=this._events[y];if(p.fn)p.fn===c&&(!m||p.once)&&(!l||p.context===l)&&a(this,y);else{for(var _=0,g=[],D=p.length;_<D;_++)(p[_].fn!==c||m&&!p[_].once||l&&p[_].context!==l)&&g.push(p[_]);g.length?this._events[y]=g.length===1?g[0]:g:a(this,y)}return this},o.prototype.removeAllListeners=function(h){var c;return h?(c=t?t+h:h,this._events[c]&&a(this,c)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,f.exports=o})(Qe);var Nt=Qe.exports;const Lt=St(Nt);class Xe extends Error{constructor(e){super(e),this.name="TimeoutError"}}class Ot extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const Ze=f=>globalThis.DOMException===void 0?new Ot(f):new DOMException(f),Je=f=>{const e=f.reason===void 0?Ze("This operation was aborted."):f.reason;return e instanceof Error?e:Ze(e)};function At(f,e){const{milliseconds:t,fallback:i,message:s,customTimers:r={setTimeout,clearTimeout}}=e;let a,o;const h=new Promise((c,l)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(e.signal){const{signal:y}=e;y.aborted&&l(Je(y)),o=()=>{l(Je(y))},y.addEventListener("abort",o,{once:!0})}if(t===Number.POSITIVE_INFINITY){f.then(c,l);return}const m=new Xe;a=r.setTimeout.call(void 0,()=>{if(i){try{c(i())}catch(y){l(y)}return}typeof f.cancel=="function"&&f.cancel(),s===!1?c():s instanceof Error?l(s):(m.message=s??`Promise timed out after ${t} milliseconds`,l(m))},t),(async()=>{try{c(await f)}catch(y){l(y)}})()}).finally(()=>{h.clear(),o&&e.signal&&e.signal.removeEventListener("abort",o)});return h.clear=()=>{r.clearTimeout.call(void 0,a),a=void 0},h}function Ht(f,e,t){let i=0,s=f.length;for(;s>0;){const r=Math.trunc(s/2);let a=i+r;t(f[a],e)<=0?(i=++a,s-=r+1):s=r}return i}class Mt{constructor(){I(this,U,[])}enqueue(e,t){t={priority:0,...t};const i={priority:t.priority,id:t.id,run:e};if(this.size===0||v(this,U)[this.size-1].priority>=t.priority){v(this,U).push(i);return}const s=Ht(v(this,U),i,(r,a)=>a.priority-r.priority);v(this,U).splice(s,0,i)}setPriority(e,t){const i=v(this,U).findIndex(r=>r.id===e);if(i===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);const[s]=v(this,U).splice(i,1);this.enqueue(s.run,{priority:t,id:e})}dequeue(){const e=v(this,U).shift();return e==null?void 0:e.run}filter(e){return v(this,U).filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return v(this,U).length}}U=new WeakMap;class It extends Lt{constructor(t){var i,s;super();I(this,S);I(this,ne);I(this,oe);I(this,te,0);I(this,fe);I(this,ae);I(this,me,0);I(this,W);I(this,le);I(this,$);I(this,pe);I(this,V,0);I(this,he);I(this,J);I(this,ge);I(this,De,1n);yt(this,"timeout");if(t={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:Mt,...t},!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${((i=t.intervalCap)==null?void 0:i.toString())??""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${((s=t.interval)==null?void 0:s.toString())??""}\` (${typeof t.interval})`);H(this,ne,t.carryoverConcurrencyCount),H(this,oe,t.intervalCap===Number.POSITIVE_INFINITY||t.interval===0),H(this,fe,t.intervalCap),H(this,ae,t.interval),H(this,$,new t.queueClass),H(this,pe,t.queueClass),this.concurrency=t.concurrency,this.timeout=t.timeout,H(this,ge,t.throwOnTimeout===!0),H(this,J,t.autoStart===!1)}get concurrency(){return v(this,he)}set concurrency(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);H(this,he,t),q(this,S,Le).call(this)}setPriority(t,i){v(this,$).setPriority(t,i)}async add(t,i={}){return i.id??(i.id=(_e(this,De)._++).toString()),i={timeout:this.timeout,throwOnTimeout:v(this,ge),...i},new Promise((s,r)=>{v(this,$).enqueue(async()=>{var a;_e(this,V)._++,_e(this,te)._++;try{(a=i.signal)==null||a.throwIfAborted();let o=t({signal:i.signal});i.timeout&&(o=At(Promise.resolve(o),{milliseconds:i.timeout})),i.signal&&(o=Promise.race([o,q(this,S,Ct).call(this,i.signal)]));const d=await o;s(d),this.emit("completed",d)}catch(o){if(o instanceof Xe&&!i.throwOnTimeout){s();return}r(o),this.emit("error",o)}finally{q(this,S,vt).call(this)}},i),this.emit("add"),q(this,S,Ne).call(this)})}async addAll(t,i){return Promise.all(t.map(async s=>this.add(s,i)))}start(){return v(this,J)?(H(this,J,!1),q(this,S,Le).call(this),this):this}pause(){H(this,J,!0)}clear(){H(this,$,new(v(this,pe)))}async onEmpty(){v(this,$).size!==0&&await q(this,S,Oe).call(this,"empty")}async onSizeLessThan(t){v(this,$).size<t||await q(this,S,Oe).call(this,"next",()=>v(this,$).size<t)}async onIdle(){v(this,V)===0&&v(this,$).size===0||await q(this,S,Oe).call(this,"idle")}get size(){return v(this,$).size}sizeBy(t){return v(this,$).filter(t).length}get pending(){return v(this,V)}get isPaused(){return v(this,J)}}ne=new WeakMap,oe=new WeakMap,te=new WeakMap,fe=new WeakMap,ae=new WeakMap,me=new WeakMap,W=new WeakMap,le=new WeakMap,$=new WeakMap,pe=new WeakMap,V=new WeakMap,he=new WeakMap,J=new WeakMap,ge=new WeakMap,De=new WeakMap,S=new WeakSet,_t=function(){return v(this,oe)||v(this,te)<v(this,fe)},bt=function(){return v(this,V)<v(this,he)},vt=function(){_e(this,V)._--,q(this,S,Ne).call(this),this.emit("next")},wt=function(){q(this,S,Ge).call(this),q(this,S,$e).call(this),H(this,le,void 0)},Et=function(){const t=Date.now();if(v(this,W)===void 0){const i=v(this,me)-t;if(i<0)H(this,te,v(this,ne)?v(this,V):0);else return v(this,le)===void 0&&H(this,le,setTimeout(()=>{q(this,S,wt).call(this)},i)),!0}return!1},Ne=function(){if(v(this,$).size===0)return v(this,W)&&clearInterval(v(this,W)),H(this,W,void 0),this.emit("empty"),v(this,V)===0&&this.emit("idle"),!1;if(!v(this,J)){const t=!v(this,S,Et);if(v(this,S,_t)&&v(this,S,bt)){const i=v(this,$).dequeue();return i?(this.emit("active"),i(),t&&q(this,S,$e).call(this),!0):!1}}return!1},$e=function(){v(this,oe)||v(this,W)!==void 0||(H(this,W,setInterval(()=>{q(this,S,Ge).call(this)},v(this,ae))),H(this,me,Date.now()+v(this,ae)))},Ge=function(){v(this,te)===0&&v(this,V)===0&&v(this,W)&&(clearInterval(v(this,W)),H(this,W,void 0)),H(this,te,v(this,ne)?v(this,V):0),q(this,S,Le).call(this)},Le=function(){for(;q(this,S,Ne).call(this););},Ct=async function(t){return new Promise((i,s)=>{t.addEventListener("abort",()=>{s(t.reason)},{once:!0})})},Oe=async function(t,i){return new Promise(s=>{const r=()=>{i&&!i()||(this.off(t,r),s())};this.on(t,r)})};const qt=()=>{const f=Fe.useAnalyticsConfigStore(),e=n.inject(ee);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 It({carryoverConcurrencyCount:!0,concurrency:f.maxParallelRequests,interval:f.requestInterval,intervalCap:f.requestIntervalCap}),i={...e,queryFnOverride:!0,queryFn:(s,r)=>t.add(()=>e.queryFn(s,r),{throwOnTimeout:!0})};n.provide(ee,i)};function Pt({queryBridge:f,context:e,definition:t,chartData:i}){const s=n.ref(""),r=n.ref("");n.onMounted(async()=>{var E,x;s.value=await((E=f==null?void 0:f.exploreBaseUrl)==null?void 0:E.call(f))??"",r.value=await((x=f==null?void 0:f.requestsBaseUrl)==null?void 0:x.call(f))??""});const a=n.computed(()=>!["golden_signals","top_n","gauge"].includes(t.value.chart.type)),o=n.computed(()=>r.value&&t.value.query&&t.value.query.datasource!=="llm_usage"),d=n.computed(()=>s.value&&t.value.query&&["basic","api_usage","llm_usage",void 0].includes(t.value.query.datasource)),h=n.computed(()=>i.value?z.msToGranularity(i.value.meta.granularity_ms):void 0),c=n.computed(()=>{var N;const E=[...e.value.filters,...t.value.query.filters??[]],x=((N=t.value.query)==null?void 0:N.datasource)??"api_usage";return E.filter(R=>z.getFieldDataSources(R.field).some(O=>x===O))}),l=n.computed(()=>{if(!d.value||!a.value)return"";const E=c.value,x=t.value.query.time_range||e.value.timeSpec,N=g(x,E);return D(N)}),m=n.computed(()=>{if(!o.value||!a.value)return"";const E=[...e.value.filters,...t.value.query.filters??[]],x=p(t.value.query.time_range||e.value.timeSpec,E);return y(x)}),y=E=>o.value?`${r.value}?q=${JSON.stringify(E)}`:"",p=(E,x)=>{var N,R;return{filter:x,timeframe:{timePeriodsKey:E.type==="relative"?E.time_range:"custom",start:E.type==="absolute"?(N=i.value)==null?void 0:N.meta.start_ms:void 0,end:E.type==="absolute"?(R=i.value)==null?void 0:R.meta.end_ms:void 0}}},_=(E,x)=>({filter:x,timeframe:{timePeriodsKey:E.type==="relative"?E.time_range:"custom",start:E.type==="absolute"?E.start:void 0,end:E.type==="absolute"?E.end:void 0}}),g=(E,x)=>{const N=t.value.query.dimensions??[];return{filters:x,metrics:t.value.query.metrics??[],dimensions:N,time_range:E,granularity:t.value.query.granularity||h.value}},D=E=>{if(!d.value)return"";const x=["api_usage","llm_usage"].includes(t.value.query.datasource)?t.value.query.datasource:"api_usage";return`${s.value}?q=${JSON.stringify(E)}&d=${x}&c=${t.value.chart.type}`};return{exploreLinkKebabMenu:l,requestsLinkKebabMenu:m,canShowKebabMenu:a,canGenerateRequestsLink:o,canGenerateExploreLink:d,buildExploreQuery:g,buildRequestsQueryZoomActions:_,buildExploreLink:D,buildRequestLink:y}}const se={useI18n:Dt,useEvaluateFeatureFlag:zt,useRequestQueue:qt,useContextLinks:Pt},we=n.defineComponent({__name:"QueryDataProvider",props:{context:{},query:{},queryReady:{type:Boolean},refreshCounter:{}},emits:["chart-data","queryComplete"],setup(f,{emit:e}){const t=f,i=e,{i18n:s}=se.useI18n(),r=n.inject(ee),a=()=>t.queryReady&&r?JSON.stringify([t.query,t.context,t.refreshCounter]):null,o=new AbortController;n.onUnmounted(()=>{o.abort()});const d=(D,E,x)=>{const N=[];return E&&N.push(...E),N.push(...z.stripUnknownFilters(D,x)),N},{data:h,error:c,isValidating:l}=xt(a,async()=>{var D,E,x,N;try{let{datasource:R,...T}=t.query;R||(R="basic");const O=d(R,t.query.filters,t.context.filters);let L=t.query.time_range;L?L.tz||(L={...L,tz:t.context.tz}):L={...t.context.timeSpec,tz:t.context.tz};const P={datasource:R,query:{...T,time_range:L,filters:O}},Y=await(r==null?void 0:r.queryFn(P,o));return p.value=null,Y}catch(R){throw(R==null?void 0:R.status)===403?p.value={message:s.t("queryDataProvider.forbidden"),type:"forbidden"}:(R==null?void 0:R.status)===408?p.value={message:s.t("queryDataProvider.timeout"),type:"timeout"}:((E=(D=R==null?void 0:R.response)==null?void 0:D.data)==null?void 0:E.message)==="Range not allowed for this tier"?p.value={message:s.t("queryDataProvider.timeRangeExceeded"),type:"range_exceeded"}:p.value={message:((N=(x=R==null?void 0:R.response)==null?void 0:x.data)==null?void 0:N.message)||(R==null?void 0:R.message),type:"other"},R}finally{i("queryComplete")}},{refreshInterval:t.context.refreshInterval,revalidateOnFocus:!1,shouldRetryOnError:!1}),{state:m,swrvState:y}=Rt(h,c,l),p=n.ref(null),_=n.computed(()=>m.value===y.ERROR||!!p.value),g=n.computed(()=>!t.queryReady||m.value===y.PENDING);return n.watch(h,D=>{D&&i("chart-data",D)}),(D,E)=>{var R;const x=n.resolveComponent("KSkeleton"),N=n.resolveComponent("KEmptyState");return g.value||!n.unref(h)&&!_.value?(n.openBlock(),n.createBlock(x,{key:0,class:"chart-skeleton",type:"table"})):_.value&&((R=p.value)==null?void 0:R.type)==="forbidden"?(n.openBlock(),n.createBlock(N,{key:1,"action-button-visible":!1,"data-testid":"chart-forbidden-state"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(p.value.message),1)]),icon:n.withCtx(()=>[n.createVNode(n.unref(ve.VisibilityOffIcon))]),_:1})):_.value?(n.openBlock(),n.createBlock(N,{key:2,"action-button-visible":!1,"data-testid":"chart-empty-state","icon-variant":"error"},{default:n.withCtx(()=>{var T;return[n.createTextVNode(n.toDisplayString((T=p.value)==null?void 0:T.message),1)]}),_:1})):n.unref(h)?n.renderSlot(D.$slots,"default",{key:3,data:n.unref(h)}):n.createCommentVNode("",!0)}}}),Bt=n.defineComponent({__name:"SimpleChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},requestsLink:{},exploreLink:{}},setup(f){n.useCssVars(i=>({"088169ae":`${i.height}px`}));const e=f,t=n.computed(()=>e.chartOptions.type==="single_value");return(i,s)=>(n.openBlock(),n.createBlock(we,{context:i.context,query:i.query,"query-ready":i.queryReady,"refresh-counter":i.refreshCounter},{default:n.withCtx(({data:r})=>[n.createElementVNode("div",{class:n.normalizeClass(["analytics-chart",{"single-value":t.value}])},[n.createVNode(n.unref(Z.SimpleChart),{"chart-data":r,"chart-options":i.chartOptions,"synthetics-data-key":t.value?void 0:i.chartOptions.synthetics_data_key},null,8,["chart-data","chart-options","synthetics-data-key"])],2)]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),re=(f,e)=>{const t=f.__vccOpts||f;for(const[i,s]of e)t[i]=s;return t},et=re(Bt,[["__scopeId","data-v-1e9ff912"]]),$t={class:"analytics-chart"},Me=re(n.defineComponent({__name:"BaseAnalyticsChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},requestsLink:{},exploreLink:{},extraProps:{}},emits:["edit-tile","chart-data","zoom-time-range","view-requests","select-chart-range"],setup(f,{emit:e}){const t=f,i=e,{i18n:s}=se.useI18n(),{evaluateFeatureFlag:r}=se.useEvaluateFeatureFlag(),a=r("ma-4135-allow-zooming-all-dashboard-tiles",!1),o=n.computed(()=>({type:t.chartOptions.type,stacked:t.chartOptions.stacked??!1,chartDatasetColors:t.chartOptions.chart_dataset_colors,threshold:t.chartOptions.threshold})),d=n.computed(()=>a?t.context.zoomable:t.context.zoomable&&!t.query.time_range),h=()=>{i("edit-tile")},c=l=>{i("chart-data",l)};return(l,m)=>{const y=n.resolveComponent("KDropdownItem");return n.openBlock(),n.createBlock(we,{context:l.context,query:l.query,"query-ready":l.queryReady,"refresh-counter":l.refreshCounter,onChartData:c},{default:n.withCtx(({data:p})=>[n.createElementVNode("div",$t,[n.createVNode(n.unref(Z.AnalyticsChart),n.mergeProps({"chart-data":p,"chart-options":o.value,"explore-link":l.exploreLink,"legend-position":"bottom","requests-link":l.requestsLink,"synthetics-data-key":l.chartOptions.synthetics_data_key,"timeseries-zoom":d.value,"tooltip-title":""},l.extraProps,{onSelectChartRange:m[0]||(m[0]=_=>i("select-chart-range",_)),onZoomTimeRange:m[1]||(m[1]=_=>i("zoom-time-range",_))}),n.createSlots({_:2},[l.context.editable?{name:"menu-items",fn:n.withCtx(()=>[n.createVNode(y,{onClick:h},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(s).t("renderer.edit")),1)]),_:1})]),key:"0"}:void 0]),1040,["chart-data","chart-options","explore-link","requests-link","synthetics-data-key","timeseries-zoom"])])]),_:1},8,["context","query","query-ready","refresh-counter"])}}}),[["__scopeId","data-v-965790dd"]]),tt=n.defineComponent({__name:"BarChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},requestsLink:{},exploreLink:{}},setup(f){return(e,t)=>(n.openBlock(),n.createBlock(Me,{"chart-options":e.chartOptions,context:e.context,"extra-props":{showAnnotations:!1},height:e.height,query:e.query,"query-ready":e.queryReady,"refresh-counter":e.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),it=n.defineComponent({__name:"TimeseriesChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},requestsLink:{},exploreLink:{}},emits:["zoom-time-range","select-chart-range"],setup(f,{emit:e}){const t=e;return(i,s)=>(n.openBlock(),n.createBlock(Me,{"chart-options":i.chartOptions,context:i.context,"explore-link":i.exploreLink,height:i.height,query:i.query,"query-ready":i.queryReady,"refresh-counter":i.refreshCounter,"requests-link":i.requestsLink,onSelectChartRange:s[0]||(s[0]=r=>t("select-chart-range",r)),onZoomTimeRange:s[1]||(s[1]=r=>t("zoom-time-range",r))},null,8,["chart-options","context","explore-link","height","query","query-ready","refresh-counter","requests-link"]))}}),Gt={class:"metric-card-tile-wrapper"},Ft=re(n.defineComponent({__name:"GoldenSignalsRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},requestsLink:{},exploreLink:{}},setup(f){const e=f,t=n.computed(()=>{const s=e.context.timeSpec;if(s.type==="absolute")return new z.Timeframe({key:"custom",timeframeText:"custom",display:"custom",startCustom:s.start,endCustom:s.end,timeframeLength:()=>s.end.getTime()-s.start.getTime(),defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["free","plus","enterprise"]});const r=z.TimePeriods.get(s.time_range);if(!r)throw new Error("Unknown time range");return r}),i=n.computed(()=>{var r,a;const s=(r=e.query)==null?void 0:r.datasource;if(s&&s!=="api_usage"&&s!=="basic")throw new Error(`Invalid datasource value: ${s}`);return{datasource:(a=e.query)==null?void 0:a.datasource,overrideTimeframe:t.value,tz:e.context.tz,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}});return(s,r)=>(n.openBlock(),n.createElementBlock("div",Gt,[n.createVNode(n.unref(be.MetricsProvider),n.normalizeProps(n.guardReactiveProps(i.value)),{default:n.withCtx(()=>[n.createVNode(n.unref(be.MetricsConsumer))]),_:1},16)]))}}),[["__scopeId","data-v-7e1b1cc1"]]),st="#6c7489",Ut="12px",rt="20px",nt="20px",Wt={class:"fallback-entity-link","data-testid":"entity-link-parent"},ot=n.defineComponent({__name:"FallbackEntityLink",props:{entityLinkData:{}},setup(f){return(e,t)=>(n.openBlock(),n.createElementBlock("div",Wt,n.toDisplayString(e.entityLinkData.label),1))}}),Vt=n.defineComponent({__name:"TopNTableRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},requestsLink:{},exploreLink:{}},setup(f){const e=f,t=n.inject(ee),i=n.defineAsyncComponent(async()=>{if(t!=null&&t.fetchComponent)try{return await t.fetchComponent("EntityLink")}catch{return ot}return ot}),s=r=>{var a;if((a=e.chartOptions)!=null&&a.entity_link)if(r.id.includes(":")){const[o,d]=r.id.split(":");return e.chartOptions.entity_link.replace(Ke,o).replace(He,d)}else return e.chartOptions.entity_link.replace(He,r.id);return""};return(r,a)=>(n.openBlock(),n.createBlock(we,{context:r.context,query:r.query,"query-ready":r.queryReady,"refresh-counter":r.refreshCounter},{default:n.withCtx(({data:o})=>[n.createVNode(n.unref(Z.TopNTable),{data:o,"synthetics-data-key":r.chartOptions.synthetics_data_key},n.createSlots({_:2},[e.chartOptions.entity_link?{name:"name",fn:n.withCtx(({record:d})=>[n.createVNode(n.unref(i),{"entity-link-data":{id:d.id,label:d.name,deleted:d.deleted},"external-link":s(d)},null,8,["entity-link-data","external-link"])]),key:"0"}:void 0]),1032,["data","synthetics-data-key"])]),_:1},8,["context","query","query-ready","refresh-counter"]))}}),Kt=n.defineComponent({__name:"DonutChartRenderer",props:{query:{},context:{},queryReady:{type:Boolean},chartOptions:{},height:{},refreshCounter:{},requestsLink:{},exploreLink:{}},setup(f){return(e,t)=>(n.openBlock(),n.createBlock(Me,{"chart-options":e.chartOptions,context:e.context,height:e.height,query:e.query,"query-ready":e.queryReady,"refresh-counter":e.refreshCounter},null,8,["chart-options","context","height","query","query-ready","refresh-counter"]))}}),jt=["data-testid"],Yt={key:0,class:"tile-header"},Qt=["data-testid"],Xt={class:"badge-text"},Zt=["data-testid"],Jt={class:"delete-option"},ei=["data-testid"],ti=["data-testid"],ii=re(n.defineComponent({__name:"DashboardTile",props:{definition:{},context:{},height:{default:de},queryReady:{type:Boolean},refreshCounter:{},tileId:{}},emits:["edit-tile","duplicate-tile","remove-tile","tile-time-range-zoom"],setup(f,{emit:e}){n.useCssVars(b=>({"3d5e4dab":`${b.height}px`}));const t=parseInt(nt,10),i=f,s=e,r=n.defineAsyncComponent(()=>Promise.resolve().then(()=>mi)),a=n.inject(ee),o=a==null?void 0:a.evaluateFeatureFlagFn("analytics-chart-zoom-actions",!1),{i18n:d}=se.useI18n(),h=n.ref(),c=n.ref(!1),l=n.ref(),m=n.ref(!1),y=n.ref(void 0),p=n.ref(void 0),_=n.ref(!0),{exploreLinkKebabMenu:g,requestsLinkKebabMenu:D,canShowKebabMenu:E,canGenerateRequestsLink:x,canGenerateExploreLink:N,buildExploreQuery:R,buildExploreLink:T,buildRequestLink:O,buildRequestsQueryZoomActions:L}=se.useContextLinks({queryBridge:a,chartData:n.readonly(h),definition:n.readonly(n.toRef(i,"definition")),context:n.readonly(n.toRef(i,"context"))});n.watch(()=>i.definition,async()=>{await n.nextTick(),l.value&&(m.value=l.value.scrollWidth>l.value.clientWidth),_.value=!0},{immediate:!0,deep:!0});const P=n.computed(()=>d.t("csvExport.defaultFilename")),Y=n.computed(()=>E.value&&(ie.value||i.context.editable)||!!Pe.value),ie=n.computed(()=>!!g.value||"allow_csv_export"in i.definition.chart&&i.definition.chart.allow_csv_export||i.context.editable),ze={timeseries_line:it,timeseries_bar:it,horizontal_bar:tt,vertical_bar:tt,gauge:et,donut:Kt,golden_signals:Ft,top_n:Vt,slottable:void 0,single_value:et,choropleth_map:r},Se=n.computed(()=>{var b,A;return{...(b=ye.value)!=null&&b.rendererEvents.supportsRequests?{"select-chart-range":xi}:{},...(A=ye.value)!=null&&A.rendererEvents.supportsZoom?{"zoom-time-range":Ci}:{}}}),ye=n.computed(()=>{var K,F;const b=ze[i.definition.chart.type],A=!!((K=b==null?void 0:b.emits)!=null&&K.includes("select-chart-range")),M=!!((F=b==null?void 0:b.emits)!=null&&F.includes("zoom-time-range"));return b&&{component:b,rendererProps:{query:i.definition.query,context:i.context,queryReady:i.queryReady,chartOptions:i.definition.chart,height:i.height-t*2,refreshCounter:i.refreshCounter,requestsLink:y.value,exploreLink:p.value},rendererEvents:{supportsRequests:A,supportsZoom:M}}}),Pe=n.computed(()=>{var A;const b=(A=i.definition.query)==null?void 0:A.time_range;if((b==null?void 0:b.type)==="relative"){const M=z.TimePeriods.get(z.TIMEFRAME_LOOKUP[b.time_range]);return M?M.display:(console.warn("Did not recognize the given relative time range:",b.time_range),b.time_range)}else if((b==null?void 0:b.type)==="absolute"){const M=b.tz||"Etc/UTC";return`${z.formatTime(b.start,{short:!0,tz:M})} - ${z.formatTime(b.end,{short:!0,tz:M})}`}return null}),ct=n.computed(()=>h.value?z.msToGranularity(h.value.meta.granularity_ms):void 0),pi=n.computed(()=>["timeseries_line","timeseries_bar"].includes(i.definition.chart.type)),ut=n.computed(()=>{var A,M;if(!pi.value||!i.queryReady||_.value)return!1;const b=(M=(A=i.definition)==null?void 0:A.query)==null?void 0:M.granularity;return!b||!ct.value?!1:b!==ct.value}),gi=n.computed(()=>{var M,K,F;const b=z.msToGranularity(((M=h.value)==null?void 0:M.meta.granularity_ms)??0)??"unknown",A=((F=(K=i.definition)==null?void 0:K.query)==null?void 0:F.granularity)??"unknown";return d.t("query_aged_out_warning",{currentGranularity:d.t(`granularities.${b}`),savedGranularity:d.t(`granularities.${A}`)})}),yi=n.computed(()=>{var M,K;const b=[...i.context.filters,...i.definition.query.filters??[]],A=((K=(M=i.definition)==null?void 0:M.query)==null?void 0:K.datasource)??"api_usage";return b.filter(F=>z.getFieldDataSources(F.field).some(pt=>A===pt))}),_i=()=>{s("edit-tile",i.definition)},bi=()=>{s("duplicate-tile",i.definition)},vi=()=>{s("remove-tile",i.definition)},wi=b=>{h.value=b,_.value=!1},ft=b=>{c.value=b},Ei=()=>{ft(!0)},Ci=b=>{const A={tileId:i.tileId.toString(),timeRange:b};s("tile-time-range-zoom",A)},xi=b=>{const A=yi.value,M=L(b,A),K=R(b,A);y.value=x.value?{href:O(M)}:void 0,p.value=N.value?{href:T(K)}:void 0};return(b,A)=>{const M=n.resolveComponent("KTooltip"),K=n.resolveComponent("KBadge"),F=n.resolveComponent("KDropdownItem"),mt=n.resolveComponent("KDropdown");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["tile-boundary",{editable:b.context.editable}]),"data-testid":`tile-${b.tileId}`},[b.definition.chart.type!=="slottable"?(n.openBlock(),n.createElementBlock("div",Yt,[n.createVNode(M,{class:"title-tooltip",disabled:!m.value,"max-width":"500",text:b.definition.chart.chart_title},{default:n.withCtx(()=>[n.createElementVNode("div",{ref_key:"titleRef",ref:l,class:"title"},n.toDisplayString(b.definition.chart.chart_title),513)]),_:1},8,["disabled","text"]),Y.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"tile-actions","data-testid":`tile-actions-${b.tileId}`},[Pe.value?(n.openBlock(),n.createBlock(K,{key:0,"data-testid":"time-range-badge",tooltip:ut.value?gi.value:void 0,"tooltip-attributes":{maxWidth:"320px"}},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("span",Xt,n.toDisplayString(Pe.value),1)]),_:2},[ut.value?{name:"icon",fn:n.withCtx(()=>[n.createVNode(n.unref(ve.WarningIcon),{size:n.unref(Ut)},null,8,["size"])]),key:"0"}:void 0]),1032,["tooltip"])):n.createCommentVNode("",!0),n.unref(E)&&b.context.editable?(n.openBlock(),n.createBlock(n.unref(ve.EditIcon),{key:1,class:"edit-icon",color:n.unref(st),"data-testid":`edit-tile-${b.tileId}`,size:n.unref(rt),onClick:_i},null,8,["color","data-testid","size"])):n.createCommentVNode("",!0),n.unref(E)&&ie.value?(n.openBlock(),n.createBlock(mt,{key:2,class:"dropdown","data-testid":`chart-action-menu-${b.tileId}`,"kpop-attributes":{placement:"bottom-end"}},{items:n.withCtx(()=>[n.unref(g)?(n.openBlock(),n.createBlock(F,{key:0,"data-testid":`chart-jump-to-explore-${b.tileId}`,item:{label:n.unref(d).t("jumpToExplore"),to:n.unref(g)}},null,8,["data-testid","item"])):n.createCommentVNode("",!0),n.unref(o)&&n.unref(D)?(n.openBlock(),n.createBlock(F,{key:1,"data-testid":`chart-jump-to-requests-${b.tileId}`,item:{label:n.unref(d).t("jumpToRequests"),to:n.unref(D)}},null,8,["data-testid","item"])):n.createCommentVNode("",!0),!("allow_csv_export"in b.definition.chart)||b.definition.chart.allow_csv_export?(n.openBlock(),n.createBlock(F,{key:2,class:"chart-export-button","data-testid":`chart-csv-export-${b.tileId}`,onClick:A[0]||(A[0]=pt=>Ei())},{default:n.withCtx(()=>[n.createElementVNode("span",{class:"chart-export-trigger","data-testid":`csv-export-button-${b.tileId}`},n.toDisplayString(n.unref(d).t("csvExport.exportAsCsv")),9,Zt)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0),b.context.editable?(n.openBlock(),n.createBlock(F,{key:3,"data-testid":`duplicate-tile-${b.tileId}`,onClick:bi},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(n.unref(d).t("renderer.duplicateTile")),1)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0),b.context.editable?(n.openBlock(),n.createBlock(F,{key:4,"data-testid":`remove-tile-${b.tileId}`,onClick:vi},{default:n.withCtx(()=>[n.createElementVNode("span",Jt,n.toDisplayString(n.unref(d).t("renderer.delete")),1)]),_:1},8,["data-testid"])):n.createCommentVNode("",!0)]),default:n.withCtx(()=>[n.createVNode(n.unref(ve.MoreIcon),{class:"kebab-action-menu",color:n.unref(st),"data-testid":`kebab-action-menu-${b.tileId}`,size:n.unref(rt)},null,8,["color","data-testid","size"])]),_:1},8,["data-testid"])):n.createCommentVNode("",!0)],8,Qt)):"description"in b.definition.chart?(n.openBlock(),n.createElementBlock("div",{key:1,class:"header-description","data-testid":`tile-description-${b.tileId}`},n.toDisplayString(b.definition.chart.description),9,ei)):n.createCommentVNode("",!0),c.value?(n.openBlock(),n.createBlock(n.unref(Z.CsvExportModal),{key:2,"chart-data":h.value,"data-testid":`csv-export-modal-${b.tileId}`,filename:P.value,onToggleModal:ft},null,8,["chart-data","data-testid","filename"])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:"tile-content","data-testid":`tile-content-${b.tileId}`},[ye.value?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(ye.value.component),n.mergeProps({key:0},ye.value.rendererProps,n.toHandlers(Se.value),{onChartData:wi}),null,16)):n.createCommentVNode("",!0)],8,ti)],10,jt)}}}),[["__scopeId","data-v-7a51e777"]]),si=(f,e)=>{let t=0;const i=new Map;e.forEach(r=>{const a=r.layout.position.row,o=i.get(a),d=r.layout.size.rows===1&&!!r.layout.size.fit_to_content;t=Math.max(t,a+r.layout.size.rows),o===void 0?i.set(a,d):i.set(a,o&&d)});const s=[];for(let r=0;r<t;r++)i.get(r)?s.push("auto"):s.push(`${f}px`);return s},at=re(n.defineComponent({__name:"GridLayout",props:{tileHeight:{type:Number,required:!1,default:()=>de},tiles:{type:Array,required:!0}},setup(f){n.useCssVars(o=>({"2a38e79e":n.unref(Ae),"4cc71de6":r.value}));const e=f,t=n.ref(null),i=n.ref(0),s=new ResizeObserver(o=>{window.requestAnimationFrame(()=>{!Array.isArray(o)||!o.length||(i.value=o[0].contentRect.width)})});n.onMounted(()=>{t.value&&s.observe(t.value)}),n.onUnmounted(()=>{t.value&&s.unobserve(t.value)});const r=n.computed(()=>si(e.tileHeight,e.tiles).join(" ")),a=n.computed(()=>e.tiles.map((o,d)=>({key:`tile-${d}`,tile:o,style:{"grid-column-start":o.layout.position.col+1,"grid-column-end":o.layout.position.col+1+o.layout.size.cols,"grid-row-start":o.layout.position.row+1,"grid-row-end":o.layout.position.row+1+o.layout.size.rows}})));return(o,d)=>(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(a.value,h=>(n.openBlock(),n.createElementBlock("div",{key:h.key,class:n.normalizeClass(["grid-cell",{"empty-cell":!h.tile}]),style:n.normalizeStyle(h.style)},[n.renderSlot(o.$slots,"tile",{style:n.normalizeStyle(h.style),tile:h.tile},void 0,!0)],6))),128))],512))}}),[["__scopeId","data-v-354b7177"]]);function ri(f,e,t,i,s){const r=(...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(f,a));return r.prototype=e.prototype,r}class u{static getElements(e,t=document){if(typeof e=="string"){const i="getElementById"in t?t:void 0;if(i&&!isNaN(+e[0])){const r=i.getElementById(e);return r?[r]:[]}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){var t,i;return e.lazyLoad||((i=(t=e.grid)==null?void 0:t.opts)==null?void 0:i.lazyLoad)&&e.lazyLoad!==!1}static createDiv(e,t){const i=document.createElement("div");return e.forEach(s=>{s&&i.classList.add(s)}),t==null||t.appendChild(i),i}static shouldSizeToContent(e,t=!1){return(e==null?void 0: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 u.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 r=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<=r?0:(s-i)*(a-r)}static area(e){return e.w*e.h}static sort(e,t=1){return e.sort((s,r)=>{const a=t*((s.y??1e4)-(r.y??1e4));return a===0?t*((s.x??1e4)-(r.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"),r=i==null?void 0:i.nonce;return r&&(s.nonce=r),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],r=t[i];i[0]==="_"||s===r?delete e[i]:s&&typeof s=="object"&&r!==void 0&&(u.removeInternalAndSame(s,r),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(),r=window.innerHeight||document.documentElement.clientHeight;if(s.top<0||s.bottom>r){const a=s.bottom-r,o=s.top,d=this.getScrollElement(e);if(d!==null){const h=d.scrollTop;s.top<0&&i<0?e.offsetHeight>r?d.scrollTop+=i:d.scrollTop+=Math.abs(o)>Math.abs(i)?i:o:i>0&&(e.offsetHeight>r?d.scrollTop+=i:d.scrollTop+=a>i?i:a),t.top+=d.scrollTop-h}}}static updateScrollResize(e,t,i){const s=this.getScrollElement(t),r=s.clientHeight,a=s===this.getScrollElement()?0:s.getBoundingClientRect().top,o=e.clientY-a,d=o<i,h=o>r-i;d?s.scrollBy({behavior:"smooth",top:o-i}):h&&s.scrollBy({behavior:"smooth",top:i-(r-o)})}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=u.clone(e);for(const s in i)i.hasOwnProperty(s)&&typeof i[s]=="object"&&s.substring(0,2)!=="__"&&!t.find(r=>r===s)&&(i[s]=u.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=u.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(r=>i[r]=e[r]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(r=>i[r]=e[r]),{...i,...s}}static simulateMouseEvent(e,t,i){const s=e,r=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(r)}static getValuesFromTransformedElement(e){const t=document.createElement("div");u.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){var t;return!(!e||e.w===e.h||e.locked||e.noResize||(t=e.grid)!=null&&t.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class Q{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 r=t;!this._loading&&this._useEntireRowArea(e,t)&&(r={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,r,s.skip));let a=!1;const o={nested:!0,pack:!1};let d=0;for(;i=i||this.collide(e,r,s.skip);){if(d++>this.nodes.length*2)throw new Error("Infinite collide check");let h;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 c={...t,y:i.y+i.h,...o};h=this._loading&&u.samePos(e,c)?!0:this.moveNode(e,c),(i.locked||this._loading)&&h?u.copyPos(t,e):!i.locked&&h&&s.pack&&(this._packNodes(),t.y=i.y+i.h,u.copyPos(e,t)),a=a||h}else h=this.moveNode(i,{...i,y:t.y+t.h,skip:e,...o});if(!h)return a;i=void 0}return a}collide(e,t=e,i){const s=e._id,r=i==null?void 0:i._id;return this.nodes.find(a=>a._id!==s&&a._id!==r&&u.isIntercepted(a,t))}collideAll(e,t=e,i){const s=e._id,r=i==null?void 0:i._id;return this.nodes.filter(a=>a._id!==s&&a._id!==r&&u.isIntercepted(a,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;const s=e._rect,r={...t.rect};r.y>s.y?(r.h+=r.y-s.y,r.y=s.y):r.h+=s.y-r.y,r.x>s.x?(r.w+=r.x-s.x,r.x=s.x):r.w+=s.x-r.x;let a,o=.5;for(let d of i){if(d.locked||!d._rect)break;const h=d._rect;let c=Number.MAX_VALUE,l=Number.MAX_VALUE;s.y<h.y?c=(r.y+r.h-h.y)/h.h:s.y+s.h>h.y+h.h&&(c=(h.y+h.h-r.y)/h.h),s.x<h.x?l=(r.x+r.w-h.x)/h.w:s.x+s.w>h.x+h.w&&(l=(h.x+h.w-r.x)/h.w);const m=Math.min(l,c);m>o&&(o=m,a=d)}return t.collide=a,a}cacheRects(e,t,i,s,r,a){return this.nodes.forEach(o=>o._rect={y:o.y*t+i,x:o.x*e+a,w:o.w*e-a-s,h:o.h*t-i-r}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){const r=t.x,a=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=r,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=a):(e.x=r,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=u.isTouching(e,t)))return i();if(s!==!1){if(e.w===t.w&&e.x===t.x&&(s||(s=u.isTouching(e,t)))){if(t.y<e.y){const r=e;e=t,t=r}return i()}if(s!==!1){if(e.h===t.h&&e.y===t.y&&(s||(s=u.isTouching(e,t)))){if(t.x<e.x){const r=e;e=t,t=r}return i()}return!1}}}isAreaEmpty(e,t,i,s){const r={x:e||0,y:t||0,w:i||1,h:s||1};return!this.collide(r)}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 r=this.nodes;return this.nodes=[],r.forEach((a,o,d)=>{let h;a.locked||(a.autoPosition=!0,e==="list"&&o&&(h=d[o-1])),this.addNode(a,!1,h)}),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=u.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??Q._idSeq++;const i=e.id;if(i){let r=1;for(;this.nodes.find(a=>a.id===e.id&&a!==e);)e.id=i+"_"+r++}(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 u.defaults(e,s),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,u.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||u.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 r={...e};r.autoPosition||r.x===void 0?(delete r.x,delete r.y):r.x=Math.min(this.defaultColumn-1,r.x),r.w=Math.min(this.defaultColumn,r.w||1),this.cacheOneLayout(r,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),u.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!u.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=u.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||u.samePos(e,e._orig)||(u.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,s){const r=s?s.y*i+(s.x+s.w):0;let a=!1;for(let o=r;!a;++o){const d=o%i,h=Math.floor(o/i);if(d+e.w>i)continue;const c={x:d,y:h,w:e.w,h:e.h};t.find(l=>u.isIntercepted(c,l))||((e.x!==d||e.y!==h)&&(e._dirty=!0),e.x=d,e.y=h,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 r;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,r=!0),this.nodes.push(e),t&&this.addedNodes.push(e),r||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 Q({column:this.column,float:this.float,nodes:this.nodes.map(a=>a._id===e._id?(i={...a},i):{...a})});if(!i)return!1;const r=s.moveNode(i,t)&&s.getRow()<=Math.max(this.getRow(),this.maxRow);if(!r&&!t.resizing&&t.collide){const a=t.collide.el.gridstackNode;if(this.swap(e,a))return this._notify(),!0}return r?(s.nodes.filter(a=>a._dirty).forEach(a=>{const o=this.nodes.find(d=>d._id===a._id);o&&(u.copyPos(o,a),o._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const t=new Q({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=u.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){var h,c;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,r=u.copyPos({},e,!0);if(u.copyPos(r,t),this.nodeBoundFix(r,s),u.copyPos(t,r),!t.forceCollide&&u.samePos(e,t))return!1;const a=u.copyPos({},e),o=this.collideAll(e,r,t.skip);let d=!0;if(o.length){const l=e._moving&&!t.nested;let m=l?this.directionCollideCoverage(e,t,o):o[0];if(l&&m&&((c=(h=e.grid)==null?void 0:h.opts)!=null&&c.subGridDynamic)&&!e.grid._isTemp){const y=u.areaIntercept(t.rect,m._rect),p=u.area(t.rect),_=u.area(m._rect);y/(p<_?p:_)>.8&&(m.grid.makeSubGrid(m.el,void 0,e),m=void 0)}m?d=!this._fixCollisions(e,r,m,t):(d=!1,i&&delete t.pack)}return d&&!u.samePos(e,r)&&(e._dirty=!0,u.copyPos(e,r)),t.pack&&this._packNodes()._notify(),!u.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){var a;const i=(a=this._layouts)==null?void 0:a.length,s=i&&this.column!==i-1?this._layouts[i-1]:null,r=[];return this.sortNodes(),this.nodes.forEach(o=>{const d=s==null?void 0:s.find(c=>c._id===o._id),h={...o,...d||{}};u.removeInternalForSave(h,!e),t&&t(o,h),r.push(h)}),r}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(r=>{if(!r._orig)return;const a=t.find(o=>o._id===r._id);a&&(a.y>=0&&r.y!==r._orig.y&&(a.y+=r.y-r._orig.y),r.x!==r._orig.x&&(a.x=Math.round(r.x*s)),r.w!==r._orig.w&&(a.w=Math.round(r.w*s)))})}}),this)}columnChanged(e,t,i="moveScale"){var o;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 r=[],a=s?this.nodes:u.sort(this.nodes,-1);if(t>e&&this._layouts){const d=this._layouts[t]||[],h=this._layouts.length-1;!d.length&&e!==h&&((o=this._layouts[h])!=null&&o.length)&&(e=h,this._layouts[h].forEach(c=>{const l=a.find(m=>m._id===c._id);l&&(!s&&!c.autoPosition&&(l.x=c.x??l.x,l.y=c.y??l.y),l.w=c.w??l.w,(c.x==null||c.y===void 0)&&(l.autoPosition=!0))})),d.forEach(c=>{const l=a.findIndex(m=>m._id===c._id);if(l!==-1){const m=a[l];if(s){m.w=c.w;return}(c.autoPosition||isNaN(c.x)||isNaN(c.y))&&this.findEmptyPosition(c,r),c.autoPosition||(m.x=c.x??m.x,m.y=c.y??m.y,m.w=c.w??m.w,r.push(m)),a.splice(l,1)}})}if(s)this.compact(i,!1);else{if(a.length)if(typeof i=="function")i(t,e,r,a);else{const d=s||i==="none"?1:t/e,h=i==="move"||i==="moveScale",c=i==="scale"||i==="moveScale";a.forEach(l=>{l.x=t===1?0:h?Math.round(l.x*d):Math.min(l.x,t-1),l.w=t===1||e===1?1:c?Math.round(l.w*d)||1:Math.min(l.w,t),r.push(l)}),a=[]}r=u.sort(r,-1),this._inColumnResize=!0,this.nodes=[],r.forEach(d=>{this.addNode(d,!1),delete d._orig})}return this.nodes.forEach(d=>delete d._orig),this.batchUpdate(!1,!s),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){const s=[];return e.forEach((r,a)=>{if(r._id===void 0){const o=r.id?this.nodes.find(d=>d.id===r.id):void 0;r._id=(o==null?void 0:o._id)??Q._idSeq++}s[a]={x:r.x,y:r.y,w:r.w,_id:r._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=s,this}cacheOneLayout(e,t){e._id=e._id??Q._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){var i,s;return((s=(i=this._layouts)==null?void 0:i[t])==null?void 0:s.findIndex(r=>r._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}}Q._idSeq=0;const G={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 k{}const j=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 X{}function Ee(f,e){f.touches.length>1||(f.cancelable&&f.preventDefault(),u.simulateMouseEvent(f.changedTouches[0],e))}function lt(f,e){f.cancelable&&f.preventDefault(),u.simulateMouseEvent(f,e)}function Ce(f){X.touchHandled||(X.touchHandled=!0,Ee(f,"mousedown"))}function xe(f){X.touchHandled&&Ee(f,"mousemove")}function ke(f){if(!X.touchHandled)return;X.pointerLeaveTimeout&&(window.clearTimeout(X.pointerLeaveTimeout),delete X.pointerLeaveTimeout);const e=!!k.dragElement;Ee(f,"mouseup"),e||Ee(f,"click"),X.touchHandled=!1}function Re(f){f.pointerType!=="mouse"&&f.target.releasePointerCapture(f.pointerId)}function ht(f){k.dragElement&&f.pointerType!=="mouse"&<(f,"mouseenter")}function dt(f){k.dragElement&&f.pointerType!=="mouse"&&(X.pointerLeaveTimeout=window.setTimeout(()=>{delete X.pointerLeaveTimeout,lt(f,"mouseleave")},10))}class Te{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(`${Te.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),j&&(this.el.addEventListener("touchstart",Ce),this.el.addEventListener("pointerdown",Re)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),j&&(this.el.removeEventListener("touchstart",Ce),this.el.removeEventListener("pointerdown",Re)),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),j&&(this.el.addEventListener("touchmove",xe),this.el.addEventListener("touchend",ke)),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),j&&(this.el.removeEventListener("touchmove",xe),this.el.removeEventListener("touchend",ke)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){var t,i;e.key==="Escape"&&((i=(t=this.host.gridstackNode)==null?void 0:t.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}}Te.prefix="ui-resizable-";class Ie{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 ce extends Ie{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const s=this.el.parentElement.getBoundingClientRect(),r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},a=this.temporalRect||r;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),k.overResizeElement===this&&delete k.overResizeElement),this}_mouseOver(e){k.overResizeElement||k.dragElement||(k.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){k.overResizeElement===this&&(delete k.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Te(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=u.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=u.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const t=u.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=u.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=u.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=ce._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,t=u.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 ce._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},r=e.clientX-i.clientX,a=this.sizeToContent?0:e.clientY-i.clientY;let o,d;t.indexOf("e")>-1?s.width+=r:t.indexOf("w")>-1&&(s.width-=r,s.left+=r,o=!0),t.indexOf("s")>-1?s.height+=a:t.indexOf("n")>-1&&(s.height-=a,s.top+=a,d=!0);const h=this._constrainSize(s.width,s.height,o,d);return Math.round(s.width)!==Math.round(h.width)&&(t.indexOf("w")>-1&&(s.left+=s.width-h.width),s.width=h.width),Math.round(s.height)!==Math.round(h.height)&&(t.indexOf("n")>-1&&(s.top+=s.height-h.height),s.height=h.height),s}_constrainSize(e,t,i,s){const r=this.option,a=(i?r.maxWidthMoveLeft:r.maxWidth)||Number.MAX_SAFE_INTEGER,o=r.minWidth/this.rectScale.x||e,d=(s?r.maxHeightMoveUp:r.maxHeight)||Number.MAX_SAFE_INTEGER,h=r.minHeight/this.rectScale.y||t,c=Math.min(a,Math.max(o,e)),l=Math.min(d,Math.max(h,t));return{width:c,height:l}}_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}}ce._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const ni='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class ue extends Ie{constructor(e,t={}){var r;super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=(r=t==null?void 0:t.handle)==null?void 0:r.substring(1),s=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:s!=null&&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),j&&(e.addEventListener("touchstart",Ce),e.addEventListener("pointerdown",Re))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),j&&(t.removeEventListener("touchstart",Ce),t.removeEventListener("pointerdown",Re))}),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(!k.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(ni)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete k.dragElement,delete k.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),j&&(e.currentTarget.addEventListener("touchmove",xe),e.currentTarget.addEventListener("touchend",ke)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),k.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const t=u.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(e){var i;const t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),k.pauseDrag){const s=Number.isInteger(k.pauseDrag)?k.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),s)}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=!0,k.dragElement=this;const s=(i=this.el.gridstackNode)==null?void 0:i.grid;s?k.dropElement=s.el.ddElement.ddDroppable:delete k.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=u.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const r=u.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){var t,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),j&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",xe,!0),e.currentTarget.removeEventListener("touchend",ke,!0)),this.dragging){delete this.dragging,(t=this.el.gridstackNode)==null||delete t._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=k.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete k.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const s=u.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(s),this.triggerEvent("dragstop",s),k.dropElement&&k.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete k.dragElement,delete k.dropElement,delete k.mouseHandled,e.preventDefault()}_keyEvent(e){var s,r;const t=this.el.gridstackNode,i=(t==null?void 0:t.grid)||((r=(s=k.dropElement)==null?void 0:s.el)==null?void 0:r.gridstack);if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!u.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",u.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=u.cloneNode(this.el)),e.parentElement||u.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=ue.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(){var t;this.helper.classList.remove("ui-draggable-dragging");const e=(t=this.helper)==null?void 0:t.gridstackNode;if(!(e!=null&&e._isAboutToRemove)&&this.dragElementOriginStyle){const i=this.helper,s=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",ue.originStyleProp.forEach(r=>i.style[r]=this.dragElementOriginStyle[r]||null),setTimeout(()=>i.style.transition=s,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,r=0;i&&(s=this.dragTransform.xOffset,r=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-r,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}}}}ue.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class oi extends Ie{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),j&&(this.el.addEventListener("pointerenter",ht),this.el.addEventListener("pointerleave",dt)))}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),j&&(this.el.removeEventListener("pointerenter",ht),this.el.removeEventListener("pointerleave",dt)))}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(!k.dragElement||!this._canDrop(k.dragElement.el))return;e.preventDefault(),e.stopPropagation(),k.dropElement&&k.dropElement!==this&&k.dropElement._mouseLeave(e,!0),k.dropElement=this;const t=u.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui(k.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){var s;if(!k.dragElement||k.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const i=u.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(k.dragElement)),this.triggerEvent("dropout",i),k.dropElement===this&&(delete k.dropElement,!t)){let r,a=this.el.parentElement;for(;!r&&a;)r=(s=a.ddElement)==null?void 0:s.ddDroppable,a=a.parentElement;r&&r._mouseEnter(e)}}drop(e){e.preventDefault();const t=u.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui(k.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 qe{static init(e){return e.ddElement||(e.ddElement=new qe(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 ue(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 ce(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 oi(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class ai{resizable(e,t,i,s){return this._getDDElements(e,t).forEach(r=>{if(t==="disable"||t==="enable")r.ddResizable&&r.ddResizable[t]();else if(t==="destroy")r.ddResizable&&r.cleanResizable();else if(t==="option")r.setupResizable({[i]:s});else{const o=r.el.gridstackNode.grid;let d=r.el.getAttribute("gs-resize-handles")||o.opts.resizable.handles||"e,s,se";d==="all"&&(d="n,e,s,w,se,sw,ne,nw");const h=!o.opts.alwaysShowResizeHandle;r.setupResizable({...o.opts.resizable,handles:d,autoHide:h,start:t.start,stop:t.stop,resize:t.resize})}}),this}draggable(e,t,i,s){return this._getDDElements(e,t).forEach(r=>{if(t==="disable"||t==="enable")r.ddDraggable&&r.ddDraggable[t]();else if(t==="destroy")r.ddDraggable&&r.cleanDraggable();else if(t==="option")r.setupDraggable({[i]:s});else{const a=r.el.gridstackNode.grid;r.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=r=>t._accept(r)),this._getDDElements(e,t).forEach(r=>{t==="disable"||t==="enable"?r.ddDroppable&&r.ddDroppable[t]():t==="destroy"?r.ddDroppable&&r.cleanDroppable():t==="option"?r.setupDroppable({[i]:s}):r.setupDroppable(t)}),this}isDroppable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(s=>s.on(t,r=>{i(r,k.dragElement?k.dragElement.el:r.target,k.dragElement?k.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=u.getElements(e);return s.length?s.map(a=>a.ddElement||(i?qe.init(a):null)).filter(a=>a):[]}}/*!
|
|
2
2
|
* GridStack 11.5.1
|
|
3
3
|
* https://gridstackjs.com/
|
|
4
4
|
*
|
|
@@ -13,7 +13,7 @@ var we = (u, e, t, i) => ({
|
|
|
13
13
|
return _(u, e, i);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { ref as $, watchEffect as Tt, inject as _e, provide as ai, onMounted as Qe, computed as
|
|
16
|
+
import { ref as $, watchEffect as Tt, inject as _e, provide as ai, onMounted as Qe, computed as S, defineComponent as Q, onUnmounted as je, watch as Xe, resolveComponent as de, createBlock as M, renderSlot as $e, createCommentVNode as Y, unref as T, openBlock as z, withCtx as q, createVNode as se, createTextVNode as Ee, toDisplayString as te, useCssVars as Ze, createElementVNode as le, normalizeClass as Je, mergeProps as zt, createSlots as et, createElementBlock as W, normalizeProps as li, guardReactiveProps as hi, defineAsyncComponent as Dt, readonly as We, toRef as ct, nextTick as St, resolveDynamicComponent as Nt, toHandlers as di, Fragment as Lt, renderList as At, normalizeStyle as ft, mergeModels as gt, useModel as ui, getCurrentInstance as ci } from "vue";
|
|
17
17
|
import { msToGranularity as Ke, getFieldDataSources as Ot, stripUnknownFilters as fi, Timeframe as gi, TimePeriods as Ht, TIMEFRAME_LOOKUP as mi, formatTime as mt } from "@kong-ui-public/analytics-utilities";
|
|
18
18
|
import { SimpleChart as pi, AnalyticsChart as yi, TopNTable as vi, CsvExportModal as _i } from "@kong-ui-public/analytics-chart";
|
|
19
19
|
import bi from "swrv";
|
|
@@ -183,8 +183,8 @@ var Pt = { exports: {} };
|
|
|
183
183
|
w[E - 1] = arguments[E];
|
|
184
184
|
m.fn.apply(m.context, w);
|
|
185
185
|
} else {
|
|
186
|
-
var
|
|
187
|
-
for (E = 0; E <
|
|
186
|
+
var N = m.length, C;
|
|
187
|
+
for (E = 0; E < N; E++)
|
|
188
188
|
switch (m[E].once && this.removeListener(l, m[E].fn, void 0, !0), k) {
|
|
189
189
|
case 1:
|
|
190
190
|
m[E].fn.call(m[E].context);
|
|
@@ -340,13 +340,13 @@ class ji {
|
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
X = new WeakMap();
|
|
343
|
-
var ge, me, he, Re, pe, ke, Z, ye, B, Te, J, ve, oe, ze, Pe,
|
|
343
|
+
var ge, me, he, Re, pe, ke, Z, ye, B, Te, J, ve, oe, ze, Pe, D, Gt, Ut, Ft, Bt, Wt, Ne, Ve, Ye, Le, Kt, Ae;
|
|
344
344
|
class Xi extends Ki {
|
|
345
345
|
// TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`
|
|
346
346
|
constructor(t) {
|
|
347
347
|
var i, s;
|
|
348
348
|
super();
|
|
349
|
-
P(this,
|
|
349
|
+
P(this, D);
|
|
350
350
|
P(this, ge);
|
|
351
351
|
P(this, me);
|
|
352
352
|
P(this, he, 0);
|
|
@@ -390,7 +390,7 @@ class Xi extends Ki {
|
|
|
390
390
|
set concurrency(t) {
|
|
391
391
|
if (!(typeof t == "number" && t >= 1))
|
|
392
392
|
throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);
|
|
393
|
-
H(this, ve, t), G(this,
|
|
393
|
+
H(this, ve, t), G(this, D, Le).call(this);
|
|
394
394
|
}
|
|
395
395
|
/**
|
|
396
396
|
Updates the priority of a promise function by its id, affecting its execution order. Requires a defined concurrency limit to take effect.
|
|
@@ -443,7 +443,7 @@ class Xi extends Ki {
|
|
|
443
443
|
try {
|
|
444
444
|
(o = i.signal) == null || o.throwIfAborted();
|
|
445
445
|
let n = t({ signal: i.signal });
|
|
446
|
-
i.timeout && (n = Yi(Promise.resolve(n), { milliseconds: i.timeout })), i.signal && (n = Promise.race([n, G(this,
|
|
446
|
+
i.timeout && (n = Yi(Promise.resolve(n), { milliseconds: i.timeout })), i.signal && (n = Promise.race([n, G(this, D, Kt).call(this, i.signal)]));
|
|
447
447
|
const h = await n;
|
|
448
448
|
s(h), this.emit("completed", h);
|
|
449
449
|
} catch (n) {
|
|
@@ -453,9 +453,9 @@ class Xi extends Ki {
|
|
|
453
453
|
}
|
|
454
454
|
r(n), this.emit("error", n);
|
|
455
455
|
} finally {
|
|
456
|
-
G(this,
|
|
456
|
+
G(this, D, Ft).call(this);
|
|
457
457
|
}
|
|
458
|
-
}, i), this.emit("add"), G(this,
|
|
458
|
+
}, i), this.emit("add"), G(this, D, Ne).call(this);
|
|
459
459
|
});
|
|
460
460
|
}
|
|
461
461
|
async addAll(t, i) {
|
|
@@ -465,7 +465,7 @@ class Xi extends Ki {
|
|
|
465
465
|
Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)
|
|
466
466
|
*/
|
|
467
467
|
start() {
|
|
468
|
-
return _(this, oe) ? (H(this, oe, !1), G(this,
|
|
468
|
+
return _(this, oe) ? (H(this, oe, !1), G(this, D, Le).call(this), this) : this;
|
|
469
469
|
}
|
|
470
470
|
/**
|
|
471
471
|
Put queue execution on hold.
|
|
@@ -485,7 +485,7 @@ class Xi extends Ki {
|
|
|
485
485
|
@returns A promise that settles when the queue becomes empty.
|
|
486
486
|
*/
|
|
487
487
|
async onEmpty() {
|
|
488
|
-
_(this, B).size !== 0 && await G(this,
|
|
488
|
+
_(this, B).size !== 0 && await G(this, D, Ae).call(this, "empty");
|
|
489
489
|
}
|
|
490
490
|
/**
|
|
491
491
|
@returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.
|
|
@@ -495,7 +495,7 @@ class Xi extends Ki {
|
|
|
495
495
|
Note that this only limits the number of items waiting to start. There could still be up to `concurrency` jobs already running that this call does not include in its calculation.
|
|
496
496
|
*/
|
|
497
497
|
async onSizeLessThan(t) {
|
|
498
|
-
_(this, B).size < t || await G(this,
|
|
498
|
+
_(this, B).size < t || await G(this, D, Ae).call(this, "next", () => _(this, B).size < t);
|
|
499
499
|
}
|
|
500
500
|
/**
|
|
501
501
|
The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.
|
|
@@ -503,7 +503,7 @@ class Xi extends Ki {
|
|
|
503
503
|
@returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
|
|
504
504
|
*/
|
|
505
505
|
async onIdle() {
|
|
506
|
-
_(this, J) === 0 && _(this, B).size === 0 || await G(this,
|
|
506
|
+
_(this, J) === 0 && _(this, B).size === 0 || await G(this, D, Ae).call(this, "idle");
|
|
507
507
|
}
|
|
508
508
|
/**
|
|
509
509
|
Size of the queue, the number of queued items waiting to run.
|
|
@@ -532,14 +532,14 @@ class Xi extends Ki {
|
|
|
532
532
|
return _(this, oe);
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
|
-
ge = new WeakMap(), me = new WeakMap(), he = new WeakMap(), Re = new WeakMap(), pe = new WeakMap(), ke = new WeakMap(), Z = new WeakMap(), ye = new WeakMap(), B = new WeakMap(), Te = new WeakMap(), J = new WeakMap(), ve = new WeakMap(), oe = new WeakMap(), ze = new WeakMap(), Pe = new WeakMap(),
|
|
535
|
+
ge = new WeakMap(), me = new WeakMap(), he = new WeakMap(), Re = new WeakMap(), pe = new WeakMap(), ke = new WeakMap(), Z = new WeakMap(), ye = new WeakMap(), B = new WeakMap(), Te = new WeakMap(), J = new WeakMap(), ve = new WeakMap(), oe = new WeakMap(), ze = new WeakMap(), Pe = new WeakMap(), D = new WeakSet(), Gt = function() {
|
|
536
536
|
return _(this, me) || _(this, he) < _(this, Re);
|
|
537
537
|
}, Ut = function() {
|
|
538
538
|
return _(this, J) < _(this, ve);
|
|
539
539
|
}, Ft = function() {
|
|
540
|
-
we(this, J)._--, G(this,
|
|
540
|
+
we(this, J)._--, G(this, D, Ne).call(this), this.emit("next");
|
|
541
541
|
}, Bt = function() {
|
|
542
|
-
G(this,
|
|
542
|
+
G(this, D, Ye).call(this), G(this, D, Ve).call(this), H(this, ye, void 0);
|
|
543
543
|
}, Wt = function() {
|
|
544
544
|
const t = Date.now();
|
|
545
545
|
if (_(this, Z) === void 0) {
|
|
@@ -548,7 +548,7 @@ ge = new WeakMap(), me = new WeakMap(), he = new WeakMap(), Re = new WeakMap(),
|
|
|
548
548
|
H(this, he, _(this, ge) ? _(this, J) : 0);
|
|
549
549
|
else
|
|
550
550
|
return _(this, ye) === void 0 && H(this, ye, setTimeout(() => {
|
|
551
|
-
G(this,
|
|
551
|
+
G(this, D, Bt).call(this);
|
|
552
552
|
}, i)), !0;
|
|
553
553
|
}
|
|
554
554
|
return !1;
|
|
@@ -556,24 +556,24 @@ ge = new WeakMap(), me = new WeakMap(), he = new WeakMap(), Re = new WeakMap(),
|
|
|
556
556
|
if (_(this, B).size === 0)
|
|
557
557
|
return _(this, Z) && clearInterval(_(this, Z)), H(this, Z, void 0), this.emit("empty"), _(this, J) === 0 && this.emit("idle"), !1;
|
|
558
558
|
if (!_(this, oe)) {
|
|
559
|
-
const t = !_(this,
|
|
560
|
-
if (_(this,
|
|
559
|
+
const t = !_(this, D, Wt);
|
|
560
|
+
if (_(this, D, Gt) && _(this, D, Ut)) {
|
|
561
561
|
const i = _(this, B).dequeue();
|
|
562
|
-
return i ? (this.emit("active"), i(), t && G(this,
|
|
562
|
+
return i ? (this.emit("active"), i(), t && G(this, D, Ve).call(this), !0) : !1;
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
565
|
return !1;
|
|
566
566
|
}, Ve = function() {
|
|
567
567
|
_(this, me) || _(this, Z) !== void 0 || (H(this, Z, setInterval(() => {
|
|
568
|
-
G(this,
|
|
568
|
+
G(this, D, Ye).call(this);
|
|
569
569
|
}, _(this, pe))), H(this, ke, Date.now() + _(this, pe)));
|
|
570
570
|
}, Ye = function() {
|
|
571
|
-
_(this, he) === 0 && _(this, J) === 0 && _(this, Z) && (clearInterval(_(this, Z)), H(this, Z, void 0)), H(this, he, _(this, ge) ? _(this, J) : 0), G(this,
|
|
571
|
+
_(this, he) === 0 && _(this, J) === 0 && _(this, Z) && (clearInterval(_(this, Z)), H(this, Z, void 0)), H(this, he, _(this, ge) ? _(this, J) : 0), G(this, D, Le).call(this);
|
|
572
572
|
}, /**
|
|
573
573
|
Executes all queued functions until it reaches the limit.
|
|
574
574
|
*/
|
|
575
575
|
Le = function() {
|
|
576
|
-
for (; G(this,
|
|
576
|
+
for (; G(this, D, Ne).call(this); )
|
|
577
577
|
;
|
|
578
578
|
}, Kt = async function(t) {
|
|
579
579
|
return new Promise((i, s) => {
|
|
@@ -620,16 +620,16 @@ function Ji({
|
|
|
620
620
|
var w, E;
|
|
621
621
|
s.value = await ((w = u == null ? void 0 : u.exploreBaseUrl) == null ? void 0 : w.call(u)) ?? "", r.value = await ((E = u == null ? void 0 : u.requestsBaseUrl) == null ? void 0 : E.call(u)) ?? "";
|
|
622
622
|
});
|
|
623
|
-
const o =
|
|
624
|
-
var
|
|
625
|
-
const w = [...e.value.filters, ...t.value.query.filters ?? []], E = ((
|
|
623
|
+
const o = S(() => !["golden_signals", "top_n", "gauge"].includes(t.value.chart.type)), n = S(() => r.value && t.value.query && t.value.query.datasource !== "llm_usage"), h = S(() => s.value && t.value.query && ["basic", "api_usage", "llm_usage", void 0].includes(t.value.query.datasource)), l = S(() => i.value ? Ke(i.value.meta.granularity_ms) : void 0), d = S(() => {
|
|
624
|
+
var N;
|
|
625
|
+
const w = [...e.value.filters, ...t.value.query.filters ?? []], E = ((N = t.value.query) == null ? void 0 : N.datasource) ?? "api_usage";
|
|
626
626
|
return w.filter((C) => Ot(C.field).some((A) => E === A));
|
|
627
|
-
}), a =
|
|
627
|
+
}), a = S(() => {
|
|
628
628
|
if (!h.value || !o.value)
|
|
629
629
|
return "";
|
|
630
|
-
const w = d.value, E = t.value.query.time_range || e.value.timeSpec,
|
|
631
|
-
return k(
|
|
632
|
-
}), f =
|
|
630
|
+
const w = d.value, E = t.value.query.time_range || e.value.timeSpec, N = m(E, w);
|
|
631
|
+
return k(N);
|
|
632
|
+
}), f = S(() => {
|
|
633
633
|
if (!n.value || !o.value)
|
|
634
634
|
return "";
|
|
635
635
|
const w = [...e.value.filters, ...t.value.query.filters ?? []], E = g(
|
|
@@ -638,12 +638,12 @@ function Ji({
|
|
|
638
638
|
);
|
|
639
639
|
return p(E);
|
|
640
640
|
}), p = (w) => n.value ? `${r.value}?q=${JSON.stringify(w)}` : "", g = (w, E) => {
|
|
641
|
-
var
|
|
641
|
+
var N, C;
|
|
642
642
|
return {
|
|
643
643
|
filter: E,
|
|
644
644
|
timeframe: {
|
|
645
645
|
timePeriodsKey: w.type === "relative" ? w.time_range : "custom",
|
|
646
|
-
start: w.type === "absolute" ? (
|
|
646
|
+
start: w.type === "absolute" ? (N = i.value) == null ? void 0 : N.meta.start_ms : void 0,
|
|
647
647
|
end: w.type === "absolute" ? (C = i.value) == null ? void 0 : C.meta.end_ms : void 0
|
|
648
648
|
}
|
|
649
649
|
};
|
|
@@ -655,19 +655,18 @@ function Ji({
|
|
|
655
655
|
end: w.type === "absolute" ? w.end : void 0
|
|
656
656
|
}
|
|
657
657
|
}), m = (w, E) => {
|
|
658
|
-
const
|
|
658
|
+
const N = t.value.query.dimensions ?? [];
|
|
659
659
|
return {
|
|
660
660
|
filters: E,
|
|
661
661
|
metrics: t.value.query.metrics ?? [],
|
|
662
|
-
dimensions:
|
|
662
|
+
dimensions: N,
|
|
663
663
|
time_range: w,
|
|
664
664
|
granularity: t.value.query.granularity || l.value
|
|
665
665
|
};
|
|
666
666
|
}, k = (w) => {
|
|
667
|
-
var D, C;
|
|
668
667
|
if (!h.value)
|
|
669
668
|
return "";
|
|
670
|
-
const E = (
|
|
669
|
+
const E = ["api_usage", "llm_usage"].includes(t.value.query.datasource) ? t.value.query.datasource : "api_usage";
|
|
671
670
|
return `${s.value}?q=${JSON.stringify(w)}&d=${E}&c=${t.value.chart.type}`;
|
|
672
671
|
};
|
|
673
672
|
return {
|
|
@@ -702,10 +701,10 @@ const ce = {
|
|
|
702
701
|
n.abort();
|
|
703
702
|
});
|
|
704
703
|
const h = (k, w, E) => {
|
|
705
|
-
const
|
|
706
|
-
return w &&
|
|
704
|
+
const N = [];
|
|
705
|
+
return w && N.push(...w), N.push(...fi(k, E)), N;
|
|
707
706
|
}, { data: l, error: d, isValidating: a } = bi(o, async () => {
|
|
708
|
-
var k, w, E,
|
|
707
|
+
var k, w, E, N;
|
|
709
708
|
try {
|
|
710
709
|
let {
|
|
711
710
|
datasource: C,
|
|
@@ -741,7 +740,7 @@ const ce = {
|
|
|
741
740
|
message: s.t("queryDataProvider.timeRangeExceeded"),
|
|
742
741
|
type: "range_exceeded"
|
|
743
742
|
} : g.value = {
|
|
744
|
-
message: ((
|
|
743
|
+
message: ((N = (E = C == null ? void 0 : C.response) == null ? void 0 : E.data) == null ? void 0 : N.message) || (C == null ? void 0 : C.message),
|
|
745
744
|
type: "other"
|
|
746
745
|
}, C;
|
|
747
746
|
} finally {
|
|
@@ -751,17 +750,17 @@ const ce = {
|
|
|
751
750
|
refreshInterval: t.context.refreshInterval,
|
|
752
751
|
revalidateOnFocus: !1,
|
|
753
752
|
shouldRetryOnError: !1
|
|
754
|
-
}), { state: f, swrvState: p } = Si(l, d, a), g = $(null), y =
|
|
753
|
+
}), { state: f, swrvState: p } = Si(l, d, a), g = $(null), y = S(() => f.value === p.ERROR || !!g.value), m = S(() => !t.queryReady || f.value === p.PENDING);
|
|
755
754
|
return Xe(l, (k) => {
|
|
756
755
|
k && i("chart-data", k);
|
|
757
756
|
}), (k, w) => {
|
|
758
757
|
var C;
|
|
759
|
-
const E = de("KSkeleton"),
|
|
758
|
+
const E = de("KSkeleton"), N = de("KEmptyState");
|
|
760
759
|
return m.value || !T(l) && !y.value ? (z(), M(E, {
|
|
761
760
|
key: 0,
|
|
762
761
|
class: "chart-skeleton",
|
|
763
762
|
type: "table"
|
|
764
|
-
})) : y.value && ((C = g.value) == null ? void 0 : C.type) === "forbidden" ? (z(), M(
|
|
763
|
+
})) : y.value && ((C = g.value) == null ? void 0 : C.type) === "forbidden" ? (z(), M(N, {
|
|
765
764
|
key: 1,
|
|
766
765
|
"action-button-visible": !1,
|
|
767
766
|
"data-testid": "chart-forbidden-state"
|
|
@@ -773,7 +772,7 @@ const ce = {
|
|
|
773
772
|
se(T(xi))
|
|
774
773
|
]),
|
|
775
774
|
_: 1
|
|
776
|
-
})) : y.value ? (z(), M(
|
|
775
|
+
})) : y.value ? (z(), M(N, {
|
|
777
776
|
key: 2,
|
|
778
777
|
"action-button-visible": !1,
|
|
779
778
|
"data-testid": "chart-empty-state",
|
|
@@ -808,7 +807,7 @@ const ce = {
|
|
|
808
807
|
Ze((i) => ({
|
|
809
808
|
"088169ae": `${i.height}px`
|
|
810
809
|
}));
|
|
811
|
-
const e = u, t =
|
|
810
|
+
const e = u, t = S(() => e.chartOptions.type === "single_value");
|
|
812
811
|
return (i, s) => (z(), M(tt, {
|
|
813
812
|
context: i.context,
|
|
814
813
|
query: i.query,
|
|
@@ -849,12 +848,12 @@ const ce = {
|
|
|
849
848
|
},
|
|
850
849
|
emits: ["edit-tile", "chart-data", "zoom-time-range", "view-requests", "select-chart-range"],
|
|
851
850
|
setup(u, { emit: e }) {
|
|
852
|
-
const t = u, i = e, { i18n: s } = ce.useI18n(), { evaluateFeatureFlag: r } = ce.useEvaluateFeatureFlag(), o = r("ma-4135-allow-zooming-all-dashboard-tiles", !1), n =
|
|
851
|
+
const t = u, i = e, { i18n: s } = ce.useI18n(), { evaluateFeatureFlag: r } = ce.useEvaluateFeatureFlag(), o = r("ma-4135-allow-zooming-all-dashboard-tiles", !1), n = S(() => ({
|
|
853
852
|
type: t.chartOptions.type,
|
|
854
853
|
stacked: t.chartOptions.stacked ?? !1,
|
|
855
854
|
chartDatasetColors: t.chartOptions.chart_dataset_colors,
|
|
856
855
|
threshold: t.chartOptions.threshold
|
|
857
|
-
})), h =
|
|
856
|
+
})), h = S(() => o ? t.context.zoomable : t.context.zoomable && !t.query.time_range), l = () => {
|
|
858
857
|
i("edit-tile");
|
|
859
858
|
}, d = (a) => {
|
|
860
859
|
i("chart-data", a);
|
|
@@ -966,7 +965,7 @@ const ce = {
|
|
|
966
965
|
exploreLink: {}
|
|
967
966
|
},
|
|
968
967
|
setup(u) {
|
|
969
|
-
const e = u, t =
|
|
968
|
+
const e = u, t = S(() => {
|
|
970
969
|
const s = e.context.timeSpec;
|
|
971
970
|
if (s.type === "absolute")
|
|
972
971
|
return new gi({
|
|
@@ -985,7 +984,7 @@ const ce = {
|
|
|
985
984
|
if (!r)
|
|
986
985
|
throw new Error("Unknown time range");
|
|
987
986
|
return r;
|
|
988
|
-
}), i =
|
|
987
|
+
}), i = S(() => {
|
|
989
988
|
var r, o;
|
|
990
989
|
const s = (r = e.query) == null ? void 0 : r.datasource;
|
|
991
990
|
if (s && s !== "api_usage" && s !== "basic")
|
|
@@ -1124,12 +1123,12 @@ const ce = {
|
|
|
1124
1123
|
Ze((v) => ({
|
|
1125
1124
|
"3d5e4dab": `${v.height}px`
|
|
1126
1125
|
}));
|
|
1127
|
-
const t = parseInt(Vt, 10), i = u, s = e, r = Dt(() => import("./GeoMapRenderer-
|
|
1126
|
+
const t = parseInt(Vt, 10), i = u, s = e, r = Dt(() => import("./GeoMapRenderer-CtZmojrF.js")), o = _e(ue), n = o == null ? void 0 : o.evaluateFeatureFlagFn("analytics-chart-zoom-actions", !1), { i18n: h } = ce.useI18n(), l = $(), d = $(!1), a = $(), f = $(!1), p = $(void 0), g = $(void 0), y = $(!0), {
|
|
1128
1127
|
exploreLinkKebabMenu: m,
|
|
1129
1128
|
requestsLinkKebabMenu: k,
|
|
1130
1129
|
canShowKebabMenu: w,
|
|
1131
1130
|
canGenerateRequestsLink: E,
|
|
1132
|
-
canGenerateExploreLink:
|
|
1131
|
+
canGenerateExploreLink: N,
|
|
1133
1132
|
buildExploreQuery: C,
|
|
1134
1133
|
buildExploreLink: R,
|
|
1135
1134
|
buildRequestLink: A,
|
|
@@ -1143,7 +1142,7 @@ const ce = {
|
|
|
1143
1142
|
Xe(() => i.definition, async () => {
|
|
1144
1143
|
await St(), a.value && (f.value = a.value.scrollWidth > a.value.clientWidth), y.value = !0;
|
|
1145
1144
|
}, { immediate: !0, deep: !0 });
|
|
1146
|
-
const U =
|
|
1145
|
+
const U = S(() => h.t("csvExport.defaultFilename")), ee = S(() => w.value && (ae.value || i.context.editable) || !!Fe.value), ae = S(() => !!m.value || "allow_csv_export" in i.definition.chart && i.definition.chart.allow_csv_export || i.context.editable), De = {
|
|
1147
1146
|
timeseries_line: wt,
|
|
1148
1147
|
timeseries_bar: wt,
|
|
1149
1148
|
horizontal_bar: bt,
|
|
@@ -1155,13 +1154,13 @@ const ce = {
|
|
|
1155
1154
|
slottable: void 0,
|
|
1156
1155
|
single_value: _t,
|
|
1157
1156
|
choropleth_map: r
|
|
1158
|
-
}, Se =
|
|
1157
|
+
}, Se = S(() => {
|
|
1159
1158
|
var v, O;
|
|
1160
1159
|
return {
|
|
1161
1160
|
...(v = be.value) != null && v.rendererEvents.supportsRequests ? { "select-chart-range": ri } : {},
|
|
1162
1161
|
...(O = be.value) != null && O.rendererEvents.supportsZoom ? { "zoom-time-range": si } : {}
|
|
1163
1162
|
};
|
|
1164
|
-
}), be =
|
|
1163
|
+
}), be = S(() => {
|
|
1165
1164
|
var j, K;
|
|
1166
1165
|
const v = De[i.definition.chart.type], O = !!((j = v == null ? void 0 : v.emits) != null && j.includes("select-chart-range")), I = !!((K = v == null ? void 0 : v.emits) != null && K.includes("zoom-time-range"));
|
|
1167
1166
|
return v && {
|
|
@@ -1181,7 +1180,7 @@ const ce = {
|
|
|
1181
1180
|
supportsZoom: I
|
|
1182
1181
|
}
|
|
1183
1182
|
};
|
|
1184
|
-
}), Fe =
|
|
1183
|
+
}), Fe = S(() => {
|
|
1185
1184
|
var O;
|
|
1186
1185
|
const v = (O = i.definition.query) == null ? void 0 : O.time_range;
|
|
1187
1186
|
if ((v == null ? void 0 : v.type) === "relative") {
|
|
@@ -1192,20 +1191,20 @@ const ce = {
|
|
|
1192
1191
|
return `${mt(v.start, { short: !0, tz: I })} - ${mt(v.end, { short: !0, tz: I })}`;
|
|
1193
1192
|
}
|
|
1194
1193
|
return null;
|
|
1195
|
-
}), nt =
|
|
1194
|
+
}), nt = S(() => l.value ? Ke(l.value.meta.granularity_ms) : void 0), Qt = S(() => ["timeseries_line", "timeseries_bar"].includes(i.definition.chart.type)), ot = S(() => {
|
|
1196
1195
|
var O, I;
|
|
1197
1196
|
if (!Qt.value || !i.queryReady || y.value)
|
|
1198
1197
|
return !1;
|
|
1199
1198
|
const v = (I = (O = i.definition) == null ? void 0 : O.query) == null ? void 0 : I.granularity;
|
|
1200
1199
|
return !v || !nt.value ? !1 : v !== nt.value;
|
|
1201
|
-
}), jt =
|
|
1200
|
+
}), jt = S(() => {
|
|
1202
1201
|
var I, j, K;
|
|
1203
1202
|
const v = Ke(((I = l.value) == null ? void 0 : I.meta.granularity_ms) ?? 0) ?? "unknown", O = ((K = (j = i.definition) == null ? void 0 : j.query) == null ? void 0 : K.granularity) ?? "unknown";
|
|
1204
1203
|
return h.t("query_aged_out_warning", {
|
|
1205
1204
|
currentGranularity: h.t(`granularities.${v}`),
|
|
1206
1205
|
savedGranularity: h.t(`granularities.${O}`)
|
|
1207
1206
|
});
|
|
1208
|
-
}), Xt =
|
|
1207
|
+
}), Xt = S(() => {
|
|
1209
1208
|
var I, j;
|
|
1210
1209
|
const v = [...i.context.filters, ...i.definition.query.filters ?? []], O = ((j = (I = i.definition) == null ? void 0 : I.query) == null ? void 0 : j.datasource) ?? "api_usage";
|
|
1211
1210
|
return v.filter((K) => Ot(K.field).some((ht) => O === ht));
|
|
@@ -1229,7 +1228,7 @@ const ce = {
|
|
|
1229
1228
|
s("tile-time-range-zoom", O);
|
|
1230
1229
|
}, ri = (v) => {
|
|
1231
1230
|
const O = Xt.value, I = L(v, O), j = C(v, O);
|
|
1232
|
-
p.value = E.value ? { href: A(I) } : void 0, g.value =
|
|
1231
|
+
p.value = E.value ? { href: A(I) } : void 0, g.value = N.value ? { href: R(j) } : void 0;
|
|
1233
1232
|
};
|
|
1234
1233
|
return (v, O) => {
|
|
1235
1234
|
const I = de("KTooltip"), j = de("KBadge"), K = de("KDropdownItem"), lt = de("KDropdown");
|
|
@@ -1408,7 +1407,7 @@ const ce = {
|
|
|
1408
1407
|
}), je(() => {
|
|
1409
1408
|
t.value && s.unobserve(t.value);
|
|
1410
1409
|
});
|
|
1411
|
-
const r =
|
|
1410
|
+
const r = S(() => bs(e.tileHeight, e.tiles).join(" ")), o = S(() => e.tiles.map((n, h) => ({
|
|
1412
1411
|
key: `tile-${h}`,
|
|
1413
1412
|
tile: n,
|
|
1414
1413
|
style: {
|
|
@@ -4047,9 +4046,9 @@ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the
|
|
|
4047
4046
|
n.x = Math.round(k / r), n.y = Math.round(w / o);
|
|
4048
4047
|
const E = this._extraDragRow;
|
|
4049
4048
|
if (this.engine.collide(s, n)) {
|
|
4050
|
-
const
|
|
4051
|
-
let C = Math.max(0, n.y + s.h -
|
|
4052
|
-
this.opts.maxRow &&
|
|
4049
|
+
const N = this.getRow();
|
|
4050
|
+
let C = Math.max(0, n.y + s.h - N);
|
|
4051
|
+
this.opts.maxRow && N + C > this.opts.maxRow && (C = Math.max(0, this.opts.maxRow - N)), this._extraDragRow = C;
|
|
4053
4052
|
} else
|
|
4054
4053
|
this._extraDragRow = 0;
|
|
4055
4054
|
if (this._extraDragRow !== E && this._updateContainerHeight(), s.x === n.x && s.y === n.y)
|
|
@@ -4197,13 +4196,13 @@ const Ts = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], zs = { cl
|
|
|
4197
4196
|
setup(u, { expose: e, emit: t }) {
|
|
4198
4197
|
const i = u, s = t, r = ui(u, "modelValue"), { i18n: o } = ce.useI18n(), n = $(0), h = $(null), l = _e(ue);
|
|
4199
4198
|
l || (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();
|
|
4200
|
-
const d = Mt(), a =
|
|
4199
|
+
const d = Mt(), a = S(() => i.context.timeSpec ? i.context.timeSpec : {
|
|
4201
4200
|
type: "relative",
|
|
4202
4201
|
time_range: d.defaultQueryTimeForOrg
|
|
4203
|
-
}), f =
|
|
4202
|
+
}), f = S(() => !!i.context.timeSpec || !d.loading), p = (R, A) => {
|
|
4204
4203
|
const L = R.layout.position.row - A.layout.position.row;
|
|
4205
4204
|
return L !== 0 ? L : R.layout.position.col - A.layout.position.col;
|
|
4206
|
-
}, g =
|
|
4205
|
+
}, g = S(() => r.value.tiles.map((R) => {
|
|
4207
4206
|
var L;
|
|
4208
4207
|
let A = R.definition;
|
|
4209
4208
|
if ("description" in A.chart) {
|
|
@@ -4230,7 +4229,7 @@ const Ts = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], zs = { cl
|
|
|
4230
4229
|
// Add a unique key to each tile internally.
|
|
4231
4230
|
id: R.id ?? crypto.randomUUID()
|
|
4232
4231
|
};
|
|
4233
|
-
})), y =
|
|
4232
|
+
})), y = S(() => {
|
|
4234
4233
|
var ae, De, Se;
|
|
4235
4234
|
let { tz: R, refreshInterval: A, editable: L } = i.context;
|
|
4236
4235
|
const U = [...i.context.filters ?? [], ...r.value.preset_filters ?? []];
|
|
@@ -4268,7 +4267,7 @@ const Ts = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], zs = { cl
|
|
|
4268
4267
|
r.value.tiles.push(L);
|
|
4269
4268
|
}, E = (R) => {
|
|
4270
4269
|
h.value && h.value.removeWidget(R.id);
|
|
4271
|
-
},
|
|
4270
|
+
}, N = () => {
|
|
4272
4271
|
n.value++;
|
|
4273
4272
|
}, C = (R) => {
|
|
4274
4273
|
const A = R.map((L) => ({
|
|
@@ -4279,7 +4278,7 @@ const Ts = ["data-id", "data-testid", "gs-h", "gs-w", "gs-x", "gs-y"], zs = { cl
|
|
|
4279
4278
|
}));
|
|
4280
4279
|
r.value.tiles = A.sort(p);
|
|
4281
4280
|
};
|
|
4282
|
-
return e({ refresh:
|
|
4281
|
+
return e({ refresh: N }), (R, A) => {
|
|
4283
4282
|
const L = de("KAlert");
|
|
4284
4283
|
return z(), W("div", Ns, [
|
|
4285
4284
|
T(l) ? (z(), M(Nt(R.context.editable ? Ss : Es), {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/dashboard-renderer",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/dashboard-renderer.umd.js",
|
|
6
6
|
"module": "./dist/dashboard-renderer.es.js",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"swrv": "^1.1.0",
|
|
31
31
|
"vue": "^3.5.13",
|
|
32
32
|
"@kong-ui-public/analytics-config-store": "^1.1.7",
|
|
33
|
-
"@kong-ui-public/analytics-chart": "^10.1.0",
|
|
34
33
|
"@kong-ui-public/analytics-geo-map": "^1.1.1",
|
|
35
34
|
"@kong-ui-public/analytics-metric-provider": "^10.0.0",
|
|
35
|
+
"@kong-ui-public/analytics-chart": "^10.1.0",
|
|
36
36
|
"@kong-ui-public/analytics-utilities": "^11.1.0",
|
|
37
|
-
"@kong-ui-public/entities-shared": "^3.27.8",
|
|
38
37
|
"@kong-ui-public/i18n": "^2.4.4",
|
|
38
|
+
"@kong-ui-public/entities-shared": "^3.27.8",
|
|
39
39
|
"@kong-ui-public/sandbox-layout": "^2.2.4"
|
|
40
40
|
},
|
|
41
41
|
"repository": {
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"@kong/kongponents": "^9.38.8",
|
|
61
61
|
"swrv": "^1.1.0",
|
|
62
62
|
"vue": ">= 3.3.13 < 4",
|
|
63
|
+
"@kong-ui-public/analytics-geo-map": "^1.1.1",
|
|
63
64
|
"@kong-ui-public/analytics-chart": "^10.1.0",
|
|
64
|
-
"@kong-ui-public/analytics-config-store": "^1.1.7",
|
|
65
65
|
"@kong-ui-public/analytics-metric-provider": "^10.0.0",
|
|
66
|
-
"@kong-ui-public/analytics-
|
|
66
|
+
"@kong-ui-public/analytics-config-store": "^1.1.7",
|
|
67
67
|
"@kong-ui-public/analytics-utilities": "^11.1.0",
|
|
68
68
|
"@kong-ui-public/i18n": "^2.4.4"
|
|
69
69
|
},
|