@kong-ui-public/analytics-chart 13.1.2 → 13.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,7 +1,7 @@
1
- (function(nt,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("vue"),require("@kong/icons"),require("@kong-ui-public/i18n"),require("@kong-ui-public/analytics-config-store"),require("@kong-ui-public/analytics-metric-provider"),require("@kong/kongponents")):typeof define=="function"&&define.amd?define(["exports","vue","@kong/icons","@kong-ui-public/i18n","@kong-ui-public/analytics-config-store","@kong-ui-public/analytics-metric-provider","@kong/kongponents"],u):(nt=typeof globalThis<"u"?globalThis:nt||self,u(nt["kong-ui-publicvitals-chart"]={},nt.Vue,nt.KongIcons,nt["kong-ui-public-i18n"],nt["kong-ui-public-analytics-config-store"],nt["kong-ui-public-analytics-metric-provider"],nt.Kongponents))})(this,(function(nt,u,St,vr,Mr,qe,Zn){"use strict";const Mf="analytics-query-provider",Df="analytics-dashboard-coordinator",mo="____OTHER____",Cf="empty";var W=(e=>(e.FIFTEEN_MIN="15m",e.ONE_HOUR="1h",e.SIX_HOUR="6h",e.TWELVE_HOUR="12h",e.ONE_DAY="24h",e.SEVEN_DAY="7d",e.THIRTY_DAY="30d",e.NINETY_DAY="90d",e.ONE_HUNDRED_EIGHTY_DAY="180d",e.ONE_YEAR="365d",e.CURRENT_WEEK="current_week",e.CURRENT_MONTH="current_month",e.CURRENT_QUARTER="current_quarter",e.CURRENT_YEAR="current_year",e.PREVIOUS_WEEK="previous_week",e.PREVIOUS_MONTH="previous_month",e.PREVIOUS_QUARTER="previous_quarter",e.PREVIOUS_YEAR="previous_year",e))(W||{});const Of=["in","not_in","selector"],Af=["empty","not_empty"],Pf=["secondly","tenSecondly","thirtySecondly","minutely","fiveMinutely","tenMinutely","thirtyMinutely","hourly","twoHourly","twelveHourly","daily","weekly","trend"],Ge=e=>e.filter(t=>t!=="time"),Dr=["api","api_package","api_product","api_product_version","control_plane","control_plane_group","data_plane_node","gateway_service","portal","route","status_code","status_code_grouped","time"],po=Ge(Dr),Ef=["active_services","error_rate","request_count","request_per_minute","response_latency_average"],Cr=[...Dr,"ai_gateway","ai_gateway_consumer","ai_gateway_consumer_group","ai_gateway_data_plane_node","application","bot_info_action","bot_info_detection_reason","bot_info_ban_type","cache_status","consumer","consumer_group","country_code","oidc_credential","upstream_status_code","upstream_status_code_grouped","response_source","data_plane_node_version","realm","portal_api","principal","principal_group"],go=Ge(Cr),Rf=[...Ef,"share_of_requests","cache_hit_rate","response_latency_p99","response_latency_p95","response_latency_p50","upstream_latency_p99","upstream_latency_p95","upstream_latency_p50","upstream_latency_average","kong_latency_p99","kong_latency_p95","kong_latency_p50","kong_latency_average","kong_internal_latency_p99","kong_internal_latency_p95","kong_internal_latency_p50","kong_internal_latency_average","response_size_p99","response_size_p95","response_size_p50","response_size_average","response_size_sum","request_size_p99","request_size_p95","request_size_p50","request_size_average","request_size_sum"],If=["ai_gateway","ai_gateway_agent","ai_gateway_consumer","ai_gateway_consumer_group","ai_gateway_data_plane_node","ai_gateway_mcp_server","ai_gateway_model","ai_gateway_version","ai_plugin","ai_provider","ai_request_model","ai_response_model","application","cache_status","consumer","control_plane","control_plane_group","gateway_service","llm_cache_status","llm_embeddings_model","llm_embeddings_provider","oidc_credential","principal","principal_group","realm","response_source","route","status_code","status_code_grouped","time","upstream_status_code","upstream_status_code_grouped"],yo=Ge(If),Lf=["a2a_context_id","a2a_error","a2a_method","a2a_task_id","a2a_task_state","ai_gateway","ai_gateway_consumer","ai_gateway_consumer_group","ai_gateway_data_plane_node","ai_gateway_version","api","api_package","api_product","api_product_version","application","auth_type","bot_info_action","bot_info_ban_type","bot_info_detection_reason","bot_info_header_names","bot_info_ja4_fingerprint","cache_status","client_ip","consumer","consumer_group","control_plane","control_plane_group","country_code","data_plane_node","data_plane_node_version","gateway_service","header_host","header_user_agent","http_method","mcp_error","mcp_method","mcp_session_id","mcp_tool_name","oidc_credential","portal","principal","principal_group","realm","request_id","request_uri","response_header_content_type","response_source","route","service_port","service_protocol","sse","status_code_grouped","time","trace_id","upstream_status_code_grouped","upstream_uri","websocket"],Nf=Ge(Lf),Bf=["ai_gateway_version","auth_type","cache_status","client_ip","data_plane_node_version","header_host","header_user_agent","http_method","oidc_credential","request_id","request_uri","response_header_content_type","response_source","service_port","service_protocol","trace_id","upstream_uri"],Ff=Bf,zf=["ai_count","latencies_response_ms","latencies_upstream_ms","latencies_kong_gateway_ms","latencies_kong_internal_ms","request_body_size","response_body_size","response_header_content_length","status_code","upstream_status_code"],Uf=Ge(zf),Vf=["platform","platform_usage"],Hf=e=>Vf.includes(e),$f=[...Cr.filter(e=>e!=="consumer_group"),"a2a_context_id","a2a_error","a2a_method","a2a_task_id","a2a_task_state","ai_gateway_agent","ai_gateway_mcp_server","ai_gateway_model","ai_gateway_version","ai_provider","mcp_error","mcp_method","mcp_session_id","mcp_tool_name"],bo=Ge($f);[...Rf];const Yf=["control_plane","data_plane_group","managed_cache","network","provider","provider_region","time"],_o=Ge(Yf);new Set(po),new Set(go),new Set(yo),new Set(bo),new Set(_o);const Or=[{code:"AF",name:"Afghanistan"},{code:"AX",name:"Aland Islands"},{code:"AL",name:"Albania"},{code:"DZ",name:"Algeria"},{code:"AS",name:"American Samoa"},{code:"AD",name:"Andorra"},{code:"AO",name:"Angola"},{code:"AI",name:"Anguilla"},{code:"AQ",name:"Antarctica"},{code:"AG",name:"Antigua and Barbuda"},{code:"AR",name:"Argentina"},{code:"AM",name:"Armenia"},{code:"AW",name:"Aruba"},{code:"AU",name:"Australia"},{code:"AT",name:"Austria"},{code:"AZ",name:"Azerbaijan"},{code:"BS",name:"Bahamas"},{code:"BH",name:"Bahrain"},{code:"BD",name:"Bangladesh"},{code:"BB",name:"Barbados"},{code:"BY",name:"Belarus"},{code:"BE",name:"Belgium"},{code:"BZ",name:"Belize"},{code:"BJ",name:"Benin"},{code:"BM",name:"Bermuda"},{code:"BT",name:"Bhutan"},{code:"BO",name:"Bolivia"},{code:"BA",name:"Bosnia and Herzegovina"},{code:"BW",name:"Botswana"},{code:"BV",name:"Bouvet Island"},{code:"BR",name:"Brazil"},{code:"IO",name:"British Indian Ocean Territory"},{code:"BN",name:"Brunei Darussalam"},{code:"BG",name:"Bulgaria"},{code:"BF",name:"Burkina Faso"},{code:"BI",name:"Burundi"},{code:"KH",name:"Cambodia"},{code:"CM",name:"Cameroon"},{code:"CA",name:"Canada"},{code:"CV",name:"Cape Verde"},{code:"KY",name:"Cayman Islands"},{code:"CF",name:"Central African Republic"},{code:"TD",name:"Chad"},{code:"CL",name:"Chile"},{code:"CN",name:"China"},{code:"CX",name:"Christmas Island"},{code:"CC",name:"Cocos (Keeling) Islands"},{code:"CO",name:"Colombia"},{code:"KM",name:"Comoros"},{code:"CG",name:"Congo"},{code:"CD",name:"Democratic Republic of the Congo"},{code:"CK",name:"Cook Islands"},{code:"CR",name:"Costa Rica"},{code:"CI",name:"Cote d'Ivoire"},{code:"HR",name:"Croatia"},{code:"CU",name:"Cuba"},{code:"CY",name:"Cyprus"},{code:"CZ",name:"Czech Republic"},{code:"DK",name:"Denmark"},{code:"DJ",name:"Djibouti"},{code:"DM",name:"Dominica"},{code:"DO",name:"Dominican Republic"},{code:"EC",name:"Ecuador"},{code:"EG",name:"Egypt"},{code:"SV",name:"El Salvador"},{code:"GQ",name:"Equatorial Guinea"},{code:"ER",name:"Eritrea"},{code:"EE",name:"Estonia"},{code:"ET",name:"Ethiopia"},{code:"FK",name:"Falkland Islands (Malvinas)"},{code:"FO",name:"Faroe Islands"},{code:"FJ",name:"Fiji"},{code:"FI",name:"Finland"},{code:"FR",name:"France"},{code:"GF",name:"French Guiana"},{code:"PF",name:"French Polynesia"},{code:"TF",name:"French Southern Territories"},{code:"GA",name:"Gabon"},{code:"GM",name:"Gambia"},{code:"GE",name:"Georgia"},{code:"DE",name:"Germany"},{code:"GH",name:"Ghana"},{code:"GI",name:"Gibraltar"},{code:"GR",name:"Greece"},{code:"GL",name:"Greenland"},{code:"GD",name:"Grenada"},{code:"GP",name:"Guadeloupe"},{code:"GU",name:"Guam"},{code:"GT",name:"Guatemala"},{code:"GG",name:"Guernsey"},{code:"GN",name:"Guinea"},{code:"GW",name:"Guinea-Bissau"},{code:"GY",name:"Guyana"},{code:"HT",name:"Haiti"},{code:"HM",name:"Heard Island and McDonald Islands"},{code:"VA",name:"The Vatican"},{code:"HN",name:"Honduras"},{code:"HK",name:"Hong Kong"},{code:"HU",name:"Hungary"},{code:"IS",name:"Iceland"},{code:"IN",name:"India"},{code:"ID",name:"Indonesia"},{code:"IR",name:"Iran"},{code:"IQ",name:"Iraq"},{code:"IE",name:"Ireland"},{code:"IM",name:"Isle of Man"},{code:"IL",name:"Israel"},{code:"IT",name:"Italy"},{code:"JM",name:"Jamaica"},{code:"JP",name:"Japan"},{code:"JE",name:"Jersey"},{code:"JO",name:"Jordan"},{code:"KZ",name:"Kazakhstan"},{code:"KE",name:"Kenya"},{code:"KI",name:"Kiribati"},{code:"KP",name:"North Korea"},{code:"KR",name:"South Korea"},{code:"KW",name:"Kuwait"},{code:"KG",name:"Kyrgyzstan"},{code:"LA",name:"Laos"},{code:"LV",name:"Latvia"},{code:"LB",name:"Lebanon"},{code:"LS",name:"Lesotho"},{code:"LR",name:"Liberia"},{code:"LY",name:"Libya"},{code:"LI",name:"Liechtenstein"},{code:"LT",name:"Lithuania"},{code:"LU",name:"Luxembourg"},{code:"MO",name:"Macao"},{code:"MK",name:"Macedonia"},{code:"MG",name:"Madagascar"},{code:"MW",name:"Malawi"},{code:"MY",name:"Malaysia"},{code:"MV",name:"Maldives"},{code:"ML",name:"Mali"},{code:"MT",name:"Malta"},{code:"MH",name:"Marshall Islands"},{code:"MQ",name:"Martinique"},{code:"MR",name:"Mauritania"},{code:"MU",name:"Mauritius"},{code:"YT",name:"Mayotte"},{code:"MX",name:"Mexico"},{code:"FM",name:"Micronesia, "},{code:"MD",name:"Moldova,"},{code:"MC",name:"Monaco"},{code:"MN",name:"Mongolia"},{code:"ME",name:"Montenegro"},{code:"MS",name:"Montserrat"},{code:"MA",name:"Morocco"},{code:"MZ",name:"Mozambique"},{code:"MM",name:"Myanmar"},{code:"NA",name:"Namibia"},{code:"NR",name:"Nauru"},{code:"NP",name:"Nepal"},{code:"NL",name:"Netherlands"},{code:"NC",name:"New Caledonia"},{code:"NZ",name:"New Zealand"},{code:"NI",name:"Nicaragua"},{code:"NE",name:"Niger"},{code:"NG",name:"Nigeria"},{code:"NU",name:"Niue"},{code:"NF",name:"Norfolk Island"},{code:"MP",name:"Northern Mariana Islands"},{code:"NO",name:"Norway"},{code:"OM",name:"Oman"},{code:"PK",name:"Pakistan"},{code:"PW",name:"Palau"},{code:"PA",name:"Panama"},{code:"PG",name:"Papua New Guinea"},{code:"PY",name:"Paraguay"},{code:"PE",name:"Peru"},{code:"PH",name:"Philippines"},{code:"PN",name:"Pitcairn"},{code:"PL",name:"Poland"},{code:"PT",name:"Portugal"},{code:"PR",name:"Puerto Rico"},{code:"QA",name:"Qatar"},{code:"RE",name:"Reunion"},{code:"RO",name:"Romania"},{code:"RU",name:"Russia"},{code:"RW",name:"Rwanda"},{code:"BL",name:"Saint Barthelemy"},{code:"SH",name:"Saint Helena"},{code:"KN",name:"Saint Kitts and Nevis"},{code:"LC",name:"Saint Lucia"},{code:"MF",name:"Saint Martin"},{code:"PM",name:"Saint Pierre and Miquelon"},{code:"VC",name:"Saint Vincent and the Grenadines"},{code:"WS",name:"Samoa"},{code:"SM",name:"San Marino"},{code:"ST",name:"Sao Tome and Principe"},{code:"SA",name:"Saudi Arabia"},{code:"SN",name:"Senegal"},{code:"RS",name:"Serbia"},{code:"SC",name:"Seychelles"},{code:"SL",name:"Sierra Leone"},{code:"SG",name:"Singapore"},{code:"SX",name:"Sint Maarten"},{code:"SK",name:"Slovakia"},{code:"SI",name:"Slovenia"},{code:"SB",name:"Solomon Islands"},{code:"SO",name:"Somalia"},{code:"ZA",name:"South Africa"},{code:"GS",name:"South Georgia and the South Sandwich Islands"},{code:"SS",name:"South Sudan"},{code:"ES",name:"Spain"},{code:"LK",name:"Sri Lanka"},{code:"SD",name:"Sudan"},{code:"SR",name:"Suriname"},{code:"SJ",name:"Svalbard and Jan Mayen"},{code:"SZ",name:"Swaziland"},{code:"SE",name:"Sweden"},{code:"CH",name:"Switzerland"},{code:"SY",name:"Syria"},{code:"TW",name:"Taiwan"},{code:"TJ",name:"Tajikistan"},{code:"TZ",name:"Tanzania"},{code:"TH",name:"Thailand"},{code:"TL",name:"Timor-Leste"},{code:"TG",name:"Togo"},{code:"TK",name:"Tokelau"},{code:"TO",name:"Tonga"},{code:"TT",name:"Trinidad and Tobago"},{code:"TN",name:"Tunisia"},{code:"TR",name:"Turkey"},{code:"TM",name:"Turkmenistan"},{code:"TC",name:"Turks and Caicos Islands"},{code:"TV",name:"Tuvalu"},{code:"UG",name:"Uganda"},{code:"UA",name:"Ukraine"},{code:"AE",name:"United Arab Emirates"},{code:"GB",name:"United Kingdom"},{code:"US",name:"United States"},{code:"UM",name:"United States Minor Outlying Islands"},{code:"UY",name:"Uruguay"},{code:"UZ",name:"Uzbekistan"},{code:"VU",name:"Vanuatu"},{code:"VE",name:"Venezuela"},{code:"VN",name:"Vietnam"},{code:"VG",name:"British Virgin Islands"},{code:"VI",name:"U.S. Virgin Islands"},{code:"WF",name:"Wallis and Futuna"},{code:"EH",name:"Western Sahara"},{code:"YE",name:"Yemen"},{code:"ZM",name:"Zambia"},{code:"ZW",name:"Zimbabwe"}],Ce=e=>({type:"array",description:"A list of filters to apply to the query",items:{oneOf:[{type:"object",description:"In filter",properties:{field:{type:"string",...e?{enum:e}:{}},operator:{type:"string",enum:Of},value:{type:"array",items:{type:["string","number","null"]}}},required:["field","operator","value"],additionalProperties:!1},{type:"object",description:"Empty filter",properties:{field:{type:"string",...e?{enum:e}:{}},operator:{type:"string",enum:Af}},required:["field","operator"],additionalProperties:!1}]}});({...Ce()},Or.map(e=>e.code));const Wf=["control_plane","gateway_service","realm","route","plugin","plugin_name","plugin_scope","data_plane_node_version","env","team","region","hostname"];Ce(go),Ce(po),Ce(yo),Ce(bo),Ce(_o),Ce(Array.from(new Set([...Nf,...Ff,...Uf]))),Ce([...new Set([...go,...po,...yo,...bo,...Wf,..._o])]);const jf={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},qf=(e,t,n)=>{let i;const s=jf[e];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+i:i+" ago":i};function xo(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Gf={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Xf={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Kf={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Zf={date:xo({formats:Gf,defaultWidth:"full"}),time:xo({formats:Xf,defaultWidth:"full"}),dateTime:xo({formats:Kf,defaultWidth:"full"})},Qf={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Jf=(e,t,n,i)=>Qf[e];function Qn(e){return(t,n)=>{const i=n?.context?String(n.context):"standalone";let s;if(i==="formatting"&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):a;s=e.formattingValues[r]||e.formattingValues[a]}else{const a=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;s=e.values[r]||e.values[a]}const o=e.argumentCallback?e.argumentCallback(t):t;return s[o]}}const tm={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},em={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},nm={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},im={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},sm={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},om={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},am=(e,t)=>{const n=Number(e),i=n%100;if(i>20||i<10)switch(i%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},rm={ordinalNumber:am,era:Qn({values:tm,defaultWidth:"wide"}),quarter:Qn({values:em,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Qn({values:nm,defaultWidth:"wide"}),day:Qn({values:im,defaultWidth:"wide"}),dayPeriod:Qn({values:sm,defaultWidth:"wide",formattingValues:om,defaultFormattingWidth:"wide"})};function Jn(e){return(t,n={})=>{const i=n.width,s=i&&e.matchPatterns[i]||e.matchPatterns[e.defaultMatchWidth],o=t.match(s);if(!o)return null;const a=o[0],r=i&&e.parsePatterns[i]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(r)?cm(r,h=>h.test(a)):lm(r,h=>h.test(a));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const d=t.slice(a.length);return{value:c,rest:d}}}function lm(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function cm(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function um(e){return(t,n={})=>{const i=t.match(e.matchPattern);if(!i)return null;const s=i[0],o=t.match(e.parsePattern);if(!o)return null;let a=e.valueCallback?e.valueCallback(o[0]):o[0];a=n.valueCallback?n.valueCallback(a):a;const r=t.slice(s.length);return{value:a,rest:r}}}const dm=/^(\d+)(th|st|nd|rd)?/i,hm=/\d+/i,fm={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},mm={any:[/^b/i,/^(a|c)/i]},pm={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},gm={any:[/1/i,/2/i,/3/i,/4/i]},ym={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},bm={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},_m={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},xm={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},wm={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},km={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Tm={ordinalNumber:um({matchPattern:dm,parsePattern:hm,valueCallback:e=>parseInt(e,10)}),era:Jn({matchPatterns:fm,defaultMatchWidth:"wide",parsePatterns:mm,defaultParseWidth:"any"}),quarter:Jn({matchPatterns:pm,defaultMatchWidth:"wide",parsePatterns:gm,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Jn({matchPatterns:ym,defaultMatchWidth:"wide",parsePatterns:bm,defaultParseWidth:"any"}),day:Jn({matchPatterns:_m,defaultMatchWidth:"wide",parsePatterns:xm,defaultParseWidth:"any"}),dayPeriod:Jn({matchPatterns:wm,defaultMatchWidth:"any",parsePatterns:km,defaultParseWidth:"any"})},Sm={code:"en-US",formatDistance:qf,formatLong:Zf,formatRelative:Jf,localize:rm,match:Tm,options:{weekStartsOn:0,firstWeekContainsDate:1}};let vm={};function ti(){return vm}const Ar=6048e5,Mm=864e5,Dm=60,Cm=3600,Pr=Symbol.for("constructDateFrom");function se(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Pr in e?e[Pr](t):e instanceof Date?new e.constructor(t):new Date(t)}function zt(e,t){return se(t||e,e)}function Er(e){const t=zt(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Om(e,...t){const n=se.bind(null,t.find(i=>typeof i=="object"));return t.map(n)}function _n(e,t){const n=zt(e,t?.in);return n.setHours(0,0,0,0),n}function Am(e,t,n){const[i,s]=Om(n?.in,e,t),o=_n(i),a=_n(s),r=+o-Er(o),l=+a-Er(a);return Math.round((r-l)/Mm)}function Pm(e,t){const n=zt(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Em(e,t){const n=zt(e,t?.in);return Am(n,Pm(n))+1}function ye(e,t){const n=ti(),i=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=zt(e,t?.in),o=s.getDay(),a=(o<i?7:0)+o-i;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function Xi(e,t){return ye(e,{...t,weekStartsOn:1})}function Rr(e,t){const n=zt(e,t?.in),i=n.getFullYear(),s=se(n,0);s.setFullYear(i+1,0,4),s.setHours(0,0,0,0);const o=Xi(s),a=se(n,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const r=Xi(a);return n.getTime()>=o.getTime()?i+1:n.getTime()>=r.getTime()?i:i-1}function Rm(e,t){const n=Rr(e,t),i=se(e,0);return i.setFullYear(n,0,4),i.setHours(0,0,0,0),Xi(i)}function Im(e,t){const n=zt(e,t?.in),i=+Xi(n)-+Rm(n);return Math.round(i/Ar)+1}function Ir(e,t){const n=zt(e,t?.in),i=n.getFullYear(),s=ti(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=se(t?.in||e,0);a.setFullYear(i+1,0,o),a.setHours(0,0,0,0);const r=ye(a,t),l=se(t?.in||e,0);l.setFullYear(i,0,o),l.setHours(0,0,0,0);const c=ye(l,t);return+n>=+r?i+1:+n>=+c?i:i-1}function Lm(e,t){const n=ti(),i=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=Ir(e,t),o=se(t?.in||e,0);return o.setFullYear(s,0,i),o.setHours(0,0,0,0),ye(o,t)}function Nm(e,t){const n=zt(e,t?.in),i=+ye(n,t)-+Lm(n,t);return Math.round(i/Ar)+1}function dt(e,t){const n=e<0?"-":"",i=Math.abs(e).toString().padStart(t,"0");return n+i}const Oe={y(e,t){const n=e.getFullYear(),i=n>0?n:1-n;return dt(t==="yy"?i%100:i,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):dt(n+1,2)},d(e,t){return dt(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(e,t){return dt(e.getHours()%12||12,t.length)},H(e,t){return dt(e.getHours(),t.length)},m(e,t){return dt(e.getMinutes(),t.length)},s(e,t){return dt(e.getSeconds(),t.length)},S(e,t){const n=t.length,i=e.getMilliseconds(),s=Math.trunc(i*Math.pow(10,n-3));return dt(s,t.length)}},xn={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Lr={G:function(e,t,n){const i=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(i,{width:"abbreviated"});case"GGGGG":return n.era(i,{width:"narrow"});default:return n.era(i,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const i=e.getFullYear(),s=i>0?i:1-i;return n.ordinalNumber(s,{unit:"year"})}return Oe.y(e,t)},Y:function(e,t,n,i){const s=Ir(e,i),o=s>0?s:1-s;if(t==="YY"){const a=o%100;return dt(a,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):dt(o,t.length)},R:function(e,t){const n=Rr(e);return dt(n,t.length)},u:function(e,t){const n=e.getFullYear();return dt(n,t.length)},Q:function(e,t,n){const i=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return dt(i,2);case"Qo":return n.ordinalNumber(i,{unit:"quarter"});case"QQQ":return n.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(i,{width:"narrow",context:"formatting"});default:return n.quarter(i,{width:"wide",context:"formatting"})}},q:function(e,t,n){const i=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return dt(i,2);case"qo":return n.ordinalNumber(i,{unit:"quarter"});case"qqq":return n.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(i,{width:"narrow",context:"standalone"});default:return n.quarter(i,{width:"wide",context:"standalone"})}},M:function(e,t,n){const i=e.getMonth();switch(t){case"M":case"MM":return Oe.M(e,t);case"Mo":return n.ordinalNumber(i+1,{unit:"month"});case"MMM":return n.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(i,{width:"narrow",context:"formatting"});default:return n.month(i,{width:"wide",context:"formatting"})}},L:function(e,t,n){const i=e.getMonth();switch(t){case"L":return String(i+1);case"LL":return dt(i+1,2);case"Lo":return n.ordinalNumber(i+1,{unit:"month"});case"LLL":return n.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(i,{width:"narrow",context:"standalone"});default:return n.month(i,{width:"wide",context:"standalone"})}},w:function(e,t,n,i){const s=Nm(e,i);return t==="wo"?n.ordinalNumber(s,{unit:"week"}):dt(s,t.length)},I:function(e,t,n){const i=Im(e);return t==="Io"?n.ordinalNumber(i,{unit:"week"}):dt(i,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Oe.d(e,t)},D:function(e,t,n){const i=Em(e);return t==="Do"?n.ordinalNumber(i,{unit:"dayOfYear"}):dt(i,t.length)},E:function(e,t,n){const i=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},e:function(e,t,n,i){const s=e.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return dt(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,n,i){const s=e.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return dt(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,n){const i=e.getDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return dt(s,t.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const i=e.getHours();let s;switch(i===12?s=xn.noon:i===0?s=xn.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,n){const i=e.getHours();let s;switch(i>=17?s=xn.evening:i>=12?s=xn.afternoon:i>=4?s=xn.morning:s=xn.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let i=e.getHours()%12;return i===0&&(i=12),n.ordinalNumber(i,{unit:"hour"})}return Oe.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Oe.H(e,t)},K:function(e,t,n){const i=e.getHours()%12;return t==="Ko"?n.ordinalNumber(i,{unit:"hour"}):dt(i,t.length)},k:function(e,t,n){let i=e.getHours();return i===0&&(i=24),t==="ko"?n.ordinalNumber(i,{unit:"hour"}):dt(i,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Oe.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Oe.s(e,t)},S:function(e,t){return Oe.S(e,t)},X:function(e,t,n){const i=e.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return Br(i);case"XXXX":case"XX":return Xe(i);default:return Xe(i,":")}},x:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"x":return Br(i);case"xxxx":case"xx":return Xe(i);default:return Xe(i,":")}},O:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Nr(i,":");default:return"GMT"+Xe(i,":")}},z:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Nr(i,":");default:return"GMT"+Xe(i,":")}},t:function(e,t,n){const i=Math.trunc(+e/1e3);return dt(i,t.length)},T:function(e,t,n){return dt(+e,t.length)}};function Nr(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=Math.trunc(i/60),o=i%60;return o===0?n+String(s):n+String(s)+t+dt(o,2)}function Br(e,t){return e%60===0?(e>0?"-":"+")+dt(Math.abs(e)/60,2):Xe(e,t)}function Xe(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=dt(Math.trunc(i/60),2),o=dt(i%60,2);return n+s+t+o}const Fr=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},zr=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Bm=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],i=n[1],s=n[2];if(!s)return Fr(e,t);let o;switch(i){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",Fr(i,t)).replace("{{time}}",zr(s,t))},Fm={p:zr,P:Bm},zm=/^D+$/,Um=/^Y+$/,Vm=["D","DD","YY","YYYY"];function Hm(e){return zm.test(e)}function $m(e){return Um.test(e)}function Ym(e,t,n){const i=Wm(e,t,n);if(console.warn(i),Vm.includes(e))throw new RangeError(i)}function Wm(e,t,n){const i=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${i} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function jm(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function qm(e){return!(!jm(e)&&typeof e!="number"||isNaN(+zt(e)))}const Gm=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Xm=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Km=/^'([^]*?)'?$/,Zm=/''/g,Qm=/[a-zA-Z]/;function Jm(e,t,n){const i=ti(),s=n?.locale??i.locale??Sm,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,r=zt(e,n?.in);if(!qm(r))throw new RangeError("Invalid time value");let l=t.match(Xm).map(d=>{const h=d[0];if(h==="p"||h==="P"){const f=Fm[h];return f(d,s.formatLong)}return d}).join("").match(Gm).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const h=d[0];if(h==="'")return{isToken:!1,value:tp(d)};if(Lr[h])return{isToken:!0,value:d};if(h.match(Qm))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:d}});s.localize.preprocessor&&(l=s.localize.preprocessor(r,l));const c={firstWeekContainsDate:o,weekStartsOn:a,locale:s};return l.map(d=>{if(!d.isToken)return d.value;const h=d.value;(!n?.useAdditionalWeekYearTokens&&$m(h)||!n?.useAdditionalDayOfYearTokens&&Hm(h))&&Ym(h,t,String(e));const f=Lr[h[0]];return f(r,h,s.localize,c)}).join("")}function tp(e){const t=e.match(Km);return t?t[1].replace(Zm,"'"):e}function Ki(e,t,n){const i=zt(e,n?.in);return isNaN(t)?se(e,NaN):(i.setDate(i.getDate()+t),i)}function Ur(e,t,n){const i=zt(e,n?.in);if(isNaN(t))return se(e,NaN);if(!t)return i;const s=i.getDate(),o=se(e,i.getTime());o.setMonth(i.getMonth()+t+1,0);const a=o.getDate();return s>=a?o:(i.setFullYear(o.getFullYear(),o.getMonth(),s),i)}function ep(e,t,n){return Ur(e,t*3,n)}function wn(e,t){const n=zt(e,t?.in),i=n.getMonth(),s=i-i%3;return n.setMonth(s,1),n.setHours(0,0,0,0),n}function kn(e,t){const n=zt(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function np(e,t){const n=zt(e,t?.in),i=n.getFullYear(),s=n.getMonth(),o=se(n,0);return o.setFullYear(i,s+1,0),o.setHours(0,0,0,0),o.getDate()}function ip(){return Object.assign({},ti())}function Vr(e){return Math.trunc(e*Cm)}function sp(e){const t=e/Dm;return Math.trunc(t)}function Hr(e,t,n){return Ur(e,-1,n)}function $r(e,t,n){return ep(e,-1,n)}function Yr(e,t,n){const i=ip(),s=rp(e,n.timeZone,n.locale??i.locale);return"formatToParts"in s?op(s,t):ap(s,t)}function op(e,t){const n=e.formatToParts(t);for(let i=n.length-1;i>=0;--i)if(n[i].type==="timeZoneName")return n[i].value}function ap(e,t){const n=e.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(n);return i?i[0].substr(1):""}function rp(e,t,n){return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}function lp(e,t){const n=fp(t);return"formatToParts"in n?up(n,e):dp(n,e)}const cp={year:0,month:1,day:2,hour:3,minute:4,second:5};function up(e,t){try{const n=e.formatToParts(t),i=[];for(let s=0;s<n.length;s++){const o=cp[n[s].type];o!==void 0&&(i[o]=parseInt(n[s].value,10))}return i}catch(n){if(n instanceof RangeError)return[NaN];throw n}}function dp(e,t){const n=e.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(i[3],10),parseInt(i[1],10),parseInt(i[2],10),parseInt(i[4],10),parseInt(i[5],10),parseInt(i[6],10)]}const wo={},Wr=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),hp=Wr==="06/25/2014, 00:00:00"||Wr==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";function fp(e){return wo[e]||(wo[e]=hp?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),wo[e]}function ko(e,t,n,i,s,o,a){const r=new Date(0);return r.setUTCFullYear(e,t,n),r.setUTCHours(i,s,o,a),r}const jr=36e5,mp=6e4,To={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function ei(e,t,n){if(!e)return 0;let i=To.timezoneZ.exec(e);if(i)return 0;let s,o;if(i=To.timezoneHH.exec(e),i)return s=parseInt(i[1],10),qr(s)?-(s*jr):NaN;if(i=To.timezoneHHMM.exec(e),i){s=parseInt(i[2],10);const a=parseInt(i[3],10);return qr(s,a)?(o=Math.abs(s)*jr+a*mp,i[1]==="+"?-o:o):NaN}if(yp(e)){t=new Date(t||Date.now());const a=n?t:pp(t),r=So(a,e);return-(n?r:gp(t,r,e))}return NaN}function pp(e){return ko(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function So(e,t){const n=lp(e,t),i=ko(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime();let s=e.getTime();const o=s%1e3;return s-=o>=0?o:1e3+o,i-s}function gp(e,t,n){let i=e.getTime()-t;const s=So(new Date(i),n);if(t===s)return t;i-=s-t;const o=So(new Date(i),n);return s===o?s:Math.max(s,o)}function qr(e,t){return-23<=e&&e<=23&&(t==null||0<=t&&t<=59)}const Gr={};function yp(e){if(Gr[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),Gr[e]=!0,!0}catch{return!1}}const bp=60*1e3,_p={X:function(e,t,n){const i=vo(n.timeZone,e);if(i===0)return"Z";switch(t){case"X":return Xr(i);case"XXXX":case"XX":return Tn(i);default:return Tn(i,":")}},x:function(e,t,n){const i=vo(n.timeZone,e);switch(t){case"x":return Xr(i);case"xxxx":case"xx":return Tn(i);default:return Tn(i,":")}},O:function(e,t,n){const i=vo(n.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+xp(i,":");default:return"GMT"+Tn(i,":")}},z:function(e,t,n){switch(t){case"z":case"zz":case"zzz":return Yr("short",e,n);default:return Yr("long",e,n)}}};function vo(e,t){const n=e?ei(e,t,!0)/bp:t?.getTimezoneOffset()??0;if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+e);return n}function Zi(e,t){const n=e<0?"-":"";let i=Math.abs(e).toString();for(;i.length<t;)i="0"+i;return n+i}function Tn(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=Zi(Math.floor(i/60),2),o=Zi(Math.floor(i%60),2);return n+s+t+o}function Xr(e,t){return e%60===0?(e>0?"-":"+")+Zi(Math.abs(e)/60,2):Tn(e,t)}function xp(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=Math.floor(i/60),o=i%60;return o===0?n+String(s):n+String(s)+t+Zi(o,2)}function Kr(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const Zr=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Mo=36e5,Qr=6e4,wp=2,jt={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Zr};function Qi(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(e===null)return new Date(NaN);const n=t.additionalDigits==null?wp:Number(t.additionalDigits);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]")return new Date(e.getTime());if(typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]")return new Date(e);if(Object.prototype.toString.call(e)!=="[object String]")return new Date(NaN);const i=kp(e),{year:s,restDateString:o}=Tp(i.date,n),a=Sp(o,s);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const r=a.getTime();let l=0,c;if(i.time&&(l=vp(i.time),l===null||isNaN(l)))return new Date(NaN);if(i.timeZone||t.timeZone){if(c=ei(i.timeZone||t.timeZone,new Date(r+l)),isNaN(c))return new Date(NaN)}else c=Kr(new Date(r+l)),c=Kr(new Date(r+l+c));return new Date(r+l+c)}else return new Date(NaN)}function kp(e){const t={};let n=jt.dateTimePattern.exec(e),i;if(n?(t.date=n[1],i=n[3]):(n=jt.datePattern.exec(e),n?(t.date=n[1],i=n[2]):(t.date=null,i=e)),i){const s=jt.timeZone.exec(i);s?(t.time=i.replace(s[1],""),t.timeZone=s[1].trim()):t.time=i}return t}function Tp(e,t){if(e){const n=jt.YYY[t],i=jt.YYYYY[t];let s=jt.YYYY.exec(e)||i.exec(e);if(s){const o=s[1];return{year:parseInt(o,10),restDateString:e.slice(o.length)}}if(s=jt.YY.exec(e)||n.exec(e),s){const o=s[1];return{year:parseInt(o,10)*100,restDateString:e.slice(o.length)}}}return{year:null}}function Sp(e,t){if(t===null)return null;let n,i,s;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let o=jt.MM.exec(e);if(o)return n=new Date(0),i=parseInt(o[1],10)-1,el(t,i)?(n.setUTCFullYear(t,i),n):new Date(NaN);if(o=jt.DDD.exec(e),o){n=new Date(0);const a=parseInt(o[1],10);return Cp(t,a)?(n.setUTCFullYear(t,0,a),n):new Date(NaN)}if(o=jt.MMDD.exec(e),o){n=new Date(0),i=parseInt(o[1],10)-1;const a=parseInt(o[2],10);return el(t,i,a)?(n.setUTCFullYear(t,i,a),n):new Date(NaN)}if(o=jt.Www.exec(e),o)return s=parseInt(o[1],10)-1,nl(s)?Jr(t,s):new Date(NaN);if(o=jt.WwwD.exec(e),o){s=parseInt(o[1],10)-1;const a=parseInt(o[2],10)-1;return nl(s,a)?Jr(t,s,a):new Date(NaN)}return null}function vp(e){let t,n,i=jt.HH.exec(e);if(i)return t=parseFloat(i[1].replace(",",".")),Do(t)?t%24*Mo:NaN;if(i=jt.HHMM.exec(e),i)return t=parseInt(i[1],10),n=parseFloat(i[2].replace(",",".")),Do(t,n)?t%24*Mo+n*Qr:NaN;if(i=jt.HHMMSS.exec(e),i){t=parseInt(i[1],10),n=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return Do(t,n,s)?t%24*Mo+n*Qr+s*1e3:NaN}return null}function Jr(e,t,n){t=t||0,n=n||0;const i=new Date(0);i.setUTCFullYear(e,0,4);const s=i.getUTCDay()||7,o=t*7+n+1-s;return i.setUTCDate(i.getUTCDate()+o),i}const Mp=[31,28,31,30,31,30,31,31,30,31,30,31],Dp=[31,29,31,30,31,30,31,31,30,31,30,31];function tl(e){return e%400===0||e%4===0&&e%100!==0}function el(e,t,n){if(t<0||t>11)return!1;if(n!=null){if(n<1)return!1;const i=tl(e);if(i&&n>Dp[t]||!i&&n>Mp[t])return!1}return!0}function Cp(e,t){if(t<1)return!1;const n=tl(e);return!(n&&t>366||!n&&t>365)}function nl(e,t){return!(e<0||e>52||t!=null&&(t<0||t>6))}function Do(e,t,n){return!(e<0||e>=25||t!=null&&(t<0||t>=60)||n!=null&&(n<0||n>=60))}const Op=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Ap(e,t,n={}){t=String(t);const i=t.match(Op);if(i){const s=Qi(n.originalDate||e,n);t=i.reduce(function(o,a){if(a[0]==="'")return o;const r=o.indexOf(a),l=o[r-1]==="'",c=o.replace(a,"'"+_p[a[0]](s,a,n)+"'");return l?c.substring(0,r-1)+c.substring(r+1):c},t)}return Jm(e,t,n)}function il(e,t,n){e=Qi(e,n);const i=ei(t,e,!0),s=new Date(e.getTime()-i),o=new Date(0);return o.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),o.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),o}function Pp(e,t,n,i){return i={...i,timeZone:t,originalDate:e},Ap(il(e,t,{timeZone:i.timeZone}),n,i)}function Ep(e,t,n){if(typeof e=="string"&&!e.match(Zr))return Qi(e,{...n,timeZone:t});e=Qi(e,n);const i=ko(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()).getTime(),s=ei(t,new Date(i));return new Date(i+s)}function Rp(e,t){return-ei(e,t)}function Ip(e,t={}){if(!e)return e;const n=t.tz||Intl.DateTimeFormat().resolvedOptions().timeZone;try{let i="MMM dd, yyy hh:mm a";t.short&&(i="MMM dd, yyy"),t.includeTZ&&(i+=" (z)");const s=new Date(e);return Pp(s,n,i)}catch{return console.error("Invalid value passed to formatTime",e),"(invalid date)"}}const Lp={secondly:1e3,tenSecondly:10*1e3,thirtySecondly:30*1e3,minutely:60*1e3,fiveMinutely:300*1e3,tenMinutely:600*1e3,thirtyMinutely:1800*1e3,hourly:3600*1e3,twoHourly:7200*1e3,twelveHourly:720*60*1e3,daily:3600*24*1e3,weekly:3600*24*7*1e3,trend:0};function Ji(e){return e&&Pf.find(t=>e<=Lp[t])||null}var ts=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},es={exports:{}};es.exports;var sl;function Np(){return sl||(sl=1,(function(e,t){var n=200,i="__lodash_hash_undefined__",s=9007199254740991,o="[object Arguments]",a="[object Array]",r="[object Boolean]",l="[object Date]",c="[object Error]",d="[object Function]",h="[object GeneratorFunction]",f="[object Map]",m="[object Number]",p="[object Object]",g="[object Promise]",y="[object RegExp]",_="[object Set]",x="[object String]",T="[object Symbol]",v="[object WeakMap]",w="[object ArrayBuffer]",D="[object DataView]",S="[object Float32Array]",A="[object Float64Array]",R="[object Int8Array]",E="[object Int16Array]",k="[object Int32Array]",C="[object Uint8Array]",z="[object Uint8ClampedArray]",N="[object Uint16Array]",V="[object Uint32Array]",Y=/[\\^$.*+?()[\]{}|]/g,G=/\w*$/,st=/^\[object .+?Constructor\]$/,ot=/^(?:0|[1-9]\d*)$/,K={};K[o]=K[a]=K[w]=K[D]=K[r]=K[l]=K[S]=K[A]=K[R]=K[E]=K[k]=K[f]=K[m]=K[p]=K[y]=K[_]=K[x]=K[T]=K[C]=K[z]=K[N]=K[V]=!0,K[c]=K[d]=K[v]=!1;var U=typeof ts=="object"&&ts&&ts.Object===Object&&ts,M=typeof self=="object"&&self&&self.Object===Object&&self,P=U||M||Function("return this")(),F=t&&!t.nodeType&&t,$=F&&!0&&e&&!e.nodeType&&e,it=$&&$.exports===F;function L(b,O){return b.set(O[0],O[1]),b}function H(b,O){return b.add(O),b}function pt(b,O){for(var I=-1,j=b?b.length:0;++I<j&&O(b[I],I,b)!==!1;);return b}function ut(b,O){for(var I=-1,j=O.length,Ft=b.length;++I<j;)b[Ft+I]=O[I];return b}function rt(b,O,I,j){for(var Ft=-1,ee=b?b.length:0;++Ft<ee;)I=O(I,b[Ft],Ft,b);return I}function Dt(b,O){for(var I=-1,j=Array(b);++I<b;)j[I]=O(I);return j}function Wt(b,O){return b?.[O]}function Lt(b){var O=!1;if(b!=null&&typeof b.toString!="function")try{O=!!(b+"")}catch{}return O}function kt(b){var O=-1,I=Array(b.size);return b.forEach(function(j,Ft){I[++O]=[Ft,j]}),I}function je(b,O){return function(I){return b(O(I))}}function pn(b){var O=-1,I=Array(b.size);return b.forEach(function(j){I[++O]=j}),I}var B=Array.prototype,X=Function.prototype,at=Object.prototype,Tt=P["__core-js_shared__"],te=(function(){var b=/[^.]+$/.exec(Tt&&Tt.keys&&Tt.keys.IE_PROTO||"");return b?"Symbol(src)_1."+b:""})(),lo=X.toString,ge=at.hasOwnProperty,jn=at.toString,KA=RegExp("^"+lo.call(ge).replace(Y,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),cf=it?P.Buffer:void 0,uf=P.Symbol,df=P.Uint8Array,ZA=je(Object.getPrototypeOf,Object),QA=Object.create,JA=at.propertyIsEnumerable,tP=B.splice,hf=Object.getOwnPropertySymbols,eP=cf?cf.isBuffer:void 0,nP=je(Object.keys,Object),gr=Xn(P,"DataView"),qi=Xn(P,"Map"),yr=Xn(P,"Promise"),br=Xn(P,"Set"),_r=Xn(P,"WeakMap"),Gi=Xn(Object,"create"),iP=bn(gr),sP=bn(qi),oP=bn(yr),aP=bn(br),rP=bn(_r),ff=uf?uf.prototype:void 0,mf=ff?ff.valueOf:void 0;function gn(b){var O=-1,I=b?b.length:0;for(this.clear();++O<I;){var j=b[O];this.set(j[0],j[1])}}function lP(){this.__data__=Gi?Gi(null):{}}function cP(b){return this.has(b)&&delete this.__data__[b]}function uP(b){var O=this.__data__;if(Gi){var I=O[b];return I===i?void 0:I}return ge.call(O,b)?O[b]:void 0}function dP(b){var O=this.__data__;return Gi?O[b]!==void 0:ge.call(O,b)}function hP(b,O){var I=this.__data__;return I[b]=Gi&&O===void 0?i:O,this}gn.prototype.clear=lP,gn.prototype.delete=cP,gn.prototype.get=uP,gn.prototype.has=dP,gn.prototype.set=hP;function Me(b){var O=-1,I=b?b.length:0;for(this.clear();++O<I;){var j=b[O];this.set(j[0],j[1])}}function fP(){this.__data__=[]}function mP(b){var O=this.__data__,I=co(O,b);if(I<0)return!1;var j=O.length-1;return I==j?O.pop():tP.call(O,I,1),!0}function pP(b){var O=this.__data__,I=co(O,b);return I<0?void 0:O[I][1]}function gP(b){return co(this.__data__,b)>-1}function yP(b,O){var I=this.__data__,j=co(I,b);return j<0?I.push([b,O]):I[j][1]=O,this}Me.prototype.clear=fP,Me.prototype.delete=mP,Me.prototype.get=pP,Me.prototype.has=gP,Me.prototype.set=yP;function qn(b){var O=-1,I=b?b.length:0;for(this.clear();++O<I;){var j=b[O];this.set(j[0],j[1])}}function bP(){this.__data__={hash:new gn,map:new(qi||Me),string:new gn}}function _P(b){return uo(this,b).delete(b)}function xP(b){return uo(this,b).get(b)}function wP(b){return uo(this,b).has(b)}function kP(b,O){return uo(this,b).set(b,O),this}qn.prototype.clear=bP,qn.prototype.delete=_P,qn.prototype.get=xP,qn.prototype.has=wP,qn.prototype.set=kP;function Gn(b){this.__data__=new Me(b)}function TP(){this.__data__=new Me}function SP(b){return this.__data__.delete(b)}function vP(b){return this.__data__.get(b)}function MP(b){return this.__data__.has(b)}function DP(b,O){var I=this.__data__;if(I instanceof Me){var j=I.__data__;if(!qi||j.length<n-1)return j.push([b,O]),this;I=this.__data__=new qn(j)}return I.set(b,O),this}Gn.prototype.clear=TP,Gn.prototype.delete=SP,Gn.prototype.get=vP,Gn.prototype.has=MP,Gn.prototype.set=DP;function CP(b,O){var I=kr(b)||QP(b)?Dt(b.length,String):[],j=I.length,Ft=!!j;for(var ee in b)ge.call(b,ee)&&!(Ft&&(ee=="length"||GP(ee,j)))&&I.push(ee);return I}function pf(b,O,I){var j=b[O];(!(ge.call(b,O)&&_f(j,I))||I===void 0&&!(O in b))&&(b[O]=I)}function co(b,O){for(var I=b.length;I--;)if(_f(b[I][0],O))return I;return-1}function OP(b,O){return b&&gf(O,Tr(O),b)}function xr(b,O,I,j,Ft,ee,De){var ne;if(j&&(ne=ee?j(b,Ft,ee,De):j(b)),ne!==void 0)return ne;if(!ho(b))return b;var kf=kr(b);if(kf){if(ne=WP(b),!O)return HP(b,ne)}else{var Kn=yn(b),Tf=Kn==d||Kn==h;if(tE(b))return LP(b,O);if(Kn==p||Kn==o||Tf&&!ee){if(Lt(b))return ee?b:{};if(ne=jP(Tf?{}:b),!O)return $P(b,OP(ne,b))}else{if(!K[Kn])return ee?b:{};ne=qP(b,Kn,xr,O)}}De||(De=new Gn);var Sf=De.get(b);if(Sf)return Sf;if(De.set(b,ne),!kf)var vf=I?YP(b):Tr(b);return pt(vf||b,function(Sr,fo){vf&&(fo=Sr,Sr=b[fo]),pf(ne,fo,xr(Sr,O,I,j,fo,b,De))}),ne}function AP(b){return ho(b)?QA(b):{}}function PP(b,O,I){var j=O(b);return kr(b)?j:ut(j,I(b))}function EP(b){return jn.call(b)}function RP(b){if(!ho(b)||KP(b))return!1;var O=wf(b)||Lt(b)?KA:st;return O.test(bn(b))}function IP(b){if(!bf(b))return nP(b);var O=[];for(var I in Object(b))ge.call(b,I)&&I!="constructor"&&O.push(I);return O}function LP(b,O){if(O)return b.slice();var I=new b.constructor(b.length);return b.copy(I),I}function wr(b){var O=new b.constructor(b.byteLength);return new df(O).set(new df(b)),O}function NP(b,O){var I=O?wr(b.buffer):b.buffer;return new b.constructor(I,b.byteOffset,b.byteLength)}function BP(b,O,I){var j=O?I(kt(b),!0):kt(b);return rt(j,L,new b.constructor)}function FP(b){var O=new b.constructor(b.source,G.exec(b));return O.lastIndex=b.lastIndex,O}function zP(b,O,I){var j=O?I(pn(b),!0):pn(b);return rt(j,H,new b.constructor)}function UP(b){return mf?Object(mf.call(b)):{}}function VP(b,O){var I=O?wr(b.buffer):b.buffer;return new b.constructor(I,b.byteOffset,b.length)}function HP(b,O){var I=-1,j=b.length;for(O||(O=Array(j));++I<j;)O[I]=b[I];return O}function gf(b,O,I,j){I||(I={});for(var Ft=-1,ee=O.length;++Ft<ee;){var De=O[Ft],ne=void 0;pf(I,De,ne===void 0?b[De]:ne)}return I}function $P(b,O){return gf(b,yf(b),O)}function YP(b){return PP(b,Tr,yf)}function uo(b,O){var I=b.__data__;return XP(O)?I[typeof O=="string"?"string":"hash"]:I.map}function Xn(b,O){var I=Wt(b,O);return RP(I)?I:void 0}var yf=hf?je(hf,Object):iE,yn=EP;(gr&&yn(new gr(new ArrayBuffer(1)))!=D||qi&&yn(new qi)!=f||yr&&yn(yr.resolve())!=g||br&&yn(new br)!=_||_r&&yn(new _r)!=v)&&(yn=function(b){var O=jn.call(b),I=O==p?b.constructor:void 0,j=I?bn(I):void 0;if(j)switch(j){case iP:return D;case sP:return f;case oP:return g;case aP:return _;case rP:return v}return O});function WP(b){var O=b.length,I=b.constructor(O);return O&&typeof b[0]=="string"&&ge.call(b,"index")&&(I.index=b.index,I.input=b.input),I}function jP(b){return typeof b.constructor=="function"&&!bf(b)?AP(ZA(b)):{}}function qP(b,O,I,j){var Ft=b.constructor;switch(O){case w:return wr(b);case r:case l:return new Ft(+b);case D:return NP(b,j);case S:case A:case R:case E:case k:case C:case z:case N:case V:return VP(b,j);case f:return BP(b,j,I);case m:case x:return new Ft(b);case y:return FP(b);case _:return zP(b,j,I);case T:return UP(b)}}function GP(b,O){return O=O??s,!!O&&(typeof b=="number"||ot.test(b))&&b>-1&&b%1==0&&b<O}function XP(b){var O=typeof b;return O=="string"||O=="number"||O=="symbol"||O=="boolean"?b!=="__proto__":b===null}function KP(b){return!!te&&te in b}function bf(b){var O=b&&b.constructor,I=typeof O=="function"&&O.prototype||at;return b===I}function bn(b){if(b!=null){try{return lo.call(b)}catch{}try{return b+""}catch{}}return""}function ZP(b){return xr(b,!0,!0)}function _f(b,O){return b===O||b!==b&&O!==O}function QP(b){return JP(b)&&ge.call(b,"callee")&&(!JA.call(b,"callee")||jn.call(b)==o)}var kr=Array.isArray;function xf(b){return b!=null&&eE(b.length)&&!wf(b)}function JP(b){return nE(b)&&xf(b)}var tE=eP||sE;function wf(b){var O=ho(b)?jn.call(b):"";return O==d||O==h}function eE(b){return typeof b=="number"&&b>-1&&b%1==0&&b<=s}function ho(b){var O=typeof b;return!!b&&(O=="object"||O=="function")}function nE(b){return!!b&&typeof b=="object"}function Tr(b){return xf(b)?CP(b):IP(b)}function iE(){return[]}function sE(){return!1}e.exports=ZP})(es,es.exports)),es.exports}Np();const oe=(e,t)=>new Date(e.getTime()-Rp(t,e));class Rt{timeframeText;key;display;timeframeLength;allowedTiers;defaultResponseGranularity;dataGranularity;isRelative;fineGrainedDefaultGranularity;_startCustom;_endCustom;_allowedGranularitiesOverride;constructor(t){this.display=t.display,this.timeframeText=t.timeframeText,this.key=t.key,this.timeframeLength=t.timeframeLength,this.allowedTiers=t.allowedTiers,this.defaultResponseGranularity=t.defaultResponseGranularity,this.dataGranularity=t.dataGranularity,this.isRelative=t.isRelative,this._startCustom=t.startCustom,this._endCustom=t.endCustom,this._allowedGranularitiesOverride=t.allowedGranularitiesOverride,this.fineGrainedDefaultGranularity=t.fineGrainedDefaultGranularity}rawEnd(t){return this._endCustom||new Date}rawStart(t){return this._startCustom||new Date(this.rawEnd().getTime()-this.timeframeLengthMs())}timeframeLengthMs(){return this.timeframeLength()*1e3}maximumTimeframeLength(){return this.timeframeLength()}allowedGranularities(t){if(this._allowedGranularitiesOverride&&t)return new Set(this._allowedGranularitiesOverride);const n=new Set,i=this.maximumTimeframeLength()/3600;return i<=6&&n.add("minutely"),i>=2&&i<=168&&n.add("hourly"),i>=48&&n.add("daily"),i>=672&&n.add("weekly"),n}cacheKey(){return this.key!=="custom"?this.key:`${this.rawStart().toISOString()}-${this.rawEnd().toISOString()}`}v4Query(t){return this.key==="custom"?{type:"absolute",start:this.rawStart(),end:this.rawEnd(),tz:t}:{type:"relative",time_range:this.key,tz:t}}tzAdjustedDate(t){if(!t)return new Date;const n=Ep(new Date,new Intl.DateTimeFormat().resolvedOptions().timeZone);return il(n,t)}}class Bp extends Rt{rawStart(t){let n=ye(this.tzAdjustedDate(t),{weekStartsOn:1});return t&&(n=oe(n,t)),n}maximumTimeframeLength(){return 3600*24*7}}class Fp extends Rt{rawStart(t){let n=kn(this.tzAdjustedDate(t));return t&&(n=oe(n,t)),n}maximumTimeframeLength(){return 3600*24*31}}class zp extends Rt{rawStart(t){let n=wn(this.tzAdjustedDate(t));return t&&(n=oe(n,t)),n}maximumTimeframeLength(){return 3600*24*92}}class Up extends Rt{rawStart(t){let n=new Date(this.tzAdjustedDate(t).getFullYear(),0,1);return t&&(n=oe(n,t)),n}maximumTimeframeLength(){return 3600*24*366}}class Vp extends Rt{rawEnd(t){let n=ye(this.tzAdjustedDate(t),{weekStartsOn:1});return t&&(n=oe(n,t)),n}rawStart(t){const n=this.tzAdjustedDate(t);let i=ye(n.setDate(n.getDate()-7),{weekStartsOn:1});return t&&(i=oe(i,t)),i}}class Hp extends Rt{rawEnd(t){let n=wn(this.tzAdjustedDate(t));return t&&(n=oe(n,t)),n}rawStart(t){let n=wn($r(this.tzAdjustedDate(t)));return t&&(n=oe(n,t)),n}}class $p extends Rt{rawEnd(t){let n=kn(this.tzAdjustedDate(t));return t&&(n=oe(n,t)),n}rawStart(t){let n=kn(Hr(this.tzAdjustedDate(t)));return t&&(n=oe(n,t)),n}}class Yp extends Rt{rawEnd(t){let n=new Date(this.tzAdjustedDate(t).getFullYear(),0,1);return t&&(n=oe(n,t)),n}rawStart(t){let n=new Date(this.tzAdjustedDate(t).getFullYear()-1,0,1);return t&&(n=oe(n,t)),n}}W.FIFTEEN_MIN,new Rt({key:W.FIFTEEN_MIN,display:"Last 15 minutes",timeframeText:"15 minutes",timeframeLength:()=>900,defaultResponseGranularity:"minutely",dataGranularity:"minutely",isRelative:!0,fineGrainedDefaultGranularity:"thirtySecondly",allowedTiers:["free","trial","plus","enterprise"],allowedGranularitiesOverride:["tenSecondly","thirtySecondly","minutely"]}),W.ONE_HOUR,new Rt({key:W.ONE_HOUR,display:"Last hour",timeframeText:"One hour",timeframeLength:()=>3600*1,defaultResponseGranularity:"minutely",dataGranularity:"minutely",isRelative:!0,fineGrainedDefaultGranularity:"minutely",allowedTiers:["free","trial","plus","enterprise"],allowedGranularitiesOverride:["tenSecondly","thirtySecondly","minutely","fiveMinutely","tenMinutely"]}),W.SIX_HOUR,new Rt({key:W.SIX_HOUR,display:"Last 6 hours",timeframeText:"6 hours",timeframeLength:()=>3600*6,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,fineGrainedDefaultGranularity:"fiveMinutely",allowedTiers:["free","trial","plus","enterprise"],allowedGranularitiesOverride:["thirtySecondly","minutely","fiveMinutely","tenMinutely","thirtyMinutely","hourly"]}),W.TWELVE_HOUR,new Rt({key:W.TWELVE_HOUR,display:"Last 12 hours",timeframeText:"12 hours",timeframeLength:()=>3600*12,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,fineGrainedDefaultGranularity:"tenMinutely",allowedTiers:["free","trial","plus","enterprise"],allowedGranularitiesOverride:["minutely","fiveMinutely","tenMinutely","thirtyMinutely","hourly"]}),W.ONE_DAY,new Rt({key:W.ONE_DAY,display:"Last 24 hours",timeframeText:"24 hours",timeframeLength:()=>3600*24,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,fineGrainedDefaultGranularity:"thirtyMinutely",allowedTiers:["free","trial","plus","enterprise"],allowedGranularitiesOverride:["fiveMinutely","tenMinutely","thirtyMinutely","hourly"]}),W.SEVEN_DAY,new Rt({key:W.SEVEN_DAY,display:"Last 7 days",timeframeText:"7 days",timeframeLength:()=>3600*24*7,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,fineGrainedDefaultGranularity:"twoHourly",allowedTiers:["trial","plus","enterprise"],allowedGranularitiesOverride:["thirtyMinutely","hourly","twoHourly","twelveHourly","daily"]}),W.THIRTY_DAY,new Rt({key:W.THIRTY_DAY,display:"Last 30 days",timeframeText:"30 days",timeframeLength:()=>3600*24*30,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,fineGrainedDefaultGranularity:"twelveHourly",allowedTiers:["trial","plus","enterprise"],allowedGranularitiesOverride:["hourly","twoHourly","twelveHourly","daily","weekly"]}),W.NINETY_DAY,new Rt({key:W.NINETY_DAY,display:"Last 90 days",timeframeText:"90 days",timeframeLength:()=>3600*24*90,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,fineGrainedDefaultGranularity:"daily",allowedTiers:["trial","plus","enterprise"],allowedGranularitiesOverride:["hourly","twoHourly","twelveHourly","daily","weekly"]}),W.ONE_HUNDRED_EIGHTY_DAY,new Rt({key:W.ONE_HUNDRED_EIGHTY_DAY,display:"Last 180 days",timeframeText:"180 days",timeframeLength:()=>3600*24*180,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,fineGrainedDefaultGranularity:"daily",allowedTiers:["trial","plus","enterprise"],allowedGranularitiesOverride:["hourly","twoHourly","twelveHourly","daily","weekly"]}),W.ONE_YEAR,new Rt({key:W.ONE_YEAR,display:"Last 365 days",timeframeText:"365 days",timeframeLength:()=>3600*24*365,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,fineGrainedDefaultGranularity:"daily",allowedTiers:["trial","plus","enterprise"],allowedGranularitiesOverride:["hourly","twoHourly","twelveHourly","daily","weekly"]}),W.CURRENT_WEEK,new Bp({key:W.CURRENT_WEEK,display:"This week",timeframeText:"Week",timeframeLength:()=>{const e=ye(new Date,{weekStartsOn:1});return(_n(Ki(new Date,1)).getTime()-e.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,fineGrainedDefaultGranularity:"twoHourly",allowedTiers:["plus","enterprise"],allowedGranularitiesOverride:["thirtyMinutely","hourly","twoHourly","twelveHourly","daily"]}),W.CURRENT_MONTH,new Fp({key:W.CURRENT_MONTH,display:"This month",timeframeText:"Month",timeframeLength:()=>{const e=kn(new Date);return(_n(Ki(new Date,1)).getTime()-e.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),W.CURRENT_QUARTER,new zp({key:W.CURRENT_QUARTER,display:"This quarter",timeframeText:"Quarter",timeframeLength:()=>{const e=wn(new Date);return(_n(Ki(new Date,1)).getTime()-e.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),W.CURRENT_YEAR,new Up({key:W.CURRENT_YEAR,display:"This year",timeframeText:"Year",timeframeLength:()=>{const e=new Date(new Date().getFullYear(),0,1);return(_n(Ki(new Date,1)).getTime()-e.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),W.PREVIOUS_WEEK,new Vp({key:W.PREVIOUS_WEEK,display:"Previous week",timeframeText:"Week",timeframeLength:()=>3600*24*7,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,fineGrainedDefaultGranularity:"twoHourly",allowedTiers:["plus","enterprise"],allowedGranularitiesOverride:["thirtyMinutely","hourly","twoHourly","twelveHourly","daily"]}),W.PREVIOUS_MONTH,new $p({key:W.PREVIOUS_MONTH,display:"Previous month",timeframeText:"Month",timeframeLength:()=>{let e=0;const t=kn(new Date),n=kn(Hr(new Date));return t.getTimezoneOffset()!==n.getTimezoneOffset()&&(e=ol(t,n)),3600*24*np(new Date().setMonth(new Date().getMonth()-1))+Vr(e)},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),W.PREVIOUS_QUARTER,new Hp({key:W.PREVIOUS_QUARTER,display:"Previous quarter",timeframeText:"Quarter",timeframeLength:()=>{const e=wn(new Date),t=wn($r(new Date));return(e.getTime()-t.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),W.PREVIOUS_YEAR,new Yp({key:W.PREVIOUS_YEAR,display:"Previous year",timeframeText:"Year",timeframeLength:()=>{const e=new Date(new Date().getFullYear(),0,1),t=new Date(new Date().getFullYear()-1,0,1);let n=0;return e.getTimezoneOffset()!==t.getTimezoneOffset()&&(n=ol(e,t)),3600*24*(365+(t.getFullYear()%4===0?1:0))+Vr(n)},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]});function ol(e,t){return sp(e.getTimezoneOffset()-t.getTimezoneOffset())}W.FIFTEEN_MIN,W.ONE_HOUR,W.SIX_HOUR,W.TWELVE_HOUR,W.ONE_DAY,W.SEVEN_DAY,W.FIFTEEN_MIN,W.ONE_HOUR,W.SIX_HOUR,W.TWELVE_HOUR,W.ONE_DAY,W.SEVEN_DAY,W.THIRTY_DAY,W.NINETY_DAY,W.ONE_HUNDRED_EIGHTY_DAY,W.ONE_YEAR,W.CURRENT_WEEK,W.CURRENT_MONTH,W.CURRENT_QUARTER,W.CURRENT_YEAR,W.PREVIOUS_WEEK,W.PREVIOUS_MONTH,W.PREVIOUS_QUARTER,W.PREVIOUS_YEAR;const Wp=new Map(Or.map(e=>[e.code,{code:e.code,name:e.name}])),Co=e=>Wp.get(e)?.name||e,al=1e3,jp=1e4,rl=1e6,ll=1e9,cl=1e12,ns=(e,t)=>{if(t.separator===!1||e<1e3)return e.toString();const n=typeof t.separator=="string"?t.separator:",",i=[];return Math.round(e).toString().split("").reverse().forEach((s,o)=>{o&&o%3===0&&i.push(n),i.push(s)}),i.reverse().join("")},ni=(e,t,n)=>{const i=e/t,s=n.round?"round":"floor";if(n.decimal===!1)return Math[s](i).toString();let o;n.precision?o=i:o=i<10?Math[s](i*10)/10:Math[s](i);let a=o.toString();return typeof n.decimal=="string"&&(a=a.replace(".",n.decimal)),a};function is(e,t={}){let n;const i=e<0;i&&(e=Math.abs(e)),t.precision&&(e=parseFloat(e.toPrecision(t.precision)));const s=t.min10k?jp:al;return e<s||t.precision&&t.precision>Math.log10(e)?n=ns(ni(e,1,t),t):e<rl?n=`${ni(e,al,t)}k`:e<ll?n=`${ni(e,rl,t)}m`:e<cl?n=`${ns(ni(e,ll,t),t)}b`:n=`${ns(ni(e,cl,t),t)}t`,i&&(n=`-${n}`),t.capital&&(n=n.toUpperCase()),t.prefix&&(n=`${t.prefix}${n}`),t.suffix&&(n=`${n}${t.suffix}`),n}is.addCommas=ns;const qp=typeof document<"u"&&document.documentElement?.lang||"en-US",ss=new Intl.NumberFormat(qp),Gp=new Set(["%"]),Xp=e=>Gp.has(e)?"flush":"spaced";function le({i18n:e}){const t=(s,o)=>{if(isNaN(s))return"0 B";const a=o?Math.pow(2,50):1e15,r=o?Math.pow(2,40):1e12,l=o?Math.pow(2,30):1e9,c=o?Math.pow(2,20):1e6,d=o?Math.pow(2,10):1e3;let h;return s>=a?h=e.formatNumber(Number.parseFloat((s/a).toPrecision(3)),{style:"unit",unit:"petabyte",unitDisplay:"narrow"}):s>=r?h=e.formatNumber(Number.parseFloat((s/r).toPrecision(3)),{style:"unit",unit:"terabyte",unitDisplay:"narrow"}):s>=l?h=e.formatNumber(Number.parseFloat((s/l).toPrecision(3)),{style:"unit",unit:"gigabyte",unitDisplay:"narrow"}):s>=c?h=e.formatNumber(Number.parseFloat((s/c).toPrecision(3)),{style:"unit",unit:"megabyte",unitDisplay:"narrow"}):s>=d?h=e.formatNumber(Number.parseFloat((s/d).toPrecision(3)),{style:"unit",unit:"kilobyte",unitDisplay:"narrow"}):h=e.formatNumber(Number.parseFloat(s.toPrecision(3)),{style:"unit",unit:"byte",unitDisplay:"narrow"}),h.replace(/([a-zA-Z]*)$/," $1")},n=(s,o="USD")=>isNaN(s)?o==="USD"?"$0.00":`${s}`:s>=.01||o!=="USD"?e.formatNumber(s,{style:"currency",currency:o}):s<1e-4?"< $0.0001":`$${Number.parseFloat(s.toPrecision(4))}`,i=(s,o,a)=>{if(!a)return s;const r=Xp(o)==="flush"?"":" ";return`${s}${r}${a}`};return{formatUnit:(s,o,{isBytes1024:a=!1,currency:r="USD",approximate:l=!1,translateUnit:c=d=>d}={})=>{const d=c(o,s);switch(o){case"bytes":return t(s,a);case"usd":return n(s,r);default:return isNaN(s)?`${s}`:l?i(is(s,{capital:!0}),o,d):s<.01?i(`${Number.parseFloat(s.toPrecision(4))}`,o,d):i(ss.format(Number.parseFloat(s.toFixed(2))),o,d)}},formatBytes:t,formatCost:n,formatRange:(s,o,a,{isBytes1024:r=!1,currency:l="USD",approximate:c=!1,translateUnit:d=h=>h}={})=>{const h=d(a,o);switch(a){case"bytes":return`${t(s,r)} - ${t(o,r)}`;case"usd":return`${n(s,l)} - ${n(o,l)}`;default:if(isNaN(s)||isNaN(o))return`${s} - ${o}`;if(c)return i(`${is(s,{capital:!0})} - ${is(o,{capital:!0})}`,a,h)}const f=s>=.01?`${ss.format(Number.parseFloat(s.toFixed(2)))}`:`${Number.parseFloat(s.toPrecision(4))}`,m=o>=.01?`${ss.format(Number.parseFloat(o.toFixed(2)))}`:`${Number.parseFloat(o.toPrecision(4))}`;return i(`${f} - ${m}`,a,h)}}}const ul="#d60027",dl="#ffe5e5",Kp="#f1f0ff",Zp="#e0e4ea",hl="#0d0e14",Qp="#ad000e",fl="#6c7489",ml="#52596e",Jp="#007d60",tg="#995c00",eg="'Inter', Roboto, Helvetica, sans-serif",Sn="16px",ng="20px",ig="#bee2ff",sg="#8fc1ff",og="#5f9aff",ag="#306fff",rg="#b5ffee",lg="#00fabe",cg="#00d6a4",ug="#00a17b",dg="#007d60",hg="#005944",fg="#b5ffee",mg="#00fabe",pg="#b5ffee",gg="#00a17b",yg="#fff296",bg="#ffe04b",_g="#ffc400",xg="#b37600",wg="#995c00",kg="#804400",Tg="#fff296",Sg="#ffe04b",vg="#ffc2b3",Mg="#ff9877",Dg="#ff723c",Cg="#f75008",Og="#d13500",Ag="#a31f00",Pg="#ffc2b3",Eg="#ff9877",Rg="#ff723c",Ig="#f75008",Lg="#d13500",Ng="#a31f00",Bg="#ffc2b3",Fg="#ff9877",zg="#ff723c",Ug="#f75008",Vg="#d13500",Hg="#a31f00",$g="#ffc2b3",Yg="#ff9877",Wg="#ff723c",jg="#f75008",qg="#d13500",Gg="#a31f00",Xg="#ffc2b3",Kg="#ff9877",Zg="#ff723c",Qg="#f75008",Jg="#d13500",ty="#ffabab",ey="#ff7272",ny="#ff3954",iy="#f50045",sy="#d60027",oy="#ad000e",ay="#ffabab",ry="#ff7272",ly="#ff3954",cy="#f50045",uy="#d60027",dy="#eefaff",hy="#ecfffb",fy="#fffce0",my="#fff1ef",py="#ffe5e5",gy="#5f9aff",yy="#00d6a4",by="#ffc400",_y="#ff723c",xy="#ff3954",pl=6048e5,wy=864e5,ii=6e4,vn=36e5,ky=1e3,gl=Symbol.for("constructDateFrom");function vt(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&gl in e?e[gl](t):e instanceof Date?new e.constructor(t):new Date(t)}function J(e,t){return vt(t||e,e)}function os(e,t,n){const i=J(e,n?.in);return isNaN(t)?vt(n?.in||e,NaN):(t&&i.setDate(i.getDate()+t),i)}function Oo(e,t,n){const i=J(e,n?.in);if(isNaN(t))return vt(e,NaN);if(!t)return i;const s=i.getDate(),o=vt(e,i.getTime());o.setMonth(i.getMonth()+t+1,0);const a=o.getDate();return s>=a?o:(i.setFullYear(o.getFullYear(),o.getMonth(),s),i)}function Ao(e,t,n){return vt(e,+J(e)+t)}function Ty(e,t,n){return Ao(e,t*vn)}let Sy={};function Ke(){return Sy}function ce(e,t){const n=Ke(),i=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=J(e,t?.in),o=s.getDay(),a=(o<i?7:0)+o-i;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function Mn(e,t){return ce(e,{...t,weekStartsOn:1})}function yl(e,t){const n=J(e,t?.in),i=n.getFullYear(),s=vt(n,0);s.setFullYear(i+1,0,4),s.setHours(0,0,0,0);const o=Mn(s),a=vt(n,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const r=Mn(a);return n.getTime()>=o.getTime()?i+1:n.getTime()>=r.getTime()?i:i-1}function as(e){const t=J(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Ze(e,...t){const n=vt.bind(null,t.find(i=>typeof i=="object"));return t.map(n)}function Po(e,t){const n=J(e,t?.in);return n.setHours(0,0,0,0),n}function bl(e,t,n){const[i,s]=Ze(n?.in,e,t),o=Po(i),a=Po(s),r=+o-as(o),l=+a-as(a);return Math.round((r-l)/wy)}function vy(e,t){const n=yl(e,t),i=vt(e,0);return i.setFullYear(n,0,4),i.setHours(0,0,0,0),Mn(i)}function My(e,t,n){const i=J(e,n?.in);return i.setTime(i.getTime()+t*ii),i}function Dy(e,t,n){return Oo(e,t*3,n)}function Cy(e,t,n){return Ao(e,t*1e3)}function Oy(e,t,n){return os(e,t*7,n)}function Ay(e,t,n){return Oo(e,t*12,n)}function si(e,t){const n=+J(e)-+J(t);return n<0?-1:n>0?1:n}function Py(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Eo(e){return!(!Py(e)&&typeof e!="number"||isNaN(+J(e)))}function Ey(e,t,n){const[i,s]=Ze(n?.in,e,t),o=i.getFullYear()-s.getFullYear(),a=i.getMonth()-s.getMonth();return o*12+a}function Ry(e,t,n){const[i,s]=Ze(n?.in,e,t);return i.getFullYear()-s.getFullYear()}function _l(e,t,n){const[i,s]=Ze(n?.in,e,t),o=xl(i,s),a=Math.abs(bl(i,s));i.setDate(i.getDate()-o*a);const r=+(xl(i,s)===-o),l=o*(a-r);return l===0?0:l}function xl(e,t){const n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function oi(e){return t=>{const i=(e?Math[e]:Math.trunc)(t);return i===0?0:i}}function Iy(e,t,n){const[i,s]=Ze(n?.in,e,t),o=(+i-+s)/vn;return oi(n?.roundingMethod)(o)}function Ro(e,t){return+J(e)-+J(t)}function Ly(e,t,n){const i=Ro(e,t)/ii;return oi(n?.roundingMethod)(i)}function wl(e,t){const n=J(e,t?.in);return n.setHours(23,59,59,999),n}function kl(e,t){const n=J(e,t?.in),i=n.getMonth();return n.setFullYear(n.getFullYear(),i+1,0),n.setHours(23,59,59,999),n}function Ny(e,t){const n=J(e,t?.in);return+wl(n,t)==+kl(n,t)}function Tl(e,t,n){const[i,s,o]=Ze(n?.in,e,e,t),a=si(s,o),r=Math.abs(Ey(s,o));if(r<1)return 0;s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-a*r);let l=si(s,o)===-a;Ny(i)&&r===1&&si(i,o)===1&&(l=!1);const c=a*(r-+l);return c===0?0:c}function By(e,t,n){const i=Tl(e,t,n)/3;return oi(n?.roundingMethod)(i)}function Fy(e,t,n){const i=Ro(e,t)/1e3;return oi(n?.roundingMethod)(i)}function zy(e,t,n){const i=_l(e,t,n)/7;return oi(n?.roundingMethod)(i)}function Uy(e,t,n){const[i,s]=Ze(n?.in,e,t),o=si(i,s),a=Math.abs(Ry(i,s));i.setFullYear(1584),s.setFullYear(1584);const r=si(i,s)===-o,l=o*(a-+r);return l===0?0:l}function Vy(e,t){const n=J(e,t?.in),i=n.getMonth(),s=i-i%3;return n.setMonth(s,1),n.setHours(0,0,0,0),n}function Hy(e,t){const n=J(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function $y(e,t){const n=J(e,t?.in),i=n.getFullYear();return n.setFullYear(i+1,0,0),n.setHours(23,59,59,999),n}function Sl(e,t){const n=J(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Yy(e,t){const n=J(e,t?.in);return n.setMinutes(59,59,999),n}function Wy(e,t){const n=Ke(),i=n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=J(e,t?.in),o=s.getDay(),a=(o<i?-7:0)+6-(o-i);return s.setDate(s.getDate()+a),s.setHours(23,59,59,999),s}function jy(e,t){const n=J(e,t?.in);return n.setSeconds(59,999),n}function qy(e,t){const n=J(e,t?.in),i=n.getMonth(),s=i-i%3+3;return n.setMonth(s,0),n.setHours(23,59,59,999),n}function Gy(e,t){const n=J(e,t?.in);return n.setMilliseconds(999),n}const Xy={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Ky=(e,t,n)=>{let i;const s=Xy[e];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+i:i+" ago":i};function Io(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Zy={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Qy={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Jy={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},t0={date:Io({formats:Zy,defaultWidth:"full"}),time:Io({formats:Qy,defaultWidth:"full"}),dateTime:Io({formats:Jy,defaultWidth:"full"})},e0={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},n0=(e,t,n,i)=>e0[e];function ai(e){return(t,n)=>{const i=n?.context?String(n.context):"standalone";let s;if(i==="formatting"&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):a;s=e.formattingValues[r]||e.formattingValues[a]}else{const a=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;s=e.values[r]||e.values[a]}const o=e.argumentCallback?e.argumentCallback(t):t;return s[o]}}const i0={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},s0={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},o0={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},a0={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},r0={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},l0={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},c0={ordinalNumber:(e,t)=>{const n=Number(e),i=n%100;if(i>20||i<10)switch(i%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:ai({values:i0,defaultWidth:"wide"}),quarter:ai({values:s0,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ai({values:o0,defaultWidth:"wide"}),day:ai({values:a0,defaultWidth:"wide"}),dayPeriod:ai({values:r0,defaultWidth:"wide",formattingValues:l0,defaultFormattingWidth:"wide"})};function ri(e){return(t,n={})=>{const i=n.width,s=i&&e.matchPatterns[i]||e.matchPatterns[e.defaultMatchWidth],o=t.match(s);if(!o)return null;const a=o[0],r=i&&e.parsePatterns[i]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(r)?d0(r,h=>h.test(a)):u0(r,h=>h.test(a));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const d=t.slice(a.length);return{value:c,rest:d}}}function u0(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function d0(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function h0(e){return(t,n={})=>{const i=t.match(e.matchPattern);if(!i)return null;const s=i[0],o=t.match(e.parsePattern);if(!o)return null;let a=e.valueCallback?e.valueCallback(o[0]):o[0];a=n.valueCallback?n.valueCallback(a):a;const r=t.slice(s.length);return{value:a,rest:r}}}const f0=/^(\d+)(th|st|nd|rd)?/i,m0=/\d+/i,p0={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},g0={any:[/^b/i,/^(a|c)/i]},y0={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},b0={any:[/1/i,/2/i,/3/i,/4/i]},_0={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},x0={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},w0={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},k0={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},T0={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},S0={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},v0={ordinalNumber:h0({matchPattern:f0,parsePattern:m0,valueCallback:e=>parseInt(e,10)}),era:ri({matchPatterns:p0,defaultMatchWidth:"wide",parsePatterns:g0,defaultParseWidth:"any"}),quarter:ri({matchPatterns:y0,defaultMatchWidth:"wide",parsePatterns:b0,defaultParseWidth:"any",valueCallback:e=>e+1}),month:ri({matchPatterns:_0,defaultMatchWidth:"wide",parsePatterns:x0,defaultParseWidth:"any"}),day:ri({matchPatterns:w0,defaultMatchWidth:"wide",parsePatterns:k0,defaultParseWidth:"any"}),dayPeriod:ri({matchPatterns:T0,defaultMatchWidth:"any",parsePatterns:S0,defaultParseWidth:"any"})},vl={code:"en-US",formatDistance:Ky,formatLong:t0,formatRelative:n0,localize:c0,match:v0,options:{weekStartsOn:0,firstWeekContainsDate:1}};function M0(e,t){const n=J(e,t?.in);return bl(n,Sl(n))+1}function Ml(e,t){const n=J(e,t?.in),i=+Mn(n)-+vy(n);return Math.round(i/pl)+1}function Lo(e,t){const n=J(e,t?.in),i=n.getFullYear(),s=Ke(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=vt(t?.in||e,0);a.setFullYear(i+1,0,o),a.setHours(0,0,0,0);const r=ce(a,t),l=vt(t?.in||e,0);l.setFullYear(i,0,o),l.setHours(0,0,0,0);const c=ce(l,t);return+n>=+r?i+1:+n>=+c?i:i-1}function D0(e,t){const n=Ke(),i=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=Lo(e,t),o=vt(t?.in||e,0);return o.setFullYear(s,0,i),o.setHours(0,0,0,0),ce(o,t)}function Dl(e,t){const n=J(e,t?.in),i=+ce(n,t)-+D0(n,t);return Math.round(i/pl)+1}function ht(e,t){const n=e<0?"-":"",i=Math.abs(e).toString().padStart(t,"0");return n+i}const Ae={y(e,t){const n=e.getFullYear(),i=n>0?n:1-n;return ht(t==="yy"?i%100:i,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):ht(n+1,2)},d(e,t){return ht(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(e,t){return ht(e.getHours()%12||12,t.length)},H(e,t){return ht(e.getHours(),t.length)},m(e,t){return ht(e.getMinutes(),t.length)},s(e,t){return ht(e.getSeconds(),t.length)},S(e,t){const n=t.length,i=e.getMilliseconds(),s=Math.trunc(i*Math.pow(10,n-3));return ht(s,t.length)}},Dn={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Cl={G:function(e,t,n){const i=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(i,{width:"abbreviated"});case"GGGGG":return n.era(i,{width:"narrow"});default:return n.era(i,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const i=e.getFullYear(),s=i>0?i:1-i;return n.ordinalNumber(s,{unit:"year"})}return Ae.y(e,t)},Y:function(e,t,n,i){const s=Lo(e,i),o=s>0?s:1-s;if(t==="YY"){const a=o%100;return ht(a,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):ht(o,t.length)},R:function(e,t){const n=yl(e);return ht(n,t.length)},u:function(e,t){const n=e.getFullYear();return ht(n,t.length)},Q:function(e,t,n){const i=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return ht(i,2);case"Qo":return n.ordinalNumber(i,{unit:"quarter"});case"QQQ":return n.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(i,{width:"narrow",context:"formatting"});default:return n.quarter(i,{width:"wide",context:"formatting"})}},q:function(e,t,n){const i=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return ht(i,2);case"qo":return n.ordinalNumber(i,{unit:"quarter"});case"qqq":return n.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(i,{width:"narrow",context:"standalone"});default:return n.quarter(i,{width:"wide",context:"standalone"})}},M:function(e,t,n){const i=e.getMonth();switch(t){case"M":case"MM":return Ae.M(e,t);case"Mo":return n.ordinalNumber(i+1,{unit:"month"});case"MMM":return n.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(i,{width:"narrow",context:"formatting"});default:return n.month(i,{width:"wide",context:"formatting"})}},L:function(e,t,n){const i=e.getMonth();switch(t){case"L":return String(i+1);case"LL":return ht(i+1,2);case"Lo":return n.ordinalNumber(i+1,{unit:"month"});case"LLL":return n.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(i,{width:"narrow",context:"standalone"});default:return n.month(i,{width:"wide",context:"standalone"})}},w:function(e,t,n,i){const s=Dl(e,i);return t==="wo"?n.ordinalNumber(s,{unit:"week"}):ht(s,t.length)},I:function(e,t,n){const i=Ml(e);return t==="Io"?n.ordinalNumber(i,{unit:"week"}):ht(i,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Ae.d(e,t)},D:function(e,t,n){const i=M0(e);return t==="Do"?n.ordinalNumber(i,{unit:"dayOfYear"}):ht(i,t.length)},E:function(e,t,n){const i=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},e:function(e,t,n,i){const s=e.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return ht(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,n,i){const s=e.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return ht(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,n){const i=e.getDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return ht(s,t.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},a:function(e,t,n){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,n){const i=e.getHours();let s;switch(i===12?s=Dn.noon:i===0?s=Dn.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,n){const i=e.getHours();let s;switch(i>=17?s=Dn.evening:i>=12?s=Dn.afternoon:i>=4?s=Dn.morning:s=Dn.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let i=e.getHours()%12;return i===0&&(i=12),n.ordinalNumber(i,{unit:"hour"})}return Ae.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Ae.H(e,t)},K:function(e,t,n){const i=e.getHours()%12;return t==="Ko"?n.ordinalNumber(i,{unit:"hour"}):ht(i,t.length)},k:function(e,t,n){let i=e.getHours();return i===0&&(i=24),t==="ko"?n.ordinalNumber(i,{unit:"hour"}):ht(i,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Ae.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Ae.s(e,t)},S:function(e,t){return Ae.S(e,t)},X:function(e,t,n){const i=e.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return Al(i);case"XXXX":case"XX":return Qe(i);default:return Qe(i,":")}},x:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"x":return Al(i);case"xxxx":case"xx":return Qe(i);default:return Qe(i,":")}},O:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Ol(i,":");default:return"GMT"+Qe(i,":")}},z:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Ol(i,":");default:return"GMT"+Qe(i,":")}},t:function(e,t,n){const i=Math.trunc(+e/1e3);return ht(i,t.length)},T:function(e,t,n){return ht(+e,t.length)}};function Ol(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=Math.trunc(i/60),o=i%60;return o===0?n+String(s):n+String(s)+t+ht(o,2)}function Al(e,t){return e%60===0?(e>0?"-":"+")+ht(Math.abs(e)/60,2):Qe(e,t)}function Qe(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=ht(Math.trunc(i/60),2),o=ht(i%60,2);return n+s+t+o}const Pl=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},El=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},No={p:El,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],i=n[1],s=n[2];if(!s)return Pl(e,t);let o;switch(i){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",Pl(i,t)).replace("{{time}}",El(s,t))}},C0=/^D+$/,O0=/^Y+$/,A0=["D","DD","YY","YYYY"];function Rl(e){return C0.test(e)}function Il(e){return O0.test(e)}function Bo(e,t,n){const i=P0(e,t,n);if(console.warn(i),A0.includes(e))throw new RangeError(i)}function P0(e,t,n){const i=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${i} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const E0=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,R0=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,I0=/^'([^]*?)'?$/,L0=/''/g,N0=/[a-zA-Z]/;function rs(e,t,n){const i=Ke(),s=n?.locale??i.locale??vl,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,r=J(e,n?.in);if(!Eo(r))throw new RangeError("Invalid time value");let l=t.match(R0).map(d=>{const h=d[0];if(h==="p"||h==="P"){const f=No[h];return f(d,s.formatLong)}return d}).join("").match(E0).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const h=d[0];if(h==="'")return{isToken:!1,value:B0(d)};if(Cl[h])return{isToken:!0,value:d};if(h.match(N0))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:d}});s.localize.preprocessor&&(l=s.localize.preprocessor(r,l));const c={firstWeekContainsDate:o,weekStartsOn:a,locale:s};return l.map(d=>{if(!d.isToken)return d.value;const h=d.value;(!n?.useAdditionalWeekYearTokens&&Il(h)||!n?.useAdditionalDayOfYearTokens&&Rl(h))&&Bo(h,t,String(e));const f=Cl[h[0]];return f(r,h,s.localize,c)}).join("")}function B0(e){const t=e.match(I0);return t?t[1].replace(L0,"'"):e}function Ll(){return Object.assign({},Ke())}function F0(e,t){const n=J(e,t?.in).getDay();return n===0?7:n}function z0(e,t){const n=U0(t)?new t(0):vt(t,0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}function U0(e){return typeof e=="function"&&e.prototype?.constructor===e}const V0=10;class Nl{subPriority=0;validate(t,n){return!0}}class H0 extends Nl{constructor(t,n,i,s,o){super(),this.value=t,this.validateValue=n,this.setValue=i,this.priority=s,o&&(this.subPriority=o)}validate(t,n){return this.validateValue(t,this.value,n)}set(t,n,i){return this.setValue(t,n,this.value,i)}}class $0 extends Nl{priority=V0;subPriority=-1;constructor(t,n){super(),this.context=t||(i=>vt(n,i))}set(t,n){return n.timestampIsSet?t:vt(t,z0(t,this.context))}}class lt{run(t,n,i,s){const o=this.parse(t,n,i,s);return o?{setter:new H0(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(t,n,i){return!0}}class Y0 extends lt{priority=140;parse(t,n,i){switch(n){case"G":case"GG":case"GGG":return i.era(t,{width:"abbreviated"})||i.era(t,{width:"narrow"});case"GGGGG":return i.era(t,{width:"narrow"});default:return i.era(t,{width:"wide"})||i.era(t,{width:"abbreviated"})||i.era(t,{width:"narrow"})}}set(t,n,i){return n.era=i,t.setFullYear(i,0,1),t.setHours(0,0,0,0),t}incompatibleTokens=["R","u","t","T"]}const Ct={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},ue={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function Ot(e,t){return e&&{value:t(e.value),rest:e.rest}}function wt(e,t){const n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function de(e,t){const n=t.match(e);if(!n)return null;if(n[0]==="Z")return{value:0,rest:t.slice(1)};const i=n[1]==="+"?1:-1,s=n[2]?parseInt(n[2],10):0,o=n[3]?parseInt(n[3],10):0,a=n[5]?parseInt(n[5],10):0;return{value:i*(s*vn+o*ii+a*ky),rest:t.slice(n[0].length)}}function Bl(e){return wt(Ct.anyDigitsSigned,e)}function Mt(e,t){switch(e){case 1:return wt(Ct.singleDigit,t);case 2:return wt(Ct.twoDigits,t);case 3:return wt(Ct.threeDigits,t);case 4:return wt(Ct.fourDigits,t);default:return wt(new RegExp("^\\d{1,"+e+"}"),t)}}function ls(e,t){switch(e){case 1:return wt(Ct.singleDigitSigned,t);case 2:return wt(Ct.twoDigitsSigned,t);case 3:return wt(Ct.threeDigitsSigned,t);case 4:return wt(Ct.fourDigitsSigned,t);default:return wt(new RegExp("^-?\\d{1,"+e+"}"),t)}}function Fo(e){switch(e){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;default:return 0}}function Fl(e,t){const n=t>0,i=n?t:1-t;let s;if(i<=50)s=e||100;else{const o=i+50,a=Math.trunc(o/100)*100,r=e>=o%100;s=e+a-(r?100:0)}return n?s:1-s}function zl(e){return e%400===0||e%4===0&&e%100!==0}class W0 extends lt{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(t,n,i){const s=o=>({year:o,isTwoDigitYear:n==="yy"});switch(n){case"y":return Ot(Mt(4,t),s);case"yo":return Ot(i.ordinalNumber(t,{unit:"year"}),s);default:return Ot(Mt(n.length,t),s)}}validate(t,n){return n.isTwoDigitYear||n.year>0}set(t,n,i){const s=t.getFullYear();if(i.isTwoDigitYear){const a=Fl(i.year,s);return t.setFullYear(a,0,1),t.setHours(0,0,0,0),t}const o=!("era"in n)||n.era===1?i.year:1-i.year;return t.setFullYear(o,0,1),t.setHours(0,0,0,0),t}}class j0 extends lt{priority=130;parse(t,n,i){const s=o=>({year:o,isTwoDigitYear:n==="YY"});switch(n){case"Y":return Ot(Mt(4,t),s);case"Yo":return Ot(i.ordinalNumber(t,{unit:"year"}),s);default:return Ot(Mt(n.length,t),s)}}validate(t,n){return n.isTwoDigitYear||n.year>0}set(t,n,i,s){const o=Lo(t,s);if(i.isTwoDigitYear){const r=Fl(i.year,o);return t.setFullYear(r,0,s.firstWeekContainsDate),t.setHours(0,0,0,0),ce(t,s)}const a=!("era"in n)||n.era===1?i.year:1-i.year;return t.setFullYear(a,0,s.firstWeekContainsDate),t.setHours(0,0,0,0),ce(t,s)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]}class q0 extends lt{priority=130;parse(t,n){return ls(n==="R"?4:n.length,t)}set(t,n,i){const s=vt(t,0);return s.setFullYear(i,0,4),s.setHours(0,0,0,0),Mn(s)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]}class G0 extends lt{priority=130;parse(t,n){return ls(n==="u"?4:n.length,t)}set(t,n,i){return t.setFullYear(i,0,1),t.setHours(0,0,0,0),t}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]}class X0 extends lt{priority=120;parse(t,n,i){switch(n){case"Q":case"QQ":return Mt(n.length,t);case"Qo":return i.ordinalNumber(t,{unit:"quarter"});case"QQQ":return i.quarter(t,{width:"abbreviated",context:"formatting"})||i.quarter(t,{width:"narrow",context:"formatting"});case"QQQQQ":return i.quarter(t,{width:"narrow",context:"formatting"});default:return i.quarter(t,{width:"wide",context:"formatting"})||i.quarter(t,{width:"abbreviated",context:"formatting"})||i.quarter(t,{width:"narrow",context:"formatting"})}}validate(t,n){return n>=1&&n<=4}set(t,n,i){return t.setMonth((i-1)*3,1),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]}class K0 extends lt{priority=120;parse(t,n,i){switch(n){case"q":case"qq":return Mt(n.length,t);case"qo":return i.ordinalNumber(t,{unit:"quarter"});case"qqq":return i.quarter(t,{width:"abbreviated",context:"standalone"})||i.quarter(t,{width:"narrow",context:"standalone"});case"qqqqq":return i.quarter(t,{width:"narrow",context:"standalone"});default:return i.quarter(t,{width:"wide",context:"standalone"})||i.quarter(t,{width:"abbreviated",context:"standalone"})||i.quarter(t,{width:"narrow",context:"standalone"})}}validate(t,n){return n>=1&&n<=4}set(t,n,i){return t.setMonth((i-1)*3,1),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]}class Z0 extends lt{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(t,n,i){const s=o=>o-1;switch(n){case"M":return Ot(wt(Ct.month,t),s);case"MM":return Ot(Mt(2,t),s);case"Mo":return Ot(i.ordinalNumber(t,{unit:"month"}),s);case"MMM":return i.month(t,{width:"abbreviated",context:"formatting"})||i.month(t,{width:"narrow",context:"formatting"});case"MMMMM":return i.month(t,{width:"narrow",context:"formatting"});default:return i.month(t,{width:"wide",context:"formatting"})||i.month(t,{width:"abbreviated",context:"formatting"})||i.month(t,{width:"narrow",context:"formatting"})}}validate(t,n){return n>=0&&n<=11}set(t,n,i){return t.setMonth(i,1),t.setHours(0,0,0,0),t}}class Q0 extends lt{priority=110;parse(t,n,i){const s=o=>o-1;switch(n){case"L":return Ot(wt(Ct.month,t),s);case"LL":return Ot(Mt(2,t),s);case"Lo":return Ot(i.ordinalNumber(t,{unit:"month"}),s);case"LLL":return i.month(t,{width:"abbreviated",context:"standalone"})||i.month(t,{width:"narrow",context:"standalone"});case"LLLLL":return i.month(t,{width:"narrow",context:"standalone"});default:return i.month(t,{width:"wide",context:"standalone"})||i.month(t,{width:"abbreviated",context:"standalone"})||i.month(t,{width:"narrow",context:"standalone"})}}validate(t,n){return n>=0&&n<=11}set(t,n,i){return t.setMonth(i,1),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]}function J0(e,t,n){const i=J(e,n?.in),s=Dl(i,n)-t;return i.setDate(i.getDate()-s*7),J(i,n?.in)}class tb extends lt{priority=100;parse(t,n,i){switch(n){case"w":return wt(Ct.week,t);case"wo":return i.ordinalNumber(t,{unit:"week"});default:return Mt(n.length,t)}}validate(t,n){return n>=1&&n<=53}set(t,n,i,s){return ce(J0(t,i,s),s)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]}function eb(e,t,n){const i=J(e,n?.in),s=Ml(i,n)-t;return i.setDate(i.getDate()-s*7),i}class nb extends lt{priority=100;parse(t,n,i){switch(n){case"I":return wt(Ct.week,t);case"Io":return i.ordinalNumber(t,{unit:"week"});default:return Mt(n.length,t)}}validate(t,n){return n>=1&&n<=53}set(t,n,i){return Mn(eb(t,i))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]}const ib=[31,28,31,30,31,30,31,31,30,31,30,31],sb=[31,29,31,30,31,30,31,31,30,31,30,31];class ob extends lt{priority=90;subPriority=1;parse(t,n,i){switch(n){case"d":return wt(Ct.date,t);case"do":return i.ordinalNumber(t,{unit:"date"});default:return Mt(n.length,t)}}validate(t,n){const i=t.getFullYear(),s=zl(i),o=t.getMonth();return s?n>=1&&n<=sb[o]:n>=1&&n<=ib[o]}set(t,n,i){return t.setDate(i),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]}class ab extends lt{priority=90;subpriority=1;parse(t,n,i){switch(n){case"D":case"DD":return wt(Ct.dayOfYear,t);case"Do":return i.ordinalNumber(t,{unit:"date"});default:return Mt(n.length,t)}}validate(t,n){const i=t.getFullYear();return zl(i)?n>=1&&n<=366:n>=1&&n<=365}set(t,n,i){return t.setMonth(0,i),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]}function zo(e,t,n){const i=Ke(),s=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,o=J(e,n?.in),a=o.getDay(),l=(t%7+7)%7,c=7-s,d=t<0||t>6?t-(a+c)%7:(l+c)%7-(a+c)%7;return os(o,d,n)}class rb extends lt{priority=90;parse(t,n,i){switch(n){case"E":case"EE":case"EEE":return i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});case"EEEEE":return i.day(t,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});default:return i.day(t,{width:"wide",context:"formatting"})||i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"})}}validate(t,n){return n>=0&&n<=6}set(t,n,i,s){return t=zo(t,i,s),t.setHours(0,0,0,0),t}incompatibleTokens=["D","i","e","c","t","T"]}class lb extends lt{priority=90;parse(t,n,i,s){const o=a=>{const r=Math.floor((a-1)/7)*7;return(a+s.weekStartsOn+6)%7+r};switch(n){case"e":case"ee":return Ot(Mt(n.length,t),o);case"eo":return Ot(i.ordinalNumber(t,{unit:"day"}),o);case"eee":return i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});case"eeeee":return i.day(t,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});default:return i.day(t,{width:"wide",context:"formatting"})||i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"})}}validate(t,n){return n>=0&&n<=6}set(t,n,i,s){return t=zo(t,i,s),t.setHours(0,0,0,0),t}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]}class cb extends lt{priority=90;parse(t,n,i,s){const o=a=>{const r=Math.floor((a-1)/7)*7;return(a+s.weekStartsOn+6)%7+r};switch(n){case"c":case"cc":return Ot(Mt(n.length,t),o);case"co":return Ot(i.ordinalNumber(t,{unit:"day"}),o);case"ccc":return i.day(t,{width:"abbreviated",context:"standalone"})||i.day(t,{width:"short",context:"standalone"})||i.day(t,{width:"narrow",context:"standalone"});case"ccccc":return i.day(t,{width:"narrow",context:"standalone"});case"cccccc":return i.day(t,{width:"short",context:"standalone"})||i.day(t,{width:"narrow",context:"standalone"});default:return i.day(t,{width:"wide",context:"standalone"})||i.day(t,{width:"abbreviated",context:"standalone"})||i.day(t,{width:"short",context:"standalone"})||i.day(t,{width:"narrow",context:"standalone"})}}validate(t,n){return n>=0&&n<=6}set(t,n,i,s){return t=zo(t,i,s),t.setHours(0,0,0,0),t}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]}function ub(e,t,n){const i=J(e,n?.in),s=F0(i,n),o=t-s;return os(i,o,n)}class db extends lt{priority=90;parse(t,n,i){const s=o=>o===0?7:o;switch(n){case"i":case"ii":return Mt(n.length,t);case"io":return i.ordinalNumber(t,{unit:"day"});case"iii":return Ot(i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"}),s);case"iiiii":return Ot(i.day(t,{width:"narrow",context:"formatting"}),s);case"iiiiii":return Ot(i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"}),s);default:return Ot(i.day(t,{width:"wide",context:"formatting"})||i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"}),s)}}validate(t,n){return n>=1&&n<=7}set(t,n,i){return t=ub(t,i),t.setHours(0,0,0,0),t}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]}class hb extends lt{priority=80;parse(t,n,i){switch(n){case"a":case"aa":case"aaa":return i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"});case"aaaaa":return i.dayPeriod(t,{width:"narrow",context:"formatting"});default:return i.dayPeriod(t,{width:"wide",context:"formatting"})||i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"})}}set(t,n,i){return t.setHours(Fo(i),0,0,0),t}incompatibleTokens=["b","B","H","k","t","T"]}class fb extends lt{priority=80;parse(t,n,i){switch(n){case"b":case"bb":case"bbb":return i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"});case"bbbbb":return i.dayPeriod(t,{width:"narrow",context:"formatting"});default:return i.dayPeriod(t,{width:"wide",context:"formatting"})||i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"})}}set(t,n,i){return t.setHours(Fo(i),0,0,0),t}incompatibleTokens=["a","B","H","k","t","T"]}class mb extends lt{priority=80;parse(t,n,i){switch(n){case"B":case"BB":case"BBB":return i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"});case"BBBBB":return i.dayPeriod(t,{width:"narrow",context:"formatting"});default:return i.dayPeriod(t,{width:"wide",context:"formatting"})||i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"})}}set(t,n,i){return t.setHours(Fo(i),0,0,0),t}incompatibleTokens=["a","b","t","T"]}class pb extends lt{priority=70;parse(t,n,i){switch(n){case"h":return wt(Ct.hour12h,t);case"ho":return i.ordinalNumber(t,{unit:"hour"});default:return Mt(n.length,t)}}validate(t,n){return n>=1&&n<=12}set(t,n,i){const s=t.getHours()>=12;return s&&i<12?t.setHours(i+12,0,0,0):!s&&i===12?t.setHours(0,0,0,0):t.setHours(i,0,0,0),t}incompatibleTokens=["H","K","k","t","T"]}class gb extends lt{priority=70;parse(t,n,i){switch(n){case"H":return wt(Ct.hour23h,t);case"Ho":return i.ordinalNumber(t,{unit:"hour"});default:return Mt(n.length,t)}}validate(t,n){return n>=0&&n<=23}set(t,n,i){return t.setHours(i,0,0,0),t}incompatibleTokens=["a","b","h","K","k","t","T"]}class yb extends lt{priority=70;parse(t,n,i){switch(n){case"K":return wt(Ct.hour11h,t);case"Ko":return i.ordinalNumber(t,{unit:"hour"});default:return Mt(n.length,t)}}validate(t,n){return n>=0&&n<=11}set(t,n,i){return t.getHours()>=12&&i<12?t.setHours(i+12,0,0,0):t.setHours(i,0,0,0),t}incompatibleTokens=["h","H","k","t","T"]}class bb extends lt{priority=70;parse(t,n,i){switch(n){case"k":return wt(Ct.hour24h,t);case"ko":return i.ordinalNumber(t,{unit:"hour"});default:return Mt(n.length,t)}}validate(t,n){return n>=1&&n<=24}set(t,n,i){const s=i<=24?i%24:i;return t.setHours(s,0,0,0),t}incompatibleTokens=["a","b","h","H","K","t","T"]}class _b extends lt{priority=60;parse(t,n,i){switch(n){case"m":return wt(Ct.minute,t);case"mo":return i.ordinalNumber(t,{unit:"minute"});default:return Mt(n.length,t)}}validate(t,n){return n>=0&&n<=59}set(t,n,i){return t.setMinutes(i,0,0),t}incompatibleTokens=["t","T"]}class xb extends lt{priority=50;parse(t,n,i){switch(n){case"s":return wt(Ct.second,t);case"so":return i.ordinalNumber(t,{unit:"second"});default:return Mt(n.length,t)}}validate(t,n){return n>=0&&n<=59}set(t,n,i){return t.setSeconds(i,0),t}incompatibleTokens=["t","T"]}class wb extends lt{priority=30;parse(t,n){const i=s=>Math.trunc(s*Math.pow(10,-n.length+3));return Ot(Mt(n.length,t),i)}set(t,n,i){return t.setMilliseconds(i),t}incompatibleTokens=["t","T"]}class kb extends lt{priority=10;parse(t,n){switch(n){case"X":return de(ue.basicOptionalMinutes,t);case"XX":return de(ue.basic,t);case"XXXX":return de(ue.basicOptionalSeconds,t);case"XXXXX":return de(ue.extendedOptionalSeconds,t);default:return de(ue.extended,t)}}set(t,n,i){return n.timestampIsSet?t:vt(t,t.getTime()-as(t)-i)}incompatibleTokens=["t","T","x"]}class Tb extends lt{priority=10;parse(t,n){switch(n){case"x":return de(ue.basicOptionalMinutes,t);case"xx":return de(ue.basic,t);case"xxxx":return de(ue.basicOptionalSeconds,t);case"xxxxx":return de(ue.extendedOptionalSeconds,t);default:return de(ue.extended,t)}}set(t,n,i){return n.timestampIsSet?t:vt(t,t.getTime()-as(t)-i)}incompatibleTokens=["t","T","X"]}class Sb extends lt{priority=40;parse(t){return Bl(t)}set(t,n,i){return[vt(t,i*1e3),{timestampIsSet:!0}]}incompatibleTokens="*"}class vb extends lt{priority=20;parse(t){return Bl(t)}set(t,n,i){return[vt(t,i),{timestampIsSet:!0}]}incompatibleTokens="*"}const Mb={G:new Y0,y:new W0,Y:new j0,R:new q0,u:new G0,Q:new X0,q:new K0,M:new Z0,L:new Q0,w:new tb,I:new nb,d:new ob,D:new ab,E:new rb,e:new lb,c:new cb,i:new db,a:new hb,b:new fb,B:new mb,h:new pb,H:new gb,K:new yb,k:new bb,m:new _b,s:new xb,S:new wb,X:new kb,x:new Tb,t:new Sb,T:new vb},Db=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Cb=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Ob=/^'([^]*?)'?$/,Ab=/''/g,Pb=/\S/,Eb=/[a-zA-Z]/;function Rb(e,t,n,i){const s=()=>vt(i?.in||n,NaN),o=Ll(),a=i?.locale??o.locale??vl,r=i?.firstWeekContainsDate??i?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,l=i?.weekStartsOn??i?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0;if(!t)return e?s():J(n,i?.in);const c={firstWeekContainsDate:r,weekStartsOn:l,locale:a},d=[new $0(i?.in,n)],h=t.match(Cb).map(y=>{const _=y[0];if(_ in No){const x=No[_];return x(y,a.formatLong)}return y}).join("").match(Db),f=[];for(let y of h){!i?.useAdditionalWeekYearTokens&&Il(y)&&Bo(y,t,e),!i?.useAdditionalDayOfYearTokens&&Rl(y)&&Bo(y,t,e);const _=y[0],x=Mb[_];if(x){const{incompatibleTokens:T}=x;if(Array.isArray(T)){const w=f.find(D=>T.includes(D.token)||D.token===_);if(w)throw new RangeError(`The format string mustn't contain \`${w.fullToken}\` and \`${y}\` at the same time`)}else if(x.incompatibleTokens==="*"&&f.length>0)throw new RangeError(`The format string mustn't contain \`${y}\` and any other token at the same time`);f.push({token:_,fullToken:y});const v=x.run(e,y,a.match,c);if(!v)return s();d.push(v.setter),e=v.rest}else{if(_.match(Eb))throw new RangeError("Format string contains an unescaped latin alphabet character `"+_+"`");if(y==="''"?y="'":_==="'"&&(y=Ib(y)),e.indexOf(y)===0)e=e.slice(y.length);else return s()}}if(e.length>0&&Pb.test(e))return s();const m=d.map(y=>y.priority).sort((y,_)=>_-y).filter((y,_,x)=>x.indexOf(y)===_).map(y=>d.filter(_=>_.priority===y).sort((_,x)=>x.subPriority-_.subPriority)).map(y=>y[0]);let p=J(n,i?.in);if(isNaN(+p))return s();const g={};for(const y of m){if(!y.validate(p,c))return s();const _=y.set(p,g,c);Array.isArray(_)?(p=_[0],Object.assign(g,_[1])):p=_}return p}function Ib(e){return e.match(Ob)[1].replace(Ab,"'")}function Lb(e,t){const n=J(e,t?.in);return n.setMinutes(0,0,0),n}function Nb(e,t){const n=J(e,t?.in);return n.setSeconds(0,0),n}function Bb(e,t){const n=J(e,t?.in);return n.setMilliseconds(0),n}function Ul(e){const t=e/vn;return Math.trunc(t)}function Vl(e,t){const n=()=>vt(t?.in,NaN),i=t?.additionalDigits??2,s=Vb(e);let o;if(s.date){const c=Hb(s.date,i);o=$b(c.restDateString,c.year)}if(!o||isNaN(+o))return n();const a=+o;let r=0,l;if(s.time&&(r=Yb(s.time),isNaN(r)))return n();if(s.timezone){if(l=Wb(s.timezone),isNaN(l))return n()}else{const c=new Date(a+r),d=J(0,t?.in);return d.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),d.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),d}return J(a+r+l,t?.in)}const cs={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Fb=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,zb=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Ub=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Vb(e){const t={},n=e.split(cs.dateTimeDelimiter);let i;if(n.length>2)return t;if(/:/.test(n[0])?i=n[0]:(t.date=n[0],i=n[1],cs.timeZoneDelimiter.test(t.date)&&(t.date=e.split(cs.timeZoneDelimiter)[0],i=e.substr(t.date.length,e.length))),i){const s=cs.timezone.exec(i);s?(t.time=i.replace(s[1],""),t.timezone=s[1]):t.time=i}return t}function Hb(e,t){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),i=e.match(n);if(!i)return{year:NaN,restDateString:""};const s=i[1]?parseInt(i[1]):null,o=i[2]?parseInt(i[2]):null;return{year:o===null?s:o*100,restDateString:e.slice((i[1]||i[2]).length)}}function $b(e,t){if(t===null)return new Date(NaN);const n=e.match(Fb);if(!n)return new Date(NaN);const i=!!n[4],s=li(n[1]),o=li(n[2])-1,a=li(n[3]),r=li(n[4]),l=li(n[5])-1;if(i)return Kb(t,r,l)?jb(t,r,l):new Date(NaN);{const c=new Date(0);return!Gb(t,o,a)||!Xb(t,s)?new Date(NaN):(c.setUTCFullYear(t,o,Math.max(s,a)),c)}}function li(e){return e?parseInt(e):1}function Yb(e){const t=e.match(zb);if(!t)return NaN;const n=Uo(t[1]),i=Uo(t[2]),s=Uo(t[3]);return Zb(n,i,s)?n*vn+i*ii+s*1e3:NaN}function Uo(e){return e&&parseFloat(e.replace(",","."))||0}function Wb(e){if(e==="Z")return 0;const t=e.match(Ub);if(!t)return 0;const n=t[1]==="+"?-1:1,i=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return Qb(i,s)?n*(i*vn+s*ii):NaN}function jb(e,t,n){const i=new Date(0);i.setUTCFullYear(e,0,4);const s=i.getUTCDay()||7,o=(t-1)*7+n+1-s;return i.setUTCDate(i.getUTCDate()+o),i}const qb=[31,null,31,30,31,30,31,31,30,31,30,31];function Hl(e){return e%400===0||e%4===0&&e%100!==0}function Gb(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(qb[t]||(Hl(e)?29:28))}function Xb(e,t){return t>=1&&t<=(Hl(e)?366:365)}function Kb(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function Zb(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function Qb(e,t){return t>=0&&t<=59}const Jb={noDataAvailableTitle:"No data in the current time frame",noDataAvailableDescription:"Once there is traffic, it will display here",limitedResultsShown:"Grouped value limit exceeded, showing the top {maxReturned}",entityNoName:"no-name",debug:"debug",total:"Total",jumpToExplore:"Open in explorer",more_actions:"More actions",emptyEntityInfo:"Requests that do not have a value for the selected group",scatter:{median:"Median",percentile:"p{value}",outlier:"Outlier (> {label})"},chartUnits:{ms:"ms",bytes:"Byte{plural}",count:"request{plural}","count/minute":"rpm",requests:"request{plural}","token count":"token{plural}","tokens/minute":"tpm","%":"%","ops/minute":"ops/minute"},query_errors:{forbidden:{message:"Data request forbidden",details:"To access this data, either filter for an entity you have access to or request analytics viewer access from your administrator."},time_range_exceeded:{message:"Time range exceeded",details:"The time range for this report is outside of your organization's data retention period"},timeout:{message:"Data request timed out",details:"We're sorry, the request timed out. Please consider using a shorter time period or try again later."},canceled:{message:"Request canceled"},other:{message:"Bad request"}},legend:{datapointValueDisplay:"{value} {unit}"},chartLabels:{ai_count:"LLM request count",latencies_response_ms:"Response latency",latencies_upstream_ms:"Upstream latency",latencies_kong_gateway_ms:"Kong latency",latencies_kong_internal_ms:"Kong internal latency",request_body_size:"Request size",response_body_size:"Response size",response_header_content_length:"Content length",ai:{cost:"Cost",costCaching:"Caching cost",promptTokens:"Prompt tokens",completionTokens:"Completion tokens",totalTokens:"Total tokens",llmLatency:"LLM latency",fetchLatency:"Fetch latency",embeddingsLatency:"Embeddings latency"},mcp:{latency:"MCP latency",response_body_size:"MCP response size"},a2a:{latency:"A2A latency",response_body_size:"A2A response size"},ai_gateway:"AI gateway",ai_gateway_agent:"AI gateway agent",ai_gateway_consumer:"AI gateway consumer",ai_gateway_consumer_group:"AI gateway consumer group",ai_gateway_data_plane_node:"AI gateway data plane node",ai_gateway_mcp_server:"AI gateway MCP server",ai_gateway_model:"AI gateway model",ai_gateway_version:"AI gateway version",ai_plugin:"AI plugin",ai_provider:"Provider",ai_request_model:"Request model",ai_response_model:"Response model",error_rate:"Error rate",request_count:"Request count",share_of_requests:"Share of requests",request_per_minute:"Requests per minute",requests_per_minute:"Requests per minute",response_latency_average:"Response latency (avg)",response_latency_p99:"Response latency (p99)",response_latency_p95:"Response latency (p95)",response_latency_p50:"Response latency (p50)",kong_latency_average:"Kong latency (avg)",kong_latency_p99:"Kong latency (p99)",kong_latency_p95:"Kong latency (p95)",kong_latency_p50:"Kong latency (p50)",kong_internal_latency_average:"Kong internal latency (avg)",kong_internal_latency_p99:"Kong internal latency (p99)",kong_internal_latency_p95:"Kong internal latency (p95)",kong_internal_latency_p50:"Kong internal latency (p50)",llm_cache_status:"Cache status",llm_embeddings_model:"Embeddings model",llm_embeddings_provider:"Embeddings provider",upstream_latency_average:"Upstream latency (avg)",upstream_latency_p99:"Upstream latency (p99)",upstream_latency_p95:"Upstream latency (p95)",upstream_latency_p50:"Upstream latency (p50)",response_size_p99:"Response size (p99)",response_size_p95:"Response size (p95)",response_size_p50:"Response size (p50)",response_size_average:"Response size (avg)",response_size_sum:"Response size (sum)",response_source:"Response source",request_size_p99:"Request size (p99)",request_size_p95:"Request size (p95)",request_size_p50:"Request size (p50)",request_size_average:"Request size (avg)",request_size_sum:"Request size (sum)",control_plane:"Control plane",control_plane_group:"Control plane group",consumer:"Consumer",consumer_group:"Consumer group",oidc_credential:"OIDC credential",country_code:"Country",country:"Country",data_plane_node:"Data plane node",data_plane_node_version:"Data plane node version",api_package:"API package",api_product:"API product",api_product_version:"API product version",portal:"Portal",realm:"Realm",runtime_group:"Runtime group",gateway_service:"Gateway service",route:"Route",application:"Application",status_code:"Status code",status_code_grouped:"Status code (grouped)",total_tokens_per_minute:"Total tokens per minute",upstream_status_code:"Upstream status code",upstream_status_code_grouped:"Upstream status code group",time:"Time",Service:"Service",ServiceVersion:"Service version",Route:"Route",Application:"Application",RuntimeGroup:"Runtime group",GatewayService:"Gateway service",StatusCode:"Status code",CodeClass:"Status code (grouped)",Time:"Time",API_PRODUCT:"Api product",API_PRODUCT_VERSION:"Api product version",RUNTIME_GROUP:"Runtime group",GATEWAY_SERVICE:"Gateway service",ROUTE:"Route",APPLICATION:"Application",STATUS_CODE:"Status code",STATUS_CODE_GROUPED:"Status code (grouped)",TIME:"Time",ORGANIZATION:"Organization",TotalRequests:"Request count",RequestsPerMinute:"Requests per minute",LatencyP99:"Response latency (p99)",LatencyP95:"Response latency (p95)",LatencyP50:"Response latency (p50)",LatencyAverage:"Response latency (avg)",UpstreamLatencyP99:"Upstream latency (p99)",UpstreamLatencyP95:"Upstream latency (p95)",UpstreamLatencyP50:"Upstream latency (p50)",UpstreamLatencyAverage:"Upstream latency (avg)",KongLatencyP99:"Kong latency (p99)",KongLatencyP95:"Kong latency (p95)",KongLatencyP50:"Kong latency (p50)",KongLatencyAverage:"Kong latency (avg)",ResponseSizeP99:"Response size (p99)",ResponseSizeP95:"Response size (p95)",ResponseSizeP50:"Response size (p50)",RequestSizeP99:"Request size (p99)",RequestSizeP95:"Request size (p95)",RequestSizeP50:"Request size (p50)",SuccessfulRequests:"Successful requests",SUCCESS:"Successful requests",FailedRequests:"Failed requests",FAILURE:"Failed requests","5XX":"5xx","4XX":"4xx","3XX":"3xx","2XX":"2xx","1XX":"1xx",REQUEST_COUNT:"Request count",REQUEST_PER_MINUTE:"Requests per minute",RESPONSE_LATENCY_P99:"Response latency",RESPONSE_LATENCY_P95:"Response latency",RESPONSE_LATENCY_P50:"Response latency",RESPONSE_SIZE_P99:"Response size (p99)",RESPONSE_SIZE_P95:"Response size (p95)",RESPONSE_SIZE_P50:"Response size (p50)",REQUEST_SIZE_P99:"Request size (p99)",REQUEST_SIZE_P95:"Request size (p95)",REQUEST_SIZE_P50:"Request size (p50)",CONTROL_PLANE:"Control plane",____OTHER____:"Others",ai_request_count:"Request count",total_tokens:"Total token count",prompt_tokens:"Prompt token count",completion_tokens:"Completion token count",cost:"Costs",cost_per_request_average:"Request cost (avg per million)",share_of_cost:"Share of cost",llm_cache_embeddings_latency_average:"Embeddings latency (avg)",llm_cache_fetch_latency_average:"Fetch latency (avg)",llm_latency_average:"LLM latency (avg)",llm_latency_p50:"LLM latency (p50)",llm_latency_p95:"LLM latency (p95)",llm_latency_p99:"LLM latency (p99)","threshold-warning":"Warning threshold: {value}","threshold-error":"Error threshold: {value}","thatreshold-neutral":"Alert threshold: {value}",api:"API",vulnerability_count:"Vulnerability count",a2a_latency_average:"A2A latency (avg)",a2a_response_size_sum:"A2A response size (sum)",a2a_context_id:"A2A context ID",a2a_error:"A2A error",a2a_method:"A2A method",a2a_task_id:"A2A task ID",active_agents:"Active agents",mcp_error:"MCP error",mcp_method:"MCP method",mcp_latency_average:"MCP latency (avg)",mcp_latency_p99:"MCP latency (p99)",mcp_latency_p95:"MCP latency (p95)",mcp_latency_p50:"MCP latency (p50)",mcp_response_size_sum:"MCP response size (sum)",mcp_session_id:"MCP session ID",mcp_tool_name:"MCP tool name",mcp_response_body_size_sum:"MCP response size (sum)",control_plane_count:"Control plane count",service_count:"Gateway service count","record_bytes:sum":"Record size (sum)","record_count:sum":"Record count (sum)","request_count:sum":"Request count (sum)",route_count:"Route count",consumer_count:"Consumer count",plugin_count:"Plugin count",node_count:"Data plane node count",principal:"Principal",principal_group:"Principal group",virtual_cluster_id:"Virtual cluster",backend_cluster_id:"Backend cluster",listener_id:"Listener",principal_name:"Principal name",principal_type:"Principal type",request_type:"Request type",topic_name:"Topic name",partition_index:"Partition index",api_key:"API key",data_plane_group:"Data plane group",managed_cache:"Managed cache",network:"Network",provider:"Provider",provider_region:"Provider region",region:"Region",cache_eviction_rate:"Cache eviction rate",cache_expiration_rate:"Cache expiration rate",cache_items_average:"Cache items (avg)",cache_memory_utilization_max:"Cache memory utilization (max)",cache_status:"Cache status",cache_hit_rate:"Cache hit rate",time_to_first_token_average:"Time to first token (avg)",time_to_first_token_p99:"Time to first token (p99)",time_to_first_token_p95:"Time to first token (p95)",time_to_first_token_p50:"Time to first token (p50)",time_per_token_average:"Time per token (avg)",time_per_token_p99:"Time per token (p99)",time_per_token_p95:"Time per token (p95)",time_per_token_p50:"Time per token (p50)"},metricAxisTitles:{cache_hit_rate:"Cache hit rate {unit}",error_rate:"Error rate in {unit}",request_count:"Request count",share_of_requests:"Share of requests",request_per_minute:"Requests per minute",requests_per_minute:"Requests per minute",latency_in:"Latency in {unit}",size_in:"Size in {unit}",response_latency_average:"Response latency (avg) in {unit}",response_latency_p99:"Response latency (p99) in {unit}",response_latency_p95:"Response latency (p95) in {unit}",response_latency_p50:"Response latency (p50) in {unit}",upstream_latency_p99:"Upstream latency (p99) in {unit}",upstream_latency_p95:"Upstream latency (p95) in {unit}",upstream_latency_p50:"Upstream latency (p50) in {unit}",kong_latency_p99:"Kong latency (p99) in {unit}",kong_latency_p95:"Kong latency (p95) in {unit}",kong_latency_p50:"Kong latency (p50) in {unit}",kong_internal_latency_average:"Kong internal latency (avg) in {unit}",kong_internal_latency_p99:"Kong internal latency (p99) in {unit}",kong_internal_latency_p95:"Kong internal latency (p95) in {unit}",kong_internal_latency_p50:"Kong internal latency (p50) in {unit}",response_size_p99:"Response size (p99) in {unit}",response_size_p95:"Response size (p95) in {unit}",response_size_p50:"Response size (p50) in {unit}",request_size_p99:"Request size (p99) in {unit}",request_size_p95:"Request size (p95) in {unit}",request_size_p50:"Request size (p50) in {unit}",request_size_sum:"Request size (sum) in {unit}",REQUEST_COUNT:"Request count",REQUEST_PER_MINUTE:"Requests per minute",RESPONSE_LATENCY_P99:"Response latency (p99) in {unit}",RESPONSE_LATENCY_P95:"Response latency (p95) in {unit}",RESPONSE_LATENCY_P50:"Response latency (p50) in {unit}",RESPONSE_SIZE_P99:"Response size (p99) in {unit}",RESPONSE_SIZE_P95:"Response size (p95) in {unit}",RESPONSE_SIZE_P50:"Response size (p50) in {unit}",REQUEST_SIZE_P99:"Request size (p99) in {unit}",REQUEST_SIZE_P95:"Request size (p95) in {unit}",REQUEST_SIZE_P50:"Request size (p50) in {unit}",TotalRequests:"Request count",RequestsPerMinute:"Requests per minute",LatencyP99:"Response latency (p99) in {unit}",LatencyP95:"Response latency (p95) in {unit}",LatencyP50:"Response latency (p50) in {unit}",LatencyAverage:"Response latency (avg) in {unit}",UpstreamLatencyP99:"Upstream latency (p99) in {unit}",UpstreamLatencyP95:"Upstream latency (p95) in {unit}",UpstreamLatencyP50:"Upstream latency (p50) in {unit}",UpstreamLatencyAverage:"Upstream latency (avg) in {unit}",KongLatencyP99:"Kong latency (p99) in {unit}",KongLatencyP95:"Kong latency (p95) in {unit}",KongLatencyP50:"Kong latency (p50) in {unit}",KongLatencyAverage:"Kong latency (avg) in {unit}",ResponseSizeP99:"Response size (p99) in {unit}",ResponseSizeP95:"Response size (p95) in {unit}",ResponseSizeP50:"Response size (p50) in {unit}",RequestSizeP99:"Request size (p99) in {unit}",RequestSizeP95:"Request size (p95) in {unit}",RequestSizeP50:"Request size (p50) in {unit}",ai_request_count:"Request count",total_tokens:"Total token count",prompt_tokens:"Prompt token count",completion_tokens:"Completion token count",cost:"Costs",cost_per_request_average:"Cost per request (avg)",share_of_cost:"Share of cost",llm_cache_embeddings_latency_average:"Embeddings latency (avg)",llm_cache_fetch_latency_average:"Fetch latency (avg)",llm_latency_average:"LLM latency (avg)",llm_latency_p50:"LLM latency (p50)",llm_latency_p95:"LLM latency (p95)",llm_latency_p99:"LLM latency (p99)",api:"API",a2a_latency_average:"A2A latency (avg) in {unit}",a2a_response_size_sum:"A2A response size (sum) in {unit}",a2a_context_id:"A2A context ID",a2a_error:"A2A error",a2a_method:"A2A method",a2a_task_id:"A2A task ID",active_agents:"Active agents",mcp_latency_average:"MCP latency (avg)",mcp_latency_p99:"MCP latency (p99)",mcp_latency_p95:"MCP latency (p95)",mcp_latency_p50:"MCP latency (p50)",mcp_response_size_sum:"MCP response size (sum) in {unit}",mcp_response_body_size_sum:"MCP response body size (sum) in {unit}",control_plane_count:"Control plane count",service_count:"Gateway service count",route_count:"Route count",consumer_count:"Consumer count",plugin_count:"Plugin count",node_count:"Data plane node count",cache_eviction_rate:"Cache eviction rate in {unit}",cache_expiration_rate:"Cache expiration rate in {unit}",cache_items_average:"Cache items (avg)",cache_memory_utilization_max:"Cache memory utilization (max) in {unit}",cached_tokens:"Cached tokens",time_to_first_token_average:"Time to first token (avg)",time_to_first_token_p99:"Time to first token (p99)",time_to_first_token_p95:"Time to first token (p95)",time_to_first_token_p50:"Time to first token (p50)",time_per_token_average:"Time per token (avg)",time_per_token_p99:"Time per token (p99)",time_per_token_p95:"Time per token (p95)",time_per_token_p50:"Time per token (p50)",total_tokens_per_minute:"Total tokens per minute"},granularityAxisTitles:{tenSecondly:"@timestamp per 10 seconds",thirtySecondly:"@timestamp per 30 seconds",minutely:"@timestamp per minute",fiveMinutely:"@timestamp per 5 minutes",tenMinutely:"@timestamp per 10 minutes",thirtyMinutely:"@timestamp per 30 minutes",hourly:"@timestamp per hour",twoHourly:"@timestamp per 2 hours",twelveHourly:"@timestamp per 12 hours",daily:"@timestamp per day",weekly:"@timestamp per week"},timestampAxisTitles:{platform:"@timestamp created at"},topNTable:{nameLabel:"Name",defaultEmptyStateTitle:"No data to display",defaultErrorStateTitle:"Something went wrong",errors:{meta:"Error: response must contain 'meta'",display:"Error: 'display' response incorrectly formatted (must have at least one key)",metricNames:"Error: 'metricNames' response incorrectly formatted (must have at least one entry)"}},topTalkers:{total:"{value} total",defaultEmptyStateTitle:"No data to display",defaultErrorStateTitle:"Something went wrong"},singleValue:{valueError:"Invalid configuration",trend:{not_available:"Not available"}},new_timerange_label:"Time range",sparkline_no_data:"No data",zoom_action_items:{zoom:"Zoom in",view_requests:"View requests",cancel:"Cancel",explore:"Explore"},zoom_time_range:{from:"From",to:"To"}};function Vo(){const e=vr.createI18n("en-us",Jb);return{i18n:e,i18nT:vr.i18nTComponent(e)}}function ci(e){return e+.5|0}const Pe=(e,t,n)=>Math.max(Math.min(e,n),t);function ui(e){return Pe(ci(e*2.55),0,255)}function Ee(e){return Pe(ci(e*255),0,255)}function be(e){return Pe(ci(e/2.55)/100,0,1)}function $l(e){return Pe(ci(e*100),0,100)}const ae={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Ho=[..."0123456789ABCDEF"],t_=e=>Ho[e&15],e_=e=>Ho[(e&240)>>4]+Ho[e&15],us=e=>(e&240)>>4===(e&15),n_=e=>us(e.r)&&us(e.g)&&us(e.b)&&us(e.a);function i_(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&ae[e[1]]*17,g:255&ae[e[2]]*17,b:255&ae[e[3]]*17,a:t===5?ae[e[4]]*17:255}:(t===7||t===9)&&(n={r:ae[e[1]]<<4|ae[e[2]],g:ae[e[3]]<<4|ae[e[4]],b:ae[e[5]]<<4|ae[e[6]],a:t===9?ae[e[7]]<<4|ae[e[8]]:255})),n}const s_=(e,t)=>e<255?t(e):"";function o_(e){var t=n_(e)?t_:e_;return e?"#"+t(e.r)+t(e.g)+t(e.b)+s_(e.a,t):void 0}const a_=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Yl(e,t,n){const i=t*Math.min(n,1-n),s=(o,a=(o+e/30)%12)=>n-i*Math.max(Math.min(a-3,9-a,1),-1);return[s(0),s(8),s(4)]}function r_(e,t,n){const i=(s,o=(s+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function l_(e,t,n){const i=Yl(e,1,.5);let s;for(t+n>1&&(s=1/(t+n),t*=s,n*=s),s=0;s<3;s++)i[s]*=1-t-n,i[s]+=t;return i}function c_(e,t,n,i,s){return e===s?(t-n)/i+(t<n?6:0):t===s?(n-e)/i+2:(e-t)/i+4}function $o(e){const n=e.r/255,i=e.g/255,s=e.b/255,o=Math.max(n,i,s),a=Math.min(n,i,s),r=(o+a)/2;let l,c,d;return o!==a&&(d=o-a,c=r>.5?d/(2-o-a):d/(o+a),l=c_(n,i,s,d,o),l=l*60+.5),[l|0,c||0,r]}function Yo(e,t,n,i){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,i)).map(Ee)}function Wo(e,t,n){return Yo(Yl,e,t,n)}function u_(e,t,n){return Yo(l_,e,t,n)}function d_(e,t,n){return Yo(r_,e,t,n)}function Wl(e){return(e%360+360)%360}function h_(e){const t=a_.exec(e);let n=255,i;if(!t)return;t[5]!==i&&(n=t[6]?ui(+t[5]):Ee(+t[5]));const s=Wl(+t[2]),o=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?i=u_(s,o,a):t[1]==="hsv"?i=d_(s,o,a):i=Wo(s,o,a),{r:i[0],g:i[1],b:i[2],a:n}}function f_(e,t){var n=$o(e);n[0]=Wl(n[0]+t),n=Wo(n),e.r=n[0],e.g=n[1],e.b=n[2]}function m_(e){if(!e)return;const t=$o(e),n=t[0],i=$l(t[1]),s=$l(t[2]);return e.a<255?`hsla(${n}, ${i}%, ${s}%, ${be(e.a)})`:`hsl(${n}, ${i}%, ${s}%)`}const jl={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},ql={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function p_(){const e={},t=Object.keys(ql),n=Object.keys(jl);let i,s,o,a,r;for(i=0;i<t.length;i++){for(a=r=t[i],s=0;s<n.length;s++)o=n[s],r=r.replace(o,jl[o]);o=parseInt(ql[a],16),e[r]=[o>>16&255,o>>8&255,o&255]}return e}let ds;function g_(e){ds||(ds=p_(),ds.transparent=[0,0,0,0]);const t=ds[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const y_=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function b_(e){const t=y_.exec(e);let n=255,i,s,o;if(t){if(t[7]!==i){const a=+t[7];n=t[8]?ui(a):Pe(a*255,0,255)}return i=+t[1],s=+t[3],o=+t[5],i=255&(t[2]?ui(i):Pe(i,0,255)),s=255&(t[4]?ui(s):Pe(s,0,255)),o=255&(t[6]?ui(o):Pe(o,0,255)),{r:i,g:s,b:o,a:n}}}function __(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${be(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const jo=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,Cn=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function x_(e,t,n){const i=Cn(be(e.r)),s=Cn(be(e.g)),o=Cn(be(e.b));return{r:Ee(jo(i+n*(Cn(be(t.r))-i))),g:Ee(jo(s+n*(Cn(be(t.g))-s))),b:Ee(jo(o+n*(Cn(be(t.b))-o))),a:e.a+n*(t.a-e.a)}}function hs(e,t,n){if(e){let i=$o(e);i[t]=Math.max(0,Math.min(i[t]+i[t]*n,t===0?360:1)),i=Wo(i),e.r=i[0],e.g=i[1],e.b=i[2]}}function Gl(e,t){return e&&Object.assign(t||{},e)}function Xl(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=Ee(e[3]))):(t=Gl(e,{r:0,g:0,b:0,a:1}),t.a=Ee(t.a)),t}function w_(e){return e.charAt(0)==="r"?b_(e):h_(e)}class di{constructor(t){if(t instanceof di)return t;const n=typeof t;let i;n==="object"?i=Xl(t):n==="string"&&(i=i_(t)||g_(t)||w_(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Gl(this._rgb);return t&&(t.a=be(t.a)),t}set rgb(t){this._rgb=Xl(t)}rgbString(){return this._valid?__(this._rgb):void 0}hexString(){return this._valid?o_(this._rgb):void 0}hslString(){return this._valid?m_(this._rgb):void 0}mix(t,n){if(t){const i=this.rgb,s=t.rgb;let o;const a=n===o?.5:n,r=2*a-1,l=i.a-s.a,c=((r*l===-1?r:(r+l)/(1+r*l))+1)/2;o=1-c,i.r=255&c*i.r+o*s.r+.5,i.g=255&c*i.g+o*s.g+.5,i.b=255&c*i.b+o*s.b+.5,i.a=a*i.a+(1-a)*s.a,this.rgb=i}return this}interpolate(t,n){return t&&(this._rgb=x_(this._rgb,t._rgb,n)),this}clone(){return new di(this.rgb)}alpha(t){return this._rgb.a=Ee(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=ci(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return hs(this._rgb,2,t),this}darken(t){return hs(this._rgb,2,-t),this}saturate(t){return hs(this._rgb,1,t),this}desaturate(t){return hs(this._rgb,1,-t),this}rotate(t){return f_(this._rgb,t),this}}function _e(){}const k_=(()=>{let e=0;return()=>e++})();function Z(e){return e==null}function ct(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function et(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function _t(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function ie(e,t){return _t(e)?e:t}function Q(e,t){return typeof e>"u"?t:e}const T_=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/t,Kl=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function ft(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function mt(e,t,n,i){let s,o,a;if(ct(e))for(o=e.length,s=0;s<o;s++)t.call(n,e[s],s);else if(et(e))for(a=Object.keys(e),o=a.length,s=0;s<o;s++)t.call(n,e[a[s]],a[s])}function fs(e,t){let n,i,s,o;if(!e||!t||e.length!==t.length)return!1;for(n=0,i=e.length;n<i;++n)if(s=e[n],o=t[n],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function ms(e){if(ct(e))return e.map(ms);if(et(e)){const t=Object.create(null),n=Object.keys(e),i=n.length;let s=0;for(;s<i;++s)t[n[s]]=ms(e[n[s]]);return t}return e}function Zl(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function S_(e,t,n,i){if(!Zl(e))return;const s=t[e],o=n[e];et(s)&&et(o)?hi(s,o,i):t[e]=ms(o)}function hi(e,t,n){const i=ct(t)?t:[t],s=i.length;if(!et(e))return e;n=n||{};const o=n.merger||S_;let a;for(let r=0;r<s;++r){if(a=i[r],!et(a))continue;const l=Object.keys(a);for(let c=0,d=l.length;c<d;++c)o(l[c],e,a,n)}return e}function fi(e,t){return hi(e,t,{merger:v_})}function v_(e,t,n){if(!Zl(e))return;const i=t[e],s=n[e];et(i)&&et(s)?fi(i,s):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=ms(s))}const Ql={"":e=>e,x:e=>e.x,y:e=>e.y};function M_(e){const t=e.split("."),n=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(n.push(i),i="");return n}function D_(e){const t=M_(e);return n=>{for(const i of t){if(i==="")break;n=n&&n[i]}return n}}function Re(e,t){return(Ql[t]||(Ql[t]=D_(t)))(e)}function qo(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Xt=e=>typeof e<"u",Kt=e=>typeof e=="function",Jl=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function C_(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const tt=Math.PI,gt=2*tt,O_=gt+tt,ps=Number.POSITIVE_INFINITY,Go=tt/180,yt=tt/2,re=tt/4,gs=tt*2/3,Ie=Math.log10,he=Math.sign;function mi(e,t,n){return Math.abs(e-t)<n}function tc(e){const t=Math.round(e);e=mi(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(Ie(e))),i=e/n;return(i<=1?1:i<=2?2:i<=5?5:10)*n}function A_(e){const t=[],n=Math.sqrt(e);let i;for(i=1;i<n;i++)e%i===0&&(t.push(i),t.push(e/i));return n===(n|0)&&t.push(n),t.sort((s,o)=>s-o).pop(),t}function P_(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function Le(e){return!P_(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function E_(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function ec(e,t,n){let i,s,o;for(i=0,s=e.length;i<s;i++)o=e[i][n],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function At(e){return e*(tt/180)}function ys(e){return e*(180/tt)}function nc(e){if(!_t(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function bs(e,t){const n=t.x-e.x,i=t.y-e.y,s=Math.sqrt(n*n+i*i);let o=Math.atan2(i,n);return o<-.5*tt&&(o+=gt),{angle:o,distance:s}}function On(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function R_(e,t){return(e-t+O_)%gt-tt}function Ut(e){return(e%gt+gt)%gt}function pi(e,t,n,i){const s=Ut(e),o=Ut(t),a=Ut(n),r=Ut(o-s),l=Ut(a-s),c=Ut(s-o),d=Ut(s-a);return s===o||s===a||i&&o===a||r>l&&c<d}function It(e,t,n){return Math.max(t,Math.min(n,e))}function I_(e){return It(e,-32768,32767)}function xe(e,t,n,i=1e-6){return e>=Math.min(t,n)-i&&e<=Math.max(t,n)+i}function Xo(e,t,n){n=n||(a=>e[a]<t);let i=e.length-1,s=0,o;for(;i-s>1;)o=s+i>>1,n(o)?s=o:i=o;return{lo:s,hi:i}}const we=(e,t,n,i)=>Xo(e,n,i?s=>{const o=e[s][t];return o<n||o===n&&e[s+1][t]===n}:s=>e[s][t]<n),L_=(e,t,n)=>Xo(e,n,i=>e[i][t]>=n);function N_(e,t,n){let i=0,s=e.length;for(;i<s&&e[i]<t;)i++;for(;s>i&&e[s-1]>n;)s--;return i>0||s<e.length?e.slice(i,s):e}const ic=["push","pop","shift","splice","unshift"];function B_(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),ic.forEach(n=>{const i="_onData"+qo(n),s=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const a=s.apply(this,o);return e._chartjs.listeners.forEach(r=>{typeof r[i]=="function"&&r[i](...o)}),a}})})}function sc(e,t){const n=e._chartjs;if(!n)return;const i=n.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(ic.forEach(o=>{delete e[o]}),delete e._chartjs)}function oc(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const ac=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function rc(e,t){let n=[],i=!1;return function(...s){n=s,i||(i=!0,ac.call(window,()=>{i=!1,e.apply(t,n)}))}}function F_(e,t){let n;return function(...i){return t?(clearTimeout(n),n=setTimeout(e,t,i)):e.apply(this,i),t}}const Ko=e=>e==="start"?"left":e==="end"?"right":"center",Vt=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,z_=(e,t,n,i)=>e===(i?"left":"right")?n:e==="center"?(t+n)/2:t;function lc(e,t,n){const i=t.length;let s=0,o=i;if(e._sorted){const{iScale:a,vScale:r,_parsed:l}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,d=a.axis,{min:h,max:f,minDefined:m,maxDefined:p}=a.getUserBounds();if(m){if(s=Math.min(we(l,d,h).lo,n?i:we(t,d,a.getPixelForValue(h)).lo),c){const g=l.slice(0,s+1).reverse().findIndex(y=>!Z(y[r.axis]));s-=Math.max(0,g)}s=It(s,0,i-1)}if(p){let g=Math.max(we(l,a.axis,f,!0).hi+1,n?0:we(t,d,a.getPixelForValue(f),!0).hi+1);if(c){const y=l.slice(g-1).findIndex(_=>!Z(_[r.axis]));g+=Math.max(0,y)}o=It(g,s,i)-s}else o=i-s}return{start:s,count:o}}function cc(e){const{xScale:t,yScale:n,_scaleRanges:i}=e,s={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!i)return e._scaleRanges=s,!0;const o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==n.min||i.ymax!==n.max;return Object.assign(i,s),o}const _s=e=>e===0||e===1,uc=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*gt/n)),dc=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*gt/n)+1,gi={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*yt)+1,easeOutSine:e=>Math.sin(e*yt),easeInOutSine:e=>-.5*(Math.cos(tt*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>_s(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>_s(e)?e:uc(e,.075,.3),easeOutElastic:e=>_s(e)?e:dc(e,.075,.3),easeInOutElastic(e){return _s(e)?e:e<.5?.5*uc(e*2,.1125,.45):.5+.5*dc(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-gi.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?gi.easeInBounce(e*2)*.5:gi.easeOutBounce(e*2-1)*.5+.5};function Zo(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function xs(e){return Zo(e)?e:new di(e)}function Qo(e){return Zo(e)?e:new di(e).saturate(.5).darken(.1).hexString()}const U_=["x","y","borderWidth","radius","tension"],V_=["color","borderColor","backgroundColor"];function H_(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:V_},numbers:{type:"number",properties:U_}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function $_(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const hc=new Map;function Y_(e,t){t=t||{};const n=e+JSON.stringify(t);let i=hc.get(n);return i||(i=new Intl.NumberFormat(e,t),hc.set(n,i)),i}function yi(e,t,n){return Y_(t,n).format(e)}const fc={values(e){return ct(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const i=this.chart.options.locale;let s,o=e;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=W_(e,n)}const a=Ie(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:s,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),yi(e,i,l)},logarithmic(e,t,n){if(e===0)return"0";const i=n[t].significand||e/Math.pow(10,Math.floor(Ie(e)));return[1,2,3,5,10,15].includes(i)||t>.8*n.length?fc.numeric.call(this,e,t,n):""}};function W_(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var ws={formatters:fc};function j_(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:ws.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Je=Object.create(null),Jo=Object.create(null);function bi(e,t){if(!t)return e;const n=t.split(".");for(let i=0,s=n.length;i<s;++i){const o=n[i];e=e[o]||(e[o]=Object.create(null))}return e}function ta(e,t,n){return typeof t=="string"?hi(bi(e,t),n):hi(bi(e,""),t)}class q_{constructor(t,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>Qo(s.backgroundColor),this.hoverBorderColor=(i,s)=>Qo(s.borderColor),this.hoverColor=(i,s)=>Qo(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return ta(this,t,n)}get(t){return bi(this,t)}describe(t,n){return ta(Jo,t,n)}override(t,n){return ta(Je,t,n)}route(t,n,i,s){const o=bi(this,t),a=bi(this,i),r="_"+n;Object.defineProperties(o,{[r]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[r],c=a[s];return et(l)?Object.assign({},c,l):Q(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(n=>n(this))}}var bt=new q_({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[H_,$_,j_]);function G_(e){return!e||Z(e.size)||Z(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function ks(e,t,n,i,s){let o=t[s];return o||(o=t[s]=e.measureText(s).width,n.push(s)),o>i&&(i=o),i}function X_(e,t,n,i){i=i||{};let s=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},o=i.garbageCollect=[],i.font=t),e.save(),e.font=t;let a=0;const r=n.length;let l,c,d,h,f;for(l=0;l<r;l++)if(h=n[l],h!=null&&!ct(h))a=ks(e,s,o,a,h);else if(ct(h))for(c=0,d=h.length;c<d;c++)f=h[c],f!=null&&!ct(f)&&(a=ks(e,s,o,a,f));e.restore();const m=o.length/2;if(m>n.length){for(l=0;l<m;l++)delete s[o[l]];o.splice(0,m)}return a}function tn(e,t,n){const i=e.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((t-s)*i)/i+s}function mc(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function ea(e,t,n,i){pc(e,t,n,i,null)}function pc(e,t,n,i,s){let o,a,r,l,c,d,h,f;const m=t.pointStyle,p=t.rotation,g=t.radius;let y=(p||0)*Go;if(m&&typeof m=="object"&&(o=m.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,i),e.rotate(y),e.drawImage(m,-m.width/2,-m.height/2,m.width,m.height),e.restore();return}if(!(isNaN(g)||g<=0)){switch(e.beginPath(),m){default:s?e.ellipse(n,i,s/2,g,0,0,gt):e.arc(n,i,g,0,gt),e.closePath();break;case"triangle":d=s?s/2:g,e.moveTo(n+Math.sin(y)*d,i-Math.cos(y)*g),y+=gs,e.lineTo(n+Math.sin(y)*d,i-Math.cos(y)*g),y+=gs,e.lineTo(n+Math.sin(y)*d,i-Math.cos(y)*g),e.closePath();break;case"rectRounded":c=g*.516,l=g-c,a=Math.cos(y+re)*l,h=Math.cos(y+re)*(s?s/2-c:l),r=Math.sin(y+re)*l,f=Math.sin(y+re)*(s?s/2-c:l),e.arc(n-h,i-r,c,y-tt,y-yt),e.arc(n+f,i-a,c,y-yt,y),e.arc(n+h,i+r,c,y,y+yt),e.arc(n-f,i+a,c,y+yt,y+tt),e.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*g,d=s?s/2:l,e.rect(n-d,i-l,2*d,2*l);break}y+=re;case"rectRot":h=Math.cos(y)*(s?s/2:g),a=Math.cos(y)*g,r=Math.sin(y)*g,f=Math.sin(y)*(s?s/2:g),e.moveTo(n-h,i-r),e.lineTo(n+f,i-a),e.lineTo(n+h,i+r),e.lineTo(n-f,i+a),e.closePath();break;case"crossRot":y+=re;case"cross":h=Math.cos(y)*(s?s/2:g),a=Math.cos(y)*g,r=Math.sin(y)*g,f=Math.sin(y)*(s?s/2:g),e.moveTo(n-h,i-r),e.lineTo(n+h,i+r),e.moveTo(n+f,i-a),e.lineTo(n-f,i+a);break;case"star":h=Math.cos(y)*(s?s/2:g),a=Math.cos(y)*g,r=Math.sin(y)*g,f=Math.sin(y)*(s?s/2:g),e.moveTo(n-h,i-r),e.lineTo(n+h,i+r),e.moveTo(n+f,i-a),e.lineTo(n-f,i+a),y+=re,h=Math.cos(y)*(s?s/2:g),a=Math.cos(y)*g,r=Math.sin(y)*g,f=Math.sin(y)*(s?s/2:g),e.moveTo(n-h,i-r),e.lineTo(n+h,i+r),e.moveTo(n+f,i-a),e.lineTo(n-f,i+a);break;case"line":a=s?s/2:Math.cos(y)*g,r=Math.sin(y)*g,e.moveTo(n-a,i-r),e.lineTo(n+a,i+r);break;case"dash":e.moveTo(n,i),e.lineTo(n+Math.cos(y)*(s?s/2:g),i+Math.sin(y)*g);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function ke(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function _i(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function xi(e){e.restore()}function K_(e,t,n,i,s){if(!t)return e.lineTo(n.x,n.y);if(s==="middle"){const o=(t.x+n.x)/2;e.lineTo(o,t.y),e.lineTo(o,n.y)}else s==="after"!=!!i?e.lineTo(t.x,n.y):e.lineTo(n.x,t.y);e.lineTo(n.x,n.y)}function Z_(e,t,n,i){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?n.cp2x:n.cp1x,i?n.cp2y:n.cp1y,n.x,n.y)}function Q_(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),Z(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function J_(e,t,n,i,s){if(s.strikethrough||s.underline){const o=e.measureText(i),a=t-o.actualBoundingBoxLeft,r=t+o.actualBoundingBoxRight,l=n-o.actualBoundingBoxAscent,c=n+o.actualBoundingBoxDescent,d=s.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=s.decorationWidth||2,e.moveTo(a,d),e.lineTo(r,d),e.stroke()}}function tx(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function en(e,t,n,i,s,o={}){const a=ct(t)?t:[t],r=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(e.save(),e.font=s.string,Q_(e,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&tx(e,o.backdrop),r&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),Z(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,n,i,o.maxWidth)),e.fillText(c,n,i,o.maxWidth),J_(e,n,i,c,o),i+=Number(s.lineHeight);e.restore()}function An(e,t){const{x:n,y:i,w:s,h:o,radius:a}=t;e.arc(n+a.topLeft,i+a.topLeft,a.topLeft,1.5*tt,tt,!0),e.lineTo(n,i+o-a.bottomLeft),e.arc(n+a.bottomLeft,i+o-a.bottomLeft,a.bottomLeft,tt,yt,!0),e.lineTo(n+s-a.bottomRight,i+o),e.arc(n+s-a.bottomRight,i+o-a.bottomRight,a.bottomRight,yt,0,!0),e.lineTo(n+s,i+a.topRight),e.arc(n+s-a.topRight,i+a.topRight,a.topRight,0,-yt,!0),e.lineTo(n+a.topLeft,i)}const ex=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,nx=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function ix(e,t){const n=(""+e).match(ex);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}const sx=e=>+e||0;function na(e,t){const n={},i=et(t),s=i?Object.keys(t):t,o=et(e)?i?a=>Q(e[a],e[t[a]]):a=>e[a]:()=>e;for(const a of s)n[a]=sx(o(a));return n}function gc(e){return na(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Ne(e){return na(e,["topLeft","topRight","bottomLeft","bottomRight"])}function Pt(e){const t=gc(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function xt(e,t){e=e||{},t=t||bt.font;let n=Q(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let i=Q(e.style,t.style);i&&!(""+i).match(nx)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:Q(e.family,t.family),lineHeight:ix(Q(e.lineHeight,t.lineHeight),n),size:n,style:i,weight:Q(e.weight,t.weight),string:""};return s.string=G_(s),s}function wi(e,t,n,i){let s,o,a;for(s=0,o=e.length;s<o;++s)if(a=e[s],a!==void 0&&a!==void 0)return a}function ox(e,t,n){const{min:i,max:s}=e,o=Kl(t,(s-i)/2),a=(r,l)=>n&&r===0?0:r+l;return{min:a(i,-Math.abs(o)),max:a(s,o)}}function Be(e,t){return Object.assign(Object.create(e),t)}function ia(e,t=[""],n,i,s=()=>e[0]){const o=n||e;typeof i>"u"&&(i=wc("_fallback",e));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:i,_getTarget:s,override:r=>ia([r,...e],t,o,i)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete e[0][l],!0},get(r,l){return bc(r,l,()=>fx(l,t,e,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(r,l){return kc(r).includes(l)},ownKeys(r){return kc(r)},set(r,l,c){const d=r._storage||(r._storage=s());return r[l]=d[l]=c,delete r._keys,!0}})}function Pn(e,t,n,i){const s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:yc(e,i),setContext:o=>Pn(e,o,n,i),override:o=>Pn(e.override(o),t,n,i)};return new Proxy(s,{deleteProperty(o,a){return delete o[a],delete e[a],!0},get(o,a,r){return bc(o,a,()=>rx(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(e,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,a)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,a){return Reflect.has(e,a)},ownKeys(){return Reflect.ownKeys(e)},set(o,a,r){return e[a]=r,delete o[a],!0}})}function yc(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:n,indexable:i,isScriptable:Kt(n)?n:()=>n,isIndexable:Kt(i)?i:()=>i}}const ax=(e,t)=>e?e+qo(t):t,sa=(e,t)=>et(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function bc(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const i=n();return e[t]=i,i}function rx(e,t,n){const{_proxy:i,_context:s,_subProxy:o,_descriptors:a}=e;let r=i[t];return Kt(r)&&a.isScriptable(t)&&(r=lx(t,r,e,n)),ct(r)&&r.length&&(r=cx(t,r,e,a.isIndexable)),sa(t,r)&&(r=Pn(r,s,o&&o[t],a)),r}function lx(e,t,n,i){const{_proxy:s,_context:o,_subProxy:a,_stack:r}=n;if(r.has(e))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+e);r.add(e);let l=t(o,a||i);return r.delete(e),sa(e,l)&&(l=oa(s._scopes,s,e,l)),l}function cx(e,t,n,i){const{_proxy:s,_context:o,_subProxy:a,_descriptors:r}=n;if(typeof o.index<"u"&&i(e))return t[o.index%t.length];if(et(t[0])){const l=t,c=s._scopes.filter(d=>d!==l);t=[];for(const d of l){const h=oa(c,s,e,d);t.push(Pn(h,o,a&&a[e],r))}}return t}function _c(e,t,n){return Kt(e)?e(t,n):e}const ux=(e,t)=>e===!0?t:typeof e=="string"?Re(t,e):void 0;function dx(e,t,n,i,s){for(const o of t){const a=ux(n,o);if(a){e.add(a);const r=_c(a._fallback,n,s);if(typeof r<"u"&&r!==n&&r!==i)return r}else if(a===!1&&typeof i<"u"&&n!==i)return null}return!1}function oa(e,t,n,i){const s=t._rootScopes,o=_c(t._fallback,n,i),a=[...e,...s],r=new Set;r.add(i);let l=xc(r,a,n,o||n,i);return l===null||typeof o<"u"&&o!==n&&(l=xc(r,a,o,l,i),l===null)?!1:ia(Array.from(r),[""],s,o,()=>hx(t,n,i))}function xc(e,t,n,i,s){for(;n;)n=dx(e,t,n,i,s);return n}function hx(e,t,n){const i=e._getTarget();t in i||(i[t]={});const s=i[t];return ct(s)&&et(n)?n:s||{}}function fx(e,t,n,i){let s;for(const o of t)if(s=wc(ax(o,e),n),typeof s<"u")return sa(e,s)?oa(n,i,e,s):s}function wc(e,t){for(const n of t){if(!n)continue;const i=n[e];if(typeof i<"u")return i}}function kc(e){let t=e._keys;return t||(t=e._keys=mx(e._scopes)),t}function mx(e){const t=new Set;for(const n of e)for(const i of Object.keys(n).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function Tc(e,t,n,i){const{iScale:s}=e,{key:o="r"}=this._parsing,a=new Array(i);let r,l,c,d;for(r=0,l=i;r<l;++r)c=r+n,d=t[c],a[r]={r:s.parse(Re(d,o),c)};return a}const px=Number.EPSILON||1e-14,En=(e,t)=>t<e.length&&!e[t].skip&&e[t],Sc=e=>e==="x"?"y":"x";function gx(e,t,n,i){const s=e.skip?t:e,o=t,a=n.skip?t:n,r=On(o,s),l=On(a,o);let c=r/(r+l),d=l/(r+l);c=isNaN(c)?0:c,d=isNaN(d)?0:d;const h=i*c,f=i*d;return{previous:{x:o.x-h*(a.x-s.x),y:o.y-h*(a.y-s.y)},next:{x:o.x+f*(a.x-s.x),y:o.y+f*(a.y-s.y)}}}function yx(e,t,n){const i=e.length;let s,o,a,r,l,c=En(e,0);for(let d=0;d<i-1;++d)if(l=c,c=En(e,d+1),!(!l||!c)){if(mi(t[d],0,px)){n[d]=n[d+1]=0;continue}s=n[d]/t[d],o=n[d+1]/t[d],r=Math.pow(s,2)+Math.pow(o,2),!(r<=9)&&(a=3/Math.sqrt(r),n[d]=s*a*t[d],n[d+1]=o*a*t[d])}}function bx(e,t,n="x"){const i=Sc(n),s=e.length;let o,a,r,l=En(e,0);for(let c=0;c<s;++c){if(a=r,r=l,l=En(e,c+1),!r)continue;const d=r[n],h=r[i];a&&(o=(d-a[n])/3,r[`cp1${n}`]=d-o,r[`cp1${i}`]=h-o*t[c]),l&&(o=(l[n]-d)/3,r[`cp2${n}`]=d+o,r[`cp2${i}`]=h+o*t[c])}}function _x(e,t="x"){const n=Sc(t),i=e.length,s=Array(i).fill(0),o=Array(i);let a,r,l,c=En(e,0);for(a=0;a<i;++a)if(r=l,l=c,c=En(e,a+1),!!l){if(c){const d=c[t]-l[t];s[a]=d!==0?(c[n]-l[n])/d:0}o[a]=r?c?he(s[a-1])!==he(s[a])?0:(s[a-1]+s[a])/2:s[a-1]:s[a]}yx(e,s,o),bx(e,o,t)}function Ts(e,t,n){return Math.max(Math.min(e,n),t)}function xx(e,t){let n,i,s,o,a,r=ke(e[0],t);for(n=0,i=e.length;n<i;++n)a=o,o=r,r=n<i-1&&ke(e[n+1],t),o&&(s=e[n],a&&(s.cp1x=Ts(s.cp1x,t.left,t.right),s.cp1y=Ts(s.cp1y,t.top,t.bottom)),r&&(s.cp2x=Ts(s.cp2x,t.left,t.right),s.cp2y=Ts(s.cp2y,t.top,t.bottom)))}function wx(e,t,n,i,s){let o,a,r,l;if(t.spanGaps&&(e=e.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")_x(e,s);else{let c=i?e[e.length-1]:e[0];for(o=0,a=e.length;o<a;++o)r=e[o],l=gx(c,r,e[Math.min(o+1,a-(i?0:1))%a],t.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,c=r}t.capBezierPoints&&xx(e,n)}function aa(){return typeof window<"u"&&typeof document<"u"}function ra(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function Ss(e,t,n){let i;return typeof e=="string"?(i=parseInt(e,10),e.indexOf("%")!==-1&&(i=i/100*t.parentNode[n])):i=e,i}const vs=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function kx(e,t){return vs(e).getPropertyValue(t)}const Tx=["top","right","bottom","left"];function nn(e,t,n){const i={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=Tx[s];i[o]=parseFloat(e[t+"-"+o+n])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Sx=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function vx(e,t){const n=e.touches,i=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=i;let a=!1,r,l;if(Sx(s,o,e.target))r=s,l=o;else{const c=t.getBoundingClientRect();r=i.clientX-c.left,l=i.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function Fe(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:i}=t,s=vs(n),o=s.boxSizing==="border-box",a=nn(s,"padding"),r=nn(s,"border","width"),{x:l,y:c,box:d}=vx(e,n),h=a.left+(d&&r.left),f=a.top+(d&&r.top);let{width:m,height:p}=t;return o&&(m-=a.width+r.width,p-=a.height+r.height),{x:Math.round((l-h)/m*n.width/i),y:Math.round((c-f)/p*n.height/i)}}function Mx(e,t,n){let i,s;if(t===void 0||n===void 0){const o=e&&ra(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const a=o.getBoundingClientRect(),r=vs(o),l=nn(r,"border","width"),c=nn(r,"padding");t=a.width-c.width-l.width,n=a.height-c.height-l.height,i=Ss(r.maxWidth,o,"clientWidth"),s=Ss(r.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:i||ps,maxHeight:s||ps}}const ze=e=>Math.round(e*10)/10;function Dx(e,t,n,i){const s=vs(e),o=nn(s,"margin"),a=Ss(s.maxWidth,e,"clientWidth")||ps,r=Ss(s.maxHeight,e,"clientHeight")||ps,l=Mx(e,t,n);let{width:c,height:d}=l;if(s.boxSizing==="content-box"){const f=nn(s,"border","width"),m=nn(s,"padding");c-=m.width+f.width,d-=m.height+f.height}return c=Math.max(0,c-o.width),d=Math.max(0,i?c/i:d-o.height),c=ze(Math.min(c,a,l.maxWidth)),d=ze(Math.min(d,r,l.maxHeight)),c&&!d&&(d=ze(c/2)),(t!==void 0||n!==void 0)&&i&&l.height&&d>l.height&&(d=l.height,c=ze(Math.floor(d*i))),{width:c,height:d}}function vc(e,t,n){const i=t||1,s=ze(e.height*i),o=ze(e.width*i);e.height=ze(e.height),e.width=ze(e.width);const a=e.canvas;return a.style&&(n||!a.style.height&&!a.style.width)&&(a.style.height=`${e.height}px`,a.style.width=`${e.width}px`),e.currentDevicePixelRatio!==i||a.height!==s||a.width!==o?(e.currentDevicePixelRatio=i,a.height=s,a.width=o,e.ctx.setTransform(i,0,0,i,0,0),!0):!1}const Cx=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};aa()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function Mc(e,t){const n=kx(e,t),i=n&&n.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function sn(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function Ox(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:i==="middle"?n<.5?e.y:t.y:i==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function Ax(e,t,n,i){const s={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},a=sn(e,s,n),r=sn(s,o,n),l=sn(o,t,n),c=sn(a,r,n),d=sn(r,l,n);return sn(c,d,n)}const Px=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,i){return n-i},leftForLtr(n,i){return n-i}}},Ex=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Rn(e,t,n){return e?Px(t,n):Ex()}function Dc(e,t){let n,i;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,i=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=i)}function Cc(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function Oc(e){return e==="angle"?{between:pi,compare:R_,normalize:Ut}:{between:xe,compare:(t,n)=>t-n,normalize:t=>t}}function Ac({start:e,end:t,count:n,loop:i,style:s}){return{start:e%n,end:t%n,loop:i&&(t-e+1)%n===0,style:s}}function Rx(e,t,n){const{property:i,start:s,end:o}=n,{between:a,normalize:r}=Oc(i),l=t.length;let{start:c,end:d,loop:h}=e,f,m;if(h){for(c+=l,d+=l,f=0,m=l;f<m&&a(r(t[c%l][i]),s,o);++f)c--,d--;c%=l,d%=l}return d<c&&(d+=l),{start:c,end:d,loop:h,style:e.style}}function Pc(e,t,n){if(!n)return[e];const{property:i,start:s,end:o}=n,a=t.length,{compare:r,between:l,normalize:c}=Oc(i),{start:d,end:h,loop:f,style:m}=Rx(e,t,n),p=[];let g=!1,y=null,_,x,T;const v=()=>l(s,T,_)&&r(s,T)!==0,w=()=>r(o,_)===0||l(o,T,_),D=()=>g||v(),S=()=>!g||w();for(let A=d,R=d;A<=h;++A)x=t[A%a],!x.skip&&(_=c(x[i]),_!==T&&(g=l(_,s,o),y===null&&D()&&(y=r(_,s)===0?A:R),y!==null&&S()&&(p.push(Ac({start:y,end:A,loop:f,count:a,style:m})),y=null),R=A,T=_));return y!==null&&p.push(Ac({start:y,end:h,loop:f,count:a,style:m})),p}function Ec(e,t){const n=[],i=e.segments;for(let s=0;s<i.length;s++){const o=Pc(i[s],e.points,t);o.length&&n.push(...o)}return n}function Ix(e,t,n,i){let s=0,o=t-1;if(n&&!i)for(;s<t&&!e[s].skip;)s++;for(;s<t&&e[s].skip;)s++;for(s%=t,n&&(o+=s);o>s&&e[o%t].skip;)o--;return o%=t,{start:s,end:o}}function Lx(e,t,n,i){const s=e.length,o=[];let a=t,r=e[t],l;for(l=t+1;l<=n;++l){const c=e[l%s];c.skip||c.stop?r.skip||(i=!1,o.push({start:t%s,end:(l-1)%s,loop:i}),t=a=c.stop?l:null):(a=l,r.skip&&(t=l)),r=c}return a!==null&&o.push({start:t%s,end:a%s,loop:i}),o}function Nx(e,t){const n=e.points,i=e.options.spanGaps,s=n.length;if(!s)return[];const o=!!e._loop,{start:a,end:r}=Ix(n,s,o,i);if(i===!0)return Rc(e,[{start:a,end:r,loop:o}],n,t);const l=r<a?r+s:r,c=!!e._fullLoop&&a===0&&r===s-1;return Rc(e,Lx(n,a,l,c),n,t)}function Rc(e,t,n,i){return!i||!i.setContext||!n?t:Bx(e,t,n,i)}function Bx(e,t,n,i){const s=e._chart.getContext(),o=Ic(e.options),{_datasetIndex:a,options:{spanGaps:r}}=e,l=n.length,c=[];let d=o,h=t[0].start,f=h;function m(p,g,y,_){const x=r?-1:1;if(p!==g){for(p+=l;n[p%l].skip;)p-=x;for(;n[g%l].skip;)g+=x;p%l!==g%l&&(c.push({start:p%l,end:g%l,loop:y,style:_}),d=_,h=g%l)}}for(const p of t){h=r?h:p.start;let g=n[h%l],y;for(f=h+1;f<=p.end;f++){const _=n[f%l];y=Ic(i.setContext(Be(s,{type:"segment",p0:g,p1:_,p0DataIndex:(f-1)%l,p1DataIndex:f%l,datasetIndex:a}))),Fx(y,d)&&m(h,f-1,p.loop,d),g=_,d=y}h<f-1&&m(h,f-1,p.loop,d)}return c}function Ic(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function Fx(e,t){if(!t)return!1;const n=[],i=function(s,o){return Zo(o)?(n.includes(o)||n.push(o),n.indexOf(o)):o};return JSON.stringify(e,i)!==JSON.stringify(t,i)}function Ms(e,t,n){return e.options.clip?e[n]:t[n]}function zx(e,t){const{xScale:n,yScale:i}=e;return n&&i?{left:Ms(n,t,"left"),right:Ms(n,t,"right"),top:Ms(i,t,"top"),bottom:Ms(i,t,"bottom")}:t}function Lc(e,t){const n=t._clip;if(n.disabled)return!1;const i=zx(t,e.chartArea);return{left:n.left===!1?0:i.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:i.right+(n.right===!0?0:n.right),top:n.top===!1?0:i.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:i.bottom+(n.bottom===!0?0:n.bottom)}}class Ux{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,i,s){const o=n.listeners[s],a=n.duration;o.forEach(r=>r({chart:t,initial:n.initial,numSteps:a,currentStep:Math.min(i-n.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=ac.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const o=i.items;let a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let i=n.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,i)),i}listen(t,n,i){this._getAnims(t).listeners[n].push(i)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const i=n.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Te=new Ux;const Nc="transparent",Vx={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const i=xs(e||Nc),s=i.valid&&xs(t||Nc);return s&&s.valid?s.mix(i,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class Hx{constructor(t,n,i,s){const o=n[i];s=wi([t.to,s,o,t.from]);const a=wi([t.from,o,s]);this._active=!0,this._fn=t.fn||Vx[t.type||typeof a],this._easing=gi[t.easing]||gi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=i,this._from=a,this._to=s,this._promises=void 0}active(){return this._active}update(t,n,i){if(this._active){this._notify(!1);const s=this._target[this._prop],o=i-this._start,a=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=wi([t.to,n,s,t.from]),this._from=wi([t.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,i=this._duration,s=this._prop,o=this._from,a=this._loop,r=this._to;let l;if(this._active=o!==r&&(a||n<i),!this._active){this._target[s]=r,this._notify(!0);return}if(n<0){this._target[s]=o;return}l=n/i%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,r,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,i)=>{t.push({res:n,rej:i})})}_notify(t){const n=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][n]()}}class la{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!et(t))return;const n=Object.keys(bt.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!et(o))return;const a={};for(const r of n)a[r]=o[r];(ct(o.properties)&&o.properties||[s]).forEach(r=>{(r===s||!i.has(r))&&i.set(r,a)})})}_animateOptions(t,n){const i=n.options,s=Yx(t,i);if(!s)return[];const o=this._createAnimations(s,i);return i.$shared&&$x(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,n){const i=this._properties,s=[],o=t.$animations||(t.$animations={}),a=Object.keys(n),r=Date.now();let l;for(l=a.length-1;l>=0;--l){const c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,n));continue}const d=n[c];let h=o[c];const f=i.get(c);if(h)if(f&&h.active()){h.update(f,d,r);continue}else h.cancel();if(!f||!f.duration){t[c]=d;continue}o[c]=h=new Hx(f,t,c,d),s.push(h)}return s}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const i=this._createAnimations(t,n);if(i.length)return Te.add(this._chart,i),!0}}function $x(e,t){const n=[],i=Object.keys(t);for(let s=0;s<i.length;s++){const o=e[i[s]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function Yx(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function Bc(e,t){const n=e&&e.options||{},i=n.reverse,s=n.min===void 0?t:0,o=n.max===void 0?t:0;return{start:i?o:s,end:i?s:o}}function Wx(e,t,n){if(n===!1)return!1;const i=Bc(e,n),s=Bc(t,n);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function jx(e){let t,n,i,s;return et(e)?(t=e.top,n=e.right,i=e.bottom,s=e.left):t=n=i=s=e,{top:t,right:n,bottom:i,left:s,disabled:e===!1}}function Fc(e,t){const n=[],i=e._getSortedDatasetMetas(t);let s,o;for(s=0,o=i.length;s<o;++s)n.push(i[s].index);return n}function zc(e,t,n,i={}){const s=e.keys,o=i.mode==="single";let a,r,l,c;if(t===null)return;let d=!1;for(a=0,r=s.length;a<r;++a){if(l=+s[a],l===n){if(d=!0,i.all)continue;break}c=e.values[l],_t(c)&&(o||t===0||he(t)===he(c))&&(t+=c)}return!d&&!i.all?0:t}function qx(e,t){const{iScale:n,vScale:i}=t,s=n.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",a=Object.keys(e),r=new Array(a.length);let l,c,d;for(l=0,c=a.length;l<c;++l)d=a[l],r[l]={[s]:d,[o]:e[d]};return r}function ca(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function Gx(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function Xx(e){const{min:t,max:n,minDefined:i,maxDefined:s}=e.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?n:Number.POSITIVE_INFINITY}}function Kx(e,t,n){const i=e[t]||(e[t]={});return i[n]||(i[n]={})}function Uc(e,t,n,i){for(const s of t.getMatchingVisibleMetas(i).reverse()){const o=e[s.index];if(n&&o>0||!n&&o<0)return s.index}return null}function Vc(e,t){const{chart:n,_cachedMeta:i}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:a,index:r}=i,l=o.axis,c=a.axis,d=Gx(o,a,i),h=t.length;let f;for(let m=0;m<h;++m){const p=t[m],{[l]:g,[c]:y}=p,_=p._stacks||(p._stacks={});f=_[c]=Kx(s,d,g),f[r]=y,f._top=Uc(f,a,!0,i.type),f._bottom=Uc(f,a,!1,i.type);const x=f._visualValues||(f._visualValues={});x[r]=y}}function ua(e,t){const n=e.scales;return Object.keys(n).filter(i=>n[i].axis===t).shift()}function Zx(e,t){return Be(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Qx(e,t,n){return Be(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function ki(e,t){const n=e.controller.index,i=e.vScale&&e.vScale.axis;if(i){t=t||e._parsed;for(const s of t){const o=s._stacks;if(!o||o[i]===void 0||o[i][n]===void 0)return;delete o[i][n],o[i]._visualValues!==void 0&&o[i]._visualValues[n]!==void 0&&delete o[i]._visualValues[n]}}}const da=e=>e==="reset"||e==="none",Hc=(e,t)=>t?e:Object.assign({},e),Jx=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Fc(n,!0),values:null};class Ue{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=ca(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&ki(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,i=this.getDataset(),s=(h,f,m,p)=>h==="x"?f:h==="r"?p:m,o=n.xAxisID=Q(i.xAxisID,ua(t,"x")),a=n.yAxisID=Q(i.yAxisID,ua(t,"y")),r=n.rAxisID=Q(i.rAxisID,ua(t,"r")),l=n.indexAxis,c=n.iAxisID=s(l,o,a,r),d=n.vAxisID=s(l,a,o,r);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(a),n.rScale=this.getScaleForId(r),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&sc(this._data,this),t._stacked&&ki(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),i=this._data;if(et(n)){const s=this._cachedMeta;this._data=qx(n,s)}else if(i!==n){if(i){sc(i,this);const s=this._cachedMeta;ki(s),s._parsed=[]}n&&Object.isExtensible(n)&&B_(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=ca(n.vScale,n),n.stack!==i.stack&&(s=!0,ki(n),n.stack=i.stack),this._resyncElements(t),(s||o!==n._stacked)&&(Vc(this,n._parsed),n._stacked=ca(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:a}=i,r=o.axis;let l=t===0&&n===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],d,h,f;if(this._parsing===!1)i._parsed=s,i._sorted=!0,f=s;else{ct(s[t])?f=this.parseArrayData(i,s,t,n):et(s[t])?f=this.parseObjectData(i,s,t,n):f=this.parsePrimitiveData(i,s,t,n);const m=()=>h[r]===null||c&&h[r]<c[r];for(d=0;d<n;++d)i._parsed[d+t]=h=f[d],l&&(m()&&(l=!1),c=h);i._sorted=l}a&&Vc(this,f)}parsePrimitiveData(t,n,i,s){const{iScale:o,vScale:a}=t,r=o.axis,l=a.axis,c=o.getLabels(),d=o===a,h=new Array(s);let f,m,p;for(f=0,m=s;f<m;++f)p=f+i,h[f]={[r]:d||o.parse(c[p],p),[l]:a.parse(n[p],p)};return h}parseArrayData(t,n,i,s){const{xScale:o,yScale:a}=t,r=new Array(s);let l,c,d,h;for(l=0,c=s;l<c;++l)d=l+i,h=n[d],r[l]={x:o.parse(h[0],d),y:a.parse(h[1],d)};return r}parseObjectData(t,n,i,s){const{xScale:o,yScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let d,h,f,m;for(d=0,h=s;d<h;++d)f=d+i,m=n[f],c[d]={x:o.parse(Re(m,r),f),y:a.parse(Re(m,l),f)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,i){const s=this.chart,o=this._cachedMeta,a=n[t.axis],r={keys:Fc(s,!0),values:n._stacks[t.axis]._visualValues};return zc(r,a,o.index,{mode:i})}updateRangeFromParsed(t,n,i,s){const o=i[n.axis];let a=o===null?NaN:o;const r=s&&i._stacks[n.axis];s&&r&&(s.values=r,a=zc(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,n){const i=this._cachedMeta,s=i._parsed,o=i._sorted&&t===i.iScale,a=s.length,r=this._getOtherScale(t),l=Jx(n,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:d,max:h}=Xx(r);let f,m;function p(){m=s[f];const g=m[r.axis];return!_t(m[t.axis])||d>g||h<g}for(f=0;f<a&&!(!p()&&(this.updateRangeFromParsed(c,t,m,l),o));++f);if(o){for(f=a-1;f>=0;--f)if(!p()){this.updateRangeFromParsed(c,t,m,l);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,i=[];let s,o,a;for(s=0,o=n.length;s<o;++s)a=n[s][t.axis],_t(a)&&i.push(a);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,i=n.iScale,s=n.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=jx(Q(this.options.clip,Wx(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,i=this._cachedMeta,s=i.data||[],o=n.chartArea,a=[],r=this._drawStart||0,l=this._drawCount||s.length-r,c=this.options.drawActiveElementsOnTop;let d;for(i.dataset&&i.dataset.draw(t,o,r,l),d=r;d<r+l;++d){const h=s[d];h.hidden||(h.active&&c?a.push(h):h.draw(t,o))}for(d=0;d<a.length;++d)a[d].draw(t,o)}getStyle(t,n){const i=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,n,i){const s=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const a=this._cachedMeta.data[t];o=a.$context||(a.$context=Qx(this.getContext(),t,a)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=Zx(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",i){const s=n==="active",o=this._cachedDataOpts,a=t+"-"+n,r=o[a],l=this.enableOptionSharing&&Xt(i);if(r)return Hc(r,l);const c=this.chart.config,d=c.datasetElementScopeKeys(this._type,t),h=s?[`${t}Hover`,"hover",t,""]:[t,""],f=c.getOptionScopes(this.getDataset(),d),m=Object.keys(bt.elements[t]),p=()=>this.getContext(i,s,n),g=c.resolveNamedOptions(f,m,p,h);return g.$shared&&(g.$shared=l,o[a]=Object.freeze(Hc(g,l))),g}_resolveAnimations(t,n,i){const s=this.chart,o=this._cachedDataOpts,a=`animation-${n}`,r=o[a];if(r)return r;let l;if(s.options.animation!==!1){const d=this.chart.config,h=d.datasetAnimationScopeKeys(this._type,n),f=d.getOptionScopes(this.getDataset(),h);l=d.createResolver(f,this.getContext(t,i,n))}const c=new la(s,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||da(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const i=this.resolveDataElementOptions(t,n),s=this._sharedOptions,o=this.getSharedOptions(i),a=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,i),{sharedOptions:o,includeOptions:a}}updateElement(t,n,i,s){da(s)?Object.assign(t,i):this._resolveAnimations(n,s).update(t,i)}updateSharedOptions(t,n,i){t&&!da(n)&&this._resolveAnimations(void 0,n).update(t,i)}_setStyle(t,n,i,s){t.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,n,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,i=this._cachedMeta.data;for(const[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];const s=i.length,o=n.length,a=Math.min(o,s);a&&this.parse(0,a),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,n,i=!0){const s=this._cachedMeta,o=s.data,a=t+n;let r;const l=c=>{for(c.length+=n,r=c.length-1;r>=a;r--)c[r]=c[r-n]};for(l(o),r=t;r<a;++r)o[r]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,n),i&&this.updateElements(o,t,n,"reset")}updateElements(t,n,i,s){}_removeElements(t,n){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,n);i._stacked&&ki(i,s)}i.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,i,s]=t;this[n](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function tw(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let i=[];for(let s=0,o=n.length;s<o;s++)i=i.concat(n[s].controller.getAllParsedValues(e));e._cache.$bar=oc(i.sort((s,o)=>s-o))}return e._cache.$bar}function ew(e){const t=e.iScale,n=tw(t,e.type);let i=t._length,s,o,a,r;const l=()=>{a===32767||a===-32768||(Xt(r)&&(i=Math.min(i,Math.abs(a-r)||i)),r=a)};for(s=0,o=n.length;s<o;++s)a=t.getPixelForValue(n[s]),l();for(r=void 0,s=0,o=t.ticks.length;s<o;++s)a=t.getPixelForTick(s),l();return i}function nw(e,t,n,i){const s=n.barThickness;let o,a;return Z(s)?(o=t.min*n.categoryPercentage,a=n.barPercentage):(o=s*i,a=1),{chunk:o/i,ratio:a,start:t.pixels[e]-o/2}}function iw(e,t,n,i){const s=t.pixels,o=s[e];let a=e>0?s[e-1]:null,r=e<s.length-1?s[e+1]:null;const l=n.categoryPercentage;a===null&&(a=o-(r===null?t.end-t.start:r-o)),r===null&&(r=o+o-a);const c=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/i,ratio:n.barPercentage,start:c}}function sw(e,t,n,i){const s=n.parse(e[0],i),o=n.parse(e[1],i),a=Math.min(s,o),r=Math.max(s,o);let l=a,c=r;Math.abs(a)>Math.abs(r)&&(l=r,c=a),t[n.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:a,max:r}}function $c(e,t,n,i){return ct(e)?sw(e,t,n,i):t[n.axis]=n.parse(e,i),t}function Yc(e,t,n,i){const s=e.iScale,o=e.vScale,a=s.getLabels(),r=s===o,l=[];let c,d,h,f;for(c=n,d=n+i;c<d;++c)f=t[c],h={},h[s.axis]=r||s.parse(a[c],c),l.push($c(f,h,o,c));return l}function ha(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function ow(e,t,n){return e!==0?he(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}function aw(e){let t,n,i,s,o;return e.horizontal?(t=e.base>e.x,n="left",i="right"):(t=e.base<e.y,n="bottom",i="top"),t?(s="end",o="start"):(s="start",o="end"),{start:n,end:i,reverse:t,top:s,bottom:o}}function rw(e,t,n,i){let s=t.borderSkipped;const o={};if(!s){e.borderSkipped=o;return}if(s===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:a,end:r,reverse:l,top:c,bottom:d}=aw(e);s==="middle"&&n&&(e.enableBorderRadius=!0,(n._top||0)===i?s=c:(n._bottom||0)===i?s=d:(o[Wc(d,a,r,l)]=!0,s=c)),o[Wc(s,a,r,l)]=!0,e.borderSkipped=o}function Wc(e,t,n,i){return i?(e=lw(e,t,n),e=jc(e,n,t)):e=jc(e,t,n),e}function lw(e,t,n){return e===t?n:e===n?t:e}function jc(e,t,n){return e==="start"?t:e==="end"?n:e}function cw(e,{inflateAmount:t},n){e.inflateAmount=t==="auto"?n===1?.33:0:t}class qc extends Ue{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,n,i,s){return Yc(t,n,i,s)}parseArrayData(t,n,i,s){return Yc(t,n,i,s)}parseObjectData(t,n,i,s){const{iScale:o,vScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?r:l,d=a.axis==="x"?r:l,h=[];let f,m,p,g;for(f=i,m=i+s;f<m;++f)g=n[f],p={},p[o.axis]=o.parse(Re(g,c),f),h.push($c(Re(g,d),p,a,f));return h}updateRangeFromParsed(t,n,i,s){super.updateRangeFromParsed(t,n,i,s);const o=i._custom;o&&n===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const n=this._cachedMeta,{iScale:i,vScale:s}=n,o=this.getParsed(t),a=o._custom,r=ha(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,t)}updateElements(t,n,i,s){const o=s==="reset",{index:a,_cachedMeta:{vScale:r}}=this,l=r.getBasePixel(),c=r.isHorizontal(),d=this._getRuler(),{sharedOptions:h,includeOptions:f}=this._getSharedOptions(n,s);for(let m=n;m<n+i;m++){const p=this.getParsed(m),g=o||Z(p[r.axis])?{base:l,head:l}:this._calculateBarValuePixels(m),y=this._calculateBarIndexPixels(m,d),_=(p._stacks||{})[r.axis],x={horizontal:c,base:g.base,enableBorderRadius:!_||ha(p._custom)||a===_._top||a===_._bottom,x:c?g.head:y.center,y:c?y.center:g.head,height:c?y.size:Math.abs(g.size),width:c?Math.abs(g.size):y.size};f&&(x.options=h||this.resolveDataElementOptions(m,t[m].active?"active":s));const T=x.options||t[m].options;rw(x,T,_,a),cw(x,T,d.ratio),this.updateElement(t[m],m,x,s)}}_getStacks(t,n){const{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(d=>d.controller.options.grouped),o=i.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(n),l=r&&r[i.axis],c=d=>{const h=d._parsed.find(m=>m[i.axis]===l),f=h&&h[d.vScale.axis];if(Z(f)||isNaN(f))return!0};for(const d of s)if(!(n!==void 0&&c(d))&&((o===!1||a.indexOf(d.stack)===-1||o===void 0&&d.stack===void 0)&&a.push(d.stack),d.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===n).shift()}_getAxis(){const t={},n=this.getFirstScaleIdForIndexAxis();for(const i of this.chart.data.datasets)t[Q(this.chart.options.indexAxis==="x"?i.xAxisID:i.yAxisID,n)]=!0;return Object.keys(t)}_getStackIndex(t,n,i){const s=this._getStacks(t,i),o=n!==void 0?s.indexOf(n):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,n=this._cachedMeta,i=n.iScale,s=[];let o,a;for(o=0,a=n.data.length;o<a;++o)s.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));const r=t.barThickness;return{min:r||ew(n),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:n,_stacked:i,index:s},options:{base:o,minBarLength:a}}=this,r=o||0,l=this.getParsed(t),c=l._custom,d=ha(c);let h=l[n.axis],f=0,m=i?this.applyStack(n,l,i):h,p,g;m!==h&&(f=m-h,m=h),d&&(h=c.barStart,m=c.barEnd-c.barStart,h!==0&&he(h)!==he(c.barEnd)&&(f=0),f+=h);const y=!Z(o)&&!d?o:f;let _=n.getPixelForValue(y);if(this.chart.getDataVisibility(t)?p=n.getPixelForValue(f+m):p=_,g=p-_,Math.abs(g)<a){g=ow(g,n,r)*a,h===r&&(_-=g/2);const x=n.getPixelForDecimal(0),T=n.getPixelForDecimal(1),v=Math.min(x,T),w=Math.max(x,T);_=Math.max(Math.min(_,w),v),p=_+g,i&&!d&&(l._stacks[n.axis]._visualValues[s]=n.getValueForPixel(p)-n.getValueForPixel(_))}if(_===n.getPixelForValue(r)){const x=he(g)*n.getLineWidthForValue(r)/2;_+=x,g-=x}return{size:g,base:_,head:p,center:p+g/2}}_calculateBarIndexPixels(t,n){const i=n.scale,s=this.options,o=s.skipNull,a=Q(s.maxBarThickness,1/0);let r,l;const c=this._getAxisCount();if(n.grouped){const d=o?this._getStackCount(t):n.stackCount,h=s.barThickness==="flex"?iw(t,n,s,d*c):nw(t,n,s,d*c),f=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,m=this._getAxis().indexOf(Q(f,this.getFirstScaleIdForIndexAxis())),p=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+m;r=h.start+h.chunk*p+h.chunk/2,l=Math.min(a,h.chunk*h.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),l=Math.min(a,n.min*n.ratio);return{base:r-l/2,head:r+l/2,center:r,size:l}}draw(){const t=this._cachedMeta,n=t.vScale,i=t.data,s=i.length;let o=0;for(;o<s;++o)this.getParsed(o)[n.axis]!==null&&!i[o].hidden&&i[o].draw(this._ctx)}}class uw extends Ue{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,n,i,s){const o=super.parsePrimitiveData(t,n,i,s);for(let a=0;a<o.length;a++)o[a]._custom=this.resolveDataElementOptions(a+i).radius;return o}parseArrayData(t,n,i,s){const o=super.parseArrayData(t,n,i,s);for(let a=0;a<o.length;a++){const r=n[i+a];o[a]._custom=Q(r[2],this.resolveDataElementOptions(a+i).radius)}return o}parseObjectData(t,n,i,s){const o=super.parseObjectData(t,n,i,s);for(let a=0;a<o.length;a++){const r=n[i+a];o[a]._custom=Q(r&&r.r&&+r.r,this.resolveDataElementOptions(a+i).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let n=0;for(let i=t.length-1;i>=0;--i)n=Math.max(n,t[i].size(this.resolveDataElementOptions(i))/2);return n>0&&n}getLabelAndValue(t){const n=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:o}=n,a=this.getParsed(t),r=s.getLabelForValue(a.x),l=o.getLabelForValue(a.y),c=a._custom;return{label:i[t]||"",value:"("+r+", "+l+(c?", "+c:"")+")"}}update(t){const n=this._cachedMeta.data;this.updateElements(n,0,n.length,t)}updateElements(t,n,i,s){const o=s==="reset",{iScale:a,vScale:r}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(n,s),d=a.axis,h=r.axis;for(let f=n;f<n+i;f++){const m=t[f],p=!o&&this.getParsed(f),g={},y=g[d]=o?a.getPixelForDecimal(.5):a.getPixelForValue(p[d]),_=g[h]=o?r.getBasePixel():r.getPixelForValue(p[h]);g.skip=isNaN(y)||isNaN(_),c&&(g.options=l||this.resolveDataElementOptions(f,m.active?"active":s),o&&(g.options.radius=0)),this.updateElement(m,f,g,s)}}resolveDataElementOptions(t,n){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,n);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const o=s.radius;return n!=="active"&&(s.radius=0),s.radius+=Q(i&&i._custom,o),s}}function dw(e,t,n){let i=1,s=1,o=0,a=0;if(t<gt){const r=e,l=r+t,c=Math.cos(r),d=Math.sin(r),h=Math.cos(l),f=Math.sin(l),m=(T,v,w)=>pi(T,r,l,!0)?1:Math.max(v,v*n,w,w*n),p=(T,v,w)=>pi(T,r,l,!0)?-1:Math.min(v,v*n,w,w*n),g=m(0,c,h),y=m(yt,d,f),_=p(tt,c,h),x=p(tt+yt,d,f);i=(g-_)/2,s=(y-x)/2,o=-(g+_)/2,a=-(y+x)/2}return{ratioX:i,ratioY:s,offsetX:o,offsetY:a}}class Ti extends Ue{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data,{labels:{pointStyle:i,textAlign:s,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((l,c)=>{const h=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:h.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:h.borderDash,lineDashOffset:h.borderDashOffset,lineJoin:h.borderJoinStyle,lineWidth:h.borderWidth,strokeStyle:h.borderColor,textAlign:s,pointStyle:i,borderRadius:a&&(r||h.borderRadius),index:c}}):[]}},onClick(t,n,i){i.chart.toggleDataVisibility(n.index),i.chart.update()}}}};constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let o=l=>+i[l];if(et(i[t])){const{key:l="value"}=this._parsing;o=c=>+Re(i[c],l)}let a,r;for(a=t,r=t+n;a<r;++a)s._parsed[a]=o(a)}}_getRotation(){return At(this.options.rotation-90)}_getCircumference(){return At(this.options.circumference)}_getRotationExtents(){let t=gt,n=-gt;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const s=this.chart.getDatasetMeta(i).controller,o=s._getRotation(),a=s._getCircumference();t=Math.min(t,o),n=Math.max(n,o+a)}return{rotation:t,circumference:n-t}}update(t){const n=this.chart,{chartArea:i}=n,s=this._cachedMeta,o=s.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(i.width,i.height)-a)/2,0),l=Math.min(T_(this.options.cutout,r),1),c=this._getRingWeight(this.index),{circumference:d,rotation:h}=this._getRotationExtents(),{ratioX:f,ratioY:m,offsetX:p,offsetY:g}=dw(h,d,l),y=(i.width-a)/f,_=(i.height-a)/m,x=Math.max(Math.min(y,_)/2,0),T=Kl(this.options.radius,x),v=Math.max(T*l,0),w=(T-v)/this._getVisibleDatasetWeightTotal();this.offsetX=p*T,this.offsetY=g*T,s.total=this.calculateTotal(),this.outerRadius=T-w*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-w*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,n){const i=this.options,s=this._cachedMeta,o=this._getCircumference();return n&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/gt)}updateElements(t,n,i,s){const o=s==="reset",a=this.chart,r=a.chartArea,c=a.options.animation,d=(r.left+r.right)/2,h=(r.top+r.bottom)/2,f=o&&c.animateScale,m=f?0:this.innerRadius,p=f?0:this.outerRadius,{sharedOptions:g,includeOptions:y}=this._getSharedOptions(n,s);let _=this._getRotation(),x;for(x=0;x<n;++x)_+=this._circumference(x,o);for(x=n;x<n+i;++x){const T=this._circumference(x,o),v=t[x],w={x:d+this.offsetX,y:h+this.offsetY,startAngle:_,endAngle:_+T,circumference:T,outerRadius:p,innerRadius:m};y&&(w.options=g||this.resolveDataElementOptions(x,v.active?"active":s)),_+=T,this.updateElement(v,x,w,s)}}calculateTotal(){const t=this._cachedMeta,n=t.data;let i=0,s;for(s=0;s<n.length;s++){const o=t._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!n[s].hidden&&(i+=Math.abs(o))}return i}calculateCircumference(t){const n=this._cachedMeta.total;return n>0&&!isNaN(t)?gt*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=yi(n._parsed[t],i.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let n=0;const i=this.chart;let s,o,a,r,l;if(!t){for(s=0,o=i.data.datasets.length;s<o;++s)if(i.isDatasetVisible(s)){a=i.getDatasetMeta(s),t=a.data,r=a.controller;break}}if(!t)return 0;for(s=0,o=t.length;s<o;++s)l=r.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(n=Math.max(n,l.borderWidth||0,l.hoverBorderWidth||0));return n}getMaxOffset(t){let n=0;for(let i=0,s=t.length;i<s;++i){const o=this.resolveDataElementOptions(i);n=Math.max(n,o.offset||0,o.hoverOffset||0)}return n}_getRingWeightOffset(t){let n=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(n+=this._getRingWeight(i));return n}_getRingWeight(t){return Math.max(Q(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class Gc extends Ue{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=n,a=this.chart._animationsDisabled;let{start:r,count:l}=lc(n,s,a);this._drawStart=r,this._drawCount=l,cc(n)&&(r=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!a,options:c},t),this.updateElements(s,r,l,t)}updateElements(t,n,i,s){const o=s==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:d,includeOptions:h}=this._getSharedOptions(n,s),f=a.axis,m=r.axis,{spanGaps:p,segment:g}=this.options,y=Le(p)?p:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||s==="none",x=n+i,T=t.length;let v=n>0&&this.getParsed(n-1);for(let w=0;w<T;++w){const D=t[w],S=_?D:{};if(w<n||w>=x){S.skip=!0;continue}const A=this.getParsed(w),R=Z(A[m]),E=S[f]=a.getPixelForValue(A[f],w),k=S[m]=o||R?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,A,l):A[m],w);S.skip=isNaN(E)||isNaN(k)||R,S.stop=w>0&&Math.abs(A[f]-v[f])>y,g&&(S.parsed=A,S.raw=c.data[w]),h&&(S.options=d||this.resolveDataElementOptions(w,D.active?"active":s)),_||this.updateElement(D,w,S,s),v=A}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,i=n.options&&n.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const o=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}class Xc extends Ue{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return n.labels.map((o,a)=>{const l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,n,i){i.chart.toggleDataVisibility(n.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,n){super(t,n),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const n=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=yi(n._parsed[t].r,i.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,n,i,s){return Tc.bind(this)(t,n,i,s)}update(t){const n=this._cachedMeta.data;this._updateRadius(),this.updateElements(n,0,n.length,t)}getMinMax(){const t=this._cachedMeta,n={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(o<n.min&&(n.min=o),o>n.max&&(n.max=o))}),n}_updateRadius(){const t=this.chart,n=t.chartArea,i=t.options,s=Math.min(n.right-n.left,n.bottom-n.top),o=Math.max(s/2,0),a=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),r=(o-a)/t.getVisibleDatasetCount();this.outerRadius=o-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,n,i,s){const o=s==="reset",a=this.chart,l=a.options.animation,c=this._cachedMeta.rScale,d=c.xCenter,h=c.yCenter,f=c.getIndexAngle(0)-.5*tt;let m=f,p;const g=360/this.countVisibleElements();for(p=0;p<n;++p)m+=this._computeAngle(p,s,g);for(p=n;p<n+i;p++){const y=t[p];let _=m,x=m+this._computeAngle(p,s,g),T=a.getDataVisibility(p)?c.getDistanceFromCenterForValue(this.getParsed(p).r):0;m=x,o&&(l.animateScale&&(T=0),l.animateRotate&&(_=x=f));const v={x:d,y:h,innerRadius:0,outerRadius:T,startAngle:_,endAngle:x,options:this.resolveDataElementOptions(p,y.active?"active":s)};this.updateElement(y,p,v,s)}}countVisibleElements(){const t=this._cachedMeta;let n=0;return t.data.forEach((i,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&n++}),n}_computeAngle(t,n,i){return this.chart.getDataVisibility(t)?At(this.resolveDataElementOptions(t,n).angle||i):0}}class hw extends Ti{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}class fw extends Ue{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const n=this._cachedMeta.vScale,i=this.getParsed(t);return{label:n.getLabels()[t],value:""+n.getLabelForValue(i[n.axis])}}parseObjectData(t,n,i,s){return Tc.bind(this)(t,n,i,s)}update(t){const n=this._cachedMeta,i=n.dataset,s=n.data||[],o=n.iScale.getLabels();if(i.points=s,t!=="resize"){const a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);const r={_loop:!0,_fullLoop:o.length===s.length,options:a};this.updateElement(i,void 0,r,t)}this.updateElements(s,0,s.length,t)}updateElements(t,n,i,s){const o=this._cachedMeta.rScale,a=s==="reset";for(let r=n;r<n+i;r++){const l=t[r],c=this.resolveDataElementOptions(r,l.active?"active":s),d=o.getPointPositionForValue(r,this.getParsed(r).r),h=a?o.xCenter:d.x,f=a?o.yCenter:d.y,m={x:h,y:f,angle:d.angle,skip:isNaN(h)||isNaN(f),options:c};this.updateElement(l,r,m,s)}}}class Kc extends Ue{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const n=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:o}=n,a=this.getParsed(t),r=s.getLabelForValue(a.x),l=o.getLabelForValue(a.y);return{label:i[t]||"",value:"("+r+", "+l+")"}}update(t){const n=this._cachedMeta,{data:i=[]}=n,s=this.chart._animationsDisabled;let{start:o,count:a}=lc(n,i,s);if(this._drawStart=o,this._drawCount=a,cc(n)&&(o=0,a=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:r,_dataset:l}=n;r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!l._decimated,r.points=i;const c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(r,void 0,{animated:!s,options:c},t)}else this.datasetElementType&&(delete n.dataset,this.datasetElementType=!1);this.updateElements(i,o,a,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,n,i,s){const o=s==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,d=this.resolveDataElementOptions(n,s),h=this.getSharedOptions(d),f=this.includeOptions(s,h),m=a.axis,p=r.axis,{spanGaps:g,segment:y}=this.options,_=Le(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||s==="none";let T=n>0&&this.getParsed(n-1);for(let v=n;v<n+i;++v){const w=t[v],D=this.getParsed(v),S=x?w:{},A=Z(D[p]),R=S[m]=a.getPixelForValue(D[m],v),E=S[p]=o||A?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,D,l):D[p],v);S.skip=isNaN(R)||isNaN(E)||A,S.stop=v>0&&Math.abs(D[m]-T[m])>_,y&&(S.parsed=D,S.raw=c.data[v]),f&&(S.options=h||this.resolveDataElementOptions(v,w.active?"active":s)),x||this.updateElement(w,v,S,s),T=D}this.updateSharedOptions(h,s,d)}getMaxOverflow(){const t=this._cachedMeta,n=t.data||[];if(!this.options.showLine){let r=0;for(let l=n.length-1;l>=0;--l)r=Math.max(r,n[l].size(this.resolveDataElementOptions(l))/2);return r>0&&r}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!n.length)return s;const o=n[0].size(this.resolveDataElementOptions(0)),a=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(s,o,a)/2}}var mw=Object.freeze({__proto__:null,BarController:qc,BubbleController:uw,DoughnutController:Ti,LineController:Gc,PieController:hw,PolarAreaController:Xc,RadarController:fw,ScatterController:Kc});function on(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class fa{static override(t){Object.assign(fa.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return on()}parse(){return on()}format(){return on()}add(){return on()}diff(){return on()}startOf(){return on()}endOf(){return on()}}var Zc={_date:fa};function pw(e,t,n,i){const{controller:s,data:o,_sorted:a}=e,r=s._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(r&&t===r.axis&&t!=="r"&&a&&o.length){const c=r._reversePixels?L_:we;if(i){if(s._sharedOptions){const d=o[0],h=typeof d.getRange=="function"&&d.getRange(t);if(h){const f=c(o,t,n-h),m=c(o,t,n+h);return{lo:f.lo,hi:m.hi}}}}else{const d=c(o,t,n);if(l){const{vScale:h}=s._cachedMeta,{_parsed:f}=e,m=f.slice(0,d.lo+1).reverse().findIndex(g=>!Z(g[h.axis]));d.lo-=Math.max(0,m);const p=f.slice(d.hi).findIndex(g=>!Z(g[h.axis]));d.hi+=Math.max(0,p)}return d}}return{lo:0,hi:o.length-1}}function Si(e,t,n,i,s){const o=e.getSortedVisibleDatasetMetas(),a=n[t];for(let r=0,l=o.length;r<l;++r){const{index:c,data:d}=o[r],{lo:h,hi:f}=pw(o[r],t,a,s);for(let m=h;m<=f;++m){const p=d[m];p.skip||i(p,c,m)}}}function gw(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(i,s){const o=t?Math.abs(i.x-s.x):0,a=n?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function ma(e,t,n,i,s){const o=[];return!s&&!e.isPointInArea(t)||Si(e,n,t,function(r,l,c){!s&&!ke(r,e.chartArea,0)||r.inRange(t.x,t.y,i)&&o.push({element:r,datasetIndex:l,index:c})},!0),o}function yw(e,t,n,i){let s=[];function o(a,r,l){const{startAngle:c,endAngle:d}=a.getProps(["startAngle","endAngle"],i),{angle:h}=bs(a,{x:t.x,y:t.y});pi(h,c,d)&&s.push({element:a,datasetIndex:r,index:l})}return Si(e,n,t,o),s}function bw(e,t,n,i,s,o){let a=[];const r=gw(n);let l=Number.POSITIVE_INFINITY;function c(d,h,f){const m=d.inRange(t.x,t.y,s);if(i&&!m)return;const p=d.getCenterPoint(s);if(!(!!o||e.isPointInArea(p))&&!m)return;const y=r(t,p);y<l?(a=[{element:d,datasetIndex:h,index:f}],l=y):y===l&&a.push({element:d,datasetIndex:h,index:f})}return Si(e,n,t,c),a}function pa(e,t,n,i,s,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!i?yw(e,t,n,s):bw(e,t,n,i,s,o)}function Qc(e,t,n,i,s){const o=[],a=n==="x"?"inXRange":"inYRange";let r=!1;return Si(e,n,t,(l,c,d)=>{l[a]&&l[a](t[n],s)&&(o.push({element:l,datasetIndex:c,index:d}),r=r||l.inRange(t.x,t.y,s))}),i&&!r?[]:o}var ga={evaluateInteractionItems:Si,modes:{index(e,t,n,i){const s=Fe(t,e),o=n.axis||"x",a=n.includeInvisible||!1,r=n.intersect?ma(e,s,o,i,a):pa(e,s,o,!1,i,a),l=[];return r.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const d=r[0].index,h=c.data[d];h&&!h.skip&&l.push({element:h,datasetIndex:c.index,index:d})}),l):[]},dataset(e,t,n,i){const s=Fe(t,e),o=n.axis||"xy",a=n.includeInvisible||!1;let r=n.intersect?ma(e,s,o,i,a):pa(e,s,o,!1,i,a);if(r.length>0){const l=r[0].datasetIndex,c=e.getDatasetMeta(l).data;r=[];for(let d=0;d<c.length;++d)r.push({element:c[d],datasetIndex:l,index:d})}return r},point(e,t,n,i){const s=Fe(t,e),o=n.axis||"xy",a=n.includeInvisible||!1;return ma(e,s,o,i,a)},nearest(e,t,n,i){const s=Fe(t,e),o=n.axis||"xy",a=n.includeInvisible||!1;return pa(e,s,o,n.intersect,i,a)},x(e,t,n,i){const s=Fe(t,e);return Qc(e,s,"x",n.intersect,i)},y(e,t,n,i){const s=Fe(t,e);return Qc(e,s,"y",n.intersect,i)}}};const Jc=["left","top","right","bottom"];function vi(e,t){return e.filter(n=>n.pos===t)}function tu(e,t){return e.filter(n=>Jc.indexOf(n.pos)===-1&&n.box.axis===t)}function Mi(e,t){return e.sort((n,i)=>{const s=t?i:n,o=t?n:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function _w(e){const t=[];let n,i,s,o,a,r;for(n=0,i=(e||[]).length;n<i;++n)s=e[n],{position:o,options:{stack:a,stackWeight:r=1}}=s,t.push({index:n,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:a&&o+a,stackWeight:r});return t}function xw(e){const t={};for(const n of e){const{stack:i,pos:s,stackWeight:o}=n;if(!i||!Jc.includes(s))continue;const a=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return t}function ww(e,t){const n=xw(e),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t;let o,a,r;for(o=0,a=e.length;o<a;++o){r=e[o];const{fullSize:l}=r.box,c=n[r.stack],d=c&&r.stackWeight/c.weight;r.horizontal?(r.width=d?d*i:l&&t.availableWidth,r.height=s):(r.width=i,r.height=d?d*s:l&&t.availableHeight)}return n}function kw(e){const t=_w(e),n=Mi(t.filter(c=>c.box.fullSize),!0),i=Mi(vi(t,"left"),!0),s=Mi(vi(t,"right")),o=Mi(vi(t,"top"),!0),a=Mi(vi(t,"bottom")),r=tu(t,"x"),l=tu(t,"y");return{fullSize:n,leftAndTop:i.concat(o),rightAndBottom:s.concat(l).concat(a).concat(r),chartArea:vi(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:o.concat(a).concat(r)}}function eu(e,t,n,i){return Math.max(e[n],t[n])+Math.max(e[i],t[i])}function nu(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function Tw(e,t,n,i){const{pos:s,box:o}=n,a=e.maxPadding;if(!et(s)){n.size&&(e[s]-=n.size);const h=i[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?o.height:o.width),n.size=h.size/h.count,e[s]+=n.size}o.getPadding&&nu(a,o.getPadding());const r=Math.max(0,t.outerWidth-eu(a,e,"left","right")),l=Math.max(0,t.outerHeight-eu(a,e,"top","bottom")),c=r!==e.w,d=l!==e.h;return e.w=r,e.h=l,n.horizontal?{same:c,other:d}:{same:d,other:c}}function Sw(e){const t=e.maxPadding;function n(i){const s=Math.max(t[i]-e[i],0);return e[i]+=s,s}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function vw(e,t){const n=t.maxPadding;function i(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(a=>{o[a]=Math.max(t[a],n[a])}),o}return i(e?["left","right"]:["top","bottom"])}function Di(e,t,n,i){const s=[];let o,a,r,l,c,d;for(o=0,a=e.length,c=0;o<a;++o){r=e[o],l=r.box,l.update(r.width||t.w,r.height||t.h,vw(r.horizontal,t));const{same:h,other:f}=Tw(t,n,r,i);c|=h&&s.length,d=d||f,l.fullSize||s.push(r)}return c&&Di(s,t,n,i)||d}function Ds(e,t,n,i,s){e.top=n,e.left=t,e.right=t+i,e.bottom=n+s,e.width=i,e.height=s}function iu(e,t,n,i){const s=n.padding;let{x:o,y:a}=t;for(const r of e){const l=r.box,c=i[r.stack]||{placed:0,weight:1},d=r.stackWeight/c.weight||1;if(r.horizontal){const h=t.w*d,f=c.size||l.height;Xt(c.start)&&(a=c.start),l.fullSize?Ds(l,s.left,a,n.outerWidth-s.right-s.left,f):Ds(l,t.left+c.placed,a,h,f),c.start=a,c.placed+=h,a=l.bottom}else{const h=t.h*d,f=c.size||l.width;Xt(c.start)&&(o=c.start),l.fullSize?Ds(l,o,s.top,f,n.outerHeight-s.bottom-s.top):Ds(l,o,t.top+c.placed,f,h),c.start=o,c.placed+=h,o=l.right}}t.x=o,t.y=a}var Ht={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,i){if(!e)return;const s=Pt(e.options.layout.padding),o=Math.max(t-s.width,0),a=Math.max(n-s.height,0),r=kw(e.boxes),l=r.vertical,c=r.horizontal;mt(e.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const d=l.reduce((g,y)=>y.box.options&&y.box.options.display===!1?g:g+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/d,hBoxMaxHeight:a/2}),f=Object.assign({},s);nu(f,Pt(i));const m=Object.assign({maxPadding:f,w:o,h:a,x:s.left,y:s.top},s),p=ww(l.concat(c),h);Di(r.fullSize,m,h,p),Di(l,m,h,p),Di(c,m,h,p)&&Di(l,m,h,p),Sw(m),iu(r.leftAndTop,m,h,p),m.x+=m.w,m.y+=m.h,iu(r.rightAndBottom,m,h,p),e.chartArea={left:m.left,top:m.top,right:m.left+m.w,bottom:m.top+m.h,height:m.h,width:m.w},mt(r.chartArea,g=>{const y=g.box;Object.assign(y,e.chartArea),y.update(m.w,m.h,{left:0,top:0,right:0,bottom:0})})}};class su{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,i){}removeEventListener(t,n,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,i,s){return n=Math.max(0,n||t.width),i=i||t.height,{width:n,height:Math.max(0,s?Math.floor(n/s):i)}}isAttached(t){return!0}updateConfig(t){}}class Mw extends su{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Cs="$chartjs",Dw={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ou=e=>e===null||e==="";function Cw(e,t){const n=e.style,i=e.getAttribute("height"),s=e.getAttribute("width");if(e[Cs]={initial:{height:i,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",ou(s)){const o=Mc(e,"width");o!==void 0&&(e.width=o)}if(ou(i))if(e.style.height==="")e.height=e.width/(t||2);else{const o=Mc(e,"height");o!==void 0&&(e.height=o)}return e}const au=Cx?{passive:!0}:!1;function Ow(e,t,n){e&&e.addEventListener(t,n,au)}function Aw(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,au)}function Pw(e,t){const n=Dw[e.type]||e.type,{x:i,y:s}=Fe(e,t);return{type:n,chart:t,native:e,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Os(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function Ew(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||Os(r.addedNodes,i),a=a&&!Os(r.removedNodes,i);a&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function Rw(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||Os(r.removedNodes,i),a=a&&!Os(r.addedNodes,i);a&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const Ci=new Map;let ru=0;function lu(){const e=window.devicePixelRatio;e!==ru&&(ru=e,Ci.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function Iw(e,t){Ci.size||window.addEventListener("resize",lu),Ci.set(e,t)}function Lw(e){Ci.delete(e),Ci.size||window.removeEventListener("resize",lu)}function Nw(e,t,n){const i=e.canvas,s=i&&ra(i);if(!s)return;const o=rc((r,l)=>{const c=s.clientWidth;n(r,l),c<s.clientWidth&&n()},window),a=new ResizeObserver(r=>{const l=r[0],c=l.contentRect.width,d=l.contentRect.height;c===0&&d===0||o(c,d)});return a.observe(s),Iw(e,o),a}function ya(e,t,n){n&&n.disconnect(),t==="resize"&&Lw(e)}function Bw(e,t,n){const i=e.canvas,s=rc(o=>{e.ctx!==null&&n(Pw(o,e))},e);return Ow(i,t,s),s}class Fw extends su{acquireContext(t,n){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Cw(t,n),i):null}releaseContext(t){const n=t.canvas;if(!n[Cs])return!1;const i=n[Cs].initial;["height","width"].forEach(o=>{const a=i[o];Z(a)?n.removeAttribute(o):n.setAttribute(o,a)});const s=i.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[Cs],!0}addEventListener(t,n,i){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),a={attach:Ew,detach:Rw,resize:Nw}[n]||Bw;s[n]=a(t,n,i)}removeEventListener(t,n){const i=t.$proxies||(t.$proxies={}),s=i[n];if(!s)return;({attach:ya,detach:ya,resize:ya}[n]||Aw)(t,n,s),i[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,i,s){return Dx(t,n,i,s)}isAttached(t){const n=t&&ra(t);return!!(n&&n.isConnected)}}function zw(e){return!aa()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?Mw:Fw}class $t{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}hasValue(){return Le(this.x)&&Le(this.y)}getProps(t,n){const i=this.$animations;if(!n||!i)return this;const s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}}function Uw(e,t){const n=e.options.ticks,i=Vw(e),s=Math.min(n.maxTicksLimit||i,i),o=n.major.enabled?$w(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>s)return Yw(t,c,o,a/s),c;const d=Hw(o,t,s);if(a>0){let h,f;const m=a>1?Math.round((l-r)/(a-1)):null;for(As(t,c,d,Z(m)?0:r-m,r),h=0,f=a-1;h<f;h++)As(t,c,d,o[h],o[h+1]);return As(t,c,d,l,Z(m)?t.length:l+m),c}return As(t,c,d),c}function Vw(e){const t=e.options.offset,n=e._tickSize(),i=e._length/n+(t?0:1),s=e._maxLength/n;return Math.floor(Math.min(i,s))}function Hw(e,t,n){const i=Ww(e),s=t.length/n;if(!i)return Math.max(s,1);const o=A_(i);for(let a=0,r=o.length-1;a<r;a++){const l=o[a];if(l>s)return l}return Math.max(s,1)}function $w(e){const t=[];let n,i;for(n=0,i=e.length;n<i;n++)e[n].major&&t.push(n);return t}function Yw(e,t,n,i){let s=0,o=n[0],a;for(i=Math.ceil(i),a=0;a<e.length;a++)a===o&&(t.push(e[a]),s++,o=n[s*i])}function As(e,t,n,i,s){const o=Q(i,0),a=Math.min(Q(s,e.length),e.length);let r=0,l,c,d;for(n=Math.ceil(n),s&&(l=s-i,n=l/Math.floor(l/n)),d=o;d<0;)r++,d=Math.round(o+r*n);for(c=Math.max(o,0);c<a;c++)c===d&&(t.push(e[c]),r++,d=Math.round(o+r*n))}function Ww(e){const t=e.length;let n,i;if(t<2)return!1;for(i=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==i)return!1;return i}const jw=e=>e==="left"?"right":e==="right"?"left":e,cu=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,uu=(e,t)=>Math.min(t||e,e);function du(e,t){const n=[],i=e.length/t,s=e.length;let o=0;for(;o<s;o+=i)n.push(e[Math.floor(o)]);return n}function qw(e,t,n){const i=e.ticks.length,s=Math.min(t,i-1),o=e._startPixel,a=e._endPixel,r=1e-6;let l=e.getPixelForTick(s),c;if(!(n&&(i===1?c=Math.max(l-o,a-l):t===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<o-r||l>a+r)))return l}function Gw(e,t){mt(e,n=>{const i=n.gc,s=i.length/2;let o;if(s>t){for(o=0;o<s;++o)delete n.data[i[o]];i.splice(0,s)}})}function Oi(e){return e.drawTicks?e.tickLength:0}function hu(e,t){if(!e.display)return 0;const n=xt(e.font,t),i=Pt(e.padding);return(ct(e.text)?e.text.length:1)*n.lineHeight+i.height}function Xw(e,t){return Be(e,{scale:t,type:"scale"})}function Kw(e,t,n){return Be(e,{tick:n,index:t,type:"tick"})}function Zw(e,t,n){let i=Ko(e);return(n&&t!=="right"||!n&&t==="right")&&(i=jw(i)),i}function Qw(e,t,n,i){const{top:s,left:o,bottom:a,right:r,chart:l}=e,{chartArea:c,scales:d}=l;let h=0,f,m,p;const g=a-s,y=r-o;if(e.isHorizontal()){if(m=Vt(i,o,r),et(n)){const _=Object.keys(n)[0],x=n[_];p=d[_].getPixelForValue(x)+g-t}else n==="center"?p=(c.bottom+c.top)/2+g-t:p=cu(e,n,t);f=r-o}else{if(et(n)){const _=Object.keys(n)[0],x=n[_];m=d[_].getPixelForValue(x)-y+t}else n==="center"?m=(c.left+c.right)/2-y+t:m=cu(e,n,t);p=Vt(i,a,s),h=n==="left"?-yt:yt}return{titleX:m,titleY:p,maxWidth:f,rotation:h}}class an extends $t{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:i,_suggestedMax:s}=this;return t=ie(t,Number.POSITIVE_INFINITY),n=ie(n,Number.NEGATIVE_INFINITY),i=ie(i,Number.POSITIVE_INFINITY),s=ie(s,Number.NEGATIVE_INFINITY),{min:ie(t,i),max:ie(n,s),minDefined:_t(t),maxDefined:_t(n)}}getMinMax(t){let{min:n,max:i,minDefined:s,maxDefined:o}=this.getUserBounds(),a;if(s&&o)return{min:n,max:i};const r=this.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)a=r[l].controller.getMinMax(this,t),s||(n=Math.min(n,a.min)),o||(i=Math.max(i,a.max));return n=o&&n>i?i:n,i=s&&n>i?n:i,{min:ie(n,ie(i,n)),max:ie(i,ie(n,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ft(this.options.beforeUpdate,[this])}update(t,n,i){const{beginAtZero:s,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=ox(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=r<this.ticks.length;this._convertTicksToLabels(l?du(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=Uw(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,i;this.isHorizontal()?(n=this.left,i=this.right):(n=this.top,i=this.bottom,t=!t),this._startPixel=n,this._endPixel=i,this._reversePixels=t,this._length=i-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ft(this.options.afterUpdate,[this])}beforeSetDimensions(){ft(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){ft(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),ft(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ft(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let i,s,o;for(i=0,s=t.length;i<s;i++)o=t[i],o.label=ft(n.callback,[o.value,i,t],this)}afterTickToLabelConversion(){ft(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ft(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,i=uu(this.ticks.length,t.ticks.maxTicksLimit),s=n.minRotation||0,o=n.maxRotation;let a=s,r,l,c;if(!this._isVisible()||!n.display||s>=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const d=this._getLabelSizes(),h=d.widest.width,f=d.highest.height,m=It(this.chart.width-h,0,this.maxWidth);r=t.offset?this.maxWidth/i:m/(i-1),h+6>r&&(r=m/(i-(t.offset?.5:1)),l=this.maxHeight-Oi(t.grid)-n.padding-hu(t.title,this.chart.options.font),c=Math.sqrt(h*h+f*f),a=ys(Math.min(Math.asin(It((d.highest.height+6)/r,-1,1)),Math.asin(It(l/c,-1,1))-Math.asin(It(f/c,-1,1)))),a=Math.max(s,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){ft(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ft(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:i,title:s,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){const l=hu(s,n.options.font);if(r?(t.width=this.maxWidth,t.height=Oi(o)+l):(t.height=this.maxHeight,t.width=Oi(o)+l),i.display&&this.ticks.length){const{first:c,last:d,widest:h,highest:f}=this._getLabelSizes(),m=i.padding*2,p=At(this.labelRotation),g=Math.cos(p),y=Math.sin(p);if(r){const _=i.mirror?0:y*h.width+g*f.height;t.height=Math.min(this.maxHeight,t.height+_+m)}else{const _=i.mirror?0:g*h.width+y*f.height;t.width=Math.min(this.maxWidth,t.width+_+m)}this._calculatePadding(c,d,y,g)}}this._handleMargins(),r?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,i,s){const{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){const d=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,m=0;l?c?(f=s*t.width,m=i*n.height):(f=i*t.height,m=s*n.width):o==="start"?m=n.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,m=n.width/2),this.paddingLeft=Math.max((f-d+a)*this.width/(this.width-d),0),this.paddingRight=Math.max((m-h+a)*this.width/(this.width-h),0)}else{let d=n.height/2,h=t.height/2;o==="start"?(d=0,h=t.height):o==="end"&&(d=n.height,h=0),this.paddingTop=d+a,this.paddingBottom=h+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ft(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,i;for(n=0,i=t.length;n<i;n++)Z(t[n].label)&&(t.splice(n,1),i--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let i=this.ticks;n<i.length&&(i=du(i,n)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,i){const{ctx:s,_longestTextCache:o}=this,a=[],r=[],l=Math.floor(n/uu(n,i));let c=0,d=0,h,f,m,p,g,y,_,x,T,v,w;for(h=0;h<n;h+=l){if(p=t[h].label,g=this._resolveTickFontOptions(h),s.font=y=g.string,_=o[y]=o[y]||{data:{},gc:[]},x=g.lineHeight,T=v=0,!Z(p)&&!ct(p))T=ks(s,_.data,_.gc,T,p),v=x;else if(ct(p))for(f=0,m=p.length;f<m;++f)w=p[f],!Z(w)&&!ct(w)&&(T=ks(s,_.data,_.gc,T,w),v+=x);a.push(T),r.push(v),c=Math.max(T,c),d=Math.max(v,d)}Gw(o,n);const D=a.indexOf(c),S=r.indexOf(d),A=R=>({width:a[R]||0,height:r[R]||0});return{first:A(0),last:A(n-1),widest:A(D),highest:A(S),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return I_(this._alignToPixels?tn(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const i=n[t];return i.$context||(i.$context=Kw(this.getContext(),t,i))}return this.$context||(this.$context=Xw(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=At(this.labelRotation),i=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n)),o=this._getLabelSizes(),a=t.autoSkipPadding||0,r=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return this.isHorizontal()?l*i>r*s?r/i:l/s:l*s<r*i?l/i:r/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,i=this.chart,s=this.options,{grid:o,position:a,border:r}=s,l=o.offset,c=this.isHorizontal(),h=this.ticks.length+(l?1:0),f=Oi(o),m=[],p=r.setContext(this.getContext()),g=p.display?p.width:0,y=g/2,_=function(Y){return tn(i,Y,g)};let x,T,v,w,D,S,A,R,E,k,C,z;if(a==="top")x=_(this.bottom),S=this.bottom-f,R=x-y,k=_(t.top)+y,z=t.bottom;else if(a==="bottom")x=_(this.top),k=t.top,z=_(t.bottom)-y,S=x+y,R=this.top+f;else if(a==="left")x=_(this.right),D=this.right-f,A=x-y,E=_(t.left)+y,C=t.right;else if(a==="right")x=_(this.left),E=t.left,C=_(t.right)-y,D=x+y,A=this.left+f;else if(n==="x"){if(a==="center")x=_((t.top+t.bottom)/2+.5);else if(et(a)){const Y=Object.keys(a)[0],G=a[Y];x=_(this.chart.scales[Y].getPixelForValue(G))}k=t.top,z=t.bottom,S=x+y,R=S+f}else if(n==="y"){if(a==="center")x=_((t.left+t.right)/2);else if(et(a)){const Y=Object.keys(a)[0],G=a[Y];x=_(this.chart.scales[Y].getPixelForValue(G))}D=x-y,A=D-f,E=t.left,C=t.right}const N=Q(s.ticks.maxTicksLimit,h),V=Math.max(1,Math.ceil(h/N));for(T=0;T<h;T+=V){const Y=this.getContext(T),G=o.setContext(Y),st=r.setContext(Y),ot=G.lineWidth,K=G.color,U=st.dash||[],M=st.dashOffset,P=G.tickWidth,F=G.tickColor,$=G.tickBorderDash||[],it=G.tickBorderDashOffset;v=qw(this,T,l),v!==void 0&&(w=tn(i,v,ot),c?D=A=E=C=w:S=R=k=z=w,m.push({tx1:D,ty1:S,tx2:A,ty2:R,x1:E,y1:k,x2:C,y2:z,width:ot,color:K,borderDash:U,borderDashOffset:M,tickWidth:P,tickColor:F,tickBorderDash:$,tickBorderDashOffset:it}))}return this._ticksLength=h,this._borderValue=x,m}_computeLabelItems(t){const n=this.axis,i=this.options,{position:s,ticks:o}=i,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:c,padding:d,mirror:h}=o,f=Oi(i.grid),m=f+d,p=h?-d:m,g=-At(this.labelRotation),y=[];let _,x,T,v,w,D,S,A,R,E,k,C,z="middle";if(s==="top")D=this.bottom-p,S=this._getXAxisLabelAlignment();else if(s==="bottom")D=this.top+p,S=this._getXAxisLabelAlignment();else if(s==="left"){const V=this._getYAxisLabelAlignment(f);S=V.textAlign,w=V.x}else if(s==="right"){const V=this._getYAxisLabelAlignment(f);S=V.textAlign,w=V.x}else if(n==="x"){if(s==="center")D=(t.top+t.bottom)/2+m;else if(et(s)){const V=Object.keys(s)[0],Y=s[V];D=this.chart.scales[V].getPixelForValue(Y)+m}S=this._getXAxisLabelAlignment()}else if(n==="y"){if(s==="center")w=(t.left+t.right)/2-m;else if(et(s)){const V=Object.keys(s)[0],Y=s[V];w=this.chart.scales[V].getPixelForValue(Y)}S=this._getYAxisLabelAlignment(f).textAlign}n==="y"&&(l==="start"?z="top":l==="end"&&(z="bottom"));const N=this._getLabelSizes();for(_=0,x=r.length;_<x;++_){T=r[_],v=T.label;const V=o.setContext(this.getContext(_));A=this.getPixelForTick(_)+o.labelOffset,R=this._resolveTickFontOptions(_),E=R.lineHeight,k=ct(v)?v.length:1;const Y=k/2,G=V.color,st=V.textStrokeColor,ot=V.textStrokeWidth;let K=S;a?(w=A,S==="inner"&&(_===x-1?K=this.options.reverse?"left":"right":_===0?K=this.options.reverse?"right":"left":K="center"),s==="top"?c==="near"||g!==0?C=-k*E+E/2:c==="center"?C=-N.highest.height/2-Y*E+E:C=-N.highest.height+E/2:c==="near"||g!==0?C=E/2:c==="center"?C=N.highest.height/2-Y*E:C=N.highest.height-k*E,h&&(C*=-1),g!==0&&!V.showLabelBackdrop&&(w+=E/2*Math.sin(g))):(D=A,C=(1-k)*E/2);let U;if(V.showLabelBackdrop){const M=Pt(V.backdropPadding),P=N.heights[_],F=N.widths[_];let $=C-M.top,it=0-M.left;switch(z){case"middle":$-=P/2;break;case"bottom":$-=P;break}switch(S){case"center":it-=F/2;break;case"right":it-=F;break;case"inner":_===x-1?it-=F:_>0&&(it-=F/2);break}U={left:it,top:$,width:F+M.width,height:P+M.height,color:V.backdropColor}}y.push({label:v,font:R,textOffset:C,options:{rotation:g,color:G,strokeColor:st,strokeWidth:ot,textAlign:K,textBaseline:z,translation:[w,D],backdrop:U}})}return y}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-At(this.labelRotation))return t==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:i,mirror:s,padding:o}}=this.options,a=this._getLabelSizes(),r=t+o,l=a.widest.width;let c,d;return n==="left"?s?(d=this.right+o,i==="near"?c="left":i==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-r,i==="near"?c="right":i==="center"?(c="center",d-=l/2):(c="left",d=this.left)):n==="right"?s?(d=this.left+o,i==="near"?c="right":i==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+r,i==="near"?c="left":i==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:i,top:s,width:o,height:a}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(i,s,o,a),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const n=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,a;const r=(l,c,d)=>{!d.width||!d.color||(i.save(),i.lineWidth=d.width,i.strokeStyle=d.color,i.setLineDash(d.borderDash||[]),i.lineDashOffset=d.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(n.display)for(o=0,a=s.length;o<a;++o){const l=s[o];n.drawOnChartArea&&r({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&r({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:i,grid:s}}=this,o=i.setContext(this.getContext()),a=i.display?o.width:0;if(!a)return;const r=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,d,h,f;this.isHorizontal()?(c=tn(t,this.left,a)-a/2,d=tn(t,this.right,r)+r/2,h=f=l):(h=tn(t,this.top,a)-a/2,f=tn(t,this.bottom,r)+r/2,c=d=l),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(c,h),n.lineTo(d,f),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&_i(i,s);const o=this.getLabelItems(t);for(const a of o){const r=a.options,l=a.font,c=a.label,d=a.textOffset;en(i,c,0,d,l,r)}s&&xi(i)}drawTitle(){const{ctx:t,options:{position:n,title:i,reverse:s}}=this;if(!i.display)return;const o=xt(i.font),a=Pt(i.padding),r=i.align;let l=o.lineHeight/2;n==="bottom"||n==="center"||et(n)?(l+=a.bottom,ct(i.text)&&(l+=o.lineHeight*(i.text.length-1))):l+=a.top;const{titleX:c,titleY:d,maxWidth:h,rotation:f}=Qw(this,l,n,r);en(t,i.text,0,0,o,{color:i.color,maxWidth:h,rotation:f,textAlign:Zw(r,n,s),textBaseline:"middle",translation:[c,d]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,i=Q(t.grid&&t.grid.z,-1),s=Q(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==an.prototype.draw?[{z:n,draw:o=>{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let o,a;for(o=0,a=n.length;o<a;++o){const r=n[o];r[i]===this.id&&(!t||r.type===t)&&s.push(r)}return s}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return xt(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Ps{constructor(t,n,i){this.type=t,this.scope=n,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let i;ek(n)&&(i=this.register(n));const s=this.items,o=t.id,a=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,Jw(t,a,i),this.override&&bt.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){const n=this.items,i=t.id,s=this.scope;i in n&&delete n[i],s&&i in bt[s]&&(delete bt[s][i],this.override&&delete Je[i])}}function Jw(e,t,n){const i=hi(Object.create(null),[n?bt.get(n):{},bt.get(t),e.defaults]);bt.set(t,i),e.defaultRoutes&&tk(t,e.defaultRoutes),e.descriptors&&bt.describe(t,e.descriptors)}function tk(e,t){Object.keys(t).forEach(n=>{const i=n.split("."),s=i.pop(),o=[e].concat(i).join("."),a=t[n].split("."),r=a.pop(),l=a.join(".");bt.route(o,s,l,r)})}function ek(e){return"id"in e&&"defaults"in e}class nk{constructor(){this.controllers=new Ps(Ue,"datasets",!0),this.elements=new Ps($t,"elements"),this.plugins=new Ps(Object,"plugins"),this.scales=new Ps(an,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,i){[...n].forEach(s=>{const o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):mt(s,a=>{const r=i||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,n,i){const s=qo(t);ft(i["before"+s],[],i),n[t](i),ft(i["after"+s],[],i)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const i=this._typedRegistries[n];if(i.isForType(t))return i}return this.plugins}_get(t,n,i){const s=n.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var fe=new nk;class ik{constructor(){this._init=void 0}notify(t,n,i,s){if(n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;const o=s?this._descriptors(t).filter(s):this._descriptors(t),a=this._notify(o,t,n,i);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),a}_notify(t,n,i,s){s=s||{};for(const o of t){const a=o.plugin,r=a[i],l=[n,s,o.options];if(ft(r,l,a)===!1&&s.cancelable)return!1}return!0}invalidate(){Z(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const i=t&&t.config,s=Q(i.options&&i.options.plugins,{}),o=sk(i);return s===!1&&!n?[]:ak(t,o,s,n)}_notifyStateChanges(t){const n=this._oldCache||[],i=this._cache,s=(o,a)=>o.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(s(n,i),t,"stop"),this._notify(s(i,n),t,"start")}}function sk(e){const t={},n=[],i=Object.keys(fe.plugins.items);for(let o=0;o<i.length;o++)n.push(fe.getPlugin(i[o]));const s=e.plugins||[];for(let o=0;o<s.length;o++){const a=s[o];n.indexOf(a)===-1&&(n.push(a),t[a.id]=!0)}return{plugins:n,localIds:t}}function ok(e,t){return!t&&e===!1?null:e===!0?{}:e}function ak(e,{plugins:t,localIds:n},i,s){const o=[],a=e.getContext();for(const r of t){const l=r.id,c=ok(i[l],s);c!==null&&o.push({plugin:r,options:rk(e.config,{plugin:r,local:n[l]},c,a)})}return o}function rk(e,{plugin:t,local:n},i,s){const o=e.pluginScopeKeys(t),a=e.getOptionScopes(i,o);return n&&t.defaults&&a.push(t.defaults),e.createResolver(a,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function ba(e,t){const n=bt.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function lk(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function ck(e,t){return e===t?"_index_":"_value_"}function fu(e){if(e==="x"||e==="y"||e==="r")return e}function uk(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function _a(e,...t){if(fu(e))return e;for(const n of t){const i=n.axis||uk(n.position)||e.length>1&&fu(e[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function mu(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function dk(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(i=>i.xAxisID===e||i.yAxisID===e);if(n.length)return mu(e,"x",n[0])||mu(e,"y",n[0])}return{}}function hk(e,t){const n=Je[e.type]||{scales:{}},i=t.scales||{},s=ba(e.type,t),o=Object.create(null);return Object.keys(i).forEach(a=>{const r=i[a];if(!et(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const l=_a(a,r,dk(a,e),bt.scales[r.type]),c=ck(l,s),d=n.scales||{};o[a]=fi(Object.create(null),[{axis:l},r,d[l],d[c]])}),e.data.datasets.forEach(a=>{const r=a.type||e.type,l=a.indexAxis||ba(r,t),d=(Je[r]||{}).scales||{};Object.keys(d).forEach(h=>{const f=lk(h,l),m=a[f+"AxisID"]||f;o[m]=o[m]||Object.create(null),fi(o[m],[{axis:f},i[m],d[h]])})}),Object.keys(o).forEach(a=>{const r=o[a];fi(r,[bt.scales[r.type],bt.scale])}),o}function pu(e){const t=e.options||(e.options={});t.plugins=Q(t.plugins,{}),t.scales=hk(e,t)}function gu(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function fk(e){return e=e||{},e.data=gu(e.data),pu(e),e}const yu=new Map,bu=new Set;function Es(e,t){let n=yu.get(e);return n||(n=t(),yu.set(e,n),bu.add(n)),n}const Ai=(e,t,n)=>{const i=Re(t,n);i!==void 0&&e.add(i)};class mk{constructor(t){this._config=fk(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=gu(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),pu(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Es(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return Es(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return Es(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,i=this.type;return Es(`${i}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const i=this._scopeCache;let s=i.get(t);return(!s||n)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,n,i){const{options:s,type:o}=this,a=this._cachedScopes(t,i),r=a.get(n);if(r)return r;const l=new Set;n.forEach(d=>{t&&(l.add(t),d.forEach(h=>Ai(l,t,h))),d.forEach(h=>Ai(l,s,h)),d.forEach(h=>Ai(l,Je[o]||{},h)),d.forEach(h=>Ai(l,bt,h)),d.forEach(h=>Ai(l,Jo,h))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),bu.has(n)&&a.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,Je[n]||{},bt.datasets[n]||{},{type:n},bt,Jo]}resolveNamedOptions(t,n,i,s=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=_u(this._resolverCache,t,s);let l=a;if(gk(a,n)){o.$shared=!1,i=Kt(i)?i():i;const c=this.createResolver(t,i,r);l=Pn(a,i,c)}for(const c of n)o[c]=l[c];return o}createResolver(t,n,i=[""],s){const{resolver:o}=_u(this._resolverCache,t,i);return et(n)?Pn(o,n,void 0,s):o}}function _u(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));const s=n.join();let o=i.get(s);return o||(o={resolver:ia(t,n),subPrefixes:n.filter(r=>!r.toLowerCase().includes("hover"))},i.set(s,o)),o}const pk=e=>et(e)&&Object.getOwnPropertyNames(e).some(t=>Kt(e[t]));function gk(e,t){const{isScriptable:n,isIndexable:i}=yc(e);for(const s of t){const o=n(s),a=i(s),r=(a||o)&&e[s];if(o&&(Kt(r)||pk(r))||a&&ct(r))return!0}return!1}var yk="4.5.1";const bk=["top","bottom","left","right","chartArea"];function xu(e,t){return e==="top"||e==="bottom"||bk.indexOf(e)===-1&&t==="x"}function wu(e,t){return function(n,i){return n[e]===i[e]?n[t]-i[t]:n[e]-i[e]}}function ku(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),ft(n&&n.onComplete,[e],t)}function _k(e){const t=e.chart,n=t.options.animation;ft(n&&n.onProgress,[e],t)}function Tu(e){return aa()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Rs={},Su=e=>{const t=Tu(e);return Object.values(Rs).filter(n=>n.canvas===t).pop()};function xk(e,t,n){const i=Object.keys(e);for(const s of i){const o=+s;if(o>=t){const a=e[s];delete e[s],(n>0||o>t)&&(e[o+n]=a)}}}function wk(e,t,n,i){return!n||e.type==="mouseout"?null:i?t:e}let Zt=class{static defaults=bt;static instances=Rs;static overrides=Je;static registry=fe;static version=yk;static getChart=Su;static register(...t){fe.add(...t),vu()}static unregister(...t){fe.remove(...t),vu()}constructor(t,n){const i=this.config=new mk(n),s=Tu(t),o=Su(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||zw(s)),this.platform.updateConfig(i);const r=this.platform.acquireContext(s,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,d=l&&l.width;if(this.id=k_(),this.ctx=r,this.canvas=l,this.width=d,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new ik,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=F_(h=>this.update(h),a.resizeDelay||0),this._dataChanges=[],Rs[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Te.listen(this,"complete",ku),Te.listen(this,"progress",_k),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:i,height:s,_aspectRatio:o}=this;return Z(t)?n&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return fe}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():vc(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return mc(this.canvas,this.ctx),this}stop(){return Te.stop(this),this}resize(t,n){Te.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,n,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,vc(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),ft(i.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};mt(n,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,n=t.scales,i=this.scales,s=Object.keys(i).reduce((a,r)=>(a[r]=!1,a),{});let o=[];n&&(o=o.concat(Object.keys(n).map(a=>{const r=n[a],l=_a(a,r),c=l==="r",d=l==="x";return{options:r,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),mt(o,a=>{const r=a.options,l=r.id,c=_a(l,r),d=Q(r.type,a.dtype);(r.position===void 0||xu(r.position,c)!==xu(a.dposition))&&(r.position=a.dposition),s[l]=!0;let h=null;if(l in i&&i[l].type===d)h=i[l];else{const f=fe.getScale(d);h=new f({id:l,type:d,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(r,t)}),mt(s,(a,r)=>{a||delete i[r]}),mt(i,a=>{Ht.configure(this,a,a.options),Ht.addBox(this,a)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>n){for(let s=n;s<i;++s)this._destroyDatasetMeta(s);t.splice(n,i-n)}this._sortedMetasets=t.slice(0).sort(wu("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((i,s)=>{n.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=n.length;i<s;i++){const o=n[i];let a=this.getDatasetMeta(i);const r=o.type||this.config.type;if(a.type&&a.type!==r&&(this._destroyDatasetMeta(i),a=this.getDatasetMeta(i)),a.type=r,a.indexAxis=o.indexAxis||ba(r,this.options),a.order=o.order||0,a.index=i,a.label=""+o.label,a.visible=this.isDatasetVisible(i),a.controller)a.controller.updateIndex(i),a.controller.linkScales();else{const l=fe.getController(r),{datasetElementType:c,dataElementType:d}=bt.datasets[r];Object.assign(l,{dataElementType:fe.getElement(d),datasetElementType:c&&fe.getElement(c)}),a.controller=new l(this,i),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){mt(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const i=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,d=this.data.datasets.length;c<d;c++){const{controller:h}=this.getDatasetMeta(c),f=!s&&o.indexOf(h)===-1;h.buildOrUpdateElements(f),a=Math.max(+h.getMaxOverflow(),a)}a=this._minPadding=i.layout.autoPadding?a:0,this._updateLayout(a),s||mt(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(wu("z","_idx"));const{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){mt(this.scales,t=>{Ht.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Jl(n,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:o}of n){const a=i==="_removeElements"?-o:o;xk(t,s,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,i=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),s=i(0);for(let o=1;o<n;o++)if(!Jl(s,i(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Ht.update(this,this.width,this.height,t);const n=this.chartArea,i=n.width<=0||n.height<=0;this._layers=[],mt(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,i=this.data.datasets.length;n<i;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,i=this.data.datasets.length;n<i;++n)this._updateDataset(n,Kt(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(n),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Te.has(this)?this.attached&&!Te.running(this)&&Te.start(this):(this.draw(),ku({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,i=[];let s,o;for(s=0,o=n.length;s<o;++s){const a=n[s];(!t||a.visible)&&i.push(a)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=Lc(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&_i(n,s),t.controller.draw(),s&&xi(n),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return ke(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,i,s){const o=ga.modes[n];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){const n=this.data.datasets[t],i=this._metasets;let s=i.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Be(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!n.hidden}setDatasetVisibility(t,n){const i=this.getDatasetMeta(t);i.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,i){const s=i?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,s);Xt(n)?(o.data[n].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(o,{visible:i}),this.update(r=>r.datasetIndex===t?s:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),Te.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),mc(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Rs[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,n=this.platform,i=(o,a)=>{n.addEventListener(this,o,a),t[o]=a},s=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};mt(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,i=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let a;const r=()=>{s("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",a)};a=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",r)},n.isAttached(this.canvas)?r():a()}unbindEvents(){mt(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},mt(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,i){const s=i?"set":"remove";let o,a,r,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),r=0,l=t.length;r<l;++r){a=t[r];const c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],i=t.map(({datasetIndex:o,index:a})=>{const r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!fs(i,n)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,n))}notifyPlugins(t,n,i){return this._plugins.notify(this,t,n,i)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,i){const s=this.options.hover,o=(l,c)=>l.filter(d=>!c.some(h=>d.datasetIndex===h.datasetIndex&&d.index===h.index)),a=o(n,t),r=i?t:o(t,n);a.length&&this.updateHoverStyle(a,s.mode,!1),r.length&&s.mode&&this.updateHoverStyle(r,s.mode,!0)}_eventHandler(t,n){const i={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},s=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const o=this._handleEvent(t,n,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,n,i){const{_active:s=[],options:o}=this,a=n,r=this._getActiveElements(t,s,i,a),l=C_(t),c=wk(t,this._lastEvent,i,l);i&&(this._lastEvent=null,ft(o.onHover,[t,r,this],this),l&&ft(o.onClick,[t,r,this],this));const d=!fs(r,s);return(d||n)&&(this._active=r,this._updateHoverStyles(r,s,n)),this._lastEvent=c,d}_getActiveElements(t,n,i,s){if(t.type==="mouseout")return[];if(!i)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}};function vu(){return mt(Zt.instances,e=>e._plugins.invalidate())}function kk(e,t,n){const{startAngle:i,x:s,y:o,outerRadius:a,innerRadius:r,options:l}=t,{borderWidth:c,borderJoinStyle:d}=l,h=Math.min(c/a,Ut(i-n));if(e.beginPath(),e.arc(s,o,a-c/2,i+h/2,n-h/2),r>0){const f=Math.min(c/r,Ut(i-n));e.arc(s,o,r+c/2,n-f/2,i+f/2,!0)}else{const f=Math.min(c/2,a*Ut(i-n));if(d==="round")e.arc(s,o,f,n-tt/2,i+tt/2,!0);else if(d==="bevel"){const m=2*f*f,p=-m*Math.cos(n+tt/2)+s,g=-m*Math.sin(n+tt/2)+o,y=m*Math.cos(i+tt/2)+s,_=m*Math.sin(i+tt/2)+o;e.lineTo(p,g),e.lineTo(y,_)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function Tk(e,t,n){const{startAngle:i,pixelMargin:s,x:o,y:a,outerRadius:r,innerRadius:l}=t;let c=s/r;e.beginPath(),e.arc(o,a,r,i-c,n+c),l>s?(c=s/l,e.arc(o,a,l,n+c,i-c,!0)):e.arc(o,a,s,n+yt,i-yt),e.closePath(),e.clip()}function Sk(e){return na(e,["outerStart","outerEnd","innerStart","innerEnd"])}function vk(e,t,n,i){const s=Sk(e.options.borderRadius),o=(n-t)/2,a=Math.min(o,i*t/2),r=l=>{const c=(n-Math.min(o,l))*i/2;return It(l,0,Math.min(o,c))};return{outerStart:r(s.outerStart),outerEnd:r(s.outerEnd),innerStart:It(s.innerStart,0,a),innerEnd:It(s.innerEnd,0,a)}}function In(e,t,n,i){return{x:n+e*Math.cos(t),y:i+e*Math.sin(t)}}function Is(e,t,n,i,s,o){const{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:d}=t,h=Math.max(t.outerRadius+i+n-c,0),f=d>0?d+i+n+c:0;let m=0;const p=s-l;if(i){const V=d>0?d-i:0,Y=h>0?h-i:0,G=(V+Y)/2,st=G!==0?p*G/(G+i):p;m=(p-st)/2}const g=Math.max(.001,p*h-n/tt)/h,y=(p-g)/2,_=l+y+m,x=s-y-m,{outerStart:T,outerEnd:v,innerStart:w,innerEnd:D}=vk(t,f,h,x-_),S=h-T,A=h-v,R=_+T/S,E=x-v/A,k=f+w,C=f+D,z=_+w/k,N=x-D/C;if(e.beginPath(),o){const V=(R+E)/2;if(e.arc(a,r,h,R,V),e.arc(a,r,h,V,E),v>0){const ot=In(A,E,a,r);e.arc(ot.x,ot.y,v,E,x+yt)}const Y=In(C,x,a,r);if(e.lineTo(Y.x,Y.y),D>0){const ot=In(C,N,a,r);e.arc(ot.x,ot.y,D,x+yt,N+Math.PI)}const G=(x-D/f+(_+w/f))/2;if(e.arc(a,r,f,x-D/f,G,!0),e.arc(a,r,f,G,_+w/f,!0),w>0){const ot=In(k,z,a,r);e.arc(ot.x,ot.y,w,z+Math.PI,_-yt)}const st=In(S,_,a,r);if(e.lineTo(st.x,st.y),T>0){const ot=In(S,R,a,r);e.arc(ot.x,ot.y,T,_-yt,R)}}else{e.moveTo(a,r);const V=Math.cos(R)*h+a,Y=Math.sin(R)*h+r;e.lineTo(V,Y);const G=Math.cos(E)*h+a,st=Math.sin(E)*h+r;e.lineTo(G,st)}e.closePath()}function Mk(e,t,n,i,s){const{fullCircles:o,startAngle:a,circumference:r}=t;let l=t.endAngle;if(o){Is(e,t,n,i,l,s);for(let c=0;c<o;++c)e.fill();isNaN(r)||(l=a+(r%gt||gt))}return Is(e,t,n,i,l,s),e.fill(),l}function Dk(e,t,n,i,s){const{fullCircles:o,startAngle:a,circumference:r,options:l}=t,{borderWidth:c,borderJoinStyle:d,borderDash:h,borderDashOffset:f,borderRadius:m}=l,p=l.borderAlign==="inner";if(!c)return;e.setLineDash(h||[]),e.lineDashOffset=f,p?(e.lineWidth=c*2,e.lineJoin=d||"round"):(e.lineWidth=c,e.lineJoin=d||"bevel");let g=t.endAngle;if(o){Is(e,t,n,i,g,s);for(let y=0;y<o;++y)e.stroke();isNaN(r)||(g=a+(r%gt||gt))}p&&Tk(e,t,g),l.selfJoin&&g-a>=tt&&m===0&&d!=="miter"&&kk(e,t,g),o||(Is(e,t,n,i,g,s),e.stroke())}class Ck extends $t{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,n,i){const s=this.getProps(["x","y"],i),{angle:o,distance:a}=bs(s,{x:t,y:n}),{startAngle:r,endAngle:l,innerRadius:c,outerRadius:d,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),f=(this.options.spacing+this.options.borderWidth)/2,m=Q(h,l-r),p=pi(o,r,l)&&r!==l,g=m>=gt||p,y=xe(a,c+f,d+f);return g&&y}getCenterPoint(t){const{x:n,y:i,startAngle:s,endAngle:o,innerRadius:a,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:l,spacing:c}=this.options,d=(s+o)/2,h=(a+r+c+l)/2;return{x:n+Math.cos(d)*h,y:i+Math.sin(d)*h}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:n,circumference:i}=this,s=(n.offset||0)/4,o=(n.spacing||0)/2,a=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=i>gt?Math.floor(i/gt):0,i===0||this.innerRadius<0||this.outerRadius<0)return;t.save();const r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*s,Math.sin(r)*s);const l=1-Math.sin(Math.min(tt,i||0)),c=s*l;t.fillStyle=n.backgroundColor,t.strokeStyle=n.borderColor,Mk(t,this,c,o,a),Dk(t,this,c,o,a),t.restore()}}function Mu(e,t,n=t){e.lineCap=Q(n.borderCapStyle,t.borderCapStyle),e.setLineDash(Q(n.borderDash,t.borderDash)),e.lineDashOffset=Q(n.borderDashOffset,t.borderDashOffset),e.lineJoin=Q(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=Q(n.borderWidth,t.borderWidth),e.strokeStyle=Q(n.borderColor,t.borderColor)}function Ok(e,t,n){e.lineTo(n.x,n.y)}function Ak(e){return e.stepped?K_:e.tension||e.cubicInterpolationMode==="monotone"?Z_:Ok}function Du(e,t,n={}){const i=e.length,{start:s=0,end:o=i-1}=n,{start:a,end:r}=t,l=Math.max(s,a),c=Math.min(o,r),d=s<a&&o<a||s>r&&o>r;return{count:i,start:l,loop:t.loop,ilen:c<l&&!d?i+c-l:c-l}}function Pk(e,t,n,i){const{points:s,options:o}=t,{count:a,start:r,loop:l,ilen:c}=Du(s,n,i),d=Ak(o);let{move:h=!0,reverse:f}=i||{},m,p,g;for(m=0;m<=c;++m)p=s[(r+(f?c-m:m))%a],!p.skip&&(h?(e.moveTo(p.x,p.y),h=!1):d(e,g,p,f,o.stepped),g=p);return l&&(p=s[(r+(f?c:0))%a],d(e,g,p,f,o.stepped)),!!l}function Ek(e,t,n,i){const s=t.points,{count:o,start:a,ilen:r}=Du(s,n,i),{move:l=!0,reverse:c}=i||{};let d=0,h=0,f,m,p,g,y,_;const x=v=>(a+(c?r-v:v))%o,T=()=>{g!==y&&(e.lineTo(d,y),e.lineTo(d,g),e.lineTo(d,_))};for(l&&(m=s[x(0)],e.moveTo(m.x,m.y)),f=0;f<=r;++f){if(m=s[x(f)],m.skip)continue;const v=m.x,w=m.y,D=v|0;D===p?(w<g?g=w:w>y&&(y=w),d=(h*d+v)/++h):(T(),e.lineTo(v,w),p=D,h=0,g=y=w),_=w}T()}function xa(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?Ek:Pk}function Rk(e){return e.stepped?Ox:e.tension||e.cubicInterpolationMode==="monotone"?Ax:sn}function Ik(e,t,n,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,n,i)&&s.closePath()),Mu(e,t.options),e.stroke(s)}function Lk(e,t,n,i){const{segments:s,options:o}=t,a=xa(t);for(const r of s)Mu(e,o,r.style),e.beginPath(),a(e,t,r,{start:n,end:n+i-1})&&e.closePath(),e.stroke()}const Nk=typeof Path2D=="function";function Bk(e,t,n,i){Nk&&!t.options.segment?Ik(e,t,n,i):Lk(e,t,n,i)}class Ls extends $t{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;wx(this._points,i,t,s,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Nx(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,i=t.length;return i&&n[t[i-1].end]}interpolate(t,n){const i=this.options,s=t[n],o=this.points,a=Ec(this,{property:n,start:s,end:s});if(!a.length)return;const r=[],l=Rk(i);let c,d;for(c=0,d=a.length;c<d;++c){const{start:h,end:f}=a[c],m=o[h],p=o[f];if(m===p){r.push(m);continue}const g=Math.abs((s-m[n])/(p[n]-m[n])),y=l(m,p,g,i.stepped);y[n]=t[n],r.push(y)}return r.length===1?r[0]:r}pathSegment(t,n,i){return xa(this)(t,this,n,i)}path(t,n,i){const s=this.segments,o=xa(this);let a=this._loop;n=n||0,i=i||this.points.length-n;for(const r of s)a&=o(t,this,r,{start:n,end:n+i-1});return!!a}draw(t,n,i,s){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Bk(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function Cu(e,t,n,i){const s=e.options,{[n]:o}=e.getProps([n],i);return Math.abs(t-o)<s.radius+s.hitRadius}class Fk extends $t{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,n,i){const s=this.options,{x:o,y:a}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(n-a,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,n){return Cu(this,t,"x",n)}inYRange(t,n){return Cu(this,t,"y",n)}getCenterPoint(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}size(t){t=t||this.options||{};let n=t.radius||0;n=Math.max(n,n&&t.hoverRadius||0);const i=n&&t.borderWidth||0;return(n+i)*2}draw(t,n){const i=this.options;this.skip||i.radius<.1||!ke(this,n,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,ea(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function Ou(e,t){const{x:n,y:i,base:s,width:o,height:a}=e.getProps(["x","y","base","width","height"],t);let r,l,c,d,h;return e.horizontal?(h=a/2,r=Math.min(n,s),l=Math.max(n,s),c=i-h,d=i+h):(h=o/2,r=n-h,l=n+h,c=Math.min(i,s),d=Math.max(i,s)),{left:r,top:c,right:l,bottom:d}}function Ve(e,t,n,i){return e?0:It(t,n,i)}function zk(e,t,n){const i=e.options.borderWidth,s=e.borderSkipped,o=gc(i);return{t:Ve(s.top,o.top,0,n),r:Ve(s.right,o.right,0,t),b:Ve(s.bottom,o.bottom,0,n),l:Ve(s.left,o.left,0,t)}}function Uk(e,t,n){const{enableBorderRadius:i}=e.getProps(["enableBorderRadius"]),s=e.options.borderRadius,o=Ne(s),a=Math.min(t,n),r=e.borderSkipped,l=i||et(s);return{topLeft:Ve(!l||r.top||r.left,o.topLeft,0,a),topRight:Ve(!l||r.top||r.right,o.topRight,0,a),bottomLeft:Ve(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:Ve(!l||r.bottom||r.right,o.bottomRight,0,a)}}function Vk(e){const t=Ou(e),n=t.right-t.left,i=t.bottom-t.top,s=zk(e,n/2,i/2),o=Uk(e,n/2,i/2);return{outer:{x:t.left,y:t.top,w:n,h:i,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:n-s.l-s.r,h:i-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function wa(e,t,n,i){const s=t===null,o=n===null,r=e&&!(s&&o)&&Ou(e,i);return r&&(s||xe(t,r.left,r.right))&&(o||xe(n,r.top,r.bottom))}function Hk(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function $k(e,t){e.rect(t.x,t.y,t.w,t.h)}function ka(e,t,n={}){const i=e.x!==n.x?-t:0,s=e.y!==n.y?-t:0,o=(e.x+e.w!==n.x+n.w?t:0)-i,a=(e.y+e.h!==n.y+n.h?t:0)-s;return{x:e.x+i,y:e.y+s,w:e.w+o,h:e.h+a,radius:e.radius}}class Yk extends $t{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:n,options:{borderColor:i,backgroundColor:s}}=this,{inner:o,outer:a}=Vk(this),r=Hk(a.radius)?An:$k;t.save(),(a.w!==o.w||a.h!==o.h)&&(t.beginPath(),r(t,ka(a,n,o)),t.clip(),r(t,ka(o,-n,a)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),r(t,ka(o,n)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,n,i){return wa(this,t,n,i)}inXRange(t,n){return wa(this,t,null,n)}inYRange(t,n){return wa(this,null,t,n)}getCenterPoint(t){const{x:n,y:i,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(n+s)/2:n,y:o?i:(i+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}var Wk=Object.freeze({__proto__:null,ArcElement:Ck,BarElement:Yk,LineElement:Ls,PointElement:Fk});const Ta=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Au=Ta.map(e=>e.replace("rgb(","rgba(").replace(")",", 0.5)"));function Pu(e){return Ta[e%Ta.length]}function Eu(e){return Au[e%Au.length]}function jk(e,t){return e.borderColor=Pu(t),e.backgroundColor=Eu(t),++t}function qk(e,t){return e.backgroundColor=e.data.map(()=>Pu(t++)),t}function Gk(e,t){return e.backgroundColor=e.data.map(()=>Eu(t++)),t}function Xk(e){let t=0;return(n,i)=>{const s=e.getDatasetMeta(i).controller;s instanceof Ti?t=qk(n,t):s instanceof Xc?t=Gk(n,t):s&&(t=jk(n,t))}}function Ru(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function Kk(e){return e&&(e.borderColor||e.backgroundColor)}function Zk(){return bt.borderColor!=="rgba(0,0,0,0.1)"||bt.backgroundColor!=="rgba(0,0,0,0.1)"}var Qk={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,t,n){if(!n.enabled)return;const{data:{datasets:i},options:s}=e.config,{elements:o}=s,a=Ru(i)||Kk(s)||o&&Ru(o)||Zk();if(!n.forceOverride&&a)return;const r=Xk(e);i.forEach(r)}};function Jk(e,t,n,i,s){const o=s.samples||i;if(o>=n)return e.slice(t,t+n);const a=[],r=(n-2)/(o-2);let l=0;const c=t+n-1;let d=t,h,f,m,p,g;for(a[l++]=e[d],h=0;h<o-2;h++){let y=0,_=0,x;const T=Math.floor((h+1)*r)+1+t,v=Math.min(Math.floor((h+2)*r)+1,n)+t,w=v-T;for(x=T;x<v;x++)y+=e[x].x,_+=e[x].y;y/=w,_/=w;const D=Math.floor(h*r)+1+t,S=Math.min(Math.floor((h+1)*r)+1,n)+t,{x:A,y:R}=e[d];for(m=p=-1,x=D;x<S;x++)p=.5*Math.abs((A-y)*(e[x].y-R)-(A-e[x].x)*(_-R)),p>m&&(m=p,f=e[x],g=x);a[l++]=f,d=g}return a[l++]=e[c],a}function tT(e,t,n,i){let s=0,o=0,a,r,l,c,d,h,f,m,p,g;const y=[],_=t+n-1,x=e[t].x,v=e[_].x-x;for(a=t;a<t+n;++a){r=e[a],l=(r.x-x)/v*i,c=r.y;const w=l|0;if(w===d)c<p?(p=c,h=a):c>g&&(g=c,f=a),s=(o*s+r.x)/++o;else{const D=a-1;if(!Z(h)&&!Z(f)){const S=Math.min(h,f),A=Math.max(h,f);S!==m&&S!==D&&y.push({...e[S],x:s}),A!==m&&A!==D&&y.push({...e[A],x:s})}a>0&&D!==m&&y.push(e[D]),y.push(r),d=w,o=0,p=g=c,h=f=m=a}}return y}function Iu(e){if(e._decimated){const t=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function Lu(e){e.data.datasets.forEach(t=>{Iu(t)})}function eT(e,t){const n=t.length;let i=0,s;const{iScale:o}=e,{min:a,max:r,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(i=It(we(t,o.axis,a).lo,0,n-1)),c?s=It(we(t,o.axis,r).hi+1,i,n)-i:s=n-i,{start:i,count:s}}var nT={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(e,t,n)=>{if(!n.enabled){Lu(e);return}const i=e.width;e.data.datasets.forEach((s,o)=>{const{_data:a,indexAxis:r}=s,l=e.getDatasetMeta(o),c=a||s.data;if(wi([r,e.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const d=e.scales[l.xAxisID];if(d.type!=="linear"&&d.type!=="time"||e.options.parsing)return;let{start:h,count:f}=eT(l,c);const m=n.threshold||4*i;if(f<=m){Iu(s);return}Z(a)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(g){this._data=g}}));let p;switch(n.algorithm){case"lttb":p=Jk(c,h,f,i,n);break;case"min-max":p=tT(c,h,f,i);break;default:throw new Error(`Unsupported decimation algorithm '${n.algorithm}'`)}s._decimated=p})},destroy(e){Lu(e)}};function iT(e,t,n){const i=e.segments,s=e.points,o=t.points,a=[];for(const r of i){let{start:l,end:c}=r;c=Ns(l,c,s);const d=Sa(n,s[l],s[c],r.loop);if(!t.segments){a.push({source:r,target:d,start:s[l],end:s[c]});continue}const h=Ec(t,d);for(const f of h){const m=Sa(n,o[f.start],o[f.end],f.loop),p=Pc(r,s,m);for(const g of p)a.push({source:g,target:f,start:{[n]:Nu(d,m,"start",Math.max)},end:{[n]:Nu(d,m,"end",Math.min)}})}}return a}function Sa(e,t,n,i){if(i)return;let s=t[e],o=n[e];return e==="angle"&&(s=Ut(s),o=Ut(o)),{property:e,start:s,end:o}}function sT(e,t){const{x:n=null,y:i=null}=e||{},s=t.points,o=[];return t.segments.forEach(({start:a,end:r})=>{r=Ns(a,r,s);const l=s[a],c=s[r];i!==null?(o.push({x:l.x,y:i}),o.push({x:c.x,y:i})):n!==null&&(o.push({x:n,y:l.y}),o.push({x:n,y:c.y}))}),o}function Ns(e,t,n){for(;t>e;t--){const i=n[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function Nu(e,t,n,i){return e&&t?i(e[n],t[n]):e?e[n]:t?t[n]:0}function Bu(e,t){let n=[],i=!1;return ct(e)?(i=!0,n=e):n=sT(e,t),n.length?new Ls({points:n,options:{tension:0},_loop:i,_fullLoop:i}):null}function Fu(e){return e&&e.fill!==!1}function oT(e,t,n){let s=e[t].fill;const o=[t];let a;if(!n)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!_t(s))return s;if(a=e[s],!a)return!1;if(a.visible)return s;o.push(s),s=a.fill}return!1}function aT(e,t,n){const i=uT(e);if(et(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return _t(s)&&Math.floor(s)===s?rT(i[0],t,s,n):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function rT(e,t,n,i){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=i?!1:n}function lT(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:et(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function cT(e,t,n){let i;return e==="start"?i=n:e==="end"?i=t.options.reverse?t.min:t.max:et(e)?i=e.value:i=t.getBaseValue(),i}function uT(e){const t=e.options,n=t.fill;let i=Q(n&&n.target,n);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function dT(e){const{scale:t,index:n,line:i}=e,s=[],o=i.segments,a=i.points,r=hT(t,n);r.push(Bu({x:null,y:t.bottom},i));for(let l=0;l<o.length;l++){const c=o[l];for(let d=c.start;d<=c.end;d++)fT(s,a[d],r)}return new Ls({points:s,options:{}})}function hT(e,t){const n=[],i=e.getMatchingVisibleMetas("line");for(let s=0;s<i.length;s++){const o=i[s];if(o.index===t)break;o.hidden||n.unshift(o.dataset)}return n}function fT(e,t,n){const i=[];for(let s=0;s<n.length;s++){const o=n[s],{first:a,last:r,point:l}=mT(o,t,"x");if(!(!l||a&&r)){if(a)i.unshift(l);else if(e.push(l),!r)break}}e.push(...i)}function mT(e,t,n){const i=e.interpolate(t,n);if(!i)return{};const s=i[n],o=e.segments,a=e.points;let r=!1,l=!1;for(let c=0;c<o.length;c++){const d=o[c],h=a[d.start][n],f=a[d.end][n];if(xe(s,h,f)){r=s===h,l=s===f;break}}return{first:r,last:l,point:i}}class zu{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,n,i){const{x:s,y:o,radius:a}=this;return n=n||{start:0,end:gt},t.arc(s,o,a,n.end,n.start,!0),!i.bounds}interpolate(t){const{x:n,y:i,radius:s}=this,o=t.angle;return{x:n+Math.cos(o)*s,y:i+Math.sin(o)*s,angle:o}}}function pT(e){const{chart:t,fill:n,line:i}=e;if(_t(n))return gT(t,n);if(n==="stack")return dT(e);if(n==="shape")return!0;const s=yT(e);return s instanceof zu?s:Bu(s,i)}function gT(e,t){const n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function yT(e){return(e.scale||{}).getPointPositionForValue?_T(e):bT(e)}function bT(e){const{scale:t={},fill:n}=e,i=lT(n,t);if(_t(i)){const s=t.isHorizontal();return{x:s?i:null,y:s?null:i}}return null}function _T(e){const{scale:t,fill:n}=e,i=t.options,s=t.getLabels().length,o=i.reverse?t.max:t.min,a=cT(n,t,o),r=[];if(i.grid.circular){const l=t.getPointPositionForValue(0,o);return new zu({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(a)})}for(let l=0;l<s;++l)r.push(t.getPointPositionForValue(l,a));return r}function va(e,t,n){const i=pT(t),{chart:s,index:o,line:a,scale:r,axis:l}=t,c=a.options,d=c.fill,h=c.backgroundColor,{above:f=h,below:m=h}=d||{},p=s.getDatasetMeta(o),g=Lc(s,p);i&&a.points.length&&(_i(e,n),xT(e,{line:a,target:i,above:f,below:m,area:n,scale:r,axis:l,clip:g}),xi(e))}function xT(e,t){const{line:n,target:i,above:s,below:o,area:a,scale:r,clip:l}=t,c=n._loop?"angle":t.axis;e.save();let d=o;o!==s&&(c==="x"?(Uu(e,i,a.top),Ma(e,{line:n,target:i,color:s,scale:r,property:c,clip:l}),e.restore(),e.save(),Uu(e,i,a.bottom)):c==="y"&&(Vu(e,i,a.left),Ma(e,{line:n,target:i,color:o,scale:r,property:c,clip:l}),e.restore(),e.save(),Vu(e,i,a.right),d=s)),Ma(e,{line:n,target:i,color:d,scale:r,property:c,clip:l}),e.restore()}function Uu(e,t,n){const{segments:i,points:s}=t;let o=!0,a=!1;e.beginPath();for(const r of i){const{start:l,end:c}=r,d=s[l],h=s[Ns(l,c,s)];o?(e.moveTo(d.x,d.y),o=!1):(e.lineTo(d.x,n),e.lineTo(d.x,d.y)),a=!!t.pathSegment(e,r,{move:a}),a?e.closePath():e.lineTo(h.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function Vu(e,t,n){const{segments:i,points:s}=t;let o=!0,a=!1;e.beginPath();for(const r of i){const{start:l,end:c}=r,d=s[l],h=s[Ns(l,c,s)];o?(e.moveTo(d.x,d.y),o=!1):(e.lineTo(n,d.y),e.lineTo(d.x,d.y)),a=!!t.pathSegment(e,r,{move:a}),a?e.closePath():e.lineTo(n,h.y)}e.lineTo(n,t.first().y),e.closePath(),e.clip()}function Ma(e,t){const{line:n,target:i,property:s,color:o,scale:a,clip:r}=t,l=iT(n,i,s);for(const{source:c,target:d,start:h,end:f}of l){const{style:{backgroundColor:m=o}={}}=c,p=i!==!0;e.save(),e.fillStyle=m,wT(e,a,r,p&&Sa(s,h,f)),e.beginPath();const g=!!n.pathSegment(e,c);let y;if(p){g?e.closePath():Hu(e,i,f,s);const _=!!i.pathSegment(e,d,{move:g,reverse:!0});y=g&&_,y||Hu(e,i,h,s)}e.closePath(),e.fill(y?"evenodd":"nonzero"),e.restore()}}function wT(e,t,n,i){const s=t.chart.chartArea,{property:o,start:a,end:r}=i||{};if(o==="x"||o==="y"){let l,c,d,h;o==="x"?(l=a,c=s.top,d=r,h=s.bottom):(l=s.left,c=a,d=s.right,h=r),e.beginPath(),n&&(l=Math.max(l,n.left),d=Math.min(d,n.right),c=Math.max(c,n.top),h=Math.min(h,n.bottom)),e.rect(l,c,d-l,h-c),e.clip()}}function Hu(e,t,n,i){const s=t.interpolate(n,i);s&&e.lineTo(s.x,s.y)}var kT={id:"filler",afterDatasetsUpdate(e,t,n){const i=(e.data.datasets||[]).length,s=[];let o,a,r,l;for(a=0;a<i;++a)o=e.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof Ls&&(l={visible:e.isDatasetVisible(a),index:a,fill:aT(r,a,i),chart:e,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,s.push(l);for(a=0;a<i;++a)l=s[a],!(!l||l.fill===!1)&&(l.fill=oT(s,a,n.propagate))},beforeDraw(e,t,n){const i=n.drawTime==="beforeDraw",s=e.getSortedVisibleDatasetMetas(),o=e.chartArea;for(let a=s.length-1;a>=0;--a){const r=s[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),i&&r.fill&&va(e.ctx,r,o))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;const i=e.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const o=i[s].$filler;Fu(o)&&va(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,t,n){const i=t.meta.$filler;!Fu(i)||n.drawTime!=="beforeDatasetDraw"||va(e.ctx,i,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const $u=(e,t)=>{let{boxHeight:n=t,boxWidth:i=t}=e;return e.usePointStyle&&(n=Math.min(n,t),i=e.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:n,itemHeight:Math.max(t,n)}},TT=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class Yu extends $t{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,i){this.maxWidth=t,this.maxHeight=n,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=ft(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(i=>t.filter(i,this.chart.data))),t.sort&&(n=n.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=xt(i.font),o=s.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=$u(i,o);let c,d;n.font=s.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(a,o,r,l)+10):(d=this.maxHeight,c=this._fitCols(a,s,r,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(d,t.maxHeight||this.maxHeight)}_fitRows(t,n,i,s){const{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],d=s+r;let h=t;o.textAlign="left",o.textBaseline="middle";let f=-1,m=-d;return this.legendItems.forEach((p,g)=>{const y=i+n/2+o.measureText(p.text).width;(g===0||c[c.length-1]+y+2*r>a)&&(h+=d,c[c.length-(g>0?0:1)]=0,m+=d,f++),l[g]={left:0,top:m,row:f,width:y,height:s},c[c.length-1]+=y+r}),h}_fitCols(t,n,i,s){const{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],d=a-t;let h=r,f=0,m=0,p=0,g=0;return this.legendItems.forEach((y,_)=>{const{itemWidth:x,itemHeight:T}=ST(i,n,o,y,s);_>0&&m+T+2*r>d&&(h+=f+r,c.push({width:f,height:m}),p+=f+r,g++,f=m=0),l[_]={left:p,top:m,col:g,width:x,height:T},f=Math.max(f,x),m+=T+r}),h+=f,c.push({width:f,height:m}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:i,labels:{padding:s},rtl:o}}=this,a=Rn(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=Vt(i,this.left+s,this.right-this.lineWidths[r]);for(const c of n)r!==c.row&&(r=c.row,l=Vt(i,this.left+s,this.right-this.lineWidths[r])),c.top+=this.top+t+s,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+s}else{let r=0,l=Vt(i,this.top+t+s,this.bottom-this.columnSizes[r].height);for(const c of n)c.col!==r&&(r=c.col,l=Vt(i,this.top+t+s,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+s,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;_i(t,this),this._draw(),xi(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:i,ctx:s}=this,{align:o,labels:a}=t,r=bt.color,l=Rn(t.rtl,this.left,this.width),c=xt(a.font),{padding:d}=a,h=c.size,f=h/2;let m;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:p,boxHeight:g,itemHeight:y}=$u(a,h),_=function(D,S,A){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;s.save();const R=Q(A.lineWidth,1);if(s.fillStyle=Q(A.fillStyle,r),s.lineCap=Q(A.lineCap,"butt"),s.lineDashOffset=Q(A.lineDashOffset,0),s.lineJoin=Q(A.lineJoin,"miter"),s.lineWidth=R,s.strokeStyle=Q(A.strokeStyle,r),s.setLineDash(Q(A.lineDash,[])),a.usePointStyle){const E={radius:g*Math.SQRT2/2,pointStyle:A.pointStyle,rotation:A.rotation,borderWidth:R},k=l.xPlus(D,p/2),C=S+f;pc(s,E,k,C,a.pointStyleWidth&&p)}else{const E=S+Math.max((h-g)/2,0),k=l.leftForLtr(D,p),C=Ne(A.borderRadius);s.beginPath(),Object.values(C).some(z=>z!==0)?An(s,{x:k,y:E,w:p,h:g,radius:C}):s.rect(k,E,p,g),s.fill(),R!==0&&s.stroke()}s.restore()},x=function(D,S,A){en(s,A.text,D,S+y/2,c,{strikethrough:A.hidden,textAlign:l.textAlign(A.textAlign)})},T=this.isHorizontal(),v=this._computeTitleHeight();T?m={x:Vt(o,this.left+d,this.right-i[0]),y:this.top+d+v,line:0}:m={x:this.left+d,y:Vt(o,this.top+v+d,this.bottom-n[0].height),line:0},Dc(this.ctx,t.textDirection);const w=y+d;this.legendItems.forEach((D,S)=>{s.strokeStyle=D.fontColor,s.fillStyle=D.fontColor;const A=s.measureText(D.text).width,R=l.textAlign(D.textAlign||(D.textAlign=a.textAlign)),E=p+f+A;let k=m.x,C=m.y;l.setWidth(this.width),T?S>0&&k+E+d>this.right&&(C=m.y+=w,m.line++,k=m.x=Vt(o,this.left+d,this.right-i[m.line])):S>0&&C+w>this.bottom&&(k=m.x=k+n[m.line].width+d,m.line++,C=m.y=Vt(o,this.top+v+d,this.bottom-n[m.line].height));const z=l.x(k);if(_(z,C,D),k=z_(R,k+p+f,T?k+E:this.right,t.rtl),x(l.x(k),C,D),T)m.x+=E+d;else if(typeof D.text!="string"){const N=c.lineHeight;m.y+=Wu(D,N)+d}else m.y+=w}),Cc(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,i=xt(n.font),s=Pt(n.padding);if(!n.display)return;const o=Rn(t.rtl,this.left,this.width),a=this.ctx,r=n.position,l=i.size/2,c=s.top+l;let d,h=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),d=this.top+c,h=Vt(t.align,h,this.right-f);else{const p=this.columnSizes.reduce((g,y)=>Math.max(g,y.height),0);d=c+Vt(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const m=Vt(r,h,h+f);a.textAlign=o.textAlign(Ko(r)),a.textBaseline="middle",a.strokeStyle=n.color,a.fillStyle=n.color,a.font=i.string,en(a,n.text,m,d,i)}_computeTitleHeight(){const t=this.options.title,n=xt(t.font),i=Pt(t.padding);return t.display?n.lineHeight+i.height:0}_getLegendItemAt(t,n){let i,s,o;if(xe(t,this.left,this.right)&&xe(n,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(s=o[i],xe(t,s.left,s.left+s.width)&&xe(n,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const n=this.options;if(!DT(t.type,n))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=TT(s,i);s&&!o&&ft(n.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!o&&ft(n.onHover,[t,i,this],this)}else i&&ft(n.onClick,[t,i,this],this)}}function ST(e,t,n,i,s){const o=vT(i,e,t,n),a=MT(s,i,t.lineHeight);return{itemWidth:o,itemHeight:a}}function vT(e,t,n,i){let s=e.text;return s&&typeof s!="string"&&(s=s.reduce((o,a)=>o.length>a.length?o:a)),t+n.size/2+i.measureText(s).width}function MT(e,t,n){let i=e;return typeof t.text!="string"&&(i=Wu(t,n)),i}function Wu(e,t){const n=e.text?e.text.length:0;return t*n}function DT(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var CT={id:"legend",_element:Yu,start(e,t,n){const i=e.legend=new Yu({ctx:e.ctx,options:n,chart:e});Ht.configure(e,i,n),Ht.addBox(e,i)},stop(e){Ht.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const i=e.legend;Ht.configure(e,i,n),i.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const i=t.datasetIndex,s=n.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:i,textAlign:s,color:o,useBorderRadius:a,borderRadius:r}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),d=Pt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class Da extends $t{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const s=ct(i.text)?i.text.length:1;this._padding=Pt(i.padding);const o=s*xt(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:i,bottom:s,right:o,options:a}=this,r=a.align;let l=0,c,d,h;return this.isHorizontal()?(d=Vt(r,i,o),h=n+t,c=o-i):(a.position==="left"?(d=i+t,h=Vt(r,s,n),l=tt*-.5):(d=o-t,h=Vt(r,n,s),l=tt*.5),c=s-n),{titleX:d,titleY:h,maxWidth:c,rotation:l}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const i=xt(n.font),o=i.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);en(t,n.text,0,0,i,{color:n.color,maxWidth:l,rotation:c,textAlign:Ko(n.align),textBaseline:"middle",translation:[a,r]})}}function OT(e,t){const n=new Da({ctx:e.ctx,options:t,chart:e});Ht.configure(e,n,t),Ht.addBox(e,n),e.titleBlock=n}var AT={id:"title",_element:Da,start(e,t,n){OT(e,n)},stop(e){const t=e.titleBlock;Ht.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const i=e.titleBlock;Ht.configure(e,i,n),i.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Bs=new WeakMap;var PT={id:"subtitle",start(e,t,n){const i=new Da({ctx:e.ctx,options:n,chart:e});Ht.configure(e,i,n),Ht.addBox(e,i),Bs.set(e,i)},stop(e){Ht.removeBox(e,Bs.get(e)),Bs.delete(e)},beforeUpdate(e,t,n){const i=Bs.get(e);Ht.configure(e,i,n),i.options=n},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Pi={average(e){if(!e.length)return!1;let t,n,i=new Set,s=0,o=0;for(t=0,n=e.length;t<n;++t){const r=e[t].element;if(r&&r.hasValue()){const l=r.tooltipPosition();i.add(l.x),s+=l.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((r,l)=>r+l)/i.size,y:s/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,i=t.y,s=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=e.length;o<a;++o){const l=e[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),d=On(t,c);d<s&&(s=d,r=l)}}if(r){const l=r.tooltipPosition();n=l.x,i=l.y}return{x:n,y:i}}};function me(e,t){return t&&(ct(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Se(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
1
+ (function(et,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("vue"),require("@kong/icons"),require("@kong-ui-public/i18n"),require("@kong-ui-public/analytics-config-store"),require("@kong-ui-public/analytics-metric-provider"),require("@kong/kongponents")):typeof define=="function"&&define.amd?define(["exports","vue","@kong/icons","@kong-ui-public/i18n","@kong-ui-public/analytics-config-store","@kong-ui-public/analytics-metric-provider","@kong/kongponents"],d):(et=typeof globalThis<"u"?globalThis:et||self,d(et["kong-ui-publicvitals-chart"]={},et.Vue,et.KongIcons,et["kong-ui-public-i18n"],et["kong-ui-public-analytics-config-store"],et["kong-ui-public-analytics-metric-provider"],et.Kongponents))})(this,(function(et,d,wt,Mr,Dr,qe,Zn){"use strict";const Df="analytics-query-provider",Cf="analytics-dashboard-coordinator",mo="____OTHER____",Of="empty";var W=(e=>(e.FIFTEEN_MIN="15m",e.ONE_HOUR="1h",e.SIX_HOUR="6h",e.TWELVE_HOUR="12h",e.ONE_DAY="24h",e.SEVEN_DAY="7d",e.THIRTY_DAY="30d",e.NINETY_DAY="90d",e.ONE_HUNDRED_EIGHTY_DAY="180d",e.ONE_YEAR="365d",e.CURRENT_WEEK="current_week",e.CURRENT_MONTH="current_month",e.CURRENT_QUARTER="current_quarter",e.CURRENT_YEAR="current_year",e.PREVIOUS_WEEK="previous_week",e.PREVIOUS_MONTH="previous_month",e.PREVIOUS_QUARTER="previous_quarter",e.PREVIOUS_YEAR="previous_year",e))(W||{});const Af=["in","not_in","selector"],Pf=["empty","not_empty"],Ef=["secondly","tenSecondly","thirtySecondly","minutely","fiveMinutely","tenMinutely","thirtyMinutely","hourly","twoHourly","twelveHourly","daily","weekly","trend"],Ge=e=>e.filter(t=>t!=="time"),Cr=["api","api_package","api_product","api_product_version","control_plane","control_plane_group","data_plane_node","gateway_service","portal","route","status_code","status_code_grouped","time"],po=Ge(Cr),Rf=["active_services","error_rate","request_count","request_per_minute","response_latency_average"],Or=[...Cr,"ai_gateway","ai_gateway_consumer","ai_gateway_consumer_group","ai_gateway_data_plane_node","application","bot_info_action","bot_info_detection_reason","bot_info_ban_type","cache_status","consumer","consumer_group","country_code","oidc_credential","upstream_status_code","upstream_status_code_grouped","response_source","data_plane_node_version","realm","portal_api","principal","principal_group"],go=Ge(Or),If=[...Rf,"share_of_requests","cache_hit_rate","response_latency_p99","response_latency_p95","response_latency_p50","upstream_latency_p99","upstream_latency_p95","upstream_latency_p50","upstream_latency_average","kong_latency_p99","kong_latency_p95","kong_latency_p50","kong_latency_average","kong_internal_latency_p99","kong_internal_latency_p95","kong_internal_latency_p50","kong_internal_latency_average","response_size_p99","response_size_p95","response_size_p50","response_size_average","response_size_sum","request_size_p99","request_size_p95","request_size_p50","request_size_average","request_size_sum"],Lf=["ai_gateway","ai_gateway_agent","ai_gateway_consumer","ai_gateway_consumer_group","ai_gateway_data_plane_node","ai_gateway_mcp_server","ai_gateway_model","ai_gateway_version","ai_plugin","ai_provider","ai_request_model","ai_response_model","application","cache_status","consumer","control_plane","control_plane_group","gateway_service","llm_cache_status","llm_embeddings_model","llm_embeddings_provider","oidc_credential","principal","principal_group","realm","response_source","route","status_code","status_code_grouped","time","upstream_status_code","upstream_status_code_grouped"],yo=Ge(Lf),Nf=["a2a_context_id","a2a_error","a2a_method","a2a_task_id","a2a_task_state","ai_gateway","ai_gateway_consumer","ai_gateway_consumer_group","ai_gateway_data_plane_node","ai_gateway_version","api","api_package","api_product","api_product_version","application","auth_type","bot_info_action","bot_info_ban_type","bot_info_detection_reason","bot_info_header_names","bot_info_ja4_fingerprint","cache_status","client_ip","consumer","consumer_group","control_plane","control_plane_group","country_code","data_plane_node","data_plane_node_version","gateway_service","header_host","header_user_agent","http_method","mcp_error","mcp_method","mcp_session_id","mcp_tool_name","oidc_credential","portal","principal","principal_group","realm","request_id","request_uri","response_header_content_type","response_source","route","service_port","service_protocol","sse","status_code_grouped","time","trace_id","upstream_status_code_grouped","upstream_uri","websocket"],Bf=Ge(Nf),Ff=["ai_gateway_version","auth_type","cache_status","client_ip","data_plane_node_version","header_host","header_user_agent","http_method","oidc_credential","request_id","request_uri","response_header_content_type","response_source","service_port","service_protocol","trace_id","upstream_uri"],zf=Ff,Uf=["ai_count","latencies_response_ms","latencies_upstream_ms","latencies_kong_gateway_ms","latencies_kong_internal_ms","request_body_size","response_body_size","response_header_content_length","status_code","upstream_status_code"],Vf=Ge(Uf),Hf=["platform","platform_usage"],$f=e=>Hf.includes(e),Yf=[...Or.filter(e=>e!=="consumer_group"),"a2a_context_id","a2a_error","a2a_method","a2a_task_id","a2a_task_state","ai_gateway_agent","ai_gateway_mcp_server","ai_gateway_model","ai_gateway_version","ai_provider","mcp_error","mcp_method","mcp_session_id","mcp_tool_name"],bo=Ge(Yf);[...If];const Wf=["control_plane","data_plane_group","managed_cache","network","provider","provider_region","time"],_o=Ge(Wf);new Set(po),new Set(go),new Set(yo),new Set(bo),new Set(_o);const Ar=[{code:"AF",name:"Afghanistan"},{code:"AX",name:"Aland Islands"},{code:"AL",name:"Albania"},{code:"DZ",name:"Algeria"},{code:"AS",name:"American Samoa"},{code:"AD",name:"Andorra"},{code:"AO",name:"Angola"},{code:"AI",name:"Anguilla"},{code:"AQ",name:"Antarctica"},{code:"AG",name:"Antigua and Barbuda"},{code:"AR",name:"Argentina"},{code:"AM",name:"Armenia"},{code:"AW",name:"Aruba"},{code:"AU",name:"Australia"},{code:"AT",name:"Austria"},{code:"AZ",name:"Azerbaijan"},{code:"BS",name:"Bahamas"},{code:"BH",name:"Bahrain"},{code:"BD",name:"Bangladesh"},{code:"BB",name:"Barbados"},{code:"BY",name:"Belarus"},{code:"BE",name:"Belgium"},{code:"BZ",name:"Belize"},{code:"BJ",name:"Benin"},{code:"BM",name:"Bermuda"},{code:"BT",name:"Bhutan"},{code:"BO",name:"Bolivia"},{code:"BA",name:"Bosnia and Herzegovina"},{code:"BW",name:"Botswana"},{code:"BV",name:"Bouvet Island"},{code:"BR",name:"Brazil"},{code:"IO",name:"British Indian Ocean Territory"},{code:"BN",name:"Brunei Darussalam"},{code:"BG",name:"Bulgaria"},{code:"BF",name:"Burkina Faso"},{code:"BI",name:"Burundi"},{code:"KH",name:"Cambodia"},{code:"CM",name:"Cameroon"},{code:"CA",name:"Canada"},{code:"CV",name:"Cape Verde"},{code:"KY",name:"Cayman Islands"},{code:"CF",name:"Central African Republic"},{code:"TD",name:"Chad"},{code:"CL",name:"Chile"},{code:"CN",name:"China"},{code:"CX",name:"Christmas Island"},{code:"CC",name:"Cocos (Keeling) Islands"},{code:"CO",name:"Colombia"},{code:"KM",name:"Comoros"},{code:"CG",name:"Congo"},{code:"CD",name:"Democratic Republic of the Congo"},{code:"CK",name:"Cook Islands"},{code:"CR",name:"Costa Rica"},{code:"CI",name:"Cote d'Ivoire"},{code:"HR",name:"Croatia"},{code:"CU",name:"Cuba"},{code:"CY",name:"Cyprus"},{code:"CZ",name:"Czech Republic"},{code:"DK",name:"Denmark"},{code:"DJ",name:"Djibouti"},{code:"DM",name:"Dominica"},{code:"DO",name:"Dominican Republic"},{code:"EC",name:"Ecuador"},{code:"EG",name:"Egypt"},{code:"SV",name:"El Salvador"},{code:"GQ",name:"Equatorial Guinea"},{code:"ER",name:"Eritrea"},{code:"EE",name:"Estonia"},{code:"ET",name:"Ethiopia"},{code:"FK",name:"Falkland Islands (Malvinas)"},{code:"FO",name:"Faroe Islands"},{code:"FJ",name:"Fiji"},{code:"FI",name:"Finland"},{code:"FR",name:"France"},{code:"GF",name:"French Guiana"},{code:"PF",name:"French Polynesia"},{code:"TF",name:"French Southern Territories"},{code:"GA",name:"Gabon"},{code:"GM",name:"Gambia"},{code:"GE",name:"Georgia"},{code:"DE",name:"Germany"},{code:"GH",name:"Ghana"},{code:"GI",name:"Gibraltar"},{code:"GR",name:"Greece"},{code:"GL",name:"Greenland"},{code:"GD",name:"Grenada"},{code:"GP",name:"Guadeloupe"},{code:"GU",name:"Guam"},{code:"GT",name:"Guatemala"},{code:"GG",name:"Guernsey"},{code:"GN",name:"Guinea"},{code:"GW",name:"Guinea-Bissau"},{code:"GY",name:"Guyana"},{code:"HT",name:"Haiti"},{code:"HM",name:"Heard Island and McDonald Islands"},{code:"VA",name:"The Vatican"},{code:"HN",name:"Honduras"},{code:"HK",name:"Hong Kong"},{code:"HU",name:"Hungary"},{code:"IS",name:"Iceland"},{code:"IN",name:"India"},{code:"ID",name:"Indonesia"},{code:"IR",name:"Iran"},{code:"IQ",name:"Iraq"},{code:"IE",name:"Ireland"},{code:"IM",name:"Isle of Man"},{code:"IL",name:"Israel"},{code:"IT",name:"Italy"},{code:"JM",name:"Jamaica"},{code:"JP",name:"Japan"},{code:"JE",name:"Jersey"},{code:"JO",name:"Jordan"},{code:"KZ",name:"Kazakhstan"},{code:"KE",name:"Kenya"},{code:"KI",name:"Kiribati"},{code:"KP",name:"North Korea"},{code:"KR",name:"South Korea"},{code:"KW",name:"Kuwait"},{code:"KG",name:"Kyrgyzstan"},{code:"LA",name:"Laos"},{code:"LV",name:"Latvia"},{code:"LB",name:"Lebanon"},{code:"LS",name:"Lesotho"},{code:"LR",name:"Liberia"},{code:"LY",name:"Libya"},{code:"LI",name:"Liechtenstein"},{code:"LT",name:"Lithuania"},{code:"LU",name:"Luxembourg"},{code:"MO",name:"Macao"},{code:"MK",name:"Macedonia"},{code:"MG",name:"Madagascar"},{code:"MW",name:"Malawi"},{code:"MY",name:"Malaysia"},{code:"MV",name:"Maldives"},{code:"ML",name:"Mali"},{code:"MT",name:"Malta"},{code:"MH",name:"Marshall Islands"},{code:"MQ",name:"Martinique"},{code:"MR",name:"Mauritania"},{code:"MU",name:"Mauritius"},{code:"YT",name:"Mayotte"},{code:"MX",name:"Mexico"},{code:"FM",name:"Micronesia, "},{code:"MD",name:"Moldova,"},{code:"MC",name:"Monaco"},{code:"MN",name:"Mongolia"},{code:"ME",name:"Montenegro"},{code:"MS",name:"Montserrat"},{code:"MA",name:"Morocco"},{code:"MZ",name:"Mozambique"},{code:"MM",name:"Myanmar"},{code:"NA",name:"Namibia"},{code:"NR",name:"Nauru"},{code:"NP",name:"Nepal"},{code:"NL",name:"Netherlands"},{code:"NC",name:"New Caledonia"},{code:"NZ",name:"New Zealand"},{code:"NI",name:"Nicaragua"},{code:"NE",name:"Niger"},{code:"NG",name:"Nigeria"},{code:"NU",name:"Niue"},{code:"NF",name:"Norfolk Island"},{code:"MP",name:"Northern Mariana Islands"},{code:"NO",name:"Norway"},{code:"OM",name:"Oman"},{code:"PK",name:"Pakistan"},{code:"PW",name:"Palau"},{code:"PA",name:"Panama"},{code:"PG",name:"Papua New Guinea"},{code:"PY",name:"Paraguay"},{code:"PE",name:"Peru"},{code:"PH",name:"Philippines"},{code:"PN",name:"Pitcairn"},{code:"PL",name:"Poland"},{code:"PT",name:"Portugal"},{code:"PR",name:"Puerto Rico"},{code:"QA",name:"Qatar"},{code:"RE",name:"Reunion"},{code:"RO",name:"Romania"},{code:"RU",name:"Russia"},{code:"RW",name:"Rwanda"},{code:"BL",name:"Saint Barthelemy"},{code:"SH",name:"Saint Helena"},{code:"KN",name:"Saint Kitts and Nevis"},{code:"LC",name:"Saint Lucia"},{code:"MF",name:"Saint Martin"},{code:"PM",name:"Saint Pierre and Miquelon"},{code:"VC",name:"Saint Vincent and the Grenadines"},{code:"WS",name:"Samoa"},{code:"SM",name:"San Marino"},{code:"ST",name:"Sao Tome and Principe"},{code:"SA",name:"Saudi Arabia"},{code:"SN",name:"Senegal"},{code:"RS",name:"Serbia"},{code:"SC",name:"Seychelles"},{code:"SL",name:"Sierra Leone"},{code:"SG",name:"Singapore"},{code:"SX",name:"Sint Maarten"},{code:"SK",name:"Slovakia"},{code:"SI",name:"Slovenia"},{code:"SB",name:"Solomon Islands"},{code:"SO",name:"Somalia"},{code:"ZA",name:"South Africa"},{code:"GS",name:"South Georgia and the South Sandwich Islands"},{code:"SS",name:"South Sudan"},{code:"ES",name:"Spain"},{code:"LK",name:"Sri Lanka"},{code:"SD",name:"Sudan"},{code:"SR",name:"Suriname"},{code:"SJ",name:"Svalbard and Jan Mayen"},{code:"SZ",name:"Swaziland"},{code:"SE",name:"Sweden"},{code:"CH",name:"Switzerland"},{code:"SY",name:"Syria"},{code:"TW",name:"Taiwan"},{code:"TJ",name:"Tajikistan"},{code:"TZ",name:"Tanzania"},{code:"TH",name:"Thailand"},{code:"TL",name:"Timor-Leste"},{code:"TG",name:"Togo"},{code:"TK",name:"Tokelau"},{code:"TO",name:"Tonga"},{code:"TT",name:"Trinidad and Tobago"},{code:"TN",name:"Tunisia"},{code:"TR",name:"Turkey"},{code:"TM",name:"Turkmenistan"},{code:"TC",name:"Turks and Caicos Islands"},{code:"TV",name:"Tuvalu"},{code:"UG",name:"Uganda"},{code:"UA",name:"Ukraine"},{code:"AE",name:"United Arab Emirates"},{code:"GB",name:"United Kingdom"},{code:"US",name:"United States"},{code:"UM",name:"United States Minor Outlying Islands"},{code:"UY",name:"Uruguay"},{code:"UZ",name:"Uzbekistan"},{code:"VU",name:"Vanuatu"},{code:"VE",name:"Venezuela"},{code:"VN",name:"Vietnam"},{code:"VG",name:"British Virgin Islands"},{code:"VI",name:"U.S. Virgin Islands"},{code:"WF",name:"Wallis and Futuna"},{code:"EH",name:"Western Sahara"},{code:"YE",name:"Yemen"},{code:"ZM",name:"Zambia"},{code:"ZW",name:"Zimbabwe"}],Ce=e=>({type:"array",description:"A list of filters to apply to the query",items:{oneOf:[{type:"object",description:"In filter",properties:{field:{type:"string",...e?{enum:e}:{}},operator:{type:"string",enum:Af},value:{type:"array",items:{type:["string","number","null"]}}},required:["field","operator","value"],additionalProperties:!1},{type:"object",description:"Empty filter",properties:{field:{type:"string",...e?{enum:e}:{}},operator:{type:"string",enum:Pf}},required:["field","operator"],additionalProperties:!1}]}});({...Ce()},Ar.map(e=>e.code));const jf=["control_plane","gateway_service","realm","route","plugin","plugin_name","plugin_scope","data_plane_node_version","env","team","region","hostname"];Ce(go),Ce(po),Ce(yo),Ce(bo),Ce(_o),Ce(Array.from(new Set([...Bf,...zf,...Vf]))),Ce([...new Set([...go,...po,...yo,...bo,...jf,..._o])]);const qf={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Gf=(e,t,n)=>{let i;const s=qf[e];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+i:i+" ago":i};function xo(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Xf={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Kf={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Zf={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Qf={date:xo({formats:Xf,defaultWidth:"full"}),time:xo({formats:Kf,defaultWidth:"full"}),dateTime:xo({formats:Zf,defaultWidth:"full"})},Jf={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},tm=(e,t,n,i)=>Jf[e];function Qn(e){return(t,n)=>{const i=n?.context?String(n.context):"standalone";let s;if(i==="formatting"&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):a;s=e.formattingValues[r]||e.formattingValues[a]}else{const a=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;s=e.values[r]||e.values[a]}const o=e.argumentCallback?e.argumentCallback(t):t;return s[o]}}const em={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},nm={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},im={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},sm={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},om={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},am={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},rm=(e,t)=>{const n=Number(e),i=n%100;if(i>20||i<10)switch(i%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},lm={ordinalNumber:rm,era:Qn({values:em,defaultWidth:"wide"}),quarter:Qn({values:nm,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Qn({values:im,defaultWidth:"wide"}),day:Qn({values:sm,defaultWidth:"wide"}),dayPeriod:Qn({values:om,defaultWidth:"wide",formattingValues:am,defaultFormattingWidth:"wide"})};function Jn(e){return(t,n={})=>{const i=n.width,s=i&&e.matchPatterns[i]||e.matchPatterns[e.defaultMatchWidth],o=t.match(s);if(!o)return null;const a=o[0],r=i&&e.parsePatterns[i]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(r)?dm(r,h=>h.test(a)):cm(r,h=>h.test(a));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=t.slice(a.length);return{value:c,rest:u}}}function cm(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function dm(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function um(e){return(t,n={})=>{const i=t.match(e.matchPattern);if(!i)return null;const s=i[0],o=t.match(e.parsePattern);if(!o)return null;let a=e.valueCallback?e.valueCallback(o[0]):o[0];a=n.valueCallback?n.valueCallback(a):a;const r=t.slice(s.length);return{value:a,rest:r}}}const hm=/^(\d+)(th|st|nd|rd)?/i,fm=/\d+/i,mm={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},pm={any:[/^b/i,/^(a|c)/i]},gm={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ym={any:[/1/i,/2/i,/3/i,/4/i]},bm={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},_m={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},xm={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},wm={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},km={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Tm={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},vm={ordinalNumber:um({matchPattern:hm,parsePattern:fm,valueCallback:e=>parseInt(e,10)}),era:Jn({matchPatterns:mm,defaultMatchWidth:"wide",parsePatterns:pm,defaultParseWidth:"any"}),quarter:Jn({matchPatterns:gm,defaultMatchWidth:"wide",parsePatterns:ym,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Jn({matchPatterns:bm,defaultMatchWidth:"wide",parsePatterns:_m,defaultParseWidth:"any"}),day:Jn({matchPatterns:xm,defaultMatchWidth:"wide",parsePatterns:wm,defaultParseWidth:"any"}),dayPeriod:Jn({matchPatterns:km,defaultMatchWidth:"any",parsePatterns:Tm,defaultParseWidth:"any"})},Sm={code:"en-US",formatDistance:Gf,formatLong:Qf,formatRelative:tm,localize:lm,match:vm,options:{weekStartsOn:0,firstWeekContainsDate:1}};let Mm={};function ti(){return Mm}const Pr=6048e5,Dm=864e5,Cm=60,Om=3600,Er=Symbol.for("constructDateFrom");function se(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Er in e?e[Er](t):e instanceof Date?new e.constructor(t):new Date(t)}function zt(e,t){return se(t||e,e)}function Rr(e){const t=zt(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Am(e,...t){const n=se.bind(null,t.find(i=>typeof i=="object"));return t.map(n)}function _n(e,t){const n=zt(e,t?.in);return n.setHours(0,0,0,0),n}function Pm(e,t,n){const[i,s]=Am(n?.in,e,t),o=_n(i),a=_n(s),r=+o-Rr(o),l=+a-Rr(a);return Math.round((r-l)/Dm)}function Em(e,t){const n=zt(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Rm(e,t){const n=zt(e,t?.in);return Pm(n,Em(n))+1}function ye(e,t){const n=ti(),i=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=zt(e,t?.in),o=s.getDay(),a=(o<i?7:0)+o-i;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function Xi(e,t){return ye(e,{...t,weekStartsOn:1})}function Ir(e,t){const n=zt(e,t?.in),i=n.getFullYear(),s=se(n,0);s.setFullYear(i+1,0,4),s.setHours(0,0,0,0);const o=Xi(s),a=se(n,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const r=Xi(a);return n.getTime()>=o.getTime()?i+1:n.getTime()>=r.getTime()?i:i-1}function Im(e,t){const n=Ir(e,t),i=se(e,0);return i.setFullYear(n,0,4),i.setHours(0,0,0,0),Xi(i)}function Lm(e,t){const n=zt(e,t?.in),i=+Xi(n)-+Im(n);return Math.round(i/Pr)+1}function Lr(e,t){const n=zt(e,t?.in),i=n.getFullYear(),s=ti(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=se(t?.in||e,0);a.setFullYear(i+1,0,o),a.setHours(0,0,0,0);const r=ye(a,t),l=se(t?.in||e,0);l.setFullYear(i,0,o),l.setHours(0,0,0,0);const c=ye(l,t);return+n>=+r?i+1:+n>=+c?i:i-1}function Nm(e,t){const n=ti(),i=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=Lr(e,t),o=se(t?.in||e,0);return o.setFullYear(s,0,i),o.setHours(0,0,0,0),ye(o,t)}function Bm(e,t){const n=zt(e,t?.in),i=+ye(n,t)-+Nm(n,t);return Math.round(i/Pr)+1}function ut(e,t){const n=e<0?"-":"",i=Math.abs(e).toString().padStart(t,"0");return n+i}const Oe={y(e,t){const n=e.getFullYear(),i=n>0?n:1-n;return ut(t==="yy"?i%100:i,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):ut(n+1,2)},d(e,t){return ut(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(e,t){return ut(e.getHours()%12||12,t.length)},H(e,t){return ut(e.getHours(),t.length)},m(e,t){return ut(e.getMinutes(),t.length)},s(e,t){return ut(e.getSeconds(),t.length)},S(e,t){const n=t.length,i=e.getMilliseconds(),s=Math.trunc(i*Math.pow(10,n-3));return ut(s,t.length)}},xn={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Nr={G:function(e,t,n){const i=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(i,{width:"abbreviated"});case"GGGGG":return n.era(i,{width:"narrow"});default:return n.era(i,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const i=e.getFullYear(),s=i>0?i:1-i;return n.ordinalNumber(s,{unit:"year"})}return Oe.y(e,t)},Y:function(e,t,n,i){const s=Lr(e,i),o=s>0?s:1-s;if(t==="YY"){const a=o%100;return ut(a,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):ut(o,t.length)},R:function(e,t){const n=Ir(e);return ut(n,t.length)},u:function(e,t){const n=e.getFullYear();return ut(n,t.length)},Q:function(e,t,n){const i=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return ut(i,2);case"Qo":return n.ordinalNumber(i,{unit:"quarter"});case"QQQ":return n.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(i,{width:"narrow",context:"formatting"});default:return n.quarter(i,{width:"wide",context:"formatting"})}},q:function(e,t,n){const i=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return ut(i,2);case"qo":return n.ordinalNumber(i,{unit:"quarter"});case"qqq":return n.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(i,{width:"narrow",context:"standalone"});default:return n.quarter(i,{width:"wide",context:"standalone"})}},M:function(e,t,n){const i=e.getMonth();switch(t){case"M":case"MM":return Oe.M(e,t);case"Mo":return n.ordinalNumber(i+1,{unit:"month"});case"MMM":return n.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(i,{width:"narrow",context:"formatting"});default:return n.month(i,{width:"wide",context:"formatting"})}},L:function(e,t,n){const i=e.getMonth();switch(t){case"L":return String(i+1);case"LL":return ut(i+1,2);case"Lo":return n.ordinalNumber(i+1,{unit:"month"});case"LLL":return n.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(i,{width:"narrow",context:"standalone"});default:return n.month(i,{width:"wide",context:"standalone"})}},w:function(e,t,n,i){const s=Bm(e,i);return t==="wo"?n.ordinalNumber(s,{unit:"week"}):ut(s,t.length)},I:function(e,t,n){const i=Lm(e);return t==="Io"?n.ordinalNumber(i,{unit:"week"}):ut(i,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Oe.d(e,t)},D:function(e,t,n){const i=Rm(e);return t==="Do"?n.ordinalNumber(i,{unit:"dayOfYear"}):ut(i,t.length)},E:function(e,t,n){const i=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},e:function(e,t,n,i){const s=e.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return ut(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,n,i){const s=e.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return ut(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,n){const i=e.getDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return ut(s,t.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const i=e.getHours();let s;switch(i===12?s=xn.noon:i===0?s=xn.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,n){const i=e.getHours();let s;switch(i>=17?s=xn.evening:i>=12?s=xn.afternoon:i>=4?s=xn.morning:s=xn.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let i=e.getHours()%12;return i===0&&(i=12),n.ordinalNumber(i,{unit:"hour"})}return Oe.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Oe.H(e,t)},K:function(e,t,n){const i=e.getHours()%12;return t==="Ko"?n.ordinalNumber(i,{unit:"hour"}):ut(i,t.length)},k:function(e,t,n){let i=e.getHours();return i===0&&(i=24),t==="ko"?n.ordinalNumber(i,{unit:"hour"}):ut(i,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Oe.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Oe.s(e,t)},S:function(e,t){return Oe.S(e,t)},X:function(e,t,n){const i=e.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return Fr(i);case"XXXX":case"XX":return Xe(i);default:return Xe(i,":")}},x:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"x":return Fr(i);case"xxxx":case"xx":return Xe(i);default:return Xe(i,":")}},O:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Br(i,":");default:return"GMT"+Xe(i,":")}},z:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Br(i,":");default:return"GMT"+Xe(i,":")}},t:function(e,t,n){const i=Math.trunc(+e/1e3);return ut(i,t.length)},T:function(e,t,n){return ut(+e,t.length)}};function Br(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=Math.trunc(i/60),o=i%60;return o===0?n+String(s):n+String(s)+t+ut(o,2)}function Fr(e,t){return e%60===0?(e>0?"-":"+")+ut(Math.abs(e)/60,2):Xe(e,t)}function Xe(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=ut(Math.trunc(i/60),2),o=ut(i%60,2);return n+s+t+o}const zr=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Ur=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Fm=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],i=n[1],s=n[2];if(!s)return zr(e,t);let o;switch(i){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",zr(i,t)).replace("{{time}}",Ur(s,t))},zm={p:Ur,P:Fm},Um=/^D+$/,Vm=/^Y+$/,Hm=["D","DD","YY","YYYY"];function $m(e){return Um.test(e)}function Ym(e){return Vm.test(e)}function Wm(e,t,n){const i=jm(e,t,n);if(console.warn(i),Hm.includes(e))throw new RangeError(i)}function jm(e,t,n){const i=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${i} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function qm(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Gm(e){return!(!qm(e)&&typeof e!="number"||isNaN(+zt(e)))}const Xm=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Km=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Zm=/^'([^]*?)'?$/,Qm=/''/g,Jm=/[a-zA-Z]/;function tp(e,t,n){const i=ti(),s=n?.locale??i.locale??Sm,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,r=zt(e,n?.in);if(!Gm(r))throw new RangeError("Invalid time value");let l=t.match(Km).map(u=>{const h=u[0];if(h==="p"||h==="P"){const f=zm[h];return f(u,s.formatLong)}return u}).join("").match(Xm).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const h=u[0];if(h==="'")return{isToken:!1,value:ep(u)};if(Nr[h])return{isToken:!0,value:u};if(h.match(Jm))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:u}});s.localize.preprocessor&&(l=s.localize.preprocessor(r,l));const c={firstWeekContainsDate:o,weekStartsOn:a,locale:s};return l.map(u=>{if(!u.isToken)return u.value;const h=u.value;(!n?.useAdditionalWeekYearTokens&&Ym(h)||!n?.useAdditionalDayOfYearTokens&&$m(h))&&Wm(h,t,String(e));const f=Nr[h[0]];return f(r,h,s.localize,c)}).join("")}function ep(e){const t=e.match(Zm);return t?t[1].replace(Qm,"'"):e}function Ki(e,t,n){const i=zt(e,n?.in);return isNaN(t)?se(e,NaN):(i.setDate(i.getDate()+t),i)}function Vr(e,t,n){const i=zt(e,n?.in);if(isNaN(t))return se(e,NaN);if(!t)return i;const s=i.getDate(),o=se(e,i.getTime());o.setMonth(i.getMonth()+t+1,0);const a=o.getDate();return s>=a?o:(i.setFullYear(o.getFullYear(),o.getMonth(),s),i)}function np(e,t,n){return Vr(e,t*3,n)}function wn(e,t){const n=zt(e,t?.in),i=n.getMonth(),s=i-i%3;return n.setMonth(s,1),n.setHours(0,0,0,0),n}function kn(e,t){const n=zt(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function ip(e,t){const n=zt(e,t?.in),i=n.getFullYear(),s=n.getMonth(),o=se(n,0);return o.setFullYear(i,s+1,0),o.setHours(0,0,0,0),o.getDate()}function sp(){return Object.assign({},ti())}function Hr(e){return Math.trunc(e*Om)}function op(e){const t=e/Cm;return Math.trunc(t)}function $r(e,t,n){return Vr(e,-1,n)}function Yr(e,t,n){return np(e,-1,n)}function Wr(e,t,n){const i=sp(),s=lp(e,n.timeZone,n.locale??i.locale);return"formatToParts"in s?ap(s,t):rp(s,t)}function ap(e,t){const n=e.formatToParts(t);for(let i=n.length-1;i>=0;--i)if(n[i].type==="timeZoneName")return n[i].value}function rp(e,t){const n=e.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(n);return i?i[0].substr(1):""}function lp(e,t,n){return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}function cp(e,t){const n=mp(t);return"formatToParts"in n?up(n,e):hp(n,e)}const dp={year:0,month:1,day:2,hour:3,minute:4,second:5};function up(e,t){try{const n=e.formatToParts(t),i=[];for(let s=0;s<n.length;s++){const o=dp[n[s].type];o!==void 0&&(i[o]=parseInt(n[s].value,10))}return i}catch(n){if(n instanceof RangeError)return[NaN];throw n}}function hp(e,t){const n=e.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(i[3],10),parseInt(i[1],10),parseInt(i[2],10),parseInt(i[4],10),parseInt(i[5],10),parseInt(i[6],10)]}const wo={},jr=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),fp=jr==="06/25/2014, 00:00:00"||jr==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";function mp(e){return wo[e]||(wo[e]=fp?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),wo[e]}function ko(e,t,n,i,s,o,a){const r=new Date(0);return r.setUTCFullYear(e,t,n),r.setUTCHours(i,s,o,a),r}const qr=36e5,pp=6e4,To={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function ei(e,t,n){if(!e)return 0;let i=To.timezoneZ.exec(e);if(i)return 0;let s,o;if(i=To.timezoneHH.exec(e),i)return s=parseInt(i[1],10),Gr(s)?-(s*qr):NaN;if(i=To.timezoneHHMM.exec(e),i){s=parseInt(i[2],10);const a=parseInt(i[3],10);return Gr(s,a)?(o=Math.abs(s)*qr+a*pp,i[1]==="+"?-o:o):NaN}if(bp(e)){t=new Date(t||Date.now());const a=n?t:gp(t),r=vo(a,e);return-(n?r:yp(t,r,e))}return NaN}function gp(e){return ko(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function vo(e,t){const n=cp(e,t),i=ko(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime();let s=e.getTime();const o=s%1e3;return s-=o>=0?o:1e3+o,i-s}function yp(e,t,n){let i=e.getTime()-t;const s=vo(new Date(i),n);if(t===s)return t;i-=s-t;const o=vo(new Date(i),n);return s===o?s:Math.max(s,o)}function Gr(e,t){return-23<=e&&e<=23&&(t==null||0<=t&&t<=59)}const Xr={};function bp(e){if(Xr[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),Xr[e]=!0,!0}catch{return!1}}const _p=60*1e3,xp={X:function(e,t,n){const i=So(n.timeZone,e);if(i===0)return"Z";switch(t){case"X":return Kr(i);case"XXXX":case"XX":return Tn(i);default:return Tn(i,":")}},x:function(e,t,n){const i=So(n.timeZone,e);switch(t){case"x":return Kr(i);case"xxxx":case"xx":return Tn(i);default:return Tn(i,":")}},O:function(e,t,n){const i=So(n.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+wp(i,":");default:return"GMT"+Tn(i,":")}},z:function(e,t,n){switch(t){case"z":case"zz":case"zzz":return Wr("short",e,n);default:return Wr("long",e,n)}}};function So(e,t){const n=e?ei(e,t,!0)/_p:t?.getTimezoneOffset()??0;if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+e);return n}function Zi(e,t){const n=e<0?"-":"";let i=Math.abs(e).toString();for(;i.length<t;)i="0"+i;return n+i}function Tn(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=Zi(Math.floor(i/60),2),o=Zi(Math.floor(i%60),2);return n+s+t+o}function Kr(e,t){return e%60===0?(e>0?"-":"+")+Zi(Math.abs(e)/60,2):Tn(e,t)}function wp(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=Math.floor(i/60),o=i%60;return o===0?n+String(s):n+String(s)+t+Zi(o,2)}function Zr(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const Qr=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Mo=36e5,Jr=6e4,kp=2,jt={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Qr};function Qi(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(e===null)return new Date(NaN);const n=t.additionalDigits==null?kp:Number(t.additionalDigits);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]")return new Date(e.getTime());if(typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]")return new Date(e);if(Object.prototype.toString.call(e)!=="[object String]")return new Date(NaN);const i=Tp(e),{year:s,restDateString:o}=vp(i.date,n),a=Sp(o,s);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const r=a.getTime();let l=0,c;if(i.time&&(l=Mp(i.time),l===null||isNaN(l)))return new Date(NaN);if(i.timeZone||t.timeZone){if(c=ei(i.timeZone||t.timeZone,new Date(r+l)),isNaN(c))return new Date(NaN)}else c=Zr(new Date(r+l)),c=Zr(new Date(r+l+c));return new Date(r+l+c)}else return new Date(NaN)}function Tp(e){const t={};let n=jt.dateTimePattern.exec(e),i;if(n?(t.date=n[1],i=n[3]):(n=jt.datePattern.exec(e),n?(t.date=n[1],i=n[2]):(t.date=null,i=e)),i){const s=jt.timeZone.exec(i);s?(t.time=i.replace(s[1],""),t.timeZone=s[1].trim()):t.time=i}return t}function vp(e,t){if(e){const n=jt.YYY[t],i=jt.YYYYY[t];let s=jt.YYYY.exec(e)||i.exec(e);if(s){const o=s[1];return{year:parseInt(o,10),restDateString:e.slice(o.length)}}if(s=jt.YY.exec(e)||n.exec(e),s){const o=s[1];return{year:parseInt(o,10)*100,restDateString:e.slice(o.length)}}}return{year:null}}function Sp(e,t){if(t===null)return null;let n,i,s;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let o=jt.MM.exec(e);if(o)return n=new Date(0),i=parseInt(o[1],10)-1,nl(t,i)?(n.setUTCFullYear(t,i),n):new Date(NaN);if(o=jt.DDD.exec(e),o){n=new Date(0);const a=parseInt(o[1],10);return Op(t,a)?(n.setUTCFullYear(t,0,a),n):new Date(NaN)}if(o=jt.MMDD.exec(e),o){n=new Date(0),i=parseInt(o[1],10)-1;const a=parseInt(o[2],10);return nl(t,i,a)?(n.setUTCFullYear(t,i,a),n):new Date(NaN)}if(o=jt.Www.exec(e),o)return s=parseInt(o[1],10)-1,il(s)?tl(t,s):new Date(NaN);if(o=jt.WwwD.exec(e),o){s=parseInt(o[1],10)-1;const a=parseInt(o[2],10)-1;return il(s,a)?tl(t,s,a):new Date(NaN)}return null}function Mp(e){let t,n,i=jt.HH.exec(e);if(i)return t=parseFloat(i[1].replace(",",".")),Do(t)?t%24*Mo:NaN;if(i=jt.HHMM.exec(e),i)return t=parseInt(i[1],10),n=parseFloat(i[2].replace(",",".")),Do(t,n)?t%24*Mo+n*Jr:NaN;if(i=jt.HHMMSS.exec(e),i){t=parseInt(i[1],10),n=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return Do(t,n,s)?t%24*Mo+n*Jr+s*1e3:NaN}return null}function tl(e,t,n){t=t||0,n=n||0;const i=new Date(0);i.setUTCFullYear(e,0,4);const s=i.getUTCDay()||7,o=t*7+n+1-s;return i.setUTCDate(i.getUTCDate()+o),i}const Dp=[31,28,31,30,31,30,31,31,30,31,30,31],Cp=[31,29,31,30,31,30,31,31,30,31,30,31];function el(e){return e%400===0||e%4===0&&e%100!==0}function nl(e,t,n){if(t<0||t>11)return!1;if(n!=null){if(n<1)return!1;const i=el(e);if(i&&n>Cp[t]||!i&&n>Dp[t])return!1}return!0}function Op(e,t){if(t<1)return!1;const n=el(e);return!(n&&t>366||!n&&t>365)}function il(e,t){return!(e<0||e>52||t!=null&&(t<0||t>6))}function Do(e,t,n){return!(e<0||e>=25||t!=null&&(t<0||t>=60)||n!=null&&(n<0||n>=60))}const Ap=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Pp(e,t,n={}){t=String(t);const i=t.match(Ap);if(i){const s=Qi(n.originalDate||e,n);t=i.reduce(function(o,a){if(a[0]==="'")return o;const r=o.indexOf(a),l=o[r-1]==="'",c=o.replace(a,"'"+xp[a[0]](s,a,n)+"'");return l?c.substring(0,r-1)+c.substring(r+1):c},t)}return tp(e,t,n)}function sl(e,t,n){e=Qi(e,n);const i=ei(t,e,!0),s=new Date(e.getTime()-i),o=new Date(0);return o.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),o.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),o}function Ep(e,t,n,i){return i={...i,timeZone:t,originalDate:e},Pp(sl(e,t,{timeZone:i.timeZone}),n,i)}function Rp(e,t,n){if(typeof e=="string"&&!e.match(Qr))return Qi(e,{...n,timeZone:t});e=Qi(e,n);const i=ko(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()).getTime(),s=ei(t,new Date(i));return new Date(i+s)}function Ip(e,t){return-ei(e,t)}function Lp(e,t={}){if(!e)return e;const n=t.tz||Intl.DateTimeFormat().resolvedOptions().timeZone;try{let i="MMM dd, yyy hh:mm a";t.short&&(i="MMM dd, yyy"),t.includeTZ&&(i+=" (z)");const s=new Date(e);return Ep(s,n,i)}catch{return console.error("Invalid value passed to formatTime",e),"(invalid date)"}}const Np={secondly:1e3,tenSecondly:10*1e3,thirtySecondly:30*1e3,minutely:60*1e3,fiveMinutely:300*1e3,tenMinutely:600*1e3,thirtyMinutely:1800*1e3,hourly:3600*1e3,twoHourly:7200*1e3,twelveHourly:720*60*1e3,daily:3600*24*1e3,weekly:3600*24*7*1e3,trend:0};function Ji(e){return e&&Ef.find(t=>e<=Np[t])||null}var ts=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},es={exports:{}};es.exports;var ol;function Bp(){return ol||(ol=1,(function(e,t){var n=200,i="__lodash_hash_undefined__",s=9007199254740991,o="[object Arguments]",a="[object Array]",r="[object Boolean]",l="[object Date]",c="[object Error]",u="[object Function]",h="[object GeneratorFunction]",f="[object Map]",m="[object Number]",p="[object Object]",g="[object Promise]",y="[object RegExp]",_="[object Set]",x="[object String]",T="[object Symbol]",S="[object WeakMap]",w="[object ArrayBuffer]",D="[object DataView]",v="[object Float32Array]",A="[object Float64Array]",R="[object Int8Array]",E="[object Int16Array]",k="[object Int32Array]",C="[object Uint8Array]",z="[object Uint8ClampedArray]",N="[object Uint16Array]",V="[object Uint32Array]",Y=/[\\^$.*+?()[\]{}|]/g,G=/\w*$/,st=/^\[object .+?Constructor\]$/,ot=/^(?:0|[1-9]\d*)$/,K={};K[o]=K[a]=K[w]=K[D]=K[r]=K[l]=K[v]=K[A]=K[R]=K[E]=K[k]=K[f]=K[m]=K[p]=K[y]=K[_]=K[x]=K[T]=K[C]=K[z]=K[N]=K[V]=!0,K[c]=K[u]=K[S]=!1;var U=typeof ts=="object"&&ts&&ts.Object===Object&&ts,M=typeof self=="object"&&self&&self.Object===Object&&self,P=U||M||Function("return this")(),F=t&&!t.nodeType&&t,$=F&&!0&&e&&!e.nodeType&&e,it=$&&$.exports===F;function L(b,O){return b.set(O[0],O[1]),b}function H(b,O){return b.add(O),b}function pt(b,O){for(var I=-1,j=b?b.length:0;++I<j&&O(b[I],I,b)!==!1;);return b}function dt(b,O){for(var I=-1,j=O.length,Ft=b.length;++I<j;)b[Ft+I]=O[I];return b}function rt(b,O,I,j){for(var Ft=-1,ee=b?b.length:0;++Ft<ee;)I=O(I,b[Ft],Ft,b);return I}function Dt(b,O){for(var I=-1,j=Array(b);++I<b;)j[I]=O(I);return j}function Wt(b,O){return b?.[O]}function Lt(b){var O=!1;if(b!=null&&typeof b.toString!="function")try{O=!!(b+"")}catch{}return O}function Tt(b){var O=-1,I=Array(b.size);return b.forEach(function(j,Ft){I[++O]=[Ft,j]}),I}function je(b,O){return function(I){return b(O(I))}}function pn(b){var O=-1,I=Array(b.size);return b.forEach(function(j){I[++O]=j}),I}var B=Array.prototype,X=Function.prototype,at=Object.prototype,vt=P["__core-js_shared__"],te=(function(){var b=/[^.]+$/.exec(vt&&vt.keys&&vt.keys.IE_PROTO||"");return b?"Symbol(src)_1."+b:""})(),lo=X.toString,ge=at.hasOwnProperty,jn=at.toString,tP=RegExp("^"+lo.call(ge).replace(Y,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),df=it?P.Buffer:void 0,uf=P.Symbol,hf=P.Uint8Array,eP=je(Object.getPrototypeOf,Object),nP=Object.create,iP=at.propertyIsEnumerable,sP=B.splice,ff=Object.getOwnPropertySymbols,oP=df?df.isBuffer:void 0,aP=je(Object.keys,Object),yr=Xn(P,"DataView"),qi=Xn(P,"Map"),br=Xn(P,"Promise"),_r=Xn(P,"Set"),xr=Xn(P,"WeakMap"),Gi=Xn(Object,"create"),rP=bn(yr),lP=bn(qi),cP=bn(br),dP=bn(_r),uP=bn(xr),mf=uf?uf.prototype:void 0,pf=mf?mf.valueOf:void 0;function gn(b){var O=-1,I=b?b.length:0;for(this.clear();++O<I;){var j=b[O];this.set(j[0],j[1])}}function hP(){this.__data__=Gi?Gi(null):{}}function fP(b){return this.has(b)&&delete this.__data__[b]}function mP(b){var O=this.__data__;if(Gi){var I=O[b];return I===i?void 0:I}return ge.call(O,b)?O[b]:void 0}function pP(b){var O=this.__data__;return Gi?O[b]!==void 0:ge.call(O,b)}function gP(b,O){var I=this.__data__;return I[b]=Gi&&O===void 0?i:O,this}gn.prototype.clear=hP,gn.prototype.delete=fP,gn.prototype.get=mP,gn.prototype.has=pP,gn.prototype.set=gP;function Me(b){var O=-1,I=b?b.length:0;for(this.clear();++O<I;){var j=b[O];this.set(j[0],j[1])}}function yP(){this.__data__=[]}function bP(b){var O=this.__data__,I=co(O,b);if(I<0)return!1;var j=O.length-1;return I==j?O.pop():sP.call(O,I,1),!0}function _P(b){var O=this.__data__,I=co(O,b);return I<0?void 0:O[I][1]}function xP(b){return co(this.__data__,b)>-1}function wP(b,O){var I=this.__data__,j=co(I,b);return j<0?I.push([b,O]):I[j][1]=O,this}Me.prototype.clear=yP,Me.prototype.delete=bP,Me.prototype.get=_P,Me.prototype.has=xP,Me.prototype.set=wP;function qn(b){var O=-1,I=b?b.length:0;for(this.clear();++O<I;){var j=b[O];this.set(j[0],j[1])}}function kP(){this.__data__={hash:new gn,map:new(qi||Me),string:new gn}}function TP(b){return uo(this,b).delete(b)}function vP(b){return uo(this,b).get(b)}function SP(b){return uo(this,b).has(b)}function MP(b,O){return uo(this,b).set(b,O),this}qn.prototype.clear=kP,qn.prototype.delete=TP,qn.prototype.get=vP,qn.prototype.has=SP,qn.prototype.set=MP;function Gn(b){this.__data__=new Me(b)}function DP(){this.__data__=new Me}function CP(b){return this.__data__.delete(b)}function OP(b){return this.__data__.get(b)}function AP(b){return this.__data__.has(b)}function PP(b,O){var I=this.__data__;if(I instanceof Me){var j=I.__data__;if(!qi||j.length<n-1)return j.push([b,O]),this;I=this.__data__=new qn(j)}return I.set(b,O),this}Gn.prototype.clear=DP,Gn.prototype.delete=CP,Gn.prototype.get=OP,Gn.prototype.has=AP,Gn.prototype.set=PP;function EP(b,O){var I=Tr(b)||nE(b)?Dt(b.length,String):[],j=I.length,Ft=!!j;for(var ee in b)ge.call(b,ee)&&!(Ft&&(ee=="length"||QP(ee,j)))&&I.push(ee);return I}function gf(b,O,I){var j=b[O];(!(ge.call(b,O)&&xf(j,I))||I===void 0&&!(O in b))&&(b[O]=I)}function co(b,O){for(var I=b.length;I--;)if(xf(b[I][0],O))return I;return-1}function RP(b,O){return b&&yf(O,vr(O),b)}function wr(b,O,I,j,Ft,ee,De){var ne;if(j&&(ne=ee?j(b,Ft,ee,De):j(b)),ne!==void 0)return ne;if(!ho(b))return b;var Tf=Tr(b);if(Tf){if(ne=XP(b),!O)return jP(b,ne)}else{var Kn=yn(b),vf=Kn==u||Kn==h;if(sE(b))return zP(b,O);if(Kn==p||Kn==o||vf&&!ee){if(Lt(b))return ee?b:{};if(ne=KP(vf?{}:b),!O)return qP(b,RP(ne,b))}else{if(!K[Kn])return ee?b:{};ne=ZP(b,Kn,wr,O)}}De||(De=new Gn);var Sf=De.get(b);if(Sf)return Sf;if(De.set(b,ne),!Tf)var Mf=I?GP(b):vr(b);return pt(Mf||b,function(Sr,fo){Mf&&(fo=Sr,Sr=b[fo]),gf(ne,fo,wr(Sr,O,I,j,fo,b,De))}),ne}function IP(b){return ho(b)?nP(b):{}}function LP(b,O,I){var j=O(b);return Tr(b)?j:dt(j,I(b))}function NP(b){return jn.call(b)}function BP(b){if(!ho(b)||tE(b))return!1;var O=kf(b)||Lt(b)?tP:st;return O.test(bn(b))}function FP(b){if(!_f(b))return aP(b);var O=[];for(var I in Object(b))ge.call(b,I)&&I!="constructor"&&O.push(I);return O}function zP(b,O){if(O)return b.slice();var I=new b.constructor(b.length);return b.copy(I),I}function kr(b){var O=new b.constructor(b.byteLength);return new hf(O).set(new hf(b)),O}function UP(b,O){var I=O?kr(b.buffer):b.buffer;return new b.constructor(I,b.byteOffset,b.byteLength)}function VP(b,O,I){var j=O?I(Tt(b),!0):Tt(b);return rt(j,L,new b.constructor)}function HP(b){var O=new b.constructor(b.source,G.exec(b));return O.lastIndex=b.lastIndex,O}function $P(b,O,I){var j=O?I(pn(b),!0):pn(b);return rt(j,H,new b.constructor)}function YP(b){return pf?Object(pf.call(b)):{}}function WP(b,O){var I=O?kr(b.buffer):b.buffer;return new b.constructor(I,b.byteOffset,b.length)}function jP(b,O){var I=-1,j=b.length;for(O||(O=Array(j));++I<j;)O[I]=b[I];return O}function yf(b,O,I,j){I||(I={});for(var Ft=-1,ee=O.length;++Ft<ee;){var De=O[Ft],ne=void 0;gf(I,De,ne===void 0?b[De]:ne)}return I}function qP(b,O){return yf(b,bf(b),O)}function GP(b){return LP(b,vr,bf)}function uo(b,O){var I=b.__data__;return JP(O)?I[typeof O=="string"?"string":"hash"]:I.map}function Xn(b,O){var I=Wt(b,O);return BP(I)?I:void 0}var bf=ff?je(ff,Object):rE,yn=NP;(yr&&yn(new yr(new ArrayBuffer(1)))!=D||qi&&yn(new qi)!=f||br&&yn(br.resolve())!=g||_r&&yn(new _r)!=_||xr&&yn(new xr)!=S)&&(yn=function(b){var O=jn.call(b),I=O==p?b.constructor:void 0,j=I?bn(I):void 0;if(j)switch(j){case rP:return D;case lP:return f;case cP:return g;case dP:return _;case uP:return S}return O});function XP(b){var O=b.length,I=b.constructor(O);return O&&typeof b[0]=="string"&&ge.call(b,"index")&&(I.index=b.index,I.input=b.input),I}function KP(b){return typeof b.constructor=="function"&&!_f(b)?IP(eP(b)):{}}function ZP(b,O,I,j){var Ft=b.constructor;switch(O){case w:return kr(b);case r:case l:return new Ft(+b);case D:return UP(b,j);case v:case A:case R:case E:case k:case C:case z:case N:case V:return WP(b,j);case f:return VP(b,j,I);case m:case x:return new Ft(b);case y:return HP(b);case _:return $P(b,j,I);case T:return YP(b)}}function QP(b,O){return O=O??s,!!O&&(typeof b=="number"||ot.test(b))&&b>-1&&b%1==0&&b<O}function JP(b){var O=typeof b;return O=="string"||O=="number"||O=="symbol"||O=="boolean"?b!=="__proto__":b===null}function tE(b){return!!te&&te in b}function _f(b){var O=b&&b.constructor,I=typeof O=="function"&&O.prototype||at;return b===I}function bn(b){if(b!=null){try{return lo.call(b)}catch{}try{return b+""}catch{}}return""}function eE(b){return wr(b,!0,!0)}function xf(b,O){return b===O||b!==b&&O!==O}function nE(b){return iE(b)&&ge.call(b,"callee")&&(!iP.call(b,"callee")||jn.call(b)==o)}var Tr=Array.isArray;function wf(b){return b!=null&&oE(b.length)&&!kf(b)}function iE(b){return aE(b)&&wf(b)}var sE=oP||lE;function kf(b){var O=ho(b)?jn.call(b):"";return O==u||O==h}function oE(b){return typeof b=="number"&&b>-1&&b%1==0&&b<=s}function ho(b){var O=typeof b;return!!b&&(O=="object"||O=="function")}function aE(b){return!!b&&typeof b=="object"}function vr(b){return wf(b)?EP(b):FP(b)}function rE(){return[]}function lE(){return!1}e.exports=eE})(es,es.exports)),es.exports}Bp();const oe=(e,t)=>new Date(e.getTime()-Ip(t,e));class Rt{timeframeText;key;display;timeframeLength;allowedTiers;defaultResponseGranularity;dataGranularity;isRelative;fineGrainedDefaultGranularity;_startCustom;_endCustom;_allowedGranularitiesOverride;constructor(t){this.display=t.display,this.timeframeText=t.timeframeText,this.key=t.key,this.timeframeLength=t.timeframeLength,this.allowedTiers=t.allowedTiers,this.defaultResponseGranularity=t.defaultResponseGranularity,this.dataGranularity=t.dataGranularity,this.isRelative=t.isRelative,this._startCustom=t.startCustom,this._endCustom=t.endCustom,this._allowedGranularitiesOverride=t.allowedGranularitiesOverride,this.fineGrainedDefaultGranularity=t.fineGrainedDefaultGranularity}rawEnd(t){return this._endCustom||new Date}rawStart(t){return this._startCustom||new Date(this.rawEnd().getTime()-this.timeframeLengthMs())}timeframeLengthMs(){return this.timeframeLength()*1e3}maximumTimeframeLength(){return this.timeframeLength()}allowedGranularities(t){if(this._allowedGranularitiesOverride&&t)return new Set(this._allowedGranularitiesOverride);const n=new Set,i=this.maximumTimeframeLength()/3600;return i<=6&&n.add("minutely"),i>=2&&i<=168&&n.add("hourly"),i>=48&&n.add("daily"),i>=672&&n.add("weekly"),n}cacheKey(){return this.key!=="custom"?this.key:`${this.rawStart().toISOString()}-${this.rawEnd().toISOString()}`}v4Query(t){return this.key==="custom"?{type:"absolute",start:this.rawStart(),end:this.rawEnd(),tz:t}:{type:"relative",time_range:this.key,tz:t}}tzAdjustedDate(t){if(!t)return new Date;const n=Rp(new Date,new Intl.DateTimeFormat().resolvedOptions().timeZone);return sl(n,t)}}class Fp extends Rt{rawStart(t){let n=ye(this.tzAdjustedDate(t),{weekStartsOn:1});return t&&(n=oe(n,t)),n}maximumTimeframeLength(){return 3600*24*7}}class zp extends Rt{rawStart(t){let n=kn(this.tzAdjustedDate(t));return t&&(n=oe(n,t)),n}maximumTimeframeLength(){return 3600*24*31}}class Up extends Rt{rawStart(t){let n=wn(this.tzAdjustedDate(t));return t&&(n=oe(n,t)),n}maximumTimeframeLength(){return 3600*24*92}}class Vp extends Rt{rawStart(t){let n=new Date(this.tzAdjustedDate(t).getFullYear(),0,1);return t&&(n=oe(n,t)),n}maximumTimeframeLength(){return 3600*24*366}}class Hp extends Rt{rawEnd(t){let n=ye(this.tzAdjustedDate(t),{weekStartsOn:1});return t&&(n=oe(n,t)),n}rawStart(t){const n=this.tzAdjustedDate(t);let i=ye(n.setDate(n.getDate()-7),{weekStartsOn:1});return t&&(i=oe(i,t)),i}}class $p extends Rt{rawEnd(t){let n=wn(this.tzAdjustedDate(t));return t&&(n=oe(n,t)),n}rawStart(t){let n=wn(Yr(this.tzAdjustedDate(t)));return t&&(n=oe(n,t)),n}}class Yp extends Rt{rawEnd(t){let n=kn(this.tzAdjustedDate(t));return t&&(n=oe(n,t)),n}rawStart(t){let n=kn($r(this.tzAdjustedDate(t)));return t&&(n=oe(n,t)),n}}class Wp extends Rt{rawEnd(t){let n=new Date(this.tzAdjustedDate(t).getFullYear(),0,1);return t&&(n=oe(n,t)),n}rawStart(t){let n=new Date(this.tzAdjustedDate(t).getFullYear()-1,0,1);return t&&(n=oe(n,t)),n}}W.FIFTEEN_MIN,new Rt({key:W.FIFTEEN_MIN,display:"Last 15 minutes",timeframeText:"15 minutes",timeframeLength:()=>900,defaultResponseGranularity:"minutely",dataGranularity:"minutely",isRelative:!0,fineGrainedDefaultGranularity:"thirtySecondly",allowedTiers:["free","trial","plus","enterprise"],allowedGranularitiesOverride:["tenSecondly","thirtySecondly","minutely"]}),W.ONE_HOUR,new Rt({key:W.ONE_HOUR,display:"Last hour",timeframeText:"One hour",timeframeLength:()=>3600*1,defaultResponseGranularity:"minutely",dataGranularity:"minutely",isRelative:!0,fineGrainedDefaultGranularity:"minutely",allowedTiers:["free","trial","plus","enterprise"],allowedGranularitiesOverride:["tenSecondly","thirtySecondly","minutely","fiveMinutely","tenMinutely"]}),W.SIX_HOUR,new Rt({key:W.SIX_HOUR,display:"Last 6 hours",timeframeText:"6 hours",timeframeLength:()=>3600*6,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,fineGrainedDefaultGranularity:"fiveMinutely",allowedTiers:["free","trial","plus","enterprise"],allowedGranularitiesOverride:["thirtySecondly","minutely","fiveMinutely","tenMinutely","thirtyMinutely","hourly"]}),W.TWELVE_HOUR,new Rt({key:W.TWELVE_HOUR,display:"Last 12 hours",timeframeText:"12 hours",timeframeLength:()=>3600*12,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,fineGrainedDefaultGranularity:"tenMinutely",allowedTiers:["free","trial","plus","enterprise"],allowedGranularitiesOverride:["minutely","fiveMinutely","tenMinutely","thirtyMinutely","hourly"]}),W.ONE_DAY,new Rt({key:W.ONE_DAY,display:"Last 24 hours",timeframeText:"24 hours",timeframeLength:()=>3600*24,defaultResponseGranularity:"hourly",dataGranularity:"hourly",isRelative:!0,fineGrainedDefaultGranularity:"thirtyMinutely",allowedTiers:["free","trial","plus","enterprise"],allowedGranularitiesOverride:["fiveMinutely","tenMinutely","thirtyMinutely","hourly"]}),W.SEVEN_DAY,new Rt({key:W.SEVEN_DAY,display:"Last 7 days",timeframeText:"7 days",timeframeLength:()=>3600*24*7,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,fineGrainedDefaultGranularity:"twoHourly",allowedTiers:["trial","plus","enterprise"],allowedGranularitiesOverride:["thirtyMinutely","hourly","twoHourly","twelveHourly","daily"]}),W.THIRTY_DAY,new Rt({key:W.THIRTY_DAY,display:"Last 30 days",timeframeText:"30 days",timeframeLength:()=>3600*24*30,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,fineGrainedDefaultGranularity:"twelveHourly",allowedTiers:["trial","plus","enterprise"],allowedGranularitiesOverride:["hourly","twoHourly","twelveHourly","daily","weekly"]}),W.NINETY_DAY,new Rt({key:W.NINETY_DAY,display:"Last 90 days",timeframeText:"90 days",timeframeLength:()=>3600*24*90,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,fineGrainedDefaultGranularity:"daily",allowedTiers:["trial","plus","enterprise"],allowedGranularitiesOverride:["hourly","twoHourly","twelveHourly","daily","weekly"]}),W.ONE_HUNDRED_EIGHTY_DAY,new Rt({key:W.ONE_HUNDRED_EIGHTY_DAY,display:"Last 180 days",timeframeText:"180 days",timeframeLength:()=>3600*24*180,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,fineGrainedDefaultGranularity:"daily",allowedTiers:["trial","plus","enterprise"],allowedGranularitiesOverride:["hourly","twoHourly","twelveHourly","daily","weekly"]}),W.ONE_YEAR,new Rt({key:W.ONE_YEAR,display:"Last 365 days",timeframeText:"365 days",timeframeLength:()=>3600*24*365,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!0,fineGrainedDefaultGranularity:"daily",allowedTiers:["trial","plus","enterprise"],allowedGranularitiesOverride:["hourly","twoHourly","twelveHourly","daily","weekly"]}),W.CURRENT_WEEK,new Fp({key:W.CURRENT_WEEK,display:"This week",timeframeText:"Week",timeframeLength:()=>{const e=ye(new Date,{weekStartsOn:1});return(_n(Ki(new Date,1)).getTime()-e.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,fineGrainedDefaultGranularity:"twoHourly",allowedTiers:["plus","enterprise"],allowedGranularitiesOverride:["thirtyMinutely","hourly","twoHourly","twelveHourly","daily"]}),W.CURRENT_MONTH,new zp({key:W.CURRENT_MONTH,display:"This month",timeframeText:"Month",timeframeLength:()=>{const e=kn(new Date);return(_n(Ki(new Date,1)).getTime()-e.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),W.CURRENT_QUARTER,new Up({key:W.CURRENT_QUARTER,display:"This quarter",timeframeText:"Quarter",timeframeLength:()=>{const e=wn(new Date);return(_n(Ki(new Date,1)).getTime()-e.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),W.CURRENT_YEAR,new Vp({key:W.CURRENT_YEAR,display:"This year",timeframeText:"Year",timeframeLength:()=>{const e=new Date(new Date().getFullYear(),0,1);return(_n(Ki(new Date,1)).getTime()-e.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),W.PREVIOUS_WEEK,new Hp({key:W.PREVIOUS_WEEK,display:"Previous week",timeframeText:"Week",timeframeLength:()=>3600*24*7,defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,fineGrainedDefaultGranularity:"twoHourly",allowedTiers:["plus","enterprise"],allowedGranularitiesOverride:["thirtyMinutely","hourly","twoHourly","twelveHourly","daily"]}),W.PREVIOUS_MONTH,new Yp({key:W.PREVIOUS_MONTH,display:"Previous month",timeframeText:"Month",timeframeLength:()=>{let e=0;const t=kn(new Date),n=kn($r(new Date));return t.getTimezoneOffset()!==n.getTimezoneOffset()&&(e=al(t,n)),3600*24*ip(new Date().setMonth(new Date().getMonth()-1))+Hr(e)},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),W.PREVIOUS_QUARTER,new $p({key:W.PREVIOUS_QUARTER,display:"Previous quarter",timeframeText:"Quarter",timeframeLength:()=>{const e=wn(new Date),t=wn(Yr(new Date));return(e.getTime()-t.getTime())/1e3},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]}),W.PREVIOUS_YEAR,new Wp({key:W.PREVIOUS_YEAR,display:"Previous year",timeframeText:"Year",timeframeLength:()=>{const e=new Date(new Date().getFullYear(),0,1),t=new Date(new Date().getFullYear()-1,0,1);let n=0;return e.getTimezoneOffset()!==t.getTimezoneOffset()&&(n=al(e,t)),3600*24*(365+(t.getFullYear()%4===0?1:0))+Hr(n)},defaultResponseGranularity:"daily",dataGranularity:"daily",isRelative:!1,allowedTiers:["plus","enterprise"]});function al(e,t){return op(e.getTimezoneOffset()-t.getTimezoneOffset())}W.FIFTEEN_MIN,W.ONE_HOUR,W.SIX_HOUR,W.TWELVE_HOUR,W.ONE_DAY,W.SEVEN_DAY,W.FIFTEEN_MIN,W.ONE_HOUR,W.SIX_HOUR,W.TWELVE_HOUR,W.ONE_DAY,W.SEVEN_DAY,W.THIRTY_DAY,W.NINETY_DAY,W.ONE_HUNDRED_EIGHTY_DAY,W.ONE_YEAR,W.CURRENT_WEEK,W.CURRENT_MONTH,W.CURRENT_QUARTER,W.CURRENT_YEAR,W.PREVIOUS_WEEK,W.PREVIOUS_MONTH,W.PREVIOUS_QUARTER,W.PREVIOUS_YEAR;const jp=new Map(Ar.map(e=>[e.code,{code:e.code,name:e.name}])),Co=e=>jp.get(e)?.name||e,rl=1e3,qp=1e4,ll=1e6,cl=1e9,dl=1e12,ns=(e,t)=>{if(t.separator===!1||e<1e3)return e.toString();const n=typeof t.separator=="string"?t.separator:",",i=[];return Math.round(e).toString().split("").reverse().forEach((s,o)=>{o&&o%3===0&&i.push(n),i.push(s)}),i.reverse().join("")},ni=(e,t,n)=>{const i=e/t,s=n.round?"round":"floor";if(n.decimal===!1)return Math[s](i).toString();let o;n.precision?o=i:o=i<10?Math[s](i*10)/10:Math[s](i);let a=o.toString();return typeof n.decimal=="string"&&(a=a.replace(".",n.decimal)),a};function is(e,t={}){let n;const i=e<0;i&&(e=Math.abs(e)),t.precision&&(e=parseFloat(e.toPrecision(t.precision)));const s=t.min10k?qp:rl;return e<s||t.precision&&t.precision>Math.log10(e)?n=ns(ni(e,1,t),t):e<ll?n=`${ni(e,rl,t)}k`:e<cl?n=`${ni(e,ll,t)}m`:e<dl?n=`${ns(ni(e,cl,t),t)}b`:n=`${ns(ni(e,dl,t),t)}t`,i&&(n=`-${n}`),t.capital&&(n=n.toUpperCase()),t.prefix&&(n=`${t.prefix}${n}`),t.suffix&&(n=`${n}${t.suffix}`),n}is.addCommas=ns;const Gp=typeof document<"u"&&document.documentElement?.lang||"en-US",ss=new Intl.NumberFormat(Gp),Xp=new Set(["%"]),Kp=e=>Xp.has(e)?"flush":"spaced";function le({i18n:e}){const t=(s,o)=>{if(isNaN(s))return"0 B";const a=o?Math.pow(2,50):1e15,r=o?Math.pow(2,40):1e12,l=o?Math.pow(2,30):1e9,c=o?Math.pow(2,20):1e6,u=o?Math.pow(2,10):1e3;let h;return s>=a?h=e.formatNumber(Number.parseFloat((s/a).toPrecision(3)),{style:"unit",unit:"petabyte",unitDisplay:"narrow"}):s>=r?h=e.formatNumber(Number.parseFloat((s/r).toPrecision(3)),{style:"unit",unit:"terabyte",unitDisplay:"narrow"}):s>=l?h=e.formatNumber(Number.parseFloat((s/l).toPrecision(3)),{style:"unit",unit:"gigabyte",unitDisplay:"narrow"}):s>=c?h=e.formatNumber(Number.parseFloat((s/c).toPrecision(3)),{style:"unit",unit:"megabyte",unitDisplay:"narrow"}):s>=u?h=e.formatNumber(Number.parseFloat((s/u).toPrecision(3)),{style:"unit",unit:"kilobyte",unitDisplay:"narrow"}):h=e.formatNumber(Number.parseFloat(s.toPrecision(3)),{style:"unit",unit:"byte",unitDisplay:"narrow"}),h.replace(/([a-zA-Z]*)$/," $1")},n=(s,o="USD")=>isNaN(s)?o==="USD"?"$0.00":`${s}`:s>=.01||o!=="USD"?e.formatNumber(s,{style:"currency",currency:o}):s<1e-4?"< $0.0001":`$${Number.parseFloat(s.toPrecision(4))}`,i=(s,o,a)=>{if(!a)return s;const r=Kp(o)==="flush"?"":" ";return`${s}${r}${a}`};return{formatUnit:(s,o,{isBytes1024:a=!1,currency:r="USD",approximate:l=!1,translateUnit:c=u=>u}={})=>{const u=c(o,s);switch(o){case"bytes":return t(s,a);case"usd":return n(s,r);default:return isNaN(s)?`${s}`:l?i(is(s,{capital:!0}),o,u):s<.01?i(`${Number.parseFloat(s.toPrecision(4))}`,o,u):i(ss.format(Number.parseFloat(s.toFixed(2))),o,u)}},formatBytes:t,formatCost:n,formatRange:(s,o,a,{isBytes1024:r=!1,currency:l="USD",approximate:c=!1,translateUnit:u=h=>h}={})=>{const h=u(a,o);switch(a){case"bytes":return`${t(s,r)} - ${t(o,r)}`;case"usd":return`${n(s,l)} - ${n(o,l)}`;default:if(isNaN(s)||isNaN(o))return`${s} - ${o}`;if(c)return i(`${is(s,{capital:!0})} - ${is(o,{capital:!0})}`,a,h)}const f=s>=.01?`${ss.format(Number.parseFloat(s.toFixed(2)))}`:`${Number.parseFloat(s.toPrecision(4))}`,m=o>=.01?`${ss.format(Number.parseFloat(o.toFixed(2)))}`:`${Number.parseFloat(o.toPrecision(4))}`;return i(`${f} - ${m}`,a,h)}}}const ul="#d60027",hl="#ffe5e5",Zp="#f1f0ff",Qp="#e0e4ea",fl="#0d0e14",Jp="#ad000e",Oo="#6c7489",ml="#52596e",tg="#007d60",eg="#995c00",ng="'Inter', Roboto, Helvetica, sans-serif",vn="16px",ig="20px",sg="40px",og="#bee2ff",ag="#8fc1ff",rg="#5f9aff",lg="#306fff",cg="#b5ffee",dg="#00fabe",ug="#00d6a4",hg="#00a17b",fg="#007d60",mg="#005944",pg="#b5ffee",gg="#00fabe",yg="#b5ffee",bg="#00a17b",_g="#fff296",xg="#ffe04b",wg="#ffc400",kg="#b37600",Tg="#995c00",vg="#804400",Sg="#fff296",Mg="#ffe04b",Dg="#ffc2b3",Cg="#ff9877",Og="#ff723c",Ag="#f75008",Pg="#d13500",Eg="#a31f00",Rg="#ffc2b3",Ig="#ff9877",Lg="#ff723c",Ng="#f75008",Bg="#d13500",Fg="#a31f00",zg="#ffc2b3",Ug="#ff9877",Vg="#ff723c",Hg="#f75008",$g="#d13500",Yg="#a31f00",Wg="#ffc2b3",jg="#ff9877",qg="#ff723c",Gg="#f75008",Xg="#d13500",Kg="#a31f00",Zg="#ffc2b3",Qg="#ff9877",Jg="#ff723c",ty="#f75008",ey="#d13500",ny="#ffabab",iy="#ff7272",sy="#ff3954",oy="#f50045",ay="#d60027",ry="#ad000e",ly="#ffabab",cy="#ff7272",dy="#ff3954",uy="#f50045",hy="#d60027",fy="#eefaff",my="#ecfffb",py="#fffce0",gy="#fff1ef",yy="#ffe5e5",by="#5f9aff",_y="#00d6a4",xy="#ffc400",wy="#ff723c",ky="#ff3954",pl=6048e5,Ty=864e5,ii=6e4,Sn=36e5,vy=1e3,gl=Symbol.for("constructDateFrom");function St(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&gl in e?e[gl](t):e instanceof Date?new e.constructor(t):new Date(t)}function J(e,t){return St(t||e,e)}function os(e,t,n){const i=J(e,n?.in);return isNaN(t)?St(n?.in||e,NaN):(t&&i.setDate(i.getDate()+t),i)}function Ao(e,t,n){const i=J(e,n?.in);if(isNaN(t))return St(e,NaN);if(!t)return i;const s=i.getDate(),o=St(e,i.getTime());o.setMonth(i.getMonth()+t+1,0);const a=o.getDate();return s>=a?o:(i.setFullYear(o.getFullYear(),o.getMonth(),s),i)}function Po(e,t,n){return St(e,+J(e)+t)}function Sy(e,t,n){return Po(e,t*Sn)}let My={};function Ke(){return My}function ce(e,t){const n=Ke(),i=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=J(e,t?.in),o=s.getDay(),a=(o<i?7:0)+o-i;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function Mn(e,t){return ce(e,{...t,weekStartsOn:1})}function yl(e,t){const n=J(e,t?.in),i=n.getFullYear(),s=St(n,0);s.setFullYear(i+1,0,4),s.setHours(0,0,0,0);const o=Mn(s),a=St(n,0);a.setFullYear(i,0,4),a.setHours(0,0,0,0);const r=Mn(a);return n.getTime()>=o.getTime()?i+1:n.getTime()>=r.getTime()?i:i-1}function as(e){const t=J(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Ze(e,...t){const n=St.bind(null,t.find(i=>typeof i=="object"));return t.map(n)}function Eo(e,t){const n=J(e,t?.in);return n.setHours(0,0,0,0),n}function bl(e,t,n){const[i,s]=Ze(n?.in,e,t),o=Eo(i),a=Eo(s),r=+o-as(o),l=+a-as(a);return Math.round((r-l)/Ty)}function Dy(e,t){const n=yl(e,t),i=St(e,0);return i.setFullYear(n,0,4),i.setHours(0,0,0,0),Mn(i)}function Cy(e,t,n){const i=J(e,n?.in);return i.setTime(i.getTime()+t*ii),i}function Oy(e,t,n){return Ao(e,t*3,n)}function Ay(e,t,n){return Po(e,t*1e3)}function Py(e,t,n){return os(e,t*7,n)}function Ey(e,t,n){return Ao(e,t*12,n)}function si(e,t){const n=+J(e)-+J(t);return n<0?-1:n>0?1:n}function Ry(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Ro(e){return!(!Ry(e)&&typeof e!="number"||isNaN(+J(e)))}function Iy(e,t,n){const[i,s]=Ze(n?.in,e,t),o=i.getFullYear()-s.getFullYear(),a=i.getMonth()-s.getMonth();return o*12+a}function Ly(e,t,n){const[i,s]=Ze(n?.in,e,t);return i.getFullYear()-s.getFullYear()}function _l(e,t,n){const[i,s]=Ze(n?.in,e,t),o=xl(i,s),a=Math.abs(bl(i,s));i.setDate(i.getDate()-o*a);const r=+(xl(i,s)===-o),l=o*(a-r);return l===0?0:l}function xl(e,t){const n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function oi(e){return t=>{const i=(e?Math[e]:Math.trunc)(t);return i===0?0:i}}function Ny(e,t,n){const[i,s]=Ze(n?.in,e,t),o=(+i-+s)/Sn;return oi(n?.roundingMethod)(o)}function Io(e,t){return+J(e)-+J(t)}function By(e,t,n){const i=Io(e,t)/ii;return oi(n?.roundingMethod)(i)}function wl(e,t){const n=J(e,t?.in);return n.setHours(23,59,59,999),n}function kl(e,t){const n=J(e,t?.in),i=n.getMonth();return n.setFullYear(n.getFullYear(),i+1,0),n.setHours(23,59,59,999),n}function Fy(e,t){const n=J(e,t?.in);return+wl(n,t)==+kl(n,t)}function Tl(e,t,n){const[i,s,o]=Ze(n?.in,e,e,t),a=si(s,o),r=Math.abs(Iy(s,o));if(r<1)return 0;s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-a*r);let l=si(s,o)===-a;Fy(i)&&r===1&&si(i,o)===1&&(l=!1);const c=a*(r-+l);return c===0?0:c}function zy(e,t,n){const i=Tl(e,t,n)/3;return oi(n?.roundingMethod)(i)}function Uy(e,t,n){const i=Io(e,t)/1e3;return oi(n?.roundingMethod)(i)}function Vy(e,t,n){const i=_l(e,t,n)/7;return oi(n?.roundingMethod)(i)}function Hy(e,t,n){const[i,s]=Ze(n?.in,e,t),o=si(i,s),a=Math.abs(Ly(i,s));i.setFullYear(1584),s.setFullYear(1584);const r=si(i,s)===-o,l=o*(a-+r);return l===0?0:l}function $y(e,t){const n=J(e,t?.in),i=n.getMonth(),s=i-i%3;return n.setMonth(s,1),n.setHours(0,0,0,0),n}function Yy(e,t){const n=J(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Wy(e,t){const n=J(e,t?.in),i=n.getFullYear();return n.setFullYear(i+1,0,0),n.setHours(23,59,59,999),n}function vl(e,t){const n=J(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function jy(e,t){const n=J(e,t?.in);return n.setMinutes(59,59,999),n}function qy(e,t){const n=Ke(),i=n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=J(e,t?.in),o=s.getDay(),a=(o<i?-7:0)+6-(o-i);return s.setDate(s.getDate()+a),s.setHours(23,59,59,999),s}function Gy(e,t){const n=J(e,t?.in);return n.setSeconds(59,999),n}function Xy(e,t){const n=J(e,t?.in),i=n.getMonth(),s=i-i%3+3;return n.setMonth(s,0),n.setHours(23,59,59,999),n}function Ky(e,t){const n=J(e,t?.in);return n.setMilliseconds(999),n}const Zy={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Qy=(e,t,n)=>{let i;const s=Zy[e];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+i:i+" ago":i};function Lo(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Jy={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},t0={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},e0={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},n0={date:Lo({formats:Jy,defaultWidth:"full"}),time:Lo({formats:t0,defaultWidth:"full"}),dateTime:Lo({formats:e0,defaultWidth:"full"})},i0={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},s0=(e,t,n,i)=>i0[e];function ai(e){return(t,n)=>{const i=n?.context?String(n.context):"standalone";let s;if(i==="formatting"&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):a;s=e.formattingValues[r]||e.formattingValues[a]}else{const a=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;s=e.values[r]||e.values[a]}const o=e.argumentCallback?e.argumentCallback(t):t;return s[o]}}const o0={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},a0={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},r0={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},l0={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},c0={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},d0={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},u0={ordinalNumber:(e,t)=>{const n=Number(e),i=n%100;if(i>20||i<10)switch(i%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:ai({values:o0,defaultWidth:"wide"}),quarter:ai({values:a0,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ai({values:r0,defaultWidth:"wide"}),day:ai({values:l0,defaultWidth:"wide"}),dayPeriod:ai({values:c0,defaultWidth:"wide",formattingValues:d0,defaultFormattingWidth:"wide"})};function ri(e){return(t,n={})=>{const i=n.width,s=i&&e.matchPatterns[i]||e.matchPatterns[e.defaultMatchWidth],o=t.match(s);if(!o)return null;const a=o[0],r=i&&e.parsePatterns[i]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(r)?f0(r,h=>h.test(a)):h0(r,h=>h.test(a));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=t.slice(a.length);return{value:c,rest:u}}}function h0(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function f0(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function m0(e){return(t,n={})=>{const i=t.match(e.matchPattern);if(!i)return null;const s=i[0],o=t.match(e.parsePattern);if(!o)return null;let a=e.valueCallback?e.valueCallback(o[0]):o[0];a=n.valueCallback?n.valueCallback(a):a;const r=t.slice(s.length);return{value:a,rest:r}}}const p0=/^(\d+)(th|st|nd|rd)?/i,g0=/\d+/i,y0={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},b0={any:[/^b/i,/^(a|c)/i]},_0={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},x0={any:[/1/i,/2/i,/3/i,/4/i]},w0={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},k0={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},T0={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},v0={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},S0={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},M0={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},D0={ordinalNumber:m0({matchPattern:p0,parsePattern:g0,valueCallback:e=>parseInt(e,10)}),era:ri({matchPatterns:y0,defaultMatchWidth:"wide",parsePatterns:b0,defaultParseWidth:"any"}),quarter:ri({matchPatterns:_0,defaultMatchWidth:"wide",parsePatterns:x0,defaultParseWidth:"any",valueCallback:e=>e+1}),month:ri({matchPatterns:w0,defaultMatchWidth:"wide",parsePatterns:k0,defaultParseWidth:"any"}),day:ri({matchPatterns:T0,defaultMatchWidth:"wide",parsePatterns:v0,defaultParseWidth:"any"}),dayPeriod:ri({matchPatterns:S0,defaultMatchWidth:"any",parsePatterns:M0,defaultParseWidth:"any"})},Sl={code:"en-US",formatDistance:Qy,formatLong:n0,formatRelative:s0,localize:u0,match:D0,options:{weekStartsOn:0,firstWeekContainsDate:1}};function C0(e,t){const n=J(e,t?.in);return bl(n,vl(n))+1}function Ml(e,t){const n=J(e,t?.in),i=+Mn(n)-+Dy(n);return Math.round(i/pl)+1}function No(e,t){const n=J(e,t?.in),i=n.getFullYear(),s=Ke(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=St(t?.in||e,0);a.setFullYear(i+1,0,o),a.setHours(0,0,0,0);const r=ce(a,t),l=St(t?.in||e,0);l.setFullYear(i,0,o),l.setHours(0,0,0,0);const c=ce(l,t);return+n>=+r?i+1:+n>=+c?i:i-1}function O0(e,t){const n=Ke(),i=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=No(e,t),o=St(t?.in||e,0);return o.setFullYear(s,0,i),o.setHours(0,0,0,0),ce(o,t)}function Dl(e,t){const n=J(e,t?.in),i=+ce(n,t)-+O0(n,t);return Math.round(i/pl)+1}function ht(e,t){const n=e<0?"-":"",i=Math.abs(e).toString().padStart(t,"0");return n+i}const Ae={y(e,t){const n=e.getFullYear(),i=n>0?n:1-n;return ht(t==="yy"?i%100:i,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):ht(n+1,2)},d(e,t){return ht(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(e,t){return ht(e.getHours()%12||12,t.length)},H(e,t){return ht(e.getHours(),t.length)},m(e,t){return ht(e.getMinutes(),t.length)},s(e,t){return ht(e.getSeconds(),t.length)},S(e,t){const n=t.length,i=e.getMilliseconds(),s=Math.trunc(i*Math.pow(10,n-3));return ht(s,t.length)}},Dn={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Cl={G:function(e,t,n){const i=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(i,{width:"abbreviated"});case"GGGGG":return n.era(i,{width:"narrow"});default:return n.era(i,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const i=e.getFullYear(),s=i>0?i:1-i;return n.ordinalNumber(s,{unit:"year"})}return Ae.y(e,t)},Y:function(e,t,n,i){const s=No(e,i),o=s>0?s:1-s;if(t==="YY"){const a=o%100;return ht(a,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):ht(o,t.length)},R:function(e,t){const n=yl(e);return ht(n,t.length)},u:function(e,t){const n=e.getFullYear();return ht(n,t.length)},Q:function(e,t,n){const i=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return ht(i,2);case"Qo":return n.ordinalNumber(i,{unit:"quarter"});case"QQQ":return n.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(i,{width:"narrow",context:"formatting"});default:return n.quarter(i,{width:"wide",context:"formatting"})}},q:function(e,t,n){const i=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return ht(i,2);case"qo":return n.ordinalNumber(i,{unit:"quarter"});case"qqq":return n.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(i,{width:"narrow",context:"standalone"});default:return n.quarter(i,{width:"wide",context:"standalone"})}},M:function(e,t,n){const i=e.getMonth();switch(t){case"M":case"MM":return Ae.M(e,t);case"Mo":return n.ordinalNumber(i+1,{unit:"month"});case"MMM":return n.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(i,{width:"narrow",context:"formatting"});default:return n.month(i,{width:"wide",context:"formatting"})}},L:function(e,t,n){const i=e.getMonth();switch(t){case"L":return String(i+1);case"LL":return ht(i+1,2);case"Lo":return n.ordinalNumber(i+1,{unit:"month"});case"LLL":return n.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(i,{width:"narrow",context:"standalone"});default:return n.month(i,{width:"wide",context:"standalone"})}},w:function(e,t,n,i){const s=Dl(e,i);return t==="wo"?n.ordinalNumber(s,{unit:"week"}):ht(s,t.length)},I:function(e,t,n){const i=Ml(e);return t==="Io"?n.ordinalNumber(i,{unit:"week"}):ht(i,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Ae.d(e,t)},D:function(e,t,n){const i=C0(e);return t==="Do"?n.ordinalNumber(i,{unit:"dayOfYear"}):ht(i,t.length)},E:function(e,t,n){const i=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},e:function(e,t,n,i){const s=e.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return ht(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,n,i){const s=e.getDay(),o=(s-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return ht(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,n){const i=e.getDay(),s=i===0?7:i;switch(t){case"i":return String(s);case"ii":return ht(s,t.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},a:function(e,t,n){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,n){const i=e.getHours();let s;switch(i===12?s=Dn.noon:i===0?s=Dn.midnight:s=i/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,n){const i=e.getHours();let s;switch(i>=17?s=Dn.evening:i>=12?s=Dn.afternoon:i>=4?s=Dn.morning:s=Dn.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let i=e.getHours()%12;return i===0&&(i=12),n.ordinalNumber(i,{unit:"hour"})}return Ae.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Ae.H(e,t)},K:function(e,t,n){const i=e.getHours()%12;return t==="Ko"?n.ordinalNumber(i,{unit:"hour"}):ht(i,t.length)},k:function(e,t,n){let i=e.getHours();return i===0&&(i=24),t==="ko"?n.ordinalNumber(i,{unit:"hour"}):ht(i,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Ae.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Ae.s(e,t)},S:function(e,t){return Ae.S(e,t)},X:function(e,t,n){const i=e.getTimezoneOffset();if(i===0)return"Z";switch(t){case"X":return Al(i);case"XXXX":case"XX":return Qe(i);default:return Qe(i,":")}},x:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"x":return Al(i);case"xxxx":case"xx":return Qe(i);default:return Qe(i,":")}},O:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Ol(i,":");default:return"GMT"+Qe(i,":")}},z:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Ol(i,":");default:return"GMT"+Qe(i,":")}},t:function(e,t,n){const i=Math.trunc(+e/1e3);return ht(i,t.length)},T:function(e,t,n){return ht(+e,t.length)}};function Ol(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=Math.trunc(i/60),o=i%60;return o===0?n+String(s):n+String(s)+t+ht(o,2)}function Al(e,t){return e%60===0?(e>0?"-":"+")+ht(Math.abs(e)/60,2):Qe(e,t)}function Qe(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=ht(Math.trunc(i/60),2),o=ht(i%60,2);return n+s+t+o}const Pl=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},El=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Bo={p:El,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],i=n[1],s=n[2];if(!s)return Pl(e,t);let o;switch(i){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",Pl(i,t)).replace("{{time}}",El(s,t))}},A0=/^D+$/,P0=/^Y+$/,E0=["D","DD","YY","YYYY"];function Rl(e){return A0.test(e)}function Il(e){return P0.test(e)}function Fo(e,t,n){const i=R0(e,t,n);if(console.warn(i),E0.includes(e))throw new RangeError(i)}function R0(e,t,n){const i=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${i} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const I0=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,L0=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,N0=/^'([^]*?)'?$/,B0=/''/g,F0=/[a-zA-Z]/;function rs(e,t,n){const i=Ke(),s=n?.locale??i.locale??Sl,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,r=J(e,n?.in);if(!Ro(r))throw new RangeError("Invalid time value");let l=t.match(L0).map(u=>{const h=u[0];if(h==="p"||h==="P"){const f=Bo[h];return f(u,s.formatLong)}return u}).join("").match(I0).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const h=u[0];if(h==="'")return{isToken:!1,value:z0(u)};if(Cl[h])return{isToken:!0,value:u};if(h.match(F0))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:u}});s.localize.preprocessor&&(l=s.localize.preprocessor(r,l));const c={firstWeekContainsDate:o,weekStartsOn:a,locale:s};return l.map(u=>{if(!u.isToken)return u.value;const h=u.value;(!n?.useAdditionalWeekYearTokens&&Il(h)||!n?.useAdditionalDayOfYearTokens&&Rl(h))&&Fo(h,t,String(e));const f=Cl[h[0]];return f(r,h,s.localize,c)}).join("")}function z0(e){const t=e.match(N0);return t?t[1].replace(B0,"'"):e}function Ll(){return Object.assign({},Ke())}function U0(e,t){const n=J(e,t?.in).getDay();return n===0?7:n}function V0(e,t){const n=H0(t)?new t(0):St(t,0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}function H0(e){return typeof e=="function"&&e.prototype?.constructor===e}const $0=10;class Nl{subPriority=0;validate(t,n){return!0}}class Y0 extends Nl{constructor(t,n,i,s,o){super(),this.value=t,this.validateValue=n,this.setValue=i,this.priority=s,o&&(this.subPriority=o)}validate(t,n){return this.validateValue(t,this.value,n)}set(t,n,i){return this.setValue(t,n,this.value,i)}}class W0 extends Nl{priority=$0;subPriority=-1;constructor(t,n){super(),this.context=t||(i=>St(n,i))}set(t,n){return n.timestampIsSet?t:St(t,V0(t,this.context))}}class lt{run(t,n,i,s){const o=this.parse(t,n,i,s);return o?{setter:new Y0(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(t,n,i){return!0}}class j0 extends lt{priority=140;parse(t,n,i){switch(n){case"G":case"GG":case"GGG":return i.era(t,{width:"abbreviated"})||i.era(t,{width:"narrow"});case"GGGGG":return i.era(t,{width:"narrow"});default:return i.era(t,{width:"wide"})||i.era(t,{width:"abbreviated"})||i.era(t,{width:"narrow"})}}set(t,n,i){return n.era=i,t.setFullYear(i,0,1),t.setHours(0,0,0,0),t}incompatibleTokens=["R","u","t","T"]}const Ct={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},de={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function Ot(e,t){return e&&{value:t(e.value),rest:e.rest}}function kt(e,t){const n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function ue(e,t){const n=t.match(e);if(!n)return null;if(n[0]==="Z")return{value:0,rest:t.slice(1)};const i=n[1]==="+"?1:-1,s=n[2]?parseInt(n[2],10):0,o=n[3]?parseInt(n[3],10):0,a=n[5]?parseInt(n[5],10):0;return{value:i*(s*Sn+o*ii+a*vy),rest:t.slice(n[0].length)}}function Bl(e){return kt(Ct.anyDigitsSigned,e)}function Mt(e,t){switch(e){case 1:return kt(Ct.singleDigit,t);case 2:return kt(Ct.twoDigits,t);case 3:return kt(Ct.threeDigits,t);case 4:return kt(Ct.fourDigits,t);default:return kt(new RegExp("^\\d{1,"+e+"}"),t)}}function ls(e,t){switch(e){case 1:return kt(Ct.singleDigitSigned,t);case 2:return kt(Ct.twoDigitsSigned,t);case 3:return kt(Ct.threeDigitsSigned,t);case 4:return kt(Ct.fourDigitsSigned,t);default:return kt(new RegExp("^-?\\d{1,"+e+"}"),t)}}function zo(e){switch(e){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;default:return 0}}function Fl(e,t){const n=t>0,i=n?t:1-t;let s;if(i<=50)s=e||100;else{const o=i+50,a=Math.trunc(o/100)*100,r=e>=o%100;s=e+a-(r?100:0)}return n?s:1-s}function zl(e){return e%400===0||e%4===0&&e%100!==0}class q0 extends lt{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(t,n,i){const s=o=>({year:o,isTwoDigitYear:n==="yy"});switch(n){case"y":return Ot(Mt(4,t),s);case"yo":return Ot(i.ordinalNumber(t,{unit:"year"}),s);default:return Ot(Mt(n.length,t),s)}}validate(t,n){return n.isTwoDigitYear||n.year>0}set(t,n,i){const s=t.getFullYear();if(i.isTwoDigitYear){const a=Fl(i.year,s);return t.setFullYear(a,0,1),t.setHours(0,0,0,0),t}const o=!("era"in n)||n.era===1?i.year:1-i.year;return t.setFullYear(o,0,1),t.setHours(0,0,0,0),t}}class G0 extends lt{priority=130;parse(t,n,i){const s=o=>({year:o,isTwoDigitYear:n==="YY"});switch(n){case"Y":return Ot(Mt(4,t),s);case"Yo":return Ot(i.ordinalNumber(t,{unit:"year"}),s);default:return Ot(Mt(n.length,t),s)}}validate(t,n){return n.isTwoDigitYear||n.year>0}set(t,n,i,s){const o=No(t,s);if(i.isTwoDigitYear){const r=Fl(i.year,o);return t.setFullYear(r,0,s.firstWeekContainsDate),t.setHours(0,0,0,0),ce(t,s)}const a=!("era"in n)||n.era===1?i.year:1-i.year;return t.setFullYear(a,0,s.firstWeekContainsDate),t.setHours(0,0,0,0),ce(t,s)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]}class X0 extends lt{priority=130;parse(t,n){return ls(n==="R"?4:n.length,t)}set(t,n,i){const s=St(t,0);return s.setFullYear(i,0,4),s.setHours(0,0,0,0),Mn(s)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]}class K0 extends lt{priority=130;parse(t,n){return ls(n==="u"?4:n.length,t)}set(t,n,i){return t.setFullYear(i,0,1),t.setHours(0,0,0,0),t}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]}class Z0 extends lt{priority=120;parse(t,n,i){switch(n){case"Q":case"QQ":return Mt(n.length,t);case"Qo":return i.ordinalNumber(t,{unit:"quarter"});case"QQQ":return i.quarter(t,{width:"abbreviated",context:"formatting"})||i.quarter(t,{width:"narrow",context:"formatting"});case"QQQQQ":return i.quarter(t,{width:"narrow",context:"formatting"});default:return i.quarter(t,{width:"wide",context:"formatting"})||i.quarter(t,{width:"abbreviated",context:"formatting"})||i.quarter(t,{width:"narrow",context:"formatting"})}}validate(t,n){return n>=1&&n<=4}set(t,n,i){return t.setMonth((i-1)*3,1),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]}class Q0 extends lt{priority=120;parse(t,n,i){switch(n){case"q":case"qq":return Mt(n.length,t);case"qo":return i.ordinalNumber(t,{unit:"quarter"});case"qqq":return i.quarter(t,{width:"abbreviated",context:"standalone"})||i.quarter(t,{width:"narrow",context:"standalone"});case"qqqqq":return i.quarter(t,{width:"narrow",context:"standalone"});default:return i.quarter(t,{width:"wide",context:"standalone"})||i.quarter(t,{width:"abbreviated",context:"standalone"})||i.quarter(t,{width:"narrow",context:"standalone"})}}validate(t,n){return n>=1&&n<=4}set(t,n,i){return t.setMonth((i-1)*3,1),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]}class J0 extends lt{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(t,n,i){const s=o=>o-1;switch(n){case"M":return Ot(kt(Ct.month,t),s);case"MM":return Ot(Mt(2,t),s);case"Mo":return Ot(i.ordinalNumber(t,{unit:"month"}),s);case"MMM":return i.month(t,{width:"abbreviated",context:"formatting"})||i.month(t,{width:"narrow",context:"formatting"});case"MMMMM":return i.month(t,{width:"narrow",context:"formatting"});default:return i.month(t,{width:"wide",context:"formatting"})||i.month(t,{width:"abbreviated",context:"formatting"})||i.month(t,{width:"narrow",context:"formatting"})}}validate(t,n){return n>=0&&n<=11}set(t,n,i){return t.setMonth(i,1),t.setHours(0,0,0,0),t}}class tb extends lt{priority=110;parse(t,n,i){const s=o=>o-1;switch(n){case"L":return Ot(kt(Ct.month,t),s);case"LL":return Ot(Mt(2,t),s);case"Lo":return Ot(i.ordinalNumber(t,{unit:"month"}),s);case"LLL":return i.month(t,{width:"abbreviated",context:"standalone"})||i.month(t,{width:"narrow",context:"standalone"});case"LLLLL":return i.month(t,{width:"narrow",context:"standalone"});default:return i.month(t,{width:"wide",context:"standalone"})||i.month(t,{width:"abbreviated",context:"standalone"})||i.month(t,{width:"narrow",context:"standalone"})}}validate(t,n){return n>=0&&n<=11}set(t,n,i){return t.setMonth(i,1),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]}function eb(e,t,n){const i=J(e,n?.in),s=Dl(i,n)-t;return i.setDate(i.getDate()-s*7),J(i,n?.in)}class nb extends lt{priority=100;parse(t,n,i){switch(n){case"w":return kt(Ct.week,t);case"wo":return i.ordinalNumber(t,{unit:"week"});default:return Mt(n.length,t)}}validate(t,n){return n>=1&&n<=53}set(t,n,i,s){return ce(eb(t,i,s),s)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]}function ib(e,t,n){const i=J(e,n?.in),s=Ml(i,n)-t;return i.setDate(i.getDate()-s*7),i}class sb extends lt{priority=100;parse(t,n,i){switch(n){case"I":return kt(Ct.week,t);case"Io":return i.ordinalNumber(t,{unit:"week"});default:return Mt(n.length,t)}}validate(t,n){return n>=1&&n<=53}set(t,n,i){return Mn(ib(t,i))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]}const ob=[31,28,31,30,31,30,31,31,30,31,30,31],ab=[31,29,31,30,31,30,31,31,30,31,30,31];class rb extends lt{priority=90;subPriority=1;parse(t,n,i){switch(n){case"d":return kt(Ct.date,t);case"do":return i.ordinalNumber(t,{unit:"date"});default:return Mt(n.length,t)}}validate(t,n){const i=t.getFullYear(),s=zl(i),o=t.getMonth();return s?n>=1&&n<=ab[o]:n>=1&&n<=ob[o]}set(t,n,i){return t.setDate(i),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]}class lb extends lt{priority=90;subpriority=1;parse(t,n,i){switch(n){case"D":case"DD":return kt(Ct.dayOfYear,t);case"Do":return i.ordinalNumber(t,{unit:"date"});default:return Mt(n.length,t)}}validate(t,n){const i=t.getFullYear();return zl(i)?n>=1&&n<=366:n>=1&&n<=365}set(t,n,i){return t.setMonth(0,i),t.setHours(0,0,0,0),t}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]}function Uo(e,t,n){const i=Ke(),s=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,o=J(e,n?.in),a=o.getDay(),l=(t%7+7)%7,c=7-s,u=t<0||t>6?t-(a+c)%7:(l+c)%7-(a+c)%7;return os(o,u,n)}class cb extends lt{priority=90;parse(t,n,i){switch(n){case"E":case"EE":case"EEE":return i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});case"EEEEE":return i.day(t,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});default:return i.day(t,{width:"wide",context:"formatting"})||i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"})}}validate(t,n){return n>=0&&n<=6}set(t,n,i,s){return t=Uo(t,i,s),t.setHours(0,0,0,0),t}incompatibleTokens=["D","i","e","c","t","T"]}class db extends lt{priority=90;parse(t,n,i,s){const o=a=>{const r=Math.floor((a-1)/7)*7;return(a+s.weekStartsOn+6)%7+r};switch(n){case"e":case"ee":return Ot(Mt(n.length,t),o);case"eo":return Ot(i.ordinalNumber(t,{unit:"day"}),o);case"eee":return i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});case"eeeee":return i.day(t,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"});default:return i.day(t,{width:"wide",context:"formatting"})||i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"})}}validate(t,n){return n>=0&&n<=6}set(t,n,i,s){return t=Uo(t,i,s),t.setHours(0,0,0,0),t}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]}class ub extends lt{priority=90;parse(t,n,i,s){const o=a=>{const r=Math.floor((a-1)/7)*7;return(a+s.weekStartsOn+6)%7+r};switch(n){case"c":case"cc":return Ot(Mt(n.length,t),o);case"co":return Ot(i.ordinalNumber(t,{unit:"day"}),o);case"ccc":return i.day(t,{width:"abbreviated",context:"standalone"})||i.day(t,{width:"short",context:"standalone"})||i.day(t,{width:"narrow",context:"standalone"});case"ccccc":return i.day(t,{width:"narrow",context:"standalone"});case"cccccc":return i.day(t,{width:"short",context:"standalone"})||i.day(t,{width:"narrow",context:"standalone"});default:return i.day(t,{width:"wide",context:"standalone"})||i.day(t,{width:"abbreviated",context:"standalone"})||i.day(t,{width:"short",context:"standalone"})||i.day(t,{width:"narrow",context:"standalone"})}}validate(t,n){return n>=0&&n<=6}set(t,n,i,s){return t=Uo(t,i,s),t.setHours(0,0,0,0),t}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]}function hb(e,t,n){const i=J(e,n?.in),s=U0(i,n),o=t-s;return os(i,o,n)}class fb extends lt{priority=90;parse(t,n,i){const s=o=>o===0?7:o;switch(n){case"i":case"ii":return Mt(n.length,t);case"io":return i.ordinalNumber(t,{unit:"day"});case"iii":return Ot(i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"}),s);case"iiiii":return Ot(i.day(t,{width:"narrow",context:"formatting"}),s);case"iiiiii":return Ot(i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"}),s);default:return Ot(i.day(t,{width:"wide",context:"formatting"})||i.day(t,{width:"abbreviated",context:"formatting"})||i.day(t,{width:"short",context:"formatting"})||i.day(t,{width:"narrow",context:"formatting"}),s)}}validate(t,n){return n>=1&&n<=7}set(t,n,i){return t=hb(t,i),t.setHours(0,0,0,0),t}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]}class mb extends lt{priority=80;parse(t,n,i){switch(n){case"a":case"aa":case"aaa":return i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"});case"aaaaa":return i.dayPeriod(t,{width:"narrow",context:"formatting"});default:return i.dayPeriod(t,{width:"wide",context:"formatting"})||i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"})}}set(t,n,i){return t.setHours(zo(i),0,0,0),t}incompatibleTokens=["b","B","H","k","t","T"]}class pb extends lt{priority=80;parse(t,n,i){switch(n){case"b":case"bb":case"bbb":return i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"});case"bbbbb":return i.dayPeriod(t,{width:"narrow",context:"formatting"});default:return i.dayPeriod(t,{width:"wide",context:"formatting"})||i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"})}}set(t,n,i){return t.setHours(zo(i),0,0,0),t}incompatibleTokens=["a","B","H","k","t","T"]}class gb extends lt{priority=80;parse(t,n,i){switch(n){case"B":case"BB":case"BBB":return i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"});case"BBBBB":return i.dayPeriod(t,{width:"narrow",context:"formatting"});default:return i.dayPeriod(t,{width:"wide",context:"formatting"})||i.dayPeriod(t,{width:"abbreviated",context:"formatting"})||i.dayPeriod(t,{width:"narrow",context:"formatting"})}}set(t,n,i){return t.setHours(zo(i),0,0,0),t}incompatibleTokens=["a","b","t","T"]}class yb extends lt{priority=70;parse(t,n,i){switch(n){case"h":return kt(Ct.hour12h,t);case"ho":return i.ordinalNumber(t,{unit:"hour"});default:return Mt(n.length,t)}}validate(t,n){return n>=1&&n<=12}set(t,n,i){const s=t.getHours()>=12;return s&&i<12?t.setHours(i+12,0,0,0):!s&&i===12?t.setHours(0,0,0,0):t.setHours(i,0,0,0),t}incompatibleTokens=["H","K","k","t","T"]}class bb extends lt{priority=70;parse(t,n,i){switch(n){case"H":return kt(Ct.hour23h,t);case"Ho":return i.ordinalNumber(t,{unit:"hour"});default:return Mt(n.length,t)}}validate(t,n){return n>=0&&n<=23}set(t,n,i){return t.setHours(i,0,0,0),t}incompatibleTokens=["a","b","h","K","k","t","T"]}class _b extends lt{priority=70;parse(t,n,i){switch(n){case"K":return kt(Ct.hour11h,t);case"Ko":return i.ordinalNumber(t,{unit:"hour"});default:return Mt(n.length,t)}}validate(t,n){return n>=0&&n<=11}set(t,n,i){return t.getHours()>=12&&i<12?t.setHours(i+12,0,0,0):t.setHours(i,0,0,0),t}incompatibleTokens=["h","H","k","t","T"]}class xb extends lt{priority=70;parse(t,n,i){switch(n){case"k":return kt(Ct.hour24h,t);case"ko":return i.ordinalNumber(t,{unit:"hour"});default:return Mt(n.length,t)}}validate(t,n){return n>=1&&n<=24}set(t,n,i){const s=i<=24?i%24:i;return t.setHours(s,0,0,0),t}incompatibleTokens=["a","b","h","H","K","t","T"]}class wb extends lt{priority=60;parse(t,n,i){switch(n){case"m":return kt(Ct.minute,t);case"mo":return i.ordinalNumber(t,{unit:"minute"});default:return Mt(n.length,t)}}validate(t,n){return n>=0&&n<=59}set(t,n,i){return t.setMinutes(i,0,0),t}incompatibleTokens=["t","T"]}class kb extends lt{priority=50;parse(t,n,i){switch(n){case"s":return kt(Ct.second,t);case"so":return i.ordinalNumber(t,{unit:"second"});default:return Mt(n.length,t)}}validate(t,n){return n>=0&&n<=59}set(t,n,i){return t.setSeconds(i,0),t}incompatibleTokens=["t","T"]}class Tb extends lt{priority=30;parse(t,n){const i=s=>Math.trunc(s*Math.pow(10,-n.length+3));return Ot(Mt(n.length,t),i)}set(t,n,i){return t.setMilliseconds(i),t}incompatibleTokens=["t","T"]}class vb extends lt{priority=10;parse(t,n){switch(n){case"X":return ue(de.basicOptionalMinutes,t);case"XX":return ue(de.basic,t);case"XXXX":return ue(de.basicOptionalSeconds,t);case"XXXXX":return ue(de.extendedOptionalSeconds,t);default:return ue(de.extended,t)}}set(t,n,i){return n.timestampIsSet?t:St(t,t.getTime()-as(t)-i)}incompatibleTokens=["t","T","x"]}class Sb extends lt{priority=10;parse(t,n){switch(n){case"x":return ue(de.basicOptionalMinutes,t);case"xx":return ue(de.basic,t);case"xxxx":return ue(de.basicOptionalSeconds,t);case"xxxxx":return ue(de.extendedOptionalSeconds,t);default:return ue(de.extended,t)}}set(t,n,i){return n.timestampIsSet?t:St(t,t.getTime()-as(t)-i)}incompatibleTokens=["t","T","X"]}class Mb extends lt{priority=40;parse(t){return Bl(t)}set(t,n,i){return[St(t,i*1e3),{timestampIsSet:!0}]}incompatibleTokens="*"}class Db extends lt{priority=20;parse(t){return Bl(t)}set(t,n,i){return[St(t,i),{timestampIsSet:!0}]}incompatibleTokens="*"}const Cb={G:new j0,y:new q0,Y:new G0,R:new X0,u:new K0,Q:new Z0,q:new Q0,M:new J0,L:new tb,w:new nb,I:new sb,d:new rb,D:new lb,E:new cb,e:new db,c:new ub,i:new fb,a:new mb,b:new pb,B:new gb,h:new yb,H:new bb,K:new _b,k:new xb,m:new wb,s:new kb,S:new Tb,X:new vb,x:new Sb,t:new Mb,T:new Db},Ob=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ab=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Pb=/^'([^]*?)'?$/,Eb=/''/g,Rb=/\S/,Ib=/[a-zA-Z]/;function Lb(e,t,n,i){const s=()=>St(i?.in||n,NaN),o=Ll(),a=i?.locale??o.locale??Sl,r=i?.firstWeekContainsDate??i?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,l=i?.weekStartsOn??i?.locale?.options?.weekStartsOn??o.weekStartsOn??o.locale?.options?.weekStartsOn??0;if(!t)return e?s():J(n,i?.in);const c={firstWeekContainsDate:r,weekStartsOn:l,locale:a},u=[new W0(i?.in,n)],h=t.match(Ab).map(y=>{const _=y[0];if(_ in Bo){const x=Bo[_];return x(y,a.formatLong)}return y}).join("").match(Ob),f=[];for(let y of h){!i?.useAdditionalWeekYearTokens&&Il(y)&&Fo(y,t,e),!i?.useAdditionalDayOfYearTokens&&Rl(y)&&Fo(y,t,e);const _=y[0],x=Cb[_];if(x){const{incompatibleTokens:T}=x;if(Array.isArray(T)){const w=f.find(D=>T.includes(D.token)||D.token===_);if(w)throw new RangeError(`The format string mustn't contain \`${w.fullToken}\` and \`${y}\` at the same time`)}else if(x.incompatibleTokens==="*"&&f.length>0)throw new RangeError(`The format string mustn't contain \`${y}\` and any other token at the same time`);f.push({token:_,fullToken:y});const S=x.run(e,y,a.match,c);if(!S)return s();u.push(S.setter),e=S.rest}else{if(_.match(Ib))throw new RangeError("Format string contains an unescaped latin alphabet character `"+_+"`");if(y==="''"?y="'":_==="'"&&(y=Nb(y)),e.indexOf(y)===0)e=e.slice(y.length);else return s()}}if(e.length>0&&Rb.test(e))return s();const m=u.map(y=>y.priority).sort((y,_)=>_-y).filter((y,_,x)=>x.indexOf(y)===_).map(y=>u.filter(_=>_.priority===y).sort((_,x)=>x.subPriority-_.subPriority)).map(y=>y[0]);let p=J(n,i?.in);if(isNaN(+p))return s();const g={};for(const y of m){if(!y.validate(p,c))return s();const _=y.set(p,g,c);Array.isArray(_)?(p=_[0],Object.assign(g,_[1])):p=_}return p}function Nb(e){return e.match(Pb)[1].replace(Eb,"'")}function Bb(e,t){const n=J(e,t?.in);return n.setMinutes(0,0,0),n}function Fb(e,t){const n=J(e,t?.in);return n.setSeconds(0,0),n}function zb(e,t){const n=J(e,t?.in);return n.setMilliseconds(0),n}function Ul(e){const t=e/Sn;return Math.trunc(t)}function Vl(e,t){const n=()=>St(t?.in,NaN),i=t?.additionalDigits??2,s=$b(e);let o;if(s.date){const c=Yb(s.date,i);o=Wb(c.restDateString,c.year)}if(!o||isNaN(+o))return n();const a=+o;let r=0,l;if(s.time&&(r=jb(s.time),isNaN(r)))return n();if(s.timezone){if(l=qb(s.timezone),isNaN(l))return n()}else{const c=new Date(a+r),u=J(0,t?.in);return u.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),u.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),u}return J(a+r+l,t?.in)}const cs={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Ub=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Vb=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Hb=/^([+-])(\d{2})(?::?(\d{2}))?$/;function $b(e){const t={},n=e.split(cs.dateTimeDelimiter);let i;if(n.length>2)return t;if(/:/.test(n[0])?i=n[0]:(t.date=n[0],i=n[1],cs.timeZoneDelimiter.test(t.date)&&(t.date=e.split(cs.timeZoneDelimiter)[0],i=e.substr(t.date.length,e.length))),i){const s=cs.timezone.exec(i);s?(t.time=i.replace(s[1],""),t.timezone=s[1]):t.time=i}return t}function Yb(e,t){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),i=e.match(n);if(!i)return{year:NaN,restDateString:""};const s=i[1]?parseInt(i[1]):null,o=i[2]?parseInt(i[2]):null;return{year:o===null?s:o*100,restDateString:e.slice((i[1]||i[2]).length)}}function Wb(e,t){if(t===null)return new Date(NaN);const n=e.match(Ub);if(!n)return new Date(NaN);const i=!!n[4],s=li(n[1]),o=li(n[2])-1,a=li(n[3]),r=li(n[4]),l=li(n[5])-1;if(i)return Qb(t,r,l)?Gb(t,r,l):new Date(NaN);{const c=new Date(0);return!Kb(t,o,a)||!Zb(t,s)?new Date(NaN):(c.setUTCFullYear(t,o,Math.max(s,a)),c)}}function li(e){return e?parseInt(e):1}function jb(e){const t=e.match(Vb);if(!t)return NaN;const n=Vo(t[1]),i=Vo(t[2]),s=Vo(t[3]);return Jb(n,i,s)?n*Sn+i*ii+s*1e3:NaN}function Vo(e){return e&&parseFloat(e.replace(",","."))||0}function qb(e){if(e==="Z")return 0;const t=e.match(Hb);if(!t)return 0;const n=t[1]==="+"?-1:1,i=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return t_(i,s)?n*(i*Sn+s*ii):NaN}function Gb(e,t,n){const i=new Date(0);i.setUTCFullYear(e,0,4);const s=i.getUTCDay()||7,o=(t-1)*7+n+1-s;return i.setUTCDate(i.getUTCDate()+o),i}const Xb=[31,null,31,30,31,30,31,31,30,31,30,31];function Hl(e){return e%400===0||e%4===0&&e%100!==0}function Kb(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Xb[t]||(Hl(e)?29:28))}function Zb(e,t){return t>=1&&t<=(Hl(e)?366:365)}function Qb(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function Jb(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function t_(e,t){return t>=0&&t<=59}const e_={noDataAvailableTitle:"No data in the current time frame",noDataAvailableDescription:"Once there is traffic, it will display here",limitedResultsShown:"Grouped value limit exceeded, showing the top {maxReturned}",entityNoName:"no-name",debug:"debug",total:"Total",jumpToExplore:"Open in explorer",more_actions:"More actions",emptyEntityInfo:"Requests that do not have a value for the selected group",scatter:{median:"Median",percentile:"p{value}",outlier:"Outlier (> {label})"},chartUnits:{ms:"ms",bytes:"Byte{plural}",count:"request{plural}","count/minute":"rpm",requests:"request{plural}","token count":"token{plural}","tokens/minute":"tpm","%":"%","ops/minute":"ops/minute"},query_errors:{forbidden:{message:"Data request forbidden",details:"To access this data, either filter for an entity you have access to or request analytics viewer access from your administrator."},time_range_exceeded:{message:"Time range exceeded",details:"The time range for this report is outside of your organization's data retention period"},timeout:{message:"Data request timed out",details:"We're sorry, the request timed out. Please consider using a shorter time period or try again later."},canceled:{message:"Request canceled"},other:{message:"Bad request"}},legend:{datapointValueDisplay:"{value} {unit}"},chartLabels:{ai_count:"LLM request count",latencies_response_ms:"Response latency",latencies_upstream_ms:"Upstream latency",latencies_kong_gateway_ms:"Kong latency",latencies_kong_internal_ms:"Kong internal latency",request_body_size:"Request size",response_body_size:"Response size",response_header_content_length:"Content length",ai:{cost:"Cost",costCaching:"Caching cost",promptTokens:"Prompt tokens",completionTokens:"Completion tokens",totalTokens:"Total tokens",llmLatency:"LLM latency",fetchLatency:"Fetch latency",embeddingsLatency:"Embeddings latency"},mcp:{latency:"MCP latency",response_body_size:"MCP response size"},a2a:{latency:"A2A latency",response_body_size:"A2A response size"},ai_gateway:"AI gateway",ai_gateway_agent:"AI gateway agent",ai_gateway_consumer:"AI gateway consumer",ai_gateway_consumer_group:"AI gateway consumer group",ai_gateway_data_plane_node:"AI gateway data plane node",ai_gateway_mcp_server:"AI gateway MCP server",ai_gateway_model:"AI gateway model",ai_gateway_version:"AI gateway version",ai_plugin:"AI plugin",ai_provider:"Provider",ai_request_model:"Request model",ai_response_model:"Response model",error_rate:"Error rate",request_count:"Request count",share_of_requests:"Share of requests",request_per_minute:"Requests per minute",requests_per_minute:"Requests per minute",response_latency_average:"Response latency (avg)",response_latency_p99:"Response latency (p99)",response_latency_p95:"Response latency (p95)",response_latency_p50:"Response latency (p50)",kong_latency_average:"Kong latency (avg)",kong_latency_p99:"Kong latency (p99)",kong_latency_p95:"Kong latency (p95)",kong_latency_p50:"Kong latency (p50)",kong_internal_latency_average:"Kong internal latency (avg)",kong_internal_latency_p99:"Kong internal latency (p99)",kong_internal_latency_p95:"Kong internal latency (p95)",kong_internal_latency_p50:"Kong internal latency (p50)",llm_cache_status:"Cache status",llm_embeddings_model:"Embeddings model",llm_embeddings_provider:"Embeddings provider",upstream_latency_average:"Upstream latency (avg)",upstream_latency_p99:"Upstream latency (p99)",upstream_latency_p95:"Upstream latency (p95)",upstream_latency_p50:"Upstream latency (p50)",response_size_p99:"Response size (p99)",response_size_p95:"Response size (p95)",response_size_p50:"Response size (p50)",response_size_average:"Response size (avg)",response_size_sum:"Response size (sum)",response_source:"Response source",request_size_p99:"Request size (p99)",request_size_p95:"Request size (p95)",request_size_p50:"Request size (p50)",request_size_average:"Request size (avg)",request_size_sum:"Request size (sum)",control_plane:"Control plane",control_plane_group:"Control plane group",consumer:"Consumer",consumer_group:"Consumer group",oidc_credential:"OIDC credential",country_code:"Country",country:"Country",data_plane_node:"Data plane node",data_plane_node_version:"Data plane node version",api_package:"API package",api_product:"API product",api_product_version:"API product version",portal:"Portal",realm:"Realm",runtime_group:"Runtime group",gateway_service:"Gateway service",route:"Route",application:"Application",status_code:"Status code",status_code_grouped:"Status code (grouped)",total_tokens_per_minute:"Total tokens per minute",upstream_status_code:"Upstream status code",upstream_status_code_grouped:"Upstream status code group",time:"Time",Service:"Service",ServiceVersion:"Service version",Route:"Route",Application:"Application",RuntimeGroup:"Runtime group",GatewayService:"Gateway service",StatusCode:"Status code",CodeClass:"Status code (grouped)",Time:"Time",API_PRODUCT:"Api product",API_PRODUCT_VERSION:"Api product version",RUNTIME_GROUP:"Runtime group",GATEWAY_SERVICE:"Gateway service",ROUTE:"Route",APPLICATION:"Application",STATUS_CODE:"Status code",STATUS_CODE_GROUPED:"Status code (grouped)",TIME:"Time",ORGANIZATION:"Organization",TotalRequests:"Request count",RequestsPerMinute:"Requests per minute",LatencyP99:"Response latency (p99)",LatencyP95:"Response latency (p95)",LatencyP50:"Response latency (p50)",LatencyAverage:"Response latency (avg)",UpstreamLatencyP99:"Upstream latency (p99)",UpstreamLatencyP95:"Upstream latency (p95)",UpstreamLatencyP50:"Upstream latency (p50)",UpstreamLatencyAverage:"Upstream latency (avg)",KongLatencyP99:"Kong latency (p99)",KongLatencyP95:"Kong latency (p95)",KongLatencyP50:"Kong latency (p50)",KongLatencyAverage:"Kong latency (avg)",ResponseSizeP99:"Response size (p99)",ResponseSizeP95:"Response size (p95)",ResponseSizeP50:"Response size (p50)",RequestSizeP99:"Request size (p99)",RequestSizeP95:"Request size (p95)",RequestSizeP50:"Request size (p50)",SuccessfulRequests:"Successful requests",SUCCESS:"Successful requests",FailedRequests:"Failed requests",FAILURE:"Failed requests","5XX":"5xx","4XX":"4xx","3XX":"3xx","2XX":"2xx","1XX":"1xx",REQUEST_COUNT:"Request count",REQUEST_PER_MINUTE:"Requests per minute",RESPONSE_LATENCY_P99:"Response latency",RESPONSE_LATENCY_P95:"Response latency",RESPONSE_LATENCY_P50:"Response latency",RESPONSE_SIZE_P99:"Response size (p99)",RESPONSE_SIZE_P95:"Response size (p95)",RESPONSE_SIZE_P50:"Response size (p50)",REQUEST_SIZE_P99:"Request size (p99)",REQUEST_SIZE_P95:"Request size (p95)",REQUEST_SIZE_P50:"Request size (p50)",CONTROL_PLANE:"Control plane",____OTHER____:"Others",ai_request_count:"Request count",total_tokens:"Total token count",prompt_tokens:"Prompt token count",completion_tokens:"Completion token count",cost:"Costs",cost_per_request_average:"Request cost (avg per million)",share_of_cost:"Share of cost",llm_cache_embeddings_latency_average:"Embeddings latency (avg)",llm_cache_fetch_latency_average:"Fetch latency (avg)",llm_latency_average:"LLM latency (avg)",llm_latency_p50:"LLM latency (p50)",llm_latency_p95:"LLM latency (p95)",llm_latency_p99:"LLM latency (p99)","threshold-warning":"Warning threshold: {value}","threshold-error":"Error threshold: {value}","thatreshold-neutral":"Alert threshold: {value}",api:"API",vulnerability_count:"Vulnerability count",a2a_latency_average:"A2A latency (avg)",a2a_response_size_sum:"A2A response size (sum)",a2a_context_id:"A2A context ID",a2a_error:"A2A error",a2a_method:"A2A method",a2a_task_id:"A2A task ID",active_agents:"Active agents",mcp_error:"MCP error",mcp_method:"MCP method",mcp_latency_average:"MCP latency (avg)",mcp_latency_p99:"MCP latency (p99)",mcp_latency_p95:"MCP latency (p95)",mcp_latency_p50:"MCP latency (p50)",mcp_response_size_sum:"MCP response size (sum)",mcp_session_id:"MCP session ID",mcp_tool_name:"MCP tool name",mcp_response_body_size_sum:"MCP response size (sum)",control_plane_count:"Control plane count",service_count:"Gateway service count","record_bytes:sum":"Record size (sum)","record_count:sum":"Record count (sum)","request_count:sum":"Request count (sum)",route_count:"Route count",consumer_count:"Consumer count",plugin_count:"Plugin count",node_count:"Data plane node count",principal:"Principal",principal_group:"Principal group",virtual_cluster_id:"Virtual cluster",backend_cluster_id:"Backend cluster",listener_id:"Listener",principal_name:"Principal name",principal_type:"Principal type",request_type:"Request type",topic_name:"Topic name",partition_index:"Partition index",api_key:"API key",data_plane_group:"Data plane group",managed_cache:"Managed cache",network:"Network",provider:"Provider",provider_region:"Provider region",region:"Region",cache_eviction_rate:"Cache eviction rate",cache_expiration_rate:"Cache expiration rate",cache_items_average:"Cache items (avg)",cache_memory_utilization_max:"Cache memory utilization (max)",cache_status:"Cache status",cache_hit_rate:"Cache hit rate",time_to_first_token_average:"Time to first token (avg)",time_to_first_token_p99:"Time to first token (p99)",time_to_first_token_p95:"Time to first token (p95)",time_to_first_token_p50:"Time to first token (p50)",time_per_token_average:"Time per token (avg)",time_per_token_p99:"Time per token (p99)",time_per_token_p95:"Time per token (p95)",time_per_token_p50:"Time per token (p50)"},metricAxisTitles:{cache_hit_rate:"Cache hit rate {unit}",error_rate:"Error rate in {unit}",request_count:"Request count",share_of_requests:"Share of requests",request_per_minute:"Requests per minute",requests_per_minute:"Requests per minute",latency_in:"Latency in {unit}",size_in:"Size in {unit}",response_latency_average:"Response latency (avg) in {unit}",response_latency_p99:"Response latency (p99) in {unit}",response_latency_p95:"Response latency (p95) in {unit}",response_latency_p50:"Response latency (p50) in {unit}",upstream_latency_p99:"Upstream latency (p99) in {unit}",upstream_latency_p95:"Upstream latency (p95) in {unit}",upstream_latency_p50:"Upstream latency (p50) in {unit}",kong_latency_p99:"Kong latency (p99) in {unit}",kong_latency_p95:"Kong latency (p95) in {unit}",kong_latency_p50:"Kong latency (p50) in {unit}",kong_internal_latency_average:"Kong internal latency (avg) in {unit}",kong_internal_latency_p99:"Kong internal latency (p99) in {unit}",kong_internal_latency_p95:"Kong internal latency (p95) in {unit}",kong_internal_latency_p50:"Kong internal latency (p50) in {unit}",response_size_p99:"Response size (p99) in {unit}",response_size_p95:"Response size (p95) in {unit}",response_size_p50:"Response size (p50) in {unit}",request_size_p99:"Request size (p99) in {unit}",request_size_p95:"Request size (p95) in {unit}",request_size_p50:"Request size (p50) in {unit}",request_size_sum:"Request size (sum) in {unit}",REQUEST_COUNT:"Request count",REQUEST_PER_MINUTE:"Requests per minute",RESPONSE_LATENCY_P99:"Response latency (p99) in {unit}",RESPONSE_LATENCY_P95:"Response latency (p95) in {unit}",RESPONSE_LATENCY_P50:"Response latency (p50) in {unit}",RESPONSE_SIZE_P99:"Response size (p99) in {unit}",RESPONSE_SIZE_P95:"Response size (p95) in {unit}",RESPONSE_SIZE_P50:"Response size (p50) in {unit}",REQUEST_SIZE_P99:"Request size (p99) in {unit}",REQUEST_SIZE_P95:"Request size (p95) in {unit}",REQUEST_SIZE_P50:"Request size (p50) in {unit}",TotalRequests:"Request count",RequestsPerMinute:"Requests per minute",LatencyP99:"Response latency (p99) in {unit}",LatencyP95:"Response latency (p95) in {unit}",LatencyP50:"Response latency (p50) in {unit}",LatencyAverage:"Response latency (avg) in {unit}",UpstreamLatencyP99:"Upstream latency (p99) in {unit}",UpstreamLatencyP95:"Upstream latency (p95) in {unit}",UpstreamLatencyP50:"Upstream latency (p50) in {unit}",UpstreamLatencyAverage:"Upstream latency (avg) in {unit}",KongLatencyP99:"Kong latency (p99) in {unit}",KongLatencyP95:"Kong latency (p95) in {unit}",KongLatencyP50:"Kong latency (p50) in {unit}",KongLatencyAverage:"Kong latency (avg) in {unit}",ResponseSizeP99:"Response size (p99) in {unit}",ResponseSizeP95:"Response size (p95) in {unit}",ResponseSizeP50:"Response size (p50) in {unit}",RequestSizeP99:"Request size (p99) in {unit}",RequestSizeP95:"Request size (p95) in {unit}",RequestSizeP50:"Request size (p50) in {unit}",ai_request_count:"Request count",total_tokens:"Total token count",prompt_tokens:"Prompt token count",completion_tokens:"Completion token count",cost:"Costs",cost_per_request_average:"Cost per request (avg)",share_of_cost:"Share of cost",llm_cache_embeddings_latency_average:"Embeddings latency (avg)",llm_cache_fetch_latency_average:"Fetch latency (avg)",llm_latency_average:"LLM latency (avg)",llm_latency_p50:"LLM latency (p50)",llm_latency_p95:"LLM latency (p95)",llm_latency_p99:"LLM latency (p99)",api:"API",a2a_latency_average:"A2A latency (avg) in {unit}",a2a_response_size_sum:"A2A response size (sum) in {unit}",a2a_context_id:"A2A context ID",a2a_error:"A2A error",a2a_method:"A2A method",a2a_task_id:"A2A task ID",active_agents:"Active agents",mcp_latency_average:"MCP latency (avg)",mcp_latency_p99:"MCP latency (p99)",mcp_latency_p95:"MCP latency (p95)",mcp_latency_p50:"MCP latency (p50)",mcp_response_size_sum:"MCP response size (sum) in {unit}",mcp_response_body_size_sum:"MCP response body size (sum) in {unit}",control_plane_count:"Control plane count",service_count:"Gateway service count",route_count:"Route count",consumer_count:"Consumer count",plugin_count:"Plugin count",node_count:"Data plane node count",cache_eviction_rate:"Cache eviction rate in {unit}",cache_expiration_rate:"Cache expiration rate in {unit}",cache_items_average:"Cache items (avg)",cache_memory_utilization_max:"Cache memory utilization (max) in {unit}",cached_tokens:"Cached tokens",time_to_first_token_average:"Time to first token (avg)",time_to_first_token_p99:"Time to first token (p99)",time_to_first_token_p95:"Time to first token (p95)",time_to_first_token_p50:"Time to first token (p50)",time_per_token_average:"Time per token (avg)",time_per_token_p99:"Time per token (p99)",time_per_token_p95:"Time per token (p95)",time_per_token_p50:"Time per token (p50)",total_tokens_per_minute:"Total tokens per minute"},granularityAxisTitles:{tenSecondly:"@timestamp per 10 seconds",thirtySecondly:"@timestamp per 30 seconds",minutely:"@timestamp per minute",fiveMinutely:"@timestamp per 5 minutes",tenMinutely:"@timestamp per 10 minutes",thirtyMinutely:"@timestamp per 30 minutes",hourly:"@timestamp per hour",twoHourly:"@timestamp per 2 hours",twelveHourly:"@timestamp per 12 hours",daily:"@timestamp per day",weekly:"@timestamp per week"},timestampAxisTitles:{platform:"@timestamp created at"},topNTable:{nameLabel:"Name",defaultEmptyStateTitle:"No data to display",defaultErrorStateTitle:"Something went wrong",errors:{meta:"Error: response must contain 'meta'",display:"Error: 'display' response incorrectly formatted (must have at least one key)",metricNames:"Error: 'metricNames' response incorrectly formatted (must have at least one entry)"}},topTalkers:{total:"{value} total",defaultEmptyStateTitle:"No data to display",defaultErrorStateTitle:"Something went wrong"},singleValue:{valueError:"Invalid configuration",trend:{not_available:"Not available"}},new_timerange_label:"Time range",sparkline_no_data:"No data",zoom_action_items:{zoom:"Zoom in",view_requests:"View requests",cancel:"Cancel",explore:"Explore"},zoom_time_range:{from:"From",to:"To"}};function Ho(){const e=Mr.createI18n("en-us",e_);return{i18n:e,i18nT:Mr.i18nTComponent(e)}}function ci(e){return e+.5|0}const Pe=(e,t,n)=>Math.max(Math.min(e,n),t);function di(e){return Pe(ci(e*2.55),0,255)}function Ee(e){return Pe(ci(e*255),0,255)}function be(e){return Pe(ci(e/2.55)/100,0,1)}function $l(e){return Pe(ci(e*100),0,100)}const ae={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},$o=[..."0123456789ABCDEF"],n_=e=>$o[e&15],i_=e=>$o[(e&240)>>4]+$o[e&15],ds=e=>(e&240)>>4===(e&15),s_=e=>ds(e.r)&&ds(e.g)&&ds(e.b)&&ds(e.a);function o_(e){var t=e.length,n;return e[0]==="#"&&(t===4||t===5?n={r:255&ae[e[1]]*17,g:255&ae[e[2]]*17,b:255&ae[e[3]]*17,a:t===5?ae[e[4]]*17:255}:(t===7||t===9)&&(n={r:ae[e[1]]<<4|ae[e[2]],g:ae[e[3]]<<4|ae[e[4]],b:ae[e[5]]<<4|ae[e[6]],a:t===9?ae[e[7]]<<4|ae[e[8]]:255})),n}const a_=(e,t)=>e<255?t(e):"";function r_(e){var t=s_(e)?n_:i_;return e?"#"+t(e.r)+t(e.g)+t(e.b)+a_(e.a,t):void 0}const l_=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Yl(e,t,n){const i=t*Math.min(n,1-n),s=(o,a=(o+e/30)%12)=>n-i*Math.max(Math.min(a-3,9-a,1),-1);return[s(0),s(8),s(4)]}function c_(e,t,n){const i=(s,o=(s+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function d_(e,t,n){const i=Yl(e,1,.5);let s;for(t+n>1&&(s=1/(t+n),t*=s,n*=s),s=0;s<3;s++)i[s]*=1-t-n,i[s]+=t;return i}function u_(e,t,n,i,s){return e===s?(t-n)/i+(t<n?6:0):t===s?(n-e)/i+2:(e-t)/i+4}function Yo(e){const n=e.r/255,i=e.g/255,s=e.b/255,o=Math.max(n,i,s),a=Math.min(n,i,s),r=(o+a)/2;let l,c,u;return o!==a&&(u=o-a,c=r>.5?u/(2-o-a):u/(o+a),l=u_(n,i,s,u,o),l=l*60+.5),[l|0,c||0,r]}function Wo(e,t,n,i){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,n,i)).map(Ee)}function jo(e,t,n){return Wo(Yl,e,t,n)}function h_(e,t,n){return Wo(d_,e,t,n)}function f_(e,t,n){return Wo(c_,e,t,n)}function Wl(e){return(e%360+360)%360}function m_(e){const t=l_.exec(e);let n=255,i;if(!t)return;t[5]!==i&&(n=t[6]?di(+t[5]):Ee(+t[5]));const s=Wl(+t[2]),o=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?i=h_(s,o,a):t[1]==="hsv"?i=f_(s,o,a):i=jo(s,o,a),{r:i[0],g:i[1],b:i[2],a:n}}function p_(e,t){var n=Yo(e);n[0]=Wl(n[0]+t),n=jo(n),e.r=n[0],e.g=n[1],e.b=n[2]}function g_(e){if(!e)return;const t=Yo(e),n=t[0],i=$l(t[1]),s=$l(t[2]);return e.a<255?`hsla(${n}, ${i}%, ${s}%, ${be(e.a)})`:`hsl(${n}, ${i}%, ${s}%)`}const jl={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},ql={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function y_(){const e={},t=Object.keys(ql),n=Object.keys(jl);let i,s,o,a,r;for(i=0;i<t.length;i++){for(a=r=t[i],s=0;s<n.length;s++)o=n[s],r=r.replace(o,jl[o]);o=parseInt(ql[a],16),e[r]=[o>>16&255,o>>8&255,o&255]}return e}let us;function b_(e){us||(us=y_(),us.transparent=[0,0,0,0]);const t=us[e.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const __=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function x_(e){const t=__.exec(e);let n=255,i,s,o;if(t){if(t[7]!==i){const a=+t[7];n=t[8]?di(a):Pe(a*255,0,255)}return i=+t[1],s=+t[3],o=+t[5],i=255&(t[2]?di(i):Pe(i,0,255)),s=255&(t[4]?di(s):Pe(s,0,255)),o=255&(t[6]?di(o):Pe(o,0,255)),{r:i,g:s,b:o,a:n}}}function w_(e){return e&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${be(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`)}const qo=e=>e<=.0031308?e*12.92:Math.pow(e,1/2.4)*1.055-.055,Cn=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function k_(e,t,n){const i=Cn(be(e.r)),s=Cn(be(e.g)),o=Cn(be(e.b));return{r:Ee(qo(i+n*(Cn(be(t.r))-i))),g:Ee(qo(s+n*(Cn(be(t.g))-s))),b:Ee(qo(o+n*(Cn(be(t.b))-o))),a:e.a+n*(t.a-e.a)}}function hs(e,t,n){if(e){let i=Yo(e);i[t]=Math.max(0,Math.min(i[t]+i[t]*n,t===0?360:1)),i=jo(i),e.r=i[0],e.g=i[1],e.b=i[2]}}function Gl(e,t){return e&&Object.assign(t||{},e)}function Xl(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=Ee(e[3]))):(t=Gl(e,{r:0,g:0,b:0,a:1}),t.a=Ee(t.a)),t}function T_(e){return e.charAt(0)==="r"?x_(e):m_(e)}class ui{constructor(t){if(t instanceof ui)return t;const n=typeof t;let i;n==="object"?i=Xl(t):n==="string"&&(i=o_(t)||b_(t)||T_(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Gl(this._rgb);return t&&(t.a=be(t.a)),t}set rgb(t){this._rgb=Xl(t)}rgbString(){return this._valid?w_(this._rgb):void 0}hexString(){return this._valid?r_(this._rgb):void 0}hslString(){return this._valid?g_(this._rgb):void 0}mix(t,n){if(t){const i=this.rgb,s=t.rgb;let o;const a=n===o?.5:n,r=2*a-1,l=i.a-s.a,c=((r*l===-1?r:(r+l)/(1+r*l))+1)/2;o=1-c,i.r=255&c*i.r+o*s.r+.5,i.g=255&c*i.g+o*s.g+.5,i.b=255&c*i.b+o*s.b+.5,i.a=a*i.a+(1-a)*s.a,this.rgb=i}return this}interpolate(t,n){return t&&(this._rgb=k_(this._rgb,t._rgb,n)),this}clone(){return new ui(this.rgb)}alpha(t){return this._rgb.a=Ee(t),this}clearer(t){const n=this._rgb;return n.a*=1-t,this}greyscale(){const t=this._rgb,n=ci(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=n,this}opaquer(t){const n=this._rgb;return n.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return hs(this._rgb,2,t),this}darken(t){return hs(this._rgb,2,-t),this}saturate(t){return hs(this._rgb,1,t),this}desaturate(t){return hs(this._rgb,1,-t),this}rotate(t){return p_(this._rgb,t),this}}function _e(){}const v_=(()=>{let e=0;return()=>e++})();function Z(e){return e==null}function ct(e){if(Array.isArray&&Array.isArray(e))return!0;const t=Object.prototype.toString.call(e);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function nt(e){return e!==null&&Object.prototype.toString.call(e)==="[object Object]"}function _t(e){return(typeof e=="number"||e instanceof Number)&&isFinite(+e)}function ie(e,t){return _t(e)?e:t}function Q(e,t){return typeof e>"u"?t:e}const S_=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100:+e/t,Kl=(e,t)=>typeof e=="string"&&e.endsWith("%")?parseFloat(e)/100*t:+e;function ft(e,t,n){if(e&&typeof e.call=="function")return e.apply(n,t)}function mt(e,t,n,i){let s,o,a;if(ct(e))for(o=e.length,s=0;s<o;s++)t.call(n,e[s],s);else if(nt(e))for(a=Object.keys(e),o=a.length,s=0;s<o;s++)t.call(n,e[a[s]],a[s])}function fs(e,t){let n,i,s,o;if(!e||!t||e.length!==t.length)return!1;for(n=0,i=e.length;n<i;++n)if(s=e[n],o=t[n],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function ms(e){if(ct(e))return e.map(ms);if(nt(e)){const t=Object.create(null),n=Object.keys(e),i=n.length;let s=0;for(;s<i;++s)t[n[s]]=ms(e[n[s]]);return t}return e}function Zl(e){return["__proto__","prototype","constructor"].indexOf(e)===-1}function M_(e,t,n,i){if(!Zl(e))return;const s=t[e],o=n[e];nt(s)&&nt(o)?hi(s,o,i):t[e]=ms(o)}function hi(e,t,n){const i=ct(t)?t:[t],s=i.length;if(!nt(e))return e;n=n||{};const o=n.merger||M_;let a;for(let r=0;r<s;++r){if(a=i[r],!nt(a))continue;const l=Object.keys(a);for(let c=0,u=l.length;c<u;++c)o(l[c],e,a,n)}return e}function fi(e,t){return hi(e,t,{merger:D_})}function D_(e,t,n){if(!Zl(e))return;const i=t[e],s=n[e];nt(i)&&nt(s)?fi(i,s):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=ms(s))}const Ql={"":e=>e,x:e=>e.x,y:e=>e.y};function C_(e){const t=e.split("."),n=[];let i="";for(const s of t)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(n.push(i),i="");return n}function O_(e){const t=C_(e);return n=>{for(const i of t){if(i==="")break;n=n&&n[i]}return n}}function Re(e,t){return(Ql[t]||(Ql[t]=O_(t)))(e)}function Go(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Xt=e=>typeof e<"u",Kt=e=>typeof e=="function",Jl=(e,t)=>{if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0};function A_(e){return e.type==="mouseup"||e.type==="click"||e.type==="contextmenu"}const tt=Math.PI,gt=2*tt,P_=gt+tt,ps=Number.POSITIVE_INFINITY,Xo=tt/180,yt=tt/2,re=tt/4,gs=tt*2/3,Ie=Math.log10,he=Math.sign;function mi(e,t,n){return Math.abs(e-t)<n}function tc(e){const t=Math.round(e);e=mi(e,t,e/1e3)?t:e;const n=Math.pow(10,Math.floor(Ie(e))),i=e/n;return(i<=1?1:i<=2?2:i<=5?5:10)*n}function E_(e){const t=[],n=Math.sqrt(e);let i;for(i=1;i<n;i++)e%i===0&&(t.push(i),t.push(e/i));return n===(n|0)&&t.push(n),t.sort((s,o)=>s-o).pop(),t}function R_(e){return typeof e=="symbol"||typeof e=="object"&&e!==null&&!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e)}function Le(e){return!R_(e)&&!isNaN(parseFloat(e))&&isFinite(e)}function I_(e,t){const n=Math.round(e);return n-t<=e&&n+t>=e}function ec(e,t,n){let i,s,o;for(i=0,s=e.length;i<s;i++)o=e[i][n],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function At(e){return e*(tt/180)}function ys(e){return e*(180/tt)}function nc(e){if(!_t(e))return;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n++;return n}function bs(e,t){const n=t.x-e.x,i=t.y-e.y,s=Math.sqrt(n*n+i*i);let o=Math.atan2(i,n);return o<-.5*tt&&(o+=gt),{angle:o,distance:s}}function On(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function L_(e,t){return(e-t+P_)%gt-tt}function Ut(e){return(e%gt+gt)%gt}function pi(e,t,n,i){const s=Ut(e),o=Ut(t),a=Ut(n),r=Ut(o-s),l=Ut(a-s),c=Ut(s-o),u=Ut(s-a);return s===o||s===a||i&&o===a||r>l&&c<u}function It(e,t,n){return Math.max(t,Math.min(n,e))}function N_(e){return It(e,-32768,32767)}function xe(e,t,n,i=1e-6){return e>=Math.min(t,n)-i&&e<=Math.max(t,n)+i}function Ko(e,t,n){n=n||(a=>e[a]<t);let i=e.length-1,s=0,o;for(;i-s>1;)o=s+i>>1,n(o)?s=o:i=o;return{lo:s,hi:i}}const we=(e,t,n,i)=>Ko(e,n,i?s=>{const o=e[s][t];return o<n||o===n&&e[s+1][t]===n}:s=>e[s][t]<n),B_=(e,t,n)=>Ko(e,n,i=>e[i][t]>=n);function F_(e,t,n){let i=0,s=e.length;for(;i<s&&e[i]<t;)i++;for(;s>i&&e[s-1]>n;)s--;return i>0||s<e.length?e.slice(i,s):e}const ic=["push","pop","shift","splice","unshift"];function z_(e,t){if(e._chartjs){e._chartjs.listeners.push(t);return}Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),ic.forEach(n=>{const i="_onData"+Go(n),s=e[n];Object.defineProperty(e,n,{configurable:!0,enumerable:!1,value(...o){const a=s.apply(this,o);return e._chartjs.listeners.forEach(r=>{typeof r[i]=="function"&&r[i](...o)}),a}})})}function sc(e,t){const n=e._chartjs;if(!n)return;const i=n.listeners,s=i.indexOf(t);s!==-1&&i.splice(s,1),!(i.length>0)&&(ic.forEach(o=>{delete e[o]}),delete e._chartjs)}function oc(e){const t=new Set(e);return t.size===e.length?e:Array.from(t)}const ac=(function(){return typeof window>"u"?function(e){return e()}:window.requestAnimationFrame})();function rc(e,t){let n=[],i=!1;return function(...s){n=s,i||(i=!0,ac.call(window,()=>{i=!1,e.apply(t,n)}))}}function U_(e,t){let n;return function(...i){return t?(clearTimeout(n),n=setTimeout(e,t,i)):e.apply(this,i),t}}const Zo=e=>e==="start"?"left":e==="end"?"right":"center",Vt=(e,t,n)=>e==="start"?t:e==="end"?n:(t+n)/2,V_=(e,t,n,i)=>e===(i?"left":"right")?n:e==="center"?(t+n)/2:t;function lc(e,t,n){const i=t.length;let s=0,o=i;if(e._sorted){const{iScale:a,vScale:r,_parsed:l}=e,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=a.axis,{min:h,max:f,minDefined:m,maxDefined:p}=a.getUserBounds();if(m){if(s=Math.min(we(l,u,h).lo,n?i:we(t,u,a.getPixelForValue(h)).lo),c){const g=l.slice(0,s+1).reverse().findIndex(y=>!Z(y[r.axis]));s-=Math.max(0,g)}s=It(s,0,i-1)}if(p){let g=Math.max(we(l,a.axis,f,!0).hi+1,n?0:we(t,u,a.getPixelForValue(f),!0).hi+1);if(c){const y=l.slice(g-1).findIndex(_=>!Z(_[r.axis]));g+=Math.max(0,y)}o=It(g,s,i)-s}else o=i-s}return{start:s,count:o}}function cc(e){const{xScale:t,yScale:n,_scaleRanges:i}=e,s={xmin:t.min,xmax:t.max,ymin:n.min,ymax:n.max};if(!i)return e._scaleRanges=s,!0;const o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==n.min||i.ymax!==n.max;return Object.assign(i,s),o}const _s=e=>e===0||e===1,dc=(e,t,n)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*gt/n)),uc=(e,t,n)=>Math.pow(2,-10*e)*Math.sin((e-t)*gt/n)+1,gi={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*yt)+1,easeOutSine:e=>Math.sin(e*yt),easeInOutSine:e=>-.5*(Math.cos(tt*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>_s(e)?e:e<.5?.5*Math.pow(2,10*(e*2-1)):.5*(-Math.pow(2,-10*(e*2-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>_s(e)?e:dc(e,.075,.3),easeOutElastic:e=>_s(e)?e:uc(e,.075,.3),easeInOutElastic(e){return _s(e)?e:e<.5?.5*dc(e*2,.1125,.45):.5+.5*uc(e*2-1,.1125,.45)},easeInBack(e){return e*e*((1.70158+1)*e-1.70158)},easeOutBack(e){return(e-=1)*e*((1.70158+1)*e+1.70158)+1},easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-gi.easeOutBounce(1-e),easeOutBounce(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},easeInOutBounce:e=>e<.5?gi.easeInBounce(e*2)*.5:gi.easeOutBounce(e*2-1)*.5+.5};function Qo(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function xs(e){return Qo(e)?e:new ui(e)}function Jo(e){return Qo(e)?e:new ui(e).saturate(.5).darken(.1).hexString()}const H_=["x","y","borderWidth","radius","tension"],$_=["color","borderColor","backgroundColor"];function Y_(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),e.set("animations",{colors:{type:"color",properties:$_},numbers:{type:"number",properties:H_}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function W_(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const hc=new Map;function j_(e,t){t=t||{};const n=e+JSON.stringify(t);let i=hc.get(n);return i||(i=new Intl.NumberFormat(e,t),hc.set(n,i)),i}function yi(e,t,n){return j_(t,n).format(e)}const fc={values(e){return ct(e)?e:""+e},numeric(e,t,n){if(e===0)return"0";const i=this.chart.options.locale;let s,o=e;if(n.length>1){const c=Math.max(Math.abs(n[0].value),Math.abs(n[n.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=q_(e,n)}const a=Ie(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:s,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),yi(e,i,l)},logarithmic(e,t,n){if(e===0)return"0";const i=n[t].significand||e/Math.pow(10,Math.floor(Ie(e)));return[1,2,3,5,10,15].includes(i)||t>.8*n.length?fc.numeric.call(this,e,t,n):""}};function q_(e,t){let n=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(n)>=1&&e!==Math.floor(e)&&(n=e-Math.floor(e)),n}var ws={formatters:fc};function G_(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,n)=>n.lineWidth,tickColor:(t,n)=>n.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:ws.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Je=Object.create(null),ta=Object.create(null);function bi(e,t){if(!t)return e;const n=t.split(".");for(let i=0,s=n.length;i<s;++i){const o=n[i];e=e[o]||(e[o]=Object.create(null))}return e}function ea(e,t,n){return typeof t=="string"?hi(bi(e,t),n):hi(bi(e,""),t)}class X_{constructor(t,n){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,s)=>Jo(s.backgroundColor),this.hoverBorderColor=(i,s)=>Jo(s.borderColor),this.hoverColor=(i,s)=>Jo(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(n)}set(t,n){return ea(this,t,n)}get(t){return bi(this,t)}describe(t,n){return ea(ta,t,n)}override(t,n){return ea(Je,t,n)}route(t,n,i,s){const o=bi(this,t),a=bi(this,i),r="_"+n;Object.defineProperties(o,{[r]:{value:o[n],writable:!0},[n]:{enumerable:!0,get(){const l=this[r],c=a[s];return nt(l)?Object.assign({},c,l):Q(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(n=>n(this))}}var bt=new X_({_scriptable:e=>!e.startsWith("on"),_indexable:e=>e!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Y_,W_,G_]);function K_(e){return!e||Z(e.size)||Z(e.family)?null:(e.style?e.style+" ":"")+(e.weight?e.weight+" ":"")+e.size+"px "+e.family}function ks(e,t,n,i,s){let o=t[s];return o||(o=t[s]=e.measureText(s).width,n.push(s)),o>i&&(i=o),i}function Z_(e,t,n,i){i=i||{};let s=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(s=i.data={},o=i.garbageCollect=[],i.font=t),e.save(),e.font=t;let a=0;const r=n.length;let l,c,u,h,f;for(l=0;l<r;l++)if(h=n[l],h!=null&&!ct(h))a=ks(e,s,o,a,h);else if(ct(h))for(c=0,u=h.length;c<u;c++)f=h[c],f!=null&&!ct(f)&&(a=ks(e,s,o,a,f));e.restore();const m=o.length/2;if(m>n.length){for(l=0;l<m;l++)delete s[o[l]];o.splice(0,m)}return a}function tn(e,t,n){const i=e.currentDevicePixelRatio,s=n!==0?Math.max(n/2,.5):0;return Math.round((t-s)*i)/i+s}function mc(e,t){!t&&!e||(t=t||e.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function na(e,t,n,i){pc(e,t,n,i,null)}function pc(e,t,n,i,s){let o,a,r,l,c,u,h,f;const m=t.pointStyle,p=t.rotation,g=t.radius;let y=(p||0)*Xo;if(m&&typeof m=="object"&&(o=m.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){e.save(),e.translate(n,i),e.rotate(y),e.drawImage(m,-m.width/2,-m.height/2,m.width,m.height),e.restore();return}if(!(isNaN(g)||g<=0)){switch(e.beginPath(),m){default:s?e.ellipse(n,i,s/2,g,0,0,gt):e.arc(n,i,g,0,gt),e.closePath();break;case"triangle":u=s?s/2:g,e.moveTo(n+Math.sin(y)*u,i-Math.cos(y)*g),y+=gs,e.lineTo(n+Math.sin(y)*u,i-Math.cos(y)*g),y+=gs,e.lineTo(n+Math.sin(y)*u,i-Math.cos(y)*g),e.closePath();break;case"rectRounded":c=g*.516,l=g-c,a=Math.cos(y+re)*l,h=Math.cos(y+re)*(s?s/2-c:l),r=Math.sin(y+re)*l,f=Math.sin(y+re)*(s?s/2-c:l),e.arc(n-h,i-r,c,y-tt,y-yt),e.arc(n+f,i-a,c,y-yt,y),e.arc(n+h,i+r,c,y,y+yt),e.arc(n-f,i+a,c,y+yt,y+tt),e.closePath();break;case"rect":if(!p){l=Math.SQRT1_2*g,u=s?s/2:l,e.rect(n-u,i-l,2*u,2*l);break}y+=re;case"rectRot":h=Math.cos(y)*(s?s/2:g),a=Math.cos(y)*g,r=Math.sin(y)*g,f=Math.sin(y)*(s?s/2:g),e.moveTo(n-h,i-r),e.lineTo(n+f,i-a),e.lineTo(n+h,i+r),e.lineTo(n-f,i+a),e.closePath();break;case"crossRot":y+=re;case"cross":h=Math.cos(y)*(s?s/2:g),a=Math.cos(y)*g,r=Math.sin(y)*g,f=Math.sin(y)*(s?s/2:g),e.moveTo(n-h,i-r),e.lineTo(n+h,i+r),e.moveTo(n+f,i-a),e.lineTo(n-f,i+a);break;case"star":h=Math.cos(y)*(s?s/2:g),a=Math.cos(y)*g,r=Math.sin(y)*g,f=Math.sin(y)*(s?s/2:g),e.moveTo(n-h,i-r),e.lineTo(n+h,i+r),e.moveTo(n+f,i-a),e.lineTo(n-f,i+a),y+=re,h=Math.cos(y)*(s?s/2:g),a=Math.cos(y)*g,r=Math.sin(y)*g,f=Math.sin(y)*(s?s/2:g),e.moveTo(n-h,i-r),e.lineTo(n+h,i+r),e.moveTo(n+f,i-a),e.lineTo(n-f,i+a);break;case"line":a=s?s/2:Math.cos(y)*g,r=Math.sin(y)*g,e.moveTo(n-a,i-r),e.lineTo(n+a,i+r);break;case"dash":e.moveTo(n,i),e.lineTo(n+Math.cos(y)*(s?s/2:g),i+Math.sin(y)*g);break;case!1:e.closePath();break}e.fill(),t.borderWidth>0&&e.stroke()}}function ke(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x<t.right+n&&e.y>t.top-n&&e.y<t.bottom+n}function _i(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function xi(e){e.restore()}function Q_(e,t,n,i,s){if(!t)return e.lineTo(n.x,n.y);if(s==="middle"){const o=(t.x+n.x)/2;e.lineTo(o,t.y),e.lineTo(o,n.y)}else s==="after"!=!!i?e.lineTo(t.x,n.y):e.lineTo(n.x,t.y);e.lineTo(n.x,n.y)}function J_(e,t,n,i){if(!t)return e.lineTo(n.x,n.y);e.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?n.cp2x:n.cp1x,i?n.cp2y:n.cp1y,n.x,n.y)}function tx(e,t){t.translation&&e.translate(t.translation[0],t.translation[1]),Z(t.rotation)||e.rotate(t.rotation),t.color&&(e.fillStyle=t.color),t.textAlign&&(e.textAlign=t.textAlign),t.textBaseline&&(e.textBaseline=t.textBaseline)}function ex(e,t,n,i,s){if(s.strikethrough||s.underline){const o=e.measureText(i),a=t-o.actualBoundingBoxLeft,r=t+o.actualBoundingBoxRight,l=n-o.actualBoundingBoxAscent,c=n+o.actualBoundingBoxDescent,u=s.strikethrough?(l+c)/2:c;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=s.decorationWidth||2,e.moveTo(a,u),e.lineTo(r,u),e.stroke()}}function nx(e,t){const n=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=n}function en(e,t,n,i,s,o={}){const a=ct(t)?t:[t],r=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(e.save(),e.font=s.string,tx(e,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&nx(e,o.backdrop),r&&(o.strokeColor&&(e.strokeStyle=o.strokeColor),Z(o.strokeWidth)||(e.lineWidth=o.strokeWidth),e.strokeText(c,n,i,o.maxWidth)),e.fillText(c,n,i,o.maxWidth),ex(e,n,i,c,o),i+=Number(s.lineHeight);e.restore()}function An(e,t){const{x:n,y:i,w:s,h:o,radius:a}=t;e.arc(n+a.topLeft,i+a.topLeft,a.topLeft,1.5*tt,tt,!0),e.lineTo(n,i+o-a.bottomLeft),e.arc(n+a.bottomLeft,i+o-a.bottomLeft,a.bottomLeft,tt,yt,!0),e.lineTo(n+s-a.bottomRight,i+o),e.arc(n+s-a.bottomRight,i+o-a.bottomRight,a.bottomRight,yt,0,!0),e.lineTo(n+s,i+a.topRight),e.arc(n+s-a.topRight,i+a.topRight,a.topRight,0,-yt,!0),e.lineTo(n+a.topLeft,i)}const ix=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,sx=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function ox(e,t){const n=(""+e).match(ix);if(!n||n[1]==="normal")return t*1.2;switch(e=+n[2],n[3]){case"px":return e;case"%":e/=100;break}return t*e}const ax=e=>+e||0;function ia(e,t){const n={},i=nt(t),s=i?Object.keys(t):t,o=nt(e)?i?a=>Q(e[a],e[t[a]]):a=>e[a]:()=>e;for(const a of s)n[a]=ax(o(a));return n}function gc(e){return ia(e,{top:"y",right:"x",bottom:"y",left:"x"})}function Ne(e){return ia(e,["topLeft","topRight","bottomLeft","bottomRight"])}function Pt(e){const t=gc(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function xt(e,t){e=e||{},t=t||bt.font;let n=Q(e.size,t.size);typeof n=="string"&&(n=parseInt(n,10));let i=Q(e.style,t.style);i&&!(""+i).match(sx)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const s={family:Q(e.family,t.family),lineHeight:ox(Q(e.lineHeight,t.lineHeight),n),size:n,style:i,weight:Q(e.weight,t.weight),string:""};return s.string=K_(s),s}function wi(e,t,n,i){let s,o,a;for(s=0,o=e.length;s<o;++s)if(a=e[s],a!==void 0&&a!==void 0)return a}function rx(e,t,n){const{min:i,max:s}=e,o=Kl(t,(s-i)/2),a=(r,l)=>n&&r===0?0:r+l;return{min:a(i,-Math.abs(o)),max:a(s,o)}}function Be(e,t){return Object.assign(Object.create(e),t)}function sa(e,t=[""],n,i,s=()=>e[0]){const o=n||e;typeof i>"u"&&(i=wc("_fallback",e));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:o,_fallback:i,_getTarget:s,override:r=>sa([r,...e],t,o,i)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete e[0][l],!0},get(r,l){return bc(r,l,()=>px(l,t,e,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(e[0])},has(r,l){return kc(r).includes(l)},ownKeys(r){return kc(r)},set(r,l,c){const u=r._storage||(r._storage=s());return r[l]=u[l]=c,delete r._keys,!0}})}function Pn(e,t,n,i){const s={_cacheable:!1,_proxy:e,_context:t,_subProxy:n,_stack:new Set,_descriptors:yc(e,i),setContext:o=>Pn(e,o,n,i),override:o=>Pn(e.override(o),t,n,i)};return new Proxy(s,{deleteProperty(o,a){return delete o[a],delete e[a],!0},get(o,a,r){return bc(o,a,()=>cx(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(e,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,a)},getPrototypeOf(){return Reflect.getPrototypeOf(e)},has(o,a){return Reflect.has(e,a)},ownKeys(){return Reflect.ownKeys(e)},set(o,a,r){return e[a]=r,delete o[a],!0}})}function yc(e,t={scriptable:!0,indexable:!0}){const{_scriptable:n=t.scriptable,_indexable:i=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:n,indexable:i,isScriptable:Kt(n)?n:()=>n,isIndexable:Kt(i)?i:()=>i}}const lx=(e,t)=>e?e+Go(t):t,oa=(e,t)=>nt(t)&&e!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function bc(e,t,n){if(Object.prototype.hasOwnProperty.call(e,t)||t==="constructor")return e[t];const i=n();return e[t]=i,i}function cx(e,t,n){const{_proxy:i,_context:s,_subProxy:o,_descriptors:a}=e;let r=i[t];return Kt(r)&&a.isScriptable(t)&&(r=dx(t,r,e,n)),ct(r)&&r.length&&(r=ux(t,r,e,a.isIndexable)),oa(t,r)&&(r=Pn(r,s,o&&o[t],a)),r}function dx(e,t,n,i){const{_proxy:s,_context:o,_subProxy:a,_stack:r}=n;if(r.has(e))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+e);r.add(e);let l=t(o,a||i);return r.delete(e),oa(e,l)&&(l=aa(s._scopes,s,e,l)),l}function ux(e,t,n,i){const{_proxy:s,_context:o,_subProxy:a,_descriptors:r}=n;if(typeof o.index<"u"&&i(e))return t[o.index%t.length];if(nt(t[0])){const l=t,c=s._scopes.filter(u=>u!==l);t=[];for(const u of l){const h=aa(c,s,e,u);t.push(Pn(h,o,a&&a[e],r))}}return t}function _c(e,t,n){return Kt(e)?e(t,n):e}const hx=(e,t)=>e===!0?t:typeof e=="string"?Re(t,e):void 0;function fx(e,t,n,i,s){for(const o of t){const a=hx(n,o);if(a){e.add(a);const r=_c(a._fallback,n,s);if(typeof r<"u"&&r!==n&&r!==i)return r}else if(a===!1&&typeof i<"u"&&n!==i)return null}return!1}function aa(e,t,n,i){const s=t._rootScopes,o=_c(t._fallback,n,i),a=[...e,...s],r=new Set;r.add(i);let l=xc(r,a,n,o||n,i);return l===null||typeof o<"u"&&o!==n&&(l=xc(r,a,o,l,i),l===null)?!1:sa(Array.from(r),[""],s,o,()=>mx(t,n,i))}function xc(e,t,n,i,s){for(;n;)n=fx(e,t,n,i,s);return n}function mx(e,t,n){const i=e._getTarget();t in i||(i[t]={});const s=i[t];return ct(s)&&nt(n)?n:s||{}}function px(e,t,n,i){let s;for(const o of t)if(s=wc(lx(o,e),n),typeof s<"u")return oa(e,s)?aa(n,i,e,s):s}function wc(e,t){for(const n of t){if(!n)continue;const i=n[e];if(typeof i<"u")return i}}function kc(e){let t=e._keys;return t||(t=e._keys=gx(e._scopes)),t}function gx(e){const t=new Set;for(const n of e)for(const i of Object.keys(n).filter(s=>!s.startsWith("_")))t.add(i);return Array.from(t)}function Tc(e,t,n,i){const{iScale:s}=e,{key:o="r"}=this._parsing,a=new Array(i);let r,l,c,u;for(r=0,l=i;r<l;++r)c=r+n,u=t[c],a[r]={r:s.parse(Re(u,o),c)};return a}const yx=Number.EPSILON||1e-14,En=(e,t)=>t<e.length&&!e[t].skip&&e[t],vc=e=>e==="x"?"y":"x";function bx(e,t,n,i){const s=e.skip?t:e,o=t,a=n.skip?t:n,r=On(o,s),l=On(a,o);let c=r/(r+l),u=l/(r+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;const h=i*c,f=i*u;return{previous:{x:o.x-h*(a.x-s.x),y:o.y-h*(a.y-s.y)},next:{x:o.x+f*(a.x-s.x),y:o.y+f*(a.y-s.y)}}}function _x(e,t,n){const i=e.length;let s,o,a,r,l,c=En(e,0);for(let u=0;u<i-1;++u)if(l=c,c=En(e,u+1),!(!l||!c)){if(mi(t[u],0,yx)){n[u]=n[u+1]=0;continue}s=n[u]/t[u],o=n[u+1]/t[u],r=Math.pow(s,2)+Math.pow(o,2),!(r<=9)&&(a=3/Math.sqrt(r),n[u]=s*a*t[u],n[u+1]=o*a*t[u])}}function xx(e,t,n="x"){const i=vc(n),s=e.length;let o,a,r,l=En(e,0);for(let c=0;c<s;++c){if(a=r,r=l,l=En(e,c+1),!r)continue;const u=r[n],h=r[i];a&&(o=(u-a[n])/3,r[`cp1${n}`]=u-o,r[`cp1${i}`]=h-o*t[c]),l&&(o=(l[n]-u)/3,r[`cp2${n}`]=u+o,r[`cp2${i}`]=h+o*t[c])}}function wx(e,t="x"){const n=vc(t),i=e.length,s=Array(i).fill(0),o=Array(i);let a,r,l,c=En(e,0);for(a=0;a<i;++a)if(r=l,l=c,c=En(e,a+1),!!l){if(c){const u=c[t]-l[t];s[a]=u!==0?(c[n]-l[n])/u:0}o[a]=r?c?he(s[a-1])!==he(s[a])?0:(s[a-1]+s[a])/2:s[a-1]:s[a]}_x(e,s,o),xx(e,o,t)}function Ts(e,t,n){return Math.max(Math.min(e,n),t)}function kx(e,t){let n,i,s,o,a,r=ke(e[0],t);for(n=0,i=e.length;n<i;++n)a=o,o=r,r=n<i-1&&ke(e[n+1],t),o&&(s=e[n],a&&(s.cp1x=Ts(s.cp1x,t.left,t.right),s.cp1y=Ts(s.cp1y,t.top,t.bottom)),r&&(s.cp2x=Ts(s.cp2x,t.left,t.right),s.cp2y=Ts(s.cp2y,t.top,t.bottom)))}function Tx(e,t,n,i,s){let o,a,r,l;if(t.spanGaps&&(e=e.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")wx(e,s);else{let c=i?e[e.length-1]:e[0];for(o=0,a=e.length;o<a;++o)r=e[o],l=bx(c,r,e[Math.min(o+1,a-(i?0:1))%a],t.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,c=r}t.capBezierPoints&&kx(e,n)}function ra(){return typeof window<"u"&&typeof document<"u"}function la(e){let t=e.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function vs(e,t,n){let i;return typeof e=="string"?(i=parseInt(e,10),e.indexOf("%")!==-1&&(i=i/100*t.parentNode[n])):i=e,i}const Ss=e=>e.ownerDocument.defaultView.getComputedStyle(e,null);function vx(e,t){return Ss(e).getPropertyValue(t)}const Sx=["top","right","bottom","left"];function nn(e,t,n){const i={};n=n?"-"+n:"";for(let s=0;s<4;s++){const o=Sx[s];i[o]=parseFloat(e[t+"-"+o+n])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Mx=(e,t,n)=>(e>0||t>0)&&(!n||!n.shadowRoot);function Dx(e,t){const n=e.touches,i=n&&n.length?n[0]:e,{offsetX:s,offsetY:o}=i;let a=!1,r,l;if(Mx(s,o,e.target))r=s,l=o;else{const c=t.getBoundingClientRect();r=i.clientX-c.left,l=i.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function Fe(e,t){if("native"in e)return e;const{canvas:n,currentDevicePixelRatio:i}=t,s=Ss(n),o=s.boxSizing==="border-box",a=nn(s,"padding"),r=nn(s,"border","width"),{x:l,y:c,box:u}=Dx(e,n),h=a.left+(u&&r.left),f=a.top+(u&&r.top);let{width:m,height:p}=t;return o&&(m-=a.width+r.width,p-=a.height+r.height),{x:Math.round((l-h)/m*n.width/i),y:Math.round((c-f)/p*n.height/i)}}function Cx(e,t,n){let i,s;if(t===void 0||n===void 0){const o=e&&la(e);if(!o)t=e.clientWidth,n=e.clientHeight;else{const a=o.getBoundingClientRect(),r=Ss(o),l=nn(r,"border","width"),c=nn(r,"padding");t=a.width-c.width-l.width,n=a.height-c.height-l.height,i=vs(r.maxWidth,o,"clientWidth"),s=vs(r.maxHeight,o,"clientHeight")}}return{width:t,height:n,maxWidth:i||ps,maxHeight:s||ps}}const ze=e=>Math.round(e*10)/10;function Ox(e,t,n,i){const s=Ss(e),o=nn(s,"margin"),a=vs(s.maxWidth,e,"clientWidth")||ps,r=vs(s.maxHeight,e,"clientHeight")||ps,l=Cx(e,t,n);let{width:c,height:u}=l;if(s.boxSizing==="content-box"){const f=nn(s,"border","width"),m=nn(s,"padding");c-=m.width+f.width,u-=m.height+f.height}return c=Math.max(0,c-o.width),u=Math.max(0,i?c/i:u-o.height),c=ze(Math.min(c,a,l.maxWidth)),u=ze(Math.min(u,r,l.maxHeight)),c&&!u&&(u=ze(c/2)),(t!==void 0||n!==void 0)&&i&&l.height&&u>l.height&&(u=l.height,c=ze(Math.floor(u*i))),{width:c,height:u}}function Sc(e,t,n){const i=t||1,s=ze(e.height*i),o=ze(e.width*i);e.height=ze(e.height),e.width=ze(e.width);const a=e.canvas;return a.style&&(n||!a.style.height&&!a.style.width)&&(a.style.height=`${e.height}px`,a.style.width=`${e.width}px`),e.currentDevicePixelRatio!==i||a.height!==s||a.width!==o?(e.currentDevicePixelRatio=i,a.height=s,a.width=o,e.ctx.setTransform(i,0,0,i,0,0),!0):!1}const Ax=(function(){let e=!1;try{const t={get passive(){return e=!0,!1}};ra()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return e})();function Mc(e,t){const n=vx(e,t),i=n&&n.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function sn(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}}function Px(e,t,n,i){return{x:e.x+n*(t.x-e.x),y:i==="middle"?n<.5?e.y:t.y:i==="after"?n<1?e.y:t.y:n>0?t.y:e.y}}function Ex(e,t,n,i){const s={x:e.cp2x,y:e.cp2y},o={x:t.cp1x,y:t.cp1y},a=sn(e,s,n),r=sn(s,o,n),l=sn(o,t,n),c=sn(a,r,n),u=sn(r,l,n);return sn(c,u,n)}const Rx=function(e,t){return{x(n){return e+e+t-n},setWidth(n){t=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,i){return n-i},leftForLtr(n,i){return n-i}}},Ix=function(){return{x(e){return e},setWidth(e){},textAlign(e){return e},xPlus(e,t){return e+t},leftForLtr(e,t){return e}}};function Rn(e,t,n){return e?Rx(t,n):Ix()}function Dc(e,t){let n,i;(t==="ltr"||t==="rtl")&&(n=e.canvas.style,i=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",t,"important"),e.prevTextDirection=i)}function Cc(e,t){t!==void 0&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function Oc(e){return e==="angle"?{between:pi,compare:L_,normalize:Ut}:{between:xe,compare:(t,n)=>t-n,normalize:t=>t}}function Ac({start:e,end:t,count:n,loop:i,style:s}){return{start:e%n,end:t%n,loop:i&&(t-e+1)%n===0,style:s}}function Lx(e,t,n){const{property:i,start:s,end:o}=n,{between:a,normalize:r}=Oc(i),l=t.length;let{start:c,end:u,loop:h}=e,f,m;if(h){for(c+=l,u+=l,f=0,m=l;f<m&&a(r(t[c%l][i]),s,o);++f)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:h,style:e.style}}function Pc(e,t,n){if(!n)return[e];const{property:i,start:s,end:o}=n,a=t.length,{compare:r,between:l,normalize:c}=Oc(i),{start:u,end:h,loop:f,style:m}=Lx(e,t,n),p=[];let g=!1,y=null,_,x,T;const S=()=>l(s,T,_)&&r(s,T)!==0,w=()=>r(o,_)===0||l(o,T,_),D=()=>g||S(),v=()=>!g||w();for(let A=u,R=u;A<=h;++A)x=t[A%a],!x.skip&&(_=c(x[i]),_!==T&&(g=l(_,s,o),y===null&&D()&&(y=r(_,s)===0?A:R),y!==null&&v()&&(p.push(Ac({start:y,end:A,loop:f,count:a,style:m})),y=null),R=A,T=_));return y!==null&&p.push(Ac({start:y,end:h,loop:f,count:a,style:m})),p}function Ec(e,t){const n=[],i=e.segments;for(let s=0;s<i.length;s++){const o=Pc(i[s],e.points,t);o.length&&n.push(...o)}return n}function Nx(e,t,n,i){let s=0,o=t-1;if(n&&!i)for(;s<t&&!e[s].skip;)s++;for(;s<t&&e[s].skip;)s++;for(s%=t,n&&(o+=s);o>s&&e[o%t].skip;)o--;return o%=t,{start:s,end:o}}function Bx(e,t,n,i){const s=e.length,o=[];let a=t,r=e[t],l;for(l=t+1;l<=n;++l){const c=e[l%s];c.skip||c.stop?r.skip||(i=!1,o.push({start:t%s,end:(l-1)%s,loop:i}),t=a=c.stop?l:null):(a=l,r.skip&&(t=l)),r=c}return a!==null&&o.push({start:t%s,end:a%s,loop:i}),o}function Fx(e,t){const n=e.points,i=e.options.spanGaps,s=n.length;if(!s)return[];const o=!!e._loop,{start:a,end:r}=Nx(n,s,o,i);if(i===!0)return Rc(e,[{start:a,end:r,loop:o}],n,t);const l=r<a?r+s:r,c=!!e._fullLoop&&a===0&&r===s-1;return Rc(e,Bx(n,a,l,c),n,t)}function Rc(e,t,n,i){return!i||!i.setContext||!n?t:zx(e,t,n,i)}function zx(e,t,n,i){const s=e._chart.getContext(),o=Ic(e.options),{_datasetIndex:a,options:{spanGaps:r}}=e,l=n.length,c=[];let u=o,h=t[0].start,f=h;function m(p,g,y,_){const x=r?-1:1;if(p!==g){for(p+=l;n[p%l].skip;)p-=x;for(;n[g%l].skip;)g+=x;p%l!==g%l&&(c.push({start:p%l,end:g%l,loop:y,style:_}),u=_,h=g%l)}}for(const p of t){h=r?h:p.start;let g=n[h%l],y;for(f=h+1;f<=p.end;f++){const _=n[f%l];y=Ic(i.setContext(Be(s,{type:"segment",p0:g,p1:_,p0DataIndex:(f-1)%l,p1DataIndex:f%l,datasetIndex:a}))),Ux(y,u)&&m(h,f-1,p.loop,u),g=_,u=y}h<f-1&&m(h,f-1,p.loop,u)}return c}function Ic(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function Ux(e,t){if(!t)return!1;const n=[],i=function(s,o){return Qo(o)?(n.includes(o)||n.push(o),n.indexOf(o)):o};return JSON.stringify(e,i)!==JSON.stringify(t,i)}function Ms(e,t,n){return e.options.clip?e[n]:t[n]}function Vx(e,t){const{xScale:n,yScale:i}=e;return n&&i?{left:Ms(n,t,"left"),right:Ms(n,t,"right"),top:Ms(i,t,"top"),bottom:Ms(i,t,"bottom")}:t}function Lc(e,t){const n=t._clip;if(n.disabled)return!1;const i=Vx(t,e.chartArea);return{left:n.left===!1?0:i.left-(n.left===!0?0:n.left),right:n.right===!1?e.width:i.right+(n.right===!0?0:n.right),top:n.top===!1?0:i.top-(n.top===!0?0:n.top),bottom:n.bottom===!1?e.height:i.bottom+(n.bottom===!0?0:n.bottom)}}class Hx{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,i,s){const o=n.listeners[s],a=n.duration;o.forEach(r=>r({chart:t,initial:n.initial,numSteps:a,currentStep:Math.min(i-n.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=ac.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const o=i.items;let a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let i=n.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,i)),i}listen(t,n,i){this._getAnims(t).listeners[n].push(i)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const i=n.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Te=new Hx;const Nc="transparent",$x={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const i=xs(e||Nc),s=i.valid&&xs(t||Nc);return s&&s.valid?s.mix(i,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class Yx{constructor(t,n,i,s){const o=n[i];s=wi([t.to,s,o,t.from]);const a=wi([t.from,o,s]);this._active=!0,this._fn=t.fn||$x[t.type||typeof a],this._easing=gi[t.easing]||gi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=i,this._from=a,this._to=s,this._promises=void 0}active(){return this._active}update(t,n,i){if(this._active){this._notify(!1);const s=this._target[this._prop],o=i-this._start,a=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=wi([t.to,n,s,t.from]),this._from=wi([t.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,i=this._duration,s=this._prop,o=this._from,a=this._loop,r=this._to;let l;if(this._active=o!==r&&(a||n<i),!this._active){this._target[s]=r,this._notify(!0);return}if(n<0){this._target[s]=o;return}l=n/i%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,r,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,i)=>{t.push({res:n,rej:i})})}_notify(t){const n=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][n]()}}class ca{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!nt(t))return;const n=Object.keys(bt.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const o=t[s];if(!nt(o))return;const a={};for(const r of n)a[r]=o[r];(ct(o.properties)&&o.properties||[s]).forEach(r=>{(r===s||!i.has(r))&&i.set(r,a)})})}_animateOptions(t,n){const i=n.options,s=jx(t,i);if(!s)return[];const o=this._createAnimations(s,i);return i.$shared&&Wx(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,n){const i=this._properties,s=[],o=t.$animations||(t.$animations={}),a=Object.keys(n),r=Date.now();let l;for(l=a.length-1;l>=0;--l){const c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(t,n));continue}const u=n[c];let h=o[c];const f=i.get(c);if(h)if(f&&h.active()){h.update(f,u,r);continue}else h.cancel();if(!f||!f.duration){t[c]=u;continue}o[c]=h=new Yx(f,t,c,u),s.push(h)}return s}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const i=this._createAnimations(t,n);if(i.length)return Te.add(this._chart,i),!0}}function Wx(e,t){const n=[],i=Object.keys(t);for(let s=0;s<i.length;s++){const o=e[i[s]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function jx(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function Bc(e,t){const n=e&&e.options||{},i=n.reverse,s=n.min===void 0?t:0,o=n.max===void 0?t:0;return{start:i?o:s,end:i?s:o}}function qx(e,t,n){if(n===!1)return!1;const i=Bc(e,n),s=Bc(t,n);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function Gx(e){let t,n,i,s;return nt(e)?(t=e.top,n=e.right,i=e.bottom,s=e.left):t=n=i=s=e,{top:t,right:n,bottom:i,left:s,disabled:e===!1}}function Fc(e,t){const n=[],i=e._getSortedDatasetMetas(t);let s,o;for(s=0,o=i.length;s<o;++s)n.push(i[s].index);return n}function zc(e,t,n,i={}){const s=e.keys,o=i.mode==="single";let a,r,l,c;if(t===null)return;let u=!1;for(a=0,r=s.length;a<r;++a){if(l=+s[a],l===n){if(u=!0,i.all)continue;break}c=e.values[l],_t(c)&&(o||t===0||he(t)===he(c))&&(t+=c)}return!u&&!i.all?0:t}function Xx(e,t){const{iScale:n,vScale:i}=t,s=n.axis==="x"?"x":"y",o=i.axis==="x"?"x":"y",a=Object.keys(e),r=new Array(a.length);let l,c,u;for(l=0,c=a.length;l<c;++l)u=a[l],r[l]={[s]:u,[o]:e[u]};return r}function da(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function Kx(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function Zx(e){const{min:t,max:n,minDefined:i,maxDefined:s}=e.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?n:Number.POSITIVE_INFINITY}}function Qx(e,t,n){const i=e[t]||(e[t]={});return i[n]||(i[n]={})}function Uc(e,t,n,i){for(const s of t.getMatchingVisibleMetas(i).reverse()){const o=e[s.index];if(n&&o>0||!n&&o<0)return s.index}return null}function Vc(e,t){const{chart:n,_cachedMeta:i}=e,s=n._stacks||(n._stacks={}),{iScale:o,vScale:a,index:r}=i,l=o.axis,c=a.axis,u=Kx(o,a,i),h=t.length;let f;for(let m=0;m<h;++m){const p=t[m],{[l]:g,[c]:y}=p,_=p._stacks||(p._stacks={});f=_[c]=Qx(s,u,g),f[r]=y,f._top=Uc(f,a,!0,i.type),f._bottom=Uc(f,a,!1,i.type);const x=f._visualValues||(f._visualValues={});x[r]=y}}function ua(e,t){const n=e.scales;return Object.keys(n).filter(i=>n[i].axis===t).shift()}function Jx(e,t){return Be(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function tw(e,t,n){return Be(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function ki(e,t){const n=e.controller.index,i=e.vScale&&e.vScale.axis;if(i){t=t||e._parsed;for(const s of t){const o=s._stacks;if(!o||o[i]===void 0||o[i][n]===void 0)return;delete o[i][n],o[i]._visualValues!==void 0&&o[i]._visualValues[n]!==void 0&&delete o[i]._visualValues[n]}}}const ha=e=>e==="reset"||e==="none",Hc=(e,t)=>t?e:Object.assign({},e),ew=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:Fc(n,!0),values:null};class Ue{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=da(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&ki(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,i=this.getDataset(),s=(h,f,m,p)=>h==="x"?f:h==="r"?p:m,o=n.xAxisID=Q(i.xAxisID,ua(t,"x")),a=n.yAxisID=Q(i.yAxisID,ua(t,"y")),r=n.rAxisID=Q(i.rAxisID,ua(t,"r")),l=n.indexAxis,c=n.iAxisID=s(l,o,a,r),u=n.vAxisID=s(l,a,o,r);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(a),n.rScale=this.getScaleForId(r),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&sc(this._data,this),t._stacked&&ki(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),i=this._data;if(nt(n)){const s=this._cachedMeta;this._data=Xx(n,s)}else if(i!==n){if(i){sc(i,this);const s=this._cachedMeta;ki(s),s._parsed=[]}n&&Object.isExtensible(n)&&z_(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const o=n._stacked;n._stacked=da(n.vScale,n),n.stack!==i.stack&&(s=!0,ki(n),n.stack=i.stack),this._resyncElements(t),(s||o!==n._stacked)&&(Vc(this,n._parsed),n._stacked=da(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:a}=i,r=o.axis;let l=t===0&&n===s.length?!0:i._sorted,c=t>0&&i._parsed[t-1],u,h,f;if(this._parsing===!1)i._parsed=s,i._sorted=!0,f=s;else{ct(s[t])?f=this.parseArrayData(i,s,t,n):nt(s[t])?f=this.parseObjectData(i,s,t,n):f=this.parsePrimitiveData(i,s,t,n);const m=()=>h[r]===null||c&&h[r]<c[r];for(u=0;u<n;++u)i._parsed[u+t]=h=f[u],l&&(m()&&(l=!1),c=h);i._sorted=l}a&&Vc(this,f)}parsePrimitiveData(t,n,i,s){const{iScale:o,vScale:a}=t,r=o.axis,l=a.axis,c=o.getLabels(),u=o===a,h=new Array(s);let f,m,p;for(f=0,m=s;f<m;++f)p=f+i,h[f]={[r]:u||o.parse(c[p],p),[l]:a.parse(n[p],p)};return h}parseArrayData(t,n,i,s){const{xScale:o,yScale:a}=t,r=new Array(s);let l,c,u,h;for(l=0,c=s;l<c;++l)u=l+i,h=n[u],r[l]={x:o.parse(h[0],u),y:a.parse(h[1],u)};return r}parseObjectData(t,n,i,s){const{xScale:o,yScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=new Array(s);let u,h,f,m;for(u=0,h=s;u<h;++u)f=u+i,m=n[f],c[u]={x:o.parse(Re(m,r),f),y:a.parse(Re(m,l),f)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,i){const s=this.chart,o=this._cachedMeta,a=n[t.axis],r={keys:Fc(s,!0),values:n._stacks[t.axis]._visualValues};return zc(r,a,o.index,{mode:i})}updateRangeFromParsed(t,n,i,s){const o=i[n.axis];let a=o===null?NaN:o;const r=s&&i._stacks[n.axis];s&&r&&(s.values=r,a=zc(s,o,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,n){const i=this._cachedMeta,s=i._parsed,o=i._sorted&&t===i.iScale,a=s.length,r=this._getOtherScale(t),l=ew(n,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:h}=Zx(r);let f,m;function p(){m=s[f];const g=m[r.axis];return!_t(m[t.axis])||u>g||h<g}for(f=0;f<a&&!(!p()&&(this.updateRangeFromParsed(c,t,m,l),o));++f);if(o){for(f=a-1;f>=0;--f)if(!p()){this.updateRangeFromParsed(c,t,m,l);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,i=[];let s,o,a;for(s=0,o=n.length;s<o;++s)a=n[s][t.axis],_t(a)&&i.push(a);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,i=n.iScale,s=n.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:s?""+s.getLabelForValue(o[s.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=Gx(Q(this.options.clip,qx(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,i=this._cachedMeta,s=i.data||[],o=n.chartArea,a=[],r=this._drawStart||0,l=this._drawCount||s.length-r,c=this.options.drawActiveElementsOnTop;let u;for(i.dataset&&i.dataset.draw(t,o,r,l),u=r;u<r+l;++u){const h=s[u];h.hidden||(h.active&&c?a.push(h):h.draw(t,o))}for(u=0;u<a.length;++u)a[u].draw(t,o)}getStyle(t,n){const i=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,n,i){const s=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const a=this._cachedMeta.data[t];o=a.$context||(a.$context=tw(this.getContext(),t,a)),o.parsed=this.getParsed(t),o.raw=s.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=Jx(this.chart.getContext(),this.index)),o.dataset=s,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",i){const s=n==="active",o=this._cachedDataOpts,a=t+"-"+n,r=o[a],l=this.enableOptionSharing&&Xt(i);if(r)return Hc(r,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),h=s?[`${t}Hover`,"hover",t,""]:[t,""],f=c.getOptionScopes(this.getDataset(),u),m=Object.keys(bt.elements[t]),p=()=>this.getContext(i,s,n),g=c.resolveNamedOptions(f,m,p,h);return g.$shared&&(g.$shared=l,o[a]=Object.freeze(Hc(g,l))),g}_resolveAnimations(t,n,i){const s=this.chart,o=this._cachedDataOpts,a=`animation-${n}`,r=o[a];if(r)return r;let l;if(s.options.animation!==!1){const u=this.chart.config,h=u.datasetAnimationScopeKeys(this._type,n),f=u.getOptionScopes(this.getDataset(),h);l=u.createResolver(f,this.getContext(t,i,n))}const c=new ca(s,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||ha(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const i=this.resolveDataElementOptions(t,n),s=this._sharedOptions,o=this.getSharedOptions(i),a=this.includeOptions(n,o)||o!==s;return this.updateSharedOptions(o,n,i),{sharedOptions:o,includeOptions:a}}updateElement(t,n,i,s){ha(s)?Object.assign(t,i):this._resolveAnimations(n,s).update(t,i)}updateSharedOptions(t,n,i){t&&!ha(n)&&this._resolveAnimations(void 0,n).update(t,i)}_setStyle(t,n,i,s){t.active=s;const o=this.getStyle(n,s);this._resolveAnimations(n,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,n,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,i=this._cachedMeta.data;for(const[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];const s=i.length,o=n.length,a=Math.min(o,s);a&&this.parse(0,a),o>s?this._insertElements(s,o-s,t):o<s&&this._removeElements(o,s-o)}_insertElements(t,n,i=!0){const s=this._cachedMeta,o=s.data,a=t+n;let r;const l=c=>{for(c.length+=n,r=c.length-1;r>=a;r--)c[r]=c[r-n]};for(l(o),r=t;r<a;++r)o[r]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,n),i&&this.updateElements(o,t,n,"reset")}updateElements(t,n,i,s){}_removeElements(t,n){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,n);i._stacked&&ki(i,s)}i.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,i,s]=t;this[n](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function nw(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let i=[];for(let s=0,o=n.length;s<o;s++)i=i.concat(n[s].controller.getAllParsedValues(e));e._cache.$bar=oc(i.sort((s,o)=>s-o))}return e._cache.$bar}function iw(e){const t=e.iScale,n=nw(t,e.type);let i=t._length,s,o,a,r;const l=()=>{a===32767||a===-32768||(Xt(r)&&(i=Math.min(i,Math.abs(a-r)||i)),r=a)};for(s=0,o=n.length;s<o;++s)a=t.getPixelForValue(n[s]),l();for(r=void 0,s=0,o=t.ticks.length;s<o;++s)a=t.getPixelForTick(s),l();return i}function sw(e,t,n,i){const s=n.barThickness;let o,a;return Z(s)?(o=t.min*n.categoryPercentage,a=n.barPercentage):(o=s*i,a=1),{chunk:o/i,ratio:a,start:t.pixels[e]-o/2}}function ow(e,t,n,i){const s=t.pixels,o=s[e];let a=e>0?s[e-1]:null,r=e<s.length-1?s[e+1]:null;const l=n.categoryPercentage;a===null&&(a=o-(r===null?t.end-t.start:r-o)),r===null&&(r=o+o-a);const c=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/i,ratio:n.barPercentage,start:c}}function aw(e,t,n,i){const s=n.parse(e[0],i),o=n.parse(e[1],i),a=Math.min(s,o),r=Math.max(s,o);let l=a,c=r;Math.abs(a)>Math.abs(r)&&(l=r,c=a),t[n.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:o,min:a,max:r}}function $c(e,t,n,i){return ct(e)?aw(e,t,n,i):t[n.axis]=n.parse(e,i),t}function Yc(e,t,n,i){const s=e.iScale,o=e.vScale,a=s.getLabels(),r=s===o,l=[];let c,u,h,f;for(c=n,u=n+i;c<u;++c)f=t[c],h={},h[s.axis]=r||s.parse(a[c],c),l.push($c(f,h,o,c));return l}function fa(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function rw(e,t,n){return e!==0?he(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}function lw(e){let t,n,i,s,o;return e.horizontal?(t=e.base>e.x,n="left",i="right"):(t=e.base<e.y,n="bottom",i="top"),t?(s="end",o="start"):(s="start",o="end"),{start:n,end:i,reverse:t,top:s,bottom:o}}function cw(e,t,n,i){let s=t.borderSkipped;const o={};if(!s){e.borderSkipped=o;return}if(s===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:a,end:r,reverse:l,top:c,bottom:u}=lw(e);s==="middle"&&n&&(e.enableBorderRadius=!0,(n._top||0)===i?s=c:(n._bottom||0)===i?s=u:(o[Wc(u,a,r,l)]=!0,s=c)),o[Wc(s,a,r,l)]=!0,e.borderSkipped=o}function Wc(e,t,n,i){return i?(e=dw(e,t,n),e=jc(e,n,t)):e=jc(e,t,n),e}function dw(e,t,n){return e===t?n:e===n?t:e}function jc(e,t,n){return e==="start"?t:e==="end"?n:e}function uw(e,{inflateAmount:t},n){e.inflateAmount=t==="auto"?n===1?.33:0:t}class qc extends Ue{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,n,i,s){return Yc(t,n,i,s)}parseArrayData(t,n,i,s){return Yc(t,n,i,s)}parseObjectData(t,n,i,s){const{iScale:o,vScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?r:l,u=a.axis==="x"?r:l,h=[];let f,m,p,g;for(f=i,m=i+s;f<m;++f)g=n[f],p={},p[o.axis]=o.parse(Re(g,c),f),h.push($c(Re(g,u),p,a,f));return h}updateRangeFromParsed(t,n,i,s){super.updateRangeFromParsed(t,n,i,s);const o=i._custom;o&&n===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const n=this._cachedMeta,{iScale:i,vScale:s}=n,o=this.getParsed(t),a=o._custom,r=fa(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(o[s.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,t)}updateElements(t,n,i,s){const o=s==="reset",{index:a,_cachedMeta:{vScale:r}}=this,l=r.getBasePixel(),c=r.isHorizontal(),u=this._getRuler(),{sharedOptions:h,includeOptions:f}=this._getSharedOptions(n,s);for(let m=n;m<n+i;m++){const p=this.getParsed(m),g=o||Z(p[r.axis])?{base:l,head:l}:this._calculateBarValuePixels(m),y=this._calculateBarIndexPixels(m,u),_=(p._stacks||{})[r.axis],x={horizontal:c,base:g.base,enableBorderRadius:!_||fa(p._custom)||a===_._top||a===_._bottom,x:c?g.head:y.center,y:c?y.center:g.head,height:c?y.size:Math.abs(g.size),width:c?Math.abs(g.size):y.size};f&&(x.options=h||this.resolveDataElementOptions(m,t[m].active?"active":s));const T=x.options||t[m].options;cw(x,T,_,a),uw(x,T,u.ratio),this.updateElement(t[m],m,x,s)}}_getStacks(t,n){const{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),o=i.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(n),l=r&&r[i.axis],c=u=>{const h=u._parsed.find(m=>m[i.axis]===l),f=h&&h[u.vScale.axis];if(Z(f)||isNaN(f))return!0};for(const u of s)if(!(n!==void 0&&c(u))&&((o===!1||a.indexOf(u.stack)===-1||o===void 0&&u.stack===void 0)&&a.push(u.stack),u.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===n).shift()}_getAxis(){const t={},n=this.getFirstScaleIdForIndexAxis();for(const i of this.chart.data.datasets)t[Q(this.chart.options.indexAxis==="x"?i.xAxisID:i.yAxisID,n)]=!0;return Object.keys(t)}_getStackIndex(t,n,i){const s=this._getStacks(t,i),o=n!==void 0?s.indexOf(n):-1;return o===-1?s.length-1:o}_getRuler(){const t=this.options,n=this._cachedMeta,i=n.iScale,s=[];let o,a;for(o=0,a=n.data.length;o<a;++o)s.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));const r=t.barThickness;return{min:r||iw(n),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:n,_stacked:i,index:s},options:{base:o,minBarLength:a}}=this,r=o||0,l=this.getParsed(t),c=l._custom,u=fa(c);let h=l[n.axis],f=0,m=i?this.applyStack(n,l,i):h,p,g;m!==h&&(f=m-h,m=h),u&&(h=c.barStart,m=c.barEnd-c.barStart,h!==0&&he(h)!==he(c.barEnd)&&(f=0),f+=h);const y=!Z(o)&&!u?o:f;let _=n.getPixelForValue(y);if(this.chart.getDataVisibility(t)?p=n.getPixelForValue(f+m):p=_,g=p-_,Math.abs(g)<a){g=rw(g,n,r)*a,h===r&&(_-=g/2);const x=n.getPixelForDecimal(0),T=n.getPixelForDecimal(1),S=Math.min(x,T),w=Math.max(x,T);_=Math.max(Math.min(_,w),S),p=_+g,i&&!u&&(l._stacks[n.axis]._visualValues[s]=n.getValueForPixel(p)-n.getValueForPixel(_))}if(_===n.getPixelForValue(r)){const x=he(g)*n.getLineWidthForValue(r)/2;_+=x,g-=x}return{size:g,base:_,head:p,center:p+g/2}}_calculateBarIndexPixels(t,n){const i=n.scale,s=this.options,o=s.skipNull,a=Q(s.maxBarThickness,1/0);let r,l;const c=this._getAxisCount();if(n.grouped){const u=o?this._getStackCount(t):n.stackCount,h=s.barThickness==="flex"?ow(t,n,s,u*c):sw(t,n,s,u*c),f=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,m=this._getAxis().indexOf(Q(f,this.getFirstScaleIdForIndexAxis())),p=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+m;r=h.start+h.chunk*p+h.chunk/2,l=Math.min(a,h.chunk*h.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),l=Math.min(a,n.min*n.ratio);return{base:r-l/2,head:r+l/2,center:r,size:l}}draw(){const t=this._cachedMeta,n=t.vScale,i=t.data,s=i.length;let o=0;for(;o<s;++o)this.getParsed(o)[n.axis]!==null&&!i[o].hidden&&i[o].draw(this._ctx)}}class hw extends Ue{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,n,i,s){const o=super.parsePrimitiveData(t,n,i,s);for(let a=0;a<o.length;a++)o[a]._custom=this.resolveDataElementOptions(a+i).radius;return o}parseArrayData(t,n,i,s){const o=super.parseArrayData(t,n,i,s);for(let a=0;a<o.length;a++){const r=n[i+a];o[a]._custom=Q(r[2],this.resolveDataElementOptions(a+i).radius)}return o}parseObjectData(t,n,i,s){const o=super.parseObjectData(t,n,i,s);for(let a=0;a<o.length;a++){const r=n[i+a];o[a]._custom=Q(r&&r.r&&+r.r,this.resolveDataElementOptions(a+i).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let n=0;for(let i=t.length-1;i>=0;--i)n=Math.max(n,t[i].size(this.resolveDataElementOptions(i))/2);return n>0&&n}getLabelAndValue(t){const n=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:o}=n,a=this.getParsed(t),r=s.getLabelForValue(a.x),l=o.getLabelForValue(a.y),c=a._custom;return{label:i[t]||"",value:"("+r+", "+l+(c?", "+c:"")+")"}}update(t){const n=this._cachedMeta.data;this.updateElements(n,0,n.length,t)}updateElements(t,n,i,s){const o=s==="reset",{iScale:a,vScale:r}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(n,s),u=a.axis,h=r.axis;for(let f=n;f<n+i;f++){const m=t[f],p=!o&&this.getParsed(f),g={},y=g[u]=o?a.getPixelForDecimal(.5):a.getPixelForValue(p[u]),_=g[h]=o?r.getBasePixel():r.getPixelForValue(p[h]);g.skip=isNaN(y)||isNaN(_),c&&(g.options=l||this.resolveDataElementOptions(f,m.active?"active":s),o&&(g.options.radius=0)),this.updateElement(m,f,g,s)}}resolveDataElementOptions(t,n){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,n);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const o=s.radius;return n!=="active"&&(s.radius=0),s.radius+=Q(i&&i._custom,o),s}}function fw(e,t,n){let i=1,s=1,o=0,a=0;if(t<gt){const r=e,l=r+t,c=Math.cos(r),u=Math.sin(r),h=Math.cos(l),f=Math.sin(l),m=(T,S,w)=>pi(T,r,l,!0)?1:Math.max(S,S*n,w,w*n),p=(T,S,w)=>pi(T,r,l,!0)?-1:Math.min(S,S*n,w,w*n),g=m(0,c,h),y=m(yt,u,f),_=p(tt,c,h),x=p(tt+yt,u,f);i=(g-_)/2,s=(y-x)/2,o=-(g+_)/2,a=-(y+x)/2}return{ratioX:i,ratioY:s,offsetX:o,offsetY:a}}class Ti extends Ue{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data,{labels:{pointStyle:i,textAlign:s,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return n.labels.length&&n.datasets.length?n.labels.map((l,c)=>{const h=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:h.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:h.borderDash,lineDashOffset:h.borderDashOffset,lineJoin:h.borderJoinStyle,lineWidth:h.borderWidth,strokeStyle:h.borderColor,textAlign:s,pointStyle:i,borderRadius:a&&(r||h.borderRadius),index:c}}):[]}},onClick(t,n,i){i.chart.toggleDataVisibility(n.index),i.chart.update()}}}};constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let o=l=>+i[l];if(nt(i[t])){const{key:l="value"}=this._parsing;o=c=>+Re(i[c],l)}let a,r;for(a=t,r=t+n;a<r;++a)s._parsed[a]=o(a)}}_getRotation(){return At(this.options.rotation-90)}_getCircumference(){return At(this.options.circumference)}_getRotationExtents(){let t=gt,n=-gt;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const s=this.chart.getDatasetMeta(i).controller,o=s._getRotation(),a=s._getCircumference();t=Math.min(t,o),n=Math.max(n,o+a)}return{rotation:t,circumference:n-t}}update(t){const n=this.chart,{chartArea:i}=n,s=this._cachedMeta,o=s.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(i.width,i.height)-a)/2,0),l=Math.min(S_(this.options.cutout,r),1),c=this._getRingWeight(this.index),{circumference:u,rotation:h}=this._getRotationExtents(),{ratioX:f,ratioY:m,offsetX:p,offsetY:g}=fw(h,u,l),y=(i.width-a)/f,_=(i.height-a)/m,x=Math.max(Math.min(y,_)/2,0),T=Kl(this.options.radius,x),S=Math.max(T*l,0),w=(T-S)/this._getVisibleDatasetWeightTotal();this.offsetX=p*T,this.offsetY=g*T,s.total=this.calculateTotal(),this.outerRadius=T-w*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-w*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,n){const i=this.options,s=this._cachedMeta,o=this._getCircumference();return n&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*o/gt)}updateElements(t,n,i,s){const o=s==="reset",a=this.chart,r=a.chartArea,c=a.options.animation,u=(r.left+r.right)/2,h=(r.top+r.bottom)/2,f=o&&c.animateScale,m=f?0:this.innerRadius,p=f?0:this.outerRadius,{sharedOptions:g,includeOptions:y}=this._getSharedOptions(n,s);let _=this._getRotation(),x;for(x=0;x<n;++x)_+=this._circumference(x,o);for(x=n;x<n+i;++x){const T=this._circumference(x,o),S=t[x],w={x:u+this.offsetX,y:h+this.offsetY,startAngle:_,endAngle:_+T,circumference:T,outerRadius:p,innerRadius:m};y&&(w.options=g||this.resolveDataElementOptions(x,S.active?"active":s)),_+=T,this.updateElement(S,x,w,s)}}calculateTotal(){const t=this._cachedMeta,n=t.data;let i=0,s;for(s=0;s<n.length;s++){const o=t._parsed[s];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(s)&&!n[s].hidden&&(i+=Math.abs(o))}return i}calculateCircumference(t){const n=this._cachedMeta.total;return n>0&&!isNaN(t)?gt*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=yi(n._parsed[t],i.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let n=0;const i=this.chart;let s,o,a,r,l;if(!t){for(s=0,o=i.data.datasets.length;s<o;++s)if(i.isDatasetVisible(s)){a=i.getDatasetMeta(s),t=a.data,r=a.controller;break}}if(!t)return 0;for(s=0,o=t.length;s<o;++s)l=r.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(n=Math.max(n,l.borderWidth||0,l.hoverBorderWidth||0));return n}getMaxOffset(t){let n=0;for(let i=0,s=t.length;i<s;++i){const o=this.resolveDataElementOptions(i);n=Math.max(n,o.offset||0,o.hoverOffset||0)}return n}_getRingWeightOffset(t){let n=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(n+=this._getRingWeight(i));return n}_getRingWeight(t){return Math.max(Q(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class Gc extends Ue{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:i,data:s=[],_dataset:o}=n,a=this.chart._animationsDisabled;let{start:r,count:l}=lc(n,s,a);this._drawStart=r,this._drawCount=l,cc(n)&&(r=0,l=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=s;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!a,options:c},t),this.updateElements(s,r,l,t)}updateElements(t,n,i,s){const o=s==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:h}=this._getSharedOptions(n,s),f=a.axis,m=r.axis,{spanGaps:p,segment:g}=this.options,y=Le(p)?p:Number.POSITIVE_INFINITY,_=this.chart._animationsDisabled||o||s==="none",x=n+i,T=t.length;let S=n>0&&this.getParsed(n-1);for(let w=0;w<T;++w){const D=t[w],v=_?D:{};if(w<n||w>=x){v.skip=!0;continue}const A=this.getParsed(w),R=Z(A[m]),E=v[f]=a.getPixelForValue(A[f],w),k=v[m]=o||R?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,A,l):A[m],w);v.skip=isNaN(E)||isNaN(k)||R,v.stop=w>0&&Math.abs(A[f]-S[f])>y,g&&(v.parsed=A,v.raw=c.data[w]),h&&(v.options=u||this.resolveDataElementOptions(w,D.active?"active":s)),_||this.updateElement(D,w,v,s),S=A}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,i=n.options&&n.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const o=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}class Xc extends Ue{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return n.labels.map((o,a)=>{const l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,n,i){i.chart.toggleDataVisibility(n.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,n){super(t,n),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const n=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=yi(n._parsed[t].r,i.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,n,i,s){return Tc.bind(this)(t,n,i,s)}update(t){const n=this._cachedMeta.data;this._updateRadius(),this.updateElements(n,0,n.length,t)}getMinMax(){const t=this._cachedMeta,n={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(o<n.min&&(n.min=o),o>n.max&&(n.max=o))}),n}_updateRadius(){const t=this.chart,n=t.chartArea,i=t.options,s=Math.min(n.right-n.left,n.bottom-n.top),o=Math.max(s/2,0),a=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),r=(o-a)/t.getVisibleDatasetCount();this.outerRadius=o-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,n,i,s){const o=s==="reset",a=this.chart,l=a.options.animation,c=this._cachedMeta.rScale,u=c.xCenter,h=c.yCenter,f=c.getIndexAngle(0)-.5*tt;let m=f,p;const g=360/this.countVisibleElements();for(p=0;p<n;++p)m+=this._computeAngle(p,s,g);for(p=n;p<n+i;p++){const y=t[p];let _=m,x=m+this._computeAngle(p,s,g),T=a.getDataVisibility(p)?c.getDistanceFromCenterForValue(this.getParsed(p).r):0;m=x,o&&(l.animateScale&&(T=0),l.animateRotate&&(_=x=f));const S={x:u,y:h,innerRadius:0,outerRadius:T,startAngle:_,endAngle:x,options:this.resolveDataElementOptions(p,y.active?"active":s)};this.updateElement(y,p,S,s)}}countVisibleElements(){const t=this._cachedMeta;let n=0;return t.data.forEach((i,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&n++}),n}_computeAngle(t,n,i){return this.chart.getDataVisibility(t)?At(this.resolveDataElementOptions(t,n).angle||i):0}}class mw extends Ti{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}class pw extends Ue{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const n=this._cachedMeta.vScale,i=this.getParsed(t);return{label:n.getLabels()[t],value:""+n.getLabelForValue(i[n.axis])}}parseObjectData(t,n,i,s){return Tc.bind(this)(t,n,i,s)}update(t){const n=this._cachedMeta,i=n.dataset,s=n.data||[],o=n.iScale.getLabels();if(i.points=s,t!=="resize"){const a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);const r={_loop:!0,_fullLoop:o.length===s.length,options:a};this.updateElement(i,void 0,r,t)}this.updateElements(s,0,s.length,t)}updateElements(t,n,i,s){const o=this._cachedMeta.rScale,a=s==="reset";for(let r=n;r<n+i;r++){const l=t[r],c=this.resolveDataElementOptions(r,l.active?"active":s),u=o.getPointPositionForValue(r,this.getParsed(r).r),h=a?o.xCenter:u.x,f=a?o.yCenter:u.y,m={x:h,y:f,angle:u.angle,skip:isNaN(h)||isNaN(f),options:c};this.updateElement(l,r,m,s)}}}class Kc extends Ue{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const n=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:o}=n,a=this.getParsed(t),r=s.getLabelForValue(a.x),l=o.getLabelForValue(a.y);return{label:i[t]||"",value:"("+r+", "+l+")"}}update(t){const n=this._cachedMeta,{data:i=[]}=n,s=this.chart._animationsDisabled;let{start:o,count:a}=lc(n,i,s);if(this._drawStart=o,this._drawCount=a,cc(n)&&(o=0,a=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:r,_dataset:l}=n;r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!l._decimated,r.points=i;const c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(r,void 0,{animated:!s,options:c},t)}else this.datasetElementType&&(delete n.dataset,this.datasetElementType=!1);this.updateElements(i,o,a,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,n,i,s){const o=s==="reset",{iScale:a,vScale:r,_stacked:l,_dataset:c}=this._cachedMeta,u=this.resolveDataElementOptions(n,s),h=this.getSharedOptions(u),f=this.includeOptions(s,h),m=a.axis,p=r.axis,{spanGaps:g,segment:y}=this.options,_=Le(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||s==="none";let T=n>0&&this.getParsed(n-1);for(let S=n;S<n+i;++S){const w=t[S],D=this.getParsed(S),v=x?w:{},A=Z(D[p]),R=v[m]=a.getPixelForValue(D[m],S),E=v[p]=o||A?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,D,l):D[p],S);v.skip=isNaN(R)||isNaN(E)||A,v.stop=S>0&&Math.abs(D[m]-T[m])>_,y&&(v.parsed=D,v.raw=c.data[S]),f&&(v.options=h||this.resolveDataElementOptions(S,w.active?"active":s)),x||this.updateElement(w,S,v,s),T=D}this.updateSharedOptions(h,s,u)}getMaxOverflow(){const t=this._cachedMeta,n=t.data||[];if(!this.options.showLine){let r=0;for(let l=n.length-1;l>=0;--l)r=Math.max(r,n[l].size(this.resolveDataElementOptions(l))/2);return r>0&&r}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!n.length)return s;const o=n[0].size(this.resolveDataElementOptions(0)),a=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(s,o,a)/2}}var gw=Object.freeze({__proto__:null,BarController:qc,BubbleController:hw,DoughnutController:Ti,LineController:Gc,PieController:mw,PolarAreaController:Xc,RadarController:pw,ScatterController:Kc});function on(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class ma{static override(t){Object.assign(ma.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return on()}parse(){return on()}format(){return on()}add(){return on()}diff(){return on()}startOf(){return on()}endOf(){return on()}}var Zc={_date:ma};function yw(e,t,n,i){const{controller:s,data:o,_sorted:a}=e,r=s._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(r&&t===r.axis&&t!=="r"&&a&&o.length){const c=r._reversePixels?B_:we;if(i){if(s._sharedOptions){const u=o[0],h=typeof u.getRange=="function"&&u.getRange(t);if(h){const f=c(o,t,n-h),m=c(o,t,n+h);return{lo:f.lo,hi:m.hi}}}}else{const u=c(o,t,n);if(l){const{vScale:h}=s._cachedMeta,{_parsed:f}=e,m=f.slice(0,u.lo+1).reverse().findIndex(g=>!Z(g[h.axis]));u.lo-=Math.max(0,m);const p=f.slice(u.hi).findIndex(g=>!Z(g[h.axis]));u.hi+=Math.max(0,p)}return u}}return{lo:0,hi:o.length-1}}function vi(e,t,n,i,s){const o=e.getSortedVisibleDatasetMetas(),a=n[t];for(let r=0,l=o.length;r<l;++r){const{index:c,data:u}=o[r],{lo:h,hi:f}=yw(o[r],t,a,s);for(let m=h;m<=f;++m){const p=u[m];p.skip||i(p,c,m)}}}function bw(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(i,s){const o=t?Math.abs(i.x-s.x):0,a=n?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function pa(e,t,n,i,s){const o=[];return!s&&!e.isPointInArea(t)||vi(e,n,t,function(r,l,c){!s&&!ke(r,e.chartArea,0)||r.inRange(t.x,t.y,i)&&o.push({element:r,datasetIndex:l,index:c})},!0),o}function _w(e,t,n,i){let s=[];function o(a,r,l){const{startAngle:c,endAngle:u}=a.getProps(["startAngle","endAngle"],i),{angle:h}=bs(a,{x:t.x,y:t.y});pi(h,c,u)&&s.push({element:a,datasetIndex:r,index:l})}return vi(e,n,t,o),s}function xw(e,t,n,i,s,o){let a=[];const r=bw(n);let l=Number.POSITIVE_INFINITY;function c(u,h,f){const m=u.inRange(t.x,t.y,s);if(i&&!m)return;const p=u.getCenterPoint(s);if(!(!!o||e.isPointInArea(p))&&!m)return;const y=r(t,p);y<l?(a=[{element:u,datasetIndex:h,index:f}],l=y):y===l&&a.push({element:u,datasetIndex:h,index:f})}return vi(e,n,t,c),a}function ga(e,t,n,i,s,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!i?_w(e,t,n,s):xw(e,t,n,i,s,o)}function Qc(e,t,n,i,s){const o=[],a=n==="x"?"inXRange":"inYRange";let r=!1;return vi(e,n,t,(l,c,u)=>{l[a]&&l[a](t[n],s)&&(o.push({element:l,datasetIndex:c,index:u}),r=r||l.inRange(t.x,t.y,s))}),i&&!r?[]:o}var ya={evaluateInteractionItems:vi,modes:{index(e,t,n,i){const s=Fe(t,e),o=n.axis||"x",a=n.includeInvisible||!1,r=n.intersect?pa(e,s,o,i,a):ga(e,s,o,!1,i,a),l=[];return r.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const u=r[0].index,h=c.data[u];h&&!h.skip&&l.push({element:h,datasetIndex:c.index,index:u})}),l):[]},dataset(e,t,n,i){const s=Fe(t,e),o=n.axis||"xy",a=n.includeInvisible||!1;let r=n.intersect?pa(e,s,o,i,a):ga(e,s,o,!1,i,a);if(r.length>0){const l=r[0].datasetIndex,c=e.getDatasetMeta(l).data;r=[];for(let u=0;u<c.length;++u)r.push({element:c[u],datasetIndex:l,index:u})}return r},point(e,t,n,i){const s=Fe(t,e),o=n.axis||"xy",a=n.includeInvisible||!1;return pa(e,s,o,i,a)},nearest(e,t,n,i){const s=Fe(t,e),o=n.axis||"xy",a=n.includeInvisible||!1;return ga(e,s,o,n.intersect,i,a)},x(e,t,n,i){const s=Fe(t,e);return Qc(e,s,"x",n.intersect,i)},y(e,t,n,i){const s=Fe(t,e);return Qc(e,s,"y",n.intersect,i)}}};const Jc=["left","top","right","bottom"];function Si(e,t){return e.filter(n=>n.pos===t)}function td(e,t){return e.filter(n=>Jc.indexOf(n.pos)===-1&&n.box.axis===t)}function Mi(e,t){return e.sort((n,i)=>{const s=t?i:n,o=t?n:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function ww(e){const t=[];let n,i,s,o,a,r;for(n=0,i=(e||[]).length;n<i;++n)s=e[n],{position:o,options:{stack:a,stackWeight:r=1}}=s,t.push({index:n,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:a&&o+a,stackWeight:r});return t}function kw(e){const t={};for(const n of e){const{stack:i,pos:s,stackWeight:o}=n;if(!i||!Jc.includes(s))continue;const a=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return t}function Tw(e,t){const n=kw(e),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t;let o,a,r;for(o=0,a=e.length;o<a;++o){r=e[o];const{fullSize:l}=r.box,c=n[r.stack],u=c&&r.stackWeight/c.weight;r.horizontal?(r.width=u?u*i:l&&t.availableWidth,r.height=s):(r.width=i,r.height=u?u*s:l&&t.availableHeight)}return n}function vw(e){const t=ww(e),n=Mi(t.filter(c=>c.box.fullSize),!0),i=Mi(Si(t,"left"),!0),s=Mi(Si(t,"right")),o=Mi(Si(t,"top"),!0),a=Mi(Si(t,"bottom")),r=td(t,"x"),l=td(t,"y");return{fullSize:n,leftAndTop:i.concat(o),rightAndBottom:s.concat(l).concat(a).concat(r),chartArea:Si(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:o.concat(a).concat(r)}}function ed(e,t,n,i){return Math.max(e[n],t[n])+Math.max(e[i],t[i])}function nd(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function Sw(e,t,n,i){const{pos:s,box:o}=n,a=e.maxPadding;if(!nt(s)){n.size&&(e[s]-=n.size);const h=i[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?o.height:o.width),n.size=h.size/h.count,e[s]+=n.size}o.getPadding&&nd(a,o.getPadding());const r=Math.max(0,t.outerWidth-ed(a,e,"left","right")),l=Math.max(0,t.outerHeight-ed(a,e,"top","bottom")),c=r!==e.w,u=l!==e.h;return e.w=r,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function Mw(e){const t=e.maxPadding;function n(i){const s=Math.max(t[i]-e[i],0);return e[i]+=s,s}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function Dw(e,t){const n=t.maxPadding;function i(s){const o={left:0,top:0,right:0,bottom:0};return s.forEach(a=>{o[a]=Math.max(t[a],n[a])}),o}return i(e?["left","right"]:["top","bottom"])}function Di(e,t,n,i){const s=[];let o,a,r,l,c,u;for(o=0,a=e.length,c=0;o<a;++o){r=e[o],l=r.box,l.update(r.width||t.w,r.height||t.h,Dw(r.horizontal,t));const{same:h,other:f}=Sw(t,n,r,i);c|=h&&s.length,u=u||f,l.fullSize||s.push(r)}return c&&Di(s,t,n,i)||u}function Ds(e,t,n,i,s){e.top=n,e.left=t,e.right=t+i,e.bottom=n+s,e.width=i,e.height=s}function id(e,t,n,i){const s=n.padding;let{x:o,y:a}=t;for(const r of e){const l=r.box,c=i[r.stack]||{placed:0,weight:1},u=r.stackWeight/c.weight||1;if(r.horizontal){const h=t.w*u,f=c.size||l.height;Xt(c.start)&&(a=c.start),l.fullSize?Ds(l,s.left,a,n.outerWidth-s.right-s.left,f):Ds(l,t.left+c.placed,a,h,f),c.start=a,c.placed+=h,a=l.bottom}else{const h=t.h*u,f=c.size||l.width;Xt(c.start)&&(o=c.start),l.fullSize?Ds(l,o,s.top,f,n.outerHeight-s.bottom-s.top):Ds(l,o,t.top+c.placed,f,h),c.start=o,c.placed+=h,o=l.right}}t.x=o,t.y=a}var Ht={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,i){if(!e)return;const s=Pt(e.options.layout.padding),o=Math.max(t-s.width,0),a=Math.max(n-s.height,0),r=vw(e.boxes),l=r.vertical,c=r.horizontal;mt(e.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const u=l.reduce((g,y)=>y.box.options&&y.box.options.display===!1?g:g+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:n,padding:s,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/u,hBoxMaxHeight:a/2}),f=Object.assign({},s);nd(f,Pt(i));const m=Object.assign({maxPadding:f,w:o,h:a,x:s.left,y:s.top},s),p=Tw(l.concat(c),h);Di(r.fullSize,m,h,p),Di(l,m,h,p),Di(c,m,h,p)&&Di(l,m,h,p),Mw(m),id(r.leftAndTop,m,h,p),m.x+=m.w,m.y+=m.h,id(r.rightAndBottom,m,h,p),e.chartArea={left:m.left,top:m.top,right:m.left+m.w,bottom:m.top+m.h,height:m.h,width:m.w},mt(r.chartArea,g=>{const y=g.box;Object.assign(y,e.chartArea),y.update(m.w,m.h,{left:0,top:0,right:0,bottom:0})})}};class sd{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,i){}removeEventListener(t,n,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,i,s){return n=Math.max(0,n||t.width),i=i||t.height,{width:n,height:Math.max(0,s?Math.floor(n/s):i)}}isAttached(t){return!0}updateConfig(t){}}class Cw extends sd{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Cs="$chartjs",Ow={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},od=e=>e===null||e==="";function Aw(e,t){const n=e.style,i=e.getAttribute("height"),s=e.getAttribute("width");if(e[Cs]={initial:{height:i,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",od(s)){const o=Mc(e,"width");o!==void 0&&(e.width=o)}if(od(i))if(e.style.height==="")e.height=e.width/(t||2);else{const o=Mc(e,"height");o!==void 0&&(e.height=o)}return e}const ad=Ax?{passive:!0}:!1;function Pw(e,t,n){e&&e.addEventListener(t,n,ad)}function Ew(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,ad)}function Rw(e,t){const n=Ow[e.type]||e.type,{x:i,y:s}=Fe(e,t);return{type:n,chart:t,native:e,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Os(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function Iw(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||Os(r.addedNodes,i),a=a&&!Os(r.removedNodes,i);a&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function Lw(e,t,n){const i=e.canvas,s=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||Os(r.removedNodes,i),a=a&&!Os(r.addedNodes,i);a&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const Ci=new Map;let rd=0;function ld(){const e=window.devicePixelRatio;e!==rd&&(rd=e,Ci.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function Nw(e,t){Ci.size||window.addEventListener("resize",ld),Ci.set(e,t)}function Bw(e){Ci.delete(e),Ci.size||window.removeEventListener("resize",ld)}function Fw(e,t,n){const i=e.canvas,s=i&&la(i);if(!s)return;const o=rc((r,l)=>{const c=s.clientWidth;n(r,l),c<s.clientWidth&&n()},window),a=new ResizeObserver(r=>{const l=r[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||o(c,u)});return a.observe(s),Nw(e,o),a}function ba(e,t,n){n&&n.disconnect(),t==="resize"&&Bw(e)}function zw(e,t,n){const i=e.canvas,s=rc(o=>{e.ctx!==null&&n(Rw(o,e))},e);return Pw(i,t,s),s}class Uw extends sd{acquireContext(t,n){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Aw(t,n),i):null}releaseContext(t){const n=t.canvas;if(!n[Cs])return!1;const i=n[Cs].initial;["height","width"].forEach(o=>{const a=i[o];Z(a)?n.removeAttribute(o):n.setAttribute(o,a)});const s=i.style||{};return Object.keys(s).forEach(o=>{n.style[o]=s[o]}),n.width=n.width,delete n[Cs],!0}addEventListener(t,n,i){this.removeEventListener(t,n);const s=t.$proxies||(t.$proxies={}),a={attach:Iw,detach:Lw,resize:Fw}[n]||zw;s[n]=a(t,n,i)}removeEventListener(t,n){const i=t.$proxies||(t.$proxies={}),s=i[n];if(!s)return;({attach:ba,detach:ba,resize:ba}[n]||Ew)(t,n,s),i[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,i,s){return Ox(t,n,i,s)}isAttached(t){const n=t&&la(t);return!!(n&&n.isConnected)}}function Vw(e){return!ra()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?Cw:Uw}class $t{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}hasValue(){return Le(this.x)&&Le(this.y)}getProps(t,n){const i=this.$animations;if(!n||!i)return this;const s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}}function Hw(e,t){const n=e.options.ticks,i=$w(e),s=Math.min(n.maxTicksLimit||i,i),o=n.major.enabled?Ww(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>s)return jw(t,c,o,a/s),c;const u=Yw(o,t,s);if(a>0){let h,f;const m=a>1?Math.round((l-r)/(a-1)):null;for(As(t,c,u,Z(m)?0:r-m,r),h=0,f=a-1;h<f;h++)As(t,c,u,o[h],o[h+1]);return As(t,c,u,l,Z(m)?t.length:l+m),c}return As(t,c,u),c}function $w(e){const t=e.options.offset,n=e._tickSize(),i=e._length/n+(t?0:1),s=e._maxLength/n;return Math.floor(Math.min(i,s))}function Yw(e,t,n){const i=qw(e),s=t.length/n;if(!i)return Math.max(s,1);const o=E_(i);for(let a=0,r=o.length-1;a<r;a++){const l=o[a];if(l>s)return l}return Math.max(s,1)}function Ww(e){const t=[];let n,i;for(n=0,i=e.length;n<i;n++)e[n].major&&t.push(n);return t}function jw(e,t,n,i){let s=0,o=n[0],a;for(i=Math.ceil(i),a=0;a<e.length;a++)a===o&&(t.push(e[a]),s++,o=n[s*i])}function As(e,t,n,i,s){const o=Q(i,0),a=Math.min(Q(s,e.length),e.length);let r=0,l,c,u;for(n=Math.ceil(n),s&&(l=s-i,n=l/Math.floor(l/n)),u=o;u<0;)r++,u=Math.round(o+r*n);for(c=Math.max(o,0);c<a;c++)c===u&&(t.push(e[c]),r++,u=Math.round(o+r*n))}function qw(e){const t=e.length;let n,i;if(t<2)return!1;for(i=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==i)return!1;return i}const Gw=e=>e==="left"?"right":e==="right"?"left":e,cd=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,dd=(e,t)=>Math.min(t||e,e);function ud(e,t){const n=[],i=e.length/t,s=e.length;let o=0;for(;o<s;o+=i)n.push(e[Math.floor(o)]);return n}function Xw(e,t,n){const i=e.ticks.length,s=Math.min(t,i-1),o=e._startPixel,a=e._endPixel,r=1e-6;let l=e.getPixelForTick(s),c;if(!(n&&(i===1?c=Math.max(l-o,a-l):t===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<o-r||l>a+r)))return l}function Kw(e,t){mt(e,n=>{const i=n.gc,s=i.length/2;let o;if(s>t){for(o=0;o<s;++o)delete n.data[i[o]];i.splice(0,s)}})}function Oi(e){return e.drawTicks?e.tickLength:0}function hd(e,t){if(!e.display)return 0;const n=xt(e.font,t),i=Pt(e.padding);return(ct(e.text)?e.text.length:1)*n.lineHeight+i.height}function Zw(e,t){return Be(e,{scale:t,type:"scale"})}function Qw(e,t,n){return Be(e,{tick:n,index:t,type:"tick"})}function Jw(e,t,n){let i=Zo(e);return(n&&t!=="right"||!n&&t==="right")&&(i=Gw(i)),i}function tk(e,t,n,i){const{top:s,left:o,bottom:a,right:r,chart:l}=e,{chartArea:c,scales:u}=l;let h=0,f,m,p;const g=a-s,y=r-o;if(e.isHorizontal()){if(m=Vt(i,o,r),nt(n)){const _=Object.keys(n)[0],x=n[_];p=u[_].getPixelForValue(x)+g-t}else n==="center"?p=(c.bottom+c.top)/2+g-t:p=cd(e,n,t);f=r-o}else{if(nt(n)){const _=Object.keys(n)[0],x=n[_];m=u[_].getPixelForValue(x)-y+t}else n==="center"?m=(c.left+c.right)/2-y+t:m=cd(e,n,t);p=Vt(i,a,s),h=n==="left"?-yt:yt}return{titleX:m,titleY:p,maxWidth:f,rotation:h}}class an extends $t{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:i,_suggestedMax:s}=this;return t=ie(t,Number.POSITIVE_INFINITY),n=ie(n,Number.NEGATIVE_INFINITY),i=ie(i,Number.POSITIVE_INFINITY),s=ie(s,Number.NEGATIVE_INFINITY),{min:ie(t,i),max:ie(n,s),minDefined:_t(t),maxDefined:_t(n)}}getMinMax(t){let{min:n,max:i,minDefined:s,maxDefined:o}=this.getUserBounds(),a;if(s&&o)return{min:n,max:i};const r=this.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)a=r[l].controller.getMinMax(this,t),s||(n=Math.min(n,a.min)),o||(i=Math.max(i,a.max));return n=o&&n>i?i:n,i=s&&n>i?n:i,{min:ie(n,ie(i,n)),max:ie(i,ie(n,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ft(this.options.beforeUpdate,[this])}update(t,n,i){const{beginAtZero:s,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=rx(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=r<this.ticks.length;this._convertTicksToLabels(l?ud(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=Hw(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,i;this.isHorizontal()?(n=this.left,i=this.right):(n=this.top,i=this.bottom,t=!t),this._startPixel=n,this._endPixel=i,this._reversePixels=t,this._length=i-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ft(this.options.afterUpdate,[this])}beforeSetDimensions(){ft(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){ft(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),ft(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ft(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let i,s,o;for(i=0,s=t.length;i<s;i++)o=t[i],o.label=ft(n.callback,[o.value,i,t],this)}afterTickToLabelConversion(){ft(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ft(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,i=dd(this.ticks.length,t.ticks.maxTicksLimit),s=n.minRotation||0,o=n.maxRotation;let a=s,r,l,c;if(!this._isVisible()||!n.display||s>=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const u=this._getLabelSizes(),h=u.widest.width,f=u.highest.height,m=It(this.chart.width-h,0,this.maxWidth);r=t.offset?this.maxWidth/i:m/(i-1),h+6>r&&(r=m/(i-(t.offset?.5:1)),l=this.maxHeight-Oi(t.grid)-n.padding-hd(t.title,this.chart.options.font),c=Math.sqrt(h*h+f*f),a=ys(Math.min(Math.asin(It((u.highest.height+6)/r,-1,1)),Math.asin(It(l/c,-1,1))-Math.asin(It(f/c,-1,1)))),a=Math.max(s,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){ft(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ft(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:i,title:s,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){const l=hd(s,n.options.font);if(r?(t.width=this.maxWidth,t.height=Oi(o)+l):(t.height=this.maxHeight,t.width=Oi(o)+l),i.display&&this.ticks.length){const{first:c,last:u,widest:h,highest:f}=this._getLabelSizes(),m=i.padding*2,p=At(this.labelRotation),g=Math.cos(p),y=Math.sin(p);if(r){const _=i.mirror?0:y*h.width+g*f.height;t.height=Math.min(this.maxHeight,t.height+_+m)}else{const _=i.mirror?0:g*h.width+y*f.height;t.width=Math.min(this.maxWidth,t.width+_+m)}this._calculatePadding(c,u,y,g)}}this._handleMargins(),r?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,i,s){const{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,m=0;l?c?(f=s*t.width,m=i*n.height):(f=i*t.height,m=s*n.width):o==="start"?m=n.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,m=n.width/2),this.paddingLeft=Math.max((f-u+a)*this.width/(this.width-u),0),this.paddingRight=Math.max((m-h+a)*this.width/(this.width-h),0)}else{let u=n.height/2,h=t.height/2;o==="start"?(u=0,h=t.height):o==="end"&&(u=n.height,h=0),this.paddingTop=u+a,this.paddingBottom=h+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ft(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,i;for(n=0,i=t.length;n<i;n++)Z(t[n].label)&&(t.splice(n,1),i--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let i=this.ticks;n<i.length&&(i=ud(i,n)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,i){const{ctx:s,_longestTextCache:o}=this,a=[],r=[],l=Math.floor(n/dd(n,i));let c=0,u=0,h,f,m,p,g,y,_,x,T,S,w;for(h=0;h<n;h+=l){if(p=t[h].label,g=this._resolveTickFontOptions(h),s.font=y=g.string,_=o[y]=o[y]||{data:{},gc:[]},x=g.lineHeight,T=S=0,!Z(p)&&!ct(p))T=ks(s,_.data,_.gc,T,p),S=x;else if(ct(p))for(f=0,m=p.length;f<m;++f)w=p[f],!Z(w)&&!ct(w)&&(T=ks(s,_.data,_.gc,T,w),S+=x);a.push(T),r.push(S),c=Math.max(T,c),u=Math.max(S,u)}Kw(o,n);const D=a.indexOf(c),v=r.indexOf(u),A=R=>({width:a[R]||0,height:r[R]||0});return{first:A(0),last:A(n-1),widest:A(D),highest:A(v),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return N_(this._alignToPixels?tn(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const i=n[t];return i.$context||(i.$context=Qw(this.getContext(),t,i))}return this.$context||(this.$context=Zw(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=At(this.labelRotation),i=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n)),o=this._getLabelSizes(),a=t.autoSkipPadding||0,r=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return this.isHorizontal()?l*i>r*s?r/i:l/s:l*s<r*i?l/i:r/s}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,i=this.chart,s=this.options,{grid:o,position:a,border:r}=s,l=o.offset,c=this.isHorizontal(),h=this.ticks.length+(l?1:0),f=Oi(o),m=[],p=r.setContext(this.getContext()),g=p.display?p.width:0,y=g/2,_=function(Y){return tn(i,Y,g)};let x,T,S,w,D,v,A,R,E,k,C,z;if(a==="top")x=_(this.bottom),v=this.bottom-f,R=x-y,k=_(t.top)+y,z=t.bottom;else if(a==="bottom")x=_(this.top),k=t.top,z=_(t.bottom)-y,v=x+y,R=this.top+f;else if(a==="left")x=_(this.right),D=this.right-f,A=x-y,E=_(t.left)+y,C=t.right;else if(a==="right")x=_(this.left),E=t.left,C=_(t.right)-y,D=x+y,A=this.left+f;else if(n==="x"){if(a==="center")x=_((t.top+t.bottom)/2+.5);else if(nt(a)){const Y=Object.keys(a)[0],G=a[Y];x=_(this.chart.scales[Y].getPixelForValue(G))}k=t.top,z=t.bottom,v=x+y,R=v+f}else if(n==="y"){if(a==="center")x=_((t.left+t.right)/2);else if(nt(a)){const Y=Object.keys(a)[0],G=a[Y];x=_(this.chart.scales[Y].getPixelForValue(G))}D=x-y,A=D-f,E=t.left,C=t.right}const N=Q(s.ticks.maxTicksLimit,h),V=Math.max(1,Math.ceil(h/N));for(T=0;T<h;T+=V){const Y=this.getContext(T),G=o.setContext(Y),st=r.setContext(Y),ot=G.lineWidth,K=G.color,U=st.dash||[],M=st.dashOffset,P=G.tickWidth,F=G.tickColor,$=G.tickBorderDash||[],it=G.tickBorderDashOffset;S=Xw(this,T,l),S!==void 0&&(w=tn(i,S,ot),c?D=A=E=C=w:v=R=k=z=w,m.push({tx1:D,ty1:v,tx2:A,ty2:R,x1:E,y1:k,x2:C,y2:z,width:ot,color:K,borderDash:U,borderDashOffset:M,tickWidth:P,tickColor:F,tickBorderDash:$,tickBorderDashOffset:it}))}return this._ticksLength=h,this._borderValue=x,m}_computeLabelItems(t){const n=this.axis,i=this.options,{position:s,ticks:o}=i,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:c,padding:u,mirror:h}=o,f=Oi(i.grid),m=f+u,p=h?-u:m,g=-At(this.labelRotation),y=[];let _,x,T,S,w,D,v,A,R,E,k,C,z="middle";if(s==="top")D=this.bottom-p,v=this._getXAxisLabelAlignment();else if(s==="bottom")D=this.top+p,v=this._getXAxisLabelAlignment();else if(s==="left"){const V=this._getYAxisLabelAlignment(f);v=V.textAlign,w=V.x}else if(s==="right"){const V=this._getYAxisLabelAlignment(f);v=V.textAlign,w=V.x}else if(n==="x"){if(s==="center")D=(t.top+t.bottom)/2+m;else if(nt(s)){const V=Object.keys(s)[0],Y=s[V];D=this.chart.scales[V].getPixelForValue(Y)+m}v=this._getXAxisLabelAlignment()}else if(n==="y"){if(s==="center")w=(t.left+t.right)/2-m;else if(nt(s)){const V=Object.keys(s)[0],Y=s[V];w=this.chart.scales[V].getPixelForValue(Y)}v=this._getYAxisLabelAlignment(f).textAlign}n==="y"&&(l==="start"?z="top":l==="end"&&(z="bottom"));const N=this._getLabelSizes();for(_=0,x=r.length;_<x;++_){T=r[_],S=T.label;const V=o.setContext(this.getContext(_));A=this.getPixelForTick(_)+o.labelOffset,R=this._resolveTickFontOptions(_),E=R.lineHeight,k=ct(S)?S.length:1;const Y=k/2,G=V.color,st=V.textStrokeColor,ot=V.textStrokeWidth;let K=v;a?(w=A,v==="inner"&&(_===x-1?K=this.options.reverse?"left":"right":_===0?K=this.options.reverse?"right":"left":K="center"),s==="top"?c==="near"||g!==0?C=-k*E+E/2:c==="center"?C=-N.highest.height/2-Y*E+E:C=-N.highest.height+E/2:c==="near"||g!==0?C=E/2:c==="center"?C=N.highest.height/2-Y*E:C=N.highest.height-k*E,h&&(C*=-1),g!==0&&!V.showLabelBackdrop&&(w+=E/2*Math.sin(g))):(D=A,C=(1-k)*E/2);let U;if(V.showLabelBackdrop){const M=Pt(V.backdropPadding),P=N.heights[_],F=N.widths[_];let $=C-M.top,it=0-M.left;switch(z){case"middle":$-=P/2;break;case"bottom":$-=P;break}switch(v){case"center":it-=F/2;break;case"right":it-=F;break;case"inner":_===x-1?it-=F:_>0&&(it-=F/2);break}U={left:it,top:$,width:F+M.width,height:P+M.height,color:V.backdropColor}}y.push({label:S,font:R,textOffset:C,options:{rotation:g,color:G,strokeColor:st,strokeWidth:ot,textAlign:K,textBaseline:z,translation:[w,D],backdrop:U}})}return y}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-At(this.labelRotation))return t==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:i,mirror:s,padding:o}}=this.options,a=this._getLabelSizes(),r=t+o,l=a.widest.width;let c,u;return n==="left"?s?(u=this.right+o,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-r,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u=this.left)):n==="right"?s?(u=this.left+o,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+r,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:i,top:s,width:o,height:a}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(i,s,o,a),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(o=>o.value===t);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){const n=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,a;const r=(l,c,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(n.display)for(o=0,a=s.length;o<a;++o){const l=s[o];n.drawOnChartArea&&r({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&r({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:i,grid:s}}=this,o=i.setContext(this.getContext()),a=i.display?o.width:0;if(!a)return;const r=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,u,h,f;this.isHorizontal()?(c=tn(t,this.left,a)-a/2,u=tn(t,this.right,r)+r/2,h=f=l):(h=tn(t,this.top,a)-a/2,f=tn(t,this.bottom,r)+r/2,c=u=l),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(c,h),n.lineTo(u,f),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&_i(i,s);const o=this.getLabelItems(t);for(const a of o){const r=a.options,l=a.font,c=a.label,u=a.textOffset;en(i,c,0,u,l,r)}s&&xi(i)}drawTitle(){const{ctx:t,options:{position:n,title:i,reverse:s}}=this;if(!i.display)return;const o=xt(i.font),a=Pt(i.padding),r=i.align;let l=o.lineHeight/2;n==="bottom"||n==="center"||nt(n)?(l+=a.bottom,ct(i.text)&&(l+=o.lineHeight*(i.text.length-1))):l+=a.top;const{titleX:c,titleY:u,maxWidth:h,rotation:f}=tk(this,l,n,r);en(t,i.text,0,0,o,{color:i.color,maxWidth:h,rotation:f,textAlign:Jw(r,n,s),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,i=Q(t.grid&&t.grid.z,-1),s=Q(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==an.prototype.draw?[{z:n,draw:o=>{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let o,a;for(o=0,a=n.length;o<a;++o){const r=n[o];r[i]===this.id&&(!t||r.type===t)&&s.push(r)}return s}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return xt(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Ps{constructor(t,n,i){this.type=t,this.scope=n,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let i;ik(n)&&(i=this.register(n));const s=this.items,o=t.id,a=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in s||(s[o]=t,ek(t,a,i),this.override&&bt.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){const n=this.items,i=t.id,s=this.scope;i in n&&delete n[i],s&&i in bt[s]&&(delete bt[s][i],this.override&&delete Je[i])}}function ek(e,t,n){const i=hi(Object.create(null),[n?bt.get(n):{},bt.get(t),e.defaults]);bt.set(t,i),e.defaultRoutes&&nk(t,e.defaultRoutes),e.descriptors&&bt.describe(t,e.descriptors)}function nk(e,t){Object.keys(t).forEach(n=>{const i=n.split("."),s=i.pop(),o=[e].concat(i).join("."),a=t[n].split("."),r=a.pop(),l=a.join(".");bt.route(o,s,l,r)})}function ik(e){return"id"in e&&"defaults"in e}class sk{constructor(){this.controllers=new Ps(Ue,"datasets",!0),this.elements=new Ps($t,"elements"),this.plugins=new Ps(Object,"plugins"),this.scales=new Ps(an,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,i){[...n].forEach(s=>{const o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):mt(s,a=>{const r=i||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,n,i){const s=Go(t);ft(i["before"+s],[],i),n[t](i),ft(i["after"+s],[],i)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const i=this._typedRegistries[n];if(i.isForType(t))return i}return this.plugins}_get(t,n,i){const s=n.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var fe=new sk;class ok{constructor(){this._init=void 0}notify(t,n,i,s){if(n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;const o=s?this._descriptors(t).filter(s):this._descriptors(t),a=this._notify(o,t,n,i);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),a}_notify(t,n,i,s){s=s||{};for(const o of t){const a=o.plugin,r=a[i],l=[n,s,o.options];if(ft(r,l,a)===!1&&s.cancelable)return!1}return!0}invalidate(){Z(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const i=t&&t.config,s=Q(i.options&&i.options.plugins,{}),o=ak(i);return s===!1&&!n?[]:lk(t,o,s,n)}_notifyStateChanges(t){const n=this._oldCache||[],i=this._cache,s=(o,a)=>o.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(s(n,i),t,"stop"),this._notify(s(i,n),t,"start")}}function ak(e){const t={},n=[],i=Object.keys(fe.plugins.items);for(let o=0;o<i.length;o++)n.push(fe.getPlugin(i[o]));const s=e.plugins||[];for(let o=0;o<s.length;o++){const a=s[o];n.indexOf(a)===-1&&(n.push(a),t[a.id]=!0)}return{plugins:n,localIds:t}}function rk(e,t){return!t&&e===!1?null:e===!0?{}:e}function lk(e,{plugins:t,localIds:n},i,s){const o=[],a=e.getContext();for(const r of t){const l=r.id,c=rk(i[l],s);c!==null&&o.push({plugin:r,options:ck(e.config,{plugin:r,local:n[l]},c,a)})}return o}function ck(e,{plugin:t,local:n},i,s){const o=e.pluginScopeKeys(t),a=e.getOptionScopes(i,o);return n&&t.defaults&&a.push(t.defaults),e.createResolver(a,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function _a(e,t){const n=bt.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function dk(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function uk(e,t){return e===t?"_index_":"_value_"}function fd(e){if(e==="x"||e==="y"||e==="r")return e}function hk(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function xa(e,...t){if(fd(e))return e;for(const n of t){const i=n.axis||hk(n.position)||e.length>1&&fd(e[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function md(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function fk(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(i=>i.xAxisID===e||i.yAxisID===e);if(n.length)return md(e,"x",n[0])||md(e,"y",n[0])}return{}}function mk(e,t){const n=Je[e.type]||{scales:{}},i=t.scales||{},s=_a(e.type,t),o=Object.create(null);return Object.keys(i).forEach(a=>{const r=i[a];if(!nt(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const l=xa(a,r,fk(a,e),bt.scales[r.type]),c=uk(l,s),u=n.scales||{};o[a]=fi(Object.create(null),[{axis:l},r,u[l],u[c]])}),e.data.datasets.forEach(a=>{const r=a.type||e.type,l=a.indexAxis||_a(r,t),u=(Je[r]||{}).scales||{};Object.keys(u).forEach(h=>{const f=dk(h,l),m=a[f+"AxisID"]||f;o[m]=o[m]||Object.create(null),fi(o[m],[{axis:f},i[m],u[h]])})}),Object.keys(o).forEach(a=>{const r=o[a];fi(r,[bt.scales[r.type],bt.scale])}),o}function pd(e){const t=e.options||(e.options={});t.plugins=Q(t.plugins,{}),t.scales=mk(e,t)}function gd(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function pk(e){return e=e||{},e.data=gd(e.data),pd(e),e}const yd=new Map,bd=new Set;function Es(e,t){let n=yd.get(e);return n||(n=t(),yd.set(e,n),bd.add(n)),n}const Ai=(e,t,n)=>{const i=Re(t,n);i!==void 0&&e.add(i)};class gk{constructor(t){this._config=pk(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=gd(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),pd(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Es(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return Es(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return Es(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,i=this.type;return Es(`${i}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const i=this._scopeCache;let s=i.get(t);return(!s||n)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,n,i){const{options:s,type:o}=this,a=this._cachedScopes(t,i),r=a.get(n);if(r)return r;const l=new Set;n.forEach(u=>{t&&(l.add(t),u.forEach(h=>Ai(l,t,h))),u.forEach(h=>Ai(l,s,h)),u.forEach(h=>Ai(l,Je[o]||{},h)),u.forEach(h=>Ai(l,bt,h)),u.forEach(h=>Ai(l,ta,h))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),bd.has(n)&&a.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,Je[n]||{},bt.datasets[n]||{},{type:n},bt,ta]}resolveNamedOptions(t,n,i,s=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=_d(this._resolverCache,t,s);let l=a;if(bk(a,n)){o.$shared=!1,i=Kt(i)?i():i;const c=this.createResolver(t,i,r);l=Pn(a,i,c)}for(const c of n)o[c]=l[c];return o}createResolver(t,n,i=[""],s){const{resolver:o}=_d(this._resolverCache,t,i);return nt(n)?Pn(o,n,void 0,s):o}}function _d(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));const s=n.join();let o=i.get(s);return o||(o={resolver:sa(t,n),subPrefixes:n.filter(r=>!r.toLowerCase().includes("hover"))},i.set(s,o)),o}const yk=e=>nt(e)&&Object.getOwnPropertyNames(e).some(t=>Kt(e[t]));function bk(e,t){const{isScriptable:n,isIndexable:i}=yc(e);for(const s of t){const o=n(s),a=i(s),r=(a||o)&&e[s];if(o&&(Kt(r)||yk(r))||a&&ct(r))return!0}return!1}var _k="4.5.1";const xk=["top","bottom","left","right","chartArea"];function xd(e,t){return e==="top"||e==="bottom"||xk.indexOf(e)===-1&&t==="x"}function wd(e,t){return function(n,i){return n[e]===i[e]?n[t]-i[t]:n[e]-i[e]}}function kd(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),ft(n&&n.onComplete,[e],t)}function wk(e){const t=e.chart,n=t.options.animation;ft(n&&n.onProgress,[e],t)}function Td(e){return ra()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Rs={},vd=e=>{const t=Td(e);return Object.values(Rs).filter(n=>n.canvas===t).pop()};function kk(e,t,n){const i=Object.keys(e);for(const s of i){const o=+s;if(o>=t){const a=e[s];delete e[s],(n>0||o>t)&&(e[o+n]=a)}}}function Tk(e,t,n,i){return!n||e.type==="mouseout"?null:i?t:e}let Zt=class{static defaults=bt;static instances=Rs;static overrides=Je;static registry=fe;static version=_k;static getChart=vd;static register(...t){fe.add(...t),Sd()}static unregister(...t){fe.remove(...t),Sd()}constructor(t,n){const i=this.config=new gk(n),s=Td(t),o=vd(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Vw(s)),this.platform.updateConfig(i);const r=this.platform.acquireContext(s,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,u=l&&l.width;if(this.id=v_(),this.ctx=r,this.canvas=l,this.width=u,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new ok,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=U_(h=>this.update(h),a.resizeDelay||0),this._dataChanges=[],Rs[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Te.listen(this,"complete",kd),Te.listen(this,"progress",wk),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:i,height:s,_aspectRatio:o}=this;return Z(t)?n&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return fe}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Sc(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return mc(this.canvas,this.ctx),this}stop(){return Te.stop(this),this}resize(t,n){Te.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,n,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,Sc(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),ft(i.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};mt(n,(i,s)=>{i.id=s})}buildOrUpdateScales(){const t=this.options,n=t.scales,i=this.scales,s=Object.keys(i).reduce((a,r)=>(a[r]=!1,a),{});let o=[];n&&(o=o.concat(Object.keys(n).map(a=>{const r=n[a],l=xa(a,r),c=l==="r",u=l==="x";return{options:r,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),mt(o,a=>{const r=a.options,l=r.id,c=xa(l,r),u=Q(r.type,a.dtype);(r.position===void 0||xd(r.position,c)!==xd(a.dposition))&&(r.position=a.dposition),s[l]=!0;let h=null;if(l in i&&i[l].type===u)h=i[l];else{const f=fe.getScale(u);h=new f({id:l,type:u,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(r,t)}),mt(s,(a,r)=>{a||delete i[r]}),mt(i,a=>{Ht.configure(this,a,a.options),Ht.addBox(this,a)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>n){for(let s=n;s<i;++s)this._destroyDatasetMeta(s);t.splice(n,i-n)}this._sortedMetasets=t.slice(0).sort(wd("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((i,s)=>{n.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=n.length;i<s;i++){const o=n[i];let a=this.getDatasetMeta(i);const r=o.type||this.config.type;if(a.type&&a.type!==r&&(this._destroyDatasetMeta(i),a=this.getDatasetMeta(i)),a.type=r,a.indexAxis=o.indexAxis||_a(r,this.options),a.order=o.order||0,a.index=i,a.label=""+o.label,a.visible=this.isDatasetVisible(i),a.controller)a.controller.updateIndex(i),a.controller.linkScales();else{const l=fe.getController(r),{datasetElementType:c,dataElementType:u}=bt.datasets[r];Object.assign(l,{dataElementType:fe.getElement(u),datasetElementType:c&&fe.getElement(c)}),a.controller=new l(this,i),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){mt(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const i=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,u=this.data.datasets.length;c<u;c++){const{controller:h}=this.getDatasetMeta(c),f=!s&&o.indexOf(h)===-1;h.buildOrUpdateElements(f),a=Math.max(+h.getMaxOverflow(),a)}a=this._minPadding=i.layout.autoPadding?a:0,this._updateLayout(a),s||mt(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(wd("z","_idx"));const{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){mt(this.scales,t=>{Ht.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Jl(n,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:o}of n){const a=i==="_removeElements"?-o:o;kk(t,s,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,i=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),s=i(0);for(let o=1;o<n;o++)if(!Jl(s,i(o)))return;return Array.from(s).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Ht.update(this,this.width,this.height,t);const n=this.chartArea,i=n.width<=0||n.height<=0;this._layers=[],mt(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,i=this.data.datasets.length;n<i;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,i=this.data.datasets.length;n<i;++n)this._updateDataset(n,Kt(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(n),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(Te.has(this)?this.attached&&!Te.running(this)&&Te.start(this):(this.draw(),kd({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,i=[];let s,o;for(s=0,o=n.length;s<o;++s){const a=n[s];(!t||a.visible)&&i.push(a)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=Lc(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&_i(n,s),t.controller.draw(),s&&xi(n),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return ke(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,i,s){const o=ya.modes[n];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){const n=this.data.datasets[t],i=this._metasets;let s=i.filter(o=>o&&o._dataset===n).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Be(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!n.hidden}setDatasetVisibility(t,n){const i=this.getDatasetMeta(t);i.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,i){const s=i?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,s);Xt(n)?(o.data[n].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(o,{visible:i}),this.update(r=>r.datasetIndex===t?s:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),Te.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),mc(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Rs[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,n=this.platform,i=(o,a)=>{n.addEventListener(this,o,a),t[o]=a},s=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};mt(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,i=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let a;const r=()=>{s("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",a)};a=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",r)},n.isAttached(this.canvas)?r():a()}unbindEvents(){mt(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},mt(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,i){const s=i?"set":"remove";let o,a,r,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),r=0,l=t.length;r<l;++r){a=t[r];const c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],i=t.map(({datasetIndex:o,index:a})=>{const r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!fs(i,n)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,n))}notifyPlugins(t,n,i){return this._plugins.notify(this,t,n,i)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,i){const s=this.options.hover,o=(l,c)=>l.filter(u=>!c.some(h=>u.datasetIndex===h.datasetIndex&&u.index===h.index)),a=o(n,t),r=i?t:o(t,n);a.length&&this.updateHoverStyle(a,s.mode,!1),r.length&&s.mode&&this.updateHoverStyle(r,s.mode,!0)}_eventHandler(t,n){const i={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},s=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const o=this._handleEvent(t,n,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,n,i){const{_active:s=[],options:o}=this,a=n,r=this._getActiveElements(t,s,i,a),l=A_(t),c=Tk(t,this._lastEvent,i,l);i&&(this._lastEvent=null,ft(o.onHover,[t,r,this],this),l&&ft(o.onClick,[t,r,this],this));const u=!fs(r,s);return(u||n)&&(this._active=r,this._updateHoverStyles(r,s,n)),this._lastEvent=c,u}_getActiveElements(t,n,i,s){if(t.type==="mouseout")return[];if(!i)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}};function Sd(){return mt(Zt.instances,e=>e._plugins.invalidate())}function vk(e,t,n){const{startAngle:i,x:s,y:o,outerRadius:a,innerRadius:r,options:l}=t,{borderWidth:c,borderJoinStyle:u}=l,h=Math.min(c/a,Ut(i-n));if(e.beginPath(),e.arc(s,o,a-c/2,i+h/2,n-h/2),r>0){const f=Math.min(c/r,Ut(i-n));e.arc(s,o,r+c/2,n-f/2,i+f/2,!0)}else{const f=Math.min(c/2,a*Ut(i-n));if(u==="round")e.arc(s,o,f,n-tt/2,i+tt/2,!0);else if(u==="bevel"){const m=2*f*f,p=-m*Math.cos(n+tt/2)+s,g=-m*Math.sin(n+tt/2)+o,y=m*Math.cos(i+tt/2)+s,_=m*Math.sin(i+tt/2)+o;e.lineTo(p,g),e.lineTo(y,_)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function Sk(e,t,n){const{startAngle:i,pixelMargin:s,x:o,y:a,outerRadius:r,innerRadius:l}=t;let c=s/r;e.beginPath(),e.arc(o,a,r,i-c,n+c),l>s?(c=s/l,e.arc(o,a,l,n+c,i-c,!0)):e.arc(o,a,s,n+yt,i-yt),e.closePath(),e.clip()}function Mk(e){return ia(e,["outerStart","outerEnd","innerStart","innerEnd"])}function Dk(e,t,n,i){const s=Mk(e.options.borderRadius),o=(n-t)/2,a=Math.min(o,i*t/2),r=l=>{const c=(n-Math.min(o,l))*i/2;return It(l,0,Math.min(o,c))};return{outerStart:r(s.outerStart),outerEnd:r(s.outerEnd),innerStart:It(s.innerStart,0,a),innerEnd:It(s.innerEnd,0,a)}}function In(e,t,n,i){return{x:n+e*Math.cos(t),y:i+e*Math.sin(t)}}function Is(e,t,n,i,s,o){const{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:u}=t,h=Math.max(t.outerRadius+i+n-c,0),f=u>0?u+i+n+c:0;let m=0;const p=s-l;if(i){const V=u>0?u-i:0,Y=h>0?h-i:0,G=(V+Y)/2,st=G!==0?p*G/(G+i):p;m=(p-st)/2}const g=Math.max(.001,p*h-n/tt)/h,y=(p-g)/2,_=l+y+m,x=s-y-m,{outerStart:T,outerEnd:S,innerStart:w,innerEnd:D}=Dk(t,f,h,x-_),v=h-T,A=h-S,R=_+T/v,E=x-S/A,k=f+w,C=f+D,z=_+w/k,N=x-D/C;if(e.beginPath(),o){const V=(R+E)/2;if(e.arc(a,r,h,R,V),e.arc(a,r,h,V,E),S>0){const ot=In(A,E,a,r);e.arc(ot.x,ot.y,S,E,x+yt)}const Y=In(C,x,a,r);if(e.lineTo(Y.x,Y.y),D>0){const ot=In(C,N,a,r);e.arc(ot.x,ot.y,D,x+yt,N+Math.PI)}const G=(x-D/f+(_+w/f))/2;if(e.arc(a,r,f,x-D/f,G,!0),e.arc(a,r,f,G,_+w/f,!0),w>0){const ot=In(k,z,a,r);e.arc(ot.x,ot.y,w,z+Math.PI,_-yt)}const st=In(v,_,a,r);if(e.lineTo(st.x,st.y),T>0){const ot=In(v,R,a,r);e.arc(ot.x,ot.y,T,_-yt,R)}}else{e.moveTo(a,r);const V=Math.cos(R)*h+a,Y=Math.sin(R)*h+r;e.lineTo(V,Y);const G=Math.cos(E)*h+a,st=Math.sin(E)*h+r;e.lineTo(G,st)}e.closePath()}function Ck(e,t,n,i,s){const{fullCircles:o,startAngle:a,circumference:r}=t;let l=t.endAngle;if(o){Is(e,t,n,i,l,s);for(let c=0;c<o;++c)e.fill();isNaN(r)||(l=a+(r%gt||gt))}return Is(e,t,n,i,l,s),e.fill(),l}function Ok(e,t,n,i,s){const{fullCircles:o,startAngle:a,circumference:r,options:l}=t,{borderWidth:c,borderJoinStyle:u,borderDash:h,borderDashOffset:f,borderRadius:m}=l,p=l.borderAlign==="inner";if(!c)return;e.setLineDash(h||[]),e.lineDashOffset=f,p?(e.lineWidth=c*2,e.lineJoin=u||"round"):(e.lineWidth=c,e.lineJoin=u||"bevel");let g=t.endAngle;if(o){Is(e,t,n,i,g,s);for(let y=0;y<o;++y)e.stroke();isNaN(r)||(g=a+(r%gt||gt))}p&&Sk(e,t,g),l.selfJoin&&g-a>=tt&&m===0&&u!=="miter"&&vk(e,t,g),o||(Is(e,t,n,i,g,s),e.stroke())}class Ak extends $t{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,n,i){const s=this.getProps(["x","y"],i),{angle:o,distance:a}=bs(s,{x:t,y:n}),{startAngle:r,endAngle:l,innerRadius:c,outerRadius:u,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),f=(this.options.spacing+this.options.borderWidth)/2,m=Q(h,l-r),p=pi(o,r,l)&&r!==l,g=m>=gt||p,y=xe(a,c+f,u+f);return g&&y}getCenterPoint(t){const{x:n,y:i,startAngle:s,endAngle:o,innerRadius:a,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:l,spacing:c}=this.options,u=(s+o)/2,h=(a+r+c+l)/2;return{x:n+Math.cos(u)*h,y:i+Math.sin(u)*h}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:n,circumference:i}=this,s=(n.offset||0)/4,o=(n.spacing||0)/2,a=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=i>gt?Math.floor(i/gt):0,i===0||this.innerRadius<0||this.outerRadius<0)return;t.save();const r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*s,Math.sin(r)*s);const l=1-Math.sin(Math.min(tt,i||0)),c=s*l;t.fillStyle=n.backgroundColor,t.strokeStyle=n.borderColor,Ck(t,this,c,o,a),Ok(t,this,c,o,a),t.restore()}}function Md(e,t,n=t){e.lineCap=Q(n.borderCapStyle,t.borderCapStyle),e.setLineDash(Q(n.borderDash,t.borderDash)),e.lineDashOffset=Q(n.borderDashOffset,t.borderDashOffset),e.lineJoin=Q(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=Q(n.borderWidth,t.borderWidth),e.strokeStyle=Q(n.borderColor,t.borderColor)}function Pk(e,t,n){e.lineTo(n.x,n.y)}function Ek(e){return e.stepped?Q_:e.tension||e.cubicInterpolationMode==="monotone"?J_:Pk}function Dd(e,t,n={}){const i=e.length,{start:s=0,end:o=i-1}=n,{start:a,end:r}=t,l=Math.max(s,a),c=Math.min(o,r),u=s<a&&o<a||s>r&&o>r;return{count:i,start:l,loop:t.loop,ilen:c<l&&!u?i+c-l:c-l}}function Rk(e,t,n,i){const{points:s,options:o}=t,{count:a,start:r,loop:l,ilen:c}=Dd(s,n,i),u=Ek(o);let{move:h=!0,reverse:f}=i||{},m,p,g;for(m=0;m<=c;++m)p=s[(r+(f?c-m:m))%a],!p.skip&&(h?(e.moveTo(p.x,p.y),h=!1):u(e,g,p,f,o.stepped),g=p);return l&&(p=s[(r+(f?c:0))%a],u(e,g,p,f,o.stepped)),!!l}function Ik(e,t,n,i){const s=t.points,{count:o,start:a,ilen:r}=Dd(s,n,i),{move:l=!0,reverse:c}=i||{};let u=0,h=0,f,m,p,g,y,_;const x=S=>(a+(c?r-S:S))%o,T=()=>{g!==y&&(e.lineTo(u,y),e.lineTo(u,g),e.lineTo(u,_))};for(l&&(m=s[x(0)],e.moveTo(m.x,m.y)),f=0;f<=r;++f){if(m=s[x(f)],m.skip)continue;const S=m.x,w=m.y,D=S|0;D===p?(w<g?g=w:w>y&&(y=w),u=(h*u+S)/++h):(T(),e.lineTo(S,w),p=D,h=0,g=y=w),_=w}T()}function wa(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?Ik:Rk}function Lk(e){return e.stepped?Px:e.tension||e.cubicInterpolationMode==="monotone"?Ex:sn}function Nk(e,t,n,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,n,i)&&s.closePath()),Md(e,t.options),e.stroke(s)}function Bk(e,t,n,i){const{segments:s,options:o}=t,a=wa(t);for(const r of s)Md(e,o,r.style),e.beginPath(),a(e,t,r,{start:n,end:n+i-1})&&e.closePath(),e.stroke()}const Fk=typeof Path2D=="function";function zk(e,t,n,i){Fk&&!t.options.segment?Nk(e,t,n,i):Bk(e,t,n,i)}class Ls extends $t{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;Tx(this._points,i,t,s,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Fx(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,i=t.length;return i&&n[t[i-1].end]}interpolate(t,n){const i=this.options,s=t[n],o=this.points,a=Ec(this,{property:n,start:s,end:s});if(!a.length)return;const r=[],l=Lk(i);let c,u;for(c=0,u=a.length;c<u;++c){const{start:h,end:f}=a[c],m=o[h],p=o[f];if(m===p){r.push(m);continue}const g=Math.abs((s-m[n])/(p[n]-m[n])),y=l(m,p,g,i.stepped);y[n]=t[n],r.push(y)}return r.length===1?r[0]:r}pathSegment(t,n,i){return wa(this)(t,this,n,i)}path(t,n,i){const s=this.segments,o=wa(this);let a=this._loop;n=n||0,i=i||this.points.length-n;for(const r of s)a&=o(t,this,r,{start:n,end:n+i-1});return!!a}draw(t,n,i,s){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),zk(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function Cd(e,t,n,i){const s=e.options,{[n]:o}=e.getProps([n],i);return Math.abs(t-o)<s.radius+s.hitRadius}class Uk extends $t{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,n,i){const s=this.options,{x:o,y:a}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(n-a,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,n){return Cd(this,t,"x",n)}inYRange(t,n){return Cd(this,t,"y",n)}getCenterPoint(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}size(t){t=t||this.options||{};let n=t.radius||0;n=Math.max(n,n&&t.hoverRadius||0);const i=n&&t.borderWidth||0;return(n+i)*2}draw(t,n){const i=this.options;this.skip||i.radius<.1||!ke(this,n,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,na(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function Od(e,t){const{x:n,y:i,base:s,width:o,height:a}=e.getProps(["x","y","base","width","height"],t);let r,l,c,u,h;return e.horizontal?(h=a/2,r=Math.min(n,s),l=Math.max(n,s),c=i-h,u=i+h):(h=o/2,r=n-h,l=n+h,c=Math.min(i,s),u=Math.max(i,s)),{left:r,top:c,right:l,bottom:u}}function Ve(e,t,n,i){return e?0:It(t,n,i)}function Vk(e,t,n){const i=e.options.borderWidth,s=e.borderSkipped,o=gc(i);return{t:Ve(s.top,o.top,0,n),r:Ve(s.right,o.right,0,t),b:Ve(s.bottom,o.bottom,0,n),l:Ve(s.left,o.left,0,t)}}function Hk(e,t,n){const{enableBorderRadius:i}=e.getProps(["enableBorderRadius"]),s=e.options.borderRadius,o=Ne(s),a=Math.min(t,n),r=e.borderSkipped,l=i||nt(s);return{topLeft:Ve(!l||r.top||r.left,o.topLeft,0,a),topRight:Ve(!l||r.top||r.right,o.topRight,0,a),bottomLeft:Ve(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:Ve(!l||r.bottom||r.right,o.bottomRight,0,a)}}function $k(e){const t=Od(e),n=t.right-t.left,i=t.bottom-t.top,s=Vk(e,n/2,i/2),o=Hk(e,n/2,i/2);return{outer:{x:t.left,y:t.top,w:n,h:i,radius:o},inner:{x:t.left+s.l,y:t.top+s.t,w:n-s.l-s.r,h:i-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function ka(e,t,n,i){const s=t===null,o=n===null,r=e&&!(s&&o)&&Od(e,i);return r&&(s||xe(t,r.left,r.right))&&(o||xe(n,r.top,r.bottom))}function Yk(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function Wk(e,t){e.rect(t.x,t.y,t.w,t.h)}function Ta(e,t,n={}){const i=e.x!==n.x?-t:0,s=e.y!==n.y?-t:0,o=(e.x+e.w!==n.x+n.w?t:0)-i,a=(e.y+e.h!==n.y+n.h?t:0)-s;return{x:e.x+i,y:e.y+s,w:e.w+o,h:e.h+a,radius:e.radius}}class jk extends $t{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:n,options:{borderColor:i,backgroundColor:s}}=this,{inner:o,outer:a}=$k(this),r=Yk(a.radius)?An:Wk;t.save(),(a.w!==o.w||a.h!==o.h)&&(t.beginPath(),r(t,Ta(a,n,o)),t.clip(),r(t,Ta(o,-n,a)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),r(t,Ta(o,n)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,n,i){return ka(this,t,n,i)}inXRange(t,n){return ka(this,t,null,n)}inYRange(t,n){return ka(this,null,t,n)}getCenterPoint(t){const{x:n,y:i,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(n+s)/2:n,y:o?i:(i+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}var qk=Object.freeze({__proto__:null,ArcElement:Ak,BarElement:jk,LineElement:Ls,PointElement:Uk});const va=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Ad=va.map(e=>e.replace("rgb(","rgba(").replace(")",", 0.5)"));function Pd(e){return va[e%va.length]}function Ed(e){return Ad[e%Ad.length]}function Gk(e,t){return e.borderColor=Pd(t),e.backgroundColor=Ed(t),++t}function Xk(e,t){return e.backgroundColor=e.data.map(()=>Pd(t++)),t}function Kk(e,t){return e.backgroundColor=e.data.map(()=>Ed(t++)),t}function Zk(e){let t=0;return(n,i)=>{const s=e.getDatasetMeta(i).controller;s instanceof Ti?t=Xk(n,t):s instanceof Xc?t=Kk(n,t):s&&(t=Gk(n,t))}}function Rd(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function Qk(e){return e&&(e.borderColor||e.backgroundColor)}function Jk(){return bt.borderColor!=="rgba(0,0,0,0.1)"||bt.backgroundColor!=="rgba(0,0,0,0.1)"}var tT={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,t,n){if(!n.enabled)return;const{data:{datasets:i},options:s}=e.config,{elements:o}=s,a=Rd(i)||Qk(s)||o&&Rd(o)||Jk();if(!n.forceOverride&&a)return;const r=Zk(e);i.forEach(r)}};function eT(e,t,n,i,s){const o=s.samples||i;if(o>=n)return e.slice(t,t+n);const a=[],r=(n-2)/(o-2);let l=0;const c=t+n-1;let u=t,h,f,m,p,g;for(a[l++]=e[u],h=0;h<o-2;h++){let y=0,_=0,x;const T=Math.floor((h+1)*r)+1+t,S=Math.min(Math.floor((h+2)*r)+1,n)+t,w=S-T;for(x=T;x<S;x++)y+=e[x].x,_+=e[x].y;y/=w,_/=w;const D=Math.floor(h*r)+1+t,v=Math.min(Math.floor((h+1)*r)+1,n)+t,{x:A,y:R}=e[u];for(m=p=-1,x=D;x<v;x++)p=.5*Math.abs((A-y)*(e[x].y-R)-(A-e[x].x)*(_-R)),p>m&&(m=p,f=e[x],g=x);a[l++]=f,u=g}return a[l++]=e[c],a}function nT(e,t,n,i){let s=0,o=0,a,r,l,c,u,h,f,m,p,g;const y=[],_=t+n-1,x=e[t].x,S=e[_].x-x;for(a=t;a<t+n;++a){r=e[a],l=(r.x-x)/S*i,c=r.y;const w=l|0;if(w===u)c<p?(p=c,h=a):c>g&&(g=c,f=a),s=(o*s+r.x)/++o;else{const D=a-1;if(!Z(h)&&!Z(f)){const v=Math.min(h,f),A=Math.max(h,f);v!==m&&v!==D&&y.push({...e[v],x:s}),A!==m&&A!==D&&y.push({...e[A],x:s})}a>0&&D!==m&&y.push(e[D]),y.push(r),u=w,o=0,p=g=c,h=f=m=a}}return y}function Id(e){if(e._decimated){const t=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function Ld(e){e.data.datasets.forEach(t=>{Id(t)})}function iT(e,t){const n=t.length;let i=0,s;const{iScale:o}=e,{min:a,max:r,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(i=It(we(t,o.axis,a).lo,0,n-1)),c?s=It(we(t,o.axis,r).hi+1,i,n)-i:s=n-i,{start:i,count:s}}var sT={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(e,t,n)=>{if(!n.enabled){Ld(e);return}const i=e.width;e.data.datasets.forEach((s,o)=>{const{_data:a,indexAxis:r}=s,l=e.getDatasetMeta(o),c=a||s.data;if(wi([r,e.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const u=e.scales[l.xAxisID];if(u.type!=="linear"&&u.type!=="time"||e.options.parsing)return;let{start:h,count:f}=iT(l,c);const m=n.threshold||4*i;if(f<=m){Id(s);return}Z(a)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(g){this._data=g}}));let p;switch(n.algorithm){case"lttb":p=eT(c,h,f,i,n);break;case"min-max":p=nT(c,h,f,i);break;default:throw new Error(`Unsupported decimation algorithm '${n.algorithm}'`)}s._decimated=p})},destroy(e){Ld(e)}};function oT(e,t,n){const i=e.segments,s=e.points,o=t.points,a=[];for(const r of i){let{start:l,end:c}=r;c=Ns(l,c,s);const u=Sa(n,s[l],s[c],r.loop);if(!t.segments){a.push({source:r,target:u,start:s[l],end:s[c]});continue}const h=Ec(t,u);for(const f of h){const m=Sa(n,o[f.start],o[f.end],f.loop),p=Pc(r,s,m);for(const g of p)a.push({source:g,target:f,start:{[n]:Nd(u,m,"start",Math.max)},end:{[n]:Nd(u,m,"end",Math.min)}})}}return a}function Sa(e,t,n,i){if(i)return;let s=t[e],o=n[e];return e==="angle"&&(s=Ut(s),o=Ut(o)),{property:e,start:s,end:o}}function aT(e,t){const{x:n=null,y:i=null}=e||{},s=t.points,o=[];return t.segments.forEach(({start:a,end:r})=>{r=Ns(a,r,s);const l=s[a],c=s[r];i!==null?(o.push({x:l.x,y:i}),o.push({x:c.x,y:i})):n!==null&&(o.push({x:n,y:l.y}),o.push({x:n,y:c.y}))}),o}function Ns(e,t,n){for(;t>e;t--){const i=n[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function Nd(e,t,n,i){return e&&t?i(e[n],t[n]):e?e[n]:t?t[n]:0}function Bd(e,t){let n=[],i=!1;return ct(e)?(i=!0,n=e):n=aT(e,t),n.length?new Ls({points:n,options:{tension:0},_loop:i,_fullLoop:i}):null}function Fd(e){return e&&e.fill!==!1}function rT(e,t,n){let s=e[t].fill;const o=[t];let a;if(!n)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!_t(s))return s;if(a=e[s],!a)return!1;if(a.visible)return s;o.push(s),s=a.fill}return!1}function lT(e,t,n){const i=hT(e);if(nt(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return _t(s)&&Math.floor(s)===s?cT(i[0],t,s,n):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function cT(e,t,n,i){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=i?!1:n}function dT(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:nt(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function uT(e,t,n){let i;return e==="start"?i=n:e==="end"?i=t.options.reverse?t.min:t.max:nt(e)?i=e.value:i=t.getBaseValue(),i}function hT(e){const t=e.options,n=t.fill;let i=Q(n&&n.target,n);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function fT(e){const{scale:t,index:n,line:i}=e,s=[],o=i.segments,a=i.points,r=mT(t,n);r.push(Bd({x:null,y:t.bottom},i));for(let l=0;l<o.length;l++){const c=o[l];for(let u=c.start;u<=c.end;u++)pT(s,a[u],r)}return new Ls({points:s,options:{}})}function mT(e,t){const n=[],i=e.getMatchingVisibleMetas("line");for(let s=0;s<i.length;s++){const o=i[s];if(o.index===t)break;o.hidden||n.unshift(o.dataset)}return n}function pT(e,t,n){const i=[];for(let s=0;s<n.length;s++){const o=n[s],{first:a,last:r,point:l}=gT(o,t,"x");if(!(!l||a&&r)){if(a)i.unshift(l);else if(e.push(l),!r)break}}e.push(...i)}function gT(e,t,n){const i=e.interpolate(t,n);if(!i)return{};const s=i[n],o=e.segments,a=e.points;let r=!1,l=!1;for(let c=0;c<o.length;c++){const u=o[c],h=a[u.start][n],f=a[u.end][n];if(xe(s,h,f)){r=s===h,l=s===f;break}}return{first:r,last:l,point:i}}class zd{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,n,i){const{x:s,y:o,radius:a}=this;return n=n||{start:0,end:gt},t.arc(s,o,a,n.end,n.start,!0),!i.bounds}interpolate(t){const{x:n,y:i,radius:s}=this,o=t.angle;return{x:n+Math.cos(o)*s,y:i+Math.sin(o)*s,angle:o}}}function yT(e){const{chart:t,fill:n,line:i}=e;if(_t(n))return bT(t,n);if(n==="stack")return fT(e);if(n==="shape")return!0;const s=_T(e);return s instanceof zd?s:Bd(s,i)}function bT(e,t){const n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function _T(e){return(e.scale||{}).getPointPositionForValue?wT(e):xT(e)}function xT(e){const{scale:t={},fill:n}=e,i=dT(n,t);if(_t(i)){const s=t.isHorizontal();return{x:s?i:null,y:s?null:i}}return null}function wT(e){const{scale:t,fill:n}=e,i=t.options,s=t.getLabels().length,o=i.reverse?t.max:t.min,a=uT(n,t,o),r=[];if(i.grid.circular){const l=t.getPointPositionForValue(0,o);return new zd({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(a)})}for(let l=0;l<s;++l)r.push(t.getPointPositionForValue(l,a));return r}function Ma(e,t,n){const i=yT(t),{chart:s,index:o,line:a,scale:r,axis:l}=t,c=a.options,u=c.fill,h=c.backgroundColor,{above:f=h,below:m=h}=u||{},p=s.getDatasetMeta(o),g=Lc(s,p);i&&a.points.length&&(_i(e,n),kT(e,{line:a,target:i,above:f,below:m,area:n,scale:r,axis:l,clip:g}),xi(e))}function kT(e,t){const{line:n,target:i,above:s,below:o,area:a,scale:r,clip:l}=t,c=n._loop?"angle":t.axis;e.save();let u=o;o!==s&&(c==="x"?(Ud(e,i,a.top),Da(e,{line:n,target:i,color:s,scale:r,property:c,clip:l}),e.restore(),e.save(),Ud(e,i,a.bottom)):c==="y"&&(Vd(e,i,a.left),Da(e,{line:n,target:i,color:o,scale:r,property:c,clip:l}),e.restore(),e.save(),Vd(e,i,a.right),u=s)),Da(e,{line:n,target:i,color:u,scale:r,property:c,clip:l}),e.restore()}function Ud(e,t,n){const{segments:i,points:s}=t;let o=!0,a=!1;e.beginPath();for(const r of i){const{start:l,end:c}=r,u=s[l],h=s[Ns(l,c,s)];o?(e.moveTo(u.x,u.y),o=!1):(e.lineTo(u.x,n),e.lineTo(u.x,u.y)),a=!!t.pathSegment(e,r,{move:a}),a?e.closePath():e.lineTo(h.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function Vd(e,t,n){const{segments:i,points:s}=t;let o=!0,a=!1;e.beginPath();for(const r of i){const{start:l,end:c}=r,u=s[l],h=s[Ns(l,c,s)];o?(e.moveTo(u.x,u.y),o=!1):(e.lineTo(n,u.y),e.lineTo(u.x,u.y)),a=!!t.pathSegment(e,r,{move:a}),a?e.closePath():e.lineTo(n,h.y)}e.lineTo(n,t.first().y),e.closePath(),e.clip()}function Da(e,t){const{line:n,target:i,property:s,color:o,scale:a,clip:r}=t,l=oT(n,i,s);for(const{source:c,target:u,start:h,end:f}of l){const{style:{backgroundColor:m=o}={}}=c,p=i!==!0;e.save(),e.fillStyle=m,TT(e,a,r,p&&Sa(s,h,f)),e.beginPath();const g=!!n.pathSegment(e,c);let y;if(p){g?e.closePath():Hd(e,i,f,s);const _=!!i.pathSegment(e,u,{move:g,reverse:!0});y=g&&_,y||Hd(e,i,h,s)}e.closePath(),e.fill(y?"evenodd":"nonzero"),e.restore()}}function TT(e,t,n,i){const s=t.chart.chartArea,{property:o,start:a,end:r}=i||{};if(o==="x"||o==="y"){let l,c,u,h;o==="x"?(l=a,c=s.top,u=r,h=s.bottom):(l=s.left,c=a,u=s.right,h=r),e.beginPath(),n&&(l=Math.max(l,n.left),u=Math.min(u,n.right),c=Math.max(c,n.top),h=Math.min(h,n.bottom)),e.rect(l,c,u-l,h-c),e.clip()}}function Hd(e,t,n,i){const s=t.interpolate(n,i);s&&e.lineTo(s.x,s.y)}var vT={id:"filler",afterDatasetsUpdate(e,t,n){const i=(e.data.datasets||[]).length,s=[];let o,a,r,l;for(a=0;a<i;++a)o=e.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof Ls&&(l={visible:e.isDatasetVisible(a),index:a,fill:lT(r,a,i),chart:e,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,s.push(l);for(a=0;a<i;++a)l=s[a],!(!l||l.fill===!1)&&(l.fill=rT(s,a,n.propagate))},beforeDraw(e,t,n){const i=n.drawTime==="beforeDraw",s=e.getSortedVisibleDatasetMetas(),o=e.chartArea;for(let a=s.length-1;a>=0;--a){const r=s[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),i&&r.fill&&Ma(e.ctx,r,o))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;const i=e.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const o=i[s].$filler;Fd(o)&&Ma(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,t,n){const i=t.meta.$filler;!Fd(i)||n.drawTime!=="beforeDatasetDraw"||Ma(e.ctx,i,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const $d=(e,t)=>{let{boxHeight:n=t,boxWidth:i=t}=e;return e.usePointStyle&&(n=Math.min(n,t),i=e.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:n,itemHeight:Math.max(t,n)}},ST=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class Yd extends $t{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,i){this.maxWidth=t,this.maxHeight=n,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=ft(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(i=>t.filter(i,this.chart.data))),t.sort&&(n=n.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=xt(i.font),o=s.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=$d(i,o);let c,u;n.font=s.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(a,o,r,l)+10):(u=this.maxHeight,c=this._fitCols(a,s,r,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,i,s){const{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=s+r;let h=t;o.textAlign="left",o.textBaseline="middle";let f=-1,m=-u;return this.legendItems.forEach((p,g)=>{const y=i+n/2+o.measureText(p.text).width;(g===0||c[c.length-1]+y+2*r>a)&&(h+=u,c[c.length-(g>0?0:1)]=0,m+=u,f++),l[g]={left:0,top:m,row:f,width:y,height:s},c[c.length-1]+=y+r}),h}_fitCols(t,n,i,s){const{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=a-t;let h=r,f=0,m=0,p=0,g=0;return this.legendItems.forEach((y,_)=>{const{itemWidth:x,itemHeight:T}=MT(i,n,o,y,s);_>0&&m+T+2*r>u&&(h+=f+r,c.push({width:f,height:m}),p+=f+r,g++,f=m=0),l[_]={left:p,top:m,col:g,width:x,height:T},f=Math.max(f,x),m+=T+r}),h+=f,c.push({width:f,height:m}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:i,labels:{padding:s},rtl:o}}=this,a=Rn(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=Vt(i,this.left+s,this.right-this.lineWidths[r]);for(const c of n)r!==c.row&&(r=c.row,l=Vt(i,this.left+s,this.right-this.lineWidths[r])),c.top+=this.top+t+s,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+s}else{let r=0,l=Vt(i,this.top+t+s,this.bottom-this.columnSizes[r].height);for(const c of n)c.col!==r&&(r=c.col,l=Vt(i,this.top+t+s,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+s,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;_i(t,this),this._draw(),xi(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:i,ctx:s}=this,{align:o,labels:a}=t,r=bt.color,l=Rn(t.rtl,this.left,this.width),c=xt(a.font),{padding:u}=a,h=c.size,f=h/2;let m;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:p,boxHeight:g,itemHeight:y}=$d(a,h),_=function(D,v,A){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;s.save();const R=Q(A.lineWidth,1);if(s.fillStyle=Q(A.fillStyle,r),s.lineCap=Q(A.lineCap,"butt"),s.lineDashOffset=Q(A.lineDashOffset,0),s.lineJoin=Q(A.lineJoin,"miter"),s.lineWidth=R,s.strokeStyle=Q(A.strokeStyle,r),s.setLineDash(Q(A.lineDash,[])),a.usePointStyle){const E={radius:g*Math.SQRT2/2,pointStyle:A.pointStyle,rotation:A.rotation,borderWidth:R},k=l.xPlus(D,p/2),C=v+f;pc(s,E,k,C,a.pointStyleWidth&&p)}else{const E=v+Math.max((h-g)/2,0),k=l.leftForLtr(D,p),C=Ne(A.borderRadius);s.beginPath(),Object.values(C).some(z=>z!==0)?An(s,{x:k,y:E,w:p,h:g,radius:C}):s.rect(k,E,p,g),s.fill(),R!==0&&s.stroke()}s.restore()},x=function(D,v,A){en(s,A.text,D,v+y/2,c,{strikethrough:A.hidden,textAlign:l.textAlign(A.textAlign)})},T=this.isHorizontal(),S=this._computeTitleHeight();T?m={x:Vt(o,this.left+u,this.right-i[0]),y:this.top+u+S,line:0}:m={x:this.left+u,y:Vt(o,this.top+S+u,this.bottom-n[0].height),line:0},Dc(this.ctx,t.textDirection);const w=y+u;this.legendItems.forEach((D,v)=>{s.strokeStyle=D.fontColor,s.fillStyle=D.fontColor;const A=s.measureText(D.text).width,R=l.textAlign(D.textAlign||(D.textAlign=a.textAlign)),E=p+f+A;let k=m.x,C=m.y;l.setWidth(this.width),T?v>0&&k+E+u>this.right&&(C=m.y+=w,m.line++,k=m.x=Vt(o,this.left+u,this.right-i[m.line])):v>0&&C+w>this.bottom&&(k=m.x=k+n[m.line].width+u,m.line++,C=m.y=Vt(o,this.top+S+u,this.bottom-n[m.line].height));const z=l.x(k);if(_(z,C,D),k=V_(R,k+p+f,T?k+E:this.right,t.rtl),x(l.x(k),C,D),T)m.x+=E+u;else if(typeof D.text!="string"){const N=c.lineHeight;m.y+=Wd(D,N)+u}else m.y+=w}),Cc(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,i=xt(n.font),s=Pt(n.padding);if(!n.display)return;const o=Rn(t.rtl,this.left,this.width),a=this.ctx,r=n.position,l=i.size/2,c=s.top+l;let u,h=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),u=this.top+c,h=Vt(t.align,h,this.right-f);else{const p=this.columnSizes.reduce((g,y)=>Math.max(g,y.height),0);u=c+Vt(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const m=Vt(r,h,h+f);a.textAlign=o.textAlign(Zo(r)),a.textBaseline="middle",a.strokeStyle=n.color,a.fillStyle=n.color,a.font=i.string,en(a,n.text,m,u,i)}_computeTitleHeight(){const t=this.options.title,n=xt(t.font),i=Pt(t.padding);return t.display?n.lineHeight+i.height:0}_getLegendItemAt(t,n){let i,s,o;if(xe(t,this.left,this.right)&&xe(n,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(s=o[i],xe(t,s.left,s.left+s.width)&&xe(n,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const n=this.options;if(!OT(t.type,n))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,o=ST(s,i);s&&!o&&ft(n.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!o&&ft(n.onHover,[t,i,this],this)}else i&&ft(n.onClick,[t,i,this],this)}}function MT(e,t,n,i,s){const o=DT(i,e,t,n),a=CT(s,i,t.lineHeight);return{itemWidth:o,itemHeight:a}}function DT(e,t,n,i){let s=e.text;return s&&typeof s!="string"&&(s=s.reduce((o,a)=>o.length>a.length?o:a)),t+n.size/2+i.measureText(s).width}function CT(e,t,n){let i=e;return typeof t.text!="string"&&(i=Wd(t,n)),i}function Wd(e,t){const n=e.text?e.text.length:0;return t*n}function OT(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var AT={id:"legend",_element:Yd,start(e,t,n){const i=e.legend=new Yd({ctx:e.ctx,options:n,chart:e});Ht.configure(e,i,n),Ht.addBox(e,i)},stop(e){Ht.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const i=e.legend;Ht.configure(e,i,n),i.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const i=t.datasetIndex,s=n.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:i,textAlign:s,color:o,useBorderRadius:a,borderRadius:r}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),u=Pt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class Ca extends $t{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const s=ct(i.text)?i.text.length:1;this._padding=Pt(i.padding);const o=s*xt(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:i,bottom:s,right:o,options:a}=this,r=a.align;let l=0,c,u,h;return this.isHorizontal()?(u=Vt(r,i,o),h=n+t,c=o-i):(a.position==="left"?(u=i+t,h=Vt(r,s,n),l=tt*-.5):(u=o-t,h=Vt(r,n,s),l=tt*.5),c=s-n),{titleX:u,titleY:h,maxWidth:c,rotation:l}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const i=xt(n.font),o=i.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);en(t,n.text,0,0,i,{color:n.color,maxWidth:l,rotation:c,textAlign:Zo(n.align),textBaseline:"middle",translation:[a,r]})}}function PT(e,t){const n=new Ca({ctx:e.ctx,options:t,chart:e});Ht.configure(e,n,t),Ht.addBox(e,n),e.titleBlock=n}var ET={id:"title",_element:Ca,start(e,t,n){PT(e,n)},stop(e){const t=e.titleBlock;Ht.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const i=e.titleBlock;Ht.configure(e,i,n),i.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Bs=new WeakMap;var RT={id:"subtitle",start(e,t,n){const i=new Ca({ctx:e.ctx,options:n,chart:e});Ht.configure(e,i,n),Ht.addBox(e,i),Bs.set(e,i)},stop(e){Ht.removeBox(e,Bs.get(e)),Bs.delete(e)},beforeUpdate(e,t,n){const i=Bs.get(e);Ht.configure(e,i,n),i.options=n},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Pi={average(e){if(!e.length)return!1;let t,n,i=new Set,s=0,o=0;for(t=0,n=e.length;t<n;++t){const r=e[t].element;if(r&&r.hasValue()){const l=r.tooltipPosition();i.add(l.x),s+=l.y,++o}}return o===0||i.size===0?!1:{x:[...i].reduce((r,l)=>r+l)/i.size,y:s/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,i=t.y,s=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=e.length;o<a;++o){const l=e[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=On(t,c);u<s&&(s=u,r=l)}}if(r){const l=r.tooltipPosition();n=l.x,i=l.y}return{x:n,y:i}}};function me(e,t){return t&&(ct(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function ve(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
2
2
  `)>-1?e.split(`
3
- `):e}function ET(e,t){const{element:n,datasetIndex:i,index:s}=t,o=e.getDatasetMeta(i).controller,{label:a,value:r}=o.getLabelAndValue(s);return{chart:e,label:a,parsed:o.getParsed(s),raw:e.data.datasets[i].data[s],formattedValue:r,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:n}}function ju(e,t){const n=e.chart.ctx,{body:i,footer:s,title:o}=e,{boxWidth:a,boxHeight:r}=t,l=xt(t.bodyFont),c=xt(t.titleFont),d=xt(t.footerFont),h=o.length,f=s.length,m=i.length,p=Pt(t.padding);let g=p.height,y=0,_=i.reduce((v,w)=>v+w.before.length+w.lines.length+w.after.length,0);if(_+=e.beforeBody.length+e.afterBody.length,h&&(g+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),_){const v=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;g+=m*v+(_-m)*l.lineHeight+(_-1)*t.bodySpacing}f&&(g+=t.footerMarginTop+f*d.lineHeight+(f-1)*t.footerSpacing);let x=0;const T=function(v){y=Math.max(y,n.measureText(v).width+x)};return n.save(),n.font=c.string,mt(e.title,T),n.font=l.string,mt(e.beforeBody.concat(e.afterBody),T),x=t.displayColors?a+2+t.boxPadding:0,mt(i,v=>{mt(v.before,T),mt(v.lines,T),mt(v.after,T)}),x=0,n.font=d.string,mt(e.footer,T),n.restore(),y+=p.width,{width:y,height:g}}function RT(e,t){const{y:n,height:i}=t;return n<i/2?"top":n>e.height-i/2?"bottom":"center"}function IT(e,t,n,i){const{x:s,width:o}=i,a=n.caretSize+n.caretPadding;if(e==="left"&&s+o+a>t.width||e==="right"&&s-o-a<0)return!0}function LT(e,t,n,i){const{x:s,width:o}=n,{width:a,chartArea:{left:r,right:l}}=e;let c="center";return i==="center"?c=s<=(r+l)/2?"left":"right":s<=o/2?c="left":s>=a-o/2&&(c="right"),IT(c,e,t,n)&&(c="center"),c}function qu(e,t,n){const i=n.yAlign||t.yAlign||RT(e,n);return{xAlign:n.xAlign||t.xAlign||LT(e,t,n,i),yAlign:i}}function NT(e,t){let{x:n,width:i}=e;return t==="right"?n-=i:t==="center"&&(n-=i/2),n}function BT(e,t,n){let{y:i,height:s}=e;return t==="top"?i+=n:t==="bottom"?i-=s+n:i-=s/2,i}function Gu(e,t,n,i){const{caretSize:s,caretPadding:o,cornerRadius:a}=e,{xAlign:r,yAlign:l}=n,c=s+o,{topLeft:d,topRight:h,bottomLeft:f,bottomRight:m}=Ne(a);let p=NT(t,r);const g=BT(t,l,c);return l==="center"?r==="left"?p+=c:r==="right"&&(p-=c):r==="left"?p-=Math.max(d,f)+s:r==="right"&&(p+=Math.max(h,m)+s),{x:It(p,0,i.width-t.width),y:It(g,0,i.height-t.height)}}function Fs(e,t,n){const i=Pt(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-i.right:e.x+i.left}function Xu(e){return me([],Se(e))}function FT(e,t,n){return Be(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Ku(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const Zu={beforeTitle:_e,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,i=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return n[t.dataIndex]}return""},afterTitle:_e,beforeBody:_e,beforeLabel:_e,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return Z(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:_e,afterBody:_e,beforeFooter:_e,footer:_e,afterFooter:_e};function Qt(e,t,n,i){const s=e[t].call(n,i);return typeof s>"u"?Zu[t].call(n,i):s}class Qu extends $t{static positioners=Pi;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&n.options.animation&&i.animations,o=new la(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=FT(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:i}=n,s=Qt(i,"beforeTitle",this,t),o=Qt(i,"title",this,t),a=Qt(i,"afterTitle",this,t);let r=[];return r=me(r,Se(s)),r=me(r,Se(o)),r=me(r,Se(a)),r}getBeforeBody(t,n){return Xu(Qt(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:i}=n,s=[];return mt(t,o=>{const a={before:[],lines:[],after:[]},r=Ku(i,o);me(a.before,Se(Qt(r,"beforeLabel",this,o))),me(a.lines,Qt(r,"label",this,o)),me(a.after,Se(Qt(r,"afterLabel",this,o))),s.push(a)}),s}getAfterBody(t,n){return Xu(Qt(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:i}=n,s=Qt(i,"beforeFooter",this,t),o=Qt(i,"footer",this,t),a=Qt(i,"afterFooter",this,t);let r=[];return r=me(r,Se(s)),r=me(r,Se(o)),r=me(r,Se(a)),r}_createItems(t){const n=this._active,i=this.chart.data,s=[],o=[],a=[];let r=[],l,c;for(l=0,c=n.length;l<c;++l)r.push(ET(this.chart,n[l]));return t.filter&&(r=r.filter((d,h,f)=>t.filter(d,h,f,i))),t.itemSort&&(r=r.sort((d,h)=>t.itemSort(d,h,i))),mt(r,d=>{const h=Ku(t.callbacks,d);s.push(Qt(h,"labelColor",this,d)),o.push(Qt(h,"labelPointStyle",this,d)),a.push(Qt(h,"labelTextColor",this,d))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,n){const i=this.options.setContext(this.getContext()),s=this._active;let o,a=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const r=Pi[i.position].call(this,s,this._eventPosition);a=this._createItems(i),this.title=this.getTitle(a,i),this.beforeBody=this.getBeforeBody(a,i),this.body=this.getBody(a,i),this.afterBody=this.getAfterBody(a,i),this.footer=this.getFooter(a,i);const l=this._size=ju(this,i),c=Object.assign({},r,l),d=qu(this.chart,i,c),h=Gu(i,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,o={opacity:1,x:h.x,y:h.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,i,s){const o=this.getCaretPosition(t,i,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,i){const{xAlign:s,yAlign:o}=this,{caretSize:a,cornerRadius:r}=i,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:h}=Ne(r),{x:f,y:m}=t,{width:p,height:g}=n;let y,_,x,T,v,w;return o==="center"?(v=m+g/2,s==="left"?(y=f,_=y-a,T=v+a,w=v-a):(y=f+p,_=y+a,T=v-a,w=v+a),x=y):(s==="left"?_=f+Math.max(l,d)+a:s==="right"?_=f+p-Math.max(c,h)-a:_=this.caretX,o==="top"?(T=m,v=T-a,y=_-a,x=_+a):(T=m+g,v=T+a,y=_+a,x=_-a),w=T),{x1:y,x2:_,x3:x,y1:T,y2:v,y3:w}}drawTitle(t,n,i){const s=this.title,o=s.length;let a,r,l;if(o){const c=Rn(i.rtl,this.x,this.width);for(t.x=Fs(this,i.titleAlign,i),n.textAlign=c.textAlign(i.titleAlign),n.textBaseline="middle",a=xt(i.titleFont),r=i.titleSpacing,n.fillStyle=i.titleColor,n.font=a.string,l=0;l<o;++l)n.fillText(s[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+r,l+1===o&&(t.y+=i.titleMarginBottom-r)}}_drawColorBox(t,n,i,s,o){const a=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=o,d=xt(o.bodyFont),h=Fs(this,"left",o),f=s.x(h),m=l<d.lineHeight?(d.lineHeight-l)/2:0,p=n.y+m;if(o.usePointStyle){const g={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},y=s.leftForLtr(f,c)+c/2,_=p+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,ea(t,g,y,_),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,ea(t,g,y,_)}else{t.lineWidth=et(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const g=s.leftForLtr(f,c),y=s.leftForLtr(s.xPlus(f,1),c-2),_=Ne(a.borderRadius);Object.values(_).some(x=>x!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,An(t,{x:g,y:p,w:c,h:l,radius:_}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),An(t,{x:y,y:p+1,w:c-2,h:l-2,radius:_}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(g,p,c,l),t.strokeRect(g,p,c,l),t.fillStyle=a.backgroundColor,t.fillRect(y,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,n,i){const{body:s}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:d}=i,h=xt(i.bodyFont);let f=h.lineHeight,m=0;const p=Rn(i.rtl,this.x,this.width),g=function(A){n.fillText(A,p.x(t.x+m),t.y+f/2),t.y+=f+o},y=p.textAlign(a);let _,x,T,v,w,D,S;for(n.textAlign=a,n.textBaseline="middle",n.font=h.string,t.x=Fs(this,y,i),n.fillStyle=i.bodyColor,mt(this.beforeBody,g),m=r&&y!=="right"?a==="center"?c/2+d:c+2+d:0,v=0,D=s.length;v<D;++v){for(_=s[v],x=this.labelTextColors[v],n.fillStyle=x,mt(_.before,g),T=_.lines,r&&T.length&&(this._drawColorBox(n,t,v,p,i),f=Math.max(h.lineHeight,l)),w=0,S=T.length;w<S;++w)g(T[w]),f=h.lineHeight;mt(_.after,g)}m=0,f=h.lineHeight,mt(this.afterBody,g),t.y-=o}drawFooter(t,n,i){const s=this.footer,o=s.length;let a,r;if(o){const l=Rn(i.rtl,this.x,this.width);for(t.x=Fs(this,i.footerAlign,i),t.y+=i.footerMarginTop,n.textAlign=l.textAlign(i.footerAlign),n.textBaseline="middle",a=xt(i.footerFont),n.fillStyle=i.footerColor,n.font=a.string,r=0;r<o;++r)n.fillText(s[r],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+i.footerSpacing}}drawBackground(t,n,i,s){const{xAlign:o,yAlign:a}=this,{x:r,y:l}=t,{width:c,height:d}=i,{topLeft:h,topRight:f,bottomLeft:m,bottomRight:p}=Ne(s.cornerRadius);n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.beginPath(),n.moveTo(r+h,l),a==="top"&&this.drawCaret(t,n,i,s),n.lineTo(r+c-f,l),n.quadraticCurveTo(r+c,l,r+c,l+f),a==="center"&&o==="right"&&this.drawCaret(t,n,i,s),n.lineTo(r+c,l+d-p),n.quadraticCurveTo(r+c,l+d,r+c-p,l+d),a==="bottom"&&this.drawCaret(t,n,i,s),n.lineTo(r+m,l+d),n.quadraticCurveTo(r,l+d,r,l+d-m),a==="center"&&o==="left"&&this.drawCaret(t,n,i,s),n.lineTo(r,l+h),n.quadraticCurveTo(r,l,r+h,l),n.closePath(),n.fill(),s.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){const a=Pi[t.position].call(this,this._active,this._eventPosition);if(!a)return;const r=this._size=ju(this,t),l=Object.assign({},a,this._size),c=qu(n,t,l),d=Gu(t,l,c,n);(s._to!==d.x||o._to!==d.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const a=Pt(n.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,n),Dc(t,n.textDirection),o.y+=a.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),Cc(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const i=this._active,s=t.map(({datasetIndex:r,index:l})=>{const c=this.chart.getDatasetMeta(r);if(!c)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:c.data[l],index:l}}),o=!fs(i,s),a=this._positionChanged(s,n);(o||a)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,i=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],a=this._getActiveElements(t,o,n,i),r=this._positionChanged(a,t),l=n||!fs(a,o)||r;return l&&(this._active=a,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,i,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return n.filter(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&a.reverse(),a}_positionChanged(t,n){const{caretX:i,caretY:s,options:o}=this,a=Pi[o.position].call(this,t,n);return a!==!1&&(i!==a.x||s!==a.y)}}var Yt={id:"tooltip",_element:Qu,positioners:Pi,afterInit(e,t,n){n&&(e.tooltip=new Qu({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Zu},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},zT=Object.freeze({__proto__:null,Colors:Qk,Decimation:nT,Filler:kT,Legend:CT,SubTitle:PT,Title:AT,Tooltip:Yt});const UT=(e,t,n,i)=>(typeof t=="string"?(n=e.push(t)-1,i.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function VT(e,t,n,i){const s=e.indexOf(t);if(s===-1)return UT(e,t,n,i);const o=e.lastIndexOf(t);return s!==o?n:s}const HT=(e,t)=>e===null?null:It(Math.round(e),0,t);function Ju(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class $T extends an{static id="category";static defaults={ticks:{callback:Ju}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const i=this.getLabels();for(const{index:s,label:o}of n)i[s]===o&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(Z(t))return null;const i=this.getLabels();return n=isFinite(n)&&i[n]===t?n:VT(i,t,Q(n,t),this._addedLabels),HT(n,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),n||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,n=this.max,i=this.options.offset,s=[];let o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let a=t;a<=n;a++)s.push({value:a});return s}getLabelForValue(t){return Ju.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function YT(e,t){const n=[],{bounds:s,step:o,min:a,max:r,precision:l,count:c,maxTicks:d,maxDigits:h,includeBounds:f}=e,m=o||1,p=d-1,{min:g,max:y}=t,_=!Z(a),x=!Z(r),T=!Z(c),v=(y-g)/(h+1);let w=tc((y-g)/p/m)*m,D,S,A,R;if(w<1e-14&&!_&&!x)return[{value:g},{value:y}];R=Math.ceil(y/w)-Math.floor(g/w),R>p&&(w=tc(R*w/p/m)*m),Z(l)||(D=Math.pow(10,l),w=Math.ceil(w*D)/D),s==="ticks"?(S=Math.floor(g/w)*w,A=Math.ceil(y/w)*w):(S=g,A=y),_&&x&&o&&E_((r-a)/o,w/1e3)?(R=Math.round(Math.min((r-a)/w,d)),w=(r-a)/R,S=a,A=r):T?(S=_?a:S,A=x?r:A,R=c-1,w=(A-S)/R):(R=(A-S)/w,mi(R,Math.round(R),w/1e3)?R=Math.round(R):R=Math.ceil(R));const E=Math.max(nc(w),nc(S));D=Math.pow(10,Z(l)?E:l),S=Math.round(S*D)/D,A=Math.round(A*D)/D;let k=0;for(_&&(f&&S!==a?(n.push({value:a}),S<a&&k++,mi(Math.round((S+k*w)*D)/D,a,td(a,v,e))&&k++):S<a&&k++);k<R;++k){const C=Math.round((S+k*w)*D)/D;if(x&&C>r)break;n.push({value:C})}return x&&f&&A!==r?n.length&&mi(n[n.length-1].value,r,td(r,v,e))?n[n.length-1].value=r:n.push({value:r}):(!x||A===r)&&n.push({value:A}),n}function td(e,t,{horizontal:n,minRotation:i}){const s=At(i),o=(n?Math.sin(s):Math.cos(s))||.001,a=.75*t*(""+e).length;return Math.min(t/o,a)}class zs extends an{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return Z(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:i}=this.getUserBounds();let{min:s,max:o}=this;const a=l=>s=n?s:l,r=l=>o=i?o:l;if(t){const l=he(s),c=he(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,a=YT(s,o);return t.bounds==="ticks"&&ec(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let n=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-n)/Math.max(t.length-1,1)/2;n-=s,i+=s}this._startValue=n,this._endValue=i,this._valueRange=i-n}getLabelForValue(t){return yi(t,this.chart.options.locale,this.options.ticks.format)}}class WT extends zs{static id="linear";static defaults={ticks:{callback:ws.formatters.numeric}};determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=_t(t)?t:0,this.max=_t(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,i=At(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const Ei=e=>Math.floor(Ie(e)),rn=(e,t)=>Math.pow(10,Ei(e)+t);function ed(e){return e/Math.pow(10,Ei(e))===1}function nd(e,t,n){const i=Math.pow(10,n),s=Math.floor(e/i);return Math.ceil(t/i)-s}function jT(e,t){const n=t-e;let i=Ei(n);for(;nd(e,t,i)>10;)i++;for(;nd(e,t,i)<10;)i--;return Math.min(i,Ei(e))}function qT(e,{min:t,max:n}){t=ie(e.min,t);const i=[],s=Ei(t);let o=jT(t,n),a=o<0?Math.pow(10,Math.abs(o)):1;const r=Math.pow(10,o),l=s>o?Math.pow(10,s):0,c=Math.round((t-l)*a)/a,d=Math.floor((t-l)/r/10)*r*10;let h=Math.floor((c-d)/Math.pow(10,o)),f=ie(e.min,Math.round((l+d+h*Math.pow(10,o))*a)/a);for(;f<n;)i.push({value:f,major:ed(f),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(o++,h=2,a=o>=0?1:a),f=Math.round((l+d+h*Math.pow(10,o))*a)/a;const m=ie(e.max,f);return i.push({value:m,major:ed(m),significand:h}),i}class GT extends an{static id="logarithmic";static defaults={ticks:{callback:ws.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const i=zs.prototype.parse.apply(this,[t,n]);if(i===0){this._zero=!0;return}return _t(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=_t(t)?Math.max(0,t):null,this.max=_t(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!_t(this._userMin)&&(this.min=t===rn(this.min,0)?rn(this.min,-1):rn(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let i=this.min,s=this.max;const o=r=>i=t?i:r,a=r=>s=n?s:r;i===s&&(i<=0?(o(1),a(10)):(o(rn(i,-1)),a(rn(s,1)))),i<=0&&o(rn(s,-1)),s<=0&&a(rn(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},i=qT(n,this);return t.bounds==="ticks"&&ec(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":yi(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Ie(t),this._valueRange=Ie(this.max)-Ie(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ie(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}function Ca(e){const t=e.ticks;if(t.display&&e.display){const n=Pt(t.backdropPadding);return Q(t.font&&t.font.size,bt.font.size)+n.height}return 0}function XT(e,t,n){return n=ct(n)?n:[n],{w:X_(e,t.string,n),h:n.length*t.lineHeight}}function id(e,t,n,i,s){return e===i||e===s?{start:t-n/2,end:t+n/2}:e<i||e>s?{start:t-n,end:t}:{start:t,end:t+n}}function KT(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),i=[],s=[],o=e._pointLabels.length,a=e.options.pointLabels,r=a.centerPointLabels?tt/o:0;for(let l=0;l<o;l++){const c=a.setContext(e.getPointLabelContext(l));s[l]=c.padding;const d=e.getPointPosition(l,e.drawingArea+s[l],r),h=xt(c.font),f=XT(e.ctx,h,e._pointLabels[l]);i[l]=f;const m=Ut(e.getIndexAngle(l)+r),p=Math.round(ys(m)),g=id(p,d.x,f.w,0,180),y=id(p,d.y,f.h,90,270);ZT(n,t,m,g,y)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=tS(e,i,s)}function ZT(e,t,n,i,s){const o=Math.abs(Math.sin(n)),a=Math.abs(Math.cos(n));let r=0,l=0;i.start<t.l?(r=(t.l-i.start)/o,e.l=Math.min(e.l,t.l-r)):i.end>t.r&&(r=(i.end-t.r)/o,e.r=Math.max(e.r,t.r+r)),s.start<t.t?(l=(t.t-s.start)/a,e.t=Math.min(e.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/a,e.b=Math.max(e.b,t.b+l))}function QT(e,t,n){const i=e.drawingArea,{extra:s,additionalAngle:o,padding:a,size:r}=n,l=e.getPointPosition(t,i+s+a,o),c=Math.round(ys(Ut(l.angle+yt))),d=iS(l.y,r.h,c),h=eS(c),f=nS(l.x,r.w,h);return{visible:!0,x:l.x,y:d,textAlign:h,left:f,top:d,right:f+r.w,bottom:d+r.h}}function JT(e,t){if(!t)return!0;const{left:n,top:i,right:s,bottom:o}=e;return!(ke({x:n,y:i},t)||ke({x:n,y:o},t)||ke({x:s,y:i},t)||ke({x:s,y:o},t))}function tS(e,t,n){const i=[],s=e._pointLabels.length,o=e.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:Ca(o)/2,additionalAngle:a?tt/s:0};let c;for(let d=0;d<s;d++){l.padding=n[d],l.size=t[d];const h=QT(e,d,l);i.push(h),r==="auto"&&(h.visible=JT(h,c),h.visible&&(c=h))}return i}function eS(e){return e===0||e===180?"center":e<180?"left":"right"}function nS(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function iS(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function sS(e,t,n){const{left:i,top:s,right:o,bottom:a}=n,{backdropColor:r}=t;if(!Z(r)){const l=Ne(t.borderRadius),c=Pt(t.backdropPadding);e.fillStyle=r;const d=i-c.left,h=s-c.top,f=o-i+c.width,m=a-s+c.height;Object.values(l).some(p=>p!==0)?(e.beginPath(),An(e,{x:d,y:h,w:f,h:m,radius:l}),e.fill()):e.fillRect(d,h,f,m)}}function oS(e,t){const{ctx:n,options:{pointLabels:i}}=e;for(let s=t-1;s>=0;s--){const o=e._pointLabelItems[s];if(!o.visible)continue;const a=i.setContext(e.getPointLabelContext(s));sS(n,a,o);const r=xt(a.font),{x:l,y:c,textAlign:d}=o;en(n,e._pointLabels[s],l,c+r.lineHeight/2,r,{color:a.color,textAlign:d,textBaseline:"middle"})}}function sd(e,t,n,i){const{ctx:s}=e;if(n)s.arc(e.xCenter,e.yCenter,t,0,gt);else{let o=e.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let a=1;a<i;a++)o=e.getPointPosition(a,t),s.lineTo(o.x,o.y)}}function aS(e,t,n,i,s){const o=e.ctx,a=t.circular,{color:r,lineWidth:l}=t;!a&&!i||!r||!l||n<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(s.dash||[]),o.lineDashOffset=s.dashOffset,o.beginPath(),sd(e,n,a,i),o.closePath(),o.stroke(),o.restore())}function rS(e,t,n){return Be(e,{label:n,index:t,type:"pointLabel"})}class lS extends zs{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ws.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Pt(Ca(this.options)/2),n=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+n/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(n,i)/2)}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!1);this.min=_t(t)&&!isNaN(t)?t:0,this.max=_t(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Ca(this.options))}generateTickLabels(t){zs.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,i)=>{const s=ft(this.options.pointLabels.callback,[n,i],this);return s||s===0?s:""}).filter((n,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?KT(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,i,s){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,i,s))}getIndexAngle(t){const n=gt/(this._pointLabels.length||1),i=this.options.startAngle||0;return Ut(t*n+At(i))}getDistanceFromCenterForValue(t){if(Z(t))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(Z(t))return NaN;const n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){const n=this._pointLabels||[];if(t>=0&&t<n.length){const i=n[t];return rS(this.getContext(),t,i)}}getPointPosition(t,n,i=0){const s=this.getIndexAngle(t)-yt+i;return{x:Math.cos(s)*n+this.xCenter,y:Math.sin(s)*n+this.yCenter,angle:s}}getPointPositionForValue(t,n){return this.getPointPosition(t,this.getDistanceFromCenterForValue(n))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:n,top:i,right:s,bottom:o}=this._pointLabelItems[t];return{left:n,top:i,right:s,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:n}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),sd(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,n=this.options,{angleLines:i,grid:s,border:o}=n,a=this._pointLabels.length;let r,l,c;if(n.pointLabels.display&&oS(this,a),s.display&&this.ticks.forEach((d,h)=>{if(h!==0||h===0&&this.min<0){l=this.getDistanceFromCenterForValue(d.value);const f=this.getContext(h),m=s.setContext(f),p=o.setContext(f);aS(this,m,l,a,p)}}),i.display){for(t.save(),r=a-1;r>=0;r--){const d=i.setContext(this.getPointLabelContext(r)),{color:h,lineWidth:f}=d;!f||!h||(t.lineWidth=f,t.strokeStyle=h,t.setLineDash(d.borderDash),t.lineDashOffset=d.borderDashOffset,l=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),c=this.getPointPosition(r,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,i=n.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let o,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&this.min>=0&&!n.reverse)return;const c=i.setContext(this.getContext(l)),d=xt(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=d.string,a=t.measureText(r.label).width,t.fillStyle=c.backdropColor;const h=Pt(c.backdropPadding);t.fillRect(-a/2-h.left,-o-d.size/2-h.top,a+h.width,d.size+h.height)}en(t,r.label,0,-o,d,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}const Us={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Jt=Object.keys(Us);function od(e,t){return e-t}function ad(e,t){if(Z(t))return null;const n=e._adapter,{parser:i,round:s,isoWeekday:o}=e._parseOpts;let a=t;return typeof i=="function"&&(a=i(a)),_t(a)||(a=typeof i=="string"?n.parse(a,i):n.parse(a)),a===null?null:(s&&(a=s==="week"&&(Le(o)||o===!0)?n.startOf(a,"isoWeek",o):n.startOf(a,s)),+a)}function rd(e,t,n,i){const s=Jt.length;for(let o=Jt.indexOf(e);o<s-1;++o){const a=Us[Jt[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((n-t)/(r*a.size))<=i)return Jt[o]}return Jt[s-1]}function cS(e,t,n,i,s){for(let o=Jt.length-1;o>=Jt.indexOf(n);o--){const a=Jt[o];if(Us[a].common&&e._adapter.diff(s,i,a)>=t-1)return a}return Jt[n?Jt.indexOf(n):0]}function uS(e){for(let t=Jt.indexOf(e)+1,n=Jt.length;t<n;++t)if(Us[Jt[t]].common)return Jt[t]}function ld(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:i,hi:s}=Xo(n,t),o=n[i]>=t?n[i]:n[s];e[o]=!0}}function dS(e,t,n,i){const s=e._adapter,o=+s.startOf(t[0].value,i),a=t[t.length-1].value;let r,l;for(r=o;r<=a;r=+s.add(r,1,i))l=n[r],l>=0&&(t[l].major=!0);return t}function cd(e,t,n){const i=[],s={},o=t.length;let a,r;for(a=0;a<o;++a)r=t[a],s[r]=a,i.push({value:r,major:!1});return o===0||!n?i:dS(e,i,s,n)}class Oa extends an{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const i=t.time||(t.time={}),s=this._adapter=new Zc._date(t.adapters.date);s.init(n),fi(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:ad(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,i=t.time.unit||"day";let{min:s,max:o,minDefined:a,maxDefined:r}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!r&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!a||!r)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=_t(s)&&!isNaN(s)?s:+n.startOf(Date.now(),i),o=_t(o)&&!isNaN(o)?o:+n.endOf(Date.now(),i)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],i=t[t.length-1]),{min:n,max:i}}buildTicks(){const t=this.options,n=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,a=this.max,r=N_(s,o,a);return this._unit=n.unit||(i.autoSkip?rd(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):cS(this,r.length,n.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:uS(this._unit),this.initOffsets(s),t.reverse&&r.reverse(),cd(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,i=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?n=1-s:n=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;n=It(n,0,a),i=It(i,0,a),this._offsets={start:n,end:i,factor:1/(n+1+i)}}_generate(){const t=this._adapter,n=this.min,i=this.max,s=this.options,o=s.time,a=o.unit||rd(o.minUnit,n,i,this._getLabelCapacity(n)),r=Q(s.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=Le(l)||l===!0,d={};let h=n,f,m;if(c&&(h=+t.startOf(h,"isoWeek",l)),h=+t.startOf(h,c?"day":a),t.diff(i,n,a)>1e5*r)throw new Error(n+" and "+i+" are too far apart with stepSize of "+r+" "+a);const p=s.ticks.source==="data"&&this.getDataTimestamps();for(f=h,m=0;f<i;f=+t.add(f,r,a),m++)ld(d,f,p);return(f===i||s.bounds==="ticks"||m===1)&&ld(d,f,p),Object.keys(d).sort(od).map(g=>+g)}getLabelForValue(t){const n=this._adapter,i=this.options.time;return i.tooltipFormat?n.format(t,i.tooltipFormat):n.format(t,i.displayFormats.datetime)}format(t,n){const s=this.options.time.displayFormats,o=this._unit,a=n||s[o];return this._adapter.format(t,a)}_tickFormatFunction(t,n,i,s){const o=this.options,a=o.ticks.callback;if(a)return ft(a,[t,n,i],this);const r=o.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&r[l],h=c&&r[c],f=i[n],m=c&&h&&f&&f.major;return this._adapter.format(t,s||(m?h:d))}generateTickLabels(t){let n,i,s;for(n=0,i=t.length;n<i;++n)s=t[n],s.label=this._tickFormatFunction(s.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+i)*n.factor)}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,i=this.ctx.measureText(t).width,s=At(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(s),a=Math.sin(s),r=this._resolveTickFontOptions(0).size;return{w:i*o+r*a,h:i*a+r*o}}_getLabelCapacity(t){const n=this.options.time,i=n.displayFormats,s=i[n.unit]||i.millisecond,o=this._tickFormatFunction(t,0,cd(this,[t],this._majorUnit),s),a=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return r>0?r:1}getDataTimestamps(){let t=this._cache.data||[],n,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,i=s.length;n<i;++n)t=t.concat(s[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,i;if(t.length)return t;const s=this.getLabels();for(n=0,i=s.length;n<i;++n)t.push(ad(this,s[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return oc(t.sort(od))}}function Vs(e,t,n){let i=0,s=e.length-1,o,a,r,l;n?(t>=e[i].pos&&t<=e[s].pos&&({lo:i,hi:s}=we(e,"pos",t)),{pos:o,time:r}=e[i],{pos:a,time:l}=e[s]):(t>=e[i].time&&t<=e[s].time&&({lo:i,hi:s}=we(e,"time",t)),{time:o,pos:r}=e[i],{time:a,pos:l}=e[s]);const c=a-o;return c?r+(l-r)*(t-o)/c:r}class hS extends Oa{static id="timeseries";static defaults=Oa.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=Vs(n,this.min),this._tableRange=Vs(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:i}=this,s=[],o=[];let a,r,l,c,d;for(a=0,r=t.length;a<r;++a)c=t[a],c>=n&&c<=i&&s.push(c);if(s.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(a=0,r=s.length;a<r;++a)d=s[a+1],l=s[a-1],c=s[a],Math.round((d+l)/2)!==c&&o.push({time:c,pos:a/(r-1)});return o}_generate(){const t=this.min,n=this.max;let i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(n)||i.length===1)&&i.push(n),i.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),i=this.getLabelTimestamps();return n.length&&i.length?t=this.normalize(n.concat(i)):t=n.length?n:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Vs(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return Vs(this._table,i*this._tableRange+this._minPos,!0)}}var fS=Object.freeze({__proto__:null,CategoryScale:$T,LinearScale:WT,LogarithmicScale:GT,RadialLinearScale:lS,TimeScale:Oa,TimeSeriesScale:hS});const mS=[mw,Wk,zT,fS];function pS(e){const n=`barChartTooltipPosition-${e.tooltipState.chartID}`,i={enabled:!1,position:n,callbacks:{label:l=>({label:l.dataset.label,value:l.label})}};Yt.positioners[n]=function(l,c){if(!l.length||e.tooltipState.interactionMode==="interactive"||c.x===null||c.y===null)return!1;const d=this.chart.canvas.getBoundingClientRect(),h=e.tooltipState.width||this.width,f=d.width/2,m=js(c,h,f),p=c.y,g=c.x<f?"left":"center";return{x:m-e.tooltipState.offsetX,y:p-e.tooltipState.offsetY,xAlign:g}},ga.modes.customInteractionMode=function(l,c){const d=Fe(c,l),h=[];return ga.evaluateInteractionItems(l,l.options.indexAxis||"x",d,(f,m,p)=>{l.options.indexAxis==="y"&&f.inYRange(d.y,!0)&&l.data.datasets[m].data[p]&&h.push({element:f,datasetIndex:m,index:p}),l.options.indexAxis==="x"&&d.x!==null&&f.inXRange(d.x,!0)&&l.data.datasets[m].data[p]&&h.push({element:f,datasetIndex:m,index:p})}),h};const s=e.numLabels.value>25?Ad:Pd,o=({chart:l,index:c})=>{const d=l.data;return{size:s,style:d?.isLabelEmpty?.[c]?"italic":"normal"}},a=(l,c,d)=>l.chart.options.indexAxis===l.axis?(c=l.getLabelForValue(d),c&&c.length>qs?c.slice(0,qs)+"...":c):l.getLabelForValue(Number(c)),r=u.computed(()=>({indexAxis:e.indexAxis,skipNull:!0,scales:{x:{stacked:e.stacked.value,grid:{offset:!1,drawOnChartArea:!1,drawBorder:!1,drawTicks:!0},ticks:{maxRotation:90,autoSkip:!1,font:o,callback:function(l,c){return a(this,l,c)}},title:{display:e.indexAxis==="y"?!Z(e.metricAxesTitle?.value):!Z(e.dimensionAxesTitle?.value),text:e.indexAxis==="y"?e.metricAxesTitle?.value:e.dimensionAxesTitle?.value,padding:{top:3,bottom:0,left:0,right:0},font:{weight:"bold"}}},y:{stacked:e.stacked.value,beginAtZero:!0,grid:{offset:!1,drawOnChartArea:!1,drawBorder:!1,drawTicks:!0},ticks:{padding:0,font:o,callback:function(l,c){return a(this,l,c)}},title:{display:e.indexAxis==="x"?!Z(e.metricAxesTitle?.value):!Z(e.dimensionAxesTitle?.value),text:e.indexAxis==="x"?e.metricAxesTitle?.value:e.dimensionAxesTitle?.value,padding:{bottom:3,top:0,left:0,right:0},font:{weight:"bold"}}}},plugins:{htmlLegend:{containerID:e.legendID},legend:{display:!1},tooltip:{...i,external:l=>{Dd(e.tooltipState,l)}}},interaction:{mode:"customInteractionMode",intersect:!0},maxBarThickness:60,maintainAspectRatio:!1,layout:{padding:{left:0,right:0,top:0,bottom:0}}}));return u.getCurrentInstance()&&u.onUnmounted(()=>{Yt.positioners[n]&&delete Yt.positioners[n]}),r}Zt.register(...mS);const gS=(e,t)=>{const n=t.datasets.map(s=>s.label),i=e.datasets.map(s=>s.label);return e.datasets.length===t.datasets.length&&n.every((s,o)=>s===i[o])};function yS(e,t,n,i,s){const o=u.shallowRef(null),a=(r,l)=>{if(t.value)return new Zt(t.value,{type:e,data:r,plugins:i,options:l})};return u.onMounted(()=>{o.value=a(n.value,s.value)}),u.onBeforeUnmount(()=>{Z(o.value)||o.value.destroy()}),u.watch(n,(r,l)=>{if(gS(l,r)&&!Z(o.value)){for(const[c,d]of r.datasets.entries())Object.assign(o.value.data.datasets[c],d);o.value.data.labels=r.labels,o.value.update()}else Z(o.value)||o.value.destroy(),o.value=a(r,s.value)}),u.watch(t,()=>{Z(o.value)||o.value.destroy(),o.value=a(n.value,s.value)}),u.watch(s,(r,l)=>{(r.indexAxis!==l.indexAxis||JSON.stringify(r.scales.x.title)!==JSON.stringify(l.scales.x.title)||JSON.stringify(r.scales.y.title)!==JSON.stringify(l.scales.y.title))&&(Z(o.value)||o.value.destroy(),o.value=a(n.value,r))}),o}const ud=1e3,bS=1e4,dd=1e6,hd=1e9,fd=1e12,Ri=(e,t)=>{if(t.separator===!1||e<1e3)return e.toString();const n=typeof t.separator=="string"?t.separator:",",i=[];return Math.round(e).toString().split("").reverse().forEach((o,a)=>{a&&a%3===0&&i.push(n),i.push(o)}),i.reverse().join("")},Ln=(e,t,n)=>{const i=e/t,s=n.round?"round":"floor";if(n.decimal===!1)return Math[s](i).toString();let o;n.precision?o=i:o=i<10?Math[s](i*10)/10:Math[s](i);let a=o.toString();return typeof n.decimal=="string"&&(a=a.replace(".",n.decimal)),a};function Ii(e,t={}){let n;const i=e<0;i&&(e=Math.abs(e)),t.precision&&(e=parseFloat(e.toPrecision(t.precision)));const s=t.min10k?bS:ud;return e<s||t.precision&&t.precision>Math.log10(e)?n=Ri(Ln(e,1,t),t):e<dd?n=`${Ln(e,ud,t)}k`:e<hd?n=`${Ln(e,dd,t)}m`:e<fd?n=`${Ri(Ln(e,hd,t),t)}b`:n=`${Ri(Ln(e,fd,t),t)}t`,i&&(n=`-${n}`),t.capital&&(n=n.toUpperCase()),t.prefix&&(n=`${t.prefix}${n}`),t.suffix&&(n=`${n}${t.suffix}`),n}Ii.addCommas=Ri;function _S(e,t,n){const{i18n:i}=q.useI18n(),{formatBytes:s}=le({i18n:i}),{translateUnit:o}=q.useTranslatedUnits();return{legendValues:u.computed(()=>e.value.datasets.reduce((r,l)=>{const c=l.total?l.total:l.data.reduce((f,m)=>f+(typeof m=="number"?Number(m)||0:Number(m&&m.y)||0),0);let d;const h=l.unit??n.value;if(h==="bytes")d=s(c);else{const f=o(h,c);d=i&&i.t("legend.datapointValueDisplay",{value:Ii(c,{capital:!0}),unit:f})||`${Ii(c,{capital:!0})} ${h}`}return{...r,[l.label]:{raw:c,formatted:d,isThreshold:l.isThreshold}}},{}))}}function xS(e){const n=`donutChartTooltipPosition-${e.tooltipState.chartID}`,i={enabled:!1,position:n,callbacks:{label:o=>({label:o.dataset.label,value:o.label})}};Yt.positioners[n]=function(o,a){if(!o.length||a.x===null||a.y===null)return!1;const r=this.chart.canvas.getBoundingClientRect(),l=e.tooltipState.width||this.width,c=r.width/2,d=js(a,l,c),h=a.y,f=a.x<c?"left":"center";return{x:d-e.tooltipState.offsetX,y:h,xAlign:f}};const s=u.computed(()=>({cutout:"65%",responsive:!0,maintainAspectRatio:!1,plugins:{htmlLegend:{containerID:e.legendID},legend:{display:!1},tooltip:{...i,external:o=>{Dd(e.tooltipState,o)}}},layout:{padding:{left:0,right:0,top:5,bottom:0}}}));return u.onUnmounted(()=>{Yt.positioners[n]&&delete Yt.positioners[n]}),{options:s}}function wS(e){const t=u.computed(()=>({type:"timeseries",display:!0,grid:{display:!0,drawOnChartArea:!1,drawTicks:!0,drawBorder:!1},ticks:{padding:0,autoSkipPadding:10,source:"auto",maxRotation:0,callback:d=>{const h=new Date(d);return qa({tickValue:h,granularity:e.granularity.value,dayBoundaryCrossed:l.value})}},title:{display:!1},border:{display:!1},stacked:e.stacked.value})),n=u.computed(()=>!!e.rightYAxis?.value),i=u.computed(()=>({title:{display:!Z(e.metricAxesTitle?.value),text:e.metricAxesTitle?.value,padding:{bottom:3},font:{weight:"bold"}},ticks:{maxTicksLimit:5},grid:{drawBorder:!1,...e.leftYAxisGrid?.value===!1?{drawOnChartArea:!1}:{}},id:"main-y-axis",beginAtZero:!0,border:{display:!1},stacked:e.stacked.value,...n.value?{display:"auto"}:{}})),s=u.computed(()=>{const d=e.rightYAxis?.value;if(d)return{display:"auto",position:"right",title:{display:!Z(d.title),text:d.title,padding:{bottom:3},font:{weight:"bold"}},ticks:{maxTicksLimit:5},grid:{drawBorder:!1,drawOnChartArea:d.showGrid??!1},beginAtZero:!0,border:{display:!1},stacked:e.stacked.value}}),a=`lineChartTooltipPosition-${e.tooltipState.chartID}`,r={enabled:!1,position:a};Yt.positioners[a]=function(d,h){if(!d.length||e.tooltipState.interactionMode==="interactive"||h.x===null||h.y===null)return!1;const f=this.chart.canvas.getBoundingClientRect(),m=e.tooltipState.width||this.width,p=e.tooltipState.height||this.height,g=f.width/2,y=f.height/2,_=js(h,m,g);let x=Cd(h,p,y);const T=h.y<y?"top":"bottom",v=h.x<g?"left":"center";return p>f.height&&(x=0),{x:_,y:x,xAlign:v,yAlign:T}};const l=u.computed(()=>{const d=Number(e.timeRangeMs.value),h=new Date,f=new Date(h.getTime()-d);return Ul(d)>24||f.getDate()!==h.getDate()}),c=u.computed(()=>({hover:{mode:"index",intersect:!1},elements:{point:{radius:e.pointsWithoutHover?.value?3:0,hitRadius:4,hoverRadius:4}},animation:{duration:250,easing:"linear"},scales:{x:t.value,y:i.value,...s.value?{[La]:s.value}:{}},responsive:!0,maintainAspectRatio:!1,plugins:{htmlLegend:{containerID:e.legendID},legend:{display:!1},streaming:!1,tooltip:{...r,external:d=>{Ra(e.tooltipState,d,e.granularity.value)}},thresholdPlugin:{threshold:e.threshold?.value}},interaction:{mode:"index",intersect:!1},layout:{padding:{left:0,right:0,top:0,bottom:0}}}));return u.onUnmounted(()=>{Yt.positioners[a]&&delete Yt.positioners[a]}),{options:c}}const kS=["usd","bytes"],TS="usd";function SS(e){const{i18n:t}=q.useI18n(),{formatUnit:n}=le({i18n:t}),i=(m,p)=>!p||!kS.includes(p)?m:m===0&&p===TS?t.formatNumber(0,{style:"currency",currency:"USD"}):n(m,p),s=u.computed(()=>{const m=Number(e.timeRangeMs.value),p=new Date,g=new Date(p.getTime()-m);return Ul(m)>24||g.getDate()!==p.getDate()}),o=u.computed(()=>({display:!Z(e.dimensionAxesTitle?.value),text:e.dimensionAxesTitle?.value,padding:{top:3},font:{weight:"bold"}})),a=u.computed(()=>({type:"linear",display:!0,beginAtZero:!0,grid:{display:!0,drawOnChartArea:!1,drawTicks:!0,drawBorder:!1},ticks:{maxRotation:0,maxTicksLimit:7,callback:m=>i(m,e.xMetricUnit?.value)},title:o.value,border:{display:!1}})),r=u.computed(()=>({type:"time",display:!0,grid:{display:!0,drawOnChartArea:!1,drawTicks:!0,drawBorder:!1},ticks:{padding:0,autoSkipPadding:100,source:"auto",maxRotation:0,callback:m=>qa({tickValue:new Date(m),granularity:e.granularity.value,dayBoundaryCrossed:s.value})},title:{display:!1},border:{display:!1}})),l=u.computed(()=>({title:{display:!Z(e.metricAxesTitle?.value),text:e.metricAxesTitle?.value,padding:{bottom:3},font:{weight:"bold"}},ticks:{maxTicksLimit:5,callback:m=>i(m,e.metricUnit?.value)},grid:{drawBorder:!1},id:"main-y-axis",beginAtZero:!0,border:{display:!1}})),c=(m,p,g)=>{const y=g?.timestamp;return y===void 0?"":Un({tickValue:new Date(y),granularity:p})},h=`scatterChartTooltipPosition-${e.tooltipState.chartID}`;Yt.positioners[h]=function(m,p){if(!m.length||e.tooltipState.interactionMode==="interactive"||p.x===null||p.y===null)return!1;const g=this.chart.canvas.getBoundingClientRect(),y=e.tooltipState.width||this.width,_=e.tooltipState.height||this.height,x=g.width/2,T=g.height/2,v=js(p,y,x);let w=Cd(p,_,T);const D=p.y<T?"top":"bottom",S=p.x<x?"left":"center";return _>g.height&&(w=0),{x:v,y:w,xAlign:S,yAlign:D}};const f=u.computed(()=>({hover:{mode:"nearest",intersect:!1},interaction:{mode:"point",intersect:!1},animation:{duration:250,easing:"linear"},scales:{x:e.xMetric?.value?a.value:r.value,y:l.value},responsive:!0,maintainAspectRatio:!1,plugins:{htmlLegend:{containerID:e.legendID},legend:{display:!1},streaming:!1,tooltip:{enabled:!1,position:h,external:m=>{Ra(e.tooltipState,m,e.granularity.value,{...e.xMetric?.value?{contextFormatter:c}:{}})}},outlierBandPlugin:{value:e.outlierValue?.value,color:e.themeColors.value.outlierBand},referenceLinePlugin:{lines:e.referenceLines?.value}},layout:{padding:{left:0,right:0,top:0,bottom:0}}}));return u.onUnmounted(()=>{Yt.positioners[h]&&delete Yt.positioners[h]}),{options:f}}const vS=e=>{const t=e.length;let n=5381;for(let i=0;i<t;i++)n=n*33^e.charCodeAt(i);return n>>>0},MS="#0044f4",md="#6c7489",DS="#d60027",CS="#ffc400",OS="#bee2ff",AS="#8fc1ff",PS="#5f9aff",ES="#306fff",RS="#b5ffee",IS="#00fabe",LS="#00d6a4",NS="#00a17b",BS="#007d60",FS="#005944",zS="#b5ffee",US="#00fabe",VS="#b5ffee",HS="#00a17b",$S="#fff296",YS="#ffe04b",WS="#ffc400",jS="#b37600",qS="#995c00",GS="#804400",XS="#fff296",KS="#ffe04b",ZS="#ffc2b3",QS="#ff9877",JS="#ff723c",tv="#f75008",ev="#d13500",nv="#a31f00",iv="#ffc2b3",sv="#ff9877",ov="#ff723c",av="#f75008",rv="#d13500",lv="#a31f00",cv="#ffc2b3",uv="#ff9877",dv="#ff723c",hv="#f75008",fv="#d13500",mv="#a31f00",pv="#ffc2b3",gv="#ff9877",yv="#ff723c",bv="#f75008",_v="#d13500",xv="#a31f00",wv="#ffc2b3",kv="#ff9877",Tv="#ff723c",Sv="#f75008",vv="#d13500",Mv="#ffabab",Dv="#ff7272",Cv="#ff3954",Ov="#f50045",Av="#d60027",Pv="#ad000e",Ev="#ffabab",Rv="#ff7272",Iv="#ff3954",Lv="#f50045",Nv="#d60027",Bv="#eefaff",Fv="#ecfffb",zv="#fffce0",Uv="#fff1ef",Vv="#ffe5e5",Hv="#5f9aff",$v="#00d6a4",Yv="#ffc400",Wv="#ff723c",jv="#ff3954",qv={100:OS,101:AS,102:PS,103:ES,200:RS,201:IS,202:LS,203:NS,204:BS,205:FS,206:zS,207:US,208:VS,226:HS,300:$S,301:YS,302:WS,303:jS,304:qS,305:GS,307:XS,308:KS,400:ZS,401:QS,402:JS,403:tv,404:ev,405:nv,406:iv,407:sv,408:ov,409:av,410:rv,411:lv,412:cv,413:uv,414:dv,415:hv,416:fv,417:mv,418:pv,421:gv,422:yv,423:bv,424:_v,425:xv,426:wv,428:kv,429:Tv,431:Sv,451:vv,500:Mv,501:Dv,502:Cv,503:Ov,504:Av,505:Pv,506:Ev,507:Rv,508:Iv,510:Lv,511:Nv},Gv={100:Bv,200:Fv,300:zv,400:Uv,500:Vv},pd={"1XX":Hv,"2XX":$v,"3XX":Yv,"4XX":Wv,"5XX":jv},Xv={error:DS,warning:CS,empty:"#9DA99D",neutral:md,____OTHER____:MS},gd=["#0076F4","#00819D","#00A17B","#8A50FF","#FF3C99","#FF6D3C","#B3A100"],yd=["#5485BA","#087D96","#3D8776","#7654BA","#A1406F","#BF5430","#B5A72C"],Kv=e=>vS(e),bd=({discriminator:e,theme:t="light"})=>{const n=Math.abs(Math.floor(e));return t==="dark"?yd[n%yd.length]:gd[n%gd.length]},Li=({state:e})=>Xv[e]??md,Zv=({statusCode:e})=>{const t=typeof e=="number"?e:Number.parseInt(e,10),n=`${t}`,i=`${Math.floor(t/100)*100}`;return qv[n]??Gv[i]??Li({state:"neutral"})},Qv=({group:e})=>pd[e]?pd[e]:Li({state:"neutral"}),pe=({discriminator:e=void 0,state:t=void 0,dimension:n=void 0,dimensionValue:i=void 0,metric:s=void 0,coordinator:o=void 0,order:a=void 0,chartUuid:r=void 0,customDimensionColors:l=void 0})=>{let c="light";if(u.hasInjectionContext()&&(c=u.inject("app:konnectColorMode",u.computed(()=>"light")).value),t!==void 0)return Li({state:t});if(i!==void 0&&l!==void 0&&l[i])return l[i];if(i&&["empty","____OTHER____"].includes(i))return Li({state:i});if(n!==void 0&&i!==void 0){if(n==="status_code")return Zv({statusCode:i});if(n==="status_code_grouped")return Qv({group:i})}if(e!==void 0)return bd({discriminator:e,theme:c});if(n||i||s){const d=`${n??""}${i??""}${s??""}`,h=o?o.resolveDiscriminator({name:d,order:a,chartUuid:r,theme:c}):Kv(d);return bd({discriminator:h,theme:c})}return Li({state:"neutral"})};function Jv({barSegmentLabels:e,coordinator:t=void 0,customColors:n=void 0,hasDimensions:i=void 0,isMultiMetric:s=void 0,metricNames:o,pivotRecords:a,rowLabels:r,seriesDimension:l=void 0,uuid:c}){const d=q.useFieldLabel();if(s)return o.map((f,m)=>({label:d(f),backgroundColor:pe({discriminator:m}),data:r.map((p,g)=>i?a[`${p.id},${f}`]||0:a[`${g},${f}`]||null)}));const h=n&&!Array.isArray(n)?n:void 0;return Array.from(e).flatMap((f,m)=>f?{dimension:l,dimensionValue:f.id,label:d(f.name),backgroundColor:pe({...!t?.color&&{discriminator:m},dimension:l,dimensionValue:f.id,coordinator:t?.color,order:m,chartUuid:c,customDimensionColors:h}),data:r.map(p=>a[`${p.id},${f.id}`]||null),isSegmentEmpty:f.id==="empty"}:[])}function tM(e,t,n,i){const s=q.useFieldLabel();return u.computed(()=>{try{if(t.value&&"meta"in t.value&&"data"in t.value){const a=t.value.data,{display:r,metric_names:l}=t.value.meta,c=r&&Object.keys(r),d=l&&l.length>1,h=r&&c&&c.length>0,f=h&&c.length>1;if(!a.length||!l)return{datasets:[],labels:[]};const m=h&&c||l,p=m[0],g=m.length>1?m[1]:m[0],y=Object.fromEntries(d?a.flatMap(k=>l.map((C,z)=>{const N=k.event[p],V=h?`${N},${C}`:`${z},${C}`,Y=k.event[C];return[V,Y]})):a.map(k=>{const C=h?`${k.event[p]},${k.event[g]}`:`${p},${g}`,z=k.event[l[0]];return[C,z]})),_=Object.keys(y).reduce((k,C)=>{const[z]=C.split(","),N=y[C];return k[z]?k[z]+=N:k[z]=N,k},{}),x=Object.entries(_).sort(([,k],[,C])=>Number(C)-Number(k)).map(([k])=>k),T=r[p],v=r[g];let w=h&&T&&Object.entries(T).map(([k,C])=>({id:k,name:C.name}))||l.map(k=>({id:k,name:k})),D=h&&v&&Object.entries(v).map(([k,C])=>({id:k,name:C.name}))||l.map(k=>({id:k,name:k}));if(h&&p==="country_code"&&(w=w.map(k=>({...k,name:Co(k.id)||k.name}))),h&&g==="country_code"&&(D=D.map(k=>({...k,name:Co(k.id)||k.name}))),p!=="status_code"&&p!=="status_code_grouped"&&(w.sort((k,C)=>x.indexOf(k.id)-x.indexOf(C.id)),D.sort((k,C)=>x.indexOf(k.id)-x.indexOf(C.id))),!w||!D)return{labels:[],datasets:[]};const S=Jv({barSegmentLabels:D,coordinator:i,customColors:e.colorPalette,hasDimensions:h,isMultiMetric:d,metricNames:l,pivotRecords:y,rowLabels:w,seriesDimension:g,uuid:n}),A=h?w.map(k=>s(k.name)):l.map(k=>s(k)),R=w.map(k=>k.id==="empty");return{labels:A,datasets:S,isLabelEmpty:R,isMultiDimension:f}}}catch(a){return console.error(a),{datasets:[],labels:[]}}return{labels:[],datasets:[]}})}const eM=(e,t,n=1)=>Array(Math.ceil((t-e)/n)).fill(e).map((i,s)=>i+s*n),nM=e=>{if(typeof e=="string"){const t=+e;if(t)return t;try{return Vl(e).getTime()}catch(n){if(n instanceof RangeError)return 0;throw n}}return e},iM=(e,t,n,i,s)=>{const a=Math.max(t-6e4,Math.max(...(s||[]).map(c=>new Date(c.timestamp).valueOf()))),r=Math.floor((e-i)/n)*n+i,l=Math.floor((a-i)/n)*n+i+n;return eM(r,l,n)};function sM(e,t,n,i){const s=q.useFieldLabel();return u.computed(()=>{try{if(t.value&&"meta"in t.value&&"data"in t.value){const a=t.value.data,{display:r,metric_names:l,metric_units:c,start:d,end:h}=t.value.meta,f=new Date(d).getTime(),m=new Date(h).getTime();if(!l)return console.error("Cannot build chart data from this explore result. Missing metric names."),{datasets:[]};const p=r&&Object.keys(r)||l,g=p&&p[0],y=r?.[g],_=!!y&&l.length>1;let x=r&&y&&Object.keys(y).map(C=>({id:C,name:y[C].name}))||l.map(C=>({id:C,name:C}));g==="country_code"&&(x=x.map(C=>({...C,name:Co(C.id)||C.name})));const T=t.value.meta.granularity_ms;if(typeof T!="number"||isNaN(T)||!isFinite(T)||T===0)return console.error("Invalid step value:",T),{datasets:[],labels:[]};if(!a.length)return{datasets:[],labels:[]};const v=nM(f),w=iM(f,m,T,v,a),D=!p.length,S=a?.length?a.reduce((C,z)=>{const N=new Date(z.timestamp).valueOf(),V=z.event;for(const Y of l)N in C||(C[N]={}),Y in C[N]||(C[N][Y]={});for(const Y of l)x.forEach(G=>{(y?V[g]===G.id:Y===G.id)?(C[N][Y]||(C[N][Y]={}),C[N][Y][G.id]=Math.round(Number(V[Y])*1e3)/1e3):D&&(C[N][Y]||(C[N][Y]={}),C[N][Y][G.id]=Math.round(Number(V[G.id])*1e3)/1e3)});return C},{}):{},A=y||l.length===1?l.flatMap(C=>x.map(z=>[C,z.id,z.name,z.id==="empty"])):x.map(C=>[C.name,C.id,C.name,C.id==="empty"]),R=e.colorPalette&&!Array.isArray(e.colorPalette)?e.colorPalette:void 0,E=D||!i?.color,k=[...A].map(([C,z,N,V],Y)=>{const G=w.map(P=>P in S&&C in S[P]?{x:P,y:S[P][C][z]||0}:{x:P,y:0}),st=pe({...E===!0&&{discriminator:Y},dimension:g,dimensionValue:z,coordinator:i?.color,order:Y,chartUuid:n,customDimensionColors:R}),ot=s(N),K=s(C),U=l.findIndex(P=>P===C),M=e.metricAxisMap?.[C]==="right";return{dimension:g,dimensionValue:z,rawDimension:N,rawMetric:C,label:_?`${ot} — ${K}`:ot,borderColor:st,backgroundColor:st,data:G,total:G.reduce((P,{y:F})=>P+Number(F),0),...$M,..._?{borderDash:U===0?[]:[U*4,2]}:{},...!_&&M?{borderDash:[4,2]}:{},...M?{yAxisID:La}:{},...e.metricAxisMap?{unit:c?.[C]??""}:{},fill:e.fill,borderWidth:e.fill?WM:YM,isSegmentEmpty:V}});return g==="status_code"||g==="status_code_grouped"?k.sort((C,z)=>(C.label??"")<(z.label??"")?-1:1):k.sort((C,z)=>Number(C.total)<Number(z.total)?-1:1),{datasets:k}}}catch(a){return console.error(a),{labels:[],datasets:[]}}return{labels:[],datasets:[]}})}const oM=3,aM=.6,_d=2,rM=2,xd=50,lM=[6,4],cM=[2,3],uM=(e,t)=>{const n=Math.sin(t)*1e4;return(n-Math.floor(n))*e};function dM(e,t,n,i){const{i18n:s}=q.useI18n(),o=q.useFieldLabel(),a=(r,l)=>l||(r===xd?s.t("scatter.median"):s.t("scatter.percentile",{value:r}));return u.computed(()=>{try{const r=t.value;if(!r?.points?.length)return{datasets:[]};const{metric:l,dimension:c,display:d,xMetric:h,xMetricUnit:f}=r,m=h?o(h):"",p=e.scatter||{},g=p.jitterMs??0,y=p.pointRadius??oM,_=p.pointOpacity??aM,x=new Map,T=[];r.points.forEach(N=>{const V=N.group??l,Y=x.get(V)||[];let G,st;N.x!==void 0?(G={x:N.x,timestamp:N.timestamp},st=[{label:m,value:N.x,...f?{unit:f}:{}},...N.extras??[]]):(G={x:N.timestamp+uM(g,N.timestamp+N.value)},st=N.extras??[]),Y.push({...G,y:N.value,...st.length?{extras:st}:{}}),x.set(V,Y),T.push(N.value)});const v=p.percentileLines||[],w=[...v.map(N=>N.percentile),...p.outlierPercentile!==void 0?[p.outlierPercentile]:[]],D=w.length?N1(T,w):new Map,S=p.outlierPercentile!==void 0?D.get(p.outlierPercentile):void 0,A=S!==void 0&&Number.isFinite(S),R=e.themeColors?.value??Xa(),E=[],k=N=>{const V=N?.y;return A&&Number.isFinite(V)&&V>S},C=e.colorPalette&&!Array.isArray(e.colorPalette)?e.colorPalette:void 0;Array.from(x.entries()).forEach(([N,V],Y)=>{const G=c&&d?.[N]?.name||N,st=N==="empty",ot=pe({...!i?.color&&{discriminator:Y},dimension:c,dimensionValue:N,coordinator:i?.color,order:Y,chartUuid:n,customDimensionColors:C}),K=Ga(ot,_),U=o(G);E.push({dimension:c,dimensionValue:N,type:"scatter",rawDimension:G,rawMetric:l,label:U,borderColor:M=>k(M.raw)?R.outlier:ot,backgroundColor:M=>k(M.raw)?R.outlier:K,pointRadius:M=>k(M.raw)?y+_d:y,pointHoverRadius:M=>(k(M.raw)?y+_d:y)+rM,data:V,pointBorderWidth:0,showLine:!1,isSegmentEmpty:st})});const z=[];return v.forEach(N=>{const V=D.get(N.percentile);if(V===void 0||!Number.isFinite(V))return;const Y=N.percentile===xd;z.push({percentile:N.percentile,label:a(N.percentile,N.label),value:V,color:N.color||(Y?R.medianLine:R.outlier),borderDash:N.borderDash||(Y?lM:cM)})}),{datasets:E,...A?{outlier:{value:S,label:s.t("scatter.outlier",{label:a(p.outlierPercentile)}),color:R.outlier}}:{},...z.length?{referenceLines:z}:{}}}catch(r){return console.warn(r),{datasets:[]}}})}const hM=(e,t)=>{u.watch([e,t],(n,i,s)=>{const[o,a]=n;!a||!window||(window._AnalyticsChartDataInternal||(window._AnalyticsChartDataInternal=new Map),window._AnalyticsChartDataInternal.set(a,o),s(()=>{window._AnalyticsChartDataInternal?.delete(a)}))},{immediate:!0})};function fM(){const{i18n:e}=q.useI18n();return{translateUnit:(n,i)=>{const s=i===1,o=`chartUnits.${n}`;return zi(n)?"":e.te(o)?e.t(o,{plural:s?"":"s"}):n}}}function mM(){const e=u.inject(Mf);return{evaluateFeatureFlag:(n,i)=>typeof e?.evaluateFeatureFlagFn!="function"?i:e.evaluateFeatureFlagFn(n,i)}}function wd(e,t){return u.getCurrentScope()?(u.onScopeDispose(e,t),!0):!1}const kd=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const pM=e=>e!=null,gM=Object.prototype.toString,yM=e=>gM.call(e)==="[object Object]";function Hs(e){return Array.isArray(e)?e:[e]}function bM(e){return u.getCurrentInstance()}function _M(e,t={}){if(!u.isRef(e))return u.toRefs(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)n[i]=u.customRef(()=>({get(){return e.value[i]},set(s){var o;if(!((o=u.toValue(t.replaceRef))!==null&&o!==void 0)||o)if(Array.isArray(e.value)){const a=[...e.value];a[i]=s,e.value=a}else{const a={...e.value,[i]:s};Object.setPrototypeOf(a,Object.getPrototypeOf(e.value)),e.value=a}else e.value[i]=s}}));return n}function xM(e,t=!0,n){bM()?u.onMounted(e,n):t?e():u.nextTick(e)}function wM(e,t,n){return u.watch(e,t,{...n,immediate:!0})}const $s=kd?window:void 0;function Nn(e){var t;const n=u.toValue(e);return(t=n?.$el)!==null&&t!==void 0?t:n}function Ni(...e){const t=(i,s,o,a)=>(i.addEventListener(s,o,a),()=>i.removeEventListener(s,o,a)),n=u.computed(()=>{const i=Hs(u.toValue(e[0])).filter(s=>s!=null);return i.every(s=>typeof s!="string")?i:void 0});return wM(()=>{var i,s;return[(i=(s=n.value)===null||s===void 0?void 0:s.map(o=>Nn(o)))!==null&&i!==void 0?i:[$s].filter(o=>o!=null),Hs(u.toValue(n.value?e[1]:e[0])),Hs(u.unref(n.value?e[2]:e[1])),u.toValue(n.value?e[3]:e[2])]},([i,s,o,a],r,l)=>{if(!i?.length||!s?.length||!o?.length)return;const c=yM(a)?{...a}:a,d=i.flatMap(h=>s.flatMap(f=>o.map(m=>t(h,f,m,c))));l(()=>{d.forEach(h=>h())})},{flush:"post"})}function kM(){const e=u.shallowRef(!1),t=u.getCurrentInstance();return t&&u.onMounted(()=>{e.value=!0},t),e}function Td(e){const t=kM();return u.computed(()=>(t.value,!!e()))}function TM(e,t,n={}){const{window:i=$s,...s}=n;let o;const a=Td(()=>i&&"MutationObserver"in i),r=()=>{o&&(o.disconnect(),o=void 0)},l=u.watch(u.computed(()=>{const h=Hs(u.toValue(e)).map(Nn).filter(pM);return new Set(h)}),h=>{r(),a.value&&h.size&&(o=new MutationObserver(t),h.forEach(f=>o.observe(f,s)))},{immediate:!0,flush:"post"}),c=()=>o?.takeRecords(),d=()=>{l(),r()};return wd(d),{isSupported:a,stop:d,takeRecords:c}}const Ys={speed:2,margin:30,direction:"both"};function SM(e){e.scrollLeft>e.scrollWidth-e.clientWidth&&(e.scrollLeft=Math.max(0,e.scrollWidth-e.clientWidth)),e.scrollTop>e.scrollHeight-e.clientHeight&&(e.scrollTop=Math.max(0,e.scrollHeight-e.clientHeight))}function vM(e,t={}){var n,i,s,o;const{pointerTypes:a,preventDefault:r,stopPropagation:l,exact:c,onMove:d,onEnd:h,onStart:f,initialValue:m,axis:p="both",draggingElement:g=$s,containerElement:y,handle:_=e,buttons:x=[0],restrictInView:T,autoScroll:v=!1}=t,w=u.ref((n=u.toValue(m))!==null&&n!==void 0?n:{x:0,y:0}),D=u.ref(),S=U=>a?a.includes(U.pointerType):!0,A=U=>{u.toValue(r)&&U.preventDefault(),u.toValue(l)&&U.stopPropagation()},R=u.toValue(v),E=typeof R=="object"?{speed:(i=u.toValue(R.speed))!==null&&i!==void 0?i:Ys.speed,margin:(s=u.toValue(R.margin))!==null&&s!==void 0?s:Ys.margin,direction:(o=R.direction)!==null&&o!==void 0?o:Ys.direction}:Ys,k=U=>typeof U=="number"?[U,U]:[U.x,U.y],C=(U,M,P)=>{const{clientWidth:F,clientHeight:$,scrollLeft:it,scrollTop:L,scrollWidth:H,scrollHeight:pt}=U,[ut,rt]=k(E.margin),[Dt,Wt]=k(E.speed);let Lt=0,kt=0;(E.direction==="x"||E.direction==="both")&&(P.x<ut&&it>0?Lt=-Dt:P.x+M.width>F-ut&&it<H-F&&(Lt=Dt)),(E.direction==="y"||E.direction==="both")&&(P.y<rt&&L>0?kt=-Wt:P.y+M.height>$-rt&&L<pt-$&&(kt=Wt)),(Lt||kt)&&U.scrollBy({left:Lt,top:kt,behavior:"auto"})};let z=null;const N=()=>{const U=u.toValue(y);U&&!z&&(z=setInterval(()=>{const M=u.toValue(e).getBoundingClientRect(),{x:P,y:F}=w.value,$={x:P-U.scrollLeft,y:F-U.scrollTop};$.x>=0&&$.y>=0&&(C(U,M,$),$.x+=U.scrollLeft,$.y+=U.scrollTop,w.value=$)},1e3/60))},V=()=>{z&&(clearInterval(z),z=null)},Y=(U,M,P,F)=>{const[$,it]=typeof P=="number"?[P,P]:[P.x,P.y],{clientWidth:L,clientHeight:H}=M;return U.x<$||U.x+F.width>L-$||U.y<it||U.y+F.height>H-it},G=()=>{if(u.toValue(t.disabled)||!D.value)return;const U=u.toValue(y);if(!U)return;const M=u.toValue(e).getBoundingClientRect(),{x:P,y:F}=w.value,$={x:P-U.scrollLeft,y:F-U.scrollTop};Y($,U,E.margin,M)?N():V()};u.toValue(v)&&u.watch(w,G);const st=U=>{var M;if(!u.toValue(x).includes(U.button)||u.toValue(t.disabled)||!S(U)||u.toValue(c)&&U.target!==u.toValue(e))return;const P=u.toValue(y),F=P==null||(M=P.getBoundingClientRect)===null||M===void 0?void 0:M.call(P),$=u.toValue(e).getBoundingClientRect(),it={x:U.clientX-(P?$.left-F.left+(v?0:P.scrollLeft):$.left),y:U.clientY-(P?$.top-F.top+(v?0:P.scrollTop):$.top)};f?.(it,U)!==!1&&(D.value=it,A(U))},ot=U=>{if(u.toValue(t.disabled)||!S(U)||!D.value)return;const M=u.toValue(y);M instanceof HTMLElement&&SM(M);const P=u.toValue(e).getBoundingClientRect();let{x:F,y:$}=w.value;if((p==="x"||p==="both")&&(F=U.clientX-D.value.x,M&&(F=Math.min(Math.max(0,F),M.scrollWidth-P.width))),(p==="y"||p==="both")&&($=U.clientY-D.value.y,M&&($=Math.min(Math.max(0,$),M.scrollHeight-P.height))),u.toValue(v)&&M&&(z===null&&C(M,P,{x:F,y:$}),F+=M.scrollLeft,$+=M.scrollTop),M&&(T||v)){if(p!=="y"){const it=F-M.scrollLeft;it<0?F=M.scrollLeft:it>M.clientWidth-P.width&&(F=M.clientWidth-P.width+M.scrollLeft)}if(p!=="x"){const it=$-M.scrollTop;it<0?$=M.scrollTop:it>M.clientHeight-P.height&&($=M.clientHeight-P.height+M.scrollTop)}}w.value={x:F,y:$},d?.(w.value,U),A(U)},K=U=>{u.toValue(t.disabled)||!S(U)||D.value&&(D.value=void 0,v&&V(),h?.(w.value,U),A(U))};if(kd){const U=()=>{var M;return{capture:(M=t.capture)!==null&&M!==void 0?M:!0,passive:!u.toValue(r)}};Ni(_,"pointerdown",st,U),Ni(g,"pointermove",ot,U),Ni(g,["pointerup","pointercancel"],K,U)}return{..._M(w),position:w,isDragging:u.computed(()=>!!D.value),style:u.computed(()=>`
3
+ `):e}function IT(e,t){const{element:n,datasetIndex:i,index:s}=t,o=e.getDatasetMeta(i).controller,{label:a,value:r}=o.getLabelAndValue(s);return{chart:e,label:a,parsed:o.getParsed(s),raw:e.data.datasets[i].data[s],formattedValue:r,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:n}}function jd(e,t){const n=e.chart.ctx,{body:i,footer:s,title:o}=e,{boxWidth:a,boxHeight:r}=t,l=xt(t.bodyFont),c=xt(t.titleFont),u=xt(t.footerFont),h=o.length,f=s.length,m=i.length,p=Pt(t.padding);let g=p.height,y=0,_=i.reduce((S,w)=>S+w.before.length+w.lines.length+w.after.length,0);if(_+=e.beforeBody.length+e.afterBody.length,h&&(g+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),_){const S=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;g+=m*S+(_-m)*l.lineHeight+(_-1)*t.bodySpacing}f&&(g+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let x=0;const T=function(S){y=Math.max(y,n.measureText(S).width+x)};return n.save(),n.font=c.string,mt(e.title,T),n.font=l.string,mt(e.beforeBody.concat(e.afterBody),T),x=t.displayColors?a+2+t.boxPadding:0,mt(i,S=>{mt(S.before,T),mt(S.lines,T),mt(S.after,T)}),x=0,n.font=u.string,mt(e.footer,T),n.restore(),y+=p.width,{width:y,height:g}}function LT(e,t){const{y:n,height:i}=t;return n<i/2?"top":n>e.height-i/2?"bottom":"center"}function NT(e,t,n,i){const{x:s,width:o}=i,a=n.caretSize+n.caretPadding;if(e==="left"&&s+o+a>t.width||e==="right"&&s-o-a<0)return!0}function BT(e,t,n,i){const{x:s,width:o}=n,{width:a,chartArea:{left:r,right:l}}=e;let c="center";return i==="center"?c=s<=(r+l)/2?"left":"right":s<=o/2?c="left":s>=a-o/2&&(c="right"),NT(c,e,t,n)&&(c="center"),c}function qd(e,t,n){const i=n.yAlign||t.yAlign||LT(e,n);return{xAlign:n.xAlign||t.xAlign||BT(e,t,n,i),yAlign:i}}function FT(e,t){let{x:n,width:i}=e;return t==="right"?n-=i:t==="center"&&(n-=i/2),n}function zT(e,t,n){let{y:i,height:s}=e;return t==="top"?i+=n:t==="bottom"?i-=s+n:i-=s/2,i}function Gd(e,t,n,i){const{caretSize:s,caretPadding:o,cornerRadius:a}=e,{xAlign:r,yAlign:l}=n,c=s+o,{topLeft:u,topRight:h,bottomLeft:f,bottomRight:m}=Ne(a);let p=FT(t,r);const g=zT(t,l,c);return l==="center"?r==="left"?p+=c:r==="right"&&(p-=c):r==="left"?p-=Math.max(u,f)+s:r==="right"&&(p+=Math.max(h,m)+s),{x:It(p,0,i.width-t.width),y:It(g,0,i.height-t.height)}}function Fs(e,t,n){const i=Pt(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-i.right:e.x+i.left}function Xd(e){return me([],ve(e))}function UT(e,t,n){return Be(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Kd(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const Zd={beforeTitle:_e,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,i=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return n[t.dataIndex]}return""},afterTitle:_e,beforeBody:_e,beforeLabel:_e,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return Z(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:_e,afterBody:_e,beforeFooter:_e,footer:_e,afterFooter:_e};function Qt(e,t,n,i){const s=e[t].call(n,i);return typeof s>"u"?Zd[t].call(n,i):s}class Qd extends $t{static positioners=Pi;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&n.options.animation&&i.animations,o=new ca(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=UT(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:i}=n,s=Qt(i,"beforeTitle",this,t),o=Qt(i,"title",this,t),a=Qt(i,"afterTitle",this,t);let r=[];return r=me(r,ve(s)),r=me(r,ve(o)),r=me(r,ve(a)),r}getBeforeBody(t,n){return Xd(Qt(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:i}=n,s=[];return mt(t,o=>{const a={before:[],lines:[],after:[]},r=Kd(i,o);me(a.before,ve(Qt(r,"beforeLabel",this,o))),me(a.lines,Qt(r,"label",this,o)),me(a.after,ve(Qt(r,"afterLabel",this,o))),s.push(a)}),s}getAfterBody(t,n){return Xd(Qt(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:i}=n,s=Qt(i,"beforeFooter",this,t),o=Qt(i,"footer",this,t),a=Qt(i,"afterFooter",this,t);let r=[];return r=me(r,ve(s)),r=me(r,ve(o)),r=me(r,ve(a)),r}_createItems(t){const n=this._active,i=this.chart.data,s=[],o=[],a=[];let r=[],l,c;for(l=0,c=n.length;l<c;++l)r.push(IT(this.chart,n[l]));return t.filter&&(r=r.filter((u,h,f)=>t.filter(u,h,f,i))),t.itemSort&&(r=r.sort((u,h)=>t.itemSort(u,h,i))),mt(r,u=>{const h=Kd(t.callbacks,u);s.push(Qt(h,"labelColor",this,u)),o.push(Qt(h,"labelPointStyle",this,u)),a.push(Qt(h,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,n){const i=this.options.setContext(this.getContext()),s=this._active;let o,a=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{const r=Pi[i.position].call(this,s,this._eventPosition);a=this._createItems(i),this.title=this.getTitle(a,i),this.beforeBody=this.getBeforeBody(a,i),this.body=this.getBody(a,i),this.afterBody=this.getAfterBody(a,i),this.footer=this.getFooter(a,i);const l=this._size=jd(this,i),c=Object.assign({},r,l),u=qd(this.chart,i,c),h=Gd(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:h.x,y:h.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,i,s){const o=this.getCaretPosition(t,i,s);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,i){const{xAlign:s,yAlign:o}=this,{caretSize:a,cornerRadius:r}=i,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:h}=Ne(r),{x:f,y:m}=t,{width:p,height:g}=n;let y,_,x,T,S,w;return o==="center"?(S=m+g/2,s==="left"?(y=f,_=y-a,T=S+a,w=S-a):(y=f+p,_=y+a,T=S-a,w=S+a),x=y):(s==="left"?_=f+Math.max(l,u)+a:s==="right"?_=f+p-Math.max(c,h)-a:_=this.caretX,o==="top"?(T=m,S=T-a,y=_-a,x=_+a):(T=m+g,S=T+a,y=_+a,x=_-a),w=T),{x1:y,x2:_,x3:x,y1:T,y2:S,y3:w}}drawTitle(t,n,i){const s=this.title,o=s.length;let a,r,l;if(o){const c=Rn(i.rtl,this.x,this.width);for(t.x=Fs(this,i.titleAlign,i),n.textAlign=c.textAlign(i.titleAlign),n.textBaseline="middle",a=xt(i.titleFont),r=i.titleSpacing,n.fillStyle=i.titleColor,n.font=a.string,l=0;l<o;++l)n.fillText(s[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+r,l+1===o&&(t.y+=i.titleMarginBottom-r)}}_drawColorBox(t,n,i,s,o){const a=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:l,boxWidth:c}=o,u=xt(o.bodyFont),h=Fs(this,"left",o),f=s.x(h),m=l<u.lineHeight?(u.lineHeight-l)/2:0,p=n.y+m;if(o.usePointStyle){const g={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},y=s.leftForLtr(f,c)+c/2,_=p+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,na(t,g,y,_),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,na(t,g,y,_)}else{t.lineWidth=nt(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const g=s.leftForLtr(f,c),y=s.leftForLtr(s.xPlus(f,1),c-2),_=Ne(a.borderRadius);Object.values(_).some(x=>x!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,An(t,{x:g,y:p,w:c,h:l,radius:_}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),An(t,{x:y,y:p+1,w:c-2,h:l-2,radius:_}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(g,p,c,l),t.strokeRect(g,p,c,l),t.fillStyle=a.backgroundColor,t.fillRect(y,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,n,i){const{body:s}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:u}=i,h=xt(i.bodyFont);let f=h.lineHeight,m=0;const p=Rn(i.rtl,this.x,this.width),g=function(A){n.fillText(A,p.x(t.x+m),t.y+f/2),t.y+=f+o},y=p.textAlign(a);let _,x,T,S,w,D,v;for(n.textAlign=a,n.textBaseline="middle",n.font=h.string,t.x=Fs(this,y,i),n.fillStyle=i.bodyColor,mt(this.beforeBody,g),m=r&&y!=="right"?a==="center"?c/2+u:c+2+u:0,S=0,D=s.length;S<D;++S){for(_=s[S],x=this.labelTextColors[S],n.fillStyle=x,mt(_.before,g),T=_.lines,r&&T.length&&(this._drawColorBox(n,t,S,p,i),f=Math.max(h.lineHeight,l)),w=0,v=T.length;w<v;++w)g(T[w]),f=h.lineHeight;mt(_.after,g)}m=0,f=h.lineHeight,mt(this.afterBody,g),t.y-=o}drawFooter(t,n,i){const s=this.footer,o=s.length;let a,r;if(o){const l=Rn(i.rtl,this.x,this.width);for(t.x=Fs(this,i.footerAlign,i),t.y+=i.footerMarginTop,n.textAlign=l.textAlign(i.footerAlign),n.textBaseline="middle",a=xt(i.footerFont),n.fillStyle=i.footerColor,n.font=a.string,r=0;r<o;++r)n.fillText(s[r],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+i.footerSpacing}}drawBackground(t,n,i,s){const{xAlign:o,yAlign:a}=this,{x:r,y:l}=t,{width:c,height:u}=i,{topLeft:h,topRight:f,bottomLeft:m,bottomRight:p}=Ne(s.cornerRadius);n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.beginPath(),n.moveTo(r+h,l),a==="top"&&this.drawCaret(t,n,i,s),n.lineTo(r+c-f,l),n.quadraticCurveTo(r+c,l,r+c,l+f),a==="center"&&o==="right"&&this.drawCaret(t,n,i,s),n.lineTo(r+c,l+u-p),n.quadraticCurveTo(r+c,l+u,r+c-p,l+u),a==="bottom"&&this.drawCaret(t,n,i,s),n.lineTo(r+m,l+u),n.quadraticCurveTo(r,l+u,r,l+u-m),a==="center"&&o==="left"&&this.drawCaret(t,n,i,s),n.lineTo(r,l+h),n.quadraticCurveTo(r,l,r+h,l),n.closePath(),n.fill(),s.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){const a=Pi[t.position].call(this,this._active,this._eventPosition);if(!a)return;const r=this._size=jd(this,t),l=Object.assign({},a,this._size),c=qd(n,t,l),u=Gd(t,l,c,n);(s._to!==u.x||o._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const a=Pt(n.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,n),Dc(t,n.textDirection),o.y+=a.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),Cc(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const i=this._active,s=t.map(({datasetIndex:r,index:l})=>{const c=this.chart.getDatasetMeta(r);if(!c)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:c.data[l],index:l}}),o=!fs(i,s),a=this._positionChanged(s,n);(o||a)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,i=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,o=this._active||[],a=this._getActiveElements(t,o,n,i),r=this._positionChanged(a,t),l=n||!fs(a,o)||r;return l&&(this._active=a,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,i,s){const o=this.options;if(t.type==="mouseout")return[];if(!s)return n.filter(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&a.reverse(),a}_positionChanged(t,n){const{caretX:i,caretY:s,options:o}=this,a=Pi[o.position].call(this,t,n);return a!==!1&&(i!==a.x||s!==a.y)}}var Yt={id:"tooltip",_element:Qd,positioners:Pi,afterInit(e,t,n){n&&(e.tooltip=new Qd({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Zd},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},VT=Object.freeze({__proto__:null,Colors:tT,Decimation:sT,Filler:vT,Legend:AT,SubTitle:RT,Title:ET,Tooltip:Yt});const HT=(e,t,n,i)=>(typeof t=="string"?(n=e.push(t)-1,i.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function $T(e,t,n,i){const s=e.indexOf(t);if(s===-1)return HT(e,t,n,i);const o=e.lastIndexOf(t);return s!==o?n:s}const YT=(e,t)=>e===null?null:It(Math.round(e),0,t);function Jd(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class WT extends an{static id="category";static defaults={ticks:{callback:Jd}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const i=this.getLabels();for(const{index:s,label:o}of n)i[s]===o&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(Z(t))return null;const i=this.getLabels();return n=isFinite(n)&&i[n]===t?n:$T(i,t,Q(n,t),this._addedLabels),YT(n,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),n||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,n=this.max,i=this.options.offset,s=[];let o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let a=t;a<=n;a++)s.push({value:a});return s}getLabelForValue(t){return Jd.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function jT(e,t){const n=[],{bounds:s,step:o,min:a,max:r,precision:l,count:c,maxTicks:u,maxDigits:h,includeBounds:f}=e,m=o||1,p=u-1,{min:g,max:y}=t,_=!Z(a),x=!Z(r),T=!Z(c),S=(y-g)/(h+1);let w=tc((y-g)/p/m)*m,D,v,A,R;if(w<1e-14&&!_&&!x)return[{value:g},{value:y}];R=Math.ceil(y/w)-Math.floor(g/w),R>p&&(w=tc(R*w/p/m)*m),Z(l)||(D=Math.pow(10,l),w=Math.ceil(w*D)/D),s==="ticks"?(v=Math.floor(g/w)*w,A=Math.ceil(y/w)*w):(v=g,A=y),_&&x&&o&&I_((r-a)/o,w/1e3)?(R=Math.round(Math.min((r-a)/w,u)),w=(r-a)/R,v=a,A=r):T?(v=_?a:v,A=x?r:A,R=c-1,w=(A-v)/R):(R=(A-v)/w,mi(R,Math.round(R),w/1e3)?R=Math.round(R):R=Math.ceil(R));const E=Math.max(nc(w),nc(v));D=Math.pow(10,Z(l)?E:l),v=Math.round(v*D)/D,A=Math.round(A*D)/D;let k=0;for(_&&(f&&v!==a?(n.push({value:a}),v<a&&k++,mi(Math.round((v+k*w)*D)/D,a,tu(a,S,e))&&k++):v<a&&k++);k<R;++k){const C=Math.round((v+k*w)*D)/D;if(x&&C>r)break;n.push({value:C})}return x&&f&&A!==r?n.length&&mi(n[n.length-1].value,r,tu(r,S,e))?n[n.length-1].value=r:n.push({value:r}):(!x||A===r)&&n.push({value:A}),n}function tu(e,t,{horizontal:n,minRotation:i}){const s=At(i),o=(n?Math.sin(s):Math.cos(s))||.001,a=.75*t*(""+e).length;return Math.min(t/o,a)}class zs extends an{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return Z(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:i}=this.getUserBounds();let{min:s,max:o}=this;const a=l=>s=n?s:l,r=l=>o=i?o:l;if(t){const l=he(s),c=he(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(s-l)}this.min=s,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,a=jT(s,o);return t.bounds==="ticks"&&ec(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let n=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-n)/Math.max(t.length-1,1)/2;n-=s,i+=s}this._startValue=n,this._endValue=i,this._valueRange=i-n}getLabelForValue(t){return yi(t,this.chart.options.locale,this.options.ticks.format)}}class qT extends zs{static id="linear";static defaults={ticks:{callback:ws.formatters.numeric}};determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=_t(t)?t:0,this.max=_t(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,i=At(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const Ei=e=>Math.floor(Ie(e)),rn=(e,t)=>Math.pow(10,Ei(e)+t);function eu(e){return e/Math.pow(10,Ei(e))===1}function nu(e,t,n){const i=Math.pow(10,n),s=Math.floor(e/i);return Math.ceil(t/i)-s}function GT(e,t){const n=t-e;let i=Ei(n);for(;nu(e,t,i)>10;)i++;for(;nu(e,t,i)<10;)i--;return Math.min(i,Ei(e))}function XT(e,{min:t,max:n}){t=ie(e.min,t);const i=[],s=Ei(t);let o=GT(t,n),a=o<0?Math.pow(10,Math.abs(o)):1;const r=Math.pow(10,o),l=s>o?Math.pow(10,s):0,c=Math.round((t-l)*a)/a,u=Math.floor((t-l)/r/10)*r*10;let h=Math.floor((c-u)/Math.pow(10,o)),f=ie(e.min,Math.round((l+u+h*Math.pow(10,o))*a)/a);for(;f<n;)i.push({value:f,major:eu(f),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(o++,h=2,a=o>=0?1:a),f=Math.round((l+u+h*Math.pow(10,o))*a)/a;const m=ie(e.max,f);return i.push({value:m,major:eu(m),significand:h}),i}class KT extends an{static id="logarithmic";static defaults={ticks:{callback:ws.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const i=zs.prototype.parse.apply(this,[t,n]);if(i===0){this._zero=!0;return}return _t(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=_t(t)?Math.max(0,t):null,this.max=_t(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!_t(this._userMin)&&(this.min=t===rn(this.min,0)?rn(this.min,-1):rn(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let i=this.min,s=this.max;const o=r=>i=t?i:r,a=r=>s=n?s:r;i===s&&(i<=0?(o(1),a(10)):(o(rn(i,-1)),a(rn(s,1)))),i<=0&&o(rn(s,-1)),s<=0&&a(rn(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},i=XT(n,this);return t.bounds==="ticks"&&ec(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":yi(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Ie(t),this._valueRange=Ie(this.max)-Ie(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ie(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}function Oa(e){const t=e.ticks;if(t.display&&e.display){const n=Pt(t.backdropPadding);return Q(t.font&&t.font.size,bt.font.size)+n.height}return 0}function ZT(e,t,n){return n=ct(n)?n:[n],{w:Z_(e,t.string,n),h:n.length*t.lineHeight}}function iu(e,t,n,i,s){return e===i||e===s?{start:t-n/2,end:t+n/2}:e<i||e>s?{start:t-n,end:t}:{start:t,end:t+n}}function QT(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),i=[],s=[],o=e._pointLabels.length,a=e.options.pointLabels,r=a.centerPointLabels?tt/o:0;for(let l=0;l<o;l++){const c=a.setContext(e.getPointLabelContext(l));s[l]=c.padding;const u=e.getPointPosition(l,e.drawingArea+s[l],r),h=xt(c.font),f=ZT(e.ctx,h,e._pointLabels[l]);i[l]=f;const m=Ut(e.getIndexAngle(l)+r),p=Math.round(ys(m)),g=iu(p,u.x,f.w,0,180),y=iu(p,u.y,f.h,90,270);JT(n,t,m,g,y)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=nv(e,i,s)}function JT(e,t,n,i,s){const o=Math.abs(Math.sin(n)),a=Math.abs(Math.cos(n));let r=0,l=0;i.start<t.l?(r=(t.l-i.start)/o,e.l=Math.min(e.l,t.l-r)):i.end>t.r&&(r=(i.end-t.r)/o,e.r=Math.max(e.r,t.r+r)),s.start<t.t?(l=(t.t-s.start)/a,e.t=Math.min(e.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/a,e.b=Math.max(e.b,t.b+l))}function tv(e,t,n){const i=e.drawingArea,{extra:s,additionalAngle:o,padding:a,size:r}=n,l=e.getPointPosition(t,i+s+a,o),c=Math.round(ys(Ut(l.angle+yt))),u=ov(l.y,r.h,c),h=iv(c),f=sv(l.x,r.w,h);return{visible:!0,x:l.x,y:u,textAlign:h,left:f,top:u,right:f+r.w,bottom:u+r.h}}function ev(e,t){if(!t)return!0;const{left:n,top:i,right:s,bottom:o}=e;return!(ke({x:n,y:i},t)||ke({x:n,y:o},t)||ke({x:s,y:i},t)||ke({x:s,y:o},t))}function nv(e,t,n){const i=[],s=e._pointLabels.length,o=e.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:Oa(o)/2,additionalAngle:a?tt/s:0};let c;for(let u=0;u<s;u++){l.padding=n[u],l.size=t[u];const h=tv(e,u,l);i.push(h),r==="auto"&&(h.visible=ev(h,c),h.visible&&(c=h))}return i}function iv(e){return e===0||e===180?"center":e<180?"left":"right"}function sv(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function ov(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function av(e,t,n){const{left:i,top:s,right:o,bottom:a}=n,{backdropColor:r}=t;if(!Z(r)){const l=Ne(t.borderRadius),c=Pt(t.backdropPadding);e.fillStyle=r;const u=i-c.left,h=s-c.top,f=o-i+c.width,m=a-s+c.height;Object.values(l).some(p=>p!==0)?(e.beginPath(),An(e,{x:u,y:h,w:f,h:m,radius:l}),e.fill()):e.fillRect(u,h,f,m)}}function rv(e,t){const{ctx:n,options:{pointLabels:i}}=e;for(let s=t-1;s>=0;s--){const o=e._pointLabelItems[s];if(!o.visible)continue;const a=i.setContext(e.getPointLabelContext(s));av(n,a,o);const r=xt(a.font),{x:l,y:c,textAlign:u}=o;en(n,e._pointLabels[s],l,c+r.lineHeight/2,r,{color:a.color,textAlign:u,textBaseline:"middle"})}}function su(e,t,n,i){const{ctx:s}=e;if(n)s.arc(e.xCenter,e.yCenter,t,0,gt);else{let o=e.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let a=1;a<i;a++)o=e.getPointPosition(a,t),s.lineTo(o.x,o.y)}}function lv(e,t,n,i,s){const o=e.ctx,a=t.circular,{color:r,lineWidth:l}=t;!a&&!i||!r||!l||n<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(s.dash||[]),o.lineDashOffset=s.dashOffset,o.beginPath(),su(e,n,a,i),o.closePath(),o.stroke(),o.restore())}function cv(e,t,n){return Be(e,{label:n,index:t,type:"pointLabel"})}class dv extends zs{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ws.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Pt(Oa(this.options)/2),n=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+n/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(n,i)/2)}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!1);this.min=_t(t)&&!isNaN(t)?t:0,this.max=_t(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Oa(this.options))}generateTickLabels(t){zs.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,i)=>{const s=ft(this.options.pointLabels.callback,[n,i],this);return s||s===0?s:""}).filter((n,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?QT(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,i,s){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,i,s))}getIndexAngle(t){const n=gt/(this._pointLabels.length||1),i=this.options.startAngle||0;return Ut(t*n+At(i))}getDistanceFromCenterForValue(t){if(Z(t))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(Z(t))return NaN;const n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){const n=this._pointLabels||[];if(t>=0&&t<n.length){const i=n[t];return cv(this.getContext(),t,i)}}getPointPosition(t,n,i=0){const s=this.getIndexAngle(t)-yt+i;return{x:Math.cos(s)*n+this.xCenter,y:Math.sin(s)*n+this.yCenter,angle:s}}getPointPositionForValue(t,n){return this.getPointPosition(t,this.getDistanceFromCenterForValue(n))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:n,top:i,right:s,bottom:o}=this._pointLabelItems[t];return{left:n,top:i,right:s,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:n}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),su(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,n=this.options,{angleLines:i,grid:s,border:o}=n,a=this._pointLabels.length;let r,l,c;if(n.pointLabels.display&&rv(this,a),s.display&&this.ticks.forEach((u,h)=>{if(h!==0||h===0&&this.min<0){l=this.getDistanceFromCenterForValue(u.value);const f=this.getContext(h),m=s.setContext(f),p=o.setContext(f);lv(this,m,l,a,p)}}),i.display){for(t.save(),r=a-1;r>=0;r--){const u=i.setContext(this.getPointLabelContext(r)),{color:h,lineWidth:f}=u;!f||!h||(t.lineWidth=f,t.strokeStyle=h,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),c=this.getPointPosition(r,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,i=n.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let o,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&this.min>=0&&!n.reverse)return;const c=i.setContext(this.getContext(l)),u=xt(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=u.string,a=t.measureText(r.label).width,t.fillStyle=c.backdropColor;const h=Pt(c.backdropPadding);t.fillRect(-a/2-h.left,-o-u.size/2-h.top,a+h.width,u.size+h.height)}en(t,r.label,0,-o,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}const Us={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Jt=Object.keys(Us);function ou(e,t){return e-t}function au(e,t){if(Z(t))return null;const n=e._adapter,{parser:i,round:s,isoWeekday:o}=e._parseOpts;let a=t;return typeof i=="function"&&(a=i(a)),_t(a)||(a=typeof i=="string"?n.parse(a,i):n.parse(a)),a===null?null:(s&&(a=s==="week"&&(Le(o)||o===!0)?n.startOf(a,"isoWeek",o):n.startOf(a,s)),+a)}function ru(e,t,n,i){const s=Jt.length;for(let o=Jt.indexOf(e);o<s-1;++o){const a=Us[Jt[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((n-t)/(r*a.size))<=i)return Jt[o]}return Jt[s-1]}function uv(e,t,n,i,s){for(let o=Jt.length-1;o>=Jt.indexOf(n);o--){const a=Jt[o];if(Us[a].common&&e._adapter.diff(s,i,a)>=t-1)return a}return Jt[n?Jt.indexOf(n):0]}function hv(e){for(let t=Jt.indexOf(e)+1,n=Jt.length;t<n;++t)if(Us[Jt[t]].common)return Jt[t]}function lu(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:i,hi:s}=Ko(n,t),o=n[i]>=t?n[i]:n[s];e[o]=!0}}function fv(e,t,n,i){const s=e._adapter,o=+s.startOf(t[0].value,i),a=t[t.length-1].value;let r,l;for(r=o;r<=a;r=+s.add(r,1,i))l=n[r],l>=0&&(t[l].major=!0);return t}function cu(e,t,n){const i=[],s={},o=t.length;let a,r;for(a=0;a<o;++a)r=t[a],s[r]=a,i.push({value:r,major:!1});return o===0||!n?i:fv(e,i,s,n)}class Aa extends an{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const i=t.time||(t.time={}),s=this._adapter=new Zc._date(t.adapters.date);s.init(n),fi(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:au(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,i=t.time.unit||"day";let{min:s,max:o,minDefined:a,maxDefined:r}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!r&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!a||!r)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=_t(s)&&!isNaN(s)?s:+n.startOf(Date.now(),i),o=_t(o)&&!isNaN(o)?o:+n.endOf(Date.now(),i)+1,this.min=Math.min(s,o-1),this.max=Math.max(s+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],i=t[t.length-1]),{min:n,max:i}}buildTicks(){const t=this.options,n=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const o=this.min,a=this.max,r=F_(s,o,a);return this._unit=n.unit||(i.autoSkip?ru(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):uv(this,r.length,n.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:hv(this._unit),this.initOffsets(s),t.reverse&&r.reverse(),cu(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,i=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?n=1-s:n=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;n=It(n,0,a),i=It(i,0,a),this._offsets={start:n,end:i,factor:1/(n+1+i)}}_generate(){const t=this._adapter,n=this.min,i=this.max,s=this.options,o=s.time,a=o.unit||ru(o.minUnit,n,i,this._getLabelCapacity(n)),r=Q(s.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=Le(l)||l===!0,u={};let h=n,f,m;if(c&&(h=+t.startOf(h,"isoWeek",l)),h=+t.startOf(h,c?"day":a),t.diff(i,n,a)>1e5*r)throw new Error(n+" and "+i+" are too far apart with stepSize of "+r+" "+a);const p=s.ticks.source==="data"&&this.getDataTimestamps();for(f=h,m=0;f<i;f=+t.add(f,r,a),m++)lu(u,f,p);return(f===i||s.bounds==="ticks"||m===1)&&lu(u,f,p),Object.keys(u).sort(ou).map(g=>+g)}getLabelForValue(t){const n=this._adapter,i=this.options.time;return i.tooltipFormat?n.format(t,i.tooltipFormat):n.format(t,i.displayFormats.datetime)}format(t,n){const s=this.options.time.displayFormats,o=this._unit,a=n||s[o];return this._adapter.format(t,a)}_tickFormatFunction(t,n,i,s){const o=this.options,a=o.ticks.callback;if(a)return ft(a,[t,n,i],this);const r=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&r[l],h=c&&r[c],f=i[n],m=c&&h&&f&&f.major;return this._adapter.format(t,s||(m?h:u))}generateTickLabels(t){let n,i,s;for(n=0,i=t.length;n<i;++n)s=t[n],s.label=this._tickFormatFunction(s.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+i)*n.factor)}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,i=this.ctx.measureText(t).width,s=At(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(s),a=Math.sin(s),r=this._resolveTickFontOptions(0).size;return{w:i*o+r*a,h:i*a+r*o}}_getLabelCapacity(t){const n=this.options.time,i=n.displayFormats,s=i[n.unit]||i.millisecond,o=this._tickFormatFunction(t,0,cu(this,[t],this._majorUnit),s),a=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return r>0?r:1}getDataTimestamps(){let t=this._cache.data||[],n,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,i=s.length;n<i;++n)t=t.concat(s[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,i;if(t.length)return t;const s=this.getLabels();for(n=0,i=s.length;n<i;++n)t.push(au(this,s[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return oc(t.sort(ou))}}function Vs(e,t,n){let i=0,s=e.length-1,o,a,r,l;n?(t>=e[i].pos&&t<=e[s].pos&&({lo:i,hi:s}=we(e,"pos",t)),{pos:o,time:r}=e[i],{pos:a,time:l}=e[s]):(t>=e[i].time&&t<=e[s].time&&({lo:i,hi:s}=we(e,"time",t)),{time:o,pos:r}=e[i],{time:a,pos:l}=e[s]);const c=a-o;return c?r+(l-r)*(t-o)/c:r}class mv extends Aa{static id="timeseries";static defaults=Aa.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=Vs(n,this.min),this._tableRange=Vs(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:i}=this,s=[],o=[];let a,r,l,c,u;for(a=0,r=t.length;a<r;++a)c=t[a],c>=n&&c<=i&&s.push(c);if(s.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(a=0,r=s.length;a<r;++a)u=s[a+1],l=s[a-1],c=s[a],Math.round((u+l)/2)!==c&&o.push({time:c,pos:a/(r-1)});return o}_generate(){const t=this.min,n=this.max;let i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(n)||i.length===1)&&i.push(n),i.sort((s,o)=>s-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),i=this.getLabelTimestamps();return n.length&&i.length?t=this.normalize(n.concat(i)):t=n.length?n:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Vs(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return Vs(this._table,i*this._tableRange+this._minPos,!0)}}var pv=Object.freeze({__proto__:null,CategoryScale:WT,LinearScale:qT,LogarithmicScale:KT,RadialLinearScale:dv,TimeScale:Aa,TimeSeriesScale:mv});const gv=[gw,qk,VT,pv];function yv(e){const n=`barChartTooltipPosition-${e.tooltipState.chartID}`,i={enabled:!1,position:n,callbacks:{label:l=>({label:l.dataset.label,value:l.label})}};Yt.positioners[n]=function(l,c){if(!l.length||e.tooltipState.interactionMode==="interactive"||c.x===null||c.y===null)return!1;const u=this.chart.canvas.getBoundingClientRect(),h=e.tooltipState.width||this.width,f=u.width/2,m=js(c,h,f),p=c.y,g=c.x<f?"left":"center";return{x:m-e.tooltipState.offsetX,y:p-e.tooltipState.offsetY,xAlign:g}},ya.modes.customInteractionMode=function(l,c){const u=Fe(c,l),h=[];return ya.evaluateInteractionItems(l,l.options.indexAxis||"x",u,(f,m,p)=>{l.options.indexAxis==="y"&&f.inYRange(u.y,!0)&&l.data.datasets[m].data[p]&&h.push({element:f,datasetIndex:m,index:p}),l.options.indexAxis==="x"&&u.x!==null&&f.inXRange(u.x,!0)&&l.data.datasets[m].data[p]&&h.push({element:f,datasetIndex:m,index:p})}),h};const s=e.numLabels.value>25?Au:Pu,o=({chart:l,index:c})=>{const u=l.data;return{size:s,style:u?.isLabelEmpty?.[c]?"italic":"normal"}},a=(l,c,u)=>l.chart.options.indexAxis===l.axis?(c=l.getLabelForValue(u),c&&c.length>qs?c.slice(0,qs)+"...":c):l.getLabelForValue(Number(c)),r=d.computed(()=>({indexAxis:e.indexAxis,skipNull:!0,scales:{x:{stacked:e.stacked.value,grid:{offset:!1,drawOnChartArea:!1,drawBorder:!1,drawTicks:!0},ticks:{maxRotation:90,autoSkip:!1,font:o,callback:function(l,c){return a(this,l,c)}},title:{display:e.indexAxis==="y"?!Z(e.metricAxesTitle?.value):!Z(e.dimensionAxesTitle?.value),text:e.indexAxis==="y"?e.metricAxesTitle?.value:e.dimensionAxesTitle?.value,padding:{top:3,bottom:0,left:0,right:0},font:{weight:"bold"}}},y:{stacked:e.stacked.value,beginAtZero:!0,grid:{offset:!1,drawOnChartArea:!1,drawBorder:!1,drawTicks:!0},ticks:{padding:0,font:o,callback:function(l,c){return a(this,l,c)}},title:{display:e.indexAxis==="x"?!Z(e.metricAxesTitle?.value):!Z(e.dimensionAxesTitle?.value),text:e.indexAxis==="x"?e.metricAxesTitle?.value:e.dimensionAxesTitle?.value,padding:{bottom:3,top:0,left:0,right:0},font:{weight:"bold"}}}},plugins:{htmlLegend:{containerID:e.legendID},legend:{display:!1},tooltip:{...i,external:l=>{Du(e.tooltipState,l)}}},interaction:{mode:"customInteractionMode",intersect:!0},maxBarThickness:60,maintainAspectRatio:!1,layout:{padding:{left:0,right:0,top:0,bottom:0}}}));return d.getCurrentInstance()&&d.onUnmounted(()=>{Yt.positioners[n]&&delete Yt.positioners[n]}),r}Zt.register(...gv);const bv=(e,t)=>{const n=t.datasets.map(s=>s.label),i=e.datasets.map(s=>s.label);return e.datasets.length===t.datasets.length&&n.every((s,o)=>s===i[o])};function _v(e,t,n,i,s){const o=d.shallowRef(null),a=(r,l)=>{if(t.value)return new Zt(t.value,{type:e,data:r,plugins:i,options:l})};return d.onMounted(()=>{o.value=a(n.value,s.value)}),d.onBeforeUnmount(()=>{Z(o.value)||o.value.destroy()}),d.watch(n,(r,l)=>{if(bv(l,r)&&!Z(o.value)){for(const[c,u]of r.datasets.entries())Object.assign(o.value.data.datasets[c],u);o.value.data.labels=r.labels,o.value.update()}else Z(o.value)||o.value.destroy(),o.value=a(r,s.value)}),d.watch(t,()=>{Z(o.value)||o.value.destroy(),o.value=a(n.value,s.value)}),d.watch(s,(r,l)=>{(r.indexAxis!==l.indexAxis||JSON.stringify(r.scales.x.title)!==JSON.stringify(l.scales.x.title)||JSON.stringify(r.scales.y.title)!==JSON.stringify(l.scales.y.title))&&(Z(o.value)||o.value.destroy(),o.value=a(n.value,r))}),o}const du=1e3,xv=1e4,uu=1e6,hu=1e9,fu=1e12,Ri=(e,t)=>{if(t.separator===!1||e<1e3)return e.toString();const n=typeof t.separator=="string"?t.separator:",",i=[];return Math.round(e).toString().split("").reverse().forEach((o,a)=>{a&&a%3===0&&i.push(n),i.push(o)}),i.reverse().join("")},Ln=(e,t,n)=>{const i=e/t,s=n.round?"round":"floor";if(n.decimal===!1)return Math[s](i).toString();let o;n.precision?o=i:o=i<10?Math[s](i*10)/10:Math[s](i);let a=o.toString();return typeof n.decimal=="string"&&(a=a.replace(".",n.decimal)),a};function Ii(e,t={}){let n;const i=e<0;i&&(e=Math.abs(e)),t.precision&&(e=parseFloat(e.toPrecision(t.precision)));const s=t.min10k?xv:du;return e<s||t.precision&&t.precision>Math.log10(e)?n=Ri(Ln(e,1,t),t):e<uu?n=`${Ln(e,du,t)}k`:e<hu?n=`${Ln(e,uu,t)}m`:e<fu?n=`${Ri(Ln(e,hu,t),t)}b`:n=`${Ri(Ln(e,fu,t),t)}t`,i&&(n=`-${n}`),t.capital&&(n=n.toUpperCase()),t.prefix&&(n=`${t.prefix}${n}`),t.suffix&&(n=`${n}${t.suffix}`),n}Ii.addCommas=Ri;function wv(e,t,n){const{i18n:i}=q.useI18n(),{formatBytes:s}=le({i18n:i}),{translateUnit:o}=q.useTranslatedUnits();return{legendValues:d.computed(()=>e.value.datasets.reduce((r,l)=>{const c=l.total?l.total:l.data.reduce((f,m)=>f+(typeof m=="number"?Number(m)||0:Number(m&&m.y)||0),0);let u;const h=l.unit??n.value;if(h==="bytes")u=s(c);else{const f=o(h,c);u=i&&i.t("legend.datapointValueDisplay",{value:Ii(c,{capital:!0}),unit:f})||`${Ii(c,{capital:!0})} ${h}`}return{...r,[l.label]:{raw:c,formatted:u,isThreshold:l.isThreshold}}},{}))}}function kv(e){const n=`donutChartTooltipPosition-${e.tooltipState.chartID}`,i={enabled:!1,position:n,callbacks:{label:o=>({label:o.dataset.label,value:o.label})}};Yt.positioners[n]=function(o,a){if(!o.length||a.x===null||a.y===null)return!1;const r=this.chart.canvas.getBoundingClientRect(),l=e.tooltipState.width||this.width,c=r.width/2,u=js(a,l,c),h=a.y,f=a.x<c?"left":"center";return{x:u-e.tooltipState.offsetX,y:h,xAlign:f}};const s=d.computed(()=>({cutout:"65%",responsive:!0,maintainAspectRatio:!1,plugins:{htmlLegend:{containerID:e.legendID},legend:{display:!1},tooltip:{...i,external:o=>{Du(e.tooltipState,o)}}},layout:{padding:{left:0,right:0,top:5,bottom:0}}}));return d.onUnmounted(()=>{Yt.positioners[n]&&delete Yt.positioners[n]}),{options:s}}function Tv(e){const t=d.computed(()=>({type:"timeseries",display:!0,grid:{display:!0,drawOnChartArea:!1,drawTicks:!0,drawBorder:!1},ticks:{padding:0,autoSkipPadding:10,source:"auto",maxRotation:0,callback:u=>{const h=new Date(u);return Ga({tickValue:h,granularity:e.granularity.value,dayBoundaryCrossed:l.value})}},title:{display:!1},border:{display:!1},stacked:e.stacked.value})),n=d.computed(()=>!!e.rightYAxis?.value),i=d.computed(()=>({title:{display:!Z(e.metricAxesTitle?.value),text:e.metricAxesTitle?.value,padding:{bottom:3},font:{weight:"bold"}},ticks:{maxTicksLimit:5},grid:{drawBorder:!1,...e.leftYAxisGrid?.value===!1?{drawOnChartArea:!1}:{}},id:"main-y-axis",beginAtZero:!0,border:{display:!1},stacked:e.stacked.value,...n.value?{display:"auto"}:{}})),s=d.computed(()=>{const u=e.rightYAxis?.value;if(u)return{display:"auto",position:"right",title:{display:!Z(u.title),text:u.title,padding:{bottom:3},font:{weight:"bold"}},ticks:{maxTicksLimit:5},grid:{drawBorder:!1,drawOnChartArea:u.showGrid??!1},beginAtZero:!0,border:{display:!1},stacked:e.stacked.value}}),a=`lineChartTooltipPosition-${e.tooltipState.chartID}`,r={enabled:!1,position:a};Yt.positioners[a]=function(u,h){if(!u.length||e.tooltipState.interactionMode==="interactive"||h.x===null||h.y===null)return!1;const f=this.chart.canvas.getBoundingClientRect(),m=e.tooltipState.width||this.width,p=e.tooltipState.height||this.height,g=f.width/2,y=f.height/2,_=js(h,m,g);let x=Cu(h,p,y);const T=h.y<y?"top":"bottom",S=h.x<g?"left":"center";return p>f.height&&(x=0),{x:_,y:x,xAlign:S,yAlign:T}};const l=d.computed(()=>{const u=Number(e.timeRangeMs.value),h=new Date,f=new Date(h.getTime()-u);return Ul(u)>24||f.getDate()!==h.getDate()}),c=d.computed(()=>({hover:{mode:"index",intersect:!1},elements:{point:{radius:e.pointsWithoutHover?.value?3:0,hitRadius:4,hoverRadius:4}},animation:{duration:250,easing:"linear"},scales:{x:t.value,y:i.value,...s.value?{[Na]:s.value}:{}},responsive:!0,maintainAspectRatio:!1,plugins:{htmlLegend:{containerID:e.legendID},legend:{display:!1},streaming:!1,tooltip:{...r,external:u=>{Ia(e.tooltipState,u,e.granularity.value)}},thresholdPlugin:{threshold:e.threshold?.value}},interaction:{mode:"index",intersect:!1},layout:{padding:{left:0,right:0,top:0,bottom:0}}}));return d.onUnmounted(()=>{Yt.positioners[a]&&delete Yt.positioners[a]}),{options:c}}const vv=["usd","bytes"],Sv="usd";function Mv(e){const{i18n:t}=q.useI18n(),{formatUnit:n}=le({i18n:t}),i=(m,p)=>!p||!vv.includes(p)?m:m===0&&p===Sv?t.formatNumber(0,{style:"currency",currency:"USD"}):n(m,p),s=d.computed(()=>{const m=Number(e.timeRangeMs.value),p=new Date,g=new Date(p.getTime()-m);return Ul(m)>24||g.getDate()!==p.getDate()}),o=d.computed(()=>({display:!Z(e.dimensionAxesTitle?.value),text:e.dimensionAxesTitle?.value,padding:{top:3},font:{weight:"bold"}})),a=d.computed(()=>({type:"linear",display:!0,beginAtZero:!0,grid:{display:!0,drawOnChartArea:!1,drawTicks:!0,drawBorder:!1},ticks:{maxRotation:0,maxTicksLimit:7,callback:m=>i(m,e.xMetricUnit?.value)},title:o.value,border:{display:!1}})),r=d.computed(()=>({type:"time",display:!0,grid:{display:!0,drawOnChartArea:!1,drawTicks:!0,drawBorder:!1},ticks:{padding:0,autoSkipPadding:100,source:"auto",maxRotation:0,callback:m=>Ga({tickValue:new Date(m),granularity:e.granularity.value,dayBoundaryCrossed:s.value})},title:{display:!1},border:{display:!1}})),l=d.computed(()=>({title:{display:!Z(e.metricAxesTitle?.value),text:e.metricAxesTitle?.value,padding:{bottom:3},font:{weight:"bold"}},ticks:{maxTicksLimit:5,callback:m=>i(m,e.metricUnit?.value)},grid:{drawBorder:!1},id:"main-y-axis",beginAtZero:!0,border:{display:!1}})),c=(m,p,g)=>{const y=g?.timestamp;return y===void 0?"":Un({tickValue:new Date(y),granularity:p})},h=`scatterChartTooltipPosition-${e.tooltipState.chartID}`;Yt.positioners[h]=function(m,p){if(!m.length||e.tooltipState.interactionMode==="interactive"||p.x===null||p.y===null)return!1;const g=this.chart.canvas.getBoundingClientRect(),y=e.tooltipState.width||this.width,_=e.tooltipState.height||this.height,x=g.width/2,T=g.height/2,S=js(p,y,x);let w=Cu(p,_,T);const D=p.y<T?"top":"bottom",v=p.x<x?"left":"center";return _>g.height&&(w=0),{x:S,y:w,xAlign:v,yAlign:D}};const f=d.computed(()=>({hover:{mode:"nearest",intersect:!1},interaction:{mode:"point",intersect:!1},animation:{duration:250,easing:"linear"},scales:{x:e.xMetric?.value?a.value:r.value,y:l.value},responsive:!0,maintainAspectRatio:!1,plugins:{htmlLegend:{containerID:e.legendID},legend:{display:!1},streaming:!1,tooltip:{enabled:!1,position:h,external:m=>{Ia(e.tooltipState,m,e.granularity.value,{...e.xMetric?.value?{contextFormatter:c}:{}})}},outlierBandPlugin:{value:e.outlierValue?.value,color:e.themeColors.value.outlierBand},referenceLinePlugin:{lines:e.referenceLines?.value}},layout:{padding:{left:0,right:0,top:0,bottom:0}}}));return d.onUnmounted(()=>{Yt.positioners[h]&&delete Yt.positioners[h]}),{options:f}}const Dv=e=>{const t=e.length;let n=5381;for(let i=0;i<t;i++)n=n*33^e.charCodeAt(i);return n>>>0},Cv="#0044f4",mu="#6c7489",Ov="#d60027",Av="#ffc400",Pv="#bee2ff",Ev="#8fc1ff",Rv="#5f9aff",Iv="#306fff",Lv="#b5ffee",Nv="#00fabe",Bv="#00d6a4",Fv="#00a17b",zv="#007d60",Uv="#005944",Vv="#b5ffee",Hv="#00fabe",$v="#b5ffee",Yv="#00a17b",Wv="#fff296",jv="#ffe04b",qv="#ffc400",Gv="#b37600",Xv="#995c00",Kv="#804400",Zv="#fff296",Qv="#ffe04b",Jv="#ffc2b3",tS="#ff9877",eS="#ff723c",nS="#f75008",iS="#d13500",sS="#a31f00",oS="#ffc2b3",aS="#ff9877",rS="#ff723c",lS="#f75008",cS="#d13500",dS="#a31f00",uS="#ffc2b3",hS="#ff9877",fS="#ff723c",mS="#f75008",pS="#d13500",gS="#a31f00",yS="#ffc2b3",bS="#ff9877",_S="#ff723c",xS="#f75008",wS="#d13500",kS="#a31f00",TS="#ffc2b3",vS="#ff9877",SS="#ff723c",MS="#f75008",DS="#d13500",CS="#ffabab",OS="#ff7272",AS="#ff3954",PS="#f50045",ES="#d60027",RS="#ad000e",IS="#ffabab",LS="#ff7272",NS="#ff3954",BS="#f50045",FS="#d60027",zS="#eefaff",US="#ecfffb",VS="#fffce0",HS="#fff1ef",$S="#ffe5e5",YS="#5f9aff",WS="#00d6a4",jS="#ffc400",qS="#ff723c",GS="#ff3954",XS={100:Pv,101:Ev,102:Rv,103:Iv,200:Lv,201:Nv,202:Bv,203:Fv,204:zv,205:Uv,206:Vv,207:Hv,208:$v,226:Yv,300:Wv,301:jv,302:qv,303:Gv,304:Xv,305:Kv,307:Zv,308:Qv,400:Jv,401:tS,402:eS,403:nS,404:iS,405:sS,406:oS,407:aS,408:rS,409:lS,410:cS,411:dS,412:uS,413:hS,414:fS,415:mS,416:pS,417:gS,418:yS,421:bS,422:_S,423:xS,424:wS,425:kS,426:TS,428:vS,429:SS,431:MS,451:DS,500:CS,501:OS,502:AS,503:PS,504:ES,505:RS,506:IS,507:LS,508:NS,510:BS,511:FS},KS={100:zS,200:US,300:VS,400:HS,500:$S},pu={"1XX":YS,"2XX":WS,"3XX":jS,"4XX":qS,"5XX":GS},ZS={error:Ov,warning:Av,empty:"#9DA99D",neutral:mu,____OTHER____:Cv},gu=["#0076F4","#00819D","#00A17B","#8A50FF","#FF3C99","#FF6D3C","#B3A100"],yu=["#5485BA","#087D96","#3D8776","#7654BA","#A1406F","#BF5430","#B5A72C"],QS=e=>Dv(e),bu=({discriminator:e,theme:t="light"})=>{const n=Math.abs(Math.floor(e));return t==="dark"?yu[n%yu.length]:gu[n%gu.length]},Li=({state:e})=>ZS[e]??mu,JS=({statusCode:e})=>{const t=typeof e=="number"?e:Number.parseInt(e,10),n=`${t}`,i=`${Math.floor(t/100)*100}`;return XS[n]??KS[i]??Li({state:"neutral"})},tM=({group:e})=>pu[e]?pu[e]:Li({state:"neutral"}),pe=({discriminator:e=void 0,state:t=void 0,dimension:n=void 0,dimensionValue:i=void 0,metric:s=void 0,coordinator:o=void 0,order:a=void 0,chartUuid:r=void 0,customDimensionColors:l=void 0})=>{let c="light";if(d.hasInjectionContext()&&(c=d.inject("app:konnectColorMode",d.computed(()=>"light")).value),t!==void 0)return Li({state:t});if(i!==void 0&&l!==void 0&&l[i])return l[i];if(i&&["empty","____OTHER____"].includes(i))return Li({state:i});if(n!==void 0&&i!==void 0){if(n==="status_code")return JS({statusCode:i});if(n==="status_code_grouped")return tM({group:i})}if(e!==void 0)return bu({discriminator:e,theme:c});if(n||i||s){const u=`${n??""}${i??""}${s??""}`,h=o?o.resolveDiscriminator({name:u,order:a,chartUuid:r,theme:c}):QS(u);return bu({discriminator:h,theme:c})}return Li({state:"neutral"})};function eM({barSegmentLabels:e,coordinator:t=void 0,customColors:n=void 0,hasDimensions:i=void 0,isMultiMetric:s=void 0,metricNames:o,pivotRecords:a,rowLabels:r,seriesDimension:l=void 0,uuid:c}){const u=q.useFieldLabel();if(s)return o.map((f,m)=>({label:u(f),backgroundColor:pe({discriminator:m}),data:r.map((p,g)=>i?a[`${p.id},${f}`]||0:a[`${g},${f}`]||null)}));const h=n&&!Array.isArray(n)?n:void 0;return Array.from(e).flatMap((f,m)=>f?{dimension:l,dimensionValue:f.id,label:u(f.name),backgroundColor:pe({...!t?.color&&{discriminator:m},dimension:l,dimensionValue:f.id,coordinator:t?.color,order:m,chartUuid:c,customDimensionColors:h}),data:r.map(p=>a[`${p.id},${f.id}`]||null),isSegmentEmpty:f.id==="empty"}:[])}function nM(e,t,n,i){const s=q.useFieldLabel();return d.computed(()=>{try{if(t.value&&"meta"in t.value&&"data"in t.value){const a=t.value.data,{display:r,metric_names:l}=t.value.meta,c=r&&Object.keys(r),u=l&&l.length>1,h=r&&c&&c.length>0,f=h&&c.length>1;if(!a.length||!l)return{datasets:[],labels:[]};const m=h&&c||l,p=m[0],g=m.length>1?m[1]:m[0],y=Object.fromEntries(u?a.flatMap(k=>l.map((C,z)=>{const N=k.event[p],V=h?`${N},${C}`:`${z},${C}`,Y=k.event[C];return[V,Y]})):a.map(k=>{const C=h?`${k.event[p]},${k.event[g]}`:`${p},${g}`,z=k.event[l[0]];return[C,z]})),_=Object.keys(y).reduce((k,C)=>{const[z]=C.split(","),N=y[C];return k[z]?k[z]+=N:k[z]=N,k},{}),x=Object.entries(_).sort(([,k],[,C])=>Number(C)-Number(k)).map(([k])=>k),T=r[p],S=r[g];let w=h&&T&&Object.entries(T).map(([k,C])=>({id:k,name:C.name}))||l.map(k=>({id:k,name:k})),D=h&&S&&Object.entries(S).map(([k,C])=>({id:k,name:C.name}))||l.map(k=>({id:k,name:k}));if(h&&p==="country_code"&&(w=w.map(k=>({...k,name:Co(k.id)||k.name}))),h&&g==="country_code"&&(D=D.map(k=>({...k,name:Co(k.id)||k.name}))),p!=="status_code"&&p!=="status_code_grouped"&&(w.sort((k,C)=>x.indexOf(k.id)-x.indexOf(C.id)),D.sort((k,C)=>x.indexOf(k.id)-x.indexOf(C.id))),!w||!D)return{labels:[],datasets:[]};const v=eM({barSegmentLabels:D,coordinator:i,customColors:e.colorPalette,hasDimensions:h,isMultiMetric:u,metricNames:l,pivotRecords:y,rowLabels:w,seriesDimension:g,uuid:n}),A=h?w.map(k=>s(k.name)):l.map(k=>s(k)),R=w.map(k=>k.id==="empty");return{labels:A,datasets:v,isLabelEmpty:R,isMultiDimension:f}}}catch(a){return console.error(a),{datasets:[],labels:[]}}return{labels:[],datasets:[]}})}const iM=(e,t,n=1)=>Array(Math.ceil((t-e)/n)).fill(e).map((i,s)=>i+s*n),sM=e=>{if(typeof e=="string"){const t=+e;if(t)return t;try{return Vl(e).getTime()}catch(n){if(n instanceof RangeError)return 0;throw n}}return e},oM=(e,t,n,i,s)=>{const a=Math.max(t-6e4,Math.max(...(s||[]).map(c=>new Date(c.timestamp).valueOf()))),r=Math.floor((e-i)/n)*n+i,l=Math.floor((a-i)/n)*n+i+n;return iM(r,l,n)};function aM(e,t,n,i){const s=q.useFieldLabel();return d.computed(()=>{try{if(t.value&&"meta"in t.value&&"data"in t.value){const a=t.value.data,{display:r,metric_names:l,metric_units:c,start:u,end:h}=t.value.meta,f=new Date(u).getTime(),m=new Date(h).getTime();if(!l)return console.error("Cannot build chart data from this explore result. Missing metric names."),{datasets:[]};const p=r&&Object.keys(r)||l,g=p&&p[0],y=r?.[g],_=!!y&&l.length>1;let x=r&&y&&Object.keys(y).map(C=>({id:C,name:y[C].name}))||l.map(C=>({id:C,name:C}));g==="country_code"&&(x=x.map(C=>({...C,name:Co(C.id)||C.name})));const T=t.value.meta.granularity_ms;if(typeof T!="number"||isNaN(T)||!isFinite(T)||T===0)return console.error("Invalid step value:",T),{datasets:[],labels:[]};if(!a.length)return{datasets:[],labels:[]};const S=sM(f),w=oM(f,m,T,S,a),D=!p.length,v=a?.length?a.reduce((C,z)=>{const N=new Date(z.timestamp).valueOf(),V=z.event;for(const Y of l)N in C||(C[N]={}),Y in C[N]||(C[N][Y]={});for(const Y of l)x.forEach(G=>{(y?V[g]===G.id:Y===G.id)?(C[N][Y]||(C[N][Y]={}),C[N][Y][G.id]=Math.round(Number(V[Y])*1e3)/1e3):D&&(C[N][Y]||(C[N][Y]={}),C[N][Y][G.id]=Math.round(Number(V[G.id])*1e3)/1e3)});return C},{}):{},A=y||l.length===1?l.flatMap(C=>x.map(z=>[C,z.id,z.name,z.id==="empty"])):x.map(C=>[C.name,C.id,C.name,C.id==="empty"]),R=e.colorPalette&&!Array.isArray(e.colorPalette)?e.colorPalette:void 0,E=D||!i?.color,k=[...A].map(([C,z,N,V],Y)=>{const G=w.map(P=>P in v&&C in v[P]?{x:P,y:v[P][C][z]||0}:{x:P,y:0}),st=pe({...E===!0&&{discriminator:Y},dimension:g,dimensionValue:z,coordinator:i?.color,order:Y,chartUuid:n,customDimensionColors:R}),ot=s(N),K=s(C),U=l.findIndex(P=>P===C),M=e.metricAxisMap?.[C]==="right";return{dimension:g,dimensionValue:z,rawDimension:N,rawMetric:C,label:_?`${ot} — ${K}`:ot,borderColor:st,backgroundColor:st,data:G,total:G.reduce((P,{y:F})=>P+Number(F),0),...WM,..._?{borderDash:U===0?[]:[U*4,2]}:{},...!_&&M?{borderDash:[4,2]}:{},...M?{yAxisID:Na}:{},...e.metricAxisMap?{unit:c?.[C]??""}:{},fill:e.fill,borderWidth:e.fill?qM:jM,isSegmentEmpty:V}});return g==="status_code"||g==="status_code_grouped"?k.sort((C,z)=>(C.label??"")<(z.label??"")?-1:1):k.sort((C,z)=>Number(C.total)<Number(z.total)?-1:1),{datasets:k}}}catch(a){return console.error(a),{labels:[],datasets:[]}}return{labels:[],datasets:[]}})}const rM=3,lM=.6,_u=2,cM=2,xu=50,dM=[6,4],uM=[2,3],hM=(e,t)=>{const n=Math.sin(t)*1e4;return(n-Math.floor(n))*e};function fM(e,t,n,i){const{i18n:s}=q.useI18n(),o=q.useFieldLabel(),a=(r,l)=>l||(r===xu?s.t("scatter.median"):s.t("scatter.percentile",{value:r}));return d.computed(()=>{try{const r=t.value;if(!r?.points?.length)return{datasets:[]};const{metric:l,dimension:c,display:u,xMetric:h,xMetricUnit:f}=r,m=h?o(h):"",p=e.scatter||{},g=p.jitterMs??0,y=p.pointRadius??rM,_=p.pointOpacity??lM,x=new Map,T=[];r.points.forEach(N=>{const V=N.group??l,Y=x.get(V)||[];let G,st;N.x!==void 0?(G={x:N.x,timestamp:N.timestamp},st=[{label:m,value:N.x,...f?{unit:f}:{}},...N.extras??[]]):(G={x:N.timestamp+hM(g,N.timestamp+N.value)},st=N.extras??[]),Y.push({...G,y:N.value,...st.length?{extras:st}:{}}),x.set(V,Y),T.push(N.value)});const S=p.percentileLines||[],w=[...S.map(N=>N.percentile),...p.outlierPercentile!==void 0?[p.outlierPercentile]:[]],D=w.length?F1(T,w):new Map,v=p.outlierPercentile!==void 0?D.get(p.outlierPercentile):void 0,A=v!==void 0&&Number.isFinite(v),R=e.themeColors?.value??Ka(),E=[],k=N=>{const V=N?.y;return A&&Number.isFinite(V)&&V>v},C=e.colorPalette&&!Array.isArray(e.colorPalette)?e.colorPalette:void 0;Array.from(x.entries()).forEach(([N,V],Y)=>{const G=c&&u?.[N]?.name||N,st=N==="empty",ot=pe({...!i?.color&&{discriminator:Y},dimension:c,dimensionValue:N,coordinator:i?.color,order:Y,chartUuid:n,customDimensionColors:C}),K=Xa(ot,_),U=o(G);E.push({dimension:c,dimensionValue:N,type:"scatter",rawDimension:G,rawMetric:l,label:U,borderColor:M=>k(M.raw)?R.outlier:ot,backgroundColor:M=>k(M.raw)?R.outlier:K,pointRadius:M=>k(M.raw)?y+_u:y,pointHoverRadius:M=>(k(M.raw)?y+_u:y)+cM,data:V,pointBorderWidth:0,showLine:!1,isSegmentEmpty:st})});const z=[];return S.forEach(N=>{const V=D.get(N.percentile);if(V===void 0||!Number.isFinite(V))return;const Y=N.percentile===xu;z.push({percentile:N.percentile,label:a(N.percentile,N.label),value:V,color:N.color||(Y?R.medianLine:R.outlier),borderDash:N.borderDash||(Y?dM:uM)})}),{datasets:E,...A?{outlier:{value:v,label:s.t("scatter.outlier",{label:a(p.outlierPercentile)}),color:R.outlier}}:{},...z.length?{referenceLines:z}:{}}}catch(r){return console.warn(r),{datasets:[]}}})}const mM=(e,t)=>{d.watch([e,t],(n,i,s)=>{const[o,a]=n;!a||!window||(window._AnalyticsChartDataInternal||(window._AnalyticsChartDataInternal=new Map),window._AnalyticsChartDataInternal.set(a,o),s(()=>{window._AnalyticsChartDataInternal?.delete(a)}))},{immediate:!0})};function pM(){const{i18n:e}=q.useI18n();return{translateUnit:(n,i)=>{const s=i===1,o=`chartUnits.${n}`;return zi(n)?"":e.te(o)?e.t(o,{plural:s?"":"s"}):n}}}function gM(){const e=d.inject(Df);return{evaluateFeatureFlag:(n,i)=>typeof e?.evaluateFeatureFlagFn!="function"?i:e.evaluateFeatureFlagFn(n,i)}}function wu(e,t){return d.getCurrentScope()?(d.onScopeDispose(e,t),!0):!1}const ku=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const yM=e=>e!=null,bM=Object.prototype.toString,_M=e=>bM.call(e)==="[object Object]";function Hs(e){return Array.isArray(e)?e:[e]}function xM(e){return d.getCurrentInstance()}function wM(e,t={}){if(!d.isRef(e))return d.toRefs(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const i in e.value)n[i]=d.customRef(()=>({get(){return e.value[i]},set(s){var o;if(!((o=d.toValue(t.replaceRef))!==null&&o!==void 0)||o)if(Array.isArray(e.value)){const a=[...e.value];a[i]=s,e.value=a}else{const a={...e.value,[i]:s};Object.setPrototypeOf(a,Object.getPrototypeOf(e.value)),e.value=a}else e.value[i]=s}}));return n}function kM(e,t=!0,n){xM()?d.onMounted(e,n):t?e():d.nextTick(e)}function TM(e,t,n){return d.watch(e,t,{...n,immediate:!0})}const $s=ku?window:void 0;function Nn(e){var t;const n=d.toValue(e);return(t=n?.$el)!==null&&t!==void 0?t:n}function Ni(...e){const t=(i,s,o,a)=>(i.addEventListener(s,o,a),()=>i.removeEventListener(s,o,a)),n=d.computed(()=>{const i=Hs(d.toValue(e[0])).filter(s=>s!=null);return i.every(s=>typeof s!="string")?i:void 0});return TM(()=>{var i,s;return[(i=(s=n.value)===null||s===void 0?void 0:s.map(o=>Nn(o)))!==null&&i!==void 0?i:[$s].filter(o=>o!=null),Hs(d.toValue(n.value?e[1]:e[0])),Hs(d.unref(n.value?e[2]:e[1])),d.toValue(n.value?e[3]:e[2])]},([i,s,o,a],r,l)=>{if(!i?.length||!s?.length||!o?.length)return;const c=_M(a)?{...a}:a,u=i.flatMap(h=>s.flatMap(f=>o.map(m=>t(h,f,m,c))));l(()=>{u.forEach(h=>h())})},{flush:"post"})}function vM(){const e=d.shallowRef(!1),t=d.getCurrentInstance();return t&&d.onMounted(()=>{e.value=!0},t),e}function Tu(e){const t=vM();return d.computed(()=>(t.value,!!e()))}function SM(e,t,n={}){const{window:i=$s,...s}=n;let o;const a=Tu(()=>i&&"MutationObserver"in i),r=()=>{o&&(o.disconnect(),o=void 0)},l=d.watch(d.computed(()=>{const h=Hs(d.toValue(e)).map(Nn).filter(yM);return new Set(h)}),h=>{r(),a.value&&h.size&&(o=new MutationObserver(t),h.forEach(f=>o.observe(f,s)))},{immediate:!0,flush:"post"}),c=()=>o?.takeRecords(),u=()=>{l(),r()};return wu(u),{isSupported:a,stop:u,takeRecords:c}}const Ys={speed:2,margin:30,direction:"both"};function MM(e){e.scrollLeft>e.scrollWidth-e.clientWidth&&(e.scrollLeft=Math.max(0,e.scrollWidth-e.clientWidth)),e.scrollTop>e.scrollHeight-e.clientHeight&&(e.scrollTop=Math.max(0,e.scrollHeight-e.clientHeight))}function DM(e,t={}){var n,i,s,o;const{pointerTypes:a,preventDefault:r,stopPropagation:l,exact:c,onMove:u,onEnd:h,onStart:f,initialValue:m,axis:p="both",draggingElement:g=$s,containerElement:y,handle:_=e,buttons:x=[0],restrictInView:T,autoScroll:S=!1}=t,w=d.ref((n=d.toValue(m))!==null&&n!==void 0?n:{x:0,y:0}),D=d.ref(),v=U=>a?a.includes(U.pointerType):!0,A=U=>{d.toValue(r)&&U.preventDefault(),d.toValue(l)&&U.stopPropagation()},R=d.toValue(S),E=typeof R=="object"?{speed:(i=d.toValue(R.speed))!==null&&i!==void 0?i:Ys.speed,margin:(s=d.toValue(R.margin))!==null&&s!==void 0?s:Ys.margin,direction:(o=R.direction)!==null&&o!==void 0?o:Ys.direction}:Ys,k=U=>typeof U=="number"?[U,U]:[U.x,U.y],C=(U,M,P)=>{const{clientWidth:F,clientHeight:$,scrollLeft:it,scrollTop:L,scrollWidth:H,scrollHeight:pt}=U,[dt,rt]=k(E.margin),[Dt,Wt]=k(E.speed);let Lt=0,Tt=0;(E.direction==="x"||E.direction==="both")&&(P.x<dt&&it>0?Lt=-Dt:P.x+M.width>F-dt&&it<H-F&&(Lt=Dt)),(E.direction==="y"||E.direction==="both")&&(P.y<rt&&L>0?Tt=-Wt:P.y+M.height>$-rt&&L<pt-$&&(Tt=Wt)),(Lt||Tt)&&U.scrollBy({left:Lt,top:Tt,behavior:"auto"})};let z=null;const N=()=>{const U=d.toValue(y);U&&!z&&(z=setInterval(()=>{const M=d.toValue(e).getBoundingClientRect(),{x:P,y:F}=w.value,$={x:P-U.scrollLeft,y:F-U.scrollTop};$.x>=0&&$.y>=0&&(C(U,M,$),$.x+=U.scrollLeft,$.y+=U.scrollTop,w.value=$)},1e3/60))},V=()=>{z&&(clearInterval(z),z=null)},Y=(U,M,P,F)=>{const[$,it]=typeof P=="number"?[P,P]:[P.x,P.y],{clientWidth:L,clientHeight:H}=M;return U.x<$||U.x+F.width>L-$||U.y<it||U.y+F.height>H-it},G=()=>{if(d.toValue(t.disabled)||!D.value)return;const U=d.toValue(y);if(!U)return;const M=d.toValue(e).getBoundingClientRect(),{x:P,y:F}=w.value,$={x:P-U.scrollLeft,y:F-U.scrollTop};Y($,U,E.margin,M)?N():V()};d.toValue(S)&&d.watch(w,G);const st=U=>{var M;if(!d.toValue(x).includes(U.button)||d.toValue(t.disabled)||!v(U)||d.toValue(c)&&U.target!==d.toValue(e))return;const P=d.toValue(y),F=P==null||(M=P.getBoundingClientRect)===null||M===void 0?void 0:M.call(P),$=d.toValue(e).getBoundingClientRect(),it={x:U.clientX-(P?$.left-F.left+(S?0:P.scrollLeft):$.left),y:U.clientY-(P?$.top-F.top+(S?0:P.scrollTop):$.top)};f?.(it,U)!==!1&&(D.value=it,A(U))},ot=U=>{if(d.toValue(t.disabled)||!v(U)||!D.value)return;const M=d.toValue(y);M instanceof HTMLElement&&MM(M);const P=d.toValue(e).getBoundingClientRect();let{x:F,y:$}=w.value;if((p==="x"||p==="both")&&(F=U.clientX-D.value.x,M&&(F=Math.min(Math.max(0,F),M.scrollWidth-P.width))),(p==="y"||p==="both")&&($=U.clientY-D.value.y,M&&($=Math.min(Math.max(0,$),M.scrollHeight-P.height))),d.toValue(S)&&M&&(z===null&&C(M,P,{x:F,y:$}),F+=M.scrollLeft,$+=M.scrollTop),M&&(T||S)){if(p!=="y"){const it=F-M.scrollLeft;it<0?F=M.scrollLeft:it>M.clientWidth-P.width&&(F=M.clientWidth-P.width+M.scrollLeft)}if(p!=="x"){const it=$-M.scrollTop;it<0?$=M.scrollTop:it>M.clientHeight-P.height&&($=M.clientHeight-P.height+M.scrollTop)}}w.value={x:F,y:$},u?.(w.value,U),A(U)},K=U=>{d.toValue(t.disabled)||!v(U)||D.value&&(D.value=void 0,S&&V(),h?.(w.value,U),A(U))};if(ku){const U=()=>{var M;return{capture:(M=t.capture)!==null&&M!==void 0?M:!0,passive:!d.toValue(r)}};Ni(_,"pointerdown",st,U),Ni(g,"pointermove",ot,U),Ni(g,["pointerup","pointercancel"],K,U)}return{...wM(w),position:w,isDragging:d.computed(()=>!!D.value),style:d.computed(()=>`
4
4
  left: ${w.value.x}px;
5
5
  top: ${w.value.y}px;
6
- ${v?"text-wrap: nowrap;":""}
7
- `)}}function MM(e,t,n={}){const{window:i=$s,...s}=n;let o;const a=Td(()=>i&&"ResizeObserver"in i),r=()=>{o&&(o.disconnect(),o=void 0)},l=u.watch(u.computed(()=>{const d=u.toValue(e);return Array.isArray(d)?d.map(h=>Nn(h)):[Nn(d)]}),d=>{if(r(),a.value&&i){o=new ResizeObserver(t);for(const h of d)h&&o.observe(h,s)}},{immediate:!0,flush:"post"}),c=()=>{r(),l()};return wd(c),{isSupported:a,stop:c}}function DM(e,t={}){const{reset:n=!0,windowResize:i=!0,windowScroll:s=!0,immediate:o=!0,updateTiming:a="sync"}=t,r=u.shallowRef(0),l=u.shallowRef(0),c=u.shallowRef(0),d=u.shallowRef(0),h=u.shallowRef(0),f=u.shallowRef(0),m=u.shallowRef(0),p=u.shallowRef(0);function g(){const _=Nn(e);if(!_){n&&(r.value=0,l.value=0,c.value=0,d.value=0,h.value=0,f.value=0,m.value=0,p.value=0);return}const x=_.getBoundingClientRect();r.value=x.height,l.value=x.bottom,c.value=x.left,d.value=x.right,h.value=x.top,f.value=x.width,m.value=x.x,p.value=x.y}function y(){a==="sync"?g():a==="next-frame"&&requestAnimationFrame(()=>g())}return MM(e,y),u.watch(()=>Nn(e),_=>!_&&y()),TM(e,y,{attributeFilter:["style","class"]}),s&&Ni("scroll",y,{capture:!0,passive:!0}),i&&Ni("resize",y,{passive:!0}),xM(()=>{o&&y()}),{height:r,bottom:l,left:c,right:d,top:h,width:f,x:m,y:p,update:y}}function CM(e,t){const{top:n,left:i}=DM(e),s=u.computed(()=>e.value?`${parseFloat(t.left)+i.value}px`:t.left),o=u.computed(()=>e.value?`${parseFloat(t.top)+n.value}px`:t.top);return{tooltipAbsoluteLeft:s,tooltipAbsoluteTop:o}}const OM=({bucketCount:e,minStamp:t,maxStamp:n,timestamps:i})=>{const s=[...i].filter(l=>l>=t&&l<=n).sort((l,c)=>l-c),o=[];if(n-t<e-2)return[];const a=(n-t)/e;let r=0;for(let l=0;l<e;l++){const c=t+l*a,d=t+(l+1)*a;let h=0;for(;r<s.length&&s[r]>=c&&s[r]<=d;)h++,r++;o.push([Math.ceil(c),h])}return o},Sd=()=>({minCounts:{},maxCounts:{},minStamps:{},maxStamps:{},renderPoints:{}}),Bi=u.ref({}),AM=e=>(Bi.value[e]||(Bi.value[e]=Sd()),Bi.value[e]),PM=(e,t)=>{const n=Bi.value[t];if(!n)return;const i=n.minCounts[e]!==void 0||n.maxCounts[e]!==void 0||n.minStamps[e]!==void 0||n.maxStamps[e]!==void 0||n.renderPoints[e]!==void 0;n&&i&&(delete n.minCounts[e],delete n.maxCounts[e],delete n.minStamps[e],delete n.maxStamps[e],delete n.renderPoints[e],Object.keys(n.minCounts).length||Object.keys(n.maxCounts).length||Object.keys(n.minStamps).length||Object.keys(n.maxStamps).length||Object.keys(n.renderPoints).length||delete Bi.value[t])};function EM({chartKey:e,datasets:t,groupKey:n,minStamp:i=void 0,maxStamp:s=void 0,minCount:o=void 0,maxCount:a=void 0,renderPoints:r=void 0,type:l}){const d=n!==void 0&&e!==void 0?AM(n):Sd(),h=e!==void 0?e:"static-chart-key",f=u.computed(()=>t.reduce((E,{timestamps:k})=>[...E,...k],[])),m=u.computed(()=>i||f.value.reduce((E,k)=>E===0?k:Math.min(E,k),0)),p=u.computed(()=>s||f.value.reduce((E,k)=>Math.max(E,k),0));u.watchEffect(()=>{d.minStamps[h]=m.value,d.maxStamps[h]=p.value,r!==void 0&&(d.renderPoints[h]=r)});const g=u.computed(()=>Object.values(d.minStamps).reduce((E,k)=>E===0?k:Math.min(E,k),0)),y=u.computed(()=>Object.values(d.maxStamps).reduce((E,k)=>Math.max(E,k),0)),_=u.computed(()=>{const E=Object.values(d.renderPoints);return E.length===0?24:E.reduce((k,C)=>Math.max(k,C),2)}),x=u.computed(()=>{const E=y.value-g.value;return Math.ceil(E/_.value)}),T=u.computed(()=>t.length>1),v=u.computed(()=>t.map(({timestamps:E,color:k,label:C})=>({data:OM({bucketCount:_.value,minStamp:g.value,maxStamp:y.value,timestamps:E}).map(([V,Y])=>({x:V,y:Y})),label:C,...(l==="sparkline_bar"||T.value)&&k&&{backgroundColor:k},...l!=="sparkline_bar"&&k&&{borderColor:k},...T.value&&l!=="sparkline_bar"&&{fill:!0}}))),w=u.computed(()=>{const E=v.value[0]?.data?.length??0,k=[];for(let C=0;C<E;C++){let z=0;for(let N=0;N<v.value.length;N++)z+=v.value[N].data[C].y;k.push(z)}return k}),D=u.computed(()=>{const E=w.value.reduce((k,C)=>Math.max(k,C),0);return Math.max(E,a??0)}),S=u.computed(()=>{const E=v.value.reduce((z,{data:N})=>[...z,...N.map(({y:V})=>V)],[]),k=E.length?E[0]:0,C=E.reduce((z,N)=>Math.min(z,N),k);return o===void 0?C:Math.min(C,o)});u.watchEffect(()=>{d.maxCounts[h]=D.value,d.minCounts[h]=S.value});const A=u.computed(()=>{const E=Object.values(d.minCounts),k=E.length?E[0]:0;return E.reduce((C,z)=>Math.min(C,z),k)}),R=u.computed(()=>Object.values(d.maxCounts).reduce((E,k)=>Math.max(E,k),0));return u.onUnmounted(()=>{e!==void 0&&n!==void 0&&PM(e,n)}),{syncedMinStamp:g,syncedMaxStamp:y,syncedRenderPoints:_,syncedChartDatasets:v,syncedGroupSizeMs:x,syncedMinCount:A,syncedMaxCount:R}}const ln=(e,t)=>{if(!e||!t)return;const n=t.toLowerCase();return e[t]??Object.entries(e).find(([i])=>i.toLowerCase()===n)?.[1]},Bn=e=>{if(e==null||e==="")return null;const t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:null},Aa=e=>e.reduce((t,n)=>n===null?t:{sum:t.sum+n,max:Math.max(t.max,n)},{sum:0,max:0}),Pa=(e,t)=>t.sum>0?e/t.sum:null,vd=(e,t,n)=>{const i=n==="relative"?t.sum:t.max;return i<=0?0:Math.min(Math.max(e/i,0),1)},Ea=(e,t)=>{const n=(t??[]).filter(o=>e>=o.value);if(!n.length)return;const i=Math.max(...n.map(o=>o.value));return n.filter(o=>o.value===i).some(o=>o.type==="error")?"error":"warning"},Md=18,RM=85;function IM(e,t,n,i){const{i18n:s}=Vo(),{formatUnit:o}=le({i18n:s}),a=q.useFieldLabel(),r=w=>w.map(D=>{const S=Math.min(D.ratio,.5)/.5;return{...D,color:pe({discriminator:0}),tint:`${Md+S*(RM-Md)}%`}}),l=u.computed(()=>e.value?.data??[]),c=u.computed(()=>e.value?.meta?.metric_names??[]),d=u.computed(()=>{const w=n.value;return w&&c.value.includes(w)?w:c.value[0]}),h=u.computed(()=>c.value.filter(w=>w!==d.value)),f=u.computed(()=>e.value?.meta?.display?.[t.value]??{}),m=(w,D)=>{if(zi(w)||w==="count"||w==="requests")return"";const S=D===1?"":"s";return s.te(`chartUnits.${w}`)?s.t(`chartUnits.${w}`,{plural:S}):w},p=w=>{const D=S=>o(S,"%",{translateUnit:A=>m(A,S)});return w>0&&w<.01?`< ${D(.01)}`:D(w)},g=(w,D)=>{if(w===null)return"–";const S=e.value?.meta?.metric_units?.[D]||"count";return S==="%"?p(w):o(w,S,{isBytes1024:!0,translateUnit:A=>m(A,w)})},y=w=>ln(i.value,w)?.label||a(w),_=u.computed(()=>Aa(l.value.map(w=>d.value?Bn(w.event[d.value]):null))),x=w=>h.value.flatMap(D=>{const S=Bn(w[D]);if(S===null)return[];const A=Ea(S,ln(i.value,D)?.thresholds);return[{key:D,label:y(D),value:g(S,D),threshold:A}]}),T=u.computed(()=>{if(!d.value)return[];const w=l.value.map(D=>{const S=D.event,A=String(S[t.value]),R=Bn(S[d.value])??0,E=Pa(R,_.value),k=E??0,C=A===mo;return{id:A,name:C?s.t(`chartLabels.${mo}`):f.value[A]?.name||A,deleted:!!f.value[A]?.deleted,isOther:C,isEmpty:A===Cf,value:R,ratio:k,display:g(R,d.value),relative:E===null?"":p(E*100),tooltipRows:x(S)}}).sort((D,S)=>Number(D.isOther)-Number(S.isOther)||S.value-D.value);return r(w)});return{column:u.computed(()=>({dimension:t.value,label:y(t.value),total:g(_.value.sum,d.value??"count"),cells:T.value})),cells:T,sizeKey:d}}const LM=(e,t,n,{prefix:i="chartLabels",fallback:s=n}={})=>{const o=`${i}.${n}`;return t.get(n)||(e.te(o)?e.t(o):s)};function NM(){const{i18n:e}=Vo(),t=Mr.useDatasourceConfigStore();return(n,i)=>LM(e,t.fieldTranslationMap,n,i)}const q={useBarChartOptions:pS,useChartJSCommon:yS,useChartLegendValues:_S,useExploreResultToDatasets:tM,useExploreResultToTimeDataset:sM,useScatterDatasets:dM,useDonutChartOptions:xS,useLineChartOptions:wS,useScatterChartOptions:SS,useI18n:Vo,useFieldLabel:NM,useReportChartDataForSynthetics:hM,useTranslatedUnits:fM,useEvaluateFeatureFlag:mM,useTooltipAbsolutePosition:CM,useSparklineSync:EM,useTopTalkersData:IM},Ws=e=>["interactive","zoom-interactive"].includes(e),Ra=(e,t,n,i)=>{const{tooltip:s}=t;if(s.opacity===0&&!Ws(e.interactionMode)){e.showTooltip=!1;return}const{i18n:o}=q.useI18n(),{formatUnit:a}=le({i18n:o}),r=e.chartTooltipSortFn||((l,c)=>c.rawValue-l.rawValue);if(s.body&&!Ws(e.interactionMode)){const l=s.labelColors,c=t.chart.config?.options?.indexAxis==="y"?"x":"y",d=s.dataPoints[0].parsed.x??0;e.tooltipContext=i?.contextFormatter?i.contextFormatter(d,n,s.dataPoints[0].raw):Un({tickValue:new Date(d),granularity:n}),e.tooltipSeries=s.dataPoints.map((f,m)=>{const p=f.parsed[c],g=f.dataset.unit??e.units,y=a(p??0,g,{translateUnit:e.translateUnit}),_=f.raw?.tooltipLabel||f.dataset.label;return{backgroundColor:l[m].backgroundColor,borderColor:l[m].borderColor,label:_,value:y,rawValue:p,isSegmentEmpty:f.dataset.isSegmentEmpty}}).sort(r);const h=s.dataPoints[0]?.raw?.extras??[];for(const f of h)e.tooltipSeries.push({label:f.label,value:f.unit?a(Number(f.value)||0,f.unit,{translateUnit:e.translateUnit}):String(f.value),rawValue:Number(f.value)||0,isExtra:!0});e.left=`${s.x}px`,e.top=`${s.y}px`,e.showTooltip=!0}},Dd=(e,t)=>{const{tooltip:n}=t,{i18n:i}=q.useI18n(),{formatUnit:s}=le({i18n:i});if(n.opacity===0&&!Ws(e.interactionMode)){e.showTooltip=!1;return}const o=e.chartTooltipSortFn||((a,r)=>r.rawValue-a.rawValue);if(n.body&&!Ws(e.interactionMode)){const a=n.labelColors,r=t.chart.config?.options?.indexAxis==="y"?"x":"y",l=["gauge","donut"].includes(e.chartType);l?e.tooltipContext=e.dimensionDisplay||n.dataPoints[0].label:n.chart.data.isMultiDimension?e.tooltipContext=n.dataPoints[0].label:e.tooltipContext=e.dimensionDisplay||"",e.tooltipSeries=n.dataPoints.map((c,d)=>{const h=l?c.parsed:c.parsed[r],f=s(h??0,e.units,{translateUnit:e.translateUnit});let m;return l?m=c.dataset.labels[c.dataIndex]:m=c.dataset.label,{backgroundColor:a[d].backgroundColor,borderColor:a[d].borderColor,label:m,value:f,rawValue:h,isSegmentEmpty:c.dataset.isSegmentEmpty}}).sort(o),e.left=`${n.x}px`,e.top=`${n.y}px`,e.showTooltip=!0}},BM=e=>e&&e.datasets&&e.datasets.length,FM=e=>BM(e)&&e.datasets.some(t=>t.data.length),zM=e=>e.datasets.some(t=>t.data[0]&&Eo(t.data[0].x)),UM=e=>!!FM(e)&&e.datasets.some(t=>t.data.length==1),VM=e=>zM(e)&&e.datasets.some(t=>t.data[0]&&(t.data[0].x??0).toString().length>=13),js=(e,t,n)=>{const s=Math.min(t/1150,1),o=.15,a=1.15,r=e.x??0;return r<n?r+t*o*(1-s):r-t*a*(1-s)},Cd=(e,t,n)=>{const o=e.y??0;return o<n?o+t*.15:o-t*.5};function Od(e,t){let n;return(...i)=>{clearTimeout(n),n=window.setTimeout(()=>{e(...i)},t)}}const Ia=(e,t,n)=>{const i=e.data;return e.options.plugins.legend.labels.generateLabels(e).filter(s=>!t?.[s.text]?.isThreshold).map(((s,o)=>({...s,value:t&&t[s.text],isSegmentEmpty:i.datasets[o].isSegmentEmpty}))).sort(n)},HM=2,Ad=10,Pd=12,qs=10,Gs="y",La="y1",$M={lineTension:0,pointBorderWidth:1.2,borderJoinStyle:"round",fill:!0},YM=2,WM=0,Na=new Map,Ed=(e,t)=>{const{i18n:n}=q.useI18n(),{formatBytes:i}=le({i18n:n});return t==="bytes"?i(e):t==="count/minute"?e.toFixed(2):ss.format(e)},jM=e=>{const n=document.createElement("canvas").getContext("2d"),i=xt({});return n.font=i.string,n.measureText(e).width},qM=()=>{const e="label_height";if(!Na.has(e)){const t=xt({});Na.set(e,t.lineHeight)}return Na.get(e)},GM=(e,t)=>t.datasets.reduce((n,i,s)=>e.isDatasetVisible(s)?n+i.data.reduce((o,a)=>isNaN(a)?o:o+a,0):n,0),XM=(e,t)=>t===0?" (0.0%)":` (${(e/t*100).toFixed(1)}%)`,KM=Zp,ZM={100:ig,101:sg,102:og,103:ag,200:rg,201:lg,202:cg,203:ug,204:dg,205:hg,206:fg,207:mg,208:pg,226:gg,300:yg,301:bg,302:_g,303:xg,304:wg,305:kg,307:Tg,308:Sg,400:vg,401:Mg,402:Dg,403:Cg,404:Og,405:Ag,406:Pg,407:Eg,408:Rg,409:Ig,410:Lg,411:Ng,412:Bg,413:Fg,414:zg,415:Ug,416:Vg,417:Hg,418:$g,421:Yg,422:Wg,423:jg,424:qg,425:Gg,426:Xg,428:Kg,429:Zg,431:Qg,451:Jg,500:ty,501:ey,502:ny,503:iy,504:sy,505:oy,506:ay,507:ry,508:ly,510:cy,511:uy},QM={100:dy,200:hy,300:fy,400:my,500:py},JM={"1XX":gy,"2XX":yy,"3XX":by,"4XX":_y,"5XX":xy},Rd=e=>{const t=parseInt(e,10),n=Math.floor(t/100)*100;return ZM[t]??QM[n]??KM},t1={...Array.from({length:500},(e,t)=>100+t).reduce((e,t)=>(e[`${t}`]=Rd(`${t}`),e),{}),____OTHER____:Kp,...JM};function Id(e,t,n){const i=Ll(),s=i1(e,n.timeZone,n.locale??i.locale);return"formatToParts"in s?e1(s,t):n1(s,t)}function e1(e,t){const n=e.formatToParts(t);for(let i=n.length-1;i>=0;--i)if(n[i].type==="timeZoneName")return n[i].value}function n1(e,t){const n=e.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(n);return i?i[0].substr(1):""}function i1(e,t,n){return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}function s1(e,t){const n=c1(t);return"formatToParts"in n?a1(n,e):r1(n,e)}const o1={year:0,month:1,day:2,hour:3,minute:4,second:5};function a1(e,t){try{const n=e.formatToParts(t),i=[];for(let s=0;s<n.length;s++){const o=o1[n[s].type];o!==void 0&&(i[o]=parseInt(n[s].value,10))}return i}catch(n){if(n instanceof RangeError)return[NaN];throw n}}function r1(e,t){const n=e.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(i[3],10),parseInt(i[1],10),parseInt(i[2],10),parseInt(i[4],10),parseInt(i[5],10),parseInt(i[6],10)]}const Ba={},Ld=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),l1=Ld==="06/25/2014, 00:00:00"||Ld==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";function c1(e){return Ba[e]||(Ba[e]=l1?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),Ba[e]}function Nd(e,t,n,i,s,o,a){const r=new Date(0);return r.setUTCFullYear(e,t,n),r.setUTCHours(i,s,o,a),r}const Bd=36e5,u1=6e4,Fa={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function za(e,t,n){if(!e)return 0;let i=Fa.timezoneZ.exec(e);if(i)return 0;let s,o;if(i=Fa.timezoneHH.exec(e),i)return s=parseInt(i[1],10),Fd(s)?-(s*Bd):NaN;if(i=Fa.timezoneHHMM.exec(e),i){s=parseInt(i[2],10);const a=parseInt(i[3],10);return Fd(s,a)?(o=Math.abs(s)*Bd+a*u1,i[1]==="+"?-o:o):NaN}if(f1(e)){t=new Date(t||Date.now());const a=n?t:d1(t),r=Ua(a,e);return-(n?r:h1(t,r,e))}return NaN}function d1(e){return Nd(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function Ua(e,t){const n=s1(e,t),i=Nd(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime();let s=e.getTime();const o=s%1e3;return s-=o>=0?o:1e3+o,i-s}function h1(e,t,n){let s=e.getTime()-t;const o=Ua(new Date(s),n);if(t===o)return t;s-=o-t;const a=Ua(new Date(s),n);return o===a?o:Math.max(o,a)}function Fd(e,t){return-23<=e&&e<=23&&(t==null||0<=t&&t<=59)}const zd={};function f1(e){if(zd[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),zd[e]=!0,!0}catch{return!1}}const m1=60*1e3,p1={X:function(e,t,n){const i=Va(n.timeZone,e);if(i===0)return"Z";switch(t){case"X":return Ud(i);case"XXXX":case"XX":return Fn(i);default:return Fn(i,":")}},x:function(e,t,n){const i=Va(n.timeZone,e);switch(t){case"x":return Ud(i);case"xxxx":case"xx":return Fn(i);default:return Fn(i,":")}},O:function(e,t,n){const i=Va(n.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+g1(i,":");default:return"GMT"+Fn(i,":")}},z:function(e,t,n){switch(t){case"z":case"zz":case"zzz":return Id("short",e,n);default:return Id("long",e,n)}}};function Va(e,t){const n=e?za(e,t,!0)/m1:t?.getTimezoneOffset()??0;if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+e);return n}function Xs(e,t){const n=e<0?"-":"";let i=Math.abs(e).toString();for(;i.length<t;)i="0"+i;return n+i}function Fn(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=Xs(Math.floor(i/60),2),o=Xs(Math.floor(i%60),2);return n+s+t+o}function Ud(e,t){return e%60===0?(e>0?"-":"+")+Xs(Math.abs(e)/60,2):Fn(e,t)}function g1(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=Math.floor(i/60),o=i%60;return o===0?n+String(s):n+String(s)+t+Xs(o,2)}function Vd(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const y1=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Ha=36e5,Hd=6e4,b1=2,qt={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:y1};function $d(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(e===null)return new Date(NaN);const n=t.additionalDigits==null?b1:Number(t.additionalDigits);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]")return new Date(e.getTime());if(typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]")return new Date(e);if(Object.prototype.toString.call(e)!=="[object String]")return new Date(NaN);const i=_1(e),{year:s,restDateString:o}=x1(i.date,n),a=w1(o,s);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const r=a.getTime();let l=0,c;if(i.time&&(l=k1(i.time),l===null||isNaN(l)))return new Date(NaN);if(i.timeZone||t.timeZone){if(c=za(i.timeZone||t.timeZone,new Date(r+l)),isNaN(c))return new Date(NaN)}else c=Vd(new Date(r+l)),c=Vd(new Date(r+l+c));return new Date(r+l+c)}else return new Date(NaN)}function _1(e){const t={};let n=qt.dateTimePattern.exec(e),i;if(n?(t.date=n[1],i=n[3]):(n=qt.datePattern.exec(e),n?(t.date=n[1],i=n[2]):(t.date=null,i=e)),i){const s=qt.timeZone.exec(i);s?(t.time=i.replace(s[1],""),t.timeZone=s[1].trim()):t.time=i}return t}function x1(e,t){if(e){const n=qt.YYY[t],i=qt.YYYYY[t];let s=qt.YYYY.exec(e)||i.exec(e);if(s){const o=s[1];return{year:parseInt(o,10),restDateString:e.slice(o.length)}}if(s=qt.YY.exec(e)||n.exec(e),s){const o=s[1];return{year:parseInt(o,10)*100,restDateString:e.slice(o.length)}}}return{year:null}}function w1(e,t){if(t===null)return null;let n,i,s;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let o=qt.MM.exec(e);if(o)return n=new Date(0),i=parseInt(o[1],10)-1,jd(t,i)?(n.setUTCFullYear(t,i),n):new Date(NaN);if(o=qt.DDD.exec(e),o){n=new Date(0);const a=parseInt(o[1],10);return v1(t,a)?(n.setUTCFullYear(t,0,a),n):new Date(NaN)}if(o=qt.MMDD.exec(e),o){n=new Date(0),i=parseInt(o[1],10)-1;const a=parseInt(o[2],10);return jd(t,i,a)?(n.setUTCFullYear(t,i,a),n):new Date(NaN)}if(o=qt.Www.exec(e),o)return s=parseInt(o[1],10)-1,qd(s)?Yd(t,s):new Date(NaN);if(o=qt.WwwD.exec(e),o){s=parseInt(o[1],10)-1;const a=parseInt(o[2],10)-1;return qd(s,a)?Yd(t,s,a):new Date(NaN)}return null}function k1(e){let t,n,i=qt.HH.exec(e);if(i)return t=parseFloat(i[1].replace(",",".")),$a(t)?t%24*Ha:NaN;if(i=qt.HHMM.exec(e),i)return t=parseInt(i[1],10),n=parseFloat(i[2].replace(",",".")),$a(t,n)?t%24*Ha+n*Hd:NaN;if(i=qt.HHMMSS.exec(e),i){t=parseInt(i[1],10),n=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return $a(t,n,s)?t%24*Ha+n*Hd+s*1e3:NaN}return null}function Yd(e,t,n){t=t||0,n=n||0;const i=new Date(0);i.setUTCFullYear(e,0,4);const s=i.getUTCDay()||7,o=t*7+n+1-s;return i.setUTCDate(i.getUTCDate()+o),i}const T1=[31,28,31,30,31,30,31,31,30,31,30,31],S1=[31,29,31,30,31,30,31,31,30,31,30,31];function Wd(e){return e%400===0||e%4===0&&e%100!==0}function jd(e,t,n){if(t<0||t>11)return!1;if(n!=null){if(n<1)return!1;const i=Wd(e);if(i&&n>S1[t]||!i&&n>T1[t])return!1}return!0}function v1(e,t){if(t<1)return!1;const n=Wd(e);return!(n&&t>366||!n&&t>365)}function qd(e,t){return!(e<0||e>52||t!=null&&(t<0||t>6))}function $a(e,t,n){return!(e<0||e>=25||t!=null&&(t<0||t>=60)||n!=null&&(n<0||n>=60))}const M1=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function D1(e,t,n={}){t=String(t);const i=t.match(M1);if(i){const s=$d(n.originalDate||e,n);t=i.reduce(function(o,a){if(a[0]==="'")return o;const r=o.indexOf(a),l=o[r-1]==="'",c=o.replace(a,"'"+p1[a[0]](s,a,n)+"'");return l?c.substring(0,r-1)+c.substring(r+1):c},t)}return rs(e,t,n)}function C1(e,t,n){e=$d(e,n);const i=za(t,e,!0),s=new Date(e.getTime()-i),o=new Date(0);return o.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),o.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),o}function Fi(e,t,n,i){return i={...i,timeZone:t,originalDate:e},D1(C1(e,t,{timeZone:i.timeZone}),n,i)}const O1=(e,t)=>`${Fi(e,t,"yyyy")} W${Fi(e,t,"II")}`,Ya="MMM dd, h:mm:ss a",Wa="h:mm:ss a",cn="MMM dd, h:mm a",zn="h:mm a",A1="MMM dd",ja="MMM dd, h:mm:ss a",He="MMM dd, h:mm a",P1={secondly:e=>e?Ya:Wa,tenSecondly:e=>e?Ya:Wa,thirtySecondly:e=>e?Ya:Wa,minutely:e=>e?cn:zn,fiveMinutely:e=>e?cn:zn,tenMinutely:e=>e?cn:zn,thirtyMinutely:e=>e?cn:zn,hourly:e=>e?cn:zn,twoHourly:e=>e?cn:zn,twelveHourly:()=>cn,daily:()=>A1},E1={secondly:()=>ja,tenSecondly:()=>ja,thirtySecondly:()=>ja,minutely:()=>He,fiveMinutely:()=>He,tenMinutely:()=>He,thirtyMinutely:()=>He,hourly:()=>He,twoHourly:()=>He,twelveHourly:()=>He,daily:()=>He};function Gd({tickValue:e,granularity:t,timezone:n,dayBoundaryCrossed:i=!1,tickMap:s,tooltipMap:o,defaultFormat:a}){const r=n||Intl.DateTimeFormat().resolvedOptions().timeZone;if(t==="weekly")return O1(e,r);if(s&&s[t]){const l=s[t](i);return Fi(e,r,l)}if(o&&o[t]){const l=o[t]();return Fi(e,r,l)}return Fi(e,r,a)}const qa=({tickValue:e,granularity:t,dayBoundaryCrossed:n,timezone:i})=>Gd({tickValue:e,granularity:t,timezone:i,dayBoundaryCrossed:n,tickMap:P1,defaultFormat:"MMM dd, h:mm:ss a"}),Un=({tickValue:e,granularity:t,timezone:n})=>Gd({tickValue:e,granularity:t,timezone:n,tooltipMap:E1,defaultFormat:"MMM dd, yyyy h:mm:ss a"}),Xd=e=>e?.code==="ERR_CANCELED"||e?.name==="CanceledError"||e?.name==="AbortError",R1=e=>{const{i18n:t}=q.useI18n();return Xd(e)?{type:"canceled",message:t.t("query_errors.canceled.message")}:e?.status===403?{status:e.status,type:"forbidden",message:t.t("query_errors.forbidden.message"),details:t.t("query_errors.forbidden.details")}:e?.status===408||e?.message?.includes("timeout")?{status:e.status,type:"timeout",message:t.t("query_errors.timeout.message"),details:t.t("query_errors.timeout.details")}:e?.response?.data?.message==="Range not allowed for this tier"?{status:e.status,type:"range_exceeded",message:t.t("query_errors.time_range_exceeded.message"),details:t.t("query_errors.time_range_exceeded.details")}:{status:e.status,type:"other",message:t.t("query_errors.other.message"),details:e.response?.data?.invalid_parameters?.map(n=>n.reason).join(", ")||e?.message}},zi=e=>e.toLocaleLowerCase().endsWith("count"),I1=e=>{const t=e.toLocaleLowerCase();return["sum","count","cost","tokens"].some(n=>t.endsWith(n))},L1=(e,t)=>{if(!e.length)return NaN;const i=Math.min(100,Math.max(0,t))/100*(e.length-1),s=Math.floor(i),o=Math.ceil(i);return s===o?e[s]:e[s]+(e[o]-e[s])*(i-s)},N1=(e,t)=>{const n=e.filter(i=>Number.isFinite(i)).sort((i,s)=>i-s);return new Map(t.map(i=>[i,L1(n,i)]))},Kd=.7,Ga=(e,t)=>{const n=xs(e.trim());return n.valid?n.alpha(t).rgbString():e},Xa=e=>{const t=e??(typeof document>"u"?null:document.documentElement);if(typeof window>"u"||!t)return{medianLine:hl,outlier:ul,outlierBand:Ga(dl,Kd)};const n=window.getComputedStyle(t),i=(s,o)=>n.getPropertyValue(s).trim()||o;return{medianLine:i("--kui-color-text",hl),outlier:i("--kui-color-background-danger",ul),outlierBand:Ga(i("--kui-color-background-danger-weakest",dl),Kd)}},B1="empty",Zd=e=>{if(!e||!("meta"in e)||!("data"in e))return;const{display:t,metric_names:n,metric_units:i,start:s,end:o,truncated:a,limit:r,datasource:l}=e.meta;if(!n?.length){console.error("Cannot build scatter chart data from this explore result. Missing metric names.");return}const c=n.length>1?n[0]:void 0,d=c?n[1]:n[0],h=t&&Object.keys(t)[0]||void 0,f=e.data??[],m=[];for(const p of f){const g=Jd(p.timestamp,p.event[d],h?p.event[h]:void 0);if(g){if(c){const y=Qd(p.event[c]);if(y===void 0)continue;g.x=y}m.push(g)}}return{points:m,metric:d,metricUnit:i?.[d],...c?{xMetric:c,xMetricUnit:i?.[c]}:{},dimension:h,display:h?t?.[h]:void 0,start:s,end:o,truncated:a,limit:r,datasource:l}},Qd=e=>{if(e==null||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0},Jd=(e,t,n,i)=>{const s=new Date(e).valueOf(),o=Qd(t);if(!Number.isFinite(s)||o===void 0)return;const a=i?.length?{extras:i}:{};return n===void 0?{timestamp:s,value:o,...a}:{timestamp:s,value:o,group:n!==null&&n!==""?String(n):B1,...a}},F1=(e,t,n)=>{if(!n?.length)return;const i=[];for(const{field:s,label:o,unit:a}of n){const r=un(e,s)??un(t,s);r==null||r===""||i.push({label:o??s,value:r,...a?{unit:a}:{}})}return i.length?i:void 0},z1=(e,t)=>{if(!e||!("meta"in e))return;const{metric:n,dimension:i,unroll:s,display:o,extraFields:a,metricUnit:r}=t,l=t.timestamp??"request_start";if(!n){console.error("Cannot build scatter chart data from these request records. Missing metric.");return}const c=[];for(const d of e.results??[]){const h=un(d,l);for(const f of U1(d,s)){const m=un(f,n),p=i?un(f,i)??un(d,i):void 0,g=Jd(h,m,i?p??null:void 0,F1(f,d,a));g&&c.push(g)}}return{points:c,metric:n,metricUnit:r,dimension:i,display:o,start:e.meta?.time_range?.start,end:e.meta?.time_range?.end,truncated:e.truncated,limit:e.limit,datasource:"requests"}},U1=(e,t)=>{if(!t)return[e];const n=un(e,t);return Array.isArray(n)?n:[]},un=(e,t)=>{let n=e;for(const i of t.split(".")){if(n===null||typeof n!="object")return;n=n[i]}return n},V1=["hidden","single","full"],H1=["donut","horizontal_bar","vertical_bar","timeseries_line","timeseries_bar","scatter"],$1=["gauge","top_n","single_value"],Ka=e=>e===null||typeof e!="object"||!("points"in e)?!1:Array.isArray(e.points);var Nt=(e=>(e.Hidden="hidden",e.Bottom="bottom",e))(Nt||{});const th={modes:{point(e,t){return Ks(e,t,{intersect:!0})},nearest(e,t,n){return j1(e,t,n)},x(e,t,n){return Ks(e,t,{intersect:n.intersect,axis:"x"})},y(e,t,n){return Ks(e,t,{intersect:n.intersect,axis:"y"})}}};function Za(e,t,n){return(th.modes[n.mode]||th.modes.nearest)(e,t,n)}function Y1(e,t,n){return n!=="x"&&n!=="y"?e.inRange(t.x,t.y,"x",!0)||e.inRange(t.x,t.y,"y",!0):e.inRange(t.x,t.y,n,!0)}function W1(e,t,n){return n==="x"?{x:e.x,y:t.y}:n==="y"?{x:t.x,y:e.y}:t}function Ks(e,t,n){return e.filter(i=>n.intersect?i.inRange(t.x,t.y):Y1(i,t,n.axis))}function j1(e,t,n){let i=Number.POSITIVE_INFINITY;return Ks(e,t,n).reduce((s,o)=>{const a=o.getCenterPoint(),r=W1(t,a,n.axis),l=On(t,r);return l<i?(s=[o],i=l):l===i&&s.push(o),s},[]).sort((s,o)=>s._index-o._index).slice(0,1)}function dn(e,t,n){const i=Math.cos(n),s=Math.sin(n),o=t.x,a=t.y;return{x:o+i*(e.x-o)-s*(e.y-a),y:a+s*(e.x-o)+i*(e.y-a)}}const q1=(e,t)=>t>e||e.length>t.length&&e.slice(0,t.length)===t,hn=.001,Zs=(e,t,n)=>Math.min(n,Math.max(t,e)),eh=(e,t)=>e.value>=e.start-t&&e.value<=e.end+t;function G1(e,t,n){for(const i of Object.keys(e))e[i]=Zs(e[i],t,n);return e}function X1(e,t,n,i){return!e||!t||n<=0?!1:Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)<=Math.pow(n+i,2)}function nh(e,{x:t,y:n,x2:i,y2:s},o,{borderWidth:a,hitTolerance:r}){const l=(a+r)/2,c=e.x>=t-l-hn&&e.x<=i+l+hn,d=e.y>=n-l-hn&&e.y<=s+l+hn;return o==="x"?c:(o==="y"||c)&&d}function ih(e,{rect:t,center:n},i,{rotation:s,borderWidth:o,hitTolerance:a}){const r=dn(e,n,At(-s));return nh(r,t,i,{borderWidth:o,hitTolerance:a})}function fn(e,t){const{centerX:n,centerY:i}=e.getProps(["centerX","centerY"],t);return{x:n,y:i}}function K1(e,t,n,i=!0){const s=n.split(".");let o=0;for(const a of t.split(".")){const r=s[o++];if(parseInt(a,10)<parseInt(r,10))break;if(q1(r,a)){if(i)throw new Error(`${e} v${n} is not supported. v${t} or newer is required.`);return!1}}return!0}const sh=e=>typeof e=="string"&&e.endsWith("%"),oh=e=>parseFloat(e)/100,ah=e=>Zs(oh(e),0,1),Ui=(e,t)=>({x:e,y:t,x2:e,y2:t,width:0,height:0}),Z1={box:e=>Ui(e.centerX,e.centerY),doughnutLabel:e=>Ui(e.centerX,e.centerY),ellipse:e=>({centerX:e.centerX,centerY:e.centerX,radius:0,width:0,height:0}),label:e=>Ui(e.centerX,e.centerY),line:e=>Ui(e.x,e.y),point:e=>({centerX:e.centerX,centerY:e.centerY,radius:0,width:0,height:0}),polygon:e=>Ui(e.centerX,e.centerY)};function Qa(e,t){return t==="start"?0:t==="end"?e:sh(t)?ah(t)*e:e/2}function $e(e,t,n=!0){return typeof t=="number"?t:sh(t)?(n?ah(t):oh(t))*e:e}function Q1(e,t){const{x:n,width:i}=e,s=t.textAlign;return s==="center"?n+i/2:s==="end"||s==="right"?n+i:n}function rh(e,t,{borderWidth:n,position:i,xAdjust:s,yAdjust:o},a){const r=et(a),l=t.width+(r?a.width:0)+n,c=t.height+(r?a.height:0)+n,d=Ja(i),h=dh(e.x,l,s,d.x),f=dh(e.y,c,o,d.y);return{x:h,y:f,x2:h+l,y2:f+c,width:l,height:c,centerX:h+l/2,centerY:f+c/2}}function Ja(e,t="center"){return et(e)?{x:Q(e.x,t),y:Q(e.y,t)}:(e=Q(e,t),{x:e,y:e})}const lh=(e,t)=>e&&e.autoFit&&t<1;function ch(e,t){const n=e.font,i=ct(n)?n:[n];return lh(e,t)?i.map(function(s){const o=xt(s);return o.size=Math.floor(s.size*t),o.lineHeight=s.lineHeight,xt(o)}):i.map(s=>xt(s))}function uh(e){return e&&(Xt(e.xValue)||Xt(e.yValue))}function dh(e,t,n=0,i){return e-Qa(t,i)+n}function Vn(e,t,n){const i=n.init;if(i){if(i===!0)return fh(t,n)}else return;return J1(e,t,n)}function hh(e,t,n){let i=!1;return t.forEach(s=>{Kt(e[s])?(i=!0,n[s]=e[s]):Xt(n[s])&&delete n[s]}),i}function fh(e,t){const n=t.type||"line";return Z1[n](e)}function J1(e,t,n){const i=ft(n.init,[{chart:e,properties:t,options:n}]);if(i===!0)return fh(t,n);if(et(i))return i}const tr=new Map,tD=e=>isNaN(e)||e<=0,eD=e=>e.reduce(function(t,n){return t+=n.string,t},"");function Qs(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object HTMLImageElement]"||t==="[object HTMLCanvasElement]"}}function Js(e,{x:t,y:n},i){i&&(e.translate(t,n),e.rotate(At(i)),e.translate(-t,-n))}function ve(e,t){if(t&&t.borderWidth)return e.lineCap=t.borderCapStyle||"butt",e.setLineDash(t.borderDash),e.lineDashOffset=t.borderDashOffset,e.lineJoin=t.borderJoinStyle||"miter",e.lineWidth=t.borderWidth,e.strokeStyle=t.borderColor,!0}function Hn(e,t){e.shadowColor=t.backgroundShadowColor,e.shadowBlur=t.shadowBlur,e.shadowOffsetX=t.shadowOffsetX,e.shadowOffsetY=t.shadowOffsetY}function to(e,t){const n=t.content;if(Qs(n))return{width:$e(n.width,t.width),height:$e(n.height,t.height)};const i=ch(t),s=t.textStrokeWidth,o=ct(n)?n:[n],a=o.join()+eD(i)+s+(e._measureText?"-spriting":"");return tr.has(a)||tr.set(a,oD(e,o,i,s)),tr.get(a)}function mh(e,t,n){const{x:i,y:s,width:o,height:a}=t;e.save(),Hn(e,n);const r=ve(e,n);e.fillStyle=n.backgroundColor,e.beginPath(),An(e,{x:i,y:s,w:o,h:a,radius:G1(Ne(n.borderRadius),0,Math.min(o,a)/2)}),e.closePath(),e.fill(),r&&(e.shadowColor=n.borderShadowColor,e.stroke()),e.restore()}function ph(e,t,n,i){const s=n.content;if(Qs(s)){e.save(),e.globalAlpha=lD(n.opacity,s.style.opacity),e.drawImage(s,t.x,t.y,t.width,t.height),e.restore();return}const o=ct(s)?s:[s],a=ch(n,i),r=n.color,l=ct(r)?r:[r],c=Q1(t,n),d=t.y+n.textStrokeWidth/2;e.save(),e.textBaseline="middle",e.textAlign=n.textAlign,nD(e,n)&&aD(e,{x:c,y:d},o,a),rD(e,{x:c,y:d},o,{fonts:a,colors:l}),e.restore()}function nD(e,t){if(t.textStrokeWidth>0)return e.lineJoin="round",e.miterLimit=2,e.lineWidth=t.textStrokeWidth,e.strokeStyle=t.textStrokeColor,!0}function iD(e,t,n,i){const{radius:s,options:o}=t,a=o.pointStyle,r=o.rotation;let l=(r||0)*Go;if(Qs(a)){e.save(),e.translate(n,i),e.rotate(l),e.drawImage(a,-a.width/2,-a.height/2,a.width,a.height),e.restore();return}tD(s)||sD(e,{x:n,y:i,radius:s,rotation:r,style:a,rad:l})}function sD(e,{x:t,y:n,radius:i,rotation:s,style:o,rad:a}){let r,l,c,d;switch(e.beginPath(),o){default:e.arc(t,n,i,0,gt),e.closePath();break;case"triangle":e.moveTo(t+Math.sin(a)*i,n-Math.cos(a)*i),a+=gs,e.lineTo(t+Math.sin(a)*i,n-Math.cos(a)*i),a+=gs,e.lineTo(t+Math.sin(a)*i,n-Math.cos(a)*i),e.closePath();break;case"rectRounded":d=i*.516,c=i-d,r=Math.cos(a+re)*c,l=Math.sin(a+re)*c,e.arc(t-r,n-l,d,a-tt,a-yt),e.arc(t+l,n-r,d,a-yt,a),e.arc(t+r,n+l,d,a,a+yt),e.arc(t-l,n+r,d,a+yt,a+tt),e.closePath();break;case"rect":if(!s){c=Math.SQRT1_2*i,e.rect(t-c,n-c,2*c,2*c);break}a+=re;case"rectRot":r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+l,n-r),e.lineTo(t+r,n+l),e.lineTo(t-l,n+r),e.closePath();break;case"crossRot":a+=re;case"cross":r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+r,n+l),e.moveTo(t+l,n-r),e.lineTo(t-l,n+r);break;case"star":r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+r,n+l),e.moveTo(t+l,n-r),e.lineTo(t-l,n+r),a+=re,r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+r,n+l),e.moveTo(t+l,n-r),e.lineTo(t-l,n+r);break;case"line":r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+r,n+l);break;case"dash":e.moveTo(t,n),e.lineTo(t+Math.cos(a)*i,n+Math.sin(a)*i);break}e.fill()}function oD(e,t,n,i){e.save();const s=t.length;let o=0,a=i;for(let r=0;r<s;r++){const l=n[Math.min(r,n.length-1)];e.font=l.string;const c=t[r];o=Math.max(o,e.measureText(c).width+i),a+=l.lineHeight}return e.restore(),{width:o,height:a}}function aD(e,{x:t,y:n},i,s){e.beginPath();let o=0;i.forEach(function(a,r){const l=s[Math.min(r,s.length-1)],c=l.lineHeight;e.font=l.string,e.strokeText(a,t,n+c/2+o),o+=c}),e.stroke()}function rD(e,{x:t,y:n},i,{fonts:s,colors:o}){let a=0;i.forEach(function(r,l){const c=o[Math.min(l,o.length-1)],d=s[Math.min(l,s.length-1)],h=d.lineHeight;e.beginPath(),e.font=d.string,e.fillStyle=c,e.fillText(r,t,n+h/2+a),a+=h,e.fill()})}function lD(e,t){const n=Le(e)?e:t;return Le(n)?Zs(n,0,1):1}const gh=["left","bottom","top","right"];function cD(e,t){const{pointX:n,pointY:i,options:s}=t,o=s.callout,a=o&&o.display&&mD(t,o);if(!a||gD(t,o,a))return;if(e.save(),e.beginPath(),!ve(e,o))return e.restore();const{separatorStart:l,separatorEnd:c}=uD(t,a),{sideStart:d,sideEnd:h}=hD(t,a,l);(o.margin>0||s.borderWidth===0)&&(e.moveTo(l.x,l.y),e.lineTo(c.x,c.y)),e.moveTo(d.x,d.y),e.lineTo(h.x,h.y);const f=dn({x:n,y:i},t.getCenterPoint(),At(-t.rotation));e.lineTo(f.x,f.y),e.stroke(),e.restore()}function uD(e,t){const{x:n,y:i,x2:s,y2:o}=e,a=dD(e,t);let r,l;return t==="left"||t==="right"?(r={x:n+a,y:i},l={x:r.x,y:o}):(r={x:n,y:i+a},l={x:s,y:r.y}),{separatorStart:r,separatorEnd:l}}function dD(e,t){const{width:n,height:i,options:s}=e,o=s.callout.margin+s.borderWidth/2;return t==="right"?n+o:t==="bottom"?i+o:-o}function hD(e,t,n){const{y:i,width:s,height:o,options:a}=e,r=a.callout.start,l=fD(t,a.callout);let c,d;return t==="left"||t==="right"?(c={x:n.x,y:i+$e(o,r)},d={x:c.x+l,y:c.y}):(c={x:n.x+$e(s,r),y:n.y},d={x:c.x,y:c.y+l}),{sideStart:c,sideEnd:d}}function fD(e,t){const n=t.side;return e==="left"||e==="top"?-n:n}function mD(e,t){const n=t.position;return gh.includes(n)?n:pD(e,t)}function pD(e,t){const{x:n,y:i,x2:s,y2:o,width:a,height:r,pointX:l,pointY:c,centerX:d,centerY:h,rotation:f}=e,m={x:d,y:h},p=t.start,g=$e(a,p),y=$e(r,p),_=[n,n+g,n+g,s],x=[i+y,o,i,o],T=[];for(let v=0;v<4;v++){const w=dn({x:_[v],y:x[v]},m,At(f));T.push({position:gh[v],distance:On(w,{x:l,y:c})})}return T.sort((v,w)=>v.distance-w.distance)[0].position}function gD(e,t,n){const{pointX:i,pointY:s}=e,o=t.margin;let a=i,r=s;return n==="left"?a+=o:n==="right"?a-=o:n==="top"?r+=o:n==="bottom"&&(r-=o),e.inRange(a,r)}const yh={xScaleID:{min:"xMin",max:"xMax",start:"left",end:"right",startProp:"x",endProp:"x2"},yScaleID:{min:"yMin",max:"yMax",start:"bottom",end:"top",startProp:"y",endProp:"y2"}};function $n(e,t,n){return t=typeof t=="number"?t:e.parse(t),_t(t)?e.getPixelForValue(t):n}function mn(e,t,n){const i=t[n];if(i||n==="scaleID")return i;const s=n.charAt(0),o=Object.values(e).filter(a=>a.axis&&a.axis===s);return o.length?o[0].id:s}function bh(e,t){if(e){const n=e.options.reverse,i=$n(e,t.min,n?t.end:t.start),s=$n(e,t.max,n?t.start:t.end);return{start:i,end:s}}}function _h(e,t){const{chartArea:n,scales:i}=e,s=i[mn(i,t,"xScaleID")],o=i[mn(i,t,"yScaleID")];let a=n.width/2,r=n.height/2;return s&&(a=$n(s,t.xValue,s.left+s.width/2)),o&&(r=$n(o,t.yValue,o.top+o.height/2)),{x:a,y:r}}function er(e,t){const n=e.scales,i=n[mn(n,t,"xScaleID")],s=n[mn(n,t,"yScaleID")];if(!i&&!s)return{};let{left:o,right:a}=i||e.chartArea,{top:r,bottom:l}=s||e.chartArea;const c=kh(i,{min:t.xMin,max:t.xMax,start:o,end:a});o=c.start,a=c.end;const d=kh(s,{min:t.yMin,max:t.yMax,start:l,end:r});return r=d.start,l=d.end,{x:o,y:r,x2:a,y2:l,width:a-o,height:l-r,centerX:o+(a-o)/2,centerY:r+(l-r)/2}}function xh(e,t){if(!uh(t)){const n=er(e,t);let i=t.radius;(!i||isNaN(i))&&(i=Math.min(n.width,n.height)/2,t.radius=i);const s=i*2,o=n.centerX+t.xAdjust,a=n.centerY+t.yAdjust;return{x:o-i,y:a-i,x2:o+i,y2:a+i,centerX:o,centerY:a,width:s,height:s,radius:i}}return bD(e,t)}function yD(e,t){const{scales:n,chartArea:i}=e,s=n[t.scaleID],o={x:i.left,y:i.top,x2:i.right,y2:i.bottom};return s?_D(s,o,t):xD(n,o,t),o}function wh(e,t){const n=er(e,t);return n.initProperties=Vn(e,n,t),n.elements=[{type:"label",optionScope:"label",properties:TD(e,n,t),initProperties:n.initProperties}],n}function bD(e,t){const n=_h(e,t),i=t.radius*2;return{x:n.x-t.radius+t.xAdjust,y:n.y-t.radius+t.yAdjust,x2:n.x+t.radius+t.xAdjust,y2:n.y+t.radius+t.yAdjust,centerX:n.x+t.xAdjust,centerY:n.y+t.yAdjust,radius:t.radius,width:i,height:i}}function kh(e,t){const n=bh(e,t)||t;return{start:Math.min(n.start,n.end),end:Math.max(n.start,n.end)}}function _D(e,t,n){const i=$n(e,n.value,NaN),s=$n(e,n.endValue,i);e.isHorizontal()?(t.x=i,t.x2=s):(t.y=i,t.y2=s)}function xD(e,t,n){for(const i of Object.keys(yh)){const s=e[mn(e,n,i)];if(s){const{min:o,max:a,start:r,end:l,startProp:c,endProp:d}=yh[i],h=bh(s,{min:n[o],max:n[a],start:s[r],end:s[l]});t[c]=h.start,t[d]=h.end}}}function wD({properties:e,options:t},n,i,s){const{x:o,x2:a,width:r}=e;return Th({start:o,end:a,borderWidth:t.borderWidth},{position:i.x,padding:{start:s.left,end:s.right},adjust:t.label.xAdjust,size:n.width})}function kD({properties:e,options:t},n,i,s){const{y:o,y2:a,height:r}=e;return Th({start:o,end:a,borderWidth:t.borderWidth},{position:i.y,padding:{start:s.top,end:s.bottom},adjust:t.label.yAdjust,size:n.height})}function Th(e,t){const{start:n,end:i,borderWidth:s}=e,{position:o,padding:{start:a,end:r},adjust:l}=t,c=i-s-n-a-r-t.size;return n+s/2+l+Qa(c,o)}function TD(e,t,n){const i=n.label;i.backgroundColor="transparent",i.callout.display=!1;const s=Ja(i.position),o=Pt(i.padding),a=to(e.ctx,i),r=wD({properties:t,options:n},a,s,o),l=kD({properties:t,options:n},a,s,o),c=a.width+o.width,d=a.height+o.height;return{x:r,y:l,x2:r+c,y2:l+d,width:c,height:d,centerX:r+c/2,centerY:l+d/2,rotation:i.rotation}}const nr=["enter","leave"],ir=nr.concat("click");function SD(e,t,n){t.listened=hh(n,ir,t.listeners),t.moveListened=!1,nr.forEach(i=>{Kt(n[i])&&(t.moveListened=!0)}),(!t.listened||!t.moveListened)&&t.annotations.forEach(i=>{!t.listened&&Kt(i.click)&&(t.listened=!0),t.moveListened||nr.forEach(s=>{Kt(i[s])&&(t.listened=!0,t.moveListened=!0)})})}function vD(e,t,n){if(e.listened)switch(t.type){case"mousemove":case"mouseout":return MD(e,t,n);case"click":return DD(e,t,n)}}function MD(e,t,n){if(!e.moveListened)return;let i;t.type==="mousemove"?i=Za(e.visibleElements,t,n.interaction):i=[];const s=e.hovered;e.hovered=i;const o={state:e,event:t};let a=Sh(o,"leave",s,i);return Sh(o,"enter",i,s)||a}function Sh({state:e,event:t},n,i,s){let o;for(const a of i)s.indexOf(a)<0&&(o=vh(a.options[n]||e.listeners[n],a,t)||o);return o}function DD(e,t,n){const i=e.listeners,s=Za(e.visibleElements,t,n.interaction);let o;for(const a of s)o=vh(a.options.click||i.click,a,t)||o;return o}function vh(e,t,n){return ft(e,[t.$context,n])===!0}const eo=["afterDraw","beforeDraw"];function CD(e,t,n){const i=t.visibleElements;t.hooked=hh(n,eo,t.hooks),t.hooked||i.forEach(s=>{t.hooked||eo.forEach(o=>{Kt(s.options[o])&&(t.hooked=!0)})})}function Mh(e,t,n){if(e.hooked){const i=t.options[n]||e.hooks[n];return ft(i,[t.$context])}}function OD(e,t,n){const i=ID(e.scales,t,n);let s=Dh(t,i,"min","suggestedMin");s=Dh(t,i,"max","suggestedMax")||s,s&&Kt(t.handleTickRangeOptions)&&t.handleTickRangeOptions()}function AD(e,t){for(const n of e)ED(n,t)}function Dh(e,t,n,i){if(_t(t[n])&&!PD(e.options,n,i)){const s=e[n]!==t[n];return e[n]=t[n],s}}function PD(e,t,n){return Xt(e[t])||Xt(e[n])}function ED(e,t){for(const n of["scaleID","xScaleID","yScaleID"]){const i=mn(t,e,n);i&&!t[i]&&RD(e,n)&&console.warn(`No scale found with id '${i}' for annotation '${e.id}'`)}}function RD(e,t){if(t==="scaleID")return!0;const n=t.charAt(0);for(const i of["Min","Max","Value"])if(Xt(e[n+i]))return!0;return!1}function ID(e,t,n){const i=t.axis,s=t.id,o=i+"ScaleID",a={min:Q(t.min,Number.NEGATIVE_INFINITY),max:Q(t.max,Number.POSITIVE_INFINITY)};for(const r of n)r.scaleID===s?Ch(r,t,["value","endValue"],a):mn(e,r,o)===s&&Ch(r,t,[i+"Min",i+"Max",i+"Value"],a);return a}function Ch(e,t,n,i){for(const s of n){const o=e[s];if(Xt(o)){const a=t.parse(o);i.min=Math.min(i.min,a),i.max=Math.max(i.max,a)}}}class Yn extends $t{inRange(t,n,i,s){const{x:o,y:a}=dn({x:t,y:n},this.getCenterPoint(s),At(-this.options.rotation));return nh({x:o,y:a},this.getProps(["x","y","x2","y2"],s),i,this.options)}getCenterPoint(t){return fn(this,t)}draw(t){t.save(),Js(t,this.getCenterPoint(),this.options.rotation),mh(t,this,this.options),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,n){return wh(t,n)}}Yn.id="boxAnnotation",Yn.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,hitTolerance:0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:!1},color:"black",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},Yn.defaultRoutes={borderColor:"color",backgroundColor:"color"},Yn.descriptors={label:{_fallback:!0}};class no extends $t{inRange(t,n,i,s){return ih({x:t,y:n},{rect:this.getProps(["x","y","x2","y2"],s),center:this.getCenterPoint(s)},i,{rotation:this.rotation,borderWidth:0,hitTolerance:this.options.hitTolerance})}getCenterPoint(t){return fn(this,t)}draw(t){const n=this.options;!n.display||!n.content||(UD(t,this),t.save(),Js(t,this.getCenterPoint(),this.rotation),ph(t,this,n,this._fitRatio),t.restore())}resolveElementProperties(t,n){const i=LD(t,n);if(!i)return{};const{controllerMeta:s,point:o,radius:a}=BD(t,n,i);let r=to(t.ctx,n);const l=FD(r,a);lh(n,l)&&(r={width:r.width*l,height:r.height*l});const{position:c,xAdjust:d,yAdjust:h}=n,f=rh(o,r,{borderWidth:0,position:c,xAdjust:d,yAdjust:h});return{initProperties:Vn(t,f,n),...f,...s,rotation:n.rotation,_fitRatio:l}}}no.id="doughnutLabelAnnotation",no.defaults={autoFit:!0,autoHide:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderColor:"transparent",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:0,color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,spacing:1,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0},no.defaultRoutes={};function LD(e,t){return e.getSortedVisibleDatasetMetas().reduce(function(n,i){const s=i.controller;return s instanceof Ti&&ND(e,t,i.data)&&(!n||s.innerRadius<n.controller.innerRadius)&&s.options.circumference>=90?i:n},void 0)}function ND(e,t,n){if(!t.autoHide)return!0;for(let i=0;i<n.length;i++)if(!n[i].hidden&&e.getDataVisibility(i))return!0}function BD({chartArea:e},t,n){const{left:i,top:s,right:o,bottom:a}=e,{innerRadius:r,offsetX:l,offsetY:c}=n.controller,d=(i+o)/2+l,h=(s+a)/2+c,f={left:Math.max(d-r,i),right:Math.min(d+r,o),top:Math.max(h-r,s),bottom:Math.min(h+r,a)},m={x:(f.left+f.right)/2,y:(f.top+f.bottom)/2},p=t.spacing+t.borderWidth/2,g=r-p,y=m.y>h,_=y?s+p:a-p,x=zD(_,d,h,g);return{controllerMeta:{_centerX:d,_centerY:h,_radius:g,_counterclockwise:y,...x},point:m,radius:Math.min(r,Math.min(f.right-f.left,f.bottom-f.top)/2)}}function FD({width:e,height:t},n){const i=Math.sqrt(Math.pow(e,2)+Math.pow(t,2));return n*2/i}function zD(e,t,n,i){const s=Math.pow(n-e,2),o=Math.pow(i,2),a=t*-2,r=Math.pow(t,2)+s-o,l=Math.pow(a,2)-4*r;if(l<=0)return{_startAngle:0,_endAngle:gt};const c=(-a-Math.sqrt(l))/2,d=(-a+Math.sqrt(l))/2;return{_startAngle:bs({x:t,y:n},{x:c,y:e}).angle,_endAngle:bs({x:t,y:n},{x:d,y:e}).angle}}function UD(e,t){const{_centerX:n,_centerY:i,_radius:s,_startAngle:o,_endAngle:a,_counterclockwise:r,options:l}=t;e.save();const c=ve(e,l);e.fillStyle=l.backgroundColor,e.beginPath(),e.arc(n,i,s,o,a,r),e.closePath(),e.fill(),c&&e.stroke(),e.restore()}class Vi extends $t{inRange(t,n,i,s){return ih({x:t,y:n},{rect:this.getProps(["x","y","x2","y2"],s),center:this.getCenterPoint(s)},i,{rotation:this.rotation,borderWidth:this.options.borderWidth,hitTolerance:this.options.hitTolerance})}getCenterPoint(t){return fn(this,t)}draw(t){const n=this.options,i=!Xt(this._visible)||this._visible;!n.display||!n.content||!i||(t.save(),Js(t,this.getCenterPoint(),this.rotation),cD(t,this),mh(t,this,n),ph(t,VD(this),n),t.restore())}resolveElementProperties(t,n){let i;if(uh(n))i=_h(t,n);else{const{centerX:r,centerY:l}=er(t,n);i={x:r,y:l}}const s=Pt(n.padding),o=to(t.ctx,n),a=rh(i,o,n,s);return{initProperties:Vn(t,a,n),pointX:i.x,pointY:i.y,...a,rotation:n.rotation}}}Vi.id="labelAnnotation",Vi.defaults={adjustScaleRange:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:0,callout:{borderCapStyle:"butt",borderColor:void 0,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:1,display:!1,margin:5,position:"auto",side:5,start:"50%"},color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},Vi.defaultRoutes={borderColor:"color"};function VD({x:e,y:t,width:n,height:i,options:s}){const o=s.borderWidth/2,a=Pt(s.padding);return{x:e+a.left+o,y:t+a.top+o,width:n-a.left-a.right-s.borderWidth,height:i-a.top-a.bottom-s.borderWidth}}const sr=(e,t,n)=>({x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}),or=(e,t,n)=>sr(t,n,Math.abs((e-t.y)/(n.y-t.y))).x,Oh=(e,t,n)=>sr(t,n,Math.abs((e-t.x)/(n.x-t.x))).y,Hi=e=>e*e,HD=(e,t,{x:n,y:i,x2:s,y2:o},a)=>a==="y"?{start:Math.min(i,o),end:Math.max(i,o),value:t}:{start:Math.min(n,s),end:Math.max(n,s),value:e},Ah=(e,t,n,i)=>(1-i)*(1-i)*e+2*(1-i)*i*t+i*i*n,ar=(e,t,n,i)=>({x:Ah(e.x,t.x,n.x,i),y:Ah(e.y,t.y,n.y,i)}),Ph=(e,t,n,i)=>2*(1-i)*(t-e)+2*i*(n-t),Eh=(e,t,n,i)=>-Math.atan2(Ph(e.x,t.x,n.x,i),Ph(e.y,t.y,n.y,i))+.5*tt;class $i extends $t{inRange(t,n,i,s){const o=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y"){const a={mouseX:t,mouseY:n},{path:r,ctx:l}=this;if(r){ve(l,this.options),l.lineWidth+=this.options.hitTolerance;const{chart:d}=this.$context,h=t*d.currentDevicePixelRatio,f=n*d.currentDevicePixelRatio,m=l.isPointInStroke(r,h,f)||rr(this,a,s);return l.restore(),m}const c=Hi(o);return jD(this,a,c,s)||rr(this,a,s)}return $D(this,{mouseX:t,mouseY:n},i,{hitSize:o,useFinalPosition:s})}getCenterPoint(t){return fn(this,t)}draw(t){const{x:n,y:i,x2:s,y2:o,cp:a,options:r}=this;if(t.save(),!ve(t,r))return t.restore();Hn(t,r);const l=Math.sqrt(Math.pow(s-n,2)+Math.pow(o-i,2));if(r.curve&&a)return tC(t,this,a,l),t.restore();const{startOpts:c,endOpts:d,startAdjust:h,endAdjust:f}=Bh(this),m=Math.atan2(o-i,s-n);t.translate(n,i),t.rotate(m),t.beginPath(),t.moveTo(0+h,0),t.lineTo(l-f,0),t.shadowColor=r.borderShadowColor,t.stroke(),lr(t,0,h,c),lr(t,l,-f,d),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,n){const i=yD(t,n),{x:s,y:o,x2:a,y2:r}=i,l=YD(i,t.chartArea),c=l?WD({x:s,y:o},{x:a,y:r},t.chartArea):{x:s,y:o,x2:a,y2:r,width:Math.abs(a-s),height:Math.abs(r-o)};if(c.centerX=(a+s)/2,c.centerY=(r+o)/2,c.initProperties=Vn(t,c,n),n.curve){const h={x:c.x,y:c.y},f={x:c.x2,y:c.y2};c.cp=JD(c,n,On(h,f))}const d=qD(t,c,n.label);return d._visible=l,c.elements=[{type:"label",optionScope:"label",properties:d,initProperties:c.initProperties}],c}}$i.id="lineAnnotation";const Rh={backgroundColor:void 0,backgroundShadowColor:void 0,borderColor:void 0,borderDash:void 0,borderDashOffset:void 0,borderShadowColor:void 0,borderWidth:void 0,display:void 0,fill:void 0,length:void 0,shadowBlur:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,width:void 0};$i.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},Rh),fill:!1,length:12,start:Object.assign({},Rh),width:6},borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:2,curve:!1,controlPoint:{y:"-50%"},display:!0,endValue:void 0,init:void 0,hitTolerance:0,label:{backgroundColor:"rgba(0,0,0,0.8)",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderColor:"black",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:6,borderShadowColor:"transparent",borderWidth:0,callout:Object.assign({},Vi.defaults.callout),color:"#fff",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},scaleID:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,value:void 0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},$i.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}},$i.defaultRoutes={borderColor:"color"};function $D(e,{mouseX:t,mouseY:n},i,{hitSize:s,useFinalPosition:o}){const a=HD(t,n,e.getProps(["x","y","x2","y2"],o),i);return eh(a,s)||rr(e,{mouseX:t,mouseY:n},o,i)}function YD({x:e,y:t,x2:n,y2:i},{top:s,right:o,bottom:a,left:r}){return!(e<r&&n<r||e>o&&n>o||t<s&&i<s||t>a&&i>a)}function Ih({x:e,y:t},n,{top:i,right:s,bottom:o,left:a}){return e<a&&(t=Oh(a,{x:e,y:t},n),e=a),e>s&&(t=Oh(s,{x:e,y:t},n),e=s),t<i&&(e=or(i,{x:e,y:t},n),t=i),t>o&&(e=or(o,{x:e,y:t},n),t=o),{x:e,y:t}}function WD(e,t,n){const{x:i,y:s}=Ih(e,t,n),{x:o,y:a}=Ih(t,e,n);return{x:i,y:s,x2:o,y2:a,width:Math.abs(o-i),height:Math.abs(a-s)}}function jD(e,{mouseX:t,mouseY:n},i=hn,s){const{x:o,y:a,x2:r,y2:l}=e.getProps(["x","y","x2","y2"],s),c=r-o,d=l-a,h=Hi(c)+Hi(d),f=h===0?-1:((t-o)*c+(n-a)*d)/h;let m,p;return f<0?(m=o,p=a):f>1?(m=r,p=l):(m=o+f*c,p=a+f*d),Hi(t-m)+Hi(n-p)<=i}function rr(e,{mouseX:t,mouseY:n},i,s){const o=e.label;return o.options.display&&o.inRange(t,n,s,i)}function qD(e,t,n){const i=n.borderWidth,s=Pt(n.padding),o=to(e.ctx,n),a=o.width+s.width+i,r=o.height+s.height+i;return XD(t,n,{width:a,height:r,padding:s},e.chartArea)}function GD(e){const{x:t,y:n,x2:i,y2:s}=e,o=Math.atan2(s-n,i-t);return o>tt/2?o-tt:o<tt/-2?o+tt:o}function XD(e,t,n,i){const{width:s,height:o,padding:a}=n,{xAdjust:r,yAdjust:l}=t,c={x:e.x,y:e.y},d={x:e.x2,y:e.y2},h=t.rotation==="auto"?GD(e):At(t.rotation),f=KD(s,o,h),m=ZD(e,t,{labelSize:f,padding:a},i),p=e.cp?ar(c,e.cp,d,m):sr(c,d,m),g={size:f.w,min:i.left,max:i.right,padding:a.left},y={size:f.h,min:i.top,max:i.bottom,padding:a.top},_=Nh(p.x,g)+r,x=Nh(p.y,y)+l;return{x:_-s/2,y:x-o/2,x2:_+s/2,y2:x+o/2,centerX:_,centerY:x,pointX:p.x,pointY:p.y,width:s,height:o,rotation:ys(h)}}function KD(e,t,n){const i=Math.cos(n),s=Math.sin(n);return{w:Math.abs(e*i)+Math.abs(t*s),h:Math.abs(e*s)+Math.abs(t*i)}}function ZD(e,t,n,i){let s;const o=QD(e,i);return t.position==="start"?s=Lh({w:e.x2-e.x,h:e.y2-e.y},n,t,o):t.position==="end"?s=1-Lh({w:e.x-e.x2,h:e.y-e.y2},n,t,o):s=Qa(1,t.position),s}function Lh(e,t,n,i){const{labelSize:s,padding:o}=t,a=e.w*i.dx,r=e.h*i.dy,l=a>0&&(s.w/2+o.left-i.x)/a,c=r>0&&(s.h/2+o.top-i.y)/r;return Zs(Math.max(l,c),0,.25)}function QD(e,t){const{x:n,x2:i,y:s,y2:o}=e,a=Math.min(s,o)-t.top,r=Math.min(n,i)-t.left,l=t.bottom-Math.max(s,o),c=t.right-Math.max(n,i);return{x:Math.min(r,c),y:Math.min(a,l),dx:r<=c?1:-1,dy:a<=l?1:-1}}function Nh(e,t){const{size:n,min:i,max:s,padding:o}=t,a=n/2;return n>s-i?(s+i)/2:(i>=e-o-a&&(e=i+o+a),s<=e+o+a&&(e=s-o-a),e)}function Bh(e){const t=e.options,n=t.arrowHeads&&t.arrowHeads.start,i=t.arrowHeads&&t.arrowHeads.end;return{startOpts:n,endOpts:i,startAdjust:Fh(e,n),endAdjust:Fh(e,i)}}function Fh(e,t){if(!t||!t.display)return 0;const{length:n,width:i}=t,s=e.options.borderWidth/2,o={x:n,y:i+s};return Math.abs(or(0,o,{x:0,y:s}))}function lr(e,t,n,i){if(!i||!i.display)return;const{length:s,width:o,fill:a,backgroundColor:r,borderColor:l}=i,c=Math.abs(t-s)+n;e.beginPath(),Hn(e,i),ve(e,i),e.moveTo(c,-o),e.lineTo(t+n,0),e.lineTo(c,o),a===!0?(e.fillStyle=r||l,e.closePath(),e.fill(),e.shadowColor="transparent"):e.shadowColor=i.borderShadowColor,e.stroke()}function JD(e,t,n){const{x:i,y:s,x2:o,y2:a,centerX:r,centerY:l}=e,c=Math.atan2(a-s,o-i),d=Ja(t.controlPoint,0),h={x:r+$e(n,d.x,!1),y:l+$e(n,d.y,!1)};return dn(h,{x:r,y:l},c)}function zh(e,{x:t,y:n},{angle:i,adjust:s},o){!o||!o.display||(e.save(),e.translate(t,n),e.rotate(i),lr(e,0,-s,o),e.restore())}function tC(e,t,n,i){const{x:s,y:o,x2:a,y2:r,options:l}=t,{startOpts:c,endOpts:d,startAdjust:h,endAdjust:f}=Bh(t),m={x:s,y:o},p={x:a,y:r},g=Eh(m,n,p,0),y=Eh(m,n,p,1)-tt,_=ar(m,n,p,h/i),x=ar(m,n,p,1-f/i),T=new Path2D;e.beginPath(),T.moveTo(_.x,_.y),T.quadraticCurveTo(n.x,n.y,x.x,x.y),e.shadowColor=l.borderShadowColor,e.stroke(T),t.path=T,t.ctx=e,zh(e,_,{angle:g,adjust:h},c),zh(e,x,{angle:y,adjust:f},d)}class Yi extends $t{inRange(t,n,i,s){const o=this.options.rotation,a=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y")return eC({x:t,y:n},this.getProps(["width","height","centerX","centerY"],s),o,a);const{x:r,y:l,x2:c,y2:d}=this.getProps(["x","y","x2","y2"],s),h=i==="y"?{start:l,end:d}:{start:r,end:c},f=dn({x:t,y:n},this.getCenterPoint(s),At(-o));return f[i]>=h.start-a-hn&&f[i]<=h.end+a+hn}getCenterPoint(t){return fn(this,t)}draw(t){const{width:n,height:i,centerX:s,centerY:o,options:a}=this;t.save(),Js(t,this.getCenterPoint(),a.rotation),Hn(t,this.options),t.beginPath(),t.fillStyle=a.backgroundColor;const r=ve(t,a);t.ellipse(s,o,i/2,n/2,tt/2,0,2*tt),t.fill(),r&&(t.shadowColor=a.borderShadowColor,t.stroke()),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,n){return wh(t,n)}}Yi.id="ellipseAnnotation",Yi.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,label:Object.assign({},Yn.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},Yi.defaultRoutes={borderColor:"color",backgroundColor:"color"},Yi.descriptors={label:{_fallback:!0}};function eC(e,t,n,i){const{width:s,height:o,centerX:a,centerY:r}=t,l=s/2,c=o/2;if(l<=0||c<=0)return!1;const d=At(n||0),h=Math.cos(d),f=Math.sin(d),m=Math.pow(h*(e.x-a)+f*(e.y-r),2),p=Math.pow(f*(e.x-a)-h*(e.y-r),2);return m/Math.pow(l+i,2)+p/Math.pow(c+i,2)<=1.0001}class io extends $t{inRange(t,n,i,s){const{x:o,y:a,x2:r,y2:l,width:c}=this.getProps(["x","y","x2","y2","width"],s),d=(this.options.borderWidth+this.options.hitTolerance)/2;return i!=="x"&&i!=="y"?X1({x:t,y:n},this.getCenterPoint(s),c/2,d):eh(i==="y"?{start:a,end:l,value:n}:{start:o,end:r,value:t},d)}getCenterPoint(t){return fn(this,t)}draw(t){const n=this.options,i=n.borderWidth;if(n.radius<.1)return;t.save(),t.fillStyle=n.backgroundColor,Hn(t,n);const s=ve(t,n);iD(t,this,this.centerX,this.centerY),s&&!Qs(n.pointStyle)&&(t.shadowColor=n.borderShadowColor,t.stroke()),t.restore(),n.borderWidth=i}resolveElementProperties(t,n){const i=xh(t,n);return i.initProperties=Vn(t,i,n),i}}io.id="pointAnnotation",io.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},io.defaultRoutes={borderColor:"color",backgroundColor:"color"};class so extends $t{inRange(t,n,i,s){if(i!=="x"&&i!=="y")return this.options.radius>=.1&&this.elements.length>1&&iC(this.elements,t,n,s);const o=dn({x:t,y:n},this.getCenterPoint(s),At(-this.options.rotation)),a=this.elements.map(c=>i==="y"?c.bY:c.bX),r=Math.min(...a),l=Math.max(...a);return o[i]>=r&&o[i]<=l}getCenterPoint(t){return fn(this,t)}draw(t){const{elements:n,options:i}=this;t.save(),t.beginPath(),t.fillStyle=i.backgroundColor,Hn(t,i);const s=ve(t,i);let o=!0;for(const a of n)o?(t.moveTo(a.x,a.y),o=!1):t.lineTo(a.x,a.y);t.closePath(),t.fill(),s&&(t.shadowColor=i.borderShadowColor,t.stroke()),t.restore()}resolveElementProperties(t,n){const i=xh(t,n),{sides:s,rotation:o}=n,a=[],r=2*tt/s;let l=o*Go;for(let c=0;c<s;c++,l+=r){const d=nC(i,n,l);d.initProperties=Vn(t,i,n),a.push(d)}return i.elements=a,i}}so.id="polygonAnnotation",so.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,point:{radius:0},radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,sides:3,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},so.defaultRoutes={borderColor:"color",backgroundColor:"color"};function nC({centerX:e,centerY:t},{radius:n,borderWidth:i,hitTolerance:s},o){const a=(i+s)/2,r=Math.sin(o),l=Math.cos(o),c={x:e+r*n,y:t-l*n};return{type:"point",optionScope:"point",properties:{x:c.x,y:c.y,centerX:c.x,centerY:c.y,bX:e+r*(n+a),bY:t-l*(n+a)}}}function iC(e,t,n,i){let s=!1,o=e[e.length-1].getProps(["bX","bY"],i);for(const a of e){const r=a.getProps(["bX","bY"],i);r.bY>n!=o.bY>n&&t<(o.bX-r.bX)*(n-r.bY)/(o.bY-r.bY)+r.bX&&(s=!s),o=r}return s}const Ye={box:Yn,doughnutLabel:no,ellipse:Yi,label:Vi,line:$i,point:io,polygon:so};Object.keys(Ye).forEach(e=>{bt.describe(`elements.${Ye[e].id}`,{_fallback:"plugins.annotation.common"})});const sC={update:Object.assign},oC=ir.concat(eo),Uh=(e,t)=>et(t)?dr(e,t):e,cr=e=>e==="color"||e==="font";function ur(e="line"){return Ye[e]?e:(console.warn(`Unknown annotation type: '${e}', defaulting to 'line'`),"line")}function aC(e,t,n,i){const s=lC(e,n.animations,i),o=t.annotations,a=dC(t.elements,o);for(let r=0;r<o.length;r++){const l=o[r],c=Vh(a,r,l.type),d=l.setContext(uC(e,c,a,l)),h=c.resolveElementProperties(e,d);h.skip=rC(h),"elements"in h&&(cC(c,h.elements,d,s),delete h.elements),Xt(c.x)||Object.assign(c,h),Object.assign(c,h.initProperties),h.options=Hh(d),s.update(c,h)}}function rC(e){return isNaN(e.x)||isNaN(e.y)}function lC(e,t,n){return n==="reset"||n==="none"||n==="resize"?sC:new la(e,t)}function cC(e,t,n,i){const s=e.elements||(e.elements=[]);s.length=t.length;for(let o=0;o<t.length;o++){const a=t[o],r=a.properties,l=Vh(s,o,a.type,a.initProperties),c=n[a.optionScope].override(a);r.options=Hh(c),i.update(l,r)}}function Vh(e,t,n,i){const s=Ye[ur(n)];let o=e[t];return(!o||!(o instanceof s))&&(o=e[t]=new s,Object.assign(o,i)),o}function Hh(e){const t=Ye[ur(e.type)],n={};n.id=e.id,n.type=e.type,n.drawTime=e.drawTime,Object.assign(n,dr(e,t.defaults),dr(e,t.defaultRoutes));for(const i of oC)n[i]=e[i];return n}function dr(e,t){const n={};for(const i of Object.keys(t)){const s=t[i],o=e[i];cr(i)&&ct(o)?n[i]=o.map(a=>Uh(a,s)):n[i]=Uh(o,s)}return n}function uC(e,t,n,i){return t.$context||(t.$context=Object.assign(Object.create(e.getContext()),{element:t,get elements(){return n.filter(s=>s&&s.options)},id:i.id,type:"annotation"}))}function dC(e,t){const n=t.length,i=e.length;if(i<n){const s=n-i;e.splice(i,0,...new Array(s))}else i>n&&e.splice(n,i-n);return e}var hC="3.1.0";const We=new Map,$h=e=>e.type!=="doughnutLabel",fC=ir.concat(eo);var Yh={id:"annotation",version:hC,beforeRegister(){K1("chart.js","4.0",Zt.version)},afterRegister(){Zt.register(Ye)},afterUnregister(){Zt.unregister(Ye)},beforeInit(e){We.set(e,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(e,t,n){const i=We.get(e),s=i.annotations=[];let o=n.annotations;et(o)?Object.keys(o).forEach(a=>{const r=o[a];et(r)&&(r.id=a,s.push(r))}):ct(o)&&s.push(...o),AD(s.filter($h),e.scales)},afterDataLimits(e,t){const n=We.get(e);OD(e,t.scale,n.annotations.filter($h).filter(i=>i.display&&i.adjustScaleRange))},afterUpdate(e,t,n){const i=We.get(e);SD(e,i,n),aC(e,i,n,t.mode),i.visibleElements=i.elements.filter(s=>!s.skip&&s.options.display),CD(e,i,n)},beforeDatasetsDraw(e,t,n){Wi(e,"beforeDatasetsDraw",n.clip)},afterDatasetsDraw(e,t,n){Wi(e,"afterDatasetsDraw",n.clip)},beforeDatasetDraw(e,t,n){Wi(e,t.index,n.clip)},beforeDraw(e,t,n){Wi(e,"beforeDraw",n.clip)},afterDraw(e,t,n){Wi(e,"afterDraw",n.clip)},beforeEvent(e,t,n){const i=We.get(e);vD(i,t.event,n)&&(t.changed=!0)},afterDestroy(e){We.delete(e)},getAnnotations(e){const t=We.get(e);return t?t.elements:[]},_getAnnotationElementsAtEventForMode(e,t,n){return Za(e,t,n)},defaults:{animations:{numbers:{properties:["x","y","x2","y2","width","height","centerX","centerY","pointX","pointY","radius"],type:"number"},colors:{properties:["backgroundColor","borderColor"],type:"color"}},clip:!0,interaction:{mode:void 0,axis:void 0,intersect:void 0},common:{drawTime:"afterDatasetsDraw",init:!1,label:{}}},descriptors:{_indexable:!1,_scriptable:e=>!fC.includes(e)&&e!=="init",annotations:{_allKeys:!1,_fallback:(e,t)=>`elements.${Ye[ur(t.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:cr,_fallback:!0},_indexable:cr}},additionalOptionScopes:[""]};function Wi(e,t,n){const{ctx:i,chartArea:s}=e,o=We.get(e);n&&_i(i,s);const a=mC(o.visibleElements,t).sort((r,l)=>r.element.options.z-l.element.options.z);for(const r of a)pC(i,s,o,r);n&&xi(i)}function mC(e,t){const n=[];for(const i of e)if(i.options.drawTime===t&&n.push({element:i,main:!0}),i.elements&&i.elements.length)for(const s of i.elements)s.options.display&&s.options.drawTime===t&&n.push({element:s});return n}function pC(e,t,n,i){const s=i.element;i.main?(Mh(n,s,"beforeDraw"),s.draw(e,t),Mh(n,s,"afterDraw")):s.draw(e,t)}const gC={class:"zoom-timerange-container"},yC={class:"zoom-timerange-details"},bC={class:"label","data-testid":"zoom-timerange-from"},_C={class:"label","data-testid":"zoom-timerange-to"},xC=u.defineComponent({__name:"ZoomTimerange",props:{start:{},end:{},granularity:{}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=u.ref(Un({tickValue:t.start,granularity:t.granularity})),s=u.ref(Un({tickValue:t.end,granularity:t.granularity})),o=(a,r)=>{Od(()=>{i.value=Un({tickValue:a,granularity:t.granularity}),s.value=Un({tickValue:r,granularity:t.granularity})},100)()};return u.watch(()=>[t.start,t.end],([a,r])=>{o(a,r)},{immediate:!0}),(a,r)=>(u.openBlock(),u.createElementBlock("div",gC,[u.createElementVNode("div",yC,[u.createElementVNode("div",bC,u.toDisplayString(u.unref(n).t("zoom_time_range.from")),1),u.createElementVNode("div",null,u.toDisplayString(i.value),1),u.createElementVNode("div",_C,u.toDisplayString(u.unref(n).t("zoom_time_range.to")),1),u.createElementVNode("div",null,u.toDisplayString(s.value),1)])]))}}),Et=(e,t)=>{const n=e.__vccOpts||e;for(const[i,s]of t)n[i]=s;return n},Wh=Et(xC,[["__scopeId","data-v-4fa681cf"]]),wC={class:"zoom-actions-container"},kC={class:"zoom-actions-heading"},TC={class:"zoom-action-select"},SC=["data-testid"],vC=["aria-disabled","href"],MC=["onClick"],DC=Et(u.defineComponent({__name:"ZoomActions",props:{zoomActionItems:{},newTimeRange:{},granularity:{}},emits:["onAction"],setup(e,{emit:t}){const n=e,i=t,s=o=>{o.action&&(o.action(n.newTimeRange),i("onAction"))};return(o,a)=>(u.openBlock(),u.createElementBlock("div",wC,[u.createElementVNode("div",kC,[u.createVNode(Wh,{end:e.newTimeRange.end,granularity:e.granularity,start:e.newTimeRange.start},null,8,["end","granularity","start"]),u.createVNode(u.unref(St.CloseIcon),{class:"zoom-actions-close-icon",color:`var(--kui-color-text-neutral, ${u.unref(fl)})`,size:`var(--kui-icon-size-30, ${u.unref(Sn)})`,onClick:a[0]||(a[0]=r=>o.$emit("onAction"))},null,8,["color","size"])]),a[2]||(a[2]=u.createElementVNode("div",{class:"zoom-actions-heading-divider"},null,-1)),u.createElementVNode("div",TC,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.zoomActionItems,r=>(u.openBlock(),u.createElementBlock("div",{key:r.key,class:u.normalizeClass(["zoom-action-item",{disabled:r.disabled}]),"data-testid":`zoom-action-item-${r.key}`},[r.href?(u.openBlock(),u.createElementBlock("a",{key:0,"aria-disabled":r.disabled,class:"zoom-action-link",href:r.href,onClick:a[1]||(a[1]=l=>o.$emit("onAction"))},u.toDisplayString(r.label),9,vC)):(u.openBlock(),u.createElementBlock("div",{key:1,onClick:l=>s(r)},u.toDisplayString(r.label),9,MC))],10,SC))),128))])]))}}),[["__scopeId","data-v-79ba72f8"]]),CC={key:2},OC={class:"tooltip-title"},AC={class:"title"},PC={key:0,class:"subtitle"},EC={class:"context"},RC={class:"metric"},IC={class:"tooltip"},LC={key:0,class:"square-marker marker-placeholder"},NC={class:"display-value"},ji=Et(u.defineComponent({__name:"ChartTooltip",props:{state:{},tooltipTitle:{default:""},absoluteLeft:{default:"0px"},absoluteTop:{default:"0px"},zoomTimeRange:{default:void 0},zoomActionItems:{default:void 0},granularity:{default:void 0}},emits:["dimensions","onAction"],setup(e,{emit:t}){const n=t,i=e,s=u.ref(null),{x:o,y:a,isDragging:r}=vM(s,{initialValue:{x:parseFloat(i.absoluteLeft),y:parseFloat(i.absoluteTop)}}),l=u.computed(()=>`${a.value}px`),c=u.computed(()=>`${o.value}px`),d=u.computed(()=>i.state.tooltipContext),h=u.computed(()=>i.state.metricDisplay),f=u.computed(()=>["interactive","zoom-interactive"].includes(i.state.interactionMode));return u.watch(()=>[i.absoluteLeft,i.absoluteTop],([m,p])=>{r.value||(o.value=parseFloat(m),a.value=parseFloat(p))}),u.watch(r,m=>{m?document.body.classList.add("no-select"):document.body.classList.remove("no-select")}),u.watch(s,m=>{if(m){const{width:p,height:g}=m.getBoundingClientRect();n("dimensions",{width:p,height:g})}}),(m,p)=>e.state.showTooltip?(u.openBlock(),u.createElementBlock("div",{key:0,ref_key:"tooltipEl",ref:s,class:u.normalizeClass(["tooltip-container",{locked:e.state.interactionMode==="interactive"}]),style:u.normalizeStyle({transform:f.value?`translate(${c.value}, ${l.value})`:`translate(${e.absoluteLeft}, ${e.absoluteTop})`,left:"0",top:"0",pointerEvents:f.value?"all":"none"})},[e.state.interactionMode==="selecting-chart-area"&&e.granularity&&e.zoomTimeRange&&e.zoomTimeRange.end&&e.zoomTimeRange.start?(u.openBlock(),u.createBlock(Wh,{key:0,end:e.zoomTimeRange?.end,granularity:e.granularity,start:e.zoomTimeRange?.start},null,8,["end","granularity","start"])):e.state.interactionMode==="zoom-interactive"&&e.zoomTimeRange&&e.zoomActionItems&&e.granularity?(u.openBlock(),u.createBlock(DC,{key:1,granularity:e.granularity,"new-time-range":e.zoomTimeRange,"zoom-action-items":e.zoomActionItems,onOnAction:p[0]||(p[0]=g=>n("onAction"))},null,8,["granularity","new-time-range","zoom-action-items"])):(u.openBlock(),u.createElementBlock("div",CC,[u.createElementVNode("div",OC,[u.createElementVNode("div",AC,[u.createElementVNode("div",null,u.toDisplayString(e.tooltipTitle),1),f.value?(u.openBlock(),u.createBlock(u.unref(St.DragIcon),{key:0,class:"drag-icon",color:`var(--kui-color-text-neutral, ${u.unref(fl)})`,size:`var(--kui-icon-size-30, ${u.unref(Sn)})`},null,8,["color","size"])):u.createCommentVNode("",!0)]),d.value||h.value?(u.openBlock(),u.createElementBlock("div",PC,[u.createElementVNode("div",EC,u.toDisplayString(d.value),1),u.createElementVNode("div",RC,u.toDisplayString(h.value),1)])):u.createCommentVNode("",!0)]),u.createElementVNode("ul",IC,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.state.tooltipSeries,({backgroundColor:g,borderColor:y,label:_,value:x,isSegmentEmpty:T,isExtra:v},w)=>(u.openBlock(),u.createElementBlock(u.Fragment,{key:_+w},[e.state.tooltipSeries.length?(u.openBlock(),u.createElementBlock("li",{key:0,class:u.normalizeClass({"extra-row":v})},[v?(u.openBlock(),u.createElementBlock("div",LC)):(u.openBlock(),u.createElementBlock("div",{key:1,class:"square-marker",style:u.normalizeStyle({background:String(g),borderColor:String(y)})},null,4)),u.createElementVNode("span",{class:u.normalizeClass(["display-label",{empty:T}])},u.toDisplayString(_),3),u.createElementVNode("span",NC,u.toDisplayString(x),1)],2)):u.createCommentVNode("",!0)],64))),128))])]))],6)):u.createCommentVNode("",!0)}}),[["__scopeId","data-v-fb2f2a72"]]),BC={key:0,class:"legend-container","data-testid":"legend"},FC=["onClick"],zC={key:0,"aria-hidden":"true",class:"line-marker",height:"2",width:"16"},UC=["stroke","stroke-dasharray"],VC=["title"],HC={class:"label truncate-label"},$C={key:0,class:"sub-label"},YC={key:0},WC={class:"tooltip-content"},oo=Et(u.defineComponent({__name:"ChartLegend",props:{id:{type:String,required:!0},items:{type:Object,required:!0},chartInstance:{type:Object,required:!1,default:()=>null}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=u.inject("showLegendValues",!1),s=u.inject("legendPosition",u.ref(Nt.Bottom)),o=({datasetIndex:l,index:c,isKey:d},h)=>d?`key-${h}`:`dataset-${l??0}-${c??0}`,a=(l=0,c)=>{if(t.chartInstance===null)return;const d=t.chartInstance instanceof Zt?t.chartInstance:t.chartInstance.chart,h=r(l,c);!d.getDatasetMeta(l).dataset&&c!==void 0?d.toggleDataVisibility(c):h?d.hide(l,c):d.show(l,c),d.update()},r=(l=0,c)=>{if(t.chartInstance===null||t.chartInstance.chart===null)return!0;const d=t.chartInstance instanceof Zt?t.chartInstance:t.chartInstance.chart;return d.getDatasetMeta(l).dataset||c===void 0?d.isDatasetVisible(l):d.getDataVisibility(c)};return(l,c)=>{const d=u.resolveComponent("KTooltip");return u.unref(s)!==u.unref(Nt).Hidden?(u.openBlock(),u.createElementBlock("ul",BC,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.items,({fillStyle:h,strokeStyle:f,text:m,datasetIndex:p,index:g,value:y,isSegmentEmpty:_,isKey:x,lineDash:T},v)=>(u.openBlock(),u.createElementBlock("li",{key:o({datasetIndex:p,index:g,isKey:x},v),class:u.normalizeClass({"legend-key":x}),onClick:w=>x?void 0:a(p,g)},[T?.length?(u.openBlock(),u.createElementBlock("svg",zC,[u.createElementVNode("line",{stroke:f,"stroke-dasharray":T.join(" "),"stroke-width":"2",x1:"0",x2:"16",y1:"1",y2:"1"},null,8,UC)])):(u.openBlock(),u.createElementBlock("div",{key:1,class:"square-marker",style:u.normalizeStyle({background:h,"border-color":f})},null,4)),u.createVNode(d,null,u.createSlots({default:u.withCtx(()=>[u.createElementVNode("div",{class:u.normalizeClass(["label-container",{"strike-through":!x&&!r(p,g),"inline-value":x}]),title:y&&(u.unref(i)||x)?`${m}: ${y.formatted}`:m},[u.createElementVNode("div",HC,u.toDisplayString(m),1),y&&(u.unref(i)||x)?(u.openBlock(),u.createElementBlock("div",$C,[x?(u.openBlock(),u.createElementBlock("span",YC,"-")):u.createCommentVNode("",!0),u.createTextVNode(" "+u.toDisplayString(y.formatted),1)])):u.createCommentVNode("",!0)],10,VC)]),_:2},[_?{name:"content",fn:u.withCtx(()=>[u.createElementVNode("div",WC,u.toDisplayString(u.unref(n).t("emptyEntityInfo")),1)]),key:"0"}:void 0]),1024)],10,FC))),128))])):u.createCommentVNode("",!0)}}}),[["__scopeId","data-v-90ef4d12"]]),Bt=[];for(let e=0;e<256;++e)Bt.push((e+256).toString(16).slice(1));function jC(e,t=0){return(Bt[e[t+0]]+Bt[e[t+1]]+Bt[e[t+2]]+Bt[e[t+3]]+"-"+Bt[e[t+4]]+Bt[e[t+5]]+"-"+Bt[e[t+6]]+Bt[e[t+7]]+"-"+Bt[e[t+8]]+Bt[e[t+9]]+"-"+Bt[e[t+10]]+Bt[e[t+11]]+Bt[e[t+12]]+Bt[e[t+13]]+Bt[e[t+14]]+Bt[e[t+15]]).toLowerCase()}const qC=new Uint8Array(16);function GC(){return crypto.getRandomValues(qC)}function hr(e,t,n){return crypto.randomUUID?crypto.randomUUID():XC(e)}function XC(e,t,n){e=e||{};const i=e.random??e.rng?.()??GC();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,jC(i)}const jh=(e,t)=>{const n=e.ctx,i=e.scales.y,s=e.scales.x,o=t[t.length-1].element;n.save(),n.strokeStyle="rgba(100, 100, 100, 1)",n.lineWidth=3,e.options.indexAxis==="x"?n.strokeRect(o.x-o.width/2,o.y,o.width,i.bottom-o.y):n.strokeRect(s.left,o.y-o.height/2,o.x-s.left,o.height),n.restore()};class qh{id="highlightPlugin";_clickedElements;_previousHoverOption;_clicked=!1;_pause=!1;_suppressNextClick=!1;afterDatasetsDraw(t){this._clickedElements&&this._clickedElements.length&&!this._pause&&jh(t,this._clickedElements)}afterEvent(t,{event:n}){if(n.type==="click"&&this._suppressNextClick){this._suppressNextClick=!1;return}if(n.type!=="click"||!n.native||this._pause)return;this._clicked=!this._clicked;const i=t.options.interaction?.mode||"index",s=t.getElementsAtEventForMode(n.native,i,{intersect:!1},!0);s.length&&this._clicked?(this._clickedElements=s,jh(t,this._clickedElements),this._previousHoverOption=t.options.hover,t.options.hover={mode:null}):(delete this._clickedElements,t.options.hover=this._previousHoverOption||t.options.hover,this._clicked=!1)}beforeDestroy(t){delete this._clickedElements,t.options.hover=this._previousHoverOption||t.options.hover,this._clicked=!1}pause(){this._pause=!0}get isPaused(){return this._pause}resume(t=!1){this._pause=!1,t&&(this._suppressNextClick=!0)}}const KC=(e,t,n,i,s="#0275d8")=>{e&&(e.save(),e.beginPath(),e.moveTo(t,n),e.lineTo(t,i),e.lineWidth=1,e.strokeStyle=s,e.stroke(),e.restore())};class ao{id="coordinator";coordinator=void 0;instanceId="";stopWatcher=void 0;activeDimension=null;activeDimensionValue=null;requiresUpdate=!1;triggerOnSelf=!1;watchTimestamp=!1;watchDimension=!1;lastMouseBrushEvent=0;constructor({coordinator:t,requiresUpdate:n=!1,triggerOnSelf:i=!1,watchTimestamp:s=!1,watchDimension:o=!1}){this.instanceId=crypto.randomUUID(),this.coordinator=t,this.requiresUpdate=n,this.triggerOnSelf=i,this.watchTimestamp=s,this.watchDimension=o}afterInit(t){if(!this.coordinator)return;const n=this.requiresUpdate?()=>t.update("none"):()=>t.draw(),i=this._watchTimestamp(n),s=this._watchDimension(n);this.stopWatcher=()=>{i&&i(),s&&s()}}afterEvent(t,{event:n}){this.coordinator&&(n.type==="mousemove"||n.type==="mouseout")&&requestAnimationFrame(i=>this._onMouseBrush(n.native,t,i))}beforeDatasetDraw(t,n){if(!this.coordinator||!this.watchDimension||this.coordinator.activeChart.value===this.instanceId&&!this.triggerOnSelf)return;t.config.type==="doughnut"?this._highlightDimensionDonut(t):this._highlightDimensionDefault(t,n)}afterDatasetsDraw(t){if(t.ctx.globalAlpha=1,!this.coordinator||!this.watchTimestamp||!this.coordinator.activeTimestamp.value||this.coordinator.activeChart.value===this.instanceId&&!this.triggerOnSelf)return;const i=t.scales.x.getPixelForValue(this.coordinator.activeTimestamp.value),s=t.ctx;KC(s,i,t.scales.y.top,t.scales.y.bottom)}beforeDestroy(){this.stopWatcher&&this.stopWatcher()}_watchTimestamp(t){if(!this.coordinator)return;let n;return this.watchTimestamp&&(n=u.watch([this.coordinator.activeChart,this.coordinator.activeTimestamp],([i])=>{(i!==this.instanceId||this.triggerOnSelf)&&t()})),n}_watchDimension(t){if(!this.coordinator)return;let n;if(this.watchDimension){let i;n=u.watch([this.coordinator.activeChart,this.coordinator.activeDimension,this.coordinator.activeDimensionValue],([s,o,a])=>{clearTimeout(i),o===null&&(this.activeDimension=null),a===null&&(this.activeDimensionValue=null),i=setTimeout(()=>{this.activeDimension=o,this.activeDimensionValue=a,(s!==this.instanceId||this.triggerOnSelf)&&t()},this.coordinator?.DIMENSION_DEBOUNCE_MS??400),u.onWatcherCleanup(()=>{clearTimeout(i)})})}return n}_onMouseBrush(t,n,i){if(!this.coordinator)return;const s=t.type,o=Math.min(this.coordinator.TIMESTAMP_DEBOUNCE_MS,this.coordinator.DIMENSION_DEBOUNCE_MS);if(!(s==="mousemove"&&i-this.lastMouseBrushEvent<o)){if(s==="mousemove"){if(!n.canvas)return;const a=this._getTimestamp(n,t),[r,l]=this._getDatasetDimension(n,t)??[];this.coordinator.activate({chartUuid:this.instanceId,timestamp:a,dimension:r,dimensionValue:l})}else s==="mouseout"&&this.coordinator.deactivate({chartUuid:this.instanceId});this.lastMouseBrushEvent=i}}_highlightDimensionDefault(t,n){if(this.activeDimension&&this.activeDimensionValue){const i=t.data.datasets.map((s,o)=>s?.dimension===this.activeDimension&&s?.dimensionValue===this.activeDimensionValue?o:-1).filter(s=>s>=0);i.length&&(t.ctx.globalAlpha=i.includes(n.index)?1:.3)}else t.ctx.globalAlpha=1}_highlightDimensionDonut(t){if(this.activeDimension&&this.activeDimensionValue){const{dimension:n,dimensionValue:i}=t.data.datasets[0];if(n===this.activeDimension){const s=i.findIndex(o=>o===this.activeDimensionValue);s>=0?t.setActiveElements([{datasetIndex:0,index:s}]):t.setActiveElements([])}else t.setActiveElements([])}else t.setActiveElements([])}_getDatasetDimension(t,n){const i=t.config.type,s=i!=="line",o=["doughnut","scatter"].includes(i)?"point":"dataset",a=t.getElementsAtEventForMode(n,o,{intersect:s},!1),[r]=a;if(!r)return;const{datasetIndex:l,index:c}=r,{dimension:d,dimensionValue:h}=t.data.datasets[l];return i==="doughnut"?[d,h[c]]:[d,h]}_getTimestamp(t,n){const[i]=t.getElementsAtEventForMode(n,"index",{intersect:!1},!1);if(i&&this.watchTimestamp){const{datasetIndex:s,index:o}=i,{x:a}=t.data.datasets[s].data[o];return a}}}const ZC=["id"],QC=["id"],JC={class:"axis-tooltip-content"},tO="100%",eO="100%",nO=20,iO=20,Gh=6,sO=0,oO=10,aO=10,rO=1,lO=Et(u.defineComponent({__name:"StackedBarChart",props:{chartData:{},tooltipTitle:{default:""},legendValues:{default:void 0},metricUnit:{default:""},orientation:{default:"horizontal"},annotations:{type:Boolean,default:!0},metricAxesTitle:{default:void 0},dimensionAxesTitle:{default:void 0},stacked:{type:Boolean,default:!0},syntheticsDataKey:{default:""},chartLegendSortFn:{type:Function,default:(e,t)=>e.value&&t.value&&t.value.raw-e.value.raw},chartTooltipSortFn:{type:Function,default:(e,t)=>t.rawValue-e.rawValue},tooltipMetricDisplay:{default:""},coordinator:{default:void 0}},setup(e){const t=e,{i18n:n}=q.useI18n(),{translateUnit:i}=q.useTranslatedUnits(),s=crypto.randomUUID(),o=crypto.randomUUID(),a=new qh,r=new ao({coordinator:t.coordinator,triggerOnSelf:!0,watchTimestamp:!1,watchDimension:!0}),l=u.useTemplateRef("chartContainer"),c=u.useTemplateRef("chartParent"),d=({chart:L},H)=>{const pt=L.data,ut=pt.labels?.indexOf(H);return pt.datasets.reduce((rt,Dt,Wt)=>{if(L.isDatasetVisible(Wt)){const Lt=Dt.data[ut];return isNaN(Lt)?rt:rt+Lt}else return rt},0)},h=(L,H,pt,ut)=>{const rt=ut==="horizontal";H===null&&(H=n.t("entityNoName"));const Dt={type:"label",yValue:kt=>rt?H:d(kt,H),xValue:kt=>rt?d(kt,H):H},Wt={...Dt,position:rt?{x:"start",y:"center"}:{x:"center",y:"end"},yAdjust:()=>rt?0:-Math.abs(qM()),content:kt=>Ed(d(kt,H),pt)},Lt={...Dt,content:kt=>XM(d(kt,H),GM(kt.chart,L)),position:rt?{x:"start",y:"center"}:{x:"center",y:"end"},xAdjust:kt=>rt?jM(Ed(d(kt,H),pt)):0,color:pe({state:"neutral"})};return{[`${H}-value`]:Wt,[`${H}-percent`]:Lt}},f=u.useTemplateRef("canvas"),m=u.useTemplateRef("axis"),p=hr(),g=hr(),y=u.ref([]),_=u.inject("legendPosition",Nt.Bottom),x=u.reactive({show:!1,top:"0px",left:"0px",text:"",offset:-50}),T=u.toRef(t,"metricUnit"),v=u.computed(()=>t.orientation==="horizontal"),w=u.reactive({showTooltip:!1,tooltipContext:"",metricDisplay:u.toRef(t,"tooltipMetricDisplay"),dimensionDisplay:u.toRef(t,"dimensionAxesTitle"),tooltipSeries:[],left:"",top:"",units:u.toRef(t,"metricUnit"),translateUnit:i,offsetX:0,offsetY:0,width:0,height:0,interactionMode:"idle",chartType:v.value?"horizontal_bar":"vertical_bar",chartID:o,chartTooltipSortFn:t.chartTooltipSortFn}),{tooltipAbsoluteLeft:D,tooltipAbsoluteTop:S}=q.useTooltipAbsolutePosition(c,w),A=u.ref(0),R=()=>t.annotations&&t.chartData.labels?.reduce((L,H)=>Object.assign(L,h(t.chartData,H,T.value,t.orientation)),{}),E={id:p,afterUpdate(L){A.value+=1,y.value=Ia(L,t.legendValues,t.chartLegendSortFn)}},k={id:g,afterUpdate(L){L.options.plugins.annotation.annotations=t.annotations?R():{}}},z=[E,{id:"axisHover",afterEvent(L,H){if(x.show=!1,H.event.type==="mousemove"){const pt=H.event,ut=L.options.indexAxis,rt=L.scales,Dt=L.scales[ut].getLabelForValue(Number(L.scales[ut].getValueForPixel(pt[ut]))),Lt=L.scales[ut].getLabels().indexOf(Dt),kt=t.chartData.isLabelEmpty?.[Lt];if((pn=>pn==="x"?pt.y>rt.x.top:pt.x<rt.y.right)(ut)){w.interactionMode!=="interactive"&&(w.showTooltip=!1);const B=L.canvas.getContext("2d").measureText(Dt).width,X=Math.abs(Math.round(pt.x-B*.5)),at=Math.round(pt.x+B*.5),Tt=L.canvas.getBoundingClientRect(),te=40;x.left=ut==="x"?`${(X>0?X:at)-x.offset+Tt.left}px`:`${pt.x-B*.5-x.offset+Tt.left}px`,x.top=`${pt.y-te+Tt.top}px`,Dt.length>qs?(x.show=!0,x.text=Dt):kt?(x.text=n.t("emptyEntityInfo"),x.show=!0):x.show=!1}else x.show=!1}}},a,r,...t.annotations?[k]:[]],N=u.computed(()=>t.chartData.labels&&t.chartData.labels.length||0),V=u.ref(0),Y=u.ref(0),G=new ResizeObserver(Od(L=>{V.value=L[0].contentRect.width,Y.value=L[0].contentRect.height},100)),st=u.computed(()=>{const L=t.chartData?.labels?.length;return f.value&&L&&!v.value?`${Math.max(L*(nO+Gh),V.value)}px`:tO}),ot=u.computed(()=>{const L=t.chartData?.labels?.length;return f.value&&L&&v.value?`${Math.max(L*(iO+Gh),Y.value)}px`:eO});q.useReportChartDataForSynthetics(u.toRef(t,"chartData"),u.toRef(t,"syntheticsDataKey")),u.onMounted(()=>{t.annotations&&Zt.register(Yh),l.value&&(V.value=l.value.offsetWidth,Y.value=l.value.offsetHeight,G.observe(l.value))}),u.onUnmounted(()=>{l.value&&G.unobserve(l.value)});const K=u.computed(()=>{const L=q.useBarChartOptions({tooltipState:w,legendID:p,stacked:u.toRef(t,"stacked"),metricAxesTitle:u.toRef(t,"metricAxesTitle"),dimensionAxesTitle:u.toRef(t,"dimensionAxesTitle"),indexAxis:v.value?"y":"x",numLabels:N});return{...L.value,plugins:{...L.value.plugins,annotation:{annotations:R(),clip:!1}}}}),U=q.useChartJSCommon("bar",f,u.toRef(t,"chartData"),z,K);u.onBeforeUnmount(()=>{Zt.unregister(Yh)});const M={[Nt.Bottom]:"column"},P=u.computed(()=>{if(m.value&&U.value){const L=window.devicePixelRatio,H=U.value,pt=H.scales.y.width*L+rO,ut=(H.scales.y.height+H.scales.y.top+H.scales.x.height)*L,rt=m.value.getContext("2d");return rt.scale(L,L),rt.canvas.width=pt,rt.canvas.height=ut,rt.canvas.style.width=`${pt/L}px`,rt.canvas.style.height=`${ut/L}px`,{scale:L,width:pt*L,height:ut*L,targetCtx:rt}}return null}),F=L=>{const H=L.target;if(P.value&&U.value&&!v.value){const pt=P.value.scale,ut=P.value.targetCtx,rt=P.value.width,Dt=P.value.height,Wt=U.value,Lt=Wt.canvas;ut.fillStyle="white",H.scrollLeft>=sO&&H.scrollLeft<=oO?(ut.globalCompositeOperation="source-over",ut.clearRect(0,0,rt,Dt),ut.drawImage(Lt,0,0,rt,Dt,0,0,rt,Dt),ut.globalCompositeOperation="destination-over",ut.fillRect(0,0,rt,Dt)):(ut.globalCompositeOperation="source-over",ut.fillRect(0,(Wt.scales.y.height+Wt.scales.y.top+aO)*pt,rt,Wt.scales.x.height*pt))}w.offsetY=H.scrollTop,w.offsetX=H.scrollLeft,x.offset=H.scrollLeft},$=({width:L,height:H})=>{w.width=L,w.height=H};u.watch(()=>t.orientation,()=>{if(m.value&&P.value){const L=P.value.width,H=P.value.height;(m.value?.getContext("2d")).clearRect(0,0,L,H)}w.showTooltip=!1,w.interactionMode="idle"}),u.watch(()=>t.annotations,L=>{U.value&&(L?U.value.options.plugins.annotation.annotations=R(t.chartData):delete U.value.options.plugins.annotation.annotations)});const it=()=>{w.showTooltip&&(w.interactionMode!=="idle"?w.interactionMode="idle":w.interactionMode="interactive")};return(L,H)=>(u.openBlock(),u.createElementBlock("div",{ref:"chartParent",class:u.normalizeClass(["chart-parent",M[u.unref(_)]])},[u.createElementVNode("canvas",{id:u.unref(s),ref:"axis",class:"axis"},null,8,ZC),u.createElementVNode("div",{ref:"chartContainer",class:"chart-container",onClick:H[0]||(H[0]=pt=>it()),onScroll:F},[u.createElementVNode("div",{class:"chart-body",style:u.normalizeStyle({width:st.value,height:ot.value})},[u.createElementVNode("canvas",{id:u.unref(o),ref:"canvas",class:"chart-canvas"},null,8,QC)],4)],544),(u.openBlock(),u.createBlock(u.Teleport,{to:"body"},[x.show?(u.openBlock(),u.createElementBlock("div",{key:0,class:"axis-tooltip",style:u.normalizeStyle({top:x.top,left:x.left}),width:"auto"},[u.createElementVNode("div",JC,u.toDisplayString(x.text),1)],4)):u.createCommentVNode("",!0),u.createVNode(ji,{"absolute-left":u.unref(D),"absolute-top":u.unref(S),"chart-parent-ref":c.value,state:w,"tooltip-title":e.tooltipTitle,onDimensions:$},null,8,["absolute-left","absolute-top","chart-parent-ref","state","tooltip-title"])])),u.createVNode(oo,{id:u.unref(p),"chart-instance":u.unref(U),items:y.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-641d9623"]]);const cO={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};Zc._date.override({_id:"date-fns",formats:function(){return cO},parse:function(e,t){if(e===null||typeof e>"u")return null;const n=typeof e;return n==="number"||e instanceof Date?e=J(e):n==="string"&&(typeof t=="string"?e=Rb(e,t,new Date,this.options):e=Vl(e,this.options)),Eo(e)?e.getTime():null},format:function(e,t){return rs(e,t,this.options)},add:function(e,t,n){switch(n){case"millisecond":return Ao(e,t);case"second":return Cy(e,t);case"minute":return My(e,t);case"hour":return Ty(e,t);case"day":return os(e,t);case"week":return Oy(e,t);case"month":return Oo(e,t);case"quarter":return Dy(e,t);case"year":return Ay(e,t);default:return e}},diff:function(e,t,n){switch(n){case"millisecond":return Ro(e,t);case"second":return Fy(e,t);case"minute":return Ly(e,t);case"hour":return Iy(e,t);case"day":return _l(e,t);case"week":return zy(e,t);case"month":return Tl(e,t);case"quarter":return By(e,t);case"year":return Uy(e,t);default:return 0}},startOf:function(e,t,n){switch(t){case"second":return Bb(e);case"minute":return Nb(e);case"hour":return Lb(e);case"day":return Po(e);case"week":return ce(e);case"isoWeek":return ce(e,{weekStartsOn:+n});case"month":return Hy(e);case"quarter":return Vy(e);case"year":return Sl(e);default:return e}},endOf:function(e,t){switch(t){case"second":return Gy(e);case"minute":return jy(e);case"hour":return Yy(e);case"day":return wl(e);case"week":return Wy(e);case"month":return kl(e);case"quarter":return qy(e);case"year":return $y(e);default:return e}}});const Xh={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},uO={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...Xh,...{ariaLabel:{type:String},ariaDescribedby:{type:String}}},dO=u.version[0]==="2"?(e,t)=>Object.assign(e,{attrs:t}):(e,t)=>Object.assign(e,t);function Wn(e){return u.isProxy(e)?u.toRaw(e):e}function hO(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e;return u.isProxy(t)?new Proxy(e,{}):e}function fO(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function Kh(e,t){e.labels=t}function Zh(e,t,n){const i=[];e.datasets=t.map(s=>{const o=e.datasets.find(a=>a[n]===s[n]);return!o||!s.data||i.includes(o)?{...s}:(i.push(o),Object.assign(o,s),o)})}function mO(e,t){const n={labels:[],datasets:[]};return Kh(n,e.labels),Zh(n,e.datasets,t),n}const pO=u.defineComponent({props:uO,setup(e,t){let{expose:n,slots:i}=t;const s=u.ref(null),o=u.shallowRef(null);n({chart:o});const a=()=>{if(!s.value)return;const{type:c,data:d,options:h,plugins:f,datasetIdKey:m}=e,p=mO(d,m),g=hO(p,d);o.value=new Zt(s.value,{type:c,data:g,options:{...h},plugins:f})},r=()=>{const c=u.toRaw(o.value);c&&(e.destroyDelay>0?setTimeout(()=>{c.destroy(),o.value=null},e.destroyDelay):(c.destroy(),o.value=null))},l=c=>{c.update(e.updateMode)};return u.onMounted(a),u.onUnmounted(r),u.watch([()=>e.options,()=>e.data],(c,d)=>{let[h,f]=c,[m,p]=d;const g=u.toRaw(o.value);if(!g)return;let y=!1;if(h){const _=Wn(h),x=Wn(m);_&&_!==x&&(fO(g,_),y=!0)}if(f){const _=Wn(f.labels),x=Wn(p.labels),T=Wn(f.datasets),v=Wn(p.datasets);_!==x&&(Kh(g.config.data,_),y=!0),T&&T!==v&&(Zh(g.config.data,T,e.datasetIdKey),y=!0)}y&&u.nextTick(()=>{l(g)})},{deep:!0}),()=>u.h("canvas",{role:"img","aria-label":e.ariaLabel,"aria-describedby":e.ariaDescribedby,ref:s},[u.h("p",{},[i.default?i.default():""])])}});function ro(e,t){return Zt.register(t),u.defineComponent({props:Xh,setup(n,i){let{expose:s}=i;const o=u.shallowRef(null),a=u.shallowRef(null);u.watch(()=>a.value?.chart??null,l=>{o.value=l},{flush:"sync"}),s({chart:o});const r=l=>{a.value=l};return()=>u.h(pO,dO({ref:r},{type:e,...n}))}})}const Qh=ro("bar",qc),Jh=ro("doughnut",Ti),tf=ro("line",Gc),gO=ro("scatter",Kc),yO={class:"chart-container"},bO={key:0,class:"chart-center-metric"},_O={class:"chart-center-total"},xO={key:0,class:"chart-center-unit"},wO=u.defineComponent({__name:"DonutChart",props:{chartData:{},tooltipTitle:{},metricUnit:{default:""},metricName:{default:""},legendPosition:{default:Nt.Bottom},legendValues:{default:void 0},syntheticsDataKey:{default:""},tooltipDimensionDisplay:{default:""},tooltipMetricDisplay:{default:""},showCenterMetric:{type:Boolean,default:!0},coordinator:{default:void 0}},setup(e){const t=e,{translateUnit:n}=q.useTranslatedUnits(),{i18n:i}=q.useI18n(),s=crypto.randomUUID(),o=crypto.randomUUID(),a=u.ref([]),r=u.useTemplateRef("chartParent"),l=new ao({coordinator:t.coordinator,requiresUpdate:!0,triggerOnSelf:!1,watchTimestamp:!1,watchDimension:!0}),c=u.reactive({showTooltip:!1,tooltipContext:"",metricDisplay:u.toRef(t,"tooltipMetricDisplay"),dimensionDisplay:u.toRef(t,"tooltipDimensionDisplay"),tooltipSeries:[],left:"",top:"",units:u.toRef(t,"metricUnit"),translateUnit:n,offsetX:0,offsetY:0,width:0,height:0,chartID:o,chartType:"donut",interactionMode:"idle"}),{tooltipAbsoluteLeft:d,tooltipAbsoluteTop:h}=q.useTooltipAbsolutePosition(r,c),f={id:s,afterUpdate(A){a.value=A.options.plugins.legend.labels.generateLabels(A).map(R=>({...R,value:t.legendValues&&t.legendValues[R.text],hidden:!1}))}},m=u.computed(()=>[l,f]),p=u.computed(()=>[t.chartData.datasets.reduce((R,E)=>(R.dimension=E.dimension,R.dimensionValue.push(E.dimensionValue),R.labels.push(E.label),R.backgroundColor.push(E.backgroundColor),R.hoverBorderColor.push(xs(E.backgroundColor).saturate(.5).darken(.15).hexString()),R.data.push(E.data.reduce((k,C)=>k+C,0)),R),{dimension:"",dimensionValue:[],labels:[],backgroundColor:[],borderColor:"#ffffff",borderWidth:1,hoverBorderColor:[],hoverBorderWidth:1,data:[],hoverOffset:10})]),{formatUnit:g}=le({i18n:i}),y=u.computed(()=>I1(t.metricName??"")),_=u.computed(()=>{const A=p.value[0]?.data.reduce((R,E)=>R+E,0)??0;return g(A,t.metricUnit,{approximate:!0,translateUnit:(R,E)=>n(R,E)}).trim()}),x=u.computed(()=>t.tooltipMetricDisplay||""),T=u.computed(()=>({...t.chartData,datasets:p.value}));q.useReportChartDataForSynthetics(u.toRef(t,"chartData"),u.toRef(t,"syntheticsDataKey"));const{options:v}=q.useDonutChartOptions({tooltipState:c,legendID:s}),w=u.ref(),D=A=>({[Nt.Bottom]:"column",[Nt.Hidden]:"hidden"})[A],S=({width:A,height:R})=>{c.width=A,c.height=R};return(A,R)=>(u.openBlock(),u.createElementBlock("div",{ref:"chartParent",class:u.normalizeClass(["chart-parent",D(e.legendPosition)]),"data-testid":"donut-chart-parent"},[u.createElementVNode("div",yO,[u.createVNode(u.unref(Jh),{ref_key:"chartInstance",ref:w,"chart-id":u.unref(o),data:T.value,options:u.unref(v),plugins:m.value},null,8,["chart-id","data","options","plugins"]),e.showCenterMetric&&y.value?(u.openBlock(),u.createElementBlock("div",bO,[u.createElementVNode("span",_O,u.toDisplayString(_.value),1),x.value?(u.openBlock(),u.createElementBlock("span",xO,u.toDisplayString(x.value),1)):u.createCommentVNode("",!0)])):u.createCommentVNode("",!0),(u.openBlock(),u.createBlock(u.Teleport,{to:"body"},[u.createVNode(ji,{"absolute-left":u.unref(d),"absolute-top":u.unref(h),state:c,"tooltip-title":e.tooltipTitle,unit:e.metricUnit,onDimensions:S},null,8,["absolute-left","absolute-top","state","tooltip-title","unit"])]))]),u.createVNode(oo,{id:u.unref(s),"chart-instance":w.value,items:a.value,position:e.legendPosition},null,8,["id","chart-instance","items","position"])],2))}}),kO=Et(wO,[["__scopeId","data-v-9e8646c1"]]);class TO{id="outlierBandPlugin";beforeDatasetsDraw(t,n,i){const s=i?.value;if(s===void 0||!Number.isFinite(s)||!i?.color)return;const o=t.scales.y;if(!o||!t.chartArea)return;const{top:a,bottom:r,left:l,right:c}=t.chartArea,d=Math.min(Math.max(o.getPixelForValue(s),a),r);if(d<=a)return;const h=t.ctx;h.save(),h.fillStyle=i.color,h.fillRect(l,a,c-l,d-a),h.restore()}}const SO=1.5;class vO{id="referenceLinePlugin";afterDatasetsDraw(t,n,i){const s=i?.lines;if(!s?.length)return;const o=t.scales.y;if(!o||!t.chartArea)return;const{top:a,bottom:r,left:l,right:c}=t.chartArea,d=t.ctx;d.save(),d.lineWidth=SO;for(const{value:h,color:f,borderDash:m}of s){if(!Number.isFinite(h))continue;const p=o.getPixelForValue(h);p<a||p>r||(d.beginPath(),d.setLineDash(m),d.strokeStyle=f,d.moveTo(l,p),d.lineTo(c,p),d.stroke())}d.restore()}}const MO={class:"chart-container"},DO=Et(u.defineComponent({__name:"ScatterChart",props:{chartData:{default:void 0},tooltipTitle:{},metricUnit:{default:""},xMetric:{default:void 0},xMetricUnit:{default:void 0},granularity:{},timeRangeMs:{default:void 0},metricAxesTitle:{default:void 0},dimensionAxesTitle:{default:void 0},syntheticsDataKey:{default:""},chartLegendSortFn:{type:Function,default:()=>0},chartTooltipSortFn:{type:Function,default:(e,t)=>t.rawValue-e.rawValue},tooltipMetricDisplay:{default:""},shadeOutlierRegion:{type:Boolean,default:!1},themeColors:{default:()=>Xa()},coordinator:{default:void 0}},setup(e){const t=e,n=u.inject("legendPosition",Nt.Bottom),{i18n:i}=q.useI18n(),{formatUnit:s}=le({i18n:i}),{translateUnit:o}=q.useTranslatedUnits(),a=u.useTemplateRef("chartParent"),r=new TO,l=new vO,c=crypto.randomUUID(),d=crypto.randomUUID(),h=new ao({coordinator:t.coordinator,requiresUpdate:!0,triggerOnSelf:!0,watchTimestamp:!1,watchDimension:!0}),f=u.ref(),m=u.reactive({showTooltip:!1,tooltipContext:0,metricDisplay:u.toRef(t,"tooltipMetricDisplay"),tooltipSeries:[],left:"",top:"",units:u.toRef(t,"metricUnit"),translateUnit:o,offsetX:0,offsetY:0,width:0,height:0,chartType:"scatter",chartID:d,chartTooltipSortFn:t.chartTooltipSortFn,interactionMode:"idle"}),{tooltipAbsoluteLeft:p,tooltipAbsoluteTop:g}=q.useTooltipAbsolutePosition(a,m);q.useReportChartDataForSynthetics(u.toRef(t,"chartData"),u.toRef(t,"syntheticsDataKey"));const y=u.computed(()=>t.chartData?.outlier),_=u.computed(()=>t.chartData?.referenceLines??[]),x=u.ref([]),T={id:c,afterUpdate(k){x.value=Ia(k,void 0,t.chartLegendSortFn)}},v=u.computed(()=>{const k=[];y.value&&k.push({text:y.value.label,fillStyle:y.value.color,strokeStyle:y.value.color,isKey:!0});for(const C of _.value)k.push({text:C.label,fillStyle:C.color,strokeStyle:C.color,lineDash:C.borderDash,isKey:!0,value:{raw:C.value,formatted:s(C.value,t.metricUnit,{translateUnit:o})}});return k}),w=u.computed(()=>[...x.value,...v.value]),D=u.computed(()=>t.shadeOutlierRegion?y.value?.value:void 0),S=u.computed(()=>[h,T,...D.value!==void 0?[r]:[],..._.value.length?[l]:[]]),A=u.computed(()=>`scatter-${S.value.map(k=>k.id).join("-")}`),{options:R}=q.useScatterChartOptions({tooltipState:m,legendID:c,granularity:u.toRef(t,"granularity"),timeRangeMs:u.toRef(t,"timeRangeMs"),metricAxesTitle:u.toRef(t,"metricAxesTitle"),dimensionAxesTitle:u.toRef(t,"dimensionAxesTitle"),metricUnit:u.toRef(t,"metricUnit"),xMetric:u.toRef(t,"xMetric"),xMetricUnit:u.toRef(t,"xMetricUnit"),outlierValue:D,referenceLines:_,themeColors:u.toRef(t,"themeColors")}),E=k=>({[Nt.Bottom]:"column",[Nt.Hidden]:"hidden"})[k];return(k,C)=>(u.openBlock(),u.createElementBlock("div",{ref:"chartParent",class:u.normalizeClass(["chart-parent",E(u.unref(n))]),"data-testid":"scatter-chart-parent"},[u.createElementVNode("div",MO,[(u.openBlock(),u.createBlock(u.unref(gO),{key:A.value,ref_key:"chartInstance",ref:f,"chart-id":u.unref(d),class:"chart-canvas",data:e.chartData,"data-testid":"scatter-chart",options:u.unref(R),plugins:S.value},null,8,["chart-id","data","options","plugins"]))]),u.createVNode(ji,{"absolute-left":u.unref(p),"absolute-top":u.unref(g),"data-testid":"tooltip",granularity:e.granularity,state:m,"tooltip-title":e.tooltipTitle},null,8,["absolute-left","absolute-top","granularity","state","tooltip-title"]),u.createVNode(oo,{id:u.unref(c),"chart-instance":f.value,"data-testid":"legend",items:w.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-34d55736"]]),fr=(e,t,n,i,s="#0275d8")=>{e.save(),e.beginPath(),e.moveTo(t,n),e.lineTo(t,i),e.lineWidth=1,e.strokeStyle=s,e.stroke(),e.restore()},Gt={},CO=()=>{Gt.x=void 0,Gt.chart=void 0,Gt.strategy=void 0,Gt.group=void 0},OO=10;class ef{id="verticalLinePlugin";_clickedSegment;_pause=!1;_useBrushingState=!1;_brushStrategy;_brushGroup;constructor({brushGroup:t=void 0,brushStrategy:n=void 0,enableBrushing:i=!1}={}){let s=!1;n==="group"&&(s=t!==void 0),this._useBrushingState=i&&s,this._brushStrategy=n,this._brushGroup=t}afterEvent(t,n){if(!this._useBrushingState)return;const{event:i}=n;(i.type==="mousemove"||i.type==="mouseout")&&requestAnimationFrame(s=>this.onMouseBrush(i.type,t,s))}_lastMouseBrushEvent=0;onMouseBrush(t,n,i){if(t==="mousemove"&&i-this._lastMouseBrushEvent<OO)return;const s=()=>{Gt.chart=n,Gt.strategy=this._brushStrategy,Gt.group=this._brushGroup;for(const o of Object.values(Zt.instances))o!==n&&o.update("none")};t==="mousemove"?n.tooltip&&n.tooltip.getActiveElements()&&n.tooltip.getActiveElements().length&&(Gt.x=n.tooltip.dataPoints[0].element.x,s()):t==="mouseout"&&(Gt.x=void 0,s()),this._lastMouseBrushEvent=i}afterDatasetsDraw(t){if(this.isPaused)return;const n=t.tooltip&&t.tooltip.getActiveElements()&&t.tooltip.getActiveElements().length,i=t.ctx;if(this._clickedSegment){const{x:s}=this._clickedSegment.element;fr(i,s,t.scales.y.top,t.scales.y.bottom)}else if(this._useBrushingState)this.drawByBrush(t);else if(n){const{x:s}=t.tooltip.dataPoints[0].element;fr(i,s,t.scales.y.top,t.scales.y.bottom)}}drawByBrush(t){if(Gt.x===void 0)return;const n=Gt.chart===t?"#0275d8":"rgba(2, 117, 216, 0.3)";this._brushStrategy==="group"&&Gt.group===this._brushGroup&&fr(t.ctx,Gt.x,t.scales.y.top,t.scales.y.bottom,n)}pause(){this._pause=!0}resume(){this._pause=!1}get isPaused(){return this._pause}set clickedSegment(t){this._clickedSegment=t}get clickedSegment(){return this._clickedSegment}destroyClickedSegment(){delete this._clickedSegment}beforeDestroy(t){if(this._clickedSegment&&this.destroyClickedSegment(),this._useBrushingState&&Gt.chart===t){const n=Gt.x!==void 0;if(CO(),n)for(const i of Object.values(Zt.instances))i!==t&&i.update("none")}}}const AO=(e,t,n)=>{const i=e.ctx;i.save(),i.strokeStyle="rgba(95, 154, 255, 1)",i.lineWidth=2,i.beginPath(),i.moveTo(t,e.chartArea.top),i.lineTo(t,e.chartArea.bottom),i.moveTo(n,e.chartArea.top),i.lineTo(n,e.chartArea.bottom),i.stroke(),i.restore()},PO=(e,t,n)=>{const i=e.ctx;i.save(),i.fillStyle="rgba(143, 193, 255, 0.3)",i.fillRect(t,e.chartArea.top,n-t,e.chartArea.bottom-e.chartArea.top),i.restore()},nf=(e,t)=>{const n=e.scales.x.getValueForPixel(t.startX),i=e.scales.x.getValueForPixel(t.endX);if(!(n===void 0||i===void 0))return{xStart:Math.min(n,i),xEnd:Math.max(n,i)}},sf=(e,t,n)=>{t.canvas.dispatchEvent(new CustomEvent(e,{detail:n}))};class EO{id="dragSelectPlugin";_isDragging=!1;_startX=0;_endX=0;_dragTimeout;_clearSelectionArea=!0;_chart=null;_dragSelectHandlers;get startX(){return this._startX}get endX(){return this._endX}beforeInit(t){this._chart=t;const n=t.canvas;let i=!1;const s=r=>{this._dragTimeout=window.setTimeout(()=>{const l=n.getBoundingClientRect();this._isDragging=!0,this._clearSelectionArea=!1,i=!0,this._startX=r.clientX-l.left,this._endX=this._startX},150)},o=r=>{const l=n.getBoundingClientRect();if(i&&this._isDragging){this._endX=r.clientX-l.left;const c=nf(t,this);c&&sf("dragSelectMove",t,c)}},a=r=>{const l=n.getBoundingClientRect();if(clearTimeout(this._dragTimeout),i&&this._isDragging){this._endX=r.clientX-l.left,i=!1,this._isDragging=!1;const c=nf(t,this);c?sf("dragSelect",t,c):this.clearSelectionArea()}};n.addEventListener("mousedown",s),n.addEventListener("mousemove",o),n.addEventListener("mouseup",a),this._dragSelectHandlers={onMouseDown:s,onMouseMove:o,onMouseUp:a}}beforeDestroy(t){const n=t.canvas;if(this._dragSelectHandlers){const{onMouseDown:i,onMouseMove:s,onMouseUp:o}=this._dragSelectHandlers;n.removeEventListener("mousedown",i),n.removeEventListener("mousemove",s),n.removeEventListener("mouseup",o)}this._isDragging=!1,this._dragTimeout&&clearTimeout(this._dragTimeout)}afterDatasetsDraw(t){(this._isDragging||!this._clearSelectionArea)&&(PO(t,this._startX,this._endX),AO(t,this._startX,this._endX))}clearSelectionArea(){this._clearSelectionArea=!0,this._chart&&this._chart.update()}}const RO=20,IO="rgba(255, 171, 171, 0.4)",LO="rgba(255, 196, 0, 0.2)",of=(e,t,n)=>{const i=t.y-e.y;if(i===0)return t.x;const s=(n-e.y)/i;return e.x+s*(t.x-e.x)},af=e=>"yAxisID"in e&&e.yAxisID||Gs,rf=(e,t)=>{const n=e.data.datasets.find(i=>i.rawMetric===t);return n?af(n):Gs},NO=(e,t,n=Gs)=>{const i=[];return e.data.datasets.forEach(s=>{if(!e.getDatasetMeta(e.data.datasets.indexOf(s)).visible||af(s)!==n)return;const a=s.data;a?.length&&t.filter(r=>r.highlightIntersections).forEach(r=>{const l=a.map(d=>({ts:d.x,aboveThreshold:d.y>=r.value}));let c=l[0].aboveThreshold?a[0].x:void 0;for(let d=1;d<l.length;d++)!l[d-1].aboveThreshold&&l[d].aboveThreshold?c=of(a[d-1],a[d],r.value):l[d-1].aboveThreshold&&!l[d].aboveThreshold&&c!==void 0&&(i.push({start:c,end:of(a[d-1],a[d],r.value),type:r.type}),c=void 0);c!==void 0&&i.push({start:c,end:l[l.length-1].ts,type:r.type})})}),i},BO=e=>{if(!e.length)return[];e.sort((n,i)=>n.type.localeCompare(i.type)||n.start-i.start);const t=[];for(const n of e){const i=t.findLast(({type:s})=>s===n.type);i&&n.start<=i.end?i.end=Math.max(i.end,n.end):t.push({...n})}return t};class FO{constructor(t){this.i18n=t}i18n;id="thresholdPlugin";_thresholds;_mouseMoveHandler;_syncThresholds(t){for(const n of Object.keys(t.threshold||{})){const i=t.threshold?.[n];i&&(this._thresholds={...this._thresholds,[n]:i.map(s=>({...s,hovered:!1}))})}if(this._thresholds)for(const n of Object.keys(this._thresholds))t.threshold?.[n]||delete this._thresholds[n]}get thresholds(){return this._thresholds}beforeUpdate(t,n,i){this._syncThresholds(i)}beforeInit(t,n,i){const s=t.canvas;this._syncThresholds(i);const o=a=>{if(t){const r=a.clientY,l=s.getBoundingClientRect();for(const c of Object.keys(this._thresholds||{})){const h=(t.scales[rf(t,c)]??t.scales.y).getValueForPixel(r-l.top);if(h){const f=this._thresholds?.[c];f&&f.forEach(m=>{m.hovered=Math.abs(m.value-h)<RO})}}}};s.addEventListener("mousemove",o),this._mouseMoveHandler=o}afterDatasetsDraw(t,n){const i=t.ctx;for(const s of Object.keys(this._thresholds||{})){const o=this._thresholds?.[s];if(o){const a=rf(t,s),r=t.scales[a]??t.scales.y;o.forEach(d=>{const h=r.getPixelForValue(d.value);i.save(),i.beginPath(),i.moveTo(t.chartArea.left,h),i.lineTo(t.chartArea.right,h),i.lineWidth=1,i.strokeStyle=pe({state:d.type}),i.setLineDash([5,5]),i.stroke(),i.restore();let f="";d.label?f=`${d.label}: ${d.value}`:d.type==="warning"?f=this.i18n.t("chartLabels.threshold-warning",{value:d.value}):d.type==="error"?f=this.i18n.t("chartLabels.threshold-error",{value:d.value}):f=this.i18n.t("chartLabels.thatreshold-neutral",{value:d.value}),d.hovered&&(i.save(),i.fillStyle=pe({state:d.type}),i.font=eg,i.fillText(f,t.chartArea.left,h-4),i.restore())});const l=NO(t,o,a);BO(l).forEach(d=>{const h=t.scales.x.getPixelForValue(d.start),f=t.scales.x.getPixelForValue(d.end);i.save(),i.fillStyle=d.type==="error"?IO:LO,i.fillRect(h,t.chartArea.top,f-h,t.chartArea.bottom-t.chartArea.top),i.restore(),i.save(),i.beginPath(),i.moveTo(h,t.chartArea.bottom),i.lineTo(f,t.chartArea.bottom),i.lineWidth=2,i.strokeStyle=pe({state:d.type}),i.stroke(),i.restore()})}}}beforeDestroy(t){this._mouseMoveHandler&&t.canvas.removeEventListener("mousemove",this._mouseMoveHandler)}}const zO=Et(u.defineComponent({__name:"TimeSeriesChart",props:{chartData:{default:void 0},type:{default:"timeseries_line"},fill:{type:Boolean,default:!1},tooltipTitle:{},metricUnit:{default:""},timeRangeMs:{default:void 0},granularity:{},stacked:{type:Boolean,default:!0},legendValues:{default:void 0},metricAxesTitle:{default:void 0},dimensionAxesTitle:{default:void 0},syntheticsDataKey:{default:""},chartLegendSortFn:{type:Function,default:(e,t)=>e.value&&t.value&&t.value.raw-e.value.raw},chartTooltipSortFn:{type:Function,default:(e,t)=>t.rawValue-e.rawValue},brush:{type:Boolean,default:!1},zoomActionItems:{default:void 0},tooltipMetricDisplay:{default:""},threshold:{default:void 0},leftYAxisGrid:{type:Boolean,default:void 0},rightYAxis:{default:void 0},coordinator:{default:void 0}},emits:["zoom-time-range","select-chart-range"],setup(e,{emit:t}){const n=e,i=t,{i18n:s}=q.useI18n(),o=new ef,a=new qh,r=new EO,l=new FO(s),{translateUnit:c}=q.useTranslatedUnits(),d=u.ref(),h=crypto.randomUUID(),f=crypto.randomUUID(),m=u.ref([]),p=u.inject("legendPosition",Nt.Bottom),g=u.useTemplateRef("chartParent"),y=u.ref(void 0),_=u.ref(!1),x=new ao({coordinator:n.coordinator,triggerOnSelf:!0,watchTimestamp:!0,watchDimension:!0}),T=u.reactive({showTooltip:!1,tooltipContext:0,metricDisplay:u.toRef(n,"tooltipMetricDisplay"),tooltipSeries:[],left:"",top:"",units:u.toRef(n,"metricUnit"),translateUnit:c,offsetX:0,offsetY:0,width:0,height:0,chartType:n.type,chartID:f,chartTooltipSortFn:n.chartTooltipSortFn,interactionMode:"idle"}),{tooltipAbsoluteLeft:v,tooltipAbsoluteTop:w}=q.useTooltipAbsolutePosition(g,T),D={id:h,afterUpdate(M){m.value=Ia(M,n.legendValues,n.chartLegendSortFn)}},S=u.computed(()=>[x,D,a,...n.brush?[r]:[],...n.type==="timeseries_line"?[o]:[],...n.threshold?[l]:[]]),A=u.computed(()=>`line-${S.value.map(M=>M.id).join("-")}`),R=u.computed(()=>`bar-${S.value.map(M=>M.id).join("-")}`),E=u.computed(()=>n.chartData&&UM(n.chartData)),{options:k}=q.useLineChartOptions({tooltipState:T,timeRangeMs:u.toRef(n,"timeRangeMs"),granularity:u.toRef(n,"granularity"),legendID:h,stacked:u.toRef(n,"stacked"),metricAxesTitle:u.toRef(n,"metricAxesTitle"),dimensionAxesTitle:u.toRef(n,"dimensionAxesTitle"),pointsWithoutHover:E,threshold:u.toRef(n,"threshold"),leftYAxisGrid:u.toRef(n,"leftYAxisGrid"),rightYAxis:u.toRef(n,"rightYAxis")});q.useReportChartDataForSynthetics(u.toRef(n,"chartData"),u.toRef(n,"syntheticsDataKey"));const C=M=>M?M.end.getTime()>M.start.getTime():!1,z=M=>({[Nt.Bottom]:"column",[Nt.Hidden]:"hidden"})[M],N=({width:M,height:P})=>{T.width=M,T.height=P},V=(M=!0)=>{T.interactionMode="idle",T.showTooltip=!1,r.clearSelectionArea(),a.isPaused&&a.resume(M),o.isPaused&&o.resume()},Y=()=>{T.interactionMode="interactive"},G=()=>{!d.value||!d.value.chart.tooltip?.dataPoints?.length||(T.interactionMode==="interactive"?o.clickedSegment=d.value.chart.tooltip.dataPoints[0]:o.destroyClickedSegment())},st=()=>{if(_.value){_.value=!1;return}T.interactionMode!=="idle"?V():Y(),G()};u.watch(()=>n.type,()=>{T.interactionMode="idle",T.showTooltip=!1,o.destroyClickedSegment()});const ot=M=>{M.preventDefault(),M.stopPropagation();const{xStart:P,xEnd:F}=M.detail,$={start:new Date(P),end:new Date(F),type:"absolute"};if(!C($)){y.value=void 0,V(!1);return}y.value=$,T.interactionMode="zoom-interactive",$&&i("select-chart-range",$)},K=M=>{T.interactionMode="selecting-chart-area",_.value=!0,o.pause(),a.pause();const{xStart:P,xEnd:F}=M.detail;y.value={start:new Date(P),end:new Date(F),type:"absolute"}},U=M=>{if(!g.value||T.interactionMode==="idle")return;const P=M.target;P&&g.value.contains(P)||_.value||V(!1)};return u.watch(()=>d.value?.chart,()=>{d.value?.chart&&(d.value.chart.canvas.removeEventListener("dragSelect",ot),d.value.chart.canvas.removeEventListener("dragSelectMove",K),d.value.chart.canvas.addEventListener("dragSelect",ot),d.value.chart.canvas.addEventListener("dragSelectMove",K))}),u.onMounted(()=>{document.addEventListener("click",U,!0)}),u.onUnmounted(()=>{d.value?.chart&&(d.value.chart.canvas.removeEventListener("dragSelect",ot),d.value.chart.canvas.removeEventListener("dragSelectMove",K)),document.removeEventListener("click",U,!0)}),(M,P)=>(u.openBlock(),u.createElementBlock("div",{ref:"chartParent",class:u.normalizeClass(["chart-parent",z(u.unref(p))]),"data-testid":"line-chart-parent"},[u.createElementVNode("div",{class:"chart-container",onClick:P[0]||(P[0]=F=>st())},[e.type==="timeseries_line"?(u.openBlock(),u.createBlock(u.unref(tf),{key:A.value,ref_key:"chartInstance",ref:d,"chart-id":u.unref(f),class:"chart-canvas",data:e.chartData,"data-testid":"time-series-line-chart",options:u.unref(k),plugins:S.value},null,8,["chart-id","data","options","plugins"])):e.type==="timeseries_bar"?(u.openBlock(),u.createBlock(u.unref(Qh),{key:R.value,ref_key:"chartInstance",ref:d,"chart-id":u.unref(f),class:"chart-canvas",data:e.chartData,"data-testid":"time-series-bar-chart",options:u.unref(k),plugins:S.value},null,8,["chart-id","data","options","plugins"])):u.createCommentVNode("",!0)]),u.createVNode(ji,{"absolute-left":u.unref(v),"absolute-top":u.unref(w),"data-testid":"tooltip",granularity:e.granularity,state:T,"tooltip-title":e.tooltipTitle,"zoom-action-items":e.zoomActionItems,"zoom-time-range":y.value,onDimensions:N,onOnAction:P[1]||(P[1]=()=>V(!1))},null,8,["absolute-left","absolute-top","granularity","state","tooltip-title","zoom-action-items","zoom-time-range"]),u.createVNode(oo,{id:u.unref(h),"chart-instance":d.value,"data-testid":"legend",items:m.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-d7ce85b0"]]),UO={key:0,class:"chart-truncation-warning","data-testid":"truncation-warning"},VO={class:"tooltip-content"},HO={key:2,class:"analytics-chart-parent"},$O=u.defineComponent({__name:"AnalyticsChart",props:{chartData:{},chartOptions:{},activeMetric:{default:void 0},tooltipTitle:{default:""},emptyStateTitle:{default:""},emptyStateDescription:{default:""},legendPosition:{default:Nt.Bottom},syntheticsDataKey:{default:""},showLegendValues:{type:Boolean,default:!1},showAnnotations:{type:Boolean,default:!0},timeseriesZoom:{type:Boolean,default:!1},requestsLink:{default:void 0},exploreLink:{default:void 0}},emits:["zoom-time-range","select-chart-range"],setup(e,{emit:t}){const n=u.inject(Df),i=t,s=e,{i18n:o}=q.useI18n(),a=q.useFieldLabel(),r=Mr.useDatasourceConfigStore(),l=u.ref(crypto.randomUUID());u.watch(()=>s.chartOptions.type,()=>{l.value=crypto.randomUUID()},{immediate:!0});const c=u.computed(()=>Ka(s.chartData)?void 0:s.chartData),d=u.computed(()=>{const B=s.chartOptions.metricAxisMap,X=c.value?.meta?.metric_names??[];if(!(s.chartOptions.type!=="timeseries_line"||!B||!X.some(at=>B[at]==="right")))return B}),h=u.computed(()=>!!d.value),f=(B,X)=>d.value?B.filter(at=>(d.value?.[at]??"left")===X):B,m=u.computed(()=>{const B=c.value?.meta,X=B?.metric_names??[];return["timeseries_line","timeseries_bar"].includes(s.chartOptions.type)&&!h.value&&X.length>1&&Object.keys(B?.display??{}).length>0?X:[]}),p=u.computed(()=>m.value.length>1),g=u.computed(()=>s.activeMetric&&m.value.includes(s.activeMetric)?s.activeMetric:m.value[0]),y=u.computed(()=>{const B=c.value;return!B||!p.value||!g.value?B:{...B,meta:{...B.meta,metric_names:[g.value]}}}),_=u.computed(()=>{const B=s.chartOptions.threshold;return!p.value||!B?B:{...B,...Object.fromEntries(Object.keys(B).filter(X=>X!==g.value).map(X=>[X,[]]))}}),x=u.computed(()=>{if(K.value)return Ka(s.chartData)?s.chartData:Zd(s.chartData)}),T=u.inject("app:konnectColorMode",u.computed(()=>"light")),v=u.useTemplateRef("chartShell"),w=u.computed(()=>(T.value,Xa(v.value))),D=u.computed(()=>{if(x.value){const{start:X,end:at,metric:Tt,metricUnit:te,truncated:lo,limit:ge,datasource:jn}=x.value;return{start:X,end:at,metricNames:[Tt],metricUnits:{[Tt]:te??""},truncated:lo,limit:ge,datasource:jn}}const B=y.value?.meta;return{start:B?.start,end:B?.end,metricNames:B?.metric_names,metricUnits:B?.metric_units,truncated:B?.truncated,limit:B?.limit,datasource:B?.datasource}}),S=u.computed(()=>K.value?q.useScatterDatasets({colorPalette:s.chartOptions.chartDatasetColors,scatter:s.chartOptions.scatter,themeColors:w},x,l.value,n).value:c.value?st.value?q.useExploreResultToTimeDataset({fill:s.chartOptions.stacked,colorPalette:s.chartOptions.chartDatasetColors,metricAxisMap:d.value},y,l.value,n).value:q.useExploreResultToDatasets({fill:s.chartOptions.stacked,colorPalette:s.chartOptions.chartDatasetColors},c,l.value,n).value:{datasets:[]}),A=u.computed(()=>s.timeseriesZoom||!!s.exploreLink||!!s.requestsLink),R=u.computed(()=>{if(!s.chartData||c.value&&!c.value.meta)return 0;const{start:B,end:X}=D.value;if(B&&X)return new Date(X).getTime()-new Date(B).getTime()}),E=u.computed(()=>D.value.metricUnits?p.value&&g.value?D.value.metricUnits[g.value]??"":Object.values(D.value.metricUnits)[0]??"":""),k=u.computed(()=>D.value.metricUnits?p.value&&g.value?g.value:Object.keys(D.value.metricUnits)[0]??"":""),C=u.computed(()=>s.showLegendValues&&s.legendPosition!==Nt.Hidden),{legendValues:z}=q.useChartLegendValues(S,s.chartOptions.type,E),N=u.computed(()=>D.value.limit?.toString()||null),V=u.computed(()=>s.chartOptions.hideTruncationWarning?!1:D.value.truncated||!1),Y=u.computed(()=>o.t("limitedResultsShown",{maxReturned:N.value})),G=u.computed(()=>["vertical_bar","horizontal_bar"].includes(s.chartOptions.type)),st=u.computed(()=>["timeseries_bar","timeseries_line"].some(B=>B===s.chartOptions.type)),ot=u.computed(()=>s.chartOptions.type==="donut"),K=u.computed(()=>s.chartOptions.type==="scatter"),U=u.computed(()=>s.chartOptions.type.includes("vertical")?"vertical":"horizontal"),M=u.computed(()=>{const{metricNames:B,metricUnits:X}=D.value;if(h.value||!B||!X)return;const at=B[0],Tt=X[at]||"";if(B.length>1){if(at.includes("latency"))return o.t("metricAxisTitles.latency_in",{unit:o.t(`chartUnits.${Tt}`,{plural:"s"})});if(at.includes("size"))return o.t("metricAxisTitles.size_in",{unit:o.t(`chartUnits.${Tt}`,{plural:"s"})})}if(at){if(zi(Tt)){const te=a(at,{prefix:"metricAxisTitles",fallback:""});if(te)return te}return a(at)}}),P=u.computed(()=>{const B=s.chartOptions.yAxes?.left?.title??s.chartOptions?.metricAxesTitle;if(B)return B;const{metricNames:X,metricUnits:at}=D.value;if(!(!X||!at))return $(f(X,"left"),at)}),F=u.computed(()=>{if(!h.value)return;const{metricNames:B,metricUnits:X}=D.value,at=B&&X?$(f(B,"right"),X):void 0;return{title:s.chartOptions.yAxes?.right?.title??at,showGrid:s.chartOptions.yAxes?.right?.showGrid}}),$=(B,X)=>{const at=B[0];if(!at)return;const Tt=X[at]||"";if(B.length>1){if(at.includes("latency"))return o.t("metricAxisTitles.latency_in",{unit:o.t(`chartUnits.${Tt}`,{plural:"s"})});if(at.includes("size"))return o.t("metricAxisTitles.size_in",{unit:o.t(`chartUnits.${Tt}`,{plural:"s"})})}return it(at,Tt)},it=(B,X)=>{if(zi(X))return a(B,{prefix:"metricAxisTitles"})||void 0;const at=o.te(`chartUnits.${X}`)?o.t(`chartUnits.${X}`,{plural:"s"}):X,Tt=r.fieldTranslationMap.get(B);return Tt?`${Tt} (${at})`:o.te(`metricAxisTitles.${B}`)?o.t(`metricAxisTitles.${B}`,{unit:at})||void 0:B||void 0},L=u.computed(()=>{if(s.chartOptions?.dimensionAxesTitle)return s.chartOptions.dimensionAxesTitle;const B=c.value?.meta,X=st.value?"Time":Object.keys(B?.display||B?.metric_names||{})[0];if(X)return a(X)}),H=u.computed(()=>{if(Hf(D.value.datasource))return o.t("timestampAxisTitles.platform");const B=Ji(c.value?.meta?.granularity_ms);if(B)return o.te(`granularityAxisTitles.${B}`)?o.t(`granularityAxisTitles.${B}`):B}),pt=u.computed(()=>{const B=x.value?.xMetric;return B?it(B,x.value?.xMetricUnit??""):H.value}),ut=u.computed(()=>s.emptyStateTitle||o.t("noDataAvailableTitle")),rt=u.computed(()=>s.emptyStateDescription||o.t("noDataAvailableDescription")),Dt=u.computed(()=>K.value?!!x.value?.points.length:st.value?VM(S.value):!!(c.value&&c.value.meta&&c.value.data.length)),Wt=u.computed(()=>{const B=c.value;return B?B.meta.granularity_ms?Ji(B.meta.granularity_ms)||"hourly":Ji(new Date(B.data[1].timestamp).getTime()-new Date(B.data[0].timestamp).getTime())||"hourly":"hourly"}),Lt=u.computed(()=>Ji(c.value?.meta?.granularity_ms)||"secondly"),kt=u.computed(()=>s.chartOptions.chartLegendSortFn?s.chartOptions.chartLegendSortFn:(B,X)=>B.text===o.t("chartLabels.____OTHER____")?1:X.text===o.t("chartLabels.____OTHER____")?-1:!isNaN(parseInt(B.text,10))&&!isNaN(parseInt(X.text,10))?B.text<X.text?-1:1:B.value&&X.value?X.value.raw-B.value.raw:0),je=u.computed(()=>s.chartOptions.chartTooltipSortFn?s.chartOptions.chartTooltipSortFn:(B,X)=>B.label===o.t("chartLabels.____OTHER____")?1:X.label===o.t("chartLabels.____OTHER____")?-1:!isNaN(parseInt(B.label,10))&&!isNaN(parseInt(X.label,10))?B.label<X.label?-1:1:B.value&&X.value?X.rawValue-B.rawValue:0),pn=u.computed(()=>[...s.timeseriesZoom?[{label:o.t("zoom_action_items.zoom"),key:"zoom-in",action:B=>i("zoom-time-range",B)}]:[],...s.exploreLink?[{label:o.t("zoom_action_items.explore"),key:"explore",href:s.exploreLink.href}]:[],...s.requestsLink?[{label:o.t("zoom_action_items.view_requests"),key:"view-requests",href:s.requestsLink.href}]:[]]);return u.provide("showLegendValues",C),u.provide("legendPosition",u.toRef(s,"legendPosition")),(B,X)=>{const at=u.resolveComponent("KTooltip"),Tt=u.resolveComponent("KEmptyState");return u.openBlock(),u.createElementBlock("div",{ref:"chartShell",class:u.normalizeClass(["analytics-chart-shell",{"show-values":C.value}])},[Dt.value&&V.value&&N.value?(u.openBlock(),u.createElementBlock("div",UO,[u.createVNode(at,{class:"tooltip","max-width":"500",placement:"right"},{content:u.withCtx(()=>[u.createElementVNode("div",VO,u.toDisplayString(Y.value),1)]),default:u.withCtx(()=>[u.createVNode(u.unref(St.WarningIcon),{color:`var(--kui-color-text-warning, ${u.unref(tg)})`,size:`var(--kui-icon-size-40, ${u.unref(ng)})`},null,8,["color","size"])]),_:1})])):u.createCommentVNode("",!0),Dt.value?(u.openBlock(),u.createElementBlock("div",HO,[st.value?(u.openBlock(),u.createBlock(zO,{key:0,brush:A.value,"chart-data":S.value,"chart-legend-sort-fn":kt.value,"chart-tooltip-sort-fn":je.value,coordinator:u.unref(n),"dimension-axes-title":H.value,fill:e.chartOptions.stacked,granularity:Wt.value,"left-y-axis-grid":e.chartOptions.yAxes?.left?.showGrid,"legend-values":u.unref(z),"metric-axes-title":P.value,"metric-unit":E.value,"right-y-axis":F.value,stacked:e.chartOptions.stacked,"synthetics-data-key":e.syntheticsDataKey,threshold:_.value,"time-range-ms":R.value,"tooltip-metric-display":M.value,"tooltip-title":e.tooltipTitle,type:e.chartOptions.type,"zoom-action-items":pn.value,onSelectChartRange:X[0]||(X[0]=te=>i("select-chart-range",te)),onZoomTimeRange:X[1]||(X[1]=te=>i("zoom-time-range",te))},null,8,["brush","chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","coordinator","dimension-axes-title","fill","granularity","left-y-axis-grid","legend-values","metric-axes-title","metric-unit","right-y-axis","stacked","synthetics-data-key","threshold","time-range-ms","tooltip-metric-display","tooltip-title","type","zoom-action-items"])):G.value?(u.openBlock(),u.createBlock(lO,{key:1,annotations:e.showAnnotations,"chart-data":S.value,"chart-legend-sort-fn":kt.value,"chart-tooltip-sort-fn":je.value,coordinator:u.unref(n),"data-testid":"bar-chart-container","dimension-axes-title":L.value,"legend-values":u.unref(z),"metric-axes-title":P.value,"metric-unit":E.value,orientation:U.value,stacked:e.chartOptions.stacked,"synthetics-data-key":e.syntheticsDataKey,"tooltip-metric-display":M.value,"tooltip-title":e.tooltipTitle},null,8,["annotations","chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","coordinator","dimension-axes-title","legend-values","metric-axes-title","metric-unit","orientation","stacked","synthetics-data-key","tooltip-metric-display","tooltip-title"])):ot.value?(u.openBlock(),u.createBlock(kO,{key:2,"chart-data":S.value,coordinator:u.unref(n),"dataset-colors":e.chartOptions.chartDatasetColors||u.unref(t1),"legend-position":e.legendPosition,"legend-values":u.unref(z),"metric-name":k.value,"metric-unit":E.value,"show-center-metric":e.chartOptions.showCenterMetric,"synthetics-data-key":e.syntheticsDataKey,"tooltip-dimension-display":L.value,"tooltip-metric-display":M.value,"tooltip-title":e.tooltipTitle},null,8,["chart-data","coordinator","dataset-colors","legend-position","legend-values","metric-name","metric-unit","show-center-metric","synthetics-data-key","tooltip-dimension-display","tooltip-metric-display","tooltip-title"])):K.value?(u.openBlock(),u.createBlock(DO,{key:3,"chart-data":S.value,"chart-legend-sort-fn":e.chartOptions.chartLegendSortFn,"chart-tooltip-sort-fn":je.value,coordinator:u.unref(n),"data-testid":"scatter-chart-container","dimension-axes-title":pt.value,granularity:Lt.value,"metric-axes-title":P.value,"metric-unit":E.value,"shade-outlier-region":e.chartOptions.scatter?.shadeOutlierRegion,"synthetics-data-key":e.syntheticsDataKey,"theme-colors":w.value,"time-range-ms":R.value,"tooltip-metric-display":M.value,"tooltip-title":e.tooltipTitle,"x-metric":x.value?.xMetric,"x-metric-unit":x.value?.xMetricUnit},null,8,["chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","coordinator","dimension-axes-title","granularity","metric-axes-title","metric-unit","shade-outlier-region","synthetics-data-key","theme-colors","time-range-ms","tooltip-metric-display","tooltip-title","x-metric","x-metric-unit"])):u.createCommentVNode("",!0)])):(u.openBlock(),u.createBlock(Tt,{key:1,"action-button-visible":!1,class:"chart-empty-state","data-testid":"no-data-in-report"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(ut.value),1)]),default:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(rt.value),1)]),_:1}))],2)}}}),YO=Et($O,[["__scopeId","data-v-8539d27c"]]),WO={class:"chart-parent","data-testid":"gauge-chart-parent"},jO={class:"chart-totals-flex"},qO={key:1,class:"metric-small","data-testid":"gauge-chart-total"},GO=Et(u.defineComponent({__name:"GaugeChart",props:{chartData:{type:Object,required:!1,default:null},metricDisplay:{type:String,required:!1,default:"hidden"},numerator:{type:Number,required:!1,default:0},syntheticsDataKey:{type:String,required:!1,default:""},datasetColors:{type:Object,required:!1,default:()=>[]},height:{type:String,required:!1,default:"400px",validator:e=>/(\d *)(px|%)/.test(e)},width:{type:String,required:!1,default:"100%",validator:e=>/(\d *)(px|%)/.test(e)}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=u.ref(hr()),s=u.computed(()=>[t.chartData.datasets.reduce((m,p)=>(m.labels.push(p.label),m.borderColor.push(p.backgroundColor),m.backgroundColor.push(p.backgroundColor),m.data.push(p.data.reduce((g,y)=>g+y,0)),m),{labels:[],backgroundColor:[],borderColor:[],data:[]})]),o=u.computed(()=>({...t.chartData,datasets:s.value}));q.useReportChartDataForSynthetics(u.toRef(t,"chartData"),u.toRef(t,"syntheticsDataKey"));const a={responsive:!0,maintainAspectRatio:!0,cutout:"78%",circumference:"200",rotation:"260",plugins:{legend:{display:!1}}},r=u.computed(()=>Ii(s?.value[0]?.data[t.numerator],{capital:!0})),l=u.computed(()=>Ii(s?.value[0]?.data[0]+s?.value[0]?.data[1],{capital:!0})),c=u.computed(()=>`color: ${s?.value[0]?.backgroundColor[t.numerator]}`),d=u.computed(()=>["full","single"].includes(t.metricDisplay)),h=u.computed(()=>t.metricDisplay==="full");return(f,m)=>(u.openBlock(),u.createElementBlock("div",WO,[u.createElementVNode("div",jO,[d.value?(u.openBlock(),u.createElementBlock("div",{key:0,class:"metric-large","data-testid":"gauge-chart-metric",style:u.normalizeStyle(c.value)},u.toDisplayString(r.value),5)):u.createCommentVNode("",!0),h.value?(u.openBlock(),u.createElementBlock("div",qO,u.toDisplayString(u.unref(n).t("total"))+": "+u.toDisplayString(l.value),1)):u.createCommentVNode("",!0)]),u.createElementVNode("div",{class:"chart-container",style:u.normalizeStyle({height:e.height,width:e.width})},[u.createVNode(u.unref(Jh),{"chart-id":i.value,data:o.value,options:a},null,8,["chart-id","data","options"])],4)]))}}),[["__scopeId","data-v-6e452d92"]]),XO={key:1,class:"single-value-wrapper"},KO={class:"single-value-metric"},ZO={class:"name-unit-alignment"},QO={class:"single-value","data-testid":"single-value-chart"},JO={key:0,class:"single-value-unit"},tA={key:0,class:"single-value-metric-name"},eA={key:0,class:"single-value-trend-range","data-testid":"single-value-trend-range"},mr="t1",pr="t2",nA=Et(u.defineComponent({__name:"SingleValue",props:{data:{type:Object,required:!0},decimalPoints:{type:Number,default:2},leftAlign:{type:Boolean,default:!1},showTrend:{type:Boolean,default:!1},increaseIsBad:{type:Boolean,default:!1},alignX:{type:String,default:"left"},compact:{type:Boolean,default:!1},hideMetricName:{type:Boolean,default:!1}},setup(e){const t=q.useFieldLabel(),{i18n:n}=q.useI18n(),{formatBytes:i,formatCost:s}=le({i18n:n}),o=e,a=u.computed(()=>`align-${o.leftAlign?"left":o.alignX}`),r=u.computed(()=>qe.buildDeltaMapping(o.data,o.showTrend,{topLevelKey:mr,secondLevelKey:pr})),l=u.computed(()=>r.value?.previous?.[mr]?.[pr]),c=u.computed(()=>r.value?.current?.[mr]?.[pr]),d=u.computed(()=>o.data.data),h=u.computed(()=>o.data.meta?.metric_names?.[0]),f=u.computed(()=>h.value?t(h.value,{fallback:""}):""),m=u.computed(()=>{const k=h.value?o.data.meta?.metric_units?.[h.value]:void 0;if(k){const C=`chartUnits.${k}`;return n.te(C)?n.t(C,{plural:""}):""}}),p=u.computed(()=>!!h.value&&(h.value.includes("_per_minute")||h.value.includes("_latency_")||h.value==="error_rate")),g=u.computed(()=>o.showTrend&&l.value!==void 0?l.value:null),y=u.computed(()=>{if(o.showTrend)return c.value??null;if(d.value.length<1||!h.value)return null;const k=d.value[0].event[h.value];return typeof k!="number"||isNaN(k)?null:k}),_=u.computed(()=>o.data?.data?.length===void 0||o.data?.data?.length===0||!o.showTrend&&y.value===null||o.showTrend&&g.value===null&&y.value===null),x=u.computed(()=>{const k=y.value;if(k===null)return"-";const C=h.value?o.data.meta?.metric_units?.[h.value]:void 0;if(C==="usd")return s(k);if(C==="bytes")return i(k);if(k>=1e9){const N=(k/1e9).toFixed(1);return N.endsWith(".0")?`${Math.floor(k/1e9)}B`:`${N}B`}if(k>=1e7){const N=(k/1e6).toFixed(1);return N.endsWith(".0")?`${Math.floor(k/1e6)}M`:`${N}M`}const z=o.decimalPoints&&typeof o.decimalPoints=="number"?o.decimalPoints:2;return k.toLocaleString("en-US",{maximumFractionDigits:z})}),T=u.computed(()=>o.showTrend&&o.data?.data?.length<2),v=u.computed(()=>qe.calculateChange(y.value??0,g.value??0)||0),w=u.computed(()=>{if(!o.showTrend)return 0;if(o.data?.data?.length<2){if(l.value===void 0)return 0;if(c.value===void 0)return o.increaseIsBad?1:-1}return qe.changePolarity(v.value,!0,o.increaseIsBad)}),D=u.computed(()=>qe.defineIcon(w.value,o.increaseIsBad)),S=u.computed(()=>{if(o.showTrend&&o.data?.data?.length<2){if(l.value===void 0)return n.t("singleValue.trend.not_available");if(c.value===void 0)return qe.metricChange(-1,!0,n.t("singleValue.trend.not_available"))}return qe.metricChange(v.value,o.data?.data?.length===2,n.t("singleValue.trend.not_available"))}),A=qe.useTrendRange(u.computed(()=>o.showTrend),void 0,u.computed(()=>o.data.meta)),R=k=>k>0?"positive":k<0?"negative":"neutral",E=k=>k>0?Jp:k<0?Qp:ml;return u.onMounted(()=>{!o.showTrend&&o.data?.data?.length>1?console.warn("SingleValue chart should only be used with a single data point. Data length:",o.data.data.length):o.showTrend&&o.data?.data?.length>2&&console.warn("SingleValue with trend expects 2 or fewer data points. Instead got:",o.data.data.length)}),(k,C)=>{const z=u.resolveComponent("KEmptyState");return u.openBlock(),u.createElementBlock("div",{class:u.normalizeClass(["chart-parent",[a.value,{compact:e.compact}]]),"data-testid":"single-value-parent"},[_.value?(u.openBlock(),u.createBlock(z,{key:0,class:"single-value-error","data-testid":"single-value-error","icon-variant":"error",title:u.unref(n).t("singleValue.valueError")},null,8,["title"])):(u.openBlock(),u.createElementBlock("div",XO,[u.createElementVNode("div",KO,[u.createElementVNode("div",ZO,[u.createElementVNode("span",QO,u.toDisplayString(x.value),1),p.value&&m.value?(u.openBlock(),u.createElementBlock("span",JO,"  "+u.toDisplayString(m.value),1)):u.createCommentVNode("",!0)]),!e.compact&&!e.hideMetricName?(u.openBlock(),u.createElementBlock("div",tA,u.toDisplayString(f.value),1)):u.createCommentVNode("",!0)]),e.showTrend?(u.openBlock(),u.createElementBlock("div",{key:0,class:u.normalizeClass(["single-value-trend",R(w.value)])},[u.createElementVNode("div",{class:u.normalizeClass(["trend-change",R(w.value)]),"data-testid":"single-value-trend"},[T.value||w.value!==0?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(D.value),{key:0,color:E(w.value),size:`var(--kui-icon-size-30, ${u.unref(Sn)})`},null,8,["color","size"])):(u.openBlock(),u.createBlock(u.unref(St.EqualIcon),{key:1,color:`var(--kui-color-text-neutral-strong, ${u.unref(ml)})`,size:`var(--kui-icon-size-30, ${u.unref(Sn)})`},null,8,["color","size"])),u.createElementVNode("div",null,u.toDisplayString(S.value),1)],2),u.unref(A)?(u.openBlock(),u.createElementBlock("div",eA,u.toDisplayString(u.unref(A)),1)):u.createCommentVNode("",!0)],2)):u.createCommentVNode("",!0)]))],2)}}}),[["__scopeId","data-v-8f58f719"]]),iA={class:"simple-chart-shell"},sA={key:1,class:"analytics-chart-parent"},oA=Et(u.defineComponent({__name:"SimpleChart",props:{chartData:{type:Object,required:!0},chartOptions:{type:Object,required:!0},emptyStateTitle:{type:String,required:!1,default:""},syntheticsDataKey:{type:String,required:!1,default:""},height:{type:String,required:!1,default:"400px",validator:e=>/(\d *)(px|%)/.test(e)},width:{type:String,required:!1,default:"100%",validator:e=>/(\d *)(px|%)/.test(e)}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=u.ref(crypto.randomUUID());u.watch(()=>t.chartOptions.type,()=>{i.value=crypto.randomUUID()},{immediate:!0});const s=u.computed(()=>{const d=q.useExploreResultToDatasets({colorPalette:t.chartOptions.chartDatasetColors},u.toRef(t,"chartData"),i.value).value;return t.chartOptions?.reverseDataset&&d?.datasets.reverse(),d}),o=u.computed(()=>t.chartData.meta?.metric_units?Object.values(t.chartData.meta.metric_units)[0]:""),a=u.computed(()=>t.chartOptions.type==="gauge"),r=u.computed(()=>t.chartOptions.type==="single_value"),l=u.computed(()=>t.emptyStateTitle||n.t("noDataAvailableTitle")),c=u.computed(()=>{const d=t.chartData&&t.chartData.meta&&t.chartData.data.length;if(r.value){const h=t.chartData.meta?.metric_names?.[0];return d&&t.chartData.data[0].event[h]!==null}return d});return(d,h)=>{const f=u.resolveComponent("KEmptyState");return u.openBlock(),u.createElementBlock("div",iA,[c.value?(u.openBlock(),u.createElementBlock("div",sA,[a.value?(u.openBlock(),u.createBlock(GO,{key:0,"chart-data":s.value,"dataset-colors":e.chartOptions.chartDatasetColors,"is-simple":"","metric-display":e.chartOptions.metricDisplay,"metric-unit":o.value,numerator:e.chartOptions.numerator,"synthetics-data-key":e.syntheticsDataKey,width:e.width},null,8,["chart-data","dataset-colors","metric-display","metric-unit","numerator","synthetics-data-key","width"])):u.createCommentVNode("",!0),r.value?(u.openBlock(),u.createBlock(nA,{key:1,"align-x":e.chartOptions.alignX,compact:e.chartOptions.compact,data:e.chartData,"decimal-points":e.chartOptions.decimalPoints,"hide-metric-name":e.chartOptions.hideMetricName,"increase-is-bad":e.chartOptions.increaseIsBad,"show-trend":e.chartOptions.showTrend},null,8,["align-x","compact","data","decimal-points","hide-metric-name","increase-is-bad","show-trend"])):u.createCommentVNode("",!0)])):(u.openBlock(),u.createBlock(f,{key:0,"action-button-visible":!0,class:"chart-empty-state","data-testid":"no-data-in-report"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(l.value),1)]),_:1}))])}}}),[["__scopeId","data-v-a084fd89"]]),aA={class:"container"},rA={key:0,class:"no-data","data-testid":"sparkline-empty"},lA=["title"],cA=Et(u.defineComponent({__name:"SparklineChart",props:{chartKey:{default:()=>{}},datasets:{},disableTooltip:{type:Boolean,default:!1},enableBrushing:{type:Boolean,default:!1},groupKey:{default:()=>{}},maxCount:{default:()=>{}},maxStamp:{default:()=>{}},minCount:{default:()=>{}},minStamp:{default:()=>{}},pointRenderCount:{default:24},showLabel:{type:Boolean,default:!1},tooltipTitle:{default:()=>{}},type:{default:"sparkline_bar"}},setup(e){const t=crypto.randomUUID(),{i18n:n}=q.useI18n(),{syncedGroupSizeMs:i,syncedMinStamp:s,syncedMaxStamp:o,syncedMinCount:a,syncedMaxCount:r,syncedRenderPoints:l,syncedChartDatasets:c}=q.useSparklineSync({chartKey:e.chartKey,datasets:e.datasets,groupKey:e.groupKey,minStamp:e.minStamp,maxStamp:e.maxStamp,minCount:e.minCount,maxCount:e.maxCount,renderPoints:e.pointRenderCount,type:e.type}),d=u.reactive({showTooltip:!1,tooltipContext:0,metricDisplay:"",tooltipSeries:[],left:"",top:"",units:"count",translateUnit:()=>"",offsetX:0,offsetY:0,width:0,height:0,chartType:e.type==="sparkline_bar"?"timeseries_bar":"timeseries_line",chartID:t,interactionMode:"idle"}),h=({width:S,height:A})=>{d.width=S,d.height=A},f=u.computed(()=>e.disableTooltip?[]:[new ef({enableBrushing:e.groupKey!==void 0&&e.chartKey!==void 0&&e.enableBrushing,brushStrategy:"group",brushGroup:e.groupKey})]),m=u.computed(()=>c.value.reduce((S,{data:A,label:R})=>({...S,[R]:A.reduce((E,{y:k})=>E+k,0)}),{})),p=u.computed(()=>c.value.map(({label:S})=>[m.value[S],`${S}: ${m.value[S]}`]).sort(([S],[A])=>A-S).map(([,S])=>S).join(", ")),g=u.computed(()=>Object.keys(m.value).map(S=>m.value[S]).reduce((S,A)=>S+A,0)),y=u.computed(()=>g.value>0),_=u.computed(()=>({labels:new Array(l.value).fill(""),datasets:c.value})),x=u.computed(()=>e.datasets.length>1),T=`SparklineTooltipPosition-${t}`,v=u.computed(()=>{const S=e.type==="sparkline_bar",A=S?s.value-1:s.value,R=S?o.value:o.value-i.value;return{maintainAspectRatio:!1,elements:{categoryPercentage:1,barPercentage:1,line:{tension:0,stepped:e.type==="sparkline_step",borderWidth:1},point:{radius:0,pointHitRadius:11,pointHoverRadius:0}},interaction:{intersect:!1,mode:"index"},layout:{padding:{left:S?0:2,right:S?0:2,top:2}},plugins:{legend:{display:!1},tooltip:{enabled:!1,position:T,external:E=>{Ra(d,E,"minutely",{contextFormatter:k=>{const C=k+i.value;let z="";return i.value>1440*60*1e3?z=rs(new Date(C),"MMM dd, yyy hh:mm a"):z=rs(new Date(C),"hh:mm a"),`${Ip(k)} - ${z}`}})}}},scales:{x:{min:A,max:R,type:"timeseries",offset:!1,grid:{display:!1},display:!1,stacked:x.value},y:{min:Math.max(a.value-1,0),max:r.value,grid:{display:!1},display:!1,stacked:x.value}}}}),w=u.ref("0"),D=u.ref("0");return u.onMounted(()=>{Yt.positioners[T]=function(S,A){if(!S.length||d.interactionMode==="interactive"||A.x===null)return!1;const R=10,E=this.chart.canvas.getBoundingClientRect(),k=d.width||this.width,C=d.height||this.height,z=E.top-C>0,N=z?E.top-C-R:E.top+E.height+R,V=E.left>k/2-A.x,Y=Math.max(R,window.innerWidth-R-k),G=Math.min(Y,V?Math.floor(E.left-k/2)+A.x:0+R);return w.value=`${N}px`,D.value=`${G}px`,{x:G,y:N,xAlign:"center",yAlign:z?"top":"bottom"}}}),u.onUnmounted(()=>{Yt.positioners[T]&&delete Yt.positioners[T]}),(S,A)=>(u.openBlock(),u.createElementBlock("div",aA,[y.value?e.type==="sparkline_bar"?(u.openBlock(),u.createBlock(u.unref(Qh),{key:1,"chart-id":u.unref(t),data:_.value,"data-testid":"sparkline-bar",options:v.value,plugins:f.value},null,8,["chart-id","data","options","plugins"])):e.type==="sparkline_line"||e.type==="sparkline_step"?(u.openBlock(),u.createBlock(u.unref(tf),{key:2,"chart-id":u.unref(t),data:_.value,"data-testid":e.type==="sparkline_line"?"sparkline-line":"sparkline-step",options:v.value,plugins:f.value},null,8,["chart-id","data","data-testid","options","plugins"])):u.createCommentVNode("",!0):(u.openBlock(),u.createElementBlock("div",rA,[u.renderSlot(S.$slots,"empty",{},()=>[u.createTextVNode(u.toDisplayString(u.unref(n).t("sparkline_no_data")),1)],!0)])),e.disableTooltip?u.createCommentVNode("",!0):(u.openBlock(),u.createBlock(ji,{key:3,"absolute-left":D.value,"absolute-top":w.value,class:"tooltip","data-testid":"sparkline-tooltip",state:d,"tooltip-title":e.tooltipTitle,onDimensions:h},null,8,["absolute-left","absolute-top","state","tooltip-title"])),y.value&&e.showLabel?(u.openBlock(),u.createElementBlock("div",{key:4,class:"label",title:S.$slots.label?"":p.value},[u.renderSlot(S.$slots,"label",{total:g.value,totalByDataset:m.value},()=>[u.createTextVNode(u.toDisplayString(p.value),1)],!0)],8,lA)):u.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-ae8259b6"]]),uA=["data-value"],dA=["title"],hA={class:"top-talkers-cell-metric"},fA={class:"top-talkers-cell-value","data-testid":"top-talkers-cell-value"},mA={key:0,class:"top-talkers-cell-relative","data-testid":"top-talkers-cell-relative"},pA={class:"top-talkers-tooltip","data-testid":"top-talkers-tooltip"},gA={class:"top-talkers-tooltip-title"},yA={class:"top-talkers-tooltip-rows"},bA={class:"top-talkers-tooltip-label"},_A=["data-threshold"],xA=Et(u.defineComponent({__name:"TopTalkersCell",props:{cell:{}},setup(e){return u.useCssVars(t=>({cecbd9f0:t.cell.color,v0d35e6b6:t.cell.tint})),(t,n)=>(u.openBlock(),u.createBlock(u.unref(Zn.KPop),{class:"top-talkers-cell-wrapper",disabled:!e.cell.tooltipRows.length,"hide-caret":"","hide-close-icon":"",placement:"right","popover-timeout":0,style:u.normalizeStyle({flexGrow:e.cell.ratio}),trigger:"hover"},{content:u.withCtx(()=>[u.createElementVNode("div",pA,[u.createElementVNode("div",gA,u.toDisplayString(e.cell.name),1),u.createElementVNode("dl",yA,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.cell.tooltipRows,i=>(u.openBlock(),u.createElementBlock(u.Fragment,{key:i.key},[u.createElementVNode("dt",bA,u.toDisplayString(i.label),1),u.createElementVNode("dd",{class:u.normalizeClass(["top-talkers-tooltip-value",i.threshold&&`top-talkers-tooltip-value--${i.threshold}`]),"data-threshold":i.threshold},u.toDisplayString(i.value),11,_A)],64))),128))])])]),default:u.withCtx(()=>[u.createElementVNode("div",{class:u.normalizeClass(["top-talkers-cell",{"top-talkers-cell--other":e.cell.isOther,"top-talkers-cell--empty":e.cell.isEmpty,"top-talkers-cell--deleted":e.cell.deleted}]),"data-testid":"top-talkers-cell","data-value":e.cell.id},[u.createElementVNode("span",{class:"top-talkers-cell-name","data-testid":"top-talkers-cell-name",title:e.cell.name},u.toDisplayString(e.cell.name),9,dA),u.createElementVNode("span",hA,[u.createElementVNode("span",fA,u.toDisplayString(e.cell.display),1),e.cell.relative?(u.openBlock(),u.createElementBlock("span",mA,"("+u.toDisplayString(e.cell.relative)+")",1)):u.createCommentVNode("",!0)])],10,uA)]),_:1},8,["disabled","style"]))}}),[["__scopeId","data-v-73764587"]]),wA=["data-dimension"],kA={class:"top-talkers-column-header"},TA={class:"top-talkers-column-label","data-testid":"top-talkers-column-label"},SA={key:0,class:"top-talkers-column-total","data-testid":"top-talkers-column-total"},vA={key:1,class:"top-talkers-column-empty","data-testid":"top-talkers-column-empty"},MA={key:2,class:"top-talkers-column-cells"},lf=Et(u.defineComponent({__name:"TopTalkersColumn",props:{dimension:{},label:{},data:{},sizeMetric:{},columnOptions:{},isLoading:{type:Boolean}},setup(e){const{i18n:t}=q.useI18n(),{column:n}=q.useTopTalkersData(u.toRef(()=>e.data),u.toRef(()=>e.dimension),u.toRef(()=>e.sizeMetric),u.toRef(()=>e.columnOptions)),i=u.computed(()=>e.label||n.value.label),s=u.computed(()=>t.t("topTalkers.total",{value:n.value.total}));return(o,a)=>(u.openBlock(),u.createElementBlock("div",{class:"top-talkers-column","data-dimension":e.dimension,"data-testid":"top-talkers-column"},[u.createElementVNode("div",kA,[u.createElementVNode("span",TA,u.toDisplayString(i.value),1),!e.isLoading&&u.unref(n).cells.length?(u.openBlock(),u.createElementBlock("span",SA,u.toDisplayString(s.value),1)):u.createCommentVNode("",!0)]),e.isLoading?(u.openBlock(),u.createBlock(u.unref(Zn.KSkeleton),{key:0,"delay-milliseconds":0,"table-columns":1,type:"table"})):u.unref(n).cells.length?(u.openBlock(),u.createElementBlock("div",MA,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(u.unref(n).cells,r=>(u.openBlock(),u.createBlock(xA,{key:r.id,cell:r},null,8,["cell"]))),128))])):(u.openBlock(),u.createElementBlock("div",vA,u.toDisplayString(u.unref(t).t("topTalkers.defaultEmptyStateTitle")),1))],8,wA))}}),[["__scopeId","data-v-e1b08041"]]),DA={class:"top-talkers-card-title","data-testid":"top-talkers-card-title"},CA={key:2,class:"top-talkers-grid","data-testid":"top-talkers-grid"},OA=Et(u.defineComponent({__name:"TopTalkersGrid",props:{title:{default:""},columns:{},sizeMetric:{default:void 0},columnOptions:{default:void 0},emptyStateTitle:{default:""},errorMessage:{default:""},titleTag:{default:"h2"}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=u.useSlots(),s=u.computed(()=>!!i.column),o=u.computed(()=>s.value||t.columns.some(a=>!!a.data?.data?.length||a.isLoading));return(a,r)=>(u.openBlock(),u.createBlock(u.unref(Zn.KCard),{class:"kong-ui-public-top-talkers","title-tag":e.titleTag},u.createSlots({default:u.withCtx(()=>[e.errorMessage?(u.openBlock(),u.createBlock(u.unref(Zn.KEmptyState),{key:0,"action-button-visible":!1,"data-testid":"top-talkers-error-state","icon-variant":"error"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(u.unref(n).t("topTalkers.defaultErrorStateTitle")),1)]),default:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(e.errorMessage),1)]),_:1})):o.value?(u.openBlock(),u.createElementBlock("div",CA,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.columns,(l,c)=>u.renderSlot(a.$slots,"column",{key:`${l.dimension}-${c}`,column:l},()=>[u.createVNode(lf,{"column-options":e.columnOptions,data:l.data,dimension:l.dimension,"is-loading":l.isLoading,label:l.label,"size-metric":e.sizeMetric},null,8,["column-options","data","dimension","is-loading","label","size-metric"])],!0)),128))])):(u.openBlock(),u.createBlock(u.unref(Zn.KEmptyState),{key:1,"action-button-visible":!1,"data-testid":"top-talkers-empty-state"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(e.emptyStateTitle||u.unref(n).t("topTalkers.defaultEmptyStateTitle")),1)]),_:1}))]),_:2},[e.title?{name:"title",fn:u.withCtx(()=>[u.createElementVNode("span",DA,u.toDisplayString(e.title),1)]),key:"0"}:void 0]),1032,["title-tag"]))}}),[["__scopeId","data-v-d5bb8abd"]]),AA={ai_provider:{anthropic:St.AnthropicIcon,azure:St.AzureIcon,bedrock:St.AmazonBedrockIcon,cerebras:St.CerebrasIcon,cohere:St.CohereIcon,databricks:St.DatabricksIcon,deepseek:St.DeepseekIcon,gemini:St.GeminiIcon,huggingface:St.HuggingFaceIcon,llama2:St.MetaLlamaIcon,mistral:St.MistralIcon,moonshot:St.KimiIcon,nvidia:St.NvidiaIcon,ollama:St.OllamaIcon,openai:St.OpenAiIcon,vertex:St.GoogleVertexIcon,vllm:St.VllmIcon,xai:St.GrokIcon}},PA=(e,t)=>{if(!(!e||!t))return AA[e]?.[t.toLowerCase()]},EA=["data-threshold"],RA=Et(u.defineComponent({__name:"TopNMetricBar",props:{ratio:{},threshold:{}},setup(e){u.useCssVars(n=>({v114553bb:u.unref(t)}));const t=pe({discriminator:0});return(n,i)=>(u.openBlock(),u.createElementBlock("span",{class:u.normalizeClass(["top-n-metric-cell-bar",{[`top-n-metric-cell--bar-${e.threshold}`]:!!e.threshold}]),"data-testid":"top-n-metric-cell-bar","data-threshold":e.threshold},[u.createElementVNode("span",{class:"top-n-metric-cell-bar-fill",style:u.normalizeStyle({width:`${e.ratio*100}%`})},null,4)],10,EA))}}),[["__scopeId","data-v-b5b1edfe"]]),IA=["data-threshold"],LA={class:"top-n-metric-cell-value"},NA={key:0,class:"top-n-metric-cell-relative","data-testid":"top-n-metric-cell-relative"},BA=Et(u.defineComponent({__name:"TopNMetricCell",props:{display:{},relative:{},threshold:{},hasBar:{type:Boolean}},setup(e){return(t,n)=>(u.openBlock(),u.createElementBlock("span",{class:u.normalizeClass(["top-n-metric-cell",{"top-n-metric-cell--bar":e.hasBar,[`top-n-metric-cell--text-${e.threshold}`]:!e.hasBar&&!!e.threshold}]),"data-threshold":e.threshold},[u.createElementVNode("span",LA,u.toDisplayString(e.display),1),e.relative?(u.openBlock(),u.createElementBlock("span",NA,"("+u.toDisplayString(e.relative)+")",1)):u.createCommentVNode("",!0)],10,IA))}}),[["__scopeId","data-v-17e7f860"]]),FA={class:"top-n-card-title","data-testid":"top-n-card-title"},zA={class:"top-n-card-description","data-testid":"top-n-card-description"},UA={key:3,class:"top-n-table","data-testid":"top-n-table"},VA={"data-testid":"top-n-table-header"},HA={class:"top-n-table-header-row"},$A=["colspan"],YA={class:"table-header-label"},WA=["data-testid"],jA={class:"top-n-table-cell-label"},qA={key:0,class:"top-n-table-cell top-n-table-cell-bar"},GA=3,XA=Et(u.defineComponent({__name:"TopNTable",props:{title:{default:""},description:{default:""},data:{},emptyStateTitle:{default:""},isLoading:{type:Boolean,default:!1},titleTag:{default:"h2"},columnOptions:{default:void 0}},setup(e){const t=e,{i18n:n}=q.useI18n(),{formatUnit:i}=le({i18n:n}),s=q.useFieldLabel(),o=u.computed(()=>t.data.data),a=u.computed(()=>!!o.value?.length),r=u.computed(()=>t.data.meta?.display?Object.keys(t.data.meta.display).slice(0,GA):[]),l=u.computed(()=>r.value[0]||""),c=u.computed(()=>r.value.length>1),d=u.computed(()=>r.value[r.value.length-1]||""),h=u.computed(()=>l.value?t.data.meta.display[l.value]:{}),f=u.computed(()=>t.data.meta?.metric_names?.length?t.data.meta.metric_names:[]),m=u.computed(()=>f.value[0]),p=u.computed(()=>m.value?s(m.value):""),g=u.computed(()=>{const M=r.value.map(P=>({key:P,columnKey:P,label:st(P,c.value?s(P):n.t("topNTable.nameLabel")),type:"dimension"}));return m.value&&M.push({key:"value",columnKey:m.value,label:st(m.value,p.value),type:"metric"}),f.value.forEach((P,F)=>{F!==0&&M.push({key:P,columnKey:P,label:st(P,s(P)),type:"metric"})}),M}),y=u.computed(()=>g.value.filter(M=>M.type==="metric")),_=u.computed(()=>g.value.filter(M=>M.type==="dimension").slice(1)),x=M=>M.type==="dimension"&&M.key===d.value,T=M=>M.type==="metric"&&!!ln(t.columnOptions,M.columnKey)?.bar,v=M=>c.value&&M.type==="dimension"&&!x(M),w=M=>{const P=M.event;return String(P[l.value])},D=(M,P)=>{const F=String(M.event[P]),$=t.data.meta?.display?.[P]?.[F];return{dimension:P,id:F,name:$?.name||"-",deleted:!!$?.deleted}},S=M=>{const P=w(M),F=h.value&&h.value[P];return F?F.name:"-"},A=M=>{const P=w(M),F=h.value&&h.value[P];return F?!!F.deleted:!1},R=M=>{const P=F=>i(F,"%",{translateUnit:$=>U($,F)});return M>0&&M<.01?`< ${P(.01)}`:P(M)},E=(M,P)=>{const F=M.event[P];if(F==null)return"–";const $=typeof F=="number"?F:Number(F);if(Number.isNaN($))return"–";const it=t.data.meta?.metric_units?.[P]||"count";if(it==="%")return R($);const L=["count","count/minute","token count"].includes(it);return i($,it,{approximate:L,isBytes1024:!0,translateUnit:H=>U(H,$)})},k=u.computed(()=>Object.fromEntries(f.value.map(M=>[M,Aa(o.value.map(P=>Bn(P.event[M])))]))),C=(M,P)=>{const F=ln(t.columnOptions,P),$=Bn(M.event[P]);if(!F||$===null)return{display:E(M,P)};const it=k.value[P],L=F.value==="relative"?Pa($,it):null;return{display:E(M,P),relative:L===null?void 0:R(L*100),barRatio:F.bar?vd($,it,F.bar):void 0,threshold:Ea($,F.thresholds)}},z=u.computed(()=>o.value?.length?o.value.map(M=>{const P=r.value.map(L=>D(M,L)),F=P[0],$=F?.id||w(M),it={id:$,rowKey:P.map(L=>`${L.dimension}:${L.id}`).join("|")||$,name:F?.name||S(M),deleted:A(M),dimensions:P,metrics:{},original:M};return f.value.forEach((L,H)=>{it.metrics[H===0?"value":L]=C(M,L)}),it}):[]),N=u.computed(()=>{if(!a.value)return"";if(t.data.meta){if(r.value.some(M=>!Object.keys(t.data.meta.display[M]||{}).length))return n.t("topNTable.errors.display");if(!m.value)return n.t("topNTable.errors.metricNames")}else return n.t("topNTable.errors.meta");return""}),V=(M,P)=>M.metrics[P]??{display:"–"},Y=(M,P)=>M.dimensions.find(F=>F.dimension===P)?.id||"",G=(M,P)=>PA(ln(t.columnOptions,M)?.icon_set,P),st=(M,P)=>M&&ln(t.columnOptions,M)?.label||P,ot=(M,P)=>M.dimensions.find(F=>F.dimension===P)?.name||"–",K=(M,P)=>{const F=M.dimensions.find($=>$.dimension===P);return{id:F?.id||"",name:F?.name||"–",deleted:F?.deleted||!1,dimension:P,dimensions:M.dimensions,isEmpty:F?.id==="empty"}},U=(M,P)=>{if(zi(M)||M==="count"||M==="requests")return"";const F=P===1?"":"s";return n.te(`chartUnits.${M}`)?n.t(`chartUnits.${M}`,{plural:F}):M};return(M,P)=>{const F=u.resolveComponent("KEmptyState"),$=u.resolveComponent("KSkeleton"),it=u.resolveComponent("KCard");return u.openBlock(),u.createBlock(it,{class:"kong-ui-public-top-n-table","title-tag":e.titleTag},u.createSlots({default:u.withCtx(()=>[N.value?(u.openBlock(),u.createBlock(F,{key:0,"action-button-visible":!1,"data-testid":"top-n-error-state","icon-variant":"error"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(u.unref(n).t("topNTable.defaultErrorStateTitle")),1)]),default:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(N.value),1)]),_:1})):e.isLoading?(u.openBlock(),u.createBlock($,{key:1,"table-columns":2,type:"table"})):a.value?(u.openBlock(),u.createElementBlock("div",UA,[u.createElementVNode("table",{class:u.normalizeClass(["top-n-table-table",{"top-n-table-table--multi-dimension":c.value}])},[u.createElementVNode("thead",VA,[u.createElementVNode("tr",HA,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(g.value,L=>(u.openBlock(),u.createElementBlock("th",{key:L.key,class:u.normalizeClass(["top-n-table-header-cell",{"top-n-table-header-cell-metric":L.type==="metric","top-n-table-header-cell-dimension-compact":v(L)}]),colspan:T(L)?2:void 0,"data-testid":"top-n-table-header-column"},[u.createElementVNode("span",YA,u.toDisplayString(L.label),1),P[0]||(P[0]=u.createElementVNode("div",{class:"top-n-table-header-cell-border"},null,-1))],10,$A))),128))])]),u.createElementVNode("tbody",null,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(z.value,L=>(u.openBlock(),u.createElementBlock("tr",{key:L.rowKey,class:"top-n-table-row"},[r.value.length?(u.openBlock(),u.createElementBlock("td",{key:0,class:u.normalizeClass(["top-n-table-cell top-n-table-cell--name",{"top-n-table-cell-dimension-compact":c.value}])},[u.createElementVNode("span",{class:"top-n-table-cell-label","data-testid":`row-${L.id}`},[G(l.value,L.id)?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(G(l.value,L.id)),{key:0,class:"top-n-table-cell-icon","data-testid":"top-n-table-cell-icon",decorative:"",size:`var(--kui-icon-size-30, ${u.unref(Sn)})`},null,8,["size"])):u.createCommentVNode("",!0),u.renderSlot(M.$slots,"name",{record:{id:L.id,name:L.name,deleted:L.deleted,dimension:l.value,dimensions:L.dimensions,isEmpty:L.id==="empty"}},()=>[u.createTextVNode(u.toDisplayString(L.name),1)],!0)],8,WA)],2)):u.createCommentVNode("",!0),(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(_.value,H=>(u.openBlock(),u.createElementBlock("td",{key:H.key,class:u.normalizeClass(["top-n-table-cell top-n-table-cell--dimension",{"top-n-table-cell-dimension-compact":!x(H)}])},[u.createElementVNode("span",jA,[G(H.key,Y(L,H.key))?(u.openBlock(),u.createBlock(u.resolveDynamicComponent(G(H.key,Y(L,H.key))),{key:0,class:"top-n-table-cell-icon","data-testid":"top-n-table-cell-icon",decorative:"",size:`var(--kui-icon-size-30, ${u.unref(Sn)})`},null,8,["size"])):u.createCommentVNode("",!0),u.renderSlot(M.$slots,"name",{record:K(L,H.key)},()=>[u.createTextVNode(u.toDisplayString(ot(L,H.key)),1)],!0)])],2))),128)),(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(y.value,H=>(u.openBlock(),u.createElementBlock(u.Fragment,{key:H.key},[u.createElementVNode("td",{class:u.normalizeClass(["top-n-table-cell top-n-table-cell-metric",{"top-n-table-cell-metric--has-bar":T(H)}])},[u.createVNode(BA,{"data-testid":H.key==="value"?`row-${L.id}`:`row-${L.id}-${H.key}`,display:V(L,H.key).display,"has-bar":T(H),relative:V(L,H.key).relative,threshold:V(L,H.key).threshold},null,8,["data-testid","display","has-bar","relative","threshold"])],2),T(H)?(u.openBlock(),u.createElementBlock("td",qA,[u.createVNode(RA,{ratio:V(L,H.key).barRatio??0,threshold:V(L,H.key).threshold},null,8,["ratio","threshold"])])):u.createCommentVNode("",!0)],64))),128))]))),128))])],2)])):(u.openBlock(),u.createBlock(F,{key:2,"action-button-visible":!1,"data-testid":"top-n-empty-state"},{title:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(e.emptyStateTitle||u.unref(n).t("topNTable.defaultEmptyStateTitle")),1)]),_:1}))]),_:2},[e.title?{name:"title",fn:u.withCtx(()=>[u.createElementVNode("span",FA,u.toDisplayString(e.title),1)]),key:"0"}:void 0,e.description?{name:"actions",fn:u.withCtx(()=>[u.createElementVNode("div",zA,u.toDisplayString(e.description),1)]),key:"1"}:void 0]),1032,["title-tag"])}}}),[["__scopeId","data-v-f3df2bb7"]]);nt.AnalyticsChart=YO,nt.ChartLegendPosition=Nt,nt.DECIMAL_DISPLAY=HM,nt.FONT_SIZE_REGULAR=Pd,nt.FONT_SIZE_SMALL=Ad,nt.LEFT_Y_AXIS_ID=Gs,nt.MAX_LABEL_LENGTH=qs,nt.OTHER_DIMENSION_ID=mo,nt.RIGHT_Y_AXIS_ID=La,nt.SimpleChart=oA,nt.SparklineChart=cA,nt.TopNTable=XA,nt.TopTalkersColumn=lf,nt.TopTalkersGrid=OA,nt.chartTypes=H1,nt.exploreResultToScatterData=Zd,nt.formatChartTicksByGranularity=qa,nt.getBarRatio=vd,nt.getColumnOptions=ln,nt.getColumnStats=Aa,nt.getRelativeValue=Pa,nt.getThresholdType=Ea,nt.handleQueryError=R1,nt.isCancellationError=Xd,nt.isScatterChartData=Ka,nt.lookupStatusCodeColor=Rd,nt.requestsToScatterData=z1,nt.simpleChartMetricDisplay=V1,nt.simpleChartTypes=$1,nt.toNumber=Bn,Object.defineProperty(nt,Symbol.toStringTag,{value:"Module"})}));
6
+ ${S?"text-wrap: nowrap;":""}
7
+ `)}}function CM(e,t,n={}){const{window:i=$s,...s}=n;let o;const a=Tu(()=>i&&"ResizeObserver"in i),r=()=>{o&&(o.disconnect(),o=void 0)},l=d.watch(d.computed(()=>{const u=d.toValue(e);return Array.isArray(u)?u.map(h=>Nn(h)):[Nn(u)]}),u=>{if(r(),a.value&&i){o=new ResizeObserver(t);for(const h of u)h&&o.observe(h,s)}},{immediate:!0,flush:"post"}),c=()=>{r(),l()};return wu(c),{isSupported:a,stop:c}}function OM(e,t={}){const{reset:n=!0,windowResize:i=!0,windowScroll:s=!0,immediate:o=!0,updateTiming:a="sync"}=t,r=d.shallowRef(0),l=d.shallowRef(0),c=d.shallowRef(0),u=d.shallowRef(0),h=d.shallowRef(0),f=d.shallowRef(0),m=d.shallowRef(0),p=d.shallowRef(0);function g(){const _=Nn(e);if(!_){n&&(r.value=0,l.value=0,c.value=0,u.value=0,h.value=0,f.value=0,m.value=0,p.value=0);return}const x=_.getBoundingClientRect();r.value=x.height,l.value=x.bottom,c.value=x.left,u.value=x.right,h.value=x.top,f.value=x.width,m.value=x.x,p.value=x.y}function y(){a==="sync"?g():a==="next-frame"&&requestAnimationFrame(()=>g())}return CM(e,y),d.watch(()=>Nn(e),_=>!_&&y()),SM(e,y,{attributeFilter:["style","class"]}),s&&Ni("scroll",y,{capture:!0,passive:!0}),i&&Ni("resize",y,{passive:!0}),kM(()=>{o&&y()}),{height:r,bottom:l,left:c,right:u,top:h,width:f,x:m,y:p,update:y}}function AM(e,t){const{top:n,left:i}=OM(e),s=d.computed(()=>e.value?`${parseFloat(t.left)+i.value}px`:t.left),o=d.computed(()=>e.value?`${parseFloat(t.top)+n.value}px`:t.top);return{tooltipAbsoluteLeft:s,tooltipAbsoluteTop:o}}const PM=({bucketCount:e,minStamp:t,maxStamp:n,timestamps:i})=>{const s=[...i].filter(l=>l>=t&&l<=n).sort((l,c)=>l-c),o=[];if(n-t<e-2)return[];const a=(n-t)/e;let r=0;for(let l=0;l<e;l++){const c=t+l*a,u=t+(l+1)*a;let h=0;for(;r<s.length&&s[r]>=c&&s[r]<=u;)h++,r++;o.push([Math.ceil(c),h])}return o},vu=()=>({minCounts:{},maxCounts:{},minStamps:{},maxStamps:{},renderPoints:{}}),Bi=d.ref({}),EM=e=>(Bi.value[e]||(Bi.value[e]=vu()),Bi.value[e]),RM=(e,t)=>{const n=Bi.value[t];if(!n)return;const i=n.minCounts[e]!==void 0||n.maxCounts[e]!==void 0||n.minStamps[e]!==void 0||n.maxStamps[e]!==void 0||n.renderPoints[e]!==void 0;n&&i&&(delete n.minCounts[e],delete n.maxCounts[e],delete n.minStamps[e],delete n.maxStamps[e],delete n.renderPoints[e],Object.keys(n.minCounts).length||Object.keys(n.maxCounts).length||Object.keys(n.minStamps).length||Object.keys(n.maxStamps).length||Object.keys(n.renderPoints).length||delete Bi.value[t])};function IM({chartKey:e,datasets:t,groupKey:n,minStamp:i=void 0,maxStamp:s=void 0,minCount:o=void 0,maxCount:a=void 0,renderPoints:r=void 0,type:l}){const u=n!==void 0&&e!==void 0?EM(n):vu(),h=e!==void 0?e:"static-chart-key",f=d.computed(()=>t.reduce((E,{timestamps:k})=>[...E,...k],[])),m=d.computed(()=>i||f.value.reduce((E,k)=>E===0?k:Math.min(E,k),0)),p=d.computed(()=>s||f.value.reduce((E,k)=>Math.max(E,k),0));d.watchEffect(()=>{u.minStamps[h]=m.value,u.maxStamps[h]=p.value,r!==void 0&&(u.renderPoints[h]=r)});const g=d.computed(()=>Object.values(u.minStamps).reduce((E,k)=>E===0?k:Math.min(E,k),0)),y=d.computed(()=>Object.values(u.maxStamps).reduce((E,k)=>Math.max(E,k),0)),_=d.computed(()=>{const E=Object.values(u.renderPoints);return E.length===0?24:E.reduce((k,C)=>Math.max(k,C),2)}),x=d.computed(()=>{const E=y.value-g.value;return Math.ceil(E/_.value)}),T=d.computed(()=>t.length>1),S=d.computed(()=>t.map(({timestamps:E,color:k,label:C})=>({data:PM({bucketCount:_.value,minStamp:g.value,maxStamp:y.value,timestamps:E}).map(([V,Y])=>({x:V,y:Y})),label:C,...(l==="sparkline_bar"||T.value)&&k&&{backgroundColor:k},...l!=="sparkline_bar"&&k&&{borderColor:k},...T.value&&l!=="sparkline_bar"&&{fill:!0}}))),w=d.computed(()=>{const E=S.value[0]?.data?.length??0,k=[];for(let C=0;C<E;C++){let z=0;for(let N=0;N<S.value.length;N++)z+=S.value[N].data[C].y;k.push(z)}return k}),D=d.computed(()=>{const E=w.value.reduce((k,C)=>Math.max(k,C),0);return Math.max(E,a??0)}),v=d.computed(()=>{const E=S.value.reduce((z,{data:N})=>[...z,...N.map(({y:V})=>V)],[]),k=E.length?E[0]:0,C=E.reduce((z,N)=>Math.min(z,N),k);return o===void 0?C:Math.min(C,o)});d.watchEffect(()=>{u.maxCounts[h]=D.value,u.minCounts[h]=v.value});const A=d.computed(()=>{const E=Object.values(u.minCounts),k=E.length?E[0]:0;return E.reduce((C,z)=>Math.min(C,z),k)}),R=d.computed(()=>Object.values(u.maxCounts).reduce((E,k)=>Math.max(E,k),0));return d.onUnmounted(()=>{e!==void 0&&n!==void 0&&RM(e,n)}),{syncedMinStamp:g,syncedMaxStamp:y,syncedRenderPoints:_,syncedChartDatasets:S,syncedGroupSizeMs:x,syncedMinCount:A,syncedMaxCount:R}}const ln=(e,t)=>{if(!e||!t)return;const n=t.toLowerCase();return e[t]??Object.entries(e).find(([i])=>i.toLowerCase()===n)?.[1]},Bn=e=>{if(e==null||e==="")return null;const t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:null},Pa=e=>e.reduce((t,n)=>n===null?t:{sum:t.sum+n,max:Math.max(t.max,n)},{sum:0,max:0}),Ea=(e,t)=>t.sum>0?e/t.sum:null,Su=(e,t,n)=>{const i=n==="relative"?t.sum:t.max;return i<=0?0:Math.min(Math.max(e/i,0),1)},Ra=(e,t)=>{const n=(t??[]).filter(o=>e>=o.value);if(!n.length)return;const i=Math.max(...n.map(o=>o.value));return n.filter(o=>o.value===i).some(o=>o.type==="error")?"error":"warning"},Mu=18,LM=85;function NM(e,t,n,i){const{i18n:s}=Ho(),{formatUnit:o}=le({i18n:s}),a=q.useFieldLabel(),r=w=>w.map(D=>{const v=Math.min(D.ratio,.5)/.5;return{...D,color:pe({discriminator:0}),tint:`${Mu+v*(LM-Mu)}%`}}),l=d.computed(()=>e.value?.data??[]),c=d.computed(()=>e.value?.meta?.metric_names??[]),u=d.computed(()=>{const w=n.value;return w&&c.value.includes(w)?w:c.value[0]}),h=d.computed(()=>c.value.filter(w=>w!==u.value)),f=d.computed(()=>e.value?.meta?.display?.[t.value]??{}),m=(w,D)=>{if(zi(w)||w==="count"||w==="requests")return"";const v=D===1?"":"s";return s.te(`chartUnits.${w}`)?s.t(`chartUnits.${w}`,{plural:v}):w},p=w=>{const D=v=>o(v,"%",{translateUnit:A=>m(A,v)});return w>0&&w<.01?`< ${D(.01)}`:D(w)},g=(w,D)=>{if(w===null)return"–";const v=e.value?.meta?.metric_units?.[D]||"count";return v==="%"?p(w):o(w,v,{isBytes1024:!0,translateUnit:A=>m(A,w)})},y=w=>ln(i.value,w)?.label||a(w),_=d.computed(()=>Pa(l.value.map(w=>u.value?Bn(w.event[u.value]):null))),x=w=>h.value.flatMap(D=>{const v=Bn(w[D]);if(v===null)return[];const A=Ra(v,ln(i.value,D)?.thresholds);return[{key:D,label:y(D),value:g(v,D),threshold:A}]}),T=d.computed(()=>{if(!u.value)return[];const w=l.value.map(D=>{const v=D.event,A=String(v[t.value]),R=Bn(v[u.value])??0,E=Ea(R,_.value),k=E??0,C=A===mo;return{id:A,name:C?s.t(`chartLabels.${mo}`):f.value[A]?.name||A,deleted:!!f.value[A]?.deleted,isOther:C,isEmpty:A===Of,value:R,ratio:k,display:g(R,u.value),relative:E===null?"":p(E*100),tooltipRows:x(v)}}).sort((D,v)=>Number(D.isOther)-Number(v.isOther)||v.value-D.value);return r(w)});return{column:d.computed(()=>({dimension:t.value,label:y(t.value),total:g(_.value.sum,u.value??"count"),cells:T.value})),cells:T,sizeKey:u}}const BM=(e,t,n,{prefix:i="chartLabels",fallback:s=n}={})=>{const o=`${i}.${n}`;return t.get(n)||(e.te(o)?e.t(o):s)};function FM(){const{i18n:e}=Ho(),t=Dr.useDatasourceConfigStore();return(n,i)=>BM(e,t.fieldTranslationMap,n,i)}const q={useBarChartOptions:yv,useChartJSCommon:_v,useChartLegendValues:wv,useExploreResultToDatasets:nM,useExploreResultToTimeDataset:aM,useScatterDatasets:fM,useDonutChartOptions:kv,useLineChartOptions:Tv,useScatterChartOptions:Mv,useI18n:Ho,useFieldLabel:FM,useReportChartDataForSynthetics:mM,useTranslatedUnits:pM,useEvaluateFeatureFlag:gM,useTooltipAbsolutePosition:AM,useSparklineSync:IM,useTopTalkersData:NM},Ws=e=>["interactive","zoom-interactive"].includes(e),Ia=(e,t,n,i)=>{const{tooltip:s}=t;if(s.opacity===0&&!Ws(e.interactionMode)){e.showTooltip=!1;return}const{i18n:o}=q.useI18n(),{formatUnit:a}=le({i18n:o}),r=e.chartTooltipSortFn||((l,c)=>c.rawValue-l.rawValue);if(s.body&&!Ws(e.interactionMode)){const l=s.labelColors,c=t.chart.config?.options?.indexAxis==="y"?"x":"y",u=s.dataPoints[0].parsed.x??0;e.tooltipContext=i?.contextFormatter?i.contextFormatter(u,n,s.dataPoints[0].raw):Un({tickValue:new Date(u),granularity:n}),e.tooltipSeries=s.dataPoints.map((f,m)=>{const p=f.parsed[c],g=f.dataset.unit??e.units,y=a(p??0,g,{translateUnit:e.translateUnit}),_=f.raw?.tooltipLabel||f.dataset.label;return{backgroundColor:l[m].backgroundColor,borderColor:l[m].borderColor,label:_,value:y,rawValue:p,isSegmentEmpty:f.dataset.isSegmentEmpty}}).sort(r);const h=s.dataPoints[0]?.raw?.extras??[];for(const f of h)e.tooltipSeries.push({label:f.label,value:f.unit?a(Number(f.value)||0,f.unit,{translateUnit:e.translateUnit}):String(f.value),rawValue:Number(f.value)||0,isExtra:!0});e.left=`${s.x}px`,e.top=`${s.y}px`,e.showTooltip=!0}},Du=(e,t)=>{const{tooltip:n}=t,{i18n:i}=q.useI18n(),{formatUnit:s}=le({i18n:i});if(n.opacity===0&&!Ws(e.interactionMode)){e.showTooltip=!1;return}const o=e.chartTooltipSortFn||((a,r)=>r.rawValue-a.rawValue);if(n.body&&!Ws(e.interactionMode)){const a=n.labelColors,r=t.chart.config?.options?.indexAxis==="y"?"x":"y",l=["gauge","donut"].includes(e.chartType);l?e.tooltipContext=e.dimensionDisplay||n.dataPoints[0].label:n.chart.data.isMultiDimension?e.tooltipContext=n.dataPoints[0].label:e.tooltipContext=e.dimensionDisplay||"",e.tooltipSeries=n.dataPoints.map((c,u)=>{const h=l?c.parsed:c.parsed[r],f=s(h??0,e.units,{translateUnit:e.translateUnit});let m;return l?m=c.dataset.labels[c.dataIndex]:m=c.dataset.label,{backgroundColor:a[u].backgroundColor,borderColor:a[u].borderColor,label:m,value:f,rawValue:h,isSegmentEmpty:c.dataset.isSegmentEmpty}}).sort(o),e.left=`${n.x}px`,e.top=`${n.y}px`,e.showTooltip=!0}},zM=e=>e&&e.datasets&&e.datasets.length,UM=e=>zM(e)&&e.datasets.some(t=>t.data.length),VM=e=>e.datasets.some(t=>t.data[0]&&Ro(t.data[0].x)),HM=e=>!!UM(e)&&e.datasets.some(t=>t.data.length==1),$M=e=>VM(e)&&e.datasets.some(t=>t.data[0]&&(t.data[0].x??0).toString().length>=13),js=(e,t,n)=>{const s=Math.min(t/1150,1),o=.15,a=1.15,r=e.x??0;return r<n?r+t*o*(1-s):r-t*a*(1-s)},Cu=(e,t,n)=>{const o=e.y??0;return o<n?o+t*.15:o-t*.5};function Ou(e,t){let n;return(...i)=>{clearTimeout(n),n=window.setTimeout(()=>{e(...i)},t)}}const La=(e,t,n)=>{const i=e.data;return e.options.plugins.legend.labels.generateLabels(e).filter(s=>!t?.[s.text]?.isThreshold).map(((s,o)=>({...s,value:t&&t[s.text],isSegmentEmpty:i.datasets[o].isSegmentEmpty}))).sort(n)},YM=2,Au=10,Pu=12,qs=10,Gs="y",Na="y1",WM={lineTension:0,pointBorderWidth:1.2,borderJoinStyle:"round",fill:!0},jM=2,qM=0,Ba=new Map,Eu=(e,t)=>{const{i18n:n}=q.useI18n(),{formatBytes:i}=le({i18n:n});return t==="bytes"?i(e):t==="count/minute"?e.toFixed(2):ss.format(e)},GM=e=>{const n=document.createElement("canvas").getContext("2d"),i=xt({});return n.font=i.string,n.measureText(e).width},XM=()=>{const e="label_height";if(!Ba.has(e)){const t=xt({});Ba.set(e,t.lineHeight)}return Ba.get(e)},KM=(e,t)=>t.datasets.reduce((n,i,s)=>e.isDatasetVisible(s)?n+i.data.reduce((o,a)=>isNaN(a)?o:o+a,0):n,0),ZM=(e,t)=>t===0?" (0.0%)":` (${(e/t*100).toFixed(1)}%)`,QM=Qp,JM={100:og,101:ag,102:rg,103:lg,200:cg,201:dg,202:ug,203:hg,204:fg,205:mg,206:pg,207:gg,208:yg,226:bg,300:_g,301:xg,302:wg,303:kg,304:Tg,305:vg,307:Sg,308:Mg,400:Dg,401:Cg,402:Og,403:Ag,404:Pg,405:Eg,406:Rg,407:Ig,408:Lg,409:Ng,410:Bg,411:Fg,412:zg,413:Ug,414:Vg,415:Hg,416:$g,417:Yg,418:Wg,421:jg,422:qg,423:Gg,424:Xg,425:Kg,426:Zg,428:Qg,429:Jg,431:ty,451:ey,500:ny,501:iy,502:sy,503:oy,504:ay,505:ry,506:ly,507:cy,508:dy,510:uy,511:hy},t1={100:fy,200:my,300:py,400:gy,500:yy},e1={"1XX":by,"2XX":_y,"3XX":xy,"4XX":wy,"5XX":ky},Ru=e=>{const t=parseInt(e,10),n=Math.floor(t/100)*100;return JM[t]??t1[n]??QM},n1={...Array.from({length:500},(e,t)=>100+t).reduce((e,t)=>(e[`${t}`]=Ru(`${t}`),e),{}),____OTHER____:Zp,...e1};function Iu(e,t,n){const i=Ll(),s=o1(e,n.timeZone,n.locale??i.locale);return"formatToParts"in s?i1(s,t):s1(s,t)}function i1(e,t){const n=e.formatToParts(t);for(let i=n.length-1;i>=0;--i)if(n[i].type==="timeZoneName")return n[i].value}function s1(e,t){const n=e.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(n);return i?i[0].substr(1):""}function o1(e,t,n){return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}function a1(e,t){const n=u1(t);return"formatToParts"in n?l1(n,e):c1(n,e)}const r1={year:0,month:1,day:2,hour:3,minute:4,second:5};function l1(e,t){try{const n=e.formatToParts(t),i=[];for(let s=0;s<n.length;s++){const o=r1[n[s].type];o!==void 0&&(i[o]=parseInt(n[s].value,10))}return i}catch(n){if(n instanceof RangeError)return[NaN];throw n}}function c1(e,t){const n=e.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(i[3],10),parseInt(i[1],10),parseInt(i[2],10),parseInt(i[4],10),parseInt(i[5],10),parseInt(i[6],10)]}const Fa={},Lu=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),d1=Lu==="06/25/2014, 00:00:00"||Lu==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";function u1(e){return Fa[e]||(Fa[e]=d1?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),Fa[e]}function Nu(e,t,n,i,s,o,a){const r=new Date(0);return r.setUTCFullYear(e,t,n),r.setUTCHours(i,s,o,a),r}const Bu=36e5,h1=6e4,za={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Ua(e,t,n){if(!e)return 0;let i=za.timezoneZ.exec(e);if(i)return 0;let s,o;if(i=za.timezoneHH.exec(e),i)return s=parseInt(i[1],10),Fu(s)?-(s*Bu):NaN;if(i=za.timezoneHHMM.exec(e),i){s=parseInt(i[2],10);const a=parseInt(i[3],10);return Fu(s,a)?(o=Math.abs(s)*Bu+a*h1,i[1]==="+"?-o:o):NaN}if(p1(e)){t=new Date(t||Date.now());const a=n?t:f1(t),r=Va(a,e);return-(n?r:m1(t,r,e))}return NaN}function f1(e){return Nu(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function Va(e,t){const n=a1(e,t),i=Nu(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime();let s=e.getTime();const o=s%1e3;return s-=o>=0?o:1e3+o,i-s}function m1(e,t,n){let s=e.getTime()-t;const o=Va(new Date(s),n);if(t===o)return t;s-=o-t;const a=Va(new Date(s),n);return o===a?o:Math.max(o,a)}function Fu(e,t){return-23<=e&&e<=23&&(t==null||0<=t&&t<=59)}const zu={};function p1(e){if(zu[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),zu[e]=!0,!0}catch{return!1}}const g1=60*1e3,y1={X:function(e,t,n){const i=Ha(n.timeZone,e);if(i===0)return"Z";switch(t){case"X":return Uu(i);case"XXXX":case"XX":return Fn(i);default:return Fn(i,":")}},x:function(e,t,n){const i=Ha(n.timeZone,e);switch(t){case"x":return Uu(i);case"xxxx":case"xx":return Fn(i);default:return Fn(i,":")}},O:function(e,t,n){const i=Ha(n.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+b1(i,":");default:return"GMT"+Fn(i,":")}},z:function(e,t,n){switch(t){case"z":case"zz":case"zzz":return Iu("short",e,n);default:return Iu("long",e,n)}}};function Ha(e,t){const n=e?Ua(e,t,!0)/g1:t?.getTimezoneOffset()??0;if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+e);return n}function Xs(e,t){const n=e<0?"-":"";let i=Math.abs(e).toString();for(;i.length<t;)i="0"+i;return n+i}function Fn(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=Xs(Math.floor(i/60),2),o=Xs(Math.floor(i%60),2);return n+s+t+o}function Uu(e,t){return e%60===0?(e>0?"-":"+")+Xs(Math.abs(e)/60,2):Fn(e,t)}function b1(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),s=Math.floor(i/60),o=i%60;return o===0?n+String(s):n+String(s)+t+Xs(o,2)}function Vu(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const _1=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,$a=36e5,Hu=6e4,x1=2,qt={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:_1};function $u(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(e===null)return new Date(NaN);const n=t.additionalDigits==null?x1:Number(t.additionalDigits);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]")return new Date(e.getTime());if(typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]")return new Date(e);if(Object.prototype.toString.call(e)!=="[object String]")return new Date(NaN);const i=w1(e),{year:s,restDateString:o}=k1(i.date,n),a=T1(o,s);if(a===null||isNaN(a.getTime()))return new Date(NaN);if(a){const r=a.getTime();let l=0,c;if(i.time&&(l=v1(i.time),l===null||isNaN(l)))return new Date(NaN);if(i.timeZone||t.timeZone){if(c=Ua(i.timeZone||t.timeZone,new Date(r+l)),isNaN(c))return new Date(NaN)}else c=Vu(new Date(r+l)),c=Vu(new Date(r+l+c));return new Date(r+l+c)}else return new Date(NaN)}function w1(e){const t={};let n=qt.dateTimePattern.exec(e),i;if(n?(t.date=n[1],i=n[3]):(n=qt.datePattern.exec(e),n?(t.date=n[1],i=n[2]):(t.date=null,i=e)),i){const s=qt.timeZone.exec(i);s?(t.time=i.replace(s[1],""),t.timeZone=s[1].trim()):t.time=i}return t}function k1(e,t){if(e){const n=qt.YYY[t],i=qt.YYYYY[t];let s=qt.YYYY.exec(e)||i.exec(e);if(s){const o=s[1];return{year:parseInt(o,10),restDateString:e.slice(o.length)}}if(s=qt.YY.exec(e)||n.exec(e),s){const o=s[1];return{year:parseInt(o,10)*100,restDateString:e.slice(o.length)}}}return{year:null}}function T1(e,t){if(t===null)return null;let n,i,s;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let o=qt.MM.exec(e);if(o)return n=new Date(0),i=parseInt(o[1],10)-1,ju(t,i)?(n.setUTCFullYear(t,i),n):new Date(NaN);if(o=qt.DDD.exec(e),o){n=new Date(0);const a=parseInt(o[1],10);return D1(t,a)?(n.setUTCFullYear(t,0,a),n):new Date(NaN)}if(o=qt.MMDD.exec(e),o){n=new Date(0),i=parseInt(o[1],10)-1;const a=parseInt(o[2],10);return ju(t,i,a)?(n.setUTCFullYear(t,i,a),n):new Date(NaN)}if(o=qt.Www.exec(e),o)return s=parseInt(o[1],10)-1,qu(s)?Yu(t,s):new Date(NaN);if(o=qt.WwwD.exec(e),o){s=parseInt(o[1],10)-1;const a=parseInt(o[2],10)-1;return qu(s,a)?Yu(t,s,a):new Date(NaN)}return null}function v1(e){let t,n,i=qt.HH.exec(e);if(i)return t=parseFloat(i[1].replace(",",".")),Ya(t)?t%24*$a:NaN;if(i=qt.HHMM.exec(e),i)return t=parseInt(i[1],10),n=parseFloat(i[2].replace(",",".")),Ya(t,n)?t%24*$a+n*Hu:NaN;if(i=qt.HHMMSS.exec(e),i){t=parseInt(i[1],10),n=parseInt(i[2],10);const s=parseFloat(i[3].replace(",","."));return Ya(t,n,s)?t%24*$a+n*Hu+s*1e3:NaN}return null}function Yu(e,t,n){t=t||0,n=n||0;const i=new Date(0);i.setUTCFullYear(e,0,4);const s=i.getUTCDay()||7,o=t*7+n+1-s;return i.setUTCDate(i.getUTCDate()+o),i}const S1=[31,28,31,30,31,30,31,31,30,31,30,31],M1=[31,29,31,30,31,30,31,31,30,31,30,31];function Wu(e){return e%400===0||e%4===0&&e%100!==0}function ju(e,t,n){if(t<0||t>11)return!1;if(n!=null){if(n<1)return!1;const i=Wu(e);if(i&&n>M1[t]||!i&&n>S1[t])return!1}return!0}function D1(e,t){if(t<1)return!1;const n=Wu(e);return!(n&&t>366||!n&&t>365)}function qu(e,t){return!(e<0||e>52||t!=null&&(t<0||t>6))}function Ya(e,t,n){return!(e<0||e>=25||t!=null&&(t<0||t>=60)||n!=null&&(n<0||n>=60))}const C1=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function O1(e,t,n={}){t=String(t);const i=t.match(C1);if(i){const s=$u(n.originalDate||e,n);t=i.reduce(function(o,a){if(a[0]==="'")return o;const r=o.indexOf(a),l=o[r-1]==="'",c=o.replace(a,"'"+y1[a[0]](s,a,n)+"'");return l?c.substring(0,r-1)+c.substring(r+1):c},t)}return rs(e,t,n)}function A1(e,t,n){e=$u(e,n);const i=Ua(t,e,!0),s=new Date(e.getTime()-i),o=new Date(0);return o.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),o.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),o}function Fi(e,t,n,i){return i={...i,timeZone:t,originalDate:e},O1(A1(e,t,{timeZone:i.timeZone}),n,i)}const P1=(e,t)=>`${Fi(e,t,"yyyy")} W${Fi(e,t,"II")}`,Wa="MMM dd, h:mm:ss a",ja="h:mm:ss a",cn="MMM dd, h:mm a",zn="h:mm a",E1="MMM dd",qa="MMM dd, h:mm:ss a",He="MMM dd, h:mm a",R1={secondly:e=>e?Wa:ja,tenSecondly:e=>e?Wa:ja,thirtySecondly:e=>e?Wa:ja,minutely:e=>e?cn:zn,fiveMinutely:e=>e?cn:zn,tenMinutely:e=>e?cn:zn,thirtyMinutely:e=>e?cn:zn,hourly:e=>e?cn:zn,twoHourly:e=>e?cn:zn,twelveHourly:()=>cn,daily:()=>E1},I1={secondly:()=>qa,tenSecondly:()=>qa,thirtySecondly:()=>qa,minutely:()=>He,fiveMinutely:()=>He,tenMinutely:()=>He,thirtyMinutely:()=>He,hourly:()=>He,twoHourly:()=>He,twelveHourly:()=>He,daily:()=>He};function Gu({tickValue:e,granularity:t,timezone:n,dayBoundaryCrossed:i=!1,tickMap:s,tooltipMap:o,defaultFormat:a}){const r=n||Intl.DateTimeFormat().resolvedOptions().timeZone;if(t==="weekly")return P1(e,r);if(s&&s[t]){const l=s[t](i);return Fi(e,r,l)}if(o&&o[t]){const l=o[t]();return Fi(e,r,l)}return Fi(e,r,a)}const Ga=({tickValue:e,granularity:t,dayBoundaryCrossed:n,timezone:i})=>Gu({tickValue:e,granularity:t,timezone:i,dayBoundaryCrossed:n,tickMap:R1,defaultFormat:"MMM dd, h:mm:ss a"}),Un=({tickValue:e,granularity:t,timezone:n})=>Gu({tickValue:e,granularity:t,timezone:n,tooltipMap:I1,defaultFormat:"MMM dd, yyyy h:mm:ss a"}),Xu=e=>e?.code==="ERR_CANCELED"||e?.name==="CanceledError"||e?.name==="AbortError",L1=e=>{const{i18n:t}=q.useI18n();return Xu(e)?{type:"canceled",message:t.t("query_errors.canceled.message")}:e?.status===403?{status:e.status,type:"forbidden",message:t.t("query_errors.forbidden.message"),details:t.t("query_errors.forbidden.details")}:e?.status===408||e?.message?.includes("timeout")?{status:e.status,type:"timeout",message:t.t("query_errors.timeout.message"),details:t.t("query_errors.timeout.details")}:e?.response?.data?.message==="Range not allowed for this tier"?{status:e.status,type:"range_exceeded",message:t.t("query_errors.time_range_exceeded.message"),details:t.t("query_errors.time_range_exceeded.details")}:{status:e.status,type:"other",message:t.t("query_errors.other.message"),details:e.response?.data?.invalid_parameters?.map(n=>n.reason).join(", ")||e?.message}},zi=e=>e.toLocaleLowerCase().endsWith("count"),N1=e=>{const t=e.toLocaleLowerCase();return["sum","count","cost","tokens"].some(n=>t.endsWith(n))},B1=(e,t)=>{if(!e.length)return NaN;const i=Math.min(100,Math.max(0,t))/100*(e.length-1),s=Math.floor(i),o=Math.ceil(i);return s===o?e[s]:e[s]+(e[o]-e[s])*(i-s)},F1=(e,t)=>{const n=e.filter(i=>Number.isFinite(i)).sort((i,s)=>i-s);return new Map(t.map(i=>[i,B1(n,i)]))},Ku=.7,Xa=(e,t)=>{const n=xs(e.trim());return n.valid?n.alpha(t).rgbString():e},Ka=e=>{const t=e??(typeof document>"u"?null:document.documentElement);if(typeof window>"u"||!t)return{medianLine:fl,outlier:ul,outlierBand:Xa(hl,Ku)};const n=window.getComputedStyle(t),i=(s,o)=>n.getPropertyValue(s).trim()||o;return{medianLine:i("--kui-color-text",fl),outlier:i("--kui-color-background-danger",ul),outlierBand:Xa(i("--kui-color-background-danger-weakest",hl),Ku)}},z1="empty",Zu=e=>{if(!e||!("meta"in e)||!("data"in e))return;const{display:t,metric_names:n,metric_units:i,start:s,end:o,truncated:a,limit:r,datasource:l}=e.meta;if(!n?.length){console.error("Cannot build scatter chart data from this explore result. Missing metric names.");return}const c=n.length>1?n[0]:void 0,u=c?n[1]:n[0],h=t&&Object.keys(t)[0]||void 0,f=e.data??[],m=[];for(const p of f){const g=Ju(p.timestamp,p.event[u],h?p.event[h]:void 0);if(g){if(c){const y=Qu(p.event[c]);if(y===void 0)continue;g.x=y}m.push(g)}}return{points:m,metric:u,metricUnit:i?.[u],...c?{xMetric:c,xMetricUnit:i?.[c]}:{},dimension:h,display:h?t?.[h]:void 0,start:s,end:o,truncated:a,limit:r,datasource:l}},Qu=e=>{if(e==null||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0},Ju=(e,t,n,i)=>{const s=new Date(e).valueOf(),o=Qu(t);if(!Number.isFinite(s)||o===void 0)return;const a=i?.length?{extras:i}:{};return n===void 0?{timestamp:s,value:o,...a}:{timestamp:s,value:o,group:n!==null&&n!==""?String(n):z1,...a}},U1=(e,t,n)=>{if(!n?.length)return;const i=[];for(const{field:s,label:o,unit:a}of n){const r=dn(e,s)??dn(t,s);r==null||r===""||i.push({label:o??s,value:r,...a?{unit:a}:{}})}return i.length?i:void 0},V1=(e,t)=>{if(!e||!("meta"in e))return;const{metric:n,dimension:i,unroll:s,display:o,extraFields:a,metricUnit:r}=t,l=t.timestamp??"request_start";if(!n){console.error("Cannot build scatter chart data from these request records. Missing metric.");return}const c=[];for(const u of e.results??[]){const h=dn(u,l);for(const f of H1(u,s)){const m=dn(f,n),p=i?dn(f,i)??dn(u,i):void 0,g=Ju(h,m,i?p??null:void 0,U1(f,u,a));g&&c.push(g)}}return{points:c,metric:n,metricUnit:r,dimension:i,display:o,start:e.meta?.time_range?.start,end:e.meta?.time_range?.end,truncated:e.truncated,limit:e.limit,datasource:"requests"}},H1=(e,t)=>{if(!t)return[e];const n=dn(e,t);return Array.isArray(n)?n:[]},dn=(e,t)=>{let n=e;for(const i of t.split(".")){if(n===null||typeof n!="object")return;n=n[i]}return n},$1=["hidden","single","full"],Y1=["donut","horizontal_bar","vertical_bar","timeseries_line","timeseries_bar","scatter"],W1=["gauge","top_n","single_value"],Za=e=>e===null||typeof e!="object"||!("points"in e)?!1:Array.isArray(e.points);var Nt=(e=>(e.Hidden="hidden",e.Bottom="bottom",e))(Nt||{});const th={modes:{point(e,t){return Ks(e,t,{intersect:!0})},nearest(e,t,n){return G1(e,t,n)},x(e,t,n){return Ks(e,t,{intersect:n.intersect,axis:"x"})},y(e,t,n){return Ks(e,t,{intersect:n.intersect,axis:"y"})}}};function Qa(e,t,n){return(th.modes[n.mode]||th.modes.nearest)(e,t,n)}function j1(e,t,n){return n!=="x"&&n!=="y"?e.inRange(t.x,t.y,"x",!0)||e.inRange(t.x,t.y,"y",!0):e.inRange(t.x,t.y,n,!0)}function q1(e,t,n){return n==="x"?{x:e.x,y:t.y}:n==="y"?{x:t.x,y:e.y}:t}function Ks(e,t,n){return e.filter(i=>n.intersect?i.inRange(t.x,t.y):j1(i,t,n.axis))}function G1(e,t,n){let i=Number.POSITIVE_INFINITY;return Ks(e,t,n).reduce((s,o)=>{const a=o.getCenterPoint(),r=q1(t,a,n.axis),l=On(t,r);return l<i?(s=[o],i=l):l===i&&s.push(o),s},[]).sort((s,o)=>s._index-o._index).slice(0,1)}function un(e,t,n){const i=Math.cos(n),s=Math.sin(n),o=t.x,a=t.y;return{x:o+i*(e.x-o)-s*(e.y-a),y:a+s*(e.x-o)+i*(e.y-a)}}const X1=(e,t)=>t>e||e.length>t.length&&e.slice(0,t.length)===t,hn=.001,Zs=(e,t,n)=>Math.min(n,Math.max(t,e)),eh=(e,t)=>e.value>=e.start-t&&e.value<=e.end+t;function K1(e,t,n){for(const i of Object.keys(e))e[i]=Zs(e[i],t,n);return e}function Z1(e,t,n,i){return!e||!t||n<=0?!1:Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)<=Math.pow(n+i,2)}function nh(e,{x:t,y:n,x2:i,y2:s},o,{borderWidth:a,hitTolerance:r}){const l=(a+r)/2,c=e.x>=t-l-hn&&e.x<=i+l+hn,u=e.y>=n-l-hn&&e.y<=s+l+hn;return o==="x"?c:(o==="y"||c)&&u}function ih(e,{rect:t,center:n},i,{rotation:s,borderWidth:o,hitTolerance:a}){const r=un(e,n,At(-s));return nh(r,t,i,{borderWidth:o,hitTolerance:a})}function fn(e,t){const{centerX:n,centerY:i}=e.getProps(["centerX","centerY"],t);return{x:n,y:i}}function Q1(e,t,n,i=!0){const s=n.split(".");let o=0;for(const a of t.split(".")){const r=s[o++];if(parseInt(a,10)<parseInt(r,10))break;if(X1(r,a)){if(i)throw new Error(`${e} v${n} is not supported. v${t} or newer is required.`);return!1}}return!0}const sh=e=>typeof e=="string"&&e.endsWith("%"),oh=e=>parseFloat(e)/100,ah=e=>Zs(oh(e),0,1),Ui=(e,t)=>({x:e,y:t,x2:e,y2:t,width:0,height:0}),J1={box:e=>Ui(e.centerX,e.centerY),doughnutLabel:e=>Ui(e.centerX,e.centerY),ellipse:e=>({centerX:e.centerX,centerY:e.centerX,radius:0,width:0,height:0}),label:e=>Ui(e.centerX,e.centerY),line:e=>Ui(e.x,e.y),point:e=>({centerX:e.centerX,centerY:e.centerY,radius:0,width:0,height:0}),polygon:e=>Ui(e.centerX,e.centerY)};function Ja(e,t){return t==="start"?0:t==="end"?e:sh(t)?ah(t)*e:e/2}function $e(e,t,n=!0){return typeof t=="number"?t:sh(t)?(n?ah(t):oh(t))*e:e}function tD(e,t){const{x:n,width:i}=e,s=t.textAlign;return s==="center"?n+i/2:s==="end"||s==="right"?n+i:n}function rh(e,t,{borderWidth:n,position:i,xAdjust:s,yAdjust:o},a){const r=nt(a),l=t.width+(r?a.width:0)+n,c=t.height+(r?a.height:0)+n,u=tr(i),h=uh(e.x,l,s,u.x),f=uh(e.y,c,o,u.y);return{x:h,y:f,x2:h+l,y2:f+c,width:l,height:c,centerX:h+l/2,centerY:f+c/2}}function tr(e,t="center"){return nt(e)?{x:Q(e.x,t),y:Q(e.y,t)}:(e=Q(e,t),{x:e,y:e})}const lh=(e,t)=>e&&e.autoFit&&t<1;function ch(e,t){const n=e.font,i=ct(n)?n:[n];return lh(e,t)?i.map(function(s){const o=xt(s);return o.size=Math.floor(s.size*t),o.lineHeight=s.lineHeight,xt(o)}):i.map(s=>xt(s))}function dh(e){return e&&(Xt(e.xValue)||Xt(e.yValue))}function uh(e,t,n=0,i){return e-Ja(t,i)+n}function Vn(e,t,n){const i=n.init;if(i){if(i===!0)return fh(t,n)}else return;return eD(e,t,n)}function hh(e,t,n){let i=!1;return t.forEach(s=>{Kt(e[s])?(i=!0,n[s]=e[s]):Xt(n[s])&&delete n[s]}),i}function fh(e,t){const n=t.type||"line";return J1[n](e)}function eD(e,t,n){const i=ft(n.init,[{chart:e,properties:t,options:n}]);if(i===!0)return fh(t,n);if(nt(i))return i}const er=new Map,nD=e=>isNaN(e)||e<=0,iD=e=>e.reduce(function(t,n){return t+=n.string,t},"");function Qs(e){if(e&&typeof e=="object"){const t=e.toString();return t==="[object HTMLImageElement]"||t==="[object HTMLCanvasElement]"}}function Js(e,{x:t,y:n},i){i&&(e.translate(t,n),e.rotate(At(i)),e.translate(-t,-n))}function Se(e,t){if(t&&t.borderWidth)return e.lineCap=t.borderCapStyle||"butt",e.setLineDash(t.borderDash),e.lineDashOffset=t.borderDashOffset,e.lineJoin=t.borderJoinStyle||"miter",e.lineWidth=t.borderWidth,e.strokeStyle=t.borderColor,!0}function Hn(e,t){e.shadowColor=t.backgroundShadowColor,e.shadowBlur=t.shadowBlur,e.shadowOffsetX=t.shadowOffsetX,e.shadowOffsetY=t.shadowOffsetY}function to(e,t){const n=t.content;if(Qs(n))return{width:$e(n.width,t.width),height:$e(n.height,t.height)};const i=ch(t),s=t.textStrokeWidth,o=ct(n)?n:[n],a=o.join()+iD(i)+s+(e._measureText?"-spriting":"");return er.has(a)||er.set(a,rD(e,o,i,s)),er.get(a)}function mh(e,t,n){const{x:i,y:s,width:o,height:a}=t;e.save(),Hn(e,n);const r=Se(e,n);e.fillStyle=n.backgroundColor,e.beginPath(),An(e,{x:i,y:s,w:o,h:a,radius:K1(Ne(n.borderRadius),0,Math.min(o,a)/2)}),e.closePath(),e.fill(),r&&(e.shadowColor=n.borderShadowColor,e.stroke()),e.restore()}function ph(e,t,n,i){const s=n.content;if(Qs(s)){e.save(),e.globalAlpha=dD(n.opacity,s.style.opacity),e.drawImage(s,t.x,t.y,t.width,t.height),e.restore();return}const o=ct(s)?s:[s],a=ch(n,i),r=n.color,l=ct(r)?r:[r],c=tD(t,n),u=t.y+n.textStrokeWidth/2;e.save(),e.textBaseline="middle",e.textAlign=n.textAlign,sD(e,n)&&lD(e,{x:c,y:u},o,a),cD(e,{x:c,y:u},o,{fonts:a,colors:l}),e.restore()}function sD(e,t){if(t.textStrokeWidth>0)return e.lineJoin="round",e.miterLimit=2,e.lineWidth=t.textStrokeWidth,e.strokeStyle=t.textStrokeColor,!0}function oD(e,t,n,i){const{radius:s,options:o}=t,a=o.pointStyle,r=o.rotation;let l=(r||0)*Xo;if(Qs(a)){e.save(),e.translate(n,i),e.rotate(l),e.drawImage(a,-a.width/2,-a.height/2,a.width,a.height),e.restore();return}nD(s)||aD(e,{x:n,y:i,radius:s,rotation:r,style:a,rad:l})}function aD(e,{x:t,y:n,radius:i,rotation:s,style:o,rad:a}){let r,l,c,u;switch(e.beginPath(),o){default:e.arc(t,n,i,0,gt),e.closePath();break;case"triangle":e.moveTo(t+Math.sin(a)*i,n-Math.cos(a)*i),a+=gs,e.lineTo(t+Math.sin(a)*i,n-Math.cos(a)*i),a+=gs,e.lineTo(t+Math.sin(a)*i,n-Math.cos(a)*i),e.closePath();break;case"rectRounded":u=i*.516,c=i-u,r=Math.cos(a+re)*c,l=Math.sin(a+re)*c,e.arc(t-r,n-l,u,a-tt,a-yt),e.arc(t+l,n-r,u,a-yt,a),e.arc(t+r,n+l,u,a,a+yt),e.arc(t-l,n+r,u,a+yt,a+tt),e.closePath();break;case"rect":if(!s){c=Math.SQRT1_2*i,e.rect(t-c,n-c,2*c,2*c);break}a+=re;case"rectRot":r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+l,n-r),e.lineTo(t+r,n+l),e.lineTo(t-l,n+r),e.closePath();break;case"crossRot":a+=re;case"cross":r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+r,n+l),e.moveTo(t+l,n-r),e.lineTo(t-l,n+r);break;case"star":r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+r,n+l),e.moveTo(t+l,n-r),e.lineTo(t-l,n+r),a+=re,r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+r,n+l),e.moveTo(t+l,n-r),e.lineTo(t-l,n+r);break;case"line":r=Math.cos(a)*i,l=Math.sin(a)*i,e.moveTo(t-r,n-l),e.lineTo(t+r,n+l);break;case"dash":e.moveTo(t,n),e.lineTo(t+Math.cos(a)*i,n+Math.sin(a)*i);break}e.fill()}function rD(e,t,n,i){e.save();const s=t.length;let o=0,a=i;for(let r=0;r<s;r++){const l=n[Math.min(r,n.length-1)];e.font=l.string;const c=t[r];o=Math.max(o,e.measureText(c).width+i),a+=l.lineHeight}return e.restore(),{width:o,height:a}}function lD(e,{x:t,y:n},i,s){e.beginPath();let o=0;i.forEach(function(a,r){const l=s[Math.min(r,s.length-1)],c=l.lineHeight;e.font=l.string,e.strokeText(a,t,n+c/2+o),o+=c}),e.stroke()}function cD(e,{x:t,y:n},i,{fonts:s,colors:o}){let a=0;i.forEach(function(r,l){const c=o[Math.min(l,o.length-1)],u=s[Math.min(l,s.length-1)],h=u.lineHeight;e.beginPath(),e.font=u.string,e.fillStyle=c,e.fillText(r,t,n+h/2+a),a+=h,e.fill()})}function dD(e,t){const n=Le(e)?e:t;return Le(n)?Zs(n,0,1):1}const gh=["left","bottom","top","right"];function uD(e,t){const{pointX:n,pointY:i,options:s}=t,o=s.callout,a=o&&o.display&&gD(t,o);if(!a||bD(t,o,a))return;if(e.save(),e.beginPath(),!Se(e,o))return e.restore();const{separatorStart:l,separatorEnd:c}=hD(t,a),{sideStart:u,sideEnd:h}=mD(t,a,l);(o.margin>0||s.borderWidth===0)&&(e.moveTo(l.x,l.y),e.lineTo(c.x,c.y)),e.moveTo(u.x,u.y),e.lineTo(h.x,h.y);const f=un({x:n,y:i},t.getCenterPoint(),At(-t.rotation));e.lineTo(f.x,f.y),e.stroke(),e.restore()}function hD(e,t){const{x:n,y:i,x2:s,y2:o}=e,a=fD(e,t);let r,l;return t==="left"||t==="right"?(r={x:n+a,y:i},l={x:r.x,y:o}):(r={x:n,y:i+a},l={x:s,y:r.y}),{separatorStart:r,separatorEnd:l}}function fD(e,t){const{width:n,height:i,options:s}=e,o=s.callout.margin+s.borderWidth/2;return t==="right"?n+o:t==="bottom"?i+o:-o}function mD(e,t,n){const{y:i,width:s,height:o,options:a}=e,r=a.callout.start,l=pD(t,a.callout);let c,u;return t==="left"||t==="right"?(c={x:n.x,y:i+$e(o,r)},u={x:c.x+l,y:c.y}):(c={x:n.x+$e(s,r),y:n.y},u={x:c.x,y:c.y+l}),{sideStart:c,sideEnd:u}}function pD(e,t){const n=t.side;return e==="left"||e==="top"?-n:n}function gD(e,t){const n=t.position;return gh.includes(n)?n:yD(e,t)}function yD(e,t){const{x:n,y:i,x2:s,y2:o,width:a,height:r,pointX:l,pointY:c,centerX:u,centerY:h,rotation:f}=e,m={x:u,y:h},p=t.start,g=$e(a,p),y=$e(r,p),_=[n,n+g,n+g,s],x=[i+y,o,i,o],T=[];for(let S=0;S<4;S++){const w=un({x:_[S],y:x[S]},m,At(f));T.push({position:gh[S],distance:On(w,{x:l,y:c})})}return T.sort((S,w)=>S.distance-w.distance)[0].position}function bD(e,t,n){const{pointX:i,pointY:s}=e,o=t.margin;let a=i,r=s;return n==="left"?a+=o:n==="right"?a-=o:n==="top"?r+=o:n==="bottom"&&(r-=o),e.inRange(a,r)}const yh={xScaleID:{min:"xMin",max:"xMax",start:"left",end:"right",startProp:"x",endProp:"x2"},yScaleID:{min:"yMin",max:"yMax",start:"bottom",end:"top",startProp:"y",endProp:"y2"}};function $n(e,t,n){return t=typeof t=="number"?t:e.parse(t),_t(t)?e.getPixelForValue(t):n}function mn(e,t,n){const i=t[n];if(i||n==="scaleID")return i;const s=n.charAt(0),o=Object.values(e).filter(a=>a.axis&&a.axis===s);return o.length?o[0].id:s}function bh(e,t){if(e){const n=e.options.reverse,i=$n(e,t.min,n?t.end:t.start),s=$n(e,t.max,n?t.start:t.end);return{start:i,end:s}}}function _h(e,t){const{chartArea:n,scales:i}=e,s=i[mn(i,t,"xScaleID")],o=i[mn(i,t,"yScaleID")];let a=n.width/2,r=n.height/2;return s&&(a=$n(s,t.xValue,s.left+s.width/2)),o&&(r=$n(o,t.yValue,o.top+o.height/2)),{x:a,y:r}}function nr(e,t){const n=e.scales,i=n[mn(n,t,"xScaleID")],s=n[mn(n,t,"yScaleID")];if(!i&&!s)return{};let{left:o,right:a}=i||e.chartArea,{top:r,bottom:l}=s||e.chartArea;const c=kh(i,{min:t.xMin,max:t.xMax,start:o,end:a});o=c.start,a=c.end;const u=kh(s,{min:t.yMin,max:t.yMax,start:l,end:r});return r=u.start,l=u.end,{x:o,y:r,x2:a,y2:l,width:a-o,height:l-r,centerX:o+(a-o)/2,centerY:r+(l-r)/2}}function xh(e,t){if(!dh(t)){const n=nr(e,t);let i=t.radius;(!i||isNaN(i))&&(i=Math.min(n.width,n.height)/2,t.radius=i);const s=i*2,o=n.centerX+t.xAdjust,a=n.centerY+t.yAdjust;return{x:o-i,y:a-i,x2:o+i,y2:a+i,centerX:o,centerY:a,width:s,height:s,radius:i}}return xD(e,t)}function _D(e,t){const{scales:n,chartArea:i}=e,s=n[t.scaleID],o={x:i.left,y:i.top,x2:i.right,y2:i.bottom};return s?wD(s,o,t):kD(n,o,t),o}function wh(e,t){const n=nr(e,t);return n.initProperties=Vn(e,n,t),n.elements=[{type:"label",optionScope:"label",properties:SD(e,n,t),initProperties:n.initProperties}],n}function xD(e,t){const n=_h(e,t),i=t.radius*2;return{x:n.x-t.radius+t.xAdjust,y:n.y-t.radius+t.yAdjust,x2:n.x+t.radius+t.xAdjust,y2:n.y+t.radius+t.yAdjust,centerX:n.x+t.xAdjust,centerY:n.y+t.yAdjust,radius:t.radius,width:i,height:i}}function kh(e,t){const n=bh(e,t)||t;return{start:Math.min(n.start,n.end),end:Math.max(n.start,n.end)}}function wD(e,t,n){const i=$n(e,n.value,NaN),s=$n(e,n.endValue,i);e.isHorizontal()?(t.x=i,t.x2=s):(t.y=i,t.y2=s)}function kD(e,t,n){for(const i of Object.keys(yh)){const s=e[mn(e,n,i)];if(s){const{min:o,max:a,start:r,end:l,startProp:c,endProp:u}=yh[i],h=bh(s,{min:n[o],max:n[a],start:s[r],end:s[l]});t[c]=h.start,t[u]=h.end}}}function TD({properties:e,options:t},n,i,s){const{x:o,x2:a,width:r}=e;return Th({start:o,end:a,borderWidth:t.borderWidth},{position:i.x,padding:{start:s.left,end:s.right},adjust:t.label.xAdjust,size:n.width})}function vD({properties:e,options:t},n,i,s){const{y:o,y2:a,height:r}=e;return Th({start:o,end:a,borderWidth:t.borderWidth},{position:i.y,padding:{start:s.top,end:s.bottom},adjust:t.label.yAdjust,size:n.height})}function Th(e,t){const{start:n,end:i,borderWidth:s}=e,{position:o,padding:{start:a,end:r},adjust:l}=t,c=i-s-n-a-r-t.size;return n+s/2+l+Ja(c,o)}function SD(e,t,n){const i=n.label;i.backgroundColor="transparent",i.callout.display=!1;const s=tr(i.position),o=Pt(i.padding),a=to(e.ctx,i),r=TD({properties:t,options:n},a,s,o),l=vD({properties:t,options:n},a,s,o),c=a.width+o.width,u=a.height+o.height;return{x:r,y:l,x2:r+c,y2:l+u,width:c,height:u,centerX:r+c/2,centerY:l+u/2,rotation:i.rotation}}const ir=["enter","leave"],sr=ir.concat("click");function MD(e,t,n){t.listened=hh(n,sr,t.listeners),t.moveListened=!1,ir.forEach(i=>{Kt(n[i])&&(t.moveListened=!0)}),(!t.listened||!t.moveListened)&&t.annotations.forEach(i=>{!t.listened&&Kt(i.click)&&(t.listened=!0),t.moveListened||ir.forEach(s=>{Kt(i[s])&&(t.listened=!0,t.moveListened=!0)})})}function DD(e,t,n){if(e.listened)switch(t.type){case"mousemove":case"mouseout":return CD(e,t,n);case"click":return OD(e,t,n)}}function CD(e,t,n){if(!e.moveListened)return;let i;t.type==="mousemove"?i=Qa(e.visibleElements,t,n.interaction):i=[];const s=e.hovered;e.hovered=i;const o={state:e,event:t};let a=vh(o,"leave",s,i);return vh(o,"enter",i,s)||a}function vh({state:e,event:t},n,i,s){let o;for(const a of i)s.indexOf(a)<0&&(o=Sh(a.options[n]||e.listeners[n],a,t)||o);return o}function OD(e,t,n){const i=e.listeners,s=Qa(e.visibleElements,t,n.interaction);let o;for(const a of s)o=Sh(a.options.click||i.click,a,t)||o;return o}function Sh(e,t,n){return ft(e,[t.$context,n])===!0}const eo=["afterDraw","beforeDraw"];function AD(e,t,n){const i=t.visibleElements;t.hooked=hh(n,eo,t.hooks),t.hooked||i.forEach(s=>{t.hooked||eo.forEach(o=>{Kt(s.options[o])&&(t.hooked=!0)})})}function Mh(e,t,n){if(e.hooked){const i=t.options[n]||e.hooks[n];return ft(i,[t.$context])}}function PD(e,t,n){const i=ND(e.scales,t,n);let s=Dh(t,i,"min","suggestedMin");s=Dh(t,i,"max","suggestedMax")||s,s&&Kt(t.handleTickRangeOptions)&&t.handleTickRangeOptions()}function ED(e,t){for(const n of e)ID(n,t)}function Dh(e,t,n,i){if(_t(t[n])&&!RD(e.options,n,i)){const s=e[n]!==t[n];return e[n]=t[n],s}}function RD(e,t,n){return Xt(e[t])||Xt(e[n])}function ID(e,t){for(const n of["scaleID","xScaleID","yScaleID"]){const i=mn(t,e,n);i&&!t[i]&&LD(e,n)&&console.warn(`No scale found with id '${i}' for annotation '${e.id}'`)}}function LD(e,t){if(t==="scaleID")return!0;const n=t.charAt(0);for(const i of["Min","Max","Value"])if(Xt(e[n+i]))return!0;return!1}function ND(e,t,n){const i=t.axis,s=t.id,o=i+"ScaleID",a={min:Q(t.min,Number.NEGATIVE_INFINITY),max:Q(t.max,Number.POSITIVE_INFINITY)};for(const r of n)r.scaleID===s?Ch(r,t,["value","endValue"],a):mn(e,r,o)===s&&Ch(r,t,[i+"Min",i+"Max",i+"Value"],a);return a}function Ch(e,t,n,i){for(const s of n){const o=e[s];if(Xt(o)){const a=t.parse(o);i.min=Math.min(i.min,a),i.max=Math.max(i.max,a)}}}class Yn extends $t{inRange(t,n,i,s){const{x:o,y:a}=un({x:t,y:n},this.getCenterPoint(s),At(-this.options.rotation));return nh({x:o,y:a},this.getProps(["x","y","x2","y2"],s),i,this.options)}getCenterPoint(t){return fn(this,t)}draw(t){t.save(),Js(t,this.getCenterPoint(),this.options.rotation),mh(t,this,this.options),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,n){return wh(t,n)}}Yn.id="boxAnnotation",Yn.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,hitTolerance:0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:!1},color:"black",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},Yn.defaultRoutes={borderColor:"color",backgroundColor:"color"},Yn.descriptors={label:{_fallback:!0}};class no extends $t{inRange(t,n,i,s){return ih({x:t,y:n},{rect:this.getProps(["x","y","x2","y2"],s),center:this.getCenterPoint(s)},i,{rotation:this.rotation,borderWidth:0,hitTolerance:this.options.hitTolerance})}getCenterPoint(t){return fn(this,t)}draw(t){const n=this.options;!n.display||!n.content||(HD(t,this),t.save(),Js(t,this.getCenterPoint(),this.rotation),ph(t,this,n,this._fitRatio),t.restore())}resolveElementProperties(t,n){const i=BD(t,n);if(!i)return{};const{controllerMeta:s,point:o,radius:a}=zD(t,n,i);let r=to(t.ctx,n);const l=UD(r,a);lh(n,l)&&(r={width:r.width*l,height:r.height*l});const{position:c,xAdjust:u,yAdjust:h}=n,f=rh(o,r,{borderWidth:0,position:c,xAdjust:u,yAdjust:h});return{initProperties:Vn(t,f,n),...f,...s,rotation:n.rotation,_fitRatio:l}}}no.id="doughnutLabelAnnotation",no.defaults={autoFit:!0,autoHide:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderColor:"transparent",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:0,color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,spacing:1,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0},no.defaultRoutes={};function BD(e,t){return e.getSortedVisibleDatasetMetas().reduce(function(n,i){const s=i.controller;return s instanceof Ti&&FD(e,t,i.data)&&(!n||s.innerRadius<n.controller.innerRadius)&&s.options.circumference>=90?i:n},void 0)}function FD(e,t,n){if(!t.autoHide)return!0;for(let i=0;i<n.length;i++)if(!n[i].hidden&&e.getDataVisibility(i))return!0}function zD({chartArea:e},t,n){const{left:i,top:s,right:o,bottom:a}=e,{innerRadius:r,offsetX:l,offsetY:c}=n.controller,u=(i+o)/2+l,h=(s+a)/2+c,f={left:Math.max(u-r,i),right:Math.min(u+r,o),top:Math.max(h-r,s),bottom:Math.min(h+r,a)},m={x:(f.left+f.right)/2,y:(f.top+f.bottom)/2},p=t.spacing+t.borderWidth/2,g=r-p,y=m.y>h,_=y?s+p:a-p,x=VD(_,u,h,g);return{controllerMeta:{_centerX:u,_centerY:h,_radius:g,_counterclockwise:y,...x},point:m,radius:Math.min(r,Math.min(f.right-f.left,f.bottom-f.top)/2)}}function UD({width:e,height:t},n){const i=Math.sqrt(Math.pow(e,2)+Math.pow(t,2));return n*2/i}function VD(e,t,n,i){const s=Math.pow(n-e,2),o=Math.pow(i,2),a=t*-2,r=Math.pow(t,2)+s-o,l=Math.pow(a,2)-4*r;if(l<=0)return{_startAngle:0,_endAngle:gt};const c=(-a-Math.sqrt(l))/2,u=(-a+Math.sqrt(l))/2;return{_startAngle:bs({x:t,y:n},{x:c,y:e}).angle,_endAngle:bs({x:t,y:n},{x:u,y:e}).angle}}function HD(e,t){const{_centerX:n,_centerY:i,_radius:s,_startAngle:o,_endAngle:a,_counterclockwise:r,options:l}=t;e.save();const c=Se(e,l);e.fillStyle=l.backgroundColor,e.beginPath(),e.arc(n,i,s,o,a,r),e.closePath(),e.fill(),c&&e.stroke(),e.restore()}class Vi extends $t{inRange(t,n,i,s){return ih({x:t,y:n},{rect:this.getProps(["x","y","x2","y2"],s),center:this.getCenterPoint(s)},i,{rotation:this.rotation,borderWidth:this.options.borderWidth,hitTolerance:this.options.hitTolerance})}getCenterPoint(t){return fn(this,t)}draw(t){const n=this.options,i=!Xt(this._visible)||this._visible;!n.display||!n.content||!i||(t.save(),Js(t,this.getCenterPoint(),this.rotation),uD(t,this),mh(t,this,n),ph(t,$D(this),n),t.restore())}resolveElementProperties(t,n){let i;if(dh(n))i=_h(t,n);else{const{centerX:r,centerY:l}=nr(t,n);i={x:r,y:l}}const s=Pt(n.padding),o=to(t.ctx,n),a=rh(i,o,n,s);return{initProperties:Vn(t,a,n),pointX:i.x,pointY:i.y,...a,rotation:n.rotation}}}Vi.id="labelAnnotation",Vi.defaults={adjustScaleRange:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:0,callout:{borderCapStyle:"butt",borderColor:void 0,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:1,display:!1,margin:5,position:"auto",side:5,start:"50%"},color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},Vi.defaultRoutes={borderColor:"color"};function $D({x:e,y:t,width:n,height:i,options:s}){const o=s.borderWidth/2,a=Pt(s.padding);return{x:e+a.left+o,y:t+a.top+o,width:n-a.left-a.right-s.borderWidth,height:i-a.top-a.bottom-s.borderWidth}}const or=(e,t,n)=>({x:e.x+n*(t.x-e.x),y:e.y+n*(t.y-e.y)}),ar=(e,t,n)=>or(t,n,Math.abs((e-t.y)/(n.y-t.y))).x,Oh=(e,t,n)=>or(t,n,Math.abs((e-t.x)/(n.x-t.x))).y,Hi=e=>e*e,YD=(e,t,{x:n,y:i,x2:s,y2:o},a)=>a==="y"?{start:Math.min(i,o),end:Math.max(i,o),value:t}:{start:Math.min(n,s),end:Math.max(n,s),value:e},Ah=(e,t,n,i)=>(1-i)*(1-i)*e+2*(1-i)*i*t+i*i*n,rr=(e,t,n,i)=>({x:Ah(e.x,t.x,n.x,i),y:Ah(e.y,t.y,n.y,i)}),Ph=(e,t,n,i)=>2*(1-i)*(t-e)+2*i*(n-t),Eh=(e,t,n,i)=>-Math.atan2(Ph(e.x,t.x,n.x,i),Ph(e.y,t.y,n.y,i))+.5*tt;class $i extends $t{inRange(t,n,i,s){const o=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y"){const a={mouseX:t,mouseY:n},{path:r,ctx:l}=this;if(r){Se(l,this.options),l.lineWidth+=this.options.hitTolerance;const{chart:u}=this.$context,h=t*u.currentDevicePixelRatio,f=n*u.currentDevicePixelRatio,m=l.isPointInStroke(r,h,f)||lr(this,a,s);return l.restore(),m}const c=Hi(o);return GD(this,a,c,s)||lr(this,a,s)}return WD(this,{mouseX:t,mouseY:n},i,{hitSize:o,useFinalPosition:s})}getCenterPoint(t){return fn(this,t)}draw(t){const{x:n,y:i,x2:s,y2:o,cp:a,options:r}=this;if(t.save(),!Se(t,r))return t.restore();Hn(t,r);const l=Math.sqrt(Math.pow(s-n,2)+Math.pow(o-i,2));if(r.curve&&a)return nC(t,this,a,l),t.restore();const{startOpts:c,endOpts:u,startAdjust:h,endAdjust:f}=Bh(this),m=Math.atan2(o-i,s-n);t.translate(n,i),t.rotate(m),t.beginPath(),t.moveTo(0+h,0),t.lineTo(l-f,0),t.shadowColor=r.borderShadowColor,t.stroke(),cr(t,0,h,c),cr(t,l,-f,u),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,n){const i=_D(t,n),{x:s,y:o,x2:a,y2:r}=i,l=jD(i,t.chartArea),c=l?qD({x:s,y:o},{x:a,y:r},t.chartArea):{x:s,y:o,x2:a,y2:r,width:Math.abs(a-s),height:Math.abs(r-o)};if(c.centerX=(a+s)/2,c.centerY=(r+o)/2,c.initProperties=Vn(t,c,n),n.curve){const h={x:c.x,y:c.y},f={x:c.x2,y:c.y2};c.cp=eC(c,n,On(h,f))}const u=XD(t,c,n.label);return u._visible=l,c.elements=[{type:"label",optionScope:"label",properties:u,initProperties:c.initProperties}],c}}$i.id="lineAnnotation";const Rh={backgroundColor:void 0,backgroundShadowColor:void 0,borderColor:void 0,borderDash:void 0,borderDashOffset:void 0,borderShadowColor:void 0,borderWidth:void 0,display:void 0,fill:void 0,length:void 0,shadowBlur:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,width:void 0};$i.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},Rh),fill:!1,length:12,start:Object.assign({},Rh),width:6},borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:2,curve:!1,controlPoint:{y:"-50%"},display:!0,endValue:void 0,init:void 0,hitTolerance:0,label:{backgroundColor:"rgba(0,0,0,0.8)",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderColor:"black",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:6,borderShadowColor:"transparent",borderWidth:0,callout:Object.assign({},Vi.defaults.callout),color:"#fff",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},scaleID:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,value:void 0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},$i.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}},$i.defaultRoutes={borderColor:"color"};function WD(e,{mouseX:t,mouseY:n},i,{hitSize:s,useFinalPosition:o}){const a=YD(t,n,e.getProps(["x","y","x2","y2"],o),i);return eh(a,s)||lr(e,{mouseX:t,mouseY:n},o,i)}function jD({x:e,y:t,x2:n,y2:i},{top:s,right:o,bottom:a,left:r}){return!(e<r&&n<r||e>o&&n>o||t<s&&i<s||t>a&&i>a)}function Ih({x:e,y:t},n,{top:i,right:s,bottom:o,left:a}){return e<a&&(t=Oh(a,{x:e,y:t},n),e=a),e>s&&(t=Oh(s,{x:e,y:t},n),e=s),t<i&&(e=ar(i,{x:e,y:t},n),t=i),t>o&&(e=ar(o,{x:e,y:t},n),t=o),{x:e,y:t}}function qD(e,t,n){const{x:i,y:s}=Ih(e,t,n),{x:o,y:a}=Ih(t,e,n);return{x:i,y:s,x2:o,y2:a,width:Math.abs(o-i),height:Math.abs(a-s)}}function GD(e,{mouseX:t,mouseY:n},i=hn,s){const{x:o,y:a,x2:r,y2:l}=e.getProps(["x","y","x2","y2"],s),c=r-o,u=l-a,h=Hi(c)+Hi(u),f=h===0?-1:((t-o)*c+(n-a)*u)/h;let m,p;return f<0?(m=o,p=a):f>1?(m=r,p=l):(m=o+f*c,p=a+f*u),Hi(t-m)+Hi(n-p)<=i}function lr(e,{mouseX:t,mouseY:n},i,s){const o=e.label;return o.options.display&&o.inRange(t,n,s,i)}function XD(e,t,n){const i=n.borderWidth,s=Pt(n.padding),o=to(e.ctx,n),a=o.width+s.width+i,r=o.height+s.height+i;return ZD(t,n,{width:a,height:r,padding:s},e.chartArea)}function KD(e){const{x:t,y:n,x2:i,y2:s}=e,o=Math.atan2(s-n,i-t);return o>tt/2?o-tt:o<tt/-2?o+tt:o}function ZD(e,t,n,i){const{width:s,height:o,padding:a}=n,{xAdjust:r,yAdjust:l}=t,c={x:e.x,y:e.y},u={x:e.x2,y:e.y2},h=t.rotation==="auto"?KD(e):At(t.rotation),f=QD(s,o,h),m=JD(e,t,{labelSize:f,padding:a},i),p=e.cp?rr(c,e.cp,u,m):or(c,u,m),g={size:f.w,min:i.left,max:i.right,padding:a.left},y={size:f.h,min:i.top,max:i.bottom,padding:a.top},_=Nh(p.x,g)+r,x=Nh(p.y,y)+l;return{x:_-s/2,y:x-o/2,x2:_+s/2,y2:x+o/2,centerX:_,centerY:x,pointX:p.x,pointY:p.y,width:s,height:o,rotation:ys(h)}}function QD(e,t,n){const i=Math.cos(n),s=Math.sin(n);return{w:Math.abs(e*i)+Math.abs(t*s),h:Math.abs(e*s)+Math.abs(t*i)}}function JD(e,t,n,i){let s;const o=tC(e,i);return t.position==="start"?s=Lh({w:e.x2-e.x,h:e.y2-e.y},n,t,o):t.position==="end"?s=1-Lh({w:e.x-e.x2,h:e.y-e.y2},n,t,o):s=Ja(1,t.position),s}function Lh(e,t,n,i){const{labelSize:s,padding:o}=t,a=e.w*i.dx,r=e.h*i.dy,l=a>0&&(s.w/2+o.left-i.x)/a,c=r>0&&(s.h/2+o.top-i.y)/r;return Zs(Math.max(l,c),0,.25)}function tC(e,t){const{x:n,x2:i,y:s,y2:o}=e,a=Math.min(s,o)-t.top,r=Math.min(n,i)-t.left,l=t.bottom-Math.max(s,o),c=t.right-Math.max(n,i);return{x:Math.min(r,c),y:Math.min(a,l),dx:r<=c?1:-1,dy:a<=l?1:-1}}function Nh(e,t){const{size:n,min:i,max:s,padding:o}=t,a=n/2;return n>s-i?(s+i)/2:(i>=e-o-a&&(e=i+o+a),s<=e+o+a&&(e=s-o-a),e)}function Bh(e){const t=e.options,n=t.arrowHeads&&t.arrowHeads.start,i=t.arrowHeads&&t.arrowHeads.end;return{startOpts:n,endOpts:i,startAdjust:Fh(e,n),endAdjust:Fh(e,i)}}function Fh(e,t){if(!t||!t.display)return 0;const{length:n,width:i}=t,s=e.options.borderWidth/2,o={x:n,y:i+s};return Math.abs(ar(0,o,{x:0,y:s}))}function cr(e,t,n,i){if(!i||!i.display)return;const{length:s,width:o,fill:a,backgroundColor:r,borderColor:l}=i,c=Math.abs(t-s)+n;e.beginPath(),Hn(e,i),Se(e,i),e.moveTo(c,-o),e.lineTo(t+n,0),e.lineTo(c,o),a===!0?(e.fillStyle=r||l,e.closePath(),e.fill(),e.shadowColor="transparent"):e.shadowColor=i.borderShadowColor,e.stroke()}function eC(e,t,n){const{x:i,y:s,x2:o,y2:a,centerX:r,centerY:l}=e,c=Math.atan2(a-s,o-i),u=tr(t.controlPoint,0),h={x:r+$e(n,u.x,!1),y:l+$e(n,u.y,!1)};return un(h,{x:r,y:l},c)}function zh(e,{x:t,y:n},{angle:i,adjust:s},o){!o||!o.display||(e.save(),e.translate(t,n),e.rotate(i),cr(e,0,-s,o),e.restore())}function nC(e,t,n,i){const{x:s,y:o,x2:a,y2:r,options:l}=t,{startOpts:c,endOpts:u,startAdjust:h,endAdjust:f}=Bh(t),m={x:s,y:o},p={x:a,y:r},g=Eh(m,n,p,0),y=Eh(m,n,p,1)-tt,_=rr(m,n,p,h/i),x=rr(m,n,p,1-f/i),T=new Path2D;e.beginPath(),T.moveTo(_.x,_.y),T.quadraticCurveTo(n.x,n.y,x.x,x.y),e.shadowColor=l.borderShadowColor,e.stroke(T),t.path=T,t.ctx=e,zh(e,_,{angle:g,adjust:h},c),zh(e,x,{angle:y,adjust:f},u)}class Yi extends $t{inRange(t,n,i,s){const o=this.options.rotation,a=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y")return iC({x:t,y:n},this.getProps(["width","height","centerX","centerY"],s),o,a);const{x:r,y:l,x2:c,y2:u}=this.getProps(["x","y","x2","y2"],s),h=i==="y"?{start:l,end:u}:{start:r,end:c},f=un({x:t,y:n},this.getCenterPoint(s),At(-o));return f[i]>=h.start-a-hn&&f[i]<=h.end+a+hn}getCenterPoint(t){return fn(this,t)}draw(t){const{width:n,height:i,centerX:s,centerY:o,options:a}=this;t.save(),Js(t,this.getCenterPoint(),a.rotation),Hn(t,this.options),t.beginPath(),t.fillStyle=a.backgroundColor;const r=Se(t,a);t.ellipse(s,o,i/2,n/2,tt/2,0,2*tt),t.fill(),r&&(t.shadowColor=a.borderShadowColor,t.stroke()),t.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(t,n){return wh(t,n)}}Yi.id="ellipseAnnotation",Yi.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,label:Object.assign({},Yn.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},Yi.defaultRoutes={borderColor:"color",backgroundColor:"color"},Yi.descriptors={label:{_fallback:!0}};function iC(e,t,n,i){const{width:s,height:o,centerX:a,centerY:r}=t,l=s/2,c=o/2;if(l<=0||c<=0)return!1;const u=At(n||0),h=Math.cos(u),f=Math.sin(u),m=Math.pow(h*(e.x-a)+f*(e.y-r),2),p=Math.pow(f*(e.x-a)-h*(e.y-r),2);return m/Math.pow(l+i,2)+p/Math.pow(c+i,2)<=1.0001}class io extends $t{inRange(t,n,i,s){const{x:o,y:a,x2:r,y2:l,width:c}=this.getProps(["x","y","x2","y2","width"],s),u=(this.options.borderWidth+this.options.hitTolerance)/2;return i!=="x"&&i!=="y"?Z1({x:t,y:n},this.getCenterPoint(s),c/2,u):eh(i==="y"?{start:a,end:l,value:n}:{start:o,end:r,value:t},u)}getCenterPoint(t){return fn(this,t)}draw(t){const n=this.options,i=n.borderWidth;if(n.radius<.1)return;t.save(),t.fillStyle=n.backgroundColor,Hn(t,n);const s=Se(t,n);oD(t,this,this.centerX,this.centerY),s&&!Qs(n.pointStyle)&&(t.shadowColor=n.borderShadowColor,t.stroke()),t.restore(),n.borderWidth=i}resolveElementProperties(t,n){const i=xh(t,n);return i.initProperties=Vn(t,i,n),i}}io.id="pointAnnotation",io.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},io.defaultRoutes={borderColor:"color",backgroundColor:"color"};class so extends $t{inRange(t,n,i,s){if(i!=="x"&&i!=="y")return this.options.radius>=.1&&this.elements.length>1&&oC(this.elements,t,n,s);const o=un({x:t,y:n},this.getCenterPoint(s),At(-this.options.rotation)),a=this.elements.map(c=>i==="y"?c.bY:c.bX),r=Math.min(...a),l=Math.max(...a);return o[i]>=r&&o[i]<=l}getCenterPoint(t){return fn(this,t)}draw(t){const{elements:n,options:i}=this;t.save(),t.beginPath(),t.fillStyle=i.backgroundColor,Hn(t,i);const s=Se(t,i);let o=!0;for(const a of n)o?(t.moveTo(a.x,a.y),o=!1):t.lineTo(a.x,a.y);t.closePath(),t.fill(),s&&(t.shadowColor=i.borderShadowColor,t.stroke()),t.restore()}resolveElementProperties(t,n){const i=xh(t,n),{sides:s,rotation:o}=n,a=[],r=2*tt/s;let l=o*Xo;for(let c=0;c<s;c++,l+=r){const u=sC(i,n,l);u.initProperties=Vn(t,i,n),a.push(u)}return i.elements=a,i}}so.id="polygonAnnotation",so.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,point:{radius:0},radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,sides:3,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},so.defaultRoutes={borderColor:"color",backgroundColor:"color"};function sC({centerX:e,centerY:t},{radius:n,borderWidth:i,hitTolerance:s},o){const a=(i+s)/2,r=Math.sin(o),l=Math.cos(o),c={x:e+r*n,y:t-l*n};return{type:"point",optionScope:"point",properties:{x:c.x,y:c.y,centerX:c.x,centerY:c.y,bX:e+r*(n+a),bY:t-l*(n+a)}}}function oC(e,t,n,i){let s=!1,o=e[e.length-1].getProps(["bX","bY"],i);for(const a of e){const r=a.getProps(["bX","bY"],i);r.bY>n!=o.bY>n&&t<(o.bX-r.bX)*(n-r.bY)/(o.bY-r.bY)+r.bX&&(s=!s),o=r}return s}const Ye={box:Yn,doughnutLabel:no,ellipse:Yi,label:Vi,line:$i,point:io,polygon:so};Object.keys(Ye).forEach(e=>{bt.describe(`elements.${Ye[e].id}`,{_fallback:"plugins.annotation.common"})});const aC={update:Object.assign},rC=sr.concat(eo),Uh=(e,t)=>nt(t)?hr(e,t):e,dr=e=>e==="color"||e==="font";function ur(e="line"){return Ye[e]?e:(console.warn(`Unknown annotation type: '${e}', defaulting to 'line'`),"line")}function lC(e,t,n,i){const s=dC(e,n.animations,i),o=t.annotations,a=fC(t.elements,o);for(let r=0;r<o.length;r++){const l=o[r],c=Vh(a,r,l.type),u=l.setContext(hC(e,c,a,l)),h=c.resolveElementProperties(e,u);h.skip=cC(h),"elements"in h&&(uC(c,h.elements,u,s),delete h.elements),Xt(c.x)||Object.assign(c,h),Object.assign(c,h.initProperties),h.options=Hh(u),s.update(c,h)}}function cC(e){return isNaN(e.x)||isNaN(e.y)}function dC(e,t,n){return n==="reset"||n==="none"||n==="resize"?aC:new ca(e,t)}function uC(e,t,n,i){const s=e.elements||(e.elements=[]);s.length=t.length;for(let o=0;o<t.length;o++){const a=t[o],r=a.properties,l=Vh(s,o,a.type,a.initProperties),c=n[a.optionScope].override(a);r.options=Hh(c),i.update(l,r)}}function Vh(e,t,n,i){const s=Ye[ur(n)];let o=e[t];return(!o||!(o instanceof s))&&(o=e[t]=new s,Object.assign(o,i)),o}function Hh(e){const t=Ye[ur(e.type)],n={};n.id=e.id,n.type=e.type,n.drawTime=e.drawTime,Object.assign(n,hr(e,t.defaults),hr(e,t.defaultRoutes));for(const i of rC)n[i]=e[i];return n}function hr(e,t){const n={};for(const i of Object.keys(t)){const s=t[i],o=e[i];dr(i)&&ct(o)?n[i]=o.map(a=>Uh(a,s)):n[i]=Uh(o,s)}return n}function hC(e,t,n,i){return t.$context||(t.$context=Object.assign(Object.create(e.getContext()),{element:t,get elements(){return n.filter(s=>s&&s.options)},id:i.id,type:"annotation"}))}function fC(e,t){const n=t.length,i=e.length;if(i<n){const s=n-i;e.splice(i,0,...new Array(s))}else i>n&&e.splice(n,i-n);return e}var mC="3.1.0";const We=new Map,$h=e=>e.type!=="doughnutLabel",pC=sr.concat(eo);var Yh={id:"annotation",version:mC,beforeRegister(){Q1("chart.js","4.0",Zt.version)},afterRegister(){Zt.register(Ye)},afterUnregister(){Zt.unregister(Ye)},beforeInit(e){We.set(e,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(e,t,n){const i=We.get(e),s=i.annotations=[];let o=n.annotations;nt(o)?Object.keys(o).forEach(a=>{const r=o[a];nt(r)&&(r.id=a,s.push(r))}):ct(o)&&s.push(...o),ED(s.filter($h),e.scales)},afterDataLimits(e,t){const n=We.get(e);PD(e,t.scale,n.annotations.filter($h).filter(i=>i.display&&i.adjustScaleRange))},afterUpdate(e,t,n){const i=We.get(e);MD(e,i,n),lC(e,i,n,t.mode),i.visibleElements=i.elements.filter(s=>!s.skip&&s.options.display),AD(e,i,n)},beforeDatasetsDraw(e,t,n){Wi(e,"beforeDatasetsDraw",n.clip)},afterDatasetsDraw(e,t,n){Wi(e,"afterDatasetsDraw",n.clip)},beforeDatasetDraw(e,t,n){Wi(e,t.index,n.clip)},beforeDraw(e,t,n){Wi(e,"beforeDraw",n.clip)},afterDraw(e,t,n){Wi(e,"afterDraw",n.clip)},beforeEvent(e,t,n){const i=We.get(e);DD(i,t.event,n)&&(t.changed=!0)},afterDestroy(e){We.delete(e)},getAnnotations(e){const t=We.get(e);return t?t.elements:[]},_getAnnotationElementsAtEventForMode(e,t,n){return Qa(e,t,n)},defaults:{animations:{numbers:{properties:["x","y","x2","y2","width","height","centerX","centerY","pointX","pointY","radius"],type:"number"},colors:{properties:["backgroundColor","borderColor"],type:"color"}},clip:!0,interaction:{mode:void 0,axis:void 0,intersect:void 0},common:{drawTime:"afterDatasetsDraw",init:!1,label:{}}},descriptors:{_indexable:!1,_scriptable:e=>!pC.includes(e)&&e!=="init",annotations:{_allKeys:!1,_fallback:(e,t)=>`elements.${Ye[ur(t.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:dr,_fallback:!0},_indexable:dr}},additionalOptionScopes:[""]};function Wi(e,t,n){const{ctx:i,chartArea:s}=e,o=We.get(e);n&&_i(i,s);const a=gC(o.visibleElements,t).sort((r,l)=>r.element.options.z-l.element.options.z);for(const r of a)yC(i,s,o,r);n&&xi(i)}function gC(e,t){const n=[];for(const i of e)if(i.options.drawTime===t&&n.push({element:i,main:!0}),i.elements&&i.elements.length)for(const s of i.elements)s.options.display&&s.options.drawTime===t&&n.push({element:s});return n}function yC(e,t,n,i){const s=i.element;i.main?(Mh(n,s,"beforeDraw"),s.draw(e,t),Mh(n,s,"afterDraw")):s.draw(e,t)}const bC={class:"zoom-timerange-container"},_C={class:"zoom-timerange-details"},xC={class:"label","data-testid":"zoom-timerange-from"},wC={class:"label","data-testid":"zoom-timerange-to"},kC=d.defineComponent({__name:"ZoomTimerange",props:{start:{},end:{},granularity:{}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=d.ref(Un({tickValue:t.start,granularity:t.granularity})),s=d.ref(Un({tickValue:t.end,granularity:t.granularity})),o=(a,r)=>{Ou(()=>{i.value=Un({tickValue:a,granularity:t.granularity}),s.value=Un({tickValue:r,granularity:t.granularity})},100)()};return d.watch(()=>[t.start,t.end],([a,r])=>{o(a,r)},{immediate:!0}),(a,r)=>(d.openBlock(),d.createElementBlock("div",bC,[d.createElementVNode("div",_C,[d.createElementVNode("div",xC,d.toDisplayString(d.unref(n).t("zoom_time_range.from")),1),d.createElementVNode("div",null,d.toDisplayString(i.value),1),d.createElementVNode("div",wC,d.toDisplayString(d.unref(n).t("zoom_time_range.to")),1),d.createElementVNode("div",null,d.toDisplayString(s.value),1)])]))}}),Et=(e,t)=>{const n=e.__vccOpts||e;for(const[i,s]of t)n[i]=s;return n},Wh=Et(kC,[["__scopeId","data-v-4fa681cf"]]),TC={class:"zoom-actions-container"},vC={class:"zoom-actions-heading"},SC={class:"zoom-action-select"},MC=["data-testid"],DC=["aria-disabled","href"],CC=["onClick"],OC=Et(d.defineComponent({__name:"ZoomActions",props:{zoomActionItems:{},newTimeRange:{},granularity:{}},emits:["onAction"],setup(e,{emit:t}){const n=e,i=t,s=o=>{o.action&&(o.action(n.newTimeRange),i("onAction"))};return(o,a)=>(d.openBlock(),d.createElementBlock("div",TC,[d.createElementVNode("div",vC,[d.createVNode(Wh,{end:e.newTimeRange.end,granularity:e.granularity,start:e.newTimeRange.start},null,8,["end","granularity","start"]),d.createVNode(d.unref(wt.CloseIcon),{class:"zoom-actions-close-icon",color:`var(--kui-color-text-neutral, ${d.unref(Oo)})`,size:`var(--kui-icon-size-30, ${d.unref(vn)})`,onClick:a[0]||(a[0]=r=>o.$emit("onAction"))},null,8,["color","size"])]),a[2]||(a[2]=d.createElementVNode("div",{class:"zoom-actions-heading-divider"},null,-1)),d.createElementVNode("div",SC,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(e.zoomActionItems,r=>(d.openBlock(),d.createElementBlock("div",{key:r.key,class:d.normalizeClass(["zoom-action-item",{disabled:r.disabled}]),"data-testid":`zoom-action-item-${r.key}`},[r.href?(d.openBlock(),d.createElementBlock("a",{key:0,"aria-disabled":r.disabled,class:"zoom-action-link",href:r.href,onClick:a[1]||(a[1]=l=>o.$emit("onAction"))},d.toDisplayString(r.label),9,DC)):(d.openBlock(),d.createElementBlock("div",{key:1,onClick:l=>s(r)},d.toDisplayString(r.label),9,CC))],10,MC))),128))])]))}}),[["__scopeId","data-v-79ba72f8"]]),AC={key:2},PC={class:"tooltip-title"},EC={class:"title"},RC={key:0,class:"subtitle"},IC={class:"context"},LC={class:"metric"},NC={class:"tooltip"},BC={key:0,class:"square-marker marker-placeholder"},FC={class:"display-value"},ji=Et(d.defineComponent({__name:"ChartTooltip",props:{state:{},tooltipTitle:{default:""},absoluteLeft:{default:"0px"},absoluteTop:{default:"0px"},zoomTimeRange:{default:void 0},zoomActionItems:{default:void 0},granularity:{default:void 0}},emits:["dimensions","onAction"],setup(e,{emit:t}){const n=t,i=e,s=d.ref(null),{x:o,y:a,isDragging:r}=DM(s,{initialValue:{x:parseFloat(i.absoluteLeft),y:parseFloat(i.absoluteTop)}}),l=d.computed(()=>`${a.value}px`),c=d.computed(()=>`${o.value}px`),u=d.computed(()=>i.state.tooltipContext),h=d.computed(()=>i.state.metricDisplay),f=d.computed(()=>["interactive","zoom-interactive"].includes(i.state.interactionMode));return d.watch(()=>[i.absoluteLeft,i.absoluteTop],([m,p])=>{r.value||(o.value=parseFloat(m),a.value=parseFloat(p))}),d.watch(r,m=>{m?document.body.classList.add("no-select"):document.body.classList.remove("no-select")}),d.watch(s,m=>{if(m){const{width:p,height:g}=m.getBoundingClientRect();n("dimensions",{width:p,height:g})}}),(m,p)=>e.state.showTooltip?(d.openBlock(),d.createElementBlock("div",{key:0,ref_key:"tooltipEl",ref:s,class:d.normalizeClass(["tooltip-container",{locked:e.state.interactionMode==="interactive"}]),style:d.normalizeStyle({transform:f.value?`translate(${c.value}, ${l.value})`:`translate(${e.absoluteLeft}, ${e.absoluteTop})`,left:"0",top:"0",pointerEvents:f.value?"all":"none"})},[e.state.interactionMode==="selecting-chart-area"&&e.granularity&&e.zoomTimeRange&&e.zoomTimeRange.end&&e.zoomTimeRange.start?(d.openBlock(),d.createBlock(Wh,{key:0,end:e.zoomTimeRange?.end,granularity:e.granularity,start:e.zoomTimeRange?.start},null,8,["end","granularity","start"])):e.state.interactionMode==="zoom-interactive"&&e.zoomTimeRange&&e.zoomActionItems&&e.granularity?(d.openBlock(),d.createBlock(OC,{key:1,granularity:e.granularity,"new-time-range":e.zoomTimeRange,"zoom-action-items":e.zoomActionItems,onOnAction:p[0]||(p[0]=g=>n("onAction"))},null,8,["granularity","new-time-range","zoom-action-items"])):(d.openBlock(),d.createElementBlock("div",AC,[d.createElementVNode("div",PC,[d.createElementVNode("div",EC,[d.createElementVNode("div",null,d.toDisplayString(e.tooltipTitle),1),f.value?(d.openBlock(),d.createBlock(d.unref(wt.DragIcon),{key:0,class:"drag-icon",color:`var(--kui-color-text-neutral, ${d.unref(Oo)})`,size:`var(--kui-icon-size-30, ${d.unref(vn)})`},null,8,["color","size"])):d.createCommentVNode("",!0)]),u.value||h.value?(d.openBlock(),d.createElementBlock("div",RC,[d.createElementVNode("div",IC,d.toDisplayString(u.value),1),d.createElementVNode("div",LC,d.toDisplayString(h.value),1)])):d.createCommentVNode("",!0)]),d.createElementVNode("ul",NC,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(e.state.tooltipSeries,({backgroundColor:g,borderColor:y,label:_,value:x,isSegmentEmpty:T,isExtra:S},w)=>(d.openBlock(),d.createElementBlock(d.Fragment,{key:_+w},[e.state.tooltipSeries.length?(d.openBlock(),d.createElementBlock("li",{key:0,class:d.normalizeClass({"extra-row":S})},[S?(d.openBlock(),d.createElementBlock("div",BC)):(d.openBlock(),d.createElementBlock("div",{key:1,class:"square-marker",style:d.normalizeStyle({background:String(g),borderColor:String(y)})},null,4)),d.createElementVNode("span",{class:d.normalizeClass(["display-label",{empty:T}])},d.toDisplayString(_),3),d.createElementVNode("span",FC,d.toDisplayString(x),1)],2)):d.createCommentVNode("",!0)],64))),128))])]))],6)):d.createCommentVNode("",!0)}}),[["__scopeId","data-v-fb2f2a72"]]),zC={key:0,class:"legend-container","data-testid":"legend"},UC=["onClick"],VC={key:0,"aria-hidden":"true",class:"line-marker",height:"2",width:"16"},HC=["stroke","stroke-dasharray"],$C=["title"],YC={class:"label truncate-label"},WC={key:0,class:"sub-label"},jC={key:0},qC={class:"tooltip-content"},oo=Et(d.defineComponent({__name:"ChartLegend",props:{id:{type:String,required:!0},items:{type:Object,required:!0},chartInstance:{type:Object,required:!1,default:()=>null}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=d.inject("showLegendValues",!1),s=d.inject("legendPosition",d.ref(Nt.Bottom)),o=({datasetIndex:l,index:c,isKey:u},h)=>u?`key-${h}`:`dataset-${l??0}-${c??0}`,a=(l=0,c)=>{if(t.chartInstance===null)return;const u=t.chartInstance instanceof Zt?t.chartInstance:t.chartInstance.chart,h=r(l,c);!u.getDatasetMeta(l).dataset&&c!==void 0?u.toggleDataVisibility(c):h?u.hide(l,c):u.show(l,c),u.update()},r=(l=0,c)=>{if(t.chartInstance===null||t.chartInstance.chart===null)return!0;const u=t.chartInstance instanceof Zt?t.chartInstance:t.chartInstance.chart;return u.getDatasetMeta(l).dataset||c===void 0?u.isDatasetVisible(l):u.getDataVisibility(c)};return(l,c)=>{const u=d.resolveComponent("KTooltip");return d.unref(s)!==d.unref(Nt).Hidden?(d.openBlock(),d.createElementBlock("ul",zC,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(e.items,({fillStyle:h,strokeStyle:f,text:m,datasetIndex:p,index:g,value:y,isSegmentEmpty:_,isKey:x,lineDash:T},S)=>(d.openBlock(),d.createElementBlock("li",{key:o({datasetIndex:p,index:g,isKey:x},S),class:d.normalizeClass({"legend-key":x}),onClick:w=>x?void 0:a(p,g)},[T?.length?(d.openBlock(),d.createElementBlock("svg",VC,[d.createElementVNode("line",{stroke:f,"stroke-dasharray":T.join(" "),"stroke-width":"2",x1:"0",x2:"16",y1:"1",y2:"1"},null,8,HC)])):(d.openBlock(),d.createElementBlock("div",{key:1,class:"square-marker",style:d.normalizeStyle({background:h,"border-color":f})},null,4)),d.createVNode(u,null,d.createSlots({default:d.withCtx(()=>[d.createElementVNode("div",{class:d.normalizeClass(["label-container",{"strike-through":!x&&!r(p,g),"inline-value":x}]),title:y&&(d.unref(i)||x)?`${m}: ${y.formatted}`:m},[d.createElementVNode("div",YC,d.toDisplayString(m),1),y&&(d.unref(i)||x)?(d.openBlock(),d.createElementBlock("div",WC,[x?(d.openBlock(),d.createElementBlock("span",jC,"-")):d.createCommentVNode("",!0),d.createTextVNode(" "+d.toDisplayString(y.formatted),1)])):d.createCommentVNode("",!0)],10,$C)]),_:2},[_?{name:"content",fn:d.withCtx(()=>[d.createElementVNode("div",qC,d.toDisplayString(d.unref(n).t("emptyEntityInfo")),1)]),key:"0"}:void 0]),1024)],10,UC))),128))])):d.createCommentVNode("",!0)}}}),[["__scopeId","data-v-90ef4d12"]]),Bt=[];for(let e=0;e<256;++e)Bt.push((e+256).toString(16).slice(1));function GC(e,t=0){return(Bt[e[t+0]]+Bt[e[t+1]]+Bt[e[t+2]]+Bt[e[t+3]]+"-"+Bt[e[t+4]]+Bt[e[t+5]]+"-"+Bt[e[t+6]]+Bt[e[t+7]]+"-"+Bt[e[t+8]]+Bt[e[t+9]]+"-"+Bt[e[t+10]]+Bt[e[t+11]]+Bt[e[t+12]]+Bt[e[t+13]]+Bt[e[t+14]]+Bt[e[t+15]]).toLowerCase()}const XC=new Uint8Array(16);function KC(){return crypto.getRandomValues(XC)}function fr(e,t,n){return crypto.randomUUID?crypto.randomUUID():ZC(e)}function ZC(e,t,n){e=e||{};const i=e.random??e.rng?.()??KC();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,GC(i)}const jh=(e,t)=>{const n=e.ctx,i=e.scales.y,s=e.scales.x,o=t[t.length-1].element;n.save(),n.strokeStyle="rgba(100, 100, 100, 1)",n.lineWidth=3,e.options.indexAxis==="x"?n.strokeRect(o.x-o.width/2,o.y,o.width,i.bottom-o.y):n.strokeRect(s.left,o.y-o.height/2,o.x-s.left,o.height),n.restore()};class qh{id="highlightPlugin";_clickedElements;_previousHoverOption;_clicked=!1;_pause=!1;_suppressNextClick=!1;afterDatasetsDraw(t){this._clickedElements&&this._clickedElements.length&&!this._pause&&jh(t,this._clickedElements)}afterEvent(t,{event:n}){if(n.type==="click"&&this._suppressNextClick){this._suppressNextClick=!1;return}if(n.type!=="click"||!n.native||this._pause)return;this._clicked=!this._clicked;const i=t.options.interaction?.mode||"index",s=t.getElementsAtEventForMode(n.native,i,{intersect:!1},!0);s.length&&this._clicked?(this._clickedElements=s,jh(t,this._clickedElements),this._previousHoverOption=t.options.hover,t.options.hover={mode:null}):(delete this._clickedElements,t.options.hover=this._previousHoverOption||t.options.hover,this._clicked=!1)}beforeDestroy(t){delete this._clickedElements,t.options.hover=this._previousHoverOption||t.options.hover,this._clicked=!1}pause(){this._pause=!0}get isPaused(){return this._pause}resume(t=!1){this._pause=!1,t&&(this._suppressNextClick=!0)}}const QC=(e,t,n,i,s="#0275d8")=>{e&&(e.save(),e.beginPath(),e.moveTo(t,n),e.lineTo(t,i),e.lineWidth=1,e.strokeStyle=s,e.stroke(),e.restore())};class ao{id="coordinator";coordinator=void 0;instanceId="";stopWatcher=void 0;activeDimension=null;activeDimensionValue=null;requiresUpdate=!1;triggerOnSelf=!1;watchTimestamp=!1;watchDimension=!1;lastMouseBrushEvent=0;constructor({coordinator:t,requiresUpdate:n=!1,triggerOnSelf:i=!1,watchTimestamp:s=!1,watchDimension:o=!1}){this.instanceId=crypto.randomUUID(),this.coordinator=t,this.requiresUpdate=n,this.triggerOnSelf=i,this.watchTimestamp=s,this.watchDimension=o}afterInit(t){if(!this.coordinator)return;const n=this.requiresUpdate?()=>t.update("none"):()=>t.draw(),i=this._watchTimestamp(n),s=this._watchDimension(n);this.stopWatcher=()=>{i&&i(),s&&s()}}afterEvent(t,{event:n}){this.coordinator&&(n.type==="mousemove"||n.type==="mouseout")&&requestAnimationFrame(i=>this._onMouseBrush(n.native,t,i))}beforeDatasetDraw(t,n){if(!this.coordinator||!this.watchDimension||this.coordinator.activeChart.value===this.instanceId&&!this.triggerOnSelf)return;t.config.type==="doughnut"?this._highlightDimensionDonut(t):this._highlightDimensionDefault(t,n)}afterDatasetsDraw(t){if(t.ctx.globalAlpha=1,!this.coordinator||!this.watchTimestamp||!this.coordinator.activeTimestamp.value||this.coordinator.activeChart.value===this.instanceId&&!this.triggerOnSelf)return;const i=t.scales.x.getPixelForValue(this.coordinator.activeTimestamp.value),s=t.ctx;QC(s,i,t.scales.y.top,t.scales.y.bottom)}beforeDestroy(){this.stopWatcher&&this.stopWatcher()}_watchTimestamp(t){if(!this.coordinator)return;let n;return this.watchTimestamp&&(n=d.watch([this.coordinator.activeChart,this.coordinator.activeTimestamp],([i])=>{(i!==this.instanceId||this.triggerOnSelf)&&t()})),n}_watchDimension(t){if(!this.coordinator)return;let n;if(this.watchDimension){let i;n=d.watch([this.coordinator.activeChart,this.coordinator.activeDimension,this.coordinator.activeDimensionValue],([s,o,a])=>{clearTimeout(i),o===null&&(this.activeDimension=null),a===null&&(this.activeDimensionValue=null),i=setTimeout(()=>{this.activeDimension=o,this.activeDimensionValue=a,(s!==this.instanceId||this.triggerOnSelf)&&t()},this.coordinator?.DIMENSION_DEBOUNCE_MS??400),d.onWatcherCleanup(()=>{clearTimeout(i)})})}return n}_onMouseBrush(t,n,i){if(!this.coordinator)return;const s=t.type,o=Math.min(this.coordinator.TIMESTAMP_DEBOUNCE_MS,this.coordinator.DIMENSION_DEBOUNCE_MS);if(!(s==="mousemove"&&i-this.lastMouseBrushEvent<o)){if(s==="mousemove"){if(!n.canvas)return;const a=this._getTimestamp(n,t),[r,l]=this._getDatasetDimension(n,t)??[];this.coordinator.activate({chartUuid:this.instanceId,timestamp:a,dimension:r,dimensionValue:l})}else s==="mouseout"&&this.coordinator.deactivate({chartUuid:this.instanceId});this.lastMouseBrushEvent=i}}_highlightDimensionDefault(t,n){if(this.activeDimension&&this.activeDimensionValue){const i=t.data.datasets.map((s,o)=>s?.dimension===this.activeDimension&&s?.dimensionValue===this.activeDimensionValue?o:-1).filter(s=>s>=0);i.length&&(t.ctx.globalAlpha=i.includes(n.index)?1:.3)}else t.ctx.globalAlpha=1}_highlightDimensionDonut(t){if(this.activeDimension&&this.activeDimensionValue){const{dimension:n,dimensionValue:i}=t.data.datasets[0];if(n===this.activeDimension){const s=i.findIndex(o=>o===this.activeDimensionValue);s>=0?t.setActiveElements([{datasetIndex:0,index:s}]):t.setActiveElements([])}else t.setActiveElements([])}else t.setActiveElements([])}_getDatasetDimension(t,n){const i=t.config.type,s=i!=="line",o=["doughnut","scatter"].includes(i)?"point":"dataset",a=t.getElementsAtEventForMode(n,o,{intersect:s},!1),[r]=a;if(!r)return;const{datasetIndex:l,index:c}=r,{dimension:u,dimensionValue:h}=t.data.datasets[l];return i==="doughnut"?[u,h[c]]:[u,h]}_getTimestamp(t,n){const[i]=t.getElementsAtEventForMode(n,"index",{intersect:!1},!1);if(i&&this.watchTimestamp){const{datasetIndex:s,index:o}=i,{x:a}=t.data.datasets[s].data[o];return a}}}const JC=["id"],tO=["id"],eO={class:"axis-tooltip-content"},nO="100%",iO="100%",sO=20,oO=20,Gh=6,aO=0,rO=10,lO=10,cO=1,dO=Et(d.defineComponent({__name:"StackedBarChart",props:{chartData:{},tooltipTitle:{default:""},legendValues:{default:void 0},metricUnit:{default:""},orientation:{default:"horizontal"},annotations:{type:Boolean,default:!0},metricAxesTitle:{default:void 0},dimensionAxesTitle:{default:void 0},stacked:{type:Boolean,default:!0},syntheticsDataKey:{default:""},chartLegendSortFn:{type:Function,default:(e,t)=>e.value&&t.value&&t.value.raw-e.value.raw},chartTooltipSortFn:{type:Function,default:(e,t)=>t.rawValue-e.rawValue},tooltipMetricDisplay:{default:""},coordinator:{default:void 0}},setup(e){const t=e,{i18n:n}=q.useI18n(),{translateUnit:i}=q.useTranslatedUnits(),s=crypto.randomUUID(),o=crypto.randomUUID(),a=new qh,r=new ao({coordinator:t.coordinator,triggerOnSelf:!0,watchTimestamp:!1,watchDimension:!0}),l=d.useTemplateRef("chartContainer"),c=d.useTemplateRef("chartParent"),u=({chart:L},H)=>{const pt=L.data,dt=pt.labels?.indexOf(H);return pt.datasets.reduce((rt,Dt,Wt)=>{if(L.isDatasetVisible(Wt)){const Lt=Dt.data[dt];return isNaN(Lt)?rt:rt+Lt}else return rt},0)},h=(L,H,pt,dt)=>{const rt=dt==="horizontal";H===null&&(H=n.t("entityNoName"));const Dt={type:"label",yValue:Tt=>rt?H:u(Tt,H),xValue:Tt=>rt?u(Tt,H):H},Wt={...Dt,position:rt?{x:"start",y:"center"}:{x:"center",y:"end"},yAdjust:()=>rt?0:-Math.abs(XM()),content:Tt=>Eu(u(Tt,H),pt)},Lt={...Dt,content:Tt=>ZM(u(Tt,H),KM(Tt.chart,L)),position:rt?{x:"start",y:"center"}:{x:"center",y:"end"},xAdjust:Tt=>rt?GM(Eu(u(Tt,H),pt)):0,color:pe({state:"neutral"})};return{[`${H}-value`]:Wt,[`${H}-percent`]:Lt}},f=d.useTemplateRef("canvas"),m=d.useTemplateRef("axis"),p=fr(),g=fr(),y=d.ref([]),_=d.inject("legendPosition",Nt.Bottom),x=d.reactive({show:!1,top:"0px",left:"0px",text:"",offset:-50}),T=d.toRef(t,"metricUnit"),S=d.computed(()=>t.orientation==="horizontal"),w=d.reactive({showTooltip:!1,tooltipContext:"",metricDisplay:d.toRef(t,"tooltipMetricDisplay"),dimensionDisplay:d.toRef(t,"dimensionAxesTitle"),tooltipSeries:[],left:"",top:"",units:d.toRef(t,"metricUnit"),translateUnit:i,offsetX:0,offsetY:0,width:0,height:0,interactionMode:"idle",chartType:S.value?"horizontal_bar":"vertical_bar",chartID:o,chartTooltipSortFn:t.chartTooltipSortFn}),{tooltipAbsoluteLeft:D,tooltipAbsoluteTop:v}=q.useTooltipAbsolutePosition(c,w),A=d.ref(0),R=()=>t.annotations&&t.chartData.labels?.reduce((L,H)=>Object.assign(L,h(t.chartData,H,T.value,t.orientation)),{}),E={id:p,afterUpdate(L){A.value+=1,y.value=La(L,t.legendValues,t.chartLegendSortFn)}},k={id:g,afterUpdate(L){L.options.plugins.annotation.annotations=t.annotations?R():{}}},z=[E,{id:"axisHover",afterEvent(L,H){if(x.show=!1,H.event.type==="mousemove"){const pt=H.event,dt=L.options.indexAxis,rt=L.scales,Dt=L.scales[dt].getLabelForValue(Number(L.scales[dt].getValueForPixel(pt[dt]))),Lt=L.scales[dt].getLabels().indexOf(Dt),Tt=t.chartData.isLabelEmpty?.[Lt];if((pn=>pn==="x"?pt.y>rt.x.top:pt.x<rt.y.right)(dt)){w.interactionMode!=="interactive"&&(w.showTooltip=!1);const B=L.canvas.getContext("2d").measureText(Dt).width,X=Math.abs(Math.round(pt.x-B*.5)),at=Math.round(pt.x+B*.5),vt=L.canvas.getBoundingClientRect(),te=40;x.left=dt==="x"?`${(X>0?X:at)-x.offset+vt.left}px`:`${pt.x-B*.5-x.offset+vt.left}px`,x.top=`${pt.y-te+vt.top}px`,Dt.length>qs?(x.show=!0,x.text=Dt):Tt?(x.text=n.t("emptyEntityInfo"),x.show=!0):x.show=!1}else x.show=!1}}},a,r,...t.annotations?[k]:[]],N=d.computed(()=>t.chartData.labels&&t.chartData.labels.length||0),V=d.ref(0),Y=d.ref(0),G=new ResizeObserver(Ou(L=>{V.value=L[0].contentRect.width,Y.value=L[0].contentRect.height},100)),st=d.computed(()=>{const L=t.chartData?.labels?.length;return f.value&&L&&!S.value?`${Math.max(L*(sO+Gh),V.value)}px`:nO}),ot=d.computed(()=>{const L=t.chartData?.labels?.length;return f.value&&L&&S.value?`${Math.max(L*(oO+Gh),Y.value)}px`:iO});q.useReportChartDataForSynthetics(d.toRef(t,"chartData"),d.toRef(t,"syntheticsDataKey")),d.onMounted(()=>{t.annotations&&Zt.register(Yh),l.value&&(V.value=l.value.offsetWidth,Y.value=l.value.offsetHeight,G.observe(l.value))}),d.onUnmounted(()=>{l.value&&G.unobserve(l.value)});const K=d.computed(()=>{const L=q.useBarChartOptions({tooltipState:w,legendID:p,stacked:d.toRef(t,"stacked"),metricAxesTitle:d.toRef(t,"metricAxesTitle"),dimensionAxesTitle:d.toRef(t,"dimensionAxesTitle"),indexAxis:S.value?"y":"x",numLabels:N});return{...L.value,plugins:{...L.value.plugins,annotation:{annotations:R(),clip:!1}}}}),U=q.useChartJSCommon("bar",f,d.toRef(t,"chartData"),z,K);d.onBeforeUnmount(()=>{Zt.unregister(Yh)});const M={[Nt.Bottom]:"column"},P=d.computed(()=>{if(m.value&&U.value){const L=window.devicePixelRatio,H=U.value,pt=H.scales.y.width*L+cO,dt=(H.scales.y.height+H.scales.y.top+H.scales.x.height)*L,rt=m.value.getContext("2d");return rt.scale(L,L),rt.canvas.width=pt,rt.canvas.height=dt,rt.canvas.style.width=`${pt/L}px`,rt.canvas.style.height=`${dt/L}px`,{scale:L,width:pt*L,height:dt*L,targetCtx:rt}}return null}),F=L=>{const H=L.target;if(P.value&&U.value&&!S.value){const pt=P.value.scale,dt=P.value.targetCtx,rt=P.value.width,Dt=P.value.height,Wt=U.value,Lt=Wt.canvas;dt.fillStyle="white",H.scrollLeft>=aO&&H.scrollLeft<=rO?(dt.globalCompositeOperation="source-over",dt.clearRect(0,0,rt,Dt),dt.drawImage(Lt,0,0,rt,Dt,0,0,rt,Dt),dt.globalCompositeOperation="destination-over",dt.fillRect(0,0,rt,Dt)):(dt.globalCompositeOperation="source-over",dt.fillRect(0,(Wt.scales.y.height+Wt.scales.y.top+lO)*pt,rt,Wt.scales.x.height*pt))}w.offsetY=H.scrollTop,w.offsetX=H.scrollLeft,x.offset=H.scrollLeft},$=({width:L,height:H})=>{w.width=L,w.height=H};d.watch(()=>t.orientation,()=>{if(m.value&&P.value){const L=P.value.width,H=P.value.height;(m.value?.getContext("2d")).clearRect(0,0,L,H)}w.showTooltip=!1,w.interactionMode="idle"}),d.watch(()=>t.annotations,L=>{U.value&&(L?U.value.options.plugins.annotation.annotations=R(t.chartData):delete U.value.options.plugins.annotation.annotations)});const it=()=>{w.showTooltip&&(w.interactionMode!=="idle"?w.interactionMode="idle":w.interactionMode="interactive")};return(L,H)=>(d.openBlock(),d.createElementBlock("div",{ref:"chartParent",class:d.normalizeClass(["chart-parent",M[d.unref(_)]])},[d.createElementVNode("canvas",{id:d.unref(s),ref:"axis",class:"axis"},null,8,JC),d.createElementVNode("div",{ref:"chartContainer",class:"chart-container",onClick:H[0]||(H[0]=pt=>it()),onScroll:F},[d.createElementVNode("div",{class:"chart-body",style:d.normalizeStyle({width:st.value,height:ot.value})},[d.createElementVNode("canvas",{id:d.unref(o),ref:"canvas",class:"chart-canvas"},null,8,tO)],4)],544),(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[x.show?(d.openBlock(),d.createElementBlock("div",{key:0,class:"axis-tooltip",style:d.normalizeStyle({top:x.top,left:x.left}),width:"auto"},[d.createElementVNode("div",eO,d.toDisplayString(x.text),1)],4)):d.createCommentVNode("",!0),d.createVNode(ji,{"absolute-left":d.unref(D),"absolute-top":d.unref(v),"chart-parent-ref":c.value,state:w,"tooltip-title":e.tooltipTitle,onDimensions:$},null,8,["absolute-left","absolute-top","chart-parent-ref","state","tooltip-title"])])),d.createVNode(oo,{id:d.unref(p),"chart-instance":d.unref(U),items:y.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-641d9623"]]);const uO={datetime:"MMM d, yyyy, h:mm:ss aaaa",millisecond:"h:mm:ss.SSS aaaa",second:"h:mm:ss aaaa",minute:"h:mm aaaa",hour:"ha",day:"MMM d",week:"PP",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"};Zc._date.override({_id:"date-fns",formats:function(){return uO},parse:function(e,t){if(e===null||typeof e>"u")return null;const n=typeof e;return n==="number"||e instanceof Date?e=J(e):n==="string"&&(typeof t=="string"?e=Lb(e,t,new Date,this.options):e=Vl(e,this.options)),Ro(e)?e.getTime():null},format:function(e,t){return rs(e,t,this.options)},add:function(e,t,n){switch(n){case"millisecond":return Po(e,t);case"second":return Ay(e,t);case"minute":return Cy(e,t);case"hour":return Sy(e,t);case"day":return os(e,t);case"week":return Py(e,t);case"month":return Ao(e,t);case"quarter":return Oy(e,t);case"year":return Ey(e,t);default:return e}},diff:function(e,t,n){switch(n){case"millisecond":return Io(e,t);case"second":return Uy(e,t);case"minute":return By(e,t);case"hour":return Ny(e,t);case"day":return _l(e,t);case"week":return Vy(e,t);case"month":return Tl(e,t);case"quarter":return zy(e,t);case"year":return Hy(e,t);default:return 0}},startOf:function(e,t,n){switch(t){case"second":return zb(e);case"minute":return Fb(e);case"hour":return Bb(e);case"day":return Eo(e);case"week":return ce(e);case"isoWeek":return ce(e,{weekStartsOn:+n});case"month":return Yy(e);case"quarter":return $y(e);case"year":return vl(e);default:return e}},endOf:function(e,t){switch(t){case"second":return Ky(e);case"minute":return Gy(e);case"hour":return jy(e);case"day":return wl(e);case"week":return qy(e);case"month":return kl(e);case"quarter":return Xy(e);case"year":return Wy(e);default:return e}}});const Xh={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},hO={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...Xh,...{ariaLabel:{type:String},ariaDescribedby:{type:String}}},fO=d.version[0]==="2"?(e,t)=>Object.assign(e,{attrs:t}):(e,t)=>Object.assign(e,t);function Wn(e){return d.isProxy(e)?d.toRaw(e):e}function mO(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e;return d.isProxy(t)?new Proxy(e,{}):e}function pO(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function Kh(e,t){e.labels=t}function Zh(e,t,n){const i=[];e.datasets=t.map(s=>{const o=e.datasets.find(a=>a[n]===s[n]);return!o||!s.data||i.includes(o)?{...s}:(i.push(o),Object.assign(o,s),o)})}function gO(e,t){const n={labels:[],datasets:[]};return Kh(n,e.labels),Zh(n,e.datasets,t),n}const yO=d.defineComponent({props:hO,setup(e,t){let{expose:n,slots:i}=t;const s=d.ref(null),o=d.shallowRef(null);n({chart:o});const a=()=>{if(!s.value)return;const{type:c,data:u,options:h,plugins:f,datasetIdKey:m}=e,p=gO(u,m),g=mO(p,u);o.value=new Zt(s.value,{type:c,data:g,options:{...h},plugins:f})},r=()=>{const c=d.toRaw(o.value);c&&(e.destroyDelay>0?setTimeout(()=>{c.destroy(),o.value=null},e.destroyDelay):(c.destroy(),o.value=null))},l=c=>{c.update(e.updateMode)};return d.onMounted(a),d.onUnmounted(r),d.watch([()=>e.options,()=>e.data],(c,u)=>{let[h,f]=c,[m,p]=u;const g=d.toRaw(o.value);if(!g)return;let y=!1;if(h){const _=Wn(h),x=Wn(m);_&&_!==x&&(pO(g,_),y=!0)}if(f){const _=Wn(f.labels),x=Wn(p.labels),T=Wn(f.datasets),S=Wn(p.datasets);_!==x&&(Kh(g.config.data,_),y=!0),T&&T!==S&&(Zh(g.config.data,T,e.datasetIdKey),y=!0)}y&&d.nextTick(()=>{l(g)})},{deep:!0}),()=>d.h("canvas",{role:"img","aria-label":e.ariaLabel,"aria-describedby":e.ariaDescribedby,ref:s},[d.h("p",{},[i.default?i.default():""])])}});function ro(e,t){return Zt.register(t),d.defineComponent({props:Xh,setup(n,i){let{expose:s}=i;const o=d.shallowRef(null),a=d.shallowRef(null);d.watch(()=>a.value?.chart??null,l=>{o.value=l},{flush:"sync"}),s({chart:o});const r=l=>{a.value=l};return()=>d.h(yO,fO({ref:r},{type:e,...n}))}})}const Qh=ro("bar",qc),Jh=ro("doughnut",Ti),tf=ro("line",Gc),bO=ro("scatter",Kc),_O={class:"chart-container"},xO={key:0,class:"chart-center-metric"},wO={class:"chart-center-total"},kO={key:0,class:"chart-center-unit"},TO=d.defineComponent({__name:"DonutChart",props:{chartData:{},tooltipTitle:{},metricUnit:{default:""},metricName:{default:""},legendPosition:{default:Nt.Bottom},legendValues:{default:void 0},syntheticsDataKey:{default:""},tooltipDimensionDisplay:{default:""},tooltipMetricDisplay:{default:""},showCenterMetric:{type:Boolean,default:!0},coordinator:{default:void 0}},setup(e){const t=e,{translateUnit:n}=q.useTranslatedUnits(),{i18n:i}=q.useI18n(),s=crypto.randomUUID(),o=crypto.randomUUID(),a=d.ref([]),r=d.useTemplateRef("chartParent"),l=new ao({coordinator:t.coordinator,requiresUpdate:!0,triggerOnSelf:!1,watchTimestamp:!1,watchDimension:!0}),c=d.reactive({showTooltip:!1,tooltipContext:"",metricDisplay:d.toRef(t,"tooltipMetricDisplay"),dimensionDisplay:d.toRef(t,"tooltipDimensionDisplay"),tooltipSeries:[],left:"",top:"",units:d.toRef(t,"metricUnit"),translateUnit:n,offsetX:0,offsetY:0,width:0,height:0,chartID:o,chartType:"donut",interactionMode:"idle"}),{tooltipAbsoluteLeft:u,tooltipAbsoluteTop:h}=q.useTooltipAbsolutePosition(r,c),f={id:s,afterUpdate(A){a.value=A.options.plugins.legend.labels.generateLabels(A).map(R=>({...R,value:t.legendValues&&t.legendValues[R.text],hidden:!1}))}},m=d.computed(()=>[l,f]),p=d.computed(()=>[t.chartData.datasets.reduce((R,E)=>(R.dimension=E.dimension,R.dimensionValue.push(E.dimensionValue),R.labels.push(E.label),R.backgroundColor.push(E.backgroundColor),R.hoverBorderColor.push(xs(E.backgroundColor).saturate(.5).darken(.15).hexString()),R.data.push(E.data.reduce((k,C)=>k+C,0)),R),{dimension:"",dimensionValue:[],labels:[],backgroundColor:[],borderColor:"#ffffff",borderWidth:1,hoverBorderColor:[],hoverBorderWidth:1,data:[],hoverOffset:10})]),{formatUnit:g}=le({i18n:i}),y=d.computed(()=>N1(t.metricName??"")),_=d.computed(()=>{const A=p.value[0]?.data.reduce((R,E)=>R+E,0)??0;return g(A,t.metricUnit,{approximate:!0,translateUnit:(R,E)=>n(R,E)}).trim()}),x=d.computed(()=>t.tooltipMetricDisplay||""),T=d.computed(()=>({...t.chartData,datasets:p.value}));q.useReportChartDataForSynthetics(d.toRef(t,"chartData"),d.toRef(t,"syntheticsDataKey"));const{options:S}=q.useDonutChartOptions({tooltipState:c,legendID:s}),w=d.ref(),D=A=>({[Nt.Bottom]:"column",[Nt.Hidden]:"hidden"})[A],v=({width:A,height:R})=>{c.width=A,c.height=R};return(A,R)=>(d.openBlock(),d.createElementBlock("div",{ref:"chartParent",class:d.normalizeClass(["chart-parent",D(e.legendPosition)]),"data-testid":"donut-chart-parent"},[d.createElementVNode("div",_O,[d.createVNode(d.unref(Jh),{ref_key:"chartInstance",ref:w,"chart-id":d.unref(o),data:T.value,options:d.unref(S),plugins:m.value},null,8,["chart-id","data","options","plugins"]),e.showCenterMetric&&y.value?(d.openBlock(),d.createElementBlock("div",xO,[d.createElementVNode("span",wO,d.toDisplayString(_.value),1),x.value?(d.openBlock(),d.createElementBlock("span",kO,d.toDisplayString(x.value),1)):d.createCommentVNode("",!0)])):d.createCommentVNode("",!0),(d.openBlock(),d.createBlock(d.Teleport,{to:"body"},[d.createVNode(ji,{"absolute-left":d.unref(u),"absolute-top":d.unref(h),state:c,"tooltip-title":e.tooltipTitle,unit:e.metricUnit,onDimensions:v},null,8,["absolute-left","absolute-top","state","tooltip-title","unit"])]))]),d.createVNode(oo,{id:d.unref(s),"chart-instance":w.value,items:a.value,position:e.legendPosition},null,8,["id","chart-instance","items","position"])],2))}}),vO=Et(TO,[["__scopeId","data-v-9e8646c1"]]);class SO{id="outlierBandPlugin";beforeDatasetsDraw(t,n,i){const s=i?.value;if(s===void 0||!Number.isFinite(s)||!i?.color)return;const o=t.scales.y;if(!o||!t.chartArea)return;const{top:a,bottom:r,left:l,right:c}=t.chartArea,u=Math.min(Math.max(o.getPixelForValue(s),a),r);if(u<=a)return;const h=t.ctx;h.save(),h.fillStyle=i.color,h.fillRect(l,a,c-l,u-a),h.restore()}}const MO=1.5;class DO{id="referenceLinePlugin";afterDatasetsDraw(t,n,i){const s=i?.lines;if(!s?.length)return;const o=t.scales.y;if(!o||!t.chartArea)return;const{top:a,bottom:r,left:l,right:c}=t.chartArea,u=t.ctx;u.save(),u.lineWidth=MO;for(const{value:h,color:f,borderDash:m}of s){if(!Number.isFinite(h))continue;const p=o.getPixelForValue(h);p<a||p>r||(u.beginPath(),u.setLineDash(m),u.strokeStyle=f,u.moveTo(l,p),u.lineTo(c,p),u.stroke())}u.restore()}}const CO={class:"chart-container"},OO=Et(d.defineComponent({__name:"ScatterChart",props:{chartData:{default:void 0},tooltipTitle:{},metricUnit:{default:""},xMetric:{default:void 0},xMetricUnit:{default:void 0},granularity:{},timeRangeMs:{default:void 0},metricAxesTitle:{default:void 0},dimensionAxesTitle:{default:void 0},syntheticsDataKey:{default:""},chartLegendSortFn:{type:Function,default:()=>0},chartTooltipSortFn:{type:Function,default:(e,t)=>t.rawValue-e.rawValue},tooltipMetricDisplay:{default:""},shadeOutlierRegion:{type:Boolean,default:!1},themeColors:{default:()=>Ka()},coordinator:{default:void 0}},setup(e){const t=e,n=d.inject("legendPosition",Nt.Bottom),{i18n:i}=q.useI18n(),{formatUnit:s}=le({i18n:i}),{translateUnit:o}=q.useTranslatedUnits(),a=d.useTemplateRef("chartParent"),r=new SO,l=new DO,c=crypto.randomUUID(),u=crypto.randomUUID(),h=new ao({coordinator:t.coordinator,requiresUpdate:!0,triggerOnSelf:!0,watchTimestamp:!1,watchDimension:!0}),f=d.ref(),m=d.reactive({showTooltip:!1,tooltipContext:0,metricDisplay:d.toRef(t,"tooltipMetricDisplay"),tooltipSeries:[],left:"",top:"",units:d.toRef(t,"metricUnit"),translateUnit:o,offsetX:0,offsetY:0,width:0,height:0,chartType:"scatter",chartID:u,chartTooltipSortFn:t.chartTooltipSortFn,interactionMode:"idle"}),{tooltipAbsoluteLeft:p,tooltipAbsoluteTop:g}=q.useTooltipAbsolutePosition(a,m);q.useReportChartDataForSynthetics(d.toRef(t,"chartData"),d.toRef(t,"syntheticsDataKey"));const y=d.computed(()=>t.chartData?.outlier),_=d.computed(()=>t.chartData?.referenceLines??[]),x=d.ref([]),T={id:c,afterUpdate(k){x.value=La(k,void 0,t.chartLegendSortFn)}},S=d.computed(()=>{const k=[];y.value&&k.push({text:y.value.label,fillStyle:y.value.color,strokeStyle:y.value.color,isKey:!0});for(const C of _.value)k.push({text:C.label,fillStyle:C.color,strokeStyle:C.color,lineDash:C.borderDash,isKey:!0,value:{raw:C.value,formatted:s(C.value,t.metricUnit,{translateUnit:o})}});return k}),w=d.computed(()=>[...x.value,...S.value]),D=d.computed(()=>t.shadeOutlierRegion?y.value?.value:void 0),v=d.computed(()=>[h,T,...D.value!==void 0?[r]:[],..._.value.length?[l]:[]]),A=d.computed(()=>`scatter-${v.value.map(k=>k.id).join("-")}`),{options:R}=q.useScatterChartOptions({tooltipState:m,legendID:c,granularity:d.toRef(t,"granularity"),timeRangeMs:d.toRef(t,"timeRangeMs"),metricAxesTitle:d.toRef(t,"metricAxesTitle"),dimensionAxesTitle:d.toRef(t,"dimensionAxesTitle"),metricUnit:d.toRef(t,"metricUnit"),xMetric:d.toRef(t,"xMetric"),xMetricUnit:d.toRef(t,"xMetricUnit"),outlierValue:D,referenceLines:_,themeColors:d.toRef(t,"themeColors")}),E=k=>({[Nt.Bottom]:"column",[Nt.Hidden]:"hidden"})[k];return(k,C)=>(d.openBlock(),d.createElementBlock("div",{ref:"chartParent",class:d.normalizeClass(["chart-parent",E(d.unref(n))]),"data-testid":"scatter-chart-parent"},[d.createElementVNode("div",CO,[(d.openBlock(),d.createBlock(d.unref(bO),{key:A.value,ref_key:"chartInstance",ref:f,"chart-id":d.unref(u),class:"chart-canvas",data:e.chartData,"data-testid":"scatter-chart",options:d.unref(R),plugins:v.value},null,8,["chart-id","data","options","plugins"]))]),d.createVNode(ji,{"absolute-left":d.unref(p),"absolute-top":d.unref(g),"data-testid":"tooltip",granularity:e.granularity,state:m,"tooltip-title":e.tooltipTitle},null,8,["absolute-left","absolute-top","granularity","state","tooltip-title"]),d.createVNode(oo,{id:d.unref(c),"chart-instance":f.value,"data-testid":"legend",items:w.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-34d55736"]]),mr=(e,t,n,i,s="#0275d8")=>{e.save(),e.beginPath(),e.moveTo(t,n),e.lineTo(t,i),e.lineWidth=1,e.strokeStyle=s,e.stroke(),e.restore()},Gt={},AO=()=>{Gt.x=void 0,Gt.chart=void 0,Gt.strategy=void 0,Gt.group=void 0},PO=10;class ef{id="verticalLinePlugin";_clickedSegment;_pause=!1;_useBrushingState=!1;_brushStrategy;_brushGroup;constructor({brushGroup:t=void 0,brushStrategy:n=void 0,enableBrushing:i=!1}={}){let s=!1;n==="group"&&(s=t!==void 0),this._useBrushingState=i&&s,this._brushStrategy=n,this._brushGroup=t}afterEvent(t,n){if(!this._useBrushingState)return;const{event:i}=n;(i.type==="mousemove"||i.type==="mouseout")&&requestAnimationFrame(s=>this.onMouseBrush(i.type,t,s))}_lastMouseBrushEvent=0;onMouseBrush(t,n,i){if(t==="mousemove"&&i-this._lastMouseBrushEvent<PO)return;const s=()=>{Gt.chart=n,Gt.strategy=this._brushStrategy,Gt.group=this._brushGroup;for(const o of Object.values(Zt.instances))o!==n&&o.update("none")};t==="mousemove"?n.tooltip&&n.tooltip.getActiveElements()&&n.tooltip.getActiveElements().length&&(Gt.x=n.tooltip.dataPoints[0].element.x,s()):t==="mouseout"&&(Gt.x=void 0,s()),this._lastMouseBrushEvent=i}afterDatasetsDraw(t){if(this.isPaused)return;const n=t.tooltip&&t.tooltip.getActiveElements()&&t.tooltip.getActiveElements().length,i=t.ctx;if(this._clickedSegment){const{x:s}=this._clickedSegment.element;mr(i,s,t.scales.y.top,t.scales.y.bottom)}else if(this._useBrushingState)this.drawByBrush(t);else if(n){const{x:s}=t.tooltip.dataPoints[0].element;mr(i,s,t.scales.y.top,t.scales.y.bottom)}}drawByBrush(t){if(Gt.x===void 0)return;const n=Gt.chart===t?"#0275d8":"rgba(2, 117, 216, 0.3)";this._brushStrategy==="group"&&Gt.group===this._brushGroup&&mr(t.ctx,Gt.x,t.scales.y.top,t.scales.y.bottom,n)}pause(){this._pause=!0}resume(){this._pause=!1}get isPaused(){return this._pause}set clickedSegment(t){this._clickedSegment=t}get clickedSegment(){return this._clickedSegment}destroyClickedSegment(){delete this._clickedSegment}beforeDestroy(t){if(this._clickedSegment&&this.destroyClickedSegment(),this._useBrushingState&&Gt.chart===t){const n=Gt.x!==void 0;if(AO(),n)for(const i of Object.values(Zt.instances))i!==t&&i.update("none")}}}const EO=(e,t,n)=>{const i=e.ctx;i.save(),i.strokeStyle="rgba(95, 154, 255, 1)",i.lineWidth=2,i.beginPath(),i.moveTo(t,e.chartArea.top),i.lineTo(t,e.chartArea.bottom),i.moveTo(n,e.chartArea.top),i.lineTo(n,e.chartArea.bottom),i.stroke(),i.restore()},RO=(e,t,n)=>{const i=e.ctx;i.save(),i.fillStyle="rgba(143, 193, 255, 0.3)",i.fillRect(t,e.chartArea.top,n-t,e.chartArea.bottom-e.chartArea.top),i.restore()},nf=(e,t)=>{const n=e.scales.x.getValueForPixel(t.startX),i=e.scales.x.getValueForPixel(t.endX);if(!(n===void 0||i===void 0))return{xStart:Math.min(n,i),xEnd:Math.max(n,i)}},sf=(e,t,n)=>{t.canvas.dispatchEvent(new CustomEvent(e,{detail:n}))};class IO{id="dragSelectPlugin";_isDragging=!1;_startX=0;_endX=0;_dragTimeout;_clearSelectionArea=!0;_chart=null;_dragSelectHandlers;get startX(){return this._startX}get endX(){return this._endX}beforeInit(t){this._chart=t;const n=t.canvas;let i=!1;const s=r=>{this._dragTimeout=window.setTimeout(()=>{const l=n.getBoundingClientRect();this._isDragging=!0,this._clearSelectionArea=!1,i=!0,this._startX=r.clientX-l.left,this._endX=this._startX},150)},o=r=>{const l=n.getBoundingClientRect();if(i&&this._isDragging){this._endX=r.clientX-l.left;const c=nf(t,this);c&&sf("dragSelectMove",t,c)}},a=r=>{const l=n.getBoundingClientRect();if(clearTimeout(this._dragTimeout),i&&this._isDragging){this._endX=r.clientX-l.left,i=!1,this._isDragging=!1;const c=nf(t,this);c?sf("dragSelect",t,c):this.clearSelectionArea()}};n.addEventListener("mousedown",s),n.addEventListener("mousemove",o),n.addEventListener("mouseup",a),this._dragSelectHandlers={onMouseDown:s,onMouseMove:o,onMouseUp:a}}beforeDestroy(t){const n=t.canvas;if(this._dragSelectHandlers){const{onMouseDown:i,onMouseMove:s,onMouseUp:o}=this._dragSelectHandlers;n.removeEventListener("mousedown",i),n.removeEventListener("mousemove",s),n.removeEventListener("mouseup",o)}this._isDragging=!1,this._dragTimeout&&clearTimeout(this._dragTimeout)}afterDatasetsDraw(t){(this._isDragging||!this._clearSelectionArea)&&(RO(t,this._startX,this._endX),EO(t,this._startX,this._endX))}clearSelectionArea(){this._clearSelectionArea=!0,this._chart&&this._chart.update()}}const LO=20,NO="rgba(255, 171, 171, 0.4)",BO="rgba(255, 196, 0, 0.2)",of=(e,t,n)=>{const i=t.y-e.y;if(i===0)return t.x;const s=(n-e.y)/i;return e.x+s*(t.x-e.x)},af=e=>"yAxisID"in e&&e.yAxisID||Gs,rf=(e,t)=>{const n=e.data.datasets.find(i=>i.rawMetric===t);return n?af(n):Gs},FO=(e,t,n=Gs)=>{const i=[];return e.data.datasets.forEach(s=>{if(!e.getDatasetMeta(e.data.datasets.indexOf(s)).visible||af(s)!==n)return;const a=s.data;a?.length&&t.filter(r=>r.highlightIntersections).forEach(r=>{const l=a.map(u=>({ts:u.x,aboveThreshold:u.y>=r.value}));let c=l[0].aboveThreshold?a[0].x:void 0;for(let u=1;u<l.length;u++)!l[u-1].aboveThreshold&&l[u].aboveThreshold?c=of(a[u-1],a[u],r.value):l[u-1].aboveThreshold&&!l[u].aboveThreshold&&c!==void 0&&(i.push({start:c,end:of(a[u-1],a[u],r.value),type:r.type}),c=void 0);c!==void 0&&i.push({start:c,end:l[l.length-1].ts,type:r.type})})}),i},zO=e=>{if(!e.length)return[];e.sort((n,i)=>n.type.localeCompare(i.type)||n.start-i.start);const t=[];for(const n of e){const i=t.findLast(({type:s})=>s===n.type);i&&n.start<=i.end?i.end=Math.max(i.end,n.end):t.push({...n})}return t};class UO{constructor(t){this.i18n=t}i18n;id="thresholdPlugin";_thresholds;_mouseMoveHandler;_syncThresholds(t){for(const n of Object.keys(t.threshold||{})){const i=t.threshold?.[n];i&&(this._thresholds={...this._thresholds,[n]:i.map(s=>({...s,hovered:!1}))})}if(this._thresholds)for(const n of Object.keys(this._thresholds))t.threshold?.[n]||delete this._thresholds[n]}get thresholds(){return this._thresholds}beforeUpdate(t,n,i){this._syncThresholds(i)}beforeInit(t,n,i){const s=t.canvas;this._syncThresholds(i);const o=a=>{if(t){const r=a.clientY,l=s.getBoundingClientRect();for(const c of Object.keys(this._thresholds||{})){const h=(t.scales[rf(t,c)]??t.scales.y).getValueForPixel(r-l.top);if(h){const f=this._thresholds?.[c];f&&f.forEach(m=>{m.hovered=Math.abs(m.value-h)<LO})}}}};s.addEventListener("mousemove",o),this._mouseMoveHandler=o}afterDatasetsDraw(t,n){const i=t.ctx;for(const s of Object.keys(this._thresholds||{})){const o=this._thresholds?.[s];if(o){const a=rf(t,s),r=t.scales[a]??t.scales.y;o.forEach(u=>{const h=r.getPixelForValue(u.value);i.save(),i.beginPath(),i.moveTo(t.chartArea.left,h),i.lineTo(t.chartArea.right,h),i.lineWidth=1,i.strokeStyle=pe({state:u.type}),i.setLineDash([5,5]),i.stroke(),i.restore();let f="";u.label?f=`${u.label}: ${u.value}`:u.type==="warning"?f=this.i18n.t("chartLabels.threshold-warning",{value:u.value}):u.type==="error"?f=this.i18n.t("chartLabels.threshold-error",{value:u.value}):f=this.i18n.t("chartLabels.thatreshold-neutral",{value:u.value}),u.hovered&&(i.save(),i.fillStyle=pe({state:u.type}),i.font=ng,i.fillText(f,t.chartArea.left,h-4),i.restore())});const l=FO(t,o,a);zO(l).forEach(u=>{const h=t.scales.x.getPixelForValue(u.start),f=t.scales.x.getPixelForValue(u.end);i.save(),i.fillStyle=u.type==="error"?NO:BO,i.fillRect(h,t.chartArea.top,f-h,t.chartArea.bottom-t.chartArea.top),i.restore(),i.save(),i.beginPath(),i.moveTo(h,t.chartArea.bottom),i.lineTo(f,t.chartArea.bottom),i.lineWidth=2,i.strokeStyle=pe({state:u.type}),i.stroke(),i.restore()})}}}beforeDestroy(t){this._mouseMoveHandler&&t.canvas.removeEventListener("mousemove",this._mouseMoveHandler)}}const VO=Et(d.defineComponent({__name:"TimeSeriesChart",props:{chartData:{default:void 0},type:{default:"timeseries_line"},fill:{type:Boolean,default:!1},tooltipTitle:{},metricUnit:{default:""},timeRangeMs:{default:void 0},granularity:{},stacked:{type:Boolean,default:!0},legendValues:{default:void 0},metricAxesTitle:{default:void 0},dimensionAxesTitle:{default:void 0},syntheticsDataKey:{default:""},chartLegendSortFn:{type:Function,default:(e,t)=>e.value&&t.value&&t.value.raw-e.value.raw},chartTooltipSortFn:{type:Function,default:(e,t)=>t.rawValue-e.rawValue},brush:{type:Boolean,default:!1},zoomActionItems:{default:void 0},tooltipMetricDisplay:{default:""},threshold:{default:void 0},leftYAxisGrid:{type:Boolean,default:void 0},rightYAxis:{default:void 0},coordinator:{default:void 0}},emits:["zoom-time-range","select-chart-range"],setup(e,{emit:t}){const n=e,i=t,{i18n:s}=q.useI18n(),o=new ef,a=new qh,r=new IO,l=new UO(s),{translateUnit:c}=q.useTranslatedUnits(),u=d.ref(),h=crypto.randomUUID(),f=crypto.randomUUID(),m=d.ref([]),p=d.inject("legendPosition",Nt.Bottom),g=d.useTemplateRef("chartParent"),y=d.ref(void 0),_=d.ref(!1),x=new ao({coordinator:n.coordinator,triggerOnSelf:!0,watchTimestamp:!0,watchDimension:!0}),T=d.reactive({showTooltip:!1,tooltipContext:0,metricDisplay:d.toRef(n,"tooltipMetricDisplay"),tooltipSeries:[],left:"",top:"",units:d.toRef(n,"metricUnit"),translateUnit:c,offsetX:0,offsetY:0,width:0,height:0,chartType:n.type,chartID:f,chartTooltipSortFn:n.chartTooltipSortFn,interactionMode:"idle"}),{tooltipAbsoluteLeft:S,tooltipAbsoluteTop:w}=q.useTooltipAbsolutePosition(g,T),D={id:h,afterUpdate(M){m.value=La(M,n.legendValues,n.chartLegendSortFn)}},v=d.computed(()=>[x,D,a,...n.brush?[r]:[],...n.type==="timeseries_line"?[o]:[],...n.threshold?[l]:[]]),A=d.computed(()=>`line-${v.value.map(M=>M.id).join("-")}`),R=d.computed(()=>`bar-${v.value.map(M=>M.id).join("-")}`),E=d.computed(()=>n.chartData&&HM(n.chartData)),{options:k}=q.useLineChartOptions({tooltipState:T,timeRangeMs:d.toRef(n,"timeRangeMs"),granularity:d.toRef(n,"granularity"),legendID:h,stacked:d.toRef(n,"stacked"),metricAxesTitle:d.toRef(n,"metricAxesTitle"),dimensionAxesTitle:d.toRef(n,"dimensionAxesTitle"),pointsWithoutHover:E,threshold:d.toRef(n,"threshold"),leftYAxisGrid:d.toRef(n,"leftYAxisGrid"),rightYAxis:d.toRef(n,"rightYAxis")});q.useReportChartDataForSynthetics(d.toRef(n,"chartData"),d.toRef(n,"syntheticsDataKey"));const C=M=>M?M.end.getTime()>M.start.getTime():!1,z=M=>({[Nt.Bottom]:"column",[Nt.Hidden]:"hidden"})[M],N=({width:M,height:P})=>{T.width=M,T.height=P},V=(M=!0)=>{T.interactionMode="idle",T.showTooltip=!1,r.clearSelectionArea(),a.isPaused&&a.resume(M),o.isPaused&&o.resume()},Y=()=>{T.interactionMode="interactive"},G=()=>{!u.value||!u.value.chart.tooltip?.dataPoints?.length||(T.interactionMode==="interactive"?o.clickedSegment=u.value.chart.tooltip.dataPoints[0]:o.destroyClickedSegment())},st=()=>{if(_.value){_.value=!1;return}T.interactionMode!=="idle"?V():Y(),G()};d.watch(()=>n.type,()=>{T.interactionMode="idle",T.showTooltip=!1,o.destroyClickedSegment()});const ot=M=>{M.preventDefault(),M.stopPropagation();const{xStart:P,xEnd:F}=M.detail,$={start:new Date(P),end:new Date(F),type:"absolute"};if(!C($)){y.value=void 0,V(!1);return}y.value=$,T.interactionMode="zoom-interactive",$&&i("select-chart-range",$)},K=M=>{T.interactionMode="selecting-chart-area",_.value=!0,o.pause(),a.pause();const{xStart:P,xEnd:F}=M.detail;y.value={start:new Date(P),end:new Date(F),type:"absolute"}},U=M=>{if(!g.value||T.interactionMode==="idle")return;const P=M.target;P&&g.value.contains(P)||_.value||V(!1)};return d.watch(()=>u.value?.chart,()=>{u.value?.chart&&(u.value.chart.canvas.removeEventListener("dragSelect",ot),u.value.chart.canvas.removeEventListener("dragSelectMove",K),u.value.chart.canvas.addEventListener("dragSelect",ot),u.value.chart.canvas.addEventListener("dragSelectMove",K))}),d.onMounted(()=>{document.addEventListener("click",U,!0)}),d.onUnmounted(()=>{u.value?.chart&&(u.value.chart.canvas.removeEventListener("dragSelect",ot),u.value.chart.canvas.removeEventListener("dragSelectMove",K)),document.removeEventListener("click",U,!0)}),(M,P)=>(d.openBlock(),d.createElementBlock("div",{ref:"chartParent",class:d.normalizeClass(["chart-parent",z(d.unref(p))]),"data-testid":"line-chart-parent"},[d.createElementVNode("div",{class:"chart-container",onClick:P[0]||(P[0]=F=>st())},[e.type==="timeseries_line"?(d.openBlock(),d.createBlock(d.unref(tf),{key:A.value,ref_key:"chartInstance",ref:u,"chart-id":d.unref(f),class:"chart-canvas",data:e.chartData,"data-testid":"time-series-line-chart",options:d.unref(k),plugins:v.value},null,8,["chart-id","data","options","plugins"])):e.type==="timeseries_bar"?(d.openBlock(),d.createBlock(d.unref(Qh),{key:R.value,ref_key:"chartInstance",ref:u,"chart-id":d.unref(f),class:"chart-canvas",data:e.chartData,"data-testid":"time-series-bar-chart",options:d.unref(k),plugins:v.value},null,8,["chart-id","data","options","plugins"])):d.createCommentVNode("",!0)]),d.createVNode(ji,{"absolute-left":d.unref(S),"absolute-top":d.unref(w),"data-testid":"tooltip",granularity:e.granularity,state:T,"tooltip-title":e.tooltipTitle,"zoom-action-items":e.zoomActionItems,"zoom-time-range":y.value,onDimensions:N,onOnAction:P[1]||(P[1]=()=>V(!1))},null,8,["absolute-left","absolute-top","granularity","state","tooltip-title","zoom-action-items","zoom-time-range"]),d.createVNode(oo,{id:d.unref(h),"chart-instance":u.value,"data-testid":"legend",items:m.value},null,8,["id","chart-instance","items"])],2))}}),[["__scopeId","data-v-d7ce85b0"]]),HO=["aria-busy"],$O=["inert"],YO={key:0,class:"loading-overlay-spinner","data-testid":"loading-overlay-spinner"},lf=Et(d.defineComponent({__name:"LoadingOverlay",props:{loading:{type:Boolean},delay:{default:200}},setup(e){const t=d.ref(!1);let n;const i=()=>{clearTimeout(n),n=void 0};return d.watch(()=>e.loading,s=>{if(i(),!s){t.value=!1;return}n=setTimeout(()=>{t.value=!0},e.delay)},{immediate:!0}),d.onBeforeUnmount(i),(s,o)=>(d.openBlock(),d.createElementBlock("div",{"aria-busy":e.loading,class:d.normalizeClass(["loading-overlay",{active:t.value}]),"data-testid":"loading-overlay"},[d.createElementVNode("div",{class:"loading-overlay-content",inert:t.value||void 0},[d.renderSlot(s.$slots,"default",{},void 0,!0)],8,$O),t.value?(d.openBlock(),d.createElementBlock("div",YO,[d.createVNode(d.unref(wt.ProgressIcon),{color:`var(--kui-color-text-neutral, ${d.unref(Oo)})`,size:`var(--kui-icon-size-70, ${d.unref(sg)})`},null,8,["color","size"])])):d.createCommentVNode("",!0)],10,HO))}}),[["__scopeId","data-v-1ca5afe6"]]),WO={key:0,class:"chart-truncation-warning","data-testid":"truncation-warning"},jO={class:"tooltip-content"},qO=d.defineComponent({__name:"AnalyticsChart",props:{chartData:{},chartOptions:{},activeMetric:{default:void 0},tooltipTitle:{default:""},emptyStateTitle:{default:""},emptyStateDescription:{default:""},legendPosition:{default:Nt.Bottom},syntheticsDataKey:{default:""},showLegendValues:{type:Boolean,default:!1},showAnnotations:{type:Boolean,default:!0},timeseriesZoom:{type:Boolean,default:!1},requestsLink:{default:void 0},exploreLink:{default:void 0},loading:{type:Boolean,default:!1}},emits:["zoom-time-range","select-chart-range"],setup(e,{emit:t}){const n=d.inject(Cf),i=t,s=e,{i18n:o}=q.useI18n(),a=q.useFieldLabel(),r=Dr.useDatasourceConfigStore(),l=d.ref(crypto.randomUUID());d.watch(()=>s.chartOptions.type,()=>{l.value=crypto.randomUUID()},{immediate:!0});const c=d.computed(()=>Za(s.chartData)?void 0:s.chartData),u=d.computed(()=>{const B=s.chartOptions.metricAxisMap,X=c.value?.meta?.metric_names??[];if(!(s.chartOptions.type!=="timeseries_line"||!B||!X.some(at=>B[at]==="right")))return B}),h=d.computed(()=>!!u.value),f=(B,X)=>u.value?B.filter(at=>(u.value?.[at]??"left")===X):B,m=d.computed(()=>{const B=c.value?.meta,X=B?.metric_names??[];return["timeseries_line","timeseries_bar"].includes(s.chartOptions.type)&&!h.value&&X.length>1&&Object.keys(B?.display??{}).length>0?X:[]}),p=d.computed(()=>m.value.length>1),g=d.computed(()=>s.activeMetric&&m.value.includes(s.activeMetric)?s.activeMetric:m.value[0]),y=d.computed(()=>{const B=c.value;return!B||!p.value||!g.value?B:{...B,meta:{...B.meta,metric_names:[g.value]}}}),_=d.computed(()=>{const B=s.chartOptions.threshold;return!p.value||!B?B:{...B,...Object.fromEntries(Object.keys(B).filter(X=>X!==g.value).map(X=>[X,[]]))}}),x=d.computed(()=>{if(K.value)return Za(s.chartData)?s.chartData:Zu(s.chartData)}),T=d.inject("app:konnectColorMode",d.computed(()=>"light")),S=d.useTemplateRef("chartShell"),w=d.computed(()=>(T.value,Ka(S.value))),D=d.computed(()=>{if(x.value){const{start:X,end:at,metric:vt,metricUnit:te,truncated:lo,limit:ge,datasource:jn}=x.value;return{start:X,end:at,metricNames:[vt],metricUnits:{[vt]:te??""},truncated:lo,limit:ge,datasource:jn}}const B=y.value?.meta;return{start:B?.start,end:B?.end,metricNames:B?.metric_names,metricUnits:B?.metric_units,truncated:B?.truncated,limit:B?.limit,datasource:B?.datasource}}),v=d.computed(()=>K.value?q.useScatterDatasets({colorPalette:s.chartOptions.chartDatasetColors,scatter:s.chartOptions.scatter,themeColors:w},x,l.value,n).value:c.value?st.value?q.useExploreResultToTimeDataset({fill:s.chartOptions.stacked,colorPalette:s.chartOptions.chartDatasetColors,metricAxisMap:u.value},y,l.value,n).value:q.useExploreResultToDatasets({fill:s.chartOptions.stacked,colorPalette:s.chartOptions.chartDatasetColors},c,l.value,n).value:{datasets:[]}),A=d.computed(()=>s.timeseriesZoom||!!s.exploreLink||!!s.requestsLink),R=d.computed(()=>{if(!s.chartData||c.value&&!c.value.meta)return 0;const{start:B,end:X}=D.value;if(B&&X)return new Date(X).getTime()-new Date(B).getTime()}),E=d.computed(()=>D.value.metricUnits?p.value&&g.value?D.value.metricUnits[g.value]??"":Object.values(D.value.metricUnits)[0]??"":""),k=d.computed(()=>D.value.metricUnits?p.value&&g.value?g.value:Object.keys(D.value.metricUnits)[0]??"":""),C=d.computed(()=>s.showLegendValues&&s.legendPosition!==Nt.Hidden),{legendValues:z}=q.useChartLegendValues(v,s.chartOptions.type,E),N=d.computed(()=>D.value.limit?.toString()||null),V=d.computed(()=>s.chartOptions.hideTruncationWarning?!1:D.value.truncated||!1),Y=d.computed(()=>o.t("limitedResultsShown",{maxReturned:N.value})),G=d.computed(()=>["vertical_bar","horizontal_bar"].includes(s.chartOptions.type)),st=d.computed(()=>["timeseries_bar","timeseries_line"].some(B=>B===s.chartOptions.type)),ot=d.computed(()=>s.chartOptions.type==="donut"),K=d.computed(()=>s.chartOptions.type==="scatter"),U=d.computed(()=>s.chartOptions.type.includes("vertical")?"vertical":"horizontal"),M=d.computed(()=>{const{metricNames:B,metricUnits:X}=D.value;if(h.value||!B||!X)return;const at=B[0],vt=X[at]||"";if(B.length>1){if(at.includes("latency"))return o.t("metricAxisTitles.latency_in",{unit:o.t(`chartUnits.${vt}`,{plural:"s"})});if(at.includes("size"))return o.t("metricAxisTitles.size_in",{unit:o.t(`chartUnits.${vt}`,{plural:"s"})})}if(at){if(zi(vt)){const te=a(at,{prefix:"metricAxisTitles",fallback:""});if(te)return te}return a(at)}}),P=d.computed(()=>{const B=s.chartOptions.yAxes?.left?.title??s.chartOptions?.metricAxesTitle;if(B)return B;const{metricNames:X,metricUnits:at}=D.value;if(!(!X||!at))return $(f(X,"left"),at)}),F=d.computed(()=>{if(!h.value)return;const{metricNames:B,metricUnits:X}=D.value,at=B&&X?$(f(B,"right"),X):void 0;return{title:s.chartOptions.yAxes?.right?.title??at,showGrid:s.chartOptions.yAxes?.right?.showGrid}}),$=(B,X)=>{const at=B[0];if(!at)return;const vt=X[at]||"";if(B.length>1){if(at.includes("latency"))return o.t("metricAxisTitles.latency_in",{unit:o.t(`chartUnits.${vt}`,{plural:"s"})});if(at.includes("size"))return o.t("metricAxisTitles.size_in",{unit:o.t(`chartUnits.${vt}`,{plural:"s"})})}return it(at,vt)},it=(B,X)=>{if(zi(X))return a(B,{prefix:"metricAxisTitles"})||void 0;const at=o.te(`chartUnits.${X}`)?o.t(`chartUnits.${X}`,{plural:"s"}):X,vt=r.fieldTranslationMap.get(B);return vt?`${vt} (${at})`:o.te(`metricAxisTitles.${B}`)?o.t(`metricAxisTitles.${B}`,{unit:at})||void 0:B||void 0},L=d.computed(()=>{if(s.chartOptions?.dimensionAxesTitle)return s.chartOptions.dimensionAxesTitle;const B=c.value?.meta,X=st.value?"Time":Object.keys(B?.display||B?.metric_names||{})[0];if(X)return a(X)}),H=d.computed(()=>{if($f(D.value.datasource))return o.t("timestampAxisTitles.platform");const B=Ji(c.value?.meta?.granularity_ms);if(B)return o.te(`granularityAxisTitles.${B}`)?o.t(`granularityAxisTitles.${B}`):B}),pt=d.computed(()=>{const B=x.value?.xMetric;return B?it(B,x.value?.xMetricUnit??""):H.value}),dt=d.computed(()=>s.emptyStateTitle||o.t("noDataAvailableTitle")),rt=d.computed(()=>s.emptyStateDescription||o.t("noDataAvailableDescription")),Dt=d.computed(()=>K.value?!!x.value?.points.length:st.value?$M(v.value):!!(c.value&&c.value.meta&&c.value.data.length)),Wt=d.computed(()=>{const B=c.value;return B?B.meta.granularity_ms?Ji(B.meta.granularity_ms)||"hourly":Ji(new Date(B.data[1].timestamp).getTime()-new Date(B.data[0].timestamp).getTime())||"hourly":"hourly"}),Lt=d.computed(()=>Ji(c.value?.meta?.granularity_ms)||"secondly"),Tt=d.computed(()=>s.chartOptions.chartLegendSortFn?s.chartOptions.chartLegendSortFn:(B,X)=>B.text===o.t("chartLabels.____OTHER____")?1:X.text===o.t("chartLabels.____OTHER____")?-1:!isNaN(parseInt(B.text,10))&&!isNaN(parseInt(X.text,10))?B.text<X.text?-1:1:B.value&&X.value?X.value.raw-B.value.raw:0),je=d.computed(()=>s.chartOptions.chartTooltipSortFn?s.chartOptions.chartTooltipSortFn:(B,X)=>B.label===o.t("chartLabels.____OTHER____")?1:X.label===o.t("chartLabels.____OTHER____")?-1:!isNaN(parseInt(B.label,10))&&!isNaN(parseInt(X.label,10))?B.label<X.label?-1:1:B.value&&X.value?X.rawValue-B.rawValue:0),pn=d.computed(()=>[...s.timeseriesZoom?[{label:o.t("zoom_action_items.zoom"),key:"zoom-in",action:B=>i("zoom-time-range",B)}]:[],...s.exploreLink?[{label:o.t("zoom_action_items.explore"),key:"explore",href:s.exploreLink.href}]:[],...s.requestsLink?[{label:o.t("zoom_action_items.view_requests"),key:"view-requests",href:s.requestsLink.href}]:[]]);return d.provide("showLegendValues",C),d.provide("legendPosition",d.toRef(s,"legendPosition")),(B,X)=>{const at=d.resolveComponent("KTooltip"),vt=d.resolveComponent("KEmptyState");return d.openBlock(),d.createElementBlock("div",{ref:"chartShell",class:d.normalizeClass(["analytics-chart-shell",{"show-values":C.value}])},[Dt.value&&V.value&&N.value?(d.openBlock(),d.createElementBlock("div",WO,[d.createVNode(at,{class:"tooltip","max-width":"500",placement:"right"},{content:d.withCtx(()=>[d.createElementVNode("div",jO,d.toDisplayString(Y.value),1)]),default:d.withCtx(()=>[d.createVNode(d.unref(wt.WarningIcon),{color:`var(--kui-color-text-warning, ${d.unref(eg)})`,size:`var(--kui-icon-size-40, ${d.unref(ig)})`},null,8,["color","size"])]),_:1})])):d.createCommentVNode("",!0),Dt.value?(d.openBlock(),d.createBlock(lf,{key:2,class:"analytics-chart-parent",loading:e.loading},{default:d.withCtx(()=>[st.value?(d.openBlock(),d.createBlock(VO,{key:0,brush:A.value,"chart-data":v.value,"chart-legend-sort-fn":Tt.value,"chart-tooltip-sort-fn":je.value,coordinator:d.unref(n),"dimension-axes-title":H.value,fill:e.chartOptions.stacked,granularity:Wt.value,"left-y-axis-grid":e.chartOptions.yAxes?.left?.showGrid,"legend-values":d.unref(z),"metric-axes-title":P.value,"metric-unit":E.value,"right-y-axis":F.value,stacked:e.chartOptions.stacked,"synthetics-data-key":e.syntheticsDataKey,threshold:_.value,"time-range-ms":R.value,"tooltip-metric-display":M.value,"tooltip-title":e.tooltipTitle,type:e.chartOptions.type,"zoom-action-items":pn.value,onSelectChartRange:X[0]||(X[0]=te=>i("select-chart-range",te)),onZoomTimeRange:X[1]||(X[1]=te=>i("zoom-time-range",te))},null,8,["brush","chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","coordinator","dimension-axes-title","fill","granularity","left-y-axis-grid","legend-values","metric-axes-title","metric-unit","right-y-axis","stacked","synthetics-data-key","threshold","time-range-ms","tooltip-metric-display","tooltip-title","type","zoom-action-items"])):G.value?(d.openBlock(),d.createBlock(dO,{key:1,annotations:e.showAnnotations,"chart-data":v.value,"chart-legend-sort-fn":Tt.value,"chart-tooltip-sort-fn":je.value,coordinator:d.unref(n),"data-testid":"bar-chart-container","dimension-axes-title":L.value,"legend-values":d.unref(z),"metric-axes-title":P.value,"metric-unit":E.value,orientation:U.value,stacked:e.chartOptions.stacked,"synthetics-data-key":e.syntheticsDataKey,"tooltip-metric-display":M.value,"tooltip-title":e.tooltipTitle},null,8,["annotations","chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","coordinator","dimension-axes-title","legend-values","metric-axes-title","metric-unit","orientation","stacked","synthetics-data-key","tooltip-metric-display","tooltip-title"])):ot.value?(d.openBlock(),d.createBlock(vO,{key:2,"chart-data":v.value,coordinator:d.unref(n),"dataset-colors":e.chartOptions.chartDatasetColors||d.unref(n1),"legend-position":e.legendPosition,"legend-values":d.unref(z),"metric-name":k.value,"metric-unit":E.value,"show-center-metric":e.chartOptions.showCenterMetric,"synthetics-data-key":e.syntheticsDataKey,"tooltip-dimension-display":L.value,"tooltip-metric-display":M.value,"tooltip-title":e.tooltipTitle},null,8,["chart-data","coordinator","dataset-colors","legend-position","legend-values","metric-name","metric-unit","show-center-metric","synthetics-data-key","tooltip-dimension-display","tooltip-metric-display","tooltip-title"])):K.value?(d.openBlock(),d.createBlock(OO,{key:3,"chart-data":v.value,"chart-legend-sort-fn":e.chartOptions.chartLegendSortFn,"chart-tooltip-sort-fn":je.value,coordinator:d.unref(n),"data-testid":"scatter-chart-container","dimension-axes-title":pt.value,granularity:Lt.value,"metric-axes-title":P.value,"metric-unit":E.value,"shade-outlier-region":e.chartOptions.scatter?.shadeOutlierRegion,"synthetics-data-key":e.syntheticsDataKey,"theme-colors":w.value,"time-range-ms":R.value,"tooltip-metric-display":M.value,"tooltip-title":e.tooltipTitle,"x-metric":x.value?.xMetric,"x-metric-unit":x.value?.xMetricUnit},null,8,["chart-data","chart-legend-sort-fn","chart-tooltip-sort-fn","coordinator","dimension-axes-title","granularity","metric-axes-title","metric-unit","shade-outlier-region","synthetics-data-key","theme-colors","time-range-ms","tooltip-metric-display","tooltip-title","x-metric","x-metric-unit"])):d.createCommentVNode("",!0)]),_:1},8,["loading"])):(d.openBlock(),d.createBlock(vt,{key:1,"action-button-visible":!1,class:"chart-empty-state","data-testid":"no-data-in-report"},{title:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(dt.value),1)]),default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(rt.value),1)]),_:1}))],2)}}}),GO=Et(qO,[["__scopeId","data-v-ee2e7ab8"]]),XO={class:"chart-parent","data-testid":"gauge-chart-parent"},KO={class:"chart-totals-flex"},ZO={key:1,class:"metric-small","data-testid":"gauge-chart-total"},QO=Et(d.defineComponent({__name:"GaugeChart",props:{chartData:{type:Object,required:!1,default:null},metricDisplay:{type:String,required:!1,default:"hidden"},numerator:{type:Number,required:!1,default:0},syntheticsDataKey:{type:String,required:!1,default:""},datasetColors:{type:Object,required:!1,default:()=>[]},height:{type:String,required:!1,default:"400px",validator:e=>/(\d *)(px|%)/.test(e)},width:{type:String,required:!1,default:"100%",validator:e=>/(\d *)(px|%)/.test(e)}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=d.ref(fr()),s=d.computed(()=>[t.chartData.datasets.reduce((m,p)=>(m.labels.push(p.label),m.borderColor.push(p.backgroundColor),m.backgroundColor.push(p.backgroundColor),m.data.push(p.data.reduce((g,y)=>g+y,0)),m),{labels:[],backgroundColor:[],borderColor:[],data:[]})]),o=d.computed(()=>({...t.chartData,datasets:s.value}));q.useReportChartDataForSynthetics(d.toRef(t,"chartData"),d.toRef(t,"syntheticsDataKey"));const a={responsive:!0,maintainAspectRatio:!0,cutout:"78%",circumference:"200",rotation:"260",plugins:{legend:{display:!1}}},r=d.computed(()=>Ii(s?.value[0]?.data[t.numerator],{capital:!0})),l=d.computed(()=>Ii(s?.value[0]?.data[0]+s?.value[0]?.data[1],{capital:!0})),c=d.computed(()=>`color: ${s?.value[0]?.backgroundColor[t.numerator]}`),u=d.computed(()=>["full","single"].includes(t.metricDisplay)),h=d.computed(()=>t.metricDisplay==="full");return(f,m)=>(d.openBlock(),d.createElementBlock("div",XO,[d.createElementVNode("div",KO,[u.value?(d.openBlock(),d.createElementBlock("div",{key:0,class:"metric-large","data-testid":"gauge-chart-metric",style:d.normalizeStyle(c.value)},d.toDisplayString(r.value),5)):d.createCommentVNode("",!0),h.value?(d.openBlock(),d.createElementBlock("div",ZO,d.toDisplayString(d.unref(n).t("total"))+": "+d.toDisplayString(l.value),1)):d.createCommentVNode("",!0)]),d.createElementVNode("div",{class:"chart-container",style:d.normalizeStyle({height:e.height,width:e.width})},[d.createVNode(d.unref(Jh),{"chart-id":i.value,data:o.value,options:a},null,8,["chart-id","data","options"])],4)]))}}),[["__scopeId","data-v-6e452d92"]]),JO={key:1,class:"single-value-wrapper"},tA={class:"single-value-metric"},eA={class:"name-unit-alignment"},nA={class:"single-value","data-testid":"single-value-chart"},iA={key:0,class:"single-value-unit"},sA={key:0,class:"single-value-metric-name"},oA={key:0,class:"single-value-trend-range","data-testid":"single-value-trend-range"},pr="t1",gr="t2",aA=Et(d.defineComponent({__name:"SingleValue",props:{data:{type:Object,required:!0},decimalPoints:{type:Number,default:2},leftAlign:{type:Boolean,default:!1},showTrend:{type:Boolean,default:!1},increaseIsBad:{type:Boolean,default:!1},alignX:{type:String,default:"left"},compact:{type:Boolean,default:!1},hideMetricName:{type:Boolean,default:!1}},setup(e){const t=q.useFieldLabel(),{i18n:n}=q.useI18n(),{formatBytes:i,formatCost:s}=le({i18n:n}),o=e,a=d.computed(()=>`align-${o.leftAlign?"left":o.alignX}`),r=d.computed(()=>qe.buildDeltaMapping(o.data,o.showTrend,{topLevelKey:pr,secondLevelKey:gr})),l=d.computed(()=>r.value?.previous?.[pr]?.[gr]),c=d.computed(()=>r.value?.current?.[pr]?.[gr]),u=d.computed(()=>o.data.data),h=d.computed(()=>o.data.meta?.metric_names?.[0]),f=d.computed(()=>h.value?t(h.value,{fallback:""}):""),m=d.computed(()=>{const k=h.value?o.data.meta?.metric_units?.[h.value]:void 0;if(k){const C=`chartUnits.${k}`;return n.te(C)?n.t(C,{plural:""}):""}}),p=d.computed(()=>!!h.value&&(h.value.includes("_per_minute")||h.value.includes("_latency_")||h.value==="error_rate")),g=d.computed(()=>o.showTrend&&l.value!==void 0?l.value:null),y=d.computed(()=>{if(o.showTrend)return c.value??null;if(u.value.length<1||!h.value)return null;const k=u.value[0].event[h.value];return typeof k!="number"||isNaN(k)?null:k}),_=d.computed(()=>o.data?.data?.length===void 0||o.data?.data?.length===0||!o.showTrend&&y.value===null||o.showTrend&&g.value===null&&y.value===null),x=d.computed(()=>{const k=y.value;if(k===null)return"-";const C=h.value?o.data.meta?.metric_units?.[h.value]:void 0;if(C==="usd")return s(k);if(C==="bytes")return i(k);if(k>=1e9){const N=(k/1e9).toFixed(1);return N.endsWith(".0")?`${Math.floor(k/1e9)}B`:`${N}B`}if(k>=1e7){const N=(k/1e6).toFixed(1);return N.endsWith(".0")?`${Math.floor(k/1e6)}M`:`${N}M`}const z=o.decimalPoints&&typeof o.decimalPoints=="number"?o.decimalPoints:2;return k.toLocaleString("en-US",{maximumFractionDigits:z})}),T=d.computed(()=>o.showTrend&&o.data?.data?.length<2),S=d.computed(()=>qe.calculateChange(y.value??0,g.value??0)||0),w=d.computed(()=>{if(!o.showTrend)return 0;if(o.data?.data?.length<2){if(l.value===void 0)return 0;if(c.value===void 0)return o.increaseIsBad?1:-1}return qe.changePolarity(S.value,!0,o.increaseIsBad)}),D=d.computed(()=>qe.defineIcon(w.value,o.increaseIsBad)),v=d.computed(()=>{if(o.showTrend&&o.data?.data?.length<2){if(l.value===void 0)return n.t("singleValue.trend.not_available");if(c.value===void 0)return qe.metricChange(-1,!0,n.t("singleValue.trend.not_available"))}return qe.metricChange(S.value,o.data?.data?.length===2,n.t("singleValue.trend.not_available"))}),A=qe.useTrendRange(d.computed(()=>o.showTrend),void 0,d.computed(()=>o.data.meta)),R=k=>k>0?"positive":k<0?"negative":"neutral",E=k=>k>0?tg:k<0?Jp:ml;return d.onMounted(()=>{!o.showTrend&&o.data?.data?.length>1?console.warn("SingleValue chart should only be used with a single data point. Data length:",o.data.data.length):o.showTrend&&o.data?.data?.length>2&&console.warn("SingleValue with trend expects 2 or fewer data points. Instead got:",o.data.data.length)}),(k,C)=>{const z=d.resolveComponent("KEmptyState");return d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["chart-parent",[a.value,{compact:e.compact}]]),"data-testid":"single-value-parent"},[_.value?(d.openBlock(),d.createBlock(z,{key:0,class:"single-value-error","data-testid":"single-value-error","icon-variant":"error",title:d.unref(n).t("singleValue.valueError")},null,8,["title"])):(d.openBlock(),d.createElementBlock("div",JO,[d.createElementVNode("div",tA,[d.createElementVNode("div",eA,[d.createElementVNode("span",nA,d.toDisplayString(x.value),1),p.value&&m.value?(d.openBlock(),d.createElementBlock("span",iA,"  "+d.toDisplayString(m.value),1)):d.createCommentVNode("",!0)]),!e.compact&&!e.hideMetricName?(d.openBlock(),d.createElementBlock("div",sA,d.toDisplayString(f.value),1)):d.createCommentVNode("",!0)]),e.showTrend?(d.openBlock(),d.createElementBlock("div",{key:0,class:d.normalizeClass(["single-value-trend",R(w.value)])},[d.createElementVNode("div",{class:d.normalizeClass(["trend-change",R(w.value)]),"data-testid":"single-value-trend"},[T.value||w.value!==0?(d.openBlock(),d.createBlock(d.resolveDynamicComponent(D.value),{key:0,color:E(w.value),size:`var(--kui-icon-size-30, ${d.unref(vn)})`},null,8,["color","size"])):(d.openBlock(),d.createBlock(d.unref(wt.EqualIcon),{key:1,color:`var(--kui-color-text-neutral-strong, ${d.unref(ml)})`,size:`var(--kui-icon-size-30, ${d.unref(vn)})`},null,8,["color","size"])),d.createElementVNode("div",null,d.toDisplayString(v.value),1)],2),d.unref(A)?(d.openBlock(),d.createElementBlock("div",oA,d.toDisplayString(d.unref(A)),1)):d.createCommentVNode("",!0)],2)):d.createCommentVNode("",!0)]))],2)}}}),[["__scopeId","data-v-8f58f719"]]),rA={class:"simple-chart-shell"},lA={key:1,class:"analytics-chart-parent"},cA=Et(d.defineComponent({__name:"SimpleChart",props:{chartData:{type:Object,required:!0},chartOptions:{type:Object,required:!0},emptyStateTitle:{type:String,required:!1,default:""},syntheticsDataKey:{type:String,required:!1,default:""},height:{type:String,required:!1,default:"400px",validator:e=>/(\d *)(px|%)/.test(e)},width:{type:String,required:!1,default:"100%",validator:e=>/(\d *)(px|%)/.test(e)}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=d.ref(crypto.randomUUID());d.watch(()=>t.chartOptions.type,()=>{i.value=crypto.randomUUID()},{immediate:!0});const s=d.computed(()=>{const u=q.useExploreResultToDatasets({colorPalette:t.chartOptions.chartDatasetColors},d.toRef(t,"chartData"),i.value).value;return t.chartOptions?.reverseDataset&&u?.datasets.reverse(),u}),o=d.computed(()=>t.chartData.meta?.metric_units?Object.values(t.chartData.meta.metric_units)[0]:""),a=d.computed(()=>t.chartOptions.type==="gauge"),r=d.computed(()=>t.chartOptions.type==="single_value"),l=d.computed(()=>t.emptyStateTitle||n.t("noDataAvailableTitle")),c=d.computed(()=>{const u=t.chartData&&t.chartData.meta&&t.chartData.data.length;if(r.value){const h=t.chartData.meta?.metric_names?.[0];return u&&t.chartData.data[0].event[h]!==null}return u});return(u,h)=>{const f=d.resolveComponent("KEmptyState");return d.openBlock(),d.createElementBlock("div",rA,[c.value?(d.openBlock(),d.createElementBlock("div",lA,[a.value?(d.openBlock(),d.createBlock(QO,{key:0,"chart-data":s.value,"dataset-colors":e.chartOptions.chartDatasetColors,"is-simple":"","metric-display":e.chartOptions.metricDisplay,"metric-unit":o.value,numerator:e.chartOptions.numerator,"synthetics-data-key":e.syntheticsDataKey,width:e.width},null,8,["chart-data","dataset-colors","metric-display","metric-unit","numerator","synthetics-data-key","width"])):d.createCommentVNode("",!0),r.value?(d.openBlock(),d.createBlock(aA,{key:1,"align-x":e.chartOptions.alignX,compact:e.chartOptions.compact,data:e.chartData,"decimal-points":e.chartOptions.decimalPoints,"hide-metric-name":e.chartOptions.hideMetricName,"increase-is-bad":e.chartOptions.increaseIsBad,"show-trend":e.chartOptions.showTrend},null,8,["align-x","compact","data","decimal-points","hide-metric-name","increase-is-bad","show-trend"])):d.createCommentVNode("",!0)])):(d.openBlock(),d.createBlock(f,{key:0,"action-button-visible":!0,class:"chart-empty-state","data-testid":"no-data-in-report"},{title:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(l.value),1)]),_:1}))])}}}),[["__scopeId","data-v-a084fd89"]]),dA={class:"container"},uA={key:0,class:"no-data","data-testid":"sparkline-empty"},hA=["title"],fA=Et(d.defineComponent({__name:"SparklineChart",props:{chartKey:{default:()=>{}},datasets:{},disableTooltip:{type:Boolean,default:!1},enableBrushing:{type:Boolean,default:!1},groupKey:{default:()=>{}},maxCount:{default:()=>{}},maxStamp:{default:()=>{}},minCount:{default:()=>{}},minStamp:{default:()=>{}},pointRenderCount:{default:24},showLabel:{type:Boolean,default:!1},tooltipTitle:{default:()=>{}},type:{default:"sparkline_bar"}},setup(e){const t=crypto.randomUUID(),{i18n:n}=q.useI18n(),{syncedGroupSizeMs:i,syncedMinStamp:s,syncedMaxStamp:o,syncedMinCount:a,syncedMaxCount:r,syncedRenderPoints:l,syncedChartDatasets:c}=q.useSparklineSync({chartKey:e.chartKey,datasets:e.datasets,groupKey:e.groupKey,minStamp:e.minStamp,maxStamp:e.maxStamp,minCount:e.minCount,maxCount:e.maxCount,renderPoints:e.pointRenderCount,type:e.type}),u=d.reactive({showTooltip:!1,tooltipContext:0,metricDisplay:"",tooltipSeries:[],left:"",top:"",units:"count",translateUnit:()=>"",offsetX:0,offsetY:0,width:0,height:0,chartType:e.type==="sparkline_bar"?"timeseries_bar":"timeseries_line",chartID:t,interactionMode:"idle"}),h=({width:v,height:A})=>{u.width=v,u.height=A},f=d.computed(()=>e.disableTooltip?[]:[new ef({enableBrushing:e.groupKey!==void 0&&e.chartKey!==void 0&&e.enableBrushing,brushStrategy:"group",brushGroup:e.groupKey})]),m=d.computed(()=>c.value.reduce((v,{data:A,label:R})=>({...v,[R]:A.reduce((E,{y:k})=>E+k,0)}),{})),p=d.computed(()=>c.value.map(({label:v})=>[m.value[v],`${v}: ${m.value[v]}`]).sort(([v],[A])=>A-v).map(([,v])=>v).join(", ")),g=d.computed(()=>Object.keys(m.value).map(v=>m.value[v]).reduce((v,A)=>v+A,0)),y=d.computed(()=>g.value>0),_=d.computed(()=>({labels:new Array(l.value).fill(""),datasets:c.value})),x=d.computed(()=>e.datasets.length>1),T=`SparklineTooltipPosition-${t}`,S=d.computed(()=>{const v=e.type==="sparkline_bar",A=v?s.value-1:s.value,R=v?o.value:o.value-i.value;return{maintainAspectRatio:!1,elements:{categoryPercentage:1,barPercentage:1,line:{tension:0,stepped:e.type==="sparkline_step",borderWidth:1},point:{radius:0,pointHitRadius:11,pointHoverRadius:0}},interaction:{intersect:!1,mode:"index"},layout:{padding:{left:v?0:2,right:v?0:2,top:2}},plugins:{legend:{display:!1},tooltip:{enabled:!1,position:T,external:E=>{Ia(u,E,"minutely",{contextFormatter:k=>{const C=k+i.value;let z="";return i.value>1440*60*1e3?z=rs(new Date(C),"MMM dd, yyy hh:mm a"):z=rs(new Date(C),"hh:mm a"),`${Lp(k)} - ${z}`}})}}},scales:{x:{min:A,max:R,type:"timeseries",offset:!1,grid:{display:!1},display:!1,stacked:x.value},y:{min:Math.max(a.value-1,0),max:r.value,grid:{display:!1},display:!1,stacked:x.value}}}}),w=d.ref("0"),D=d.ref("0");return d.onMounted(()=>{Yt.positioners[T]=function(v,A){if(!v.length||u.interactionMode==="interactive"||A.x===null)return!1;const R=10,E=this.chart.canvas.getBoundingClientRect(),k=u.width||this.width,C=u.height||this.height,z=E.top-C>0,N=z?E.top-C-R:E.top+E.height+R,V=E.left>k/2-A.x,Y=Math.max(R,window.innerWidth-R-k),G=Math.min(Y,V?Math.floor(E.left-k/2)+A.x:0+R);return w.value=`${N}px`,D.value=`${G}px`,{x:G,y:N,xAlign:"center",yAlign:z?"top":"bottom"}}}),d.onUnmounted(()=>{Yt.positioners[T]&&delete Yt.positioners[T]}),(v,A)=>(d.openBlock(),d.createElementBlock("div",dA,[y.value?e.type==="sparkline_bar"?(d.openBlock(),d.createBlock(d.unref(Qh),{key:1,"chart-id":d.unref(t),data:_.value,"data-testid":"sparkline-bar",options:S.value,plugins:f.value},null,8,["chart-id","data","options","plugins"])):e.type==="sparkline_line"||e.type==="sparkline_step"?(d.openBlock(),d.createBlock(d.unref(tf),{key:2,"chart-id":d.unref(t),data:_.value,"data-testid":e.type==="sparkline_line"?"sparkline-line":"sparkline-step",options:S.value,plugins:f.value},null,8,["chart-id","data","data-testid","options","plugins"])):d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",uA,[d.renderSlot(v.$slots,"empty",{},()=>[d.createTextVNode(d.toDisplayString(d.unref(n).t("sparkline_no_data")),1)],!0)])),e.disableTooltip?d.createCommentVNode("",!0):(d.openBlock(),d.createBlock(ji,{key:3,"absolute-left":D.value,"absolute-top":w.value,class:"tooltip","data-testid":"sparkline-tooltip",state:u,"tooltip-title":e.tooltipTitle,onDimensions:h},null,8,["absolute-left","absolute-top","state","tooltip-title"])),y.value&&e.showLabel?(d.openBlock(),d.createElementBlock("div",{key:4,class:"label",title:v.$slots.label?"":p.value},[d.renderSlot(v.$slots,"label",{total:g.value,totalByDataset:m.value},()=>[d.createTextVNode(d.toDisplayString(p.value),1)],!0)],8,hA)):d.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-ae8259b6"]]),mA=["data-value"],pA=["title"],gA={class:"top-talkers-cell-metric"},yA={class:"top-talkers-cell-value","data-testid":"top-talkers-cell-value"},bA={key:0,class:"top-talkers-cell-relative","data-testid":"top-talkers-cell-relative"},_A={class:"top-talkers-tooltip","data-testid":"top-talkers-tooltip"},xA={class:"top-talkers-tooltip-title"},wA={class:"top-talkers-tooltip-rows"},kA={class:"top-talkers-tooltip-label"},TA=["data-threshold"],vA=Et(d.defineComponent({__name:"TopTalkersCell",props:{cell:{}},setup(e){return d.useCssVars(t=>({cecbd9f0:t.cell.color,v0d35e6b6:t.cell.tint})),(t,n)=>(d.openBlock(),d.createBlock(d.unref(Zn.KPop),{class:"top-talkers-cell-wrapper",disabled:!e.cell.tooltipRows.length,"hide-caret":"","hide-close-icon":"",placement:"right","popover-timeout":0,style:d.normalizeStyle({flexGrow:e.cell.ratio}),trigger:"hover"},{content:d.withCtx(()=>[d.createElementVNode("div",_A,[d.createElementVNode("div",xA,d.toDisplayString(e.cell.name),1),d.createElementVNode("dl",wA,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(e.cell.tooltipRows,i=>(d.openBlock(),d.createElementBlock(d.Fragment,{key:i.key},[d.createElementVNode("dt",kA,d.toDisplayString(i.label),1),d.createElementVNode("dd",{class:d.normalizeClass(["top-talkers-tooltip-value",i.threshold&&`top-talkers-tooltip-value--${i.threshold}`]),"data-threshold":i.threshold},d.toDisplayString(i.value),11,TA)],64))),128))])])]),default:d.withCtx(()=>[d.createElementVNode("div",{class:d.normalizeClass(["top-talkers-cell",{"top-talkers-cell--other":e.cell.isOther,"top-talkers-cell--empty":e.cell.isEmpty,"top-talkers-cell--deleted":e.cell.deleted}]),"data-testid":"top-talkers-cell","data-value":e.cell.id},[d.createElementVNode("span",{class:"top-talkers-cell-name","data-testid":"top-talkers-cell-name",title:e.cell.name},d.toDisplayString(e.cell.name),9,pA),d.createElementVNode("span",gA,[d.createElementVNode("span",yA,d.toDisplayString(e.cell.display),1),e.cell.relative?(d.openBlock(),d.createElementBlock("span",bA,"("+d.toDisplayString(e.cell.relative)+")",1)):d.createCommentVNode("",!0)])],10,mA)]),_:1},8,["disabled","style"]))}}),[["__scopeId","data-v-73764587"]]),SA=["data-dimension"],MA={class:"top-talkers-column-header"},DA={class:"top-talkers-column-label","data-testid":"top-talkers-column-label"},CA={key:0,class:"top-talkers-column-total","data-testid":"top-talkers-column-total"},OA={key:1,class:"top-talkers-column-empty","data-testid":"top-talkers-column-empty"},AA={key:2,class:"top-talkers-column-cells"},cf=Et(d.defineComponent({__name:"TopTalkersColumn",props:{dimension:{},label:{},data:{},sizeMetric:{},columnOptions:{},isLoading:{type:Boolean}},setup(e){const{i18n:t}=q.useI18n(),{column:n}=q.useTopTalkersData(d.toRef(()=>e.data),d.toRef(()=>e.dimension),d.toRef(()=>e.sizeMetric),d.toRef(()=>e.columnOptions)),i=d.computed(()=>e.label||n.value.label),s=d.computed(()=>t.t("topTalkers.total",{value:n.value.total}));return(o,a)=>(d.openBlock(),d.createElementBlock("div",{class:"top-talkers-column","data-dimension":e.dimension,"data-testid":"top-talkers-column"},[d.createElementVNode("div",MA,[d.createElementVNode("span",DA,d.toDisplayString(i.value),1),!e.isLoading&&d.unref(n).cells.length?(d.openBlock(),d.createElementBlock("span",CA,d.toDisplayString(s.value),1)):d.createCommentVNode("",!0)]),e.isLoading?(d.openBlock(),d.createBlock(d.unref(Zn.KSkeleton),{key:0,"delay-milliseconds":0,"table-columns":1,type:"table"})):d.unref(n).cells.length?(d.openBlock(),d.createElementBlock("div",AA,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(d.unref(n).cells,r=>(d.openBlock(),d.createBlock(vA,{key:r.id,cell:r},null,8,["cell"]))),128))])):(d.openBlock(),d.createElementBlock("div",OA,d.toDisplayString(d.unref(t).t("topTalkers.defaultEmptyStateTitle")),1))],8,SA))}}),[["__scopeId","data-v-e1b08041"]]),PA={class:"top-talkers-card-title","data-testid":"top-talkers-card-title"},EA={key:2,class:"top-talkers-grid","data-testid":"top-talkers-grid"},RA=Et(d.defineComponent({__name:"TopTalkersGrid",props:{title:{default:""},columns:{},sizeMetric:{default:void 0},columnOptions:{default:void 0},emptyStateTitle:{default:""},errorMessage:{default:""},titleTag:{default:"h2"}},setup(e){const t=e,{i18n:n}=q.useI18n(),i=d.useSlots(),s=d.computed(()=>!!i.column),o=d.computed(()=>s.value||t.columns.some(a=>!!a.data?.data?.length||a.isLoading));return(a,r)=>(d.openBlock(),d.createBlock(d.unref(Zn.KCard),{class:"kong-ui-public-top-talkers","title-tag":e.titleTag},d.createSlots({default:d.withCtx(()=>[e.errorMessage?(d.openBlock(),d.createBlock(d.unref(Zn.KEmptyState),{key:0,"action-button-visible":!1,"data-testid":"top-talkers-error-state","icon-variant":"error"},{title:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(d.unref(n).t("topTalkers.defaultErrorStateTitle")),1)]),default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(e.errorMessage),1)]),_:1})):o.value?(d.openBlock(),d.createElementBlock("div",EA,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(e.columns,(l,c)=>d.renderSlot(a.$slots,"column",{key:`${l.dimension}-${c}`,column:l},()=>[d.createVNode(cf,{"column-options":e.columnOptions,data:l.data,dimension:l.dimension,"is-loading":l.isLoading,label:l.label,"size-metric":e.sizeMetric},null,8,["column-options","data","dimension","is-loading","label","size-metric"])],!0)),128))])):(d.openBlock(),d.createBlock(d.unref(Zn.KEmptyState),{key:1,"action-button-visible":!1,"data-testid":"top-talkers-empty-state"},{title:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(e.emptyStateTitle||d.unref(n).t("topTalkers.defaultEmptyStateTitle")),1)]),_:1}))]),_:2},[e.title?{name:"title",fn:d.withCtx(()=>[d.createElementVNode("span",PA,d.toDisplayString(e.title),1)]),key:"0"}:void 0]),1032,["title-tag"]))}}),[["__scopeId","data-v-d5bb8abd"]]),IA={ai_provider:{anthropic:wt.AnthropicIcon,azure:wt.AzureIcon,bedrock:wt.AmazonBedrockIcon,cerebras:wt.CerebrasIcon,cohere:wt.CohereIcon,databricks:wt.DatabricksIcon,deepseek:wt.DeepseekIcon,gemini:wt.GeminiIcon,huggingface:wt.HuggingFaceIcon,llama2:wt.MetaLlamaIcon,mistral:wt.MistralIcon,moonshot:wt.KimiIcon,nvidia:wt.NvidiaIcon,ollama:wt.OllamaIcon,openai:wt.OpenAiIcon,vertex:wt.GoogleVertexIcon,vllm:wt.VllmIcon,xai:wt.GrokIcon}},LA=(e,t)=>{if(!(!e||!t))return IA[e]?.[t.toLowerCase()]},NA=["data-threshold"],BA=Et(d.defineComponent({__name:"TopNMetricBar",props:{ratio:{},threshold:{}},setup(e){d.useCssVars(n=>({v114553bb:d.unref(t)}));const t=pe({discriminator:0});return(n,i)=>(d.openBlock(),d.createElementBlock("span",{class:d.normalizeClass(["top-n-metric-cell-bar",{[`top-n-metric-cell--bar-${e.threshold}`]:!!e.threshold}]),"data-testid":"top-n-metric-cell-bar","data-threshold":e.threshold},[d.createElementVNode("span",{class:"top-n-metric-cell-bar-fill",style:d.normalizeStyle({width:`${e.ratio*100}%`})},null,4)],10,NA))}}),[["__scopeId","data-v-b5b1edfe"]]),FA=["data-threshold"],zA={class:"top-n-metric-cell-value"},UA={key:0,class:"top-n-metric-cell-relative","data-testid":"top-n-metric-cell-relative"},VA=Et(d.defineComponent({__name:"TopNMetricCell",props:{display:{},relative:{},threshold:{},hasBar:{type:Boolean}},setup(e){return(t,n)=>(d.openBlock(),d.createElementBlock("span",{class:d.normalizeClass(["top-n-metric-cell",{"top-n-metric-cell--bar":e.hasBar,[`top-n-metric-cell--text-${e.threshold}`]:!e.hasBar&&!!e.threshold}]),"data-threshold":e.threshold},[d.createElementVNode("span",zA,d.toDisplayString(e.display),1),e.relative?(d.openBlock(),d.createElementBlock("span",UA,"("+d.toDisplayString(e.relative)+")",1)):d.createCommentVNode("",!0)],10,FA))}}),[["__scopeId","data-v-17e7f860"]]),HA={class:"top-n-card-title","data-testid":"top-n-card-title"},$A={class:"top-n-card-description","data-testid":"top-n-card-description"},YA={key:3,class:"top-n-table","data-testid":"top-n-table"},WA={"data-testid":"top-n-table-header"},jA={class:"top-n-table-header-row"},qA=["colspan"],GA={class:"table-header-label"},XA=["data-testid"],KA={class:"top-n-table-cell-label"},ZA={key:0,class:"top-n-table-cell top-n-table-cell-bar"},QA=3,JA=Et(d.defineComponent({__name:"TopNTable",props:{title:{default:""},description:{default:""},data:{},emptyStateTitle:{default:""},isLoading:{type:Boolean,default:!1},titleTag:{default:"h2"},columnOptions:{default:void 0}},setup(e){const t=e,{i18n:n}=q.useI18n(),{formatUnit:i}=le({i18n:n}),s=q.useFieldLabel(),o=d.computed(()=>t.data.data),a=d.computed(()=>!!o.value?.length),r=d.computed(()=>t.data.meta?.display?Object.keys(t.data.meta.display).slice(0,QA):[]),l=d.computed(()=>r.value[0]||""),c=d.computed(()=>r.value.length>1),u=d.computed(()=>r.value[r.value.length-1]||""),h=d.computed(()=>l.value?t.data.meta.display[l.value]:{}),f=d.computed(()=>t.data.meta?.metric_names?.length?t.data.meta.metric_names:[]),m=d.computed(()=>f.value[0]),p=d.computed(()=>m.value?s(m.value):""),g=d.computed(()=>{const M=r.value.map(P=>({key:P,columnKey:P,label:st(P,c.value?s(P):n.t("topNTable.nameLabel")),type:"dimension"}));return m.value&&M.push({key:"value",columnKey:m.value,label:st(m.value,p.value),type:"metric"}),f.value.forEach((P,F)=>{F!==0&&M.push({key:P,columnKey:P,label:st(P,s(P)),type:"metric"})}),M}),y=d.computed(()=>g.value.filter(M=>M.type==="metric")),_=d.computed(()=>g.value.filter(M=>M.type==="dimension").slice(1)),x=M=>M.type==="dimension"&&M.key===u.value,T=M=>M.type==="metric"&&!!ln(t.columnOptions,M.columnKey)?.bar,S=M=>c.value&&M.type==="dimension"&&!x(M),w=M=>{const P=M.event;return String(P[l.value])},D=(M,P)=>{const F=String(M.event[P]),$=t.data.meta?.display?.[P]?.[F];return{dimension:P,id:F,name:$?.name||"-",deleted:!!$?.deleted}},v=M=>{const P=w(M),F=h.value&&h.value[P];return F?F.name:"-"},A=M=>{const P=w(M),F=h.value&&h.value[P];return F?!!F.deleted:!1},R=M=>{const P=F=>i(F,"%",{translateUnit:$=>U($,F)});return M>0&&M<.01?`< ${P(.01)}`:P(M)},E=(M,P)=>{const F=M.event[P];if(F==null)return"–";const $=typeof F=="number"?F:Number(F);if(Number.isNaN($))return"–";const it=t.data.meta?.metric_units?.[P]||"count";if(it==="%")return R($);const L=["count","count/minute","token count"].includes(it);return i($,it,{approximate:L,isBytes1024:!0,translateUnit:H=>U(H,$)})},k=d.computed(()=>Object.fromEntries(f.value.map(M=>[M,Pa(o.value.map(P=>Bn(P.event[M])))]))),C=(M,P)=>{const F=ln(t.columnOptions,P),$=Bn(M.event[P]);if(!F||$===null)return{display:E(M,P)};const it=k.value[P],L=F.value==="relative"?Ea($,it):null;return{display:E(M,P),relative:L===null?void 0:R(L*100),barRatio:F.bar?Su($,it,F.bar):void 0,threshold:Ra($,F.thresholds)}},z=d.computed(()=>o.value?.length?o.value.map(M=>{const P=r.value.map(L=>D(M,L)),F=P[0],$=F?.id||w(M),it={id:$,rowKey:P.map(L=>`${L.dimension}:${L.id}`).join("|")||$,name:F?.name||v(M),deleted:A(M),dimensions:P,metrics:{},original:M};return f.value.forEach((L,H)=>{it.metrics[H===0?"value":L]=C(M,L)}),it}):[]),N=d.computed(()=>{if(!a.value)return"";if(t.data.meta){if(r.value.some(M=>!Object.keys(t.data.meta.display[M]||{}).length))return n.t("topNTable.errors.display");if(!m.value)return n.t("topNTable.errors.metricNames")}else return n.t("topNTable.errors.meta");return""}),V=(M,P)=>M.metrics[P]??{display:"–"},Y=(M,P)=>M.dimensions.find(F=>F.dimension===P)?.id||"",G=(M,P)=>LA(ln(t.columnOptions,M)?.icon_set,P),st=(M,P)=>M&&ln(t.columnOptions,M)?.label||P,ot=(M,P)=>M.dimensions.find(F=>F.dimension===P)?.name||"–",K=(M,P)=>{const F=M.dimensions.find($=>$.dimension===P);return{id:F?.id||"",name:F?.name||"–",deleted:F?.deleted||!1,dimension:P,dimensions:M.dimensions,isEmpty:F?.id==="empty"}},U=(M,P)=>{if(zi(M)||M==="count"||M==="requests")return"";const F=P===1?"":"s";return n.te(`chartUnits.${M}`)?n.t(`chartUnits.${M}`,{plural:F}):M};return(M,P)=>{const F=d.resolveComponent("KEmptyState"),$=d.resolveComponent("KSkeleton"),it=d.resolveComponent("KCard");return d.openBlock(),d.createBlock(it,{class:"kong-ui-public-top-n-table","title-tag":e.titleTag},d.createSlots({default:d.withCtx(()=>[N.value?(d.openBlock(),d.createBlock(F,{key:0,"action-button-visible":!1,"data-testid":"top-n-error-state","icon-variant":"error"},{title:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(d.unref(n).t("topNTable.defaultErrorStateTitle")),1)]),default:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(N.value),1)]),_:1})):e.isLoading?(d.openBlock(),d.createBlock($,{key:1,"table-columns":2,type:"table"})):a.value?(d.openBlock(),d.createElementBlock("div",YA,[d.createElementVNode("table",{class:d.normalizeClass(["top-n-table-table",{"top-n-table-table--multi-dimension":c.value}])},[d.createElementVNode("thead",WA,[d.createElementVNode("tr",jA,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(g.value,L=>(d.openBlock(),d.createElementBlock("th",{key:L.key,class:d.normalizeClass(["top-n-table-header-cell",{"top-n-table-header-cell-metric":L.type==="metric","top-n-table-header-cell-dimension-compact":S(L)}]),colspan:T(L)?2:void 0,"data-testid":"top-n-table-header-column"},[d.createElementVNode("span",GA,d.toDisplayString(L.label),1),P[0]||(P[0]=d.createElementVNode("div",{class:"top-n-table-header-cell-border"},null,-1))],10,qA))),128))])]),d.createElementVNode("tbody",null,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(z.value,L=>(d.openBlock(),d.createElementBlock("tr",{key:L.rowKey,class:"top-n-table-row"},[r.value.length?(d.openBlock(),d.createElementBlock("td",{key:0,class:d.normalizeClass(["top-n-table-cell top-n-table-cell--name",{"top-n-table-cell-dimension-compact":c.value}])},[d.createElementVNode("span",{class:"top-n-table-cell-label","data-testid":`row-${L.id}`},[G(l.value,L.id)?(d.openBlock(),d.createBlock(d.resolveDynamicComponent(G(l.value,L.id)),{key:0,class:"top-n-table-cell-icon","data-testid":"top-n-table-cell-icon",decorative:"",size:`var(--kui-icon-size-30, ${d.unref(vn)})`},null,8,["size"])):d.createCommentVNode("",!0),d.renderSlot(M.$slots,"name",{record:{id:L.id,name:L.name,deleted:L.deleted,dimension:l.value,dimensions:L.dimensions,isEmpty:L.id==="empty"}},()=>[d.createTextVNode(d.toDisplayString(L.name),1)],!0)],8,XA)],2)):d.createCommentVNode("",!0),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(_.value,H=>(d.openBlock(),d.createElementBlock("td",{key:H.key,class:d.normalizeClass(["top-n-table-cell top-n-table-cell--dimension",{"top-n-table-cell-dimension-compact":!x(H)}])},[d.createElementVNode("span",KA,[G(H.key,Y(L,H.key))?(d.openBlock(),d.createBlock(d.resolveDynamicComponent(G(H.key,Y(L,H.key))),{key:0,class:"top-n-table-cell-icon","data-testid":"top-n-table-cell-icon",decorative:"",size:`var(--kui-icon-size-30, ${d.unref(vn)})`},null,8,["size"])):d.createCommentVNode("",!0),d.renderSlot(M.$slots,"name",{record:K(L,H.key)},()=>[d.createTextVNode(d.toDisplayString(ot(L,H.key)),1)],!0)])],2))),128)),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(y.value,H=>(d.openBlock(),d.createElementBlock(d.Fragment,{key:H.key},[d.createElementVNode("td",{class:d.normalizeClass(["top-n-table-cell top-n-table-cell-metric",{"top-n-table-cell-metric--has-bar":T(H)}])},[d.createVNode(VA,{"data-testid":H.key==="value"?`row-${L.id}`:`row-${L.id}-${H.key}`,display:V(L,H.key).display,"has-bar":T(H),relative:V(L,H.key).relative,threshold:V(L,H.key).threshold},null,8,["data-testid","display","has-bar","relative","threshold"])],2),T(H)?(d.openBlock(),d.createElementBlock("td",ZA,[d.createVNode(BA,{ratio:V(L,H.key).barRatio??0,threshold:V(L,H.key).threshold},null,8,["ratio","threshold"])])):d.createCommentVNode("",!0)],64))),128))]))),128))])],2)])):(d.openBlock(),d.createBlock(F,{key:2,"action-button-visible":!1,"data-testid":"top-n-empty-state"},{title:d.withCtx(()=>[d.createTextVNode(d.toDisplayString(e.emptyStateTitle||d.unref(n).t("topNTable.defaultEmptyStateTitle")),1)]),_:1}))]),_:2},[e.title?{name:"title",fn:d.withCtx(()=>[d.createElementVNode("span",HA,d.toDisplayString(e.title),1)]),key:"0"}:void 0,e.description?{name:"actions",fn:d.withCtx(()=>[d.createElementVNode("div",$A,d.toDisplayString(e.description),1)]),key:"1"}:void 0]),1032,["title-tag"])}}}),[["__scopeId","data-v-f3df2bb7"]]);et.AnalyticsChart=GO,et.ChartLegendPosition=Nt,et.DECIMAL_DISPLAY=YM,et.FONT_SIZE_REGULAR=Pu,et.FONT_SIZE_SMALL=Au,et.LEFT_Y_AXIS_ID=Gs,et.LoadingOverlay=lf,et.MAX_LABEL_LENGTH=qs,et.OTHER_DIMENSION_ID=mo,et.RIGHT_Y_AXIS_ID=Na,et.SimpleChart=cA,et.SparklineChart=fA,et.TopNTable=JA,et.TopTalkersColumn=cf,et.TopTalkersGrid=RA,et.chartTypes=Y1,et.exploreResultToScatterData=Zu,et.formatChartTicksByGranularity=Ga,et.getBarRatio=Su,et.getColumnOptions=ln,et.getColumnStats=Pa,et.getRelativeValue=Ea,et.getThresholdType=Ra,et.handleQueryError=L1,et.isCancellationError=Xu,et.isScatterChartData=Za,et.lookupStatusCodeColor=Ru,et.requestsToScatterData=V1,et.simpleChartMetricDisplay=$1,et.simpleChartTypes=W1,et.toNumber=Bn,Object.defineProperty(et,Symbol.toStringTag,{value:"Module"})}));